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
79ee9be9
Commit
79ee9be9
authored
Feb 21, 2019
by
GitLab Bot
Browse files
Options
Browse Files
Download
Plain Diff
Automatic merge of gitlab-org/gitlab-ce master
parents
bb66e5a4
bf582261
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
50 additions
and
4 deletions
+50
-4
.gitlab-ci.yml
.gitlab-ci.yml
+2
-2
app/helpers/labels_helper.rb
app/helpers/labels_helper.rb
+4
-0
app/views/projects/issues/_issue.html.haml
app/views/projects/issues/_issue.html.haml
+1
-1
app/views/projects/merge_requests/_merge_request.html.haml
app/views/projects/merge_requests/_merge_request.html.haml
+1
-1
changelogs/unreleased/dz-sort-labels-alphabetically.yml
changelogs/unreleased/dz-sort-labels-alphabetically.yml
+5
-0
spec/features/issuables/issuable_list_spec.rb
spec/features/issuables/issuable_list_spec.rb
+24
-0
spec/helpers/labels_helper_spec.rb
spec/helpers/labels_helper_spec.rb
+13
-0
No files found.
.gitlab-ci.yml
View file @
79ee9be9
...
...
@@ -840,8 +840,8 @@ gitlab:assets:compile:
-
//@gitlab/gitlabhq
-
//@gitlab/gitlab-ee
tags
:
-
gitlab-org-delivery
-
high-cpu
-
docker
-
gitlab-org
karma
:
<<
:
*dedicated-no-docs-pull-cache-job
...
...
app/helpers/labels_helper.rb
View file @
79ee9be9
...
...
@@ -227,6 +227,10 @@ module LabelsHelper
"
#{
action
}
at
#{
level
}
level"
end
def
labels_sorted_by_title
(
labels
)
labels
.
sort_by
(
&
:title
)
end
# Required for Banzai::Filter::LabelReferenceFilter
module_function
:render_colored_label
,
:text_color_for_bg
,
:escape_once
end
app/views/projects/issues/_issue.html.haml
View file @
79ee9be9
...
...
@@ -36,7 +36,7 @@
=
issue
.
due_date
.
to_s
(
:medium
)
-
if
issue
.
labels
.
any?
-
issue
.
labels
.
each
do
|
label
|
-
labels_sorted_by_title
(
issue
.
labels
)
.
each
do
|
label
|
=
link_to_label
(
label
,
subject:
issue
.
project
,
css_class:
'label-link'
)
-
if
issue
.
weight
...
...
app/views/projects/merge_requests/_merge_request.html.haml
View file @
79ee9be9
...
...
@@ -34,7 +34,7 @@
=
merge_request
.
target_branch
-
if
merge_request
.
labels
.
any?
-
merge_request
.
labels
.
each
do
|
label
|
-
labels_sorted_by_title
(
merge_request
.
labels
)
.
each
do
|
label
|
=
link_to_label
(
label
,
subject:
merge_request
.
project
,
type: :merge_request
,
css_class:
'label-link'
)
.issuable-meta
...
...
changelogs/unreleased/dz-sort-labels-alphabetically.yml
0 → 100644
View file @
79ee9be9
---
title
:
Sort labels alphabetically on issues and merge requests list
merge_request
:
25470
author
:
type
:
changed
spec/features/issuables/issuable_list_spec.rb
View file @
79ee9be9
...
...
@@ -28,6 +28,22 @@ describe 'issuable list' do
expect
(
first
(
'.fa-thumbs-down'
).
find
(
:xpath
,
'..'
)).
to
have_content
(
1
)
expect
(
first
(
'.fa-comments'
).
find
(
:xpath
,
'..'
)).
to
have_content
(
2
)
end
it
'sorts labels alphabetically'
do
label1
=
create
(
:label
,
project:
project
,
title:
'a'
)
label2
=
create
(
:label
,
project:
project
,
title:
'z'
)
label3
=
create
(
:label
,
project:
project
,
title:
'X'
)
label4
=
create
(
:label
,
project:
project
,
title:
'B'
)
issuable
=
create_issuable
(
issuable_type
)
issuable
.
labels
<<
[
label1
,
label2
,
label3
,
label4
]
visit_issuable_list
(
issuable_type
)
expect
(
all
(
'.label-link'
)[
0
].
text
).
to
have_content
(
'B'
)
expect
(
all
(
'.label-link'
)[
1
].
text
).
to
have_content
(
'X'
)
expect
(
all
(
'.label-link'
)[
2
].
text
).
to
have_content
(
'a'
)
expect
(
all
(
'.label-link'
)[
3
].
text
).
to
have_content
(
'z'
)
end
end
it
"counts merge requests closing issues icons for each issue"
do
...
...
@@ -45,6 +61,14 @@ describe 'issuable list' do
end
end
def
create_issuable
(
issuable_type
)
if
issuable_type
==
:issue
create
(
:issue
,
project:
project
)
else
create
(
:merge_request
,
source_project:
project
)
end
end
def
create_issuables
(
issuable_type
)
3
.
times
do
|
n
|
issuable
=
...
...
spec/helpers/labels_helper_spec.rb
View file @
79ee9be9
...
...
@@ -236,4 +236,17 @@ describe LabelsHelper do
expect
(
labels_filter_path
(
format: :json
)).
to
eq
(
dashboard_labels_path
(
format: :json
))
end
end
describe
'labels_sorted_by_title'
do
it
'sorts labels alphabetically'
do
label1
=
double
(
:label
,
title:
'a'
)
label2
=
double
(
:label
,
title:
'B'
)
label3
=
double
(
:label
,
title:
'c'
)
label4
=
double
(
:label
,
title:
'D'
)
labels
=
[
label1
,
label2
,
label3
,
label4
]
expect
(
labels_sorted_by_title
(
labels
))
.
to
match_array
([
label2
,
label4
,
label1
,
label3
])
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