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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
93c0bb80
Commit
93c0bb80
authored
Apr 28, 2016
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed issue with selected date not loading correctly
Added loading icon to selected date box
parent
bef5695a
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
49 additions
and
53 deletions
+49
-53
app/assets/javascripts/calendar.js.coffee
app/assets/javascripts/calendar.js.coffee
+24
-20
app/assets/stylesheets/framework/calendar.scss
app/assets/stylesheets/framework/calendar.scss
+2
-14
app/views/users/calendar_activities.html.haml
app/views/users/calendar_activities.html.haml
+23
-19
No files found.
app/assets/javascripts/calendar.js.coffee
View file @
93c0bb80
class
@
Calendar
constructor
:
(
timestamps
,
calendar_activities_path
)
->
currentSelectedDate
=
''
daySpace
=
1
daySize
=
15
daySizeWithSpace
=
daySize
+
(
daySpace
*
2
)
# Get the highest value from the timestampes
highestValue
=
0
_
.
each
timestamps
,
(
count
)
->
...
...
@@ -51,7 +55,7 @@ class @Calendar
months
=
[]
svg
=
d3
.
select
'.js-contrib-calendar'
.
append
'svg'
.
attr
'width'
,
54
*
17
.
attr
'width'
,
54
*
daySizeWithSpace
.
attr
'height'
,
167
.
attr
'class'
,
'contrib-calendar'
...
...
@@ -64,7 +68,7 @@ class @Calendar
_
.
each
group
,
(
stamp
,
a
)
->
if
a
is
0
and
stamp
.
day
is
0
month
=
stamp
.
date
.
getMonth
()
x
=
(
17
*
i
+
1
)
+
17
x
=
(
daySizeWithSpace
*
i
+
1
)
+
daySizeWithSpace
lastMonth
=
_
.
last
(
months
)
if
lastMonth
?
lastMonthX
=
lastMonth
.
x
...
...
@@ -73,12 +77,12 @@ class @Calendar
months
.
push
month
:
month
x
:
x
else
if
month
isnt
lastMonth
.
month
and
x
-
17
isnt
lastMonthX
else
if
month
isnt
lastMonth
.
month
and
x
-
daySizeWithSpace
isnt
lastMonthX
months
.
push
month
:
month
x
:
x
"translate(
#{
(
17
*
i
+
1
)
+
17
}
, 18)"
"translate(
#{
(
daySizeWithSpace
*
i
+
1
)
+
daySizeWithSpace
}
, 18)"
.
selectAll
'rect'
.
data
(
stamp
)
->
stamp
...
...
@@ -86,9 +90,9 @@ class @Calendar
.
append
'rect'
.
attr
'x'
,
'0'
.
attr
'y'
,
(
stamp
,
i
)
->
(
17
*
stamp
.
day
)
.
attr
'width'
,
15
.
attr
'height'
,
15
(
daySizeWithSpace
*
stamp
.
day
)
.
attr
'width'
,
daySize
.
attr
'height'
,
daySize
.
attr
'title'
,
(
stamp
)
->
contribText
=
'No contributions'
...
...
@@ -106,22 +110,22 @@ class @Calendar
'#ededed'
.
attr
'data-container'
,
'body'
.
on
'click'
,
(
stamp
)
->
if
currentSelectedDate
is
''
if
currentSelectedDate
is
nt
stamp
.
date
currentSelectedDate
=
stamp
.
date
formated_date
=
currentSelectedDate
.
getFullYear
()
+
"-"
+
(
currentSelectedDate
.
getMonth
()
+
1
)
+
"-"
+
currentSelectedDate
.
getDate
()
format
t
ed_date
=
currentSelectedDate
.
getFullYear
()
+
"-"
+
(
currentSelectedDate
.
getMonth
()
+
1
)
+
"-"
+
currentSelectedDate
.
getDate
()
$
.
ajax
url
:
calendar_activities_path
data
:
date
:
formated_date
date
:
format
t
ed_date
cache
:
false
dataType
:
'html'
beforeSend
:
->
$
(
'.user-calendar-activities'
).
html
'<div class="text-center"><i class="fa fa-spinner fa-spin user-calendar-activities-loading"></i></div>'
success
:
(
data
)
->
$
(
'.user-calendar-activities'
).
html
data
else
currentSelectedDate
=
''
$
(
'.user-calendar-activities, .content_list'
).
html
''
Pager
.
getOld
()
$
(
'.user-calendar-activities'
).
html
''
# Month titles
svg
.
append
'g'
...
...
@@ -139,13 +143,13 @@ class @Calendar
# Day titles
days
=
[{
text
:
'M'
y
:
29
+
(
17
*
1
)
y
:
29
+
(
daySizeWithSpace
*
1
)
},
{
text
:
'W'
y
:
29
+
(
17
*
3
)
y
:
29
+
(
daySizeWithSpace
*
3
)
},
{
text
:
'F'
y
:
29
+
(
17
*
5
)
y
:
29
+
(
daySizeWithSpace
*
5
)
}]
svg
.
append
'g'
.
selectAll
'text'
...
...
@@ -162,15 +166,15 @@ class @Calendar
# Key with color boxes
svg
.
append
'g'
.
attr
'transform'
,
"translate(18,
#{
17
*
8
+
16
}
)"
.
attr
'transform'
,
"translate(18,
#{
daySizeWithSpace
*
8
+
16
}
)"
.
selectAll
'rect'
.
data
keyColors
.
enter
()
.
append
'rect'
.
attr
'width'
,
15
.
attr
'height'
,
15
.
attr
'width'
,
daySize
.
attr
'height'
,
daySize
.
attr
'x'
,
(
color
,
i
)
->
17
*
i
daySizeWithSpace
*
i
.
attr
'y'
,
0
.
attr
'fill'
,
(
color
)
->
color
...
...
app/assets/stylesheets/framework/calendar.scss
View file @
93c0bb80
...
...
@@ -5,24 +5,12 @@
}
.user-calendar-activities
{
.calendar_onclick_hr
{
padding
:
0
;
margin
:
10px
0
;
}
.str-truncated
{
max-width
:
70%
;
}
.text-expander
{
background
:
#eee
;
color
:
#555
;
padding
:
0
5px
;
cursor
:
pointer
;
margin-left
:
4px
;
&
:hover
{
background-color
:
#ddd
;
}
.user-calendar-activities-loading
{
font-size
:
24px
;
}
}
...
...
app/views/users/calendar_activities.html.haml
View file @
93c0bb80
%h4
.prepend-top-20
%span
.light
Contributions for
Contributions for
%strong
#{
@calendar_date
.
to_s
(
:short
)
}
%ul
.bordered-list
-
@events
.
sort_by
(
&
:created_at
).
each
do
|
event
|
%li
%span
.light
%i
.fa.fa-clock-o
=
event
.
created_at
.
to_s
(
:time
)
-
if
event
.
push?
#{
event
.
action_name
}
#{
event
.
ref_type
}
#{
event
.
ref_name
}
-
else
=
event_action_name
(
event
)
-
if
event
.
target
%strong
=
link_to
"#
#{
event
.
target_iid
}
"
,
[
event
.
project
.
namespace
.
becomes
(
Namespace
),
event
.
project
,
event
.
target
]
at
%strong
-
if
event
.
project
=
link_to_project
event
.
project
-
if
@events
.
any?
%ul
.bordered-list
-
@events
.
sort_by
(
&
:created_at
).
each
do
|
event
|
%li
%span
.light
%i
.fa.fa-clock-o
=
event
.
created_at
.
to_s
(
:time
)
-
if
event
.
push?
#{
event
.
action_name
}
#{
event
.
ref_type
}
#{
event
.
ref_name
}
-
else
=
event
.
project_name
=
event_action_name
(
event
)
-
if
event
.
target
%strong
=
link_to
"#
#{
event
.
target_iid
}
"
,
[
event
.
project
.
namespace
.
becomes
(
Namespace
),
event
.
project
,
event
.
target
]
at
%strong
-
if
event
.
project
=
link_to_project
event
.
project
-
else
=
event
.
project_name
-
else
%p
No contributions found for
#{
@calendar_date
.
to_s
(
:short
)
}
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