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
e487b099
Commit
e487b099
authored
Jun 03, 2016
by
Alfredo Sumaran
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve functionality
parent
8b3ed9c3
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
18 deletions
+21
-18
app/assets/javascripts/LabelManager.js.coffee
app/assets/javascripts/LabelManager.js.coffee
+21
-18
No files found.
app/assets/javascripts/LabelManager.js.coffee
View file @
e487b099
class
@
LabelManager
errorMessage
:
'Unable to update label prioritization at this time'
constructor
:
(
opts
=
{})
->
# Defaults
{
...
...
@@ -27,7 +29,7 @@ class @LabelManager
action
=
if
$btn
.
parents
(
'.js-prioritized-labels'
).
length
then
'remove'
else
'add'
_this
.
toggleLabelPriority
(
$label
,
action
)
toggleLabelPriority
:
(
$label
,
action
,
persistState
=
fals
e
)
->
toggleLabelPriority
:
(
$label
,
action
,
persistState
=
tru
e
)
->
_this
=
@
url
=
$label
.
find
(
'.js-toggle-priority'
).
data
'url'
...
...
@@ -48,31 +50,32 @@ class @LabelManager
$label
.
detach
().
appendTo
(
$target
)
# Return if we are not persisting state
return
if
persistState
return
unless
persistState
if
action
is
'remove'
xhr
=
$
.
ajax
url
:
url
,
type
:
'DELETE'
# If request fails, put label back to Other labels group
xhr
.
fail
->
_this
.
toggleLabelPriority
(
$label
,
'remove'
,
true
)
# Show a message
new
Flash
(
'Unable to update label prioritization at this time'
,
'alert'
)
else
@
savePrioritySort
()
xhr
=
@
savePrioritySort
(
$label
,
action
)
xhr
.
fail
@
rollbackLabelPosition
.
bind
(
@
,
$label
,
action
)
onPrioritySortUpdate
:
->
@
savePrioritySort
()
xhr
=
@
savePrioritySort
()
savePrioritySort
:
->
xhr
=
$
.
post
xhr
.
fail
->
new
Flash
(
@
errorMessage
,
'alert'
)
savePrioritySort
:
()
->
$
.
post
url
:
@
prioritizedLabels
.
data
(
'url'
)
data
:
label_ids
:
@
getSortedLabelsIds
()
xhr
.
fail
->
new
Flash
(
'Unable to update label prioritization at this time'
,
'alert'
)
rollbackLabelPosition
:
(
$label
,
originalAction
)
->
action
=
if
originalAction
is
'remove'
then
'add'
else
'remove'
@
toggleLabelPriority
(
$label
,
action
,
false
)
new
Flash
(
@
errorMessage
,
'alert'
)
getSortedLabelsIds
:
->
sortedIds
=
[]
...
...
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