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
53a4437a
Commit
53a4437a
authored
Apr 19, 2018
by
Luke Bennett
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add and remove priority label
parent
5099e73f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
3 deletions
+19
-3
app/assets/javascripts/label_manager.js
app/assets/javascripts/label_manager.js
+14
-1
app/views/projects/labels/index.html.haml
app/views/projects/labels/index.html.haml
+4
-1
app/views/shared/_label_row.html.haml
app/views/shared/_label_row.html.haml
+1
-1
No files found.
app/assets/javascripts/label_manager.js
View file @
53a4437a
...
...
@@ -13,6 +13,7 @@ export default class LabelManager {
this
.
otherLabels
=
otherLabels
||
$
(
'
.js-other-labels
'
);
this
.
errorMessage
=
'
Unable to update label prioritization at this time
'
;
this
.
emptyState
=
document
.
querySelector
(
'
#js-priority-labels-empty-state
'
);
this
.
$badgeItemTemplate
=
$
(
document
.
getElementById
(
'
js-badge-item-template
'
).
innerHTML
);
this
.
sortable
=
Sortable
.
create
(
this
.
prioritizedLabels
.
get
(
0
),
{
filter
:
'
.empty-message
'
,
forceFallback
:
true
,
...
...
@@ -63,7 +64,11 @@ export default class LabelManager {
$target
=
this
.
otherLabels
;
$from
=
this
.
prioritizedLabels
;
}
$label
.
detach
().
appendTo
(
$target
);
const
$detachedLabel
=
$label
.
detach
();
this
.
toggleLabelPriorityBadge
(
$detachedLabel
,
action
);
$detachedLabel
.
appendTo
(
$target
);
if
(
$from
.
find
(
'
li
'
).
length
)
{
$from
.
find
(
'
.empty-message
'
).
removeClass
(
'
hidden
'
);
}
...
...
@@ -88,6 +93,14 @@ export default class LabelManager {
}
}
toggleLabelPriorityBadge
(
$label
,
action
)
{
if
(
action
===
'
remove
'
)
{
$
(
'
.js-priority-badge
'
,
$label
).
remove
();
}
else
{
$
(
'
.label-links
'
,
$label
).
append
(
this
.
$badgeItemTemplate
);
}
}
onPrioritySortUpdate
()
{
this
.
savePrioritySort
()
.
catch
(()
=>
flash
(
this
.
errorMessage
));
...
...
app/views/projects/labels/index.html.haml
View file @
53a4437a
...
...
@@ -9,7 +9,6 @@
=
link_to
new_project_label_path
(
@project
),
class:
"btn btn-new"
do
New label
-
if
@labels
.
exists?
||
@prioritized_labels
.
exists?
#promote-label-modal
%div
{
class:
container_class
}
...
...
@@ -40,3 +39,7 @@
=
paginate
@labels
,
theme:
'gitlab'
-
else
=
render
'shared/empty_states/labels'
%template
#js-badge-item-template
%li
.label-link-item.js-priority-badge.inline.prepend-left-10
.label-badge.label-badge-blue
Prioritized label
\ No newline at end of file
app/views/shared/_label_row.html.haml
View file @
53a4437a
...
...
@@ -18,5 +18,5 @@
%li
.label-link-item.inline
=
link_to_label
(
label
,
subject:
subject
,
type: :merge_request
)
{
'Merge requests'
}
-
if
label
.
priority?
%li
.label-link-item.inline.prepend-left-10
%li
.label-link-item.
js-priority-badge.
inline.prepend-left-10
.label-badge.label-badge-blue
Prioritized label
\ No newline at end of file
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