Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Tatuya Kamada
gitlab-ce
Commits
36fdbc6e
Commit
36fdbc6e
authored
Apr 26, 2016
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updated contrib map away from cal heat map
parent
78a67fc4
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
114 additions
and
24 deletions
+114
-24
app/assets/javascripts/calendar.js.coffee
app/assets/javascripts/calendar.js.coffee
+84
-22
app/assets/stylesheets/framework/calendar.scss
app/assets/stylesheets/framework/calendar.scss
+30
-0
app/views/users/calendar.html.haml
app/views/users/calendar.html.haml
+0
-2
No files found.
app/assets/javascripts/calendar.js.coffee
View file @
36fdbc6e
class
@
Calendar
class
@
Calendar
constructor
:
(
timestamps
,
starting_year
,
starting_month
,
calendar_activities_path
)
->
constructor
:
(
timestamps
,
starting_year
,
starting_month
,
calendar_activities_path
)
->
cal
=
new
CalHeatMap
()
# Get the highest value from the timestampes
cal
.
init
highestValue
=
0
itemName
:
[
"contribution"
]
_
.
each
timestamps
,
(
count
)
->
data
:
timestamps
if
count
>
highestValue
start
:
new
Date
(
starting_year
,
starting_month
)
highestValue
=
count
domainLabelFormat
:
"%b"
id
:
"cal-heatmap"
timestamps
=
_
.
chain
(
timestamps
)
domain
:
"month"
.
map
(
stamp
,
key
)
->
subDomain
:
"day"
{
range
:
12
count
:
stamp
tooltip
:
true
date
:
key
label
:
}
position
:
"top"
.
groupBy
(
stamp
,
i
)
->
legend
:
[
Math
.
floor
i
/
7
0
.
toArray
()
10
.
value
()
20
30
monthNames
=
[
'Jan'
,
'Feb'
,
'Mar'
,
'Apr'
,
'May'
,
'Jun'
,
'Jul'
,
'Aug'
,
'Sep'
,
'Oct'
,
'Nov'
,
'Dec'
]
]
months
=
[]
legendCellPadding
:
3
svg
=
d3
.
select
'#cal-heatmap'
cellSize
:
$
(
'.user-calendar'
).
width
()
/
73
.
append
'svg'
onClick
:
(
date
,
count
)
->
.
attr
'width'
,
53
*
17
.
attr
'height'
,
140
# Setup each day box
svg
.
selectAll
'g'
.
data
timestamps
.
enter
()
.
append
'g'
.
attr
'transform'
,
(
group
,
i
)
->
_
.
each
group
,
(
stamp
)
->
month
=
new
Date
(
parseInt
(
stamp
.
date
)
*
1000
).
getMonth
()
x
=
17
*
i
+
1
lastMonth
=
_
.
last
(
months
)
# If undefined, push
if
!
lastMonth
?
months
.
push
month
:
month
x
:
x
else
if
lastMonth
.
x
is
x
lastMonth
.
month
=
month
else
if
lastMonth
.
month
isnt
month
months
.
push
month
:
month
x
:
x
"translate(
#{
17
*
i
+
1
}
, 18)"
.
selectAll
'rect'
.
data
(
stamp
)
->
stamp
.
enter
()
.
append
'rect'
.
attr
'x'
,
'0'
.
attr
'y'
,
(
stamp
,
i
)
->
17
*
i
.
attr
'width'
,
15
.
attr
'height'
,
15
.
attr
'title'
,
(
stamp
)
->
"
#{
stamp
.
count
}
contributions<br />
#{
gl
.
utils
.
formatDate
parseInt
(
stamp
.
date
)
*
1000
}
"
.
attr
'class'
,
(
stamp
)
->
extraClass
=
''
if
stamp
.
count
isnt
0
diff
=
stamp
.
count
/
highestValue
classNumber
=
Math
.
floor
(
diff
/
0.25
)
+
1
extraClass
+=
"user-contrib-cell-
#{
classNumber
}
"
"user-contrib-cell
#{
extraClass
}
js-tooltip"
.
attr
'data-container'
,
'body'
.
on
'click'
,
(
stamp
)
->
date
=
new
Date
(
parseInt
(
stamp
.
date
)
*
1000
)
formated_date
=
date
.
getFullYear
()
+
"-"
+
(
date
.
getMonth
()
+
1
)
+
"-"
+
date
.
getDate
()
formated_date
=
date
.
getFullYear
()
+
"-"
+
(
date
.
getMonth
()
+
1
)
+
"-"
+
date
.
getDate
()
$
.
ajax
$
.
ajax
url
:
calendar_activities_path
url
:
calendar_activities_path
...
@@ -32,3 +80,17 @@ class @Calendar
...
@@ -32,3 +80,17 @@ class @Calendar
success
:
(
data
)
->
success
:
(
data
)
->
$
(
".user-calendar-activities"
).
html
data
$
(
".user-calendar-activities"
).
html
data
svg
.
append
'g'
.
selectAll
'text'
.
data
months
.
enter
()
.
append
'text'
.
attr
'x'
,
(
date
)
->
date
.
x
.
attr
'y'
,
10
.
attr
'class'
,
'user-contrib-text'
.
text
(
date
)
->
monthNames
[
date
.
month
]
$
(
'#cal-heatmap .js-tooltip'
).
tooltip
html
:
true
app/assets/stylesheets/framework/calendar.scss
View file @
36fdbc6e
...
@@ -68,3 +68,33 @@
...
@@ -68,3 +68,33 @@
font-weight
:
550
;
font-weight
:
550
;
}
}
}
}
.user-contrib-cell
{
fill
:
#ededed
;
cursor
:
pointer
;
&
:hover
{
stroke
:
#000
;
}
}
.user-contrib-cell-1
{
fill
:
#acd5f2
;
}
.user-contrib-cell-3
{
fill
:
#7fa8d1
;
}
.user-contrib-cell-4
{
fill
:
#49729b
;
}
.user-contrib-cell-5
{
fill
:
#254e77
;
}
.user-contrib-text
{
font-size
:
12px
;
fill
:
#959494
;
}
app/views/users/calendar.html.haml
View file @
36fdbc6e
...
@@ -6,5 +6,3 @@
...
@@ -6,5 +6,3 @@
#{
@starting_month
}
,
#{
@starting_month
}
,
'
#{
user_calendar_activities_path
}
'
'
#{
user_calendar_activities_path
}
'
);
);
.calendar-hint
Summary of issues, merge requests, and push events
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment