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
339baf8f
Commit
339baf8f
authored
Jul 18, 2017
by
Mike Greiling
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor async calendar data
parent
651bf36c
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
27 additions
and
18 deletions
+27
-18
app/assets/javascripts/users/index.js
app/assets/javascripts/users/index.js
+0
-2
app/assets/javascripts/users/user_tabs.js
app/assets/javascripts/users/user_tabs.js
+25
-2
app/controllers/users_controller.rb
app/controllers/users_controller.rb
+1
-4
app/views/users/calendar.html.haml
app/views/users/calendar.html.haml
+0
-9
app/views/users/show.html.haml
app/views/users/show.html.haml
+1
-1
No files found.
app/assets/javascripts/users/index.js
View file @
339baf8f
import
ActivityCalendar
from
'
./activity_calendar
'
;
import
User
from
'
./user
'
;
// use legacy exports until embedded javascript is refactored
window
.
Calendar
=
ActivityCalendar
;
window
.
gl
=
window
.
gl
||
{};
window
.
gl
.
User
=
User
;
app/assets/javascripts/users/user_tabs.js
View file @
339baf8f
/* eslint-disable max-len, space-before-function-paren, no-underscore-dangle, consistent-return, comma-dangle, no-unused-vars, dot-notation, no-new, no-return-assign, camelcase, no-param-reassign, class-methods-use-this */
import
ActivityCalendar
from
'
./activity_calendar
'
;
/*
UserTabs
...
...
@@ -60,6 +62,15 @@ content on the Users#show page.
</div>
*/
const
CALENDAR_TEMPLATE
=
`
<div class="clearfix calendar">
<div class="js-contrib-calendar"></div>
<div class="calendar-hint">
Summary of issues, merge requests, push events, and comments
</div>
</div>
`
;
export
default
class
UserTabs
{
constructor
({
defaultAction
,
action
,
parentEl
})
{
this
.
loaded
=
{};
...
...
@@ -147,9 +158,21 @@ export default class UserTabs {
return
;
}
const
$calendarWrap
=
this
.
$parentEl
.
find
(
'
.user-calendar
'
);
$calendarWrap
.
load
(
$calendarWrap
.
data
(
'
href
'
));
const
calendarPath
=
$calendarWrap
.
data
(
'
calendarPath
'
);
const
calendarActivitiesPath
=
$calendarWrap
.
data
(
'
calendarActivitiesPath
'
);
$
.
ajax
({
dataType
:
'
json
'
,
type
:
'
GET
'
,
url
:
calendarPath
,
success
:
(
activityData
)
=>
{
$calendarWrap
.
html
(
CALENDAR_TEMPLATE
);
new
ActivityCalendar
(
activityData
,
calendarActivitiesPath
);
}
});
new
gl
.
Activities
();
return
this
.
loaded
[
'
activity
'
]
=
true
;
this
.
loaded
[
'
activity
'
]
=
true
;
}
toggleLoading
(
status
)
{
...
...
app/controllers/users_controller.rb
View file @
339baf8f
...
...
@@ -73,10 +73,7 @@ class UsersController < ApplicationController
end
def
calendar
calendar
=
contributions_calendar
@activity_dates
=
calendar
.
activity_dates
render
'calendar'
,
layout:
false
render
json:
contributions_calendar
.
activity_dates
end
def
calendar_activities
...
...
app/views/users/calendar.html.haml
deleted
100644 → 0
View file @
651bf36c
.clearfix.calendar
.js-contrib-calendar
.calendar-hint
Summary of issues, merge requests, push events, and comments
:javascript
new
Calendar
(
#{
@activity_dates
.
to_json
}
,
'
#{
user_calendar_activities_path
}
'
);
app/views/users/show.html.haml
View file @
339baf8f
...
...
@@ -105,7 +105,7 @@
.tab-content
#activity
.tab-pane
.row-content-block.calender-block.white.second-block.hidden-xs
.user-calendar
{
data:
{
href:
user_calendar
_path
}
}
.user-calendar
{
data:
{
calendar_path:
user_calendar_path
(
@user
,
:json
),
calendar_activities_path:
user_calendar_activities
_path
}
}
%h4
.center.light
%i
.fa.fa-spinner.fa-spin
.user-calendar-activities
...
...
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