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
0
Merge Requests
0
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
Boxiang Sun
gitlab-ce
Commits
c5ef0c60
Commit
c5ef0c60
authored
May 02, 2014
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'improve-admin-projects-page' into 'master'
Improve admin projects page Add dropdown for project sorting
parents
9dfc4fe6
c608a5dc
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
0 deletions
+25
-0
app/controllers/admin/projects_controller.rb
app/controllers/admin/projects_controller.rb
+1
-0
app/models/project.rb
app/models/project.rb
+1
-0
app/views/admin/projects/index.html.haml
app/views/admin/projects/index.html.haml
+23
-0
No files found.
app/controllers/admin/projects_controller.rb
View file @
c5ef0c60
...
@@ -12,6 +12,7 @@ class Admin::ProjectsController < Admin::ApplicationController
...
@@ -12,6 +12,7 @@ class Admin::ProjectsController < Admin::ApplicationController
@projects
=
@projects
.
with_push
if
params
[
:with_push
].
present?
@projects
=
@projects
.
with_push
if
params
[
:with_push
].
present?
@projects
=
@projects
.
abandoned
if
params
[
:abandoned
].
present?
@projects
=
@projects
.
abandoned
if
params
[
:abandoned
].
present?
@projects
=
@projects
.
search
(
params
[
:name
])
if
params
[
:name
].
present?
@projects
=
@projects
.
search
(
params
[
:name
])
if
params
[
:name
].
present?
@projects
=
@projects
.
sort
(
@sort
=
params
[
:sort
])
@projects
=
@projects
.
includes
(
:namespace
).
order
(
"namespaces.path, projects.name ASC"
).
page
(
params
[
:page
]).
per
(
20
)
@projects
=
@projects
.
includes
(
:namespace
).
order
(
"namespaces.path, projects.name ASC"
).
page
(
params
[
:page
]).
per
(
20
)
end
end
...
...
app/models/project.rb
View file @
c5ef0c60
...
@@ -203,6 +203,7 @@ class Project < ActiveRecord::Base
...
@@ -203,6 +203,7 @@ class Project < ActiveRecord::Base
when
'oldest'
then
reorder
(
'projects.created_at ASC'
)
when
'oldest'
then
reorder
(
'projects.created_at ASC'
)
when
'recently_updated'
then
reorder
(
'projects.updated_at DESC'
)
when
'recently_updated'
then
reorder
(
'projects.updated_at DESC'
)
when
'last_updated'
then
reorder
(
'projects.updated_at ASC'
)
when
'last_updated'
then
reorder
(
'projects.updated_at ASC'
)
when
'largest_repository'
then
reorder
(
'projects.repository_size DESC'
)
else
reorder
(
"namespaces.path, projects.name ASC"
)
else
reorder
(
"namespaces.path, projects.name ASC"
)
end
end
end
end
...
...
app/views/admin/projects/index.html.haml
View file @
c5ef0c60
...
@@ -32,6 +32,7 @@
...
@@ -32,6 +32,7 @@
=
visibility_level_icon
(
level
)
=
visibility_level_icon
(
level
)
=
label
=
label
.form-actions
.form-actions
=
hidden_field_tag
:sort
,
params
[
:sort
]
=
submit_tag
"Search"
,
class:
"btn submit btn-primary"
=
submit_tag
"Search"
,
class:
"btn submit btn-primary"
=
link_to
"Reset"
,
admin_projects_path
,
class:
"btn"
=
link_to
"Reset"
,
admin_projects_path
,
class:
"btn"
...
@@ -40,6 +41,28 @@
...
@@ -40,6 +41,28 @@
.title
.title
Projects (
#{
@projects
.
total_count
}
)
Projects (
#{
@projects
.
total_count
}
)
.pull-right
.pull-right
.dropdown.inline
%a
.dropdown-toggle.btn
{
href:
'#'
,
"data-toggle"
=>
"dropdown"
}
%span
.light
sort:
-
if
@sort
.
present?
=
@sort
.
humanize
-
else
Name
%b
.caret
%ul
.dropdown-menu
%li
=
link_to
admin_projects_path
(
sort:
nil
)
do
Name
=
link_to
admin_projects_path
(
sort:
'newest'
)
do
Newest
=
link_to
admin_projects_path
(
sort:
'oldest'
)
do
Oldest
=
link_to
admin_projects_path
(
sort:
'recently_updated'
)
do
Recently updated
=
link_to
admin_projects_path
(
sort:
'last_updated'
)
do
Last updated
=
link_to
admin_projects_path
(
sort:
'largest_repository'
)
do
Largest repository
=
link_to
'New Project'
,
new_project_path
,
class:
"btn btn-new"
=
link_to
'New Project'
,
new_project_path
,
class:
"btn btn-new"
%ul
.well-list
%ul
.well-list
-
@projects
.
each
do
|
project
|
-
@projects
.
each
do
|
project
|
...
...
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