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
Léo-Paul Géneau
gitlab-ce
Commits
7458437e
Commit
7458437e
authored
Dec 26, 2013
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve sorting for public projects page
Signed-off-by:
Dmitriy Zaporozhets
<
dmitriy.zaporozhets@gmail.com
>
parent
6a0c0f3f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
3 deletions
+6
-3
app/controllers/public/projects_controller.rb
app/controllers/public/projects_controller.rb
+2
-1
app/views/public/projects/index.html.haml
app/views/public/projects/index.html.haml
+4
-2
No files found.
app/controllers/public/projects_controller.rb
View file @
7458437e
...
...
@@ -8,7 +8,8 @@ class Public::ProjectsController < ApplicationController
def
index
@projects
=
Project
.
public_or_internal_only
(
current_user
)
@projects
=
@projects
.
search
(
params
[
:search
])
if
params
[
:search
].
present?
@projects
=
case
params
[
:sort
]
@sort
=
params
[
:sort
]
@projects
=
case
@sort
when
'newest'
then
@projects
.
order
(
'created_at DESC'
)
when
'oldest'
then
@projects
.
order
(
'created_at ASC'
)
when
'recently_updated'
then
@projects
.
order
(
'updated_at DESC'
)
...
...
app/views/public/projects/index.html.haml
View file @
7458437e
...
...
@@ -15,12 +15,14 @@
%a
.dropdown-toggle.btn
{
href:
'#'
,
"data-toggle"
=>
"dropdown"
}
%span
.light
sort:
-
if
@sort
.
present?
=
@sort
=
@sort
.
humanize
-
else
N
ewest
N
ame
%b
.caret
%ul
.dropdown-menu
%li
=
link_to
public_projects_path
(
sort:
nil
)
do
Name
=
link_to
public_projects_path
(
sort:
'newest'
)
do
Newest
=
link_to
public_projects_path
(
sort:
'oldest'
)
do
...
...
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