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
24719881
Commit
24719881
authored
Sep 11, 2018
by
GitLab Bot
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'upstream/master' into ce-to-ee-2018-09-11
parents
a23144ee
b21625a9
Changes
16
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
164 additions
and
4 deletions
+164
-4
app/assets/stylesheets/framework/filters.scss
app/assets/stylesheets/framework/filters.scss
+2
-2
app/controllers/groups/labels_controller.rb
app/controllers/groups/labels_controller.rb
+5
-0
app/controllers/projects/labels_controller.rb
app/controllers/projects/labels_controller.rb
+6
-1
app/finders/labels_finder.rb
app/finders/labels_finder.rb
+5
-1
app/helpers/sorting_helper.rb
app/helpers/sorting_helper.rb
+11
-0
app/models/label.rb
app/models/label.rb
+3
-0
app/uploaders/namespace_file_uploader.rb
app/uploaders/namespace_file_uploader.rb
+4
-0
app/views/groups/labels/index.html.haml
app/views/groups/labels/index.html.haml
+1
-0
app/views/projects/labels/index.html.haml
app/views/projects/labels/index.html.haml
+1
-0
app/views/shared/labels/_sort_dropdown.html.haml
app/views/shared/labels/_sort_dropdown.html.haml
+9
-0
changelogs/unreleased/49943-resolve-filter-bar-height-changes.yml
...gs/unreleased/49943-resolve-filter-bar-height-changes.yml
+5
-0
changelogs/unreleased/50835-add-filtering-sorting-for-labels-on-labels-page.yml
...50835-add-filtering-sorting-for-labels-on-labels-page.yml
+5
-0
changelogs/unreleased/fix-namespace-upload.yml
changelogs/unreleased/fix-namespace-upload.yml
+5
-0
spec/features/groups/labels/sort_labels_spec.rb
spec/features/groups/labels/sort_labels_spec.rb
+48
-0
spec/features/projects/labels/sort_labels_spec.rb
spec/features/projects/labels/sort_labels_spec.rb
+48
-0
spec/uploaders/namespace_file_uploader_spec.rb
spec/uploaders/namespace_file_uploader_spec.rb
+6
-0
No files found.
app/assets/stylesheets/framework/filters.scss
View file @
24719881
...
...
@@ -92,8 +92,8 @@
display
:
-
webkit-flex
;
display
:
flex
;
flex-shrink
:
0
;
margin-top
:
5
px
;
margin-bottom
:
5
px
;
margin-top
:
4
px
;
margin-bottom
:
4
px
;
.selectable
{
display
:
-
webkit-flex
;
...
...
app/controllers/groups/labels_controller.rb
View file @
24719881
...
...
@@ -12,6 +12,7 @@ class Groups::LabelsController < Groups::ApplicationController
format
.
html
do
@labels
=
@group
.
labels
.
optionally_search
(
params
[
:search
])
.
order_by
(
sort
)
.
page
(
params
[
:page
])
end
format
.
json
do
...
...
@@ -117,4 +118,8 @@ class Groups::LabelsController < Groups::ApplicationController
include_descendant_groups:
params
[
:include_descendant_groups
],
search:
params
[
:search
]).
execute
end
def
sort
@sort
||=
params
[
:sort
]
||
'name_asc'
end
end
app/controllers/projects/labels_controller.rb
View file @
24719881
...
...
@@ -163,7 +163,12 @@ class Projects::LabelsController < Projects::ApplicationController
LabelsFinder
.
new
(
current_user
,
project_id:
@project
.
id
,
include_ancestor_groups:
params
[
:include_ancestor_groups
],
search:
params
[
:search
]).
execute
search:
params
[
:search
],
sort:
sort
).
execute
end
def
sort
@sort
||=
params
[
:sort
]
||
'name_asc'
end
def
authorize_admin_labels!
...
...
app/finders/labels_finder.rb
View file @
24719881
...
...
@@ -54,7 +54,11 @@ class LabelsFinder < UnionFinder
end
def
sort
(
items
)
items
.
reorder
(
title: :asc
)
if
params
[
:sort
]
items
.
order_by
(
params
[
:sort
])
else
items
.
reorder
(
title: :asc
)
end
end
def
with_title
(
items
)
...
...
app/helpers/sorting_helper.rb
View file @
24719881
...
...
@@ -106,6 +106,17 @@ module SortingHelper
}
end
def
label_sort_options_hash
{
sort_value_name
=>
sort_title_name
,
sort_value_name_desc
=>
sort_title_name_desc
,
sort_value_recently_created
=>
sort_title_recently_created
,
sort_value_oldest_created
=>
sort_title_oldest_created
,
sort_value_recently_updated
=>
sort_title_recently_updated
,
sort_value_oldest_updated
=>
sort_title_oldest_updated
}
end
def
sortable_item
(
item
,
path
,
sorted_by
)
link_to
item
,
path
,
class:
sorted_by
==
item
?
'is-active'
:
''
end
...
...
app/models/label.rb
View file @
24719881
...
...
@@ -6,6 +6,7 @@ class Label < ActiveRecord::Base
include
Subscribable
include
Gitlab
::
SQL
::
Pattern
include
OptionallySearch
include
Sortable
# Represents a "No Label" state used for filtering Issues and Merge
# Requests that have no label assigned.
...
...
@@ -41,6 +42,8 @@ class Label < ActiveRecord::Base
scope
:with_lists_and_board
,
->
{
joins
(
lists: :board
).
merge
(
List
.
movable
)
}
scope
:on_group_boards
,
->
(
group_id
)
{
with_lists_and_board
.
where
(
boards:
{
group_id:
group_id
})
}
scope
:on_project_boards
,
->
(
project_id
)
{
with_lists_and_board
.
where
(
boards:
{
project_id:
project_id
})
}
scope
:order_name_asc
,
->
{
reorder
(
title: :asc
)
}
scope
:order_name_desc
,
->
{
reorder
(
title: :desc
)
}
def
self
.
prioritized
(
project
)
joins
(
:priorities
)
...
...
app/uploaders/namespace_file_uploader.rb
View file @
24719881
...
...
@@ -21,6 +21,10 @@ class NamespaceFileUploader < FileUploader
File
.
join
(
model
.
id
.
to_s
)
end
def
self
.
workhorse_local_upload_path
File
.
join
(
options
.
storage_path
,
'uploads'
,
TMP_UPLOAD_PATH
)
end
# Re-Override
def
store_dir
store_dirs
[
object_store
]
...
...
app/views/groups/labels/index.html.haml
View file @
24719881
...
...
@@ -21,6 +21,7 @@
%span
.input-group-append
%button
.btn.btn-default
{
type:
"submit"
,
"aria-label"
=>
_
(
'Submit search'
)
}
=
icon
(
"search"
)
=
render
'shared/labels/sort_dropdown'
.labels-container.prepend-top-5
-
if
@labels
.
any?
...
...
app/views/projects/labels/index.html.haml
View file @
24719881
...
...
@@ -22,6 +22,7 @@
%span
.input-group-append
%button
.btn.btn-default
{
type:
"submit"
,
"aria-label"
=>
_
(
'Submit search'
)
}
=
icon
(
"search"
)
=
render
'shared/labels/sort_dropdown'
.labels-container.prepend-top-10
-
if
can_admin_label
...
...
app/views/shared/labels/_sort_dropdown.html.haml
0 → 100644
View file @
24719881
-
sort_title
=
label_sort_options_hash
[
@sort
]
||
sort_title_name_desc
.dropdown.inline
%button
.dropdown-toggle
{
type:
'button'
,
data:
{
toggle:
'dropdown'
}
}
=
sort_title
=
icon
(
'chevron-down'
)
%ul
.dropdown-menu.dropdown-menu-right.dropdown-menu-sort
%li
-
label_sort_options_hash
.
each
do
|
value
,
title
|
=
sortable_item
(
title
,
page_filter_path
(
sort:
value
,
label:
true
),
sort_title
)
changelogs/unreleased/49943-resolve-filter-bar-height-changes.yml
0 → 100644
View file @
24719881
---
title
:
Fix filter bar height bug when a tag is added
merge_request
:
author
:
type
:
fixed
changelogs/unreleased/50835-add-filtering-sorting-for-labels-on-labels-page.yml
0 → 100644
View file @
24719881
---
title
:
Add sorting for labels on labels page
merge_request
:
21642
author
:
type
:
added
changelogs/unreleased/fix-namespace-upload.yml
0 → 100644
View file @
24719881
---
title
:
Fix workhorse temp path for namespace uploads
merge_request
:
21650
author
:
type
:
fixed
spec/features/groups/labels/sort_labels_spec.rb
0 → 100644
View file @
24719881
# frozen_string_literal: true
require
'spec_helper'
describe
'Sort labels'
,
:js
do
let
(
:user
)
{
create
(
:user
)
}
let
(
:group
)
{
create
(
:group
)
}
let!
(
:label1
)
{
create
(
:group_label
,
title:
'Foo'
,
description:
'Lorem ipsum'
,
group:
group
)
}
let!
(
:label2
)
{
create
(
:group_label
,
title:
'Bar'
,
description:
'Fusce consequat'
,
group:
group
)
}
before
do
group
.
add_maintainer
(
user
)
sign_in
(
user
)
visit
group_labels_path
(
group
)
end
it
'sorts by title by default'
do
expect
(
page
).
to
have_button
(
'Name'
)
# assert default sorting
within
'.other-labels'
do
expect
(
page
.
all
(
'.label-list-item'
).
first
.
text
).
to
include
(
'Bar'
)
expect
(
page
.
all
(
'.label-list-item'
).
last
.
text
).
to
include
(
'Foo'
)
end
end
it
'sorts by date'
do
click_button
'Name'
sort_options
=
find
(
'ul.dropdown-menu-sort li'
).
all
(
'a'
).
collect
(
&
:text
)
expect
(
sort_options
[
0
]).
to
eq
(
'Name'
)
expect
(
sort_options
[
1
]).
to
eq
(
'Name, descending'
)
expect
(
sort_options
[
2
]).
to
eq
(
'Last created'
)
expect
(
sort_options
[
3
]).
to
eq
(
'Oldest created'
)
expect
(
sort_options
[
4
]).
to
eq
(
'Last updated'
)
expect
(
sort_options
[
5
]).
to
eq
(
'Oldest updated'
)
click_link
'Name, descending'
# assert default sorting
within
'.other-labels'
do
expect
(
page
.
all
(
'.label-list-item'
).
first
.
text
).
to
include
(
'Foo'
)
expect
(
page
.
all
(
'.label-list-item'
).
last
.
text
).
to
include
(
'Bar'
)
end
end
end
spec/features/projects/labels/sort_labels_spec.rb
0 → 100644
View file @
24719881
# frozen_string_literal: true
require
'spec_helper'
describe
'Sort labels'
,
:js
do
let
(
:user
)
{
create
(
:user
)
}
let
(
:project
)
{
create
(
:project
)
}
let!
(
:label1
)
{
create
(
:label
,
title:
'Foo'
,
description:
'Lorem ipsum'
,
project:
project
)
}
let!
(
:label2
)
{
create
(
:label
,
title:
'Bar'
,
description:
'Fusce consequat'
,
project:
project
)
}
before
do
project
.
add_maintainer
(
user
)
sign_in
(
user
)
visit
project_labels_path
(
project
)
end
it
'sorts by title by default'
do
expect
(
page
).
to
have_button
(
'Name'
)
# assert default sorting
within
'.other-labels'
do
expect
(
page
.
all
(
'.label-list-item'
).
first
.
text
).
to
include
(
'Bar'
)
expect
(
page
.
all
(
'.label-list-item'
).
last
.
text
).
to
include
(
'Foo'
)
end
end
it
'sorts by date'
do
click_button
'Name'
sort_options
=
find
(
'ul.dropdown-menu-sort li'
).
all
(
'a'
).
collect
(
&
:text
)
expect
(
sort_options
[
0
]).
to
eq
(
'Name'
)
expect
(
sort_options
[
1
]).
to
eq
(
'Name, descending'
)
expect
(
sort_options
[
2
]).
to
eq
(
'Last created'
)
expect
(
sort_options
[
3
]).
to
eq
(
'Oldest created'
)
expect
(
sort_options
[
4
]).
to
eq
(
'Last updated'
)
expect
(
sort_options
[
5
]).
to
eq
(
'Oldest updated'
)
click_link
'Name, descending'
# assert default sorting
within
'.other-labels'
do
expect
(
page
.
all
(
'.label-list-item'
).
first
.
text
).
to
include
(
'Foo'
)
expect
(
page
.
all
(
'.label-list-item'
).
last
.
text
).
to
include
(
'Bar'
)
end
end
end
spec/uploaders/namespace_file_uploader_spec.rb
View file @
24719881
...
...
@@ -40,6 +40,12 @@ describe NamespaceFileUploader do
end
end
describe
'#workhorse_local_upload_path'
do
it
'returns the correct path in uploads directory'
do
expect
(
described_class
.
workhorse_local_upload_path
).
to
end_with
(
'/uploads/tmp/uploads'
)
end
end
describe
"#migrate!"
do
before
do
uploader
.
store!
(
fixture_file_upload
(
File
.
join
(
'spec/fixtures/doc_sample.txt'
)))
...
...
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