diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2015-03-23 19:45:40 +0300 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2015-03-23 19:45:40 +0300 |
commit | c5d65ed62f637a91b6ea9554db57e4e74bab9cb3 (patch) | |
tree | 77c5916fe44afc5147179abcb153ecfbd1e1804a /app | |
parent | 81d603e2c1be5b45a623eec4f5ea9a70abcc676c (diff) | |
parent | fee1f2e0ab0336e6746aae8e9ed76549c6ac3353 (diff) |
Merge branch 'userpage-activity-scroll'
Conflicts:
app/controllers/users_controller.rb
Diffstat (limited to 'app')
-rw-r--r-- | app/assets/javascripts/dispatcher.js.coffee | 1 | ||||
-rw-r--r-- | app/controllers/users_controller.rb | 25 | ||||
-rw-r--r-- | app/views/users/show.html.haml | 3 |
3 files changed, 22 insertions, 7 deletions
diff --git a/app/assets/javascripts/dispatcher.js.coffee b/app/assets/javascripts/dispatcher.js.coffee index edf482f33d8..deabaf8a784 100644 --- a/app/assets/javascripts/dispatcher.js.coffee +++ b/app/assets/javascripts/dispatcher.js.coffee @@ -97,6 +97,7 @@ class Dispatcher new ProjectFork() when 'users:show' new User() + new Activities() switch path.first() when 'admin' diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index f9b568b8af9..679d6897ce9 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -13,17 +13,21 @@ class UsersController < ApplicationController # Collect only groups common for both users @groups = @user.groups & GroupsFinder.new.execute(current_user) - # Get user activity feed for projects common for both users - @events = @user.recent_events. - where(project_id: authorized_projects_ids). - with_associations.limit(30) - @title = @user.name @title_url = user_path(@user) respond_to do |format| format.html - format.atom { render layout: false } + + format.atom do + load_events + render layout: false + end + + format.json do + load_events + pager_json("events/_events", @events.count) + end end end @@ -81,4 +85,13 @@ class UsersController < ApplicationController @contributions_calendar ||= Gitlab::ContributionsCalendar. new(contributed_projects.reject(&:forked?), @user) end + + def load_events + # Get user activity feed for projects common for both users + @events = @user.recent_events. + where(project_id: authorized_projects_ids). + with_associations + + @events = @events.limit(20).offset(params[:offset] || 0) + end end diff --git a/app/views/users/show.html.haml b/app/views/users/show.html.haml index fd96020d129..0653fb871ae 100644 --- a/app/views/users/show.html.haml +++ b/app/views/users/show.html.haml @@ -40,7 +40,8 @@ %strong %i.fa.fa-rss - = render @events + .content_list + = spinner %aside.col-md-4 = render 'profile', user: @user = render 'projects' |