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
Kazuhiko Shiozaki
gitlab-ce
Commits
2ecc7950
Commit
2ecc7950
authored
Jul 30, 2014
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Order labels by name
Signed-off-by:
Dmitriy Zaporozhets
<
dmitriy.zaporozhets@gmail.com
>
parent
91c1534e
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
4 additions
and
2 deletions
+4
-2
app/controllers/projects/labels_controller.rb
app/controllers/projects/labels_controller.rb
+1
-1
app/models/label.rb
app/models/label.rb
+2
-0
app/views/shared/_project_filter.html.haml
app/views/shared/_project_filter.html.haml
+1
-1
No files found.
app/controllers/projects/labels_controller.rb
View file @
2ecc7950
...
...
@@ -7,7 +7,7 @@ class Projects::LabelsController < Projects::ApplicationController
respond_to
:js
,
:html
def
index
@labels
=
@project
.
labels
.
order
(
'title ASC'
)
.
page
(
params
[
:page
]).
per
(
20
)
@labels
=
@project
.
labels
.
order
_by_name
.
page
(
params
[
:page
]).
per
(
20
)
end
def
new
...
...
app/models/label.rb
View file @
2ecc7950
...
...
@@ -9,6 +9,8 @@ class Label < ActiveRecord::Base
# Dont allow '?', '&', and ',' for label titles
validates
:title
,
presence:
true
,
format:
{
with:
/\A[^&\?,&]*\z/
}
scope
:order_by_name
,
->
{
reorder
(
"labels.title ASC"
)
}
def
name
title
end
...
...
app/views/shared/_project_filter.html.haml
View file @
2ecc7950
...
...
@@ -36,7 +36,7 @@
%fieldset
%legend
Labels
%ul
.nav.nav-pills.nav-stacked.nav-small.labels-filter
-
@project
.
labels
.
each
do
|
label
|
-
@project
.
labels
.
order_by_name
.
each
do
|
label
|
%li
{
class:
label_filter_class
(
label
.
name
)}
=
link_to
labels_filter_path
(
label
.
name
)
do
=
render_colored_label
(
label
)
...
...
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