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
afc2f6a0
Commit
afc2f6a0
authored
Jan 28, 2019
by
Camil Staps
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor UsersController to present personal, contributed and starred projects in the same way
parent
e7c34c37
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
19 deletions
+7
-19
app/controllers/users_controller.rb
app/controllers/users_controller.rb
+7
-19
No files found.
app/controllers/users_controller.rb
View file @
afc2f6a0
...
...
@@ -57,34 +57,22 @@ class UsersController < ApplicationController
def
projects
load_projects
skip_pagination
=
Gitlab
::
Utils
.
to_boolean
(
params
[
:skip_pagination
])
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
present_projects
(
@projects
)
end
def
contributed
load_contributed_projects
respond_to
do
|
format
|
format
.
html
{
render
'show'
}
format
.
json
do
render
json:
{
html:
view_to_html_string
(
"shared/projects/_list"
,
projects:
@contributed_projects
)
}
end
end
present_projects
(
@contributed_projects
)
end
def
starred
load_starred_projects
present_projects
(
@starred_projects
)
end
def
present_projects
(
projects
)
skip_pagination
=
Gitlab
::
Utils
.
to_boolean
(
params
[
:skip_pagination
])
skip_namespace
=
Gitlab
::
Utils
.
to_boolean
(
params
[
:skip_namespace
])
compact_mode
=
Gitlab
::
Utils
.
to_boolean
(
params
[
:compact_mode
])
...
...
@@ -92,7 +80,7 @@ class UsersController < ApplicationController
respond_to
do
|
format
|
format
.
html
{
render
'show'
}
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
...
...
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