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
0866a47a
Commit
0866a47a
authored
Apr 12, 2019
by
Heinrich Lee Yu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Show prioritized labels to guests
Disables sorting when guests are viewing
parent
9ec37d3d
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
59 additions
and
35 deletions
+59
-35
app/assets/javascripts/label_manager.js
app/assets/javascripts/label_manager.js
+10
-7
app/assets/stylesheets/pages/labels.scss
app/assets/stylesheets/pages/labels.scss
+3
-3
app/views/projects/labels/index.html.haml
app/views/projects/labels/index.html.haml
+19
-20
app/views/shared/milestones/_labels_tab.html.haml
app/views/shared/milestones/_labels_tab.html.haml
+1
-1
changelogs/unreleased/57247-show-prioritized-labels-to-guests.yml
...gs/unreleased/57247-show-prioritized-labels-to-guests.yml
+5
-0
spec/features/projects/labels/update_prioritization_spec.rb
spec/features/projects/labels/update_prioritization_spec.rb
+16
-4
spec/features/projects/labels/user_views_labels_spec.rb
spec/features/projects/labels/user_views_labels_spec.rb
+5
-0
No files found.
app/assets/javascripts/label_manager.js
View file @
0866a47a
...
@@ -14,13 +14,16 @@ export default class LabelManager {
...
@@ -14,13 +14,16 @@ export default class LabelManager {
this
.
errorMessage
=
'
Unable to update label prioritization at this time
'
;
this
.
errorMessage
=
'
Unable to update label prioritization at this time
'
;
this
.
emptyState
=
document
.
querySelector
(
'
#js-priority-labels-empty-state
'
);
this
.
emptyState
=
document
.
querySelector
(
'
#js-priority-labels-empty-state
'
);
this
.
$badgeItemTemplate
=
$
(
'
#js-badge-item-template
'
);
this
.
$badgeItemTemplate
=
$
(
'
#js-badge-item-template
'
);
this
.
sortable
=
Sortable
.
create
(
this
.
prioritizedLabels
.
get
(
0
),
{
if
(
'
sortable
'
in
this
.
prioritizedLabels
.
data
())
{
Sortable
.
create
(
this
.
prioritizedLabels
.
get
(
0
),
{
filter
:
'
.empty-message
'
,
filter
:
'
.empty-message
'
,
forceFallback
:
true
,
forceFallback
:
true
,
fallbackClass
:
'
is-dragging
'
,
fallbackClass
:
'
is-dragging
'
,
dataIdAttr
:
'
data-id
'
,
dataIdAttr
:
'
data-id
'
,
onUpdate
:
this
.
onPrioritySortUpdate
.
bind
(
this
),
onUpdate
:
this
.
onPrioritySortUpdate
.
bind
(
this
),
});
});
}
this
.
bindEvents
();
this
.
bindEvents
();
}
}
...
...
app/assets/stylesheets/pages/labels.scss
View file @
0866a47a
...
@@ -75,7 +75,7 @@
...
@@ -75,7 +75,7 @@
padding
:
0
;
padding
:
0
;
margin-bottom
:
0
;
margin-bottom
:
0
;
>
li
:not
(
.empty-message
)
:not
(
.
is-not-draggable
)
{
>
li
:not
(
.empty-message
)
:not
(
.
no-border
)
{
background-color
:
$white-light
;
background-color
:
$white-light
;
margin-bottom
:
5px
;
margin-bottom
:
5px
;
display
:
flex
;
display
:
flex
;
...
@@ -92,7 +92,7 @@
...
@@ -92,7 +92,7 @@
opacity
:
0
.3
;
opacity
:
0
.3
;
}
}
.prioritized-labels
&
{
.prioritized-labels
:not
(
.is-not-draggable
)
&
{
box-shadow
:
0
1px
2px
$issue-boards-card-shadow
;
box-shadow
:
0
1px
2px
$issue-boards-card-shadow
;
cursor
:
move
;
cursor
:
move
;
cursor
:
grab
;
cursor
:
grab
;
...
@@ -353,7 +353,7 @@
...
@@ -353,7 +353,7 @@
@media
(
max-width
:
map-get
(
$grid-breakpoints
,
md
)
-1
)
{
@media
(
max-width
:
map-get
(
$grid-breakpoints
,
md
)
-1
)
{
.manage-labels-list
{
.manage-labels-list
{
>
li
:not
(
.empty-message
)
:not
(
.
is-not-draggable
)
{
>
li
:not
(
.empty-message
)
:not
(
.
no-border
)
{
flex-wrap
:
wrap
;
flex-wrap
:
wrap
;
}
}
...
...
app/views/projects/labels/index.html.haml
View file @
0866a47a
...
@@ -11,17 +11,17 @@
...
@@ -11,17 +11,17 @@
=
render
'shared/labels/nav'
,
labels_or_filters:
labels_or_filters
,
can_admin_label:
can_admin_label
=
render
'shared/labels/nav'
,
labels_or_filters:
labels_or_filters
,
can_admin_label:
can_admin_label
.labels-container.prepend-top-10
.labels-container.prepend-top-10
-
if
can_admin_label
-
if
can_admin_label
&&
search
.
blank?
-
if
search
.
blank?
%p
.text-muted
%p
.text-muted
=
_
(
'Labels can be applied to issues and merge requests.'
)
=
_
(
'Labels can be applied to issues and merge requests.'
)
%br
%br
=
_
(
'Star a label to make it a priority label. Order the prioritized labels to change their relative priority, by dragging.'
)
=
_
(
'Star a label to make it a priority label. Order the prioritized labels to change their relative priority, by dragging.'
)
-# Only show it in the first page
-# Only show it in the first page
-
hide
=
@available_labels
.
empty?
||
(
params
[
:page
].
present?
&&
params
[
:page
]
!=
'1'
)
-
hide
=
@available_labels
.
empty?
||
(
params
[
:page
].
present?
&&
params
[
:page
]
!=
'1'
)
.prioritized-labels
{
class:
(
'hide'
if
hide
)
}
.prioritized-labels
{
class:
[(
'hide'
if
hide
),
(
'is-not-draggable'
unless
can_admin_label
)]
}
%h5
.prepend-top-10
=
_
(
'Prioritized Labels'
)
%h5
.prepend-top-10
=
_
(
'Prioritized Labels'
)
.content-list.manage-labels-list.js-prioritized-labels
{
"data-url"
=>
set_priorities_project_labels_path
(
@project
)
}
.content-list.manage-labels-list.js-prioritized-labels
{
data:
{
url:
set_priorities_project_labels_path
(
@project
),
sortable:
can_admin_label
}
}
#js-priority-labels-empty-state
.priority-labels-empty-state
{
class:
"#{'hidden' unless @prioritized_labels.empty? && search.blank?}"
}
#js-priority-labels-empty-state
.priority-labels-empty-state
{
class:
"#{'hidden' unless @prioritized_labels.empty? && search.blank?}"
}
=
render
'shared/empty_states/priority_labels'
=
render
'shared/empty_states/priority_labels'
-
if
@prioritized_labels
.
present?
-
if
@prioritized_labels
.
present?
...
@@ -32,7 +32,6 @@
...
@@ -32,7 +32,6 @@
-
if
@labels
.
present?
-
if
@labels
.
present?
.other-labels
.other-labels
-
if
can_admin_label
%h5
{
class:
(
'hide'
if
hide
)
}=
_
(
'Other Labels'
)
%h5
{
class:
(
'hide'
if
hide
)
}=
_
(
'Other Labels'
)
.content-list.manage-labels-list.js-other-labels
.content-list.manage-labels-list.js-other-labels
=
render
partial:
'shared/label'
,
subject:
@project
,
collection:
@labels
,
as: :label
=
render
partial:
'shared/label'
,
subject:
@project
,
collection:
@labels
,
as: :label
...
...
app/views/shared/milestones/_labels_tab.html.haml
View file @
0866a47a
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
-
labels
.
each
do
|
label
|
-
labels
.
each
do
|
label
|
-
options
=
{
milestone_title:
@milestone
.
title
,
label_name:
label
.
title
}
-
options
=
{
milestone_title:
@milestone
.
title
,
label_name:
label
.
title
}
%li
.
is-not-draggable
%li
.
no-border
%span
.label-row
%span
.label-row
%span
.label-name
%span
.label-name
=
render_label
(
label
,
tooltip:
false
,
link:
milestones_label_path
(
options
))
=
render_label
(
label
,
tooltip:
false
,
link:
milestones_label_path
(
options
))
...
...
changelogs/unreleased/57247-show-prioritized-labels-to-guests.yml
0 → 100644
View file @
0866a47a
---
title
:
Show prioritized labels to guests
merge_request
:
27307
author
:
type
:
fixed
spec/features/projects/labels/update_prioritization_spec.rb
View file @
0866a47a
...
@@ -138,29 +138,41 @@ describe 'Prioritize labels' do
...
@@ -138,29 +138,41 @@ describe 'Prioritize labels' do
end
end
context
'as a guest'
do
context
'as a guest'
do
it
'does not prioritize labels'
do
before
do
create
(
:label_priority
,
project:
project
,
label:
bug
,
priority:
1
)
create
(
:label_priority
,
project:
project
,
label:
feature
,
priority:
2
)
guest
=
create
(
:user
)
guest
=
create
(
:user
)
sign_in
guest
sign_in
guest
visit
project_labels_path
(
project
)
visit
project_labels_path
(
project
)
end
it
'cannot prioritize labels'
do
expect
(
page
).
to
have_content
'bug'
expect
(
page
).
to
have_content
'bug'
expect
(
page
).
to
have_content
'wontfix'
expect
(
page
).
to
have_content
'wontfix'
expect
(
page
).
to
have_content
'feature'
expect
(
page
).
to
have_content
'feature'
expect
(
page
).
not_to
have_css
(
'.prioritized-labels'
)
expect
(
page
).
not_to
have_content
'Star a label'
expect
(
page
).
not_to
have_content
'Star a label'
end
end
it
'cannot sort prioritized labels'
,
:js
do
drag_to
(
selector:
'.prioritized-labels .label-list-item'
,
from_index:
1
,
to_index:
2
)
page
.
within
(
'.prioritized-labels'
)
do
expect
(
first
(
'.label-list-item'
)).
to
have_content
(
'bug'
)
expect
(
page
.
all
(
'.label-list-item'
).
last
).
to
have_content
(
'feature'
)
end
end
end
end
context
'as a non signed in user'
do
context
'as a non signed in user'
do
it
'
does
not prioritize labels'
do
it
'
can
not prioritize labels'
do
visit
project_labels_path
(
project
)
visit
project_labels_path
(
project
)
expect
(
page
).
to
have_content
'bug'
expect
(
page
).
to
have_content
'bug'
expect
(
page
).
to
have_content
'wontfix'
expect
(
page
).
to
have_content
'wontfix'
expect
(
page
).
to
have_content
'feature'
expect
(
page
).
to
have_content
'feature'
expect
(
page
).
not_to
have_css
(
'.prioritized-labels'
)
expect
(
page
).
not_to
have_content
'Star a label'
expect
(
page
).
not_to
have_content
'Star a label'
end
end
end
end
...
...
spec/features/projects/labels/user_views_labels_spec.rb
View file @
0866a47a
...
@@ -7,6 +7,7 @@ describe "User views labels" do
...
@@ -7,6 +7,7 @@ describe "User views labels" do
set
(
:user
)
{
create
(
:user
)
}
set
(
:user
)
{
create
(
:user
)
}
let
(
:label_titles
)
{
%w[bug enhancement feature]
}
let
(
:label_titles
)
{
%w[bug enhancement feature]
}
let!
(
:prioritized_label
)
{
create
(
:label
,
project:
project
,
title:
'prioritized-label-name'
,
priority:
1
)
}
before
do
before
do
label_titles
.
each
{
|
title
|
create
(
:label
,
project:
project
,
title:
title
)
}
label_titles
.
each
{
|
title
|
create
(
:label
,
project:
project
,
title:
title
)
}
...
@@ -18,6 +19,10 @@ describe "User views labels" do
...
@@ -18,6 +19,10 @@ describe "User views labels" do
end
end
it
"shows all labels"
do
it
"shows all labels"
do
page
.
within
(
'.prioritized-labels .manage-labels-list'
)
do
expect
(
page
).
to
have_content
(
'prioritized-label-name'
)
end
page
.
within
(
'.other-labels .manage-labels-list'
)
do
page
.
within
(
'.other-labels .manage-labels-list'
)
do
label_titles
.
each
{
|
title
|
expect
(
page
).
to
have_content
(
title
)
}
label_titles
.
each
{
|
title
|
expect
(
page
).
to
have_content
(
title
)
}
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