Refactor UsersController to present personal, contributed and starred projects in the same way
This commit is contained in:
parent
e7c34c37c8
commit
afc2f6a031
1 changed files with 7 additions and 19 deletions
|
@ -57,34 +57,22 @@ class UsersController < ApplicationController
|
||||||
def projects
|
def projects
|
||||||
load_projects
|
load_projects
|
||||||
|
|
||||||
skip_pagination = Gitlab::Utils.to_boolean(params[:skip_pagination])
|
present_projects(@projects)
|
||||||
skip_namespace = Gitlab::Utils.to_boolean(params[:skip_namespace])
|
|
||||||
compact_mode = Gitlab::Utils.to_boolean(params[:compact_mode])
|
|
||||||
|
|
||||||
respond_to do |format|
|
|
||||||
format.html { render 'show' }
|
|
||||||
format.json do
|
|
||||||
pager_json("shared/projects/_list", @projects.count, projects: @projects, skip_pagination: skip_pagination, skip_namespace: skip_namespace, compact_mode: compact_mode)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def contributed
|
def contributed
|
||||||
load_contributed_projects
|
load_contributed_projects
|
||||||
|
|
||||||
respond_to do |format|
|
present_projects(@contributed_projects)
|
||||||
format.html { render 'show' }
|
|
||||||
format.json do
|
|
||||||
render json: {
|
|
||||||
html: view_to_html_string("shared/projects/_list", projects: @contributed_projects)
|
|
||||||
}
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def starred
|
def starred
|
||||||
load_starred_projects
|
load_starred_projects
|
||||||
|
|
||||||
|
present_projects(@starred_projects)
|
||||||
|
end
|
||||||
|
|
||||||
|
def present_projects(projects)
|
||||||
skip_pagination = Gitlab::Utils.to_boolean(params[:skip_pagination])
|
skip_pagination = Gitlab::Utils.to_boolean(params[:skip_pagination])
|
||||||
skip_namespace = Gitlab::Utils.to_boolean(params[:skip_namespace])
|
skip_namespace = Gitlab::Utils.to_boolean(params[:skip_namespace])
|
||||||
compact_mode = Gitlab::Utils.to_boolean(params[:compact_mode])
|
compact_mode = Gitlab::Utils.to_boolean(params[:compact_mode])
|
||||||
|
@ -92,7 +80,7 @@ class UsersController < ApplicationController
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html { render 'show' }
|
format.html { render 'show' }
|
||||||
format.json do
|
format.json do
|
||||||
pager_json("shared/projects/_list", @starred_projects.count, projects: @starred_projects, skip_pagination: skip_pagination, skip_namespace: skip_namespace, compact_mode: compact_mode)
|
pager_json("shared/projects/_list", projects.count, projects: projects, skip_pagination: skip_pagination, skip_namespace: skip_namespace, compact_mode: compact_mode)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue