summaryrefslogtreecommitdiff
path: root/app/controllers/users_controller.rb
diff options
context:
space:
mode:
authorJosh Frye <joshfng@gmail.com>2016-02-24 11:08:00 -0500
committerJosh Frye <joshfng@gmail.com>2016-02-29 08:24:07 -0500
commitcc9f93f9d26a18a7e867384e1e3cf34a3197ba5c (patch)
tree4ad72747512c4e29cb231cf9ace790f4ab5eb8b0 /app/controllers/users_controller.rb
parentcd391b66e9d480c3143b63d32f893c6a1015f04e (diff)
downloadgitlab-ce-cc9f93f9d26a18a7e867384e1e3cf34a3197ba5c.tar.gz
Add routes and actions for dynamic tab loading
Diffstat (limited to 'app/controllers/users_controller.rb')
-rw-r--r--app/controllers/users_controller.rb39
1 files changed, 32 insertions, 7 deletions
diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb
index 6055b606086..6f7021c43fd 100644
--- a/app/controllers/users_controller.rb
+++ b/app/controllers/users_controller.rb
@@ -3,13 +3,6 @@ class UsersController < ApplicationController
before_action :set_user
def show
- @contributed_projects = contributed_projects.joined(@user).reject(&:forked?)
-
- @projects = PersonalProjectsFinder.new(@user).execute(current_user)
- @projects = @projects.page(params[:page]).per(PER_PAGE)
-
- @groups = @user.groups.order_id_desc
-
respond_to do |format|
format.html
@@ -25,6 +18,24 @@ class UsersController < ApplicationController
end
end
+ def groups
+ load_groups
+
+ render 'shared/groups/_list', locals: { groups: @groups }, layout: false
+ end
+
+ def user_projects
+ load_projects
+
+ render 'shared/projects/_list', locals: { projects: @projects, remote: true }, layout: false
+ end
+
+ def user_contributed_projects
+ load_contributed_projects
+
+ render 'shared/projects/_list', locals: { projects: @contributed_projects }, layout: false
+ end
+
def calendar
calendar = contributions_calendar
@timestamps = calendar.timestamps
@@ -69,6 +80,20 @@ class UsersController < ApplicationController
limit_recent(20, params[:offset])
end
+ def load_projects
+ @projects =
+ PersonalProjectsFinder.new(@user).execute(current_user)
+ .page(params[:page]).per(PER_PAGE)
+ end
+
+ def load_contributed_projects
+ @contributed_projects = contributed_projects.joined(@user)
+ end
+
+ def load_groups
+ @groups = @user.groups.order_id_desc
+ end
+
def projects_for_current_user
ProjectsFinder.new.execute(current_user)
end