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
Jérome Perrin
gitlab-ce
Commits
6a0c0f3f
Commit
6a0c0f3f
authored
Dec 26, 2013
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add sorting to public projects page
Signed-off-by:
Dmitriy Zaporozhets
<
dmitriy.zaporozhets@gmail.com
>
parent
8310b458
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
44 additions
and
15 deletions
+44
-15
app/assets/stylesheets/gitlab_bootstrap/forms.scss
app/assets/stylesheets/gitlab_bootstrap/forms.scss
+4
-0
app/contexts/issues/list_context.rb
app/contexts/issues/list_context.rb
+1
-2
app/controllers/public/projects_controller.rb
app/controllers/public/projects_controller.rb
+8
-1
app/views/public/projects/index.html.haml
app/views/public/projects/index.html.haml
+31
-12
No files found.
app/assets/stylesheets/gitlab_bootstrap/forms.scss
View file @
6a0c0f3f
...
...
@@ -21,6 +21,10 @@ form {
text-align
:
left
;
}
}
&
.form-tiny
{
margin
:
0
;
}
}
input
.input-xpadding
,
...
...
app/contexts/issues/list_context.rb
View file @
6a0c0f3f
...
...
@@ -29,7 +29,7 @@ module Issues
if
params
[
:milestone_id
].
present?
@issues
=
@issues
.
where
(
milestone_id:
(
params
[
:milestone_id
]
==
'0'
?
nil
:
params
[
:milestone_id
]))
end
# Sort by :sort param
@issues
=
sort
(
@issues
,
params
[
:sort
])
...
...
@@ -49,6 +49,5 @@ module Issues
else
issues
end
end
end
end
app/controllers/public/projects_controller.rb
View file @
6a0c0f3f
...
...
@@ -8,6 +8,13 @@ class Public::ProjectsController < ApplicationController
def
index
@projects
=
Project
.
public_or_internal_only
(
current_user
)
@projects
=
@projects
.
search
(
params
[
:search
])
if
params
[
:search
].
present?
@projects
=
@projects
.
includes
(
:namespace
).
order
(
"namespaces.path, projects.name ASC"
).
page
(
params
[
:page
]).
per
(
20
)
@projects
=
case
params
[
: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'
)
when
'last_updated'
then
@projects
.
order
(
'updated_at ASC'
)
else
@projects
.
order
(
"namespaces.path, projects.name ASC"
)
end
@projects
=
@projects
.
includes
(
:namespace
).
page
(
params
[
:page
]).
per
(
20
)
end
end
app/views/public/projects/index.html.haml
View file @
6a0c0f3f
.row
.span6
%h3
.page-title
Projects (
#{
@projects
.
total_count
}
)
.light
You can browse public projects in read-only mode until signed in.
%h3
.page-title
Projects (
#{
@projects
.
total_count
}
)
.light
You can browse public projects in read-only mode until signed in.
%hr
.clearfix
.pull-left
=
form_tag
public_projects_path
,
method: :get
,
class:
'form-inline form-tiny'
do
|
f
|
.search-holder
=
search_field_tag
:search
,
params
[
:search
],
placeholder:
"Filter by name"
,
class:
"span4 search-text-input"
,
id:
"projects_search"
=
submit_tag
'Search'
,
class:
"btn btn-primary wide"
.pull-right
.dropdown.inline
%a
.dropdown-toggle.btn
{
href:
'#'
,
"data-toggle"
=>
"dropdown"
}
%span
.light
sort:
-
if
@sort
.
present?
=
@sort
-
else
Newest
%b
.caret
%ul
.dropdown-menu
%li
=
link_to
public_projects_path
(
sort:
'newest'
)
do
Newest
=
link_to
public_projects_path
(
sort:
'oldest'
)
do
Oldest
=
link_to
public_projects_path
(
sort:
'recently_updated'
)
do
Recently updated
=
link_to
public_projects_path
(
sort:
'last_updated'
)
do
Last updated
.span6
.pull-right
=
form_tag
public_projects_path
,
method: :get
,
class:
'form-inline'
do
|
f
|
.search-holder
=
search_field_tag
:search
,
params
[
:search
],
placeholder:
"Filter by name"
,
class:
"span3 search-text-input"
,
id:
"projects_search"
=
submit_tag
'Search'
,
class:
"btn btn-primary wide"
%hr
.public-projects
%ul
.bordered-list.top-list
...
...
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