Commit 5ea01651 authored by Alfredo Sumaran's avatar Alfredo Sumaran

Enhancements

parent 2ee779f1
class @Flash class @Flash
constructor: (message, type)-> constructor: (message, type = 'alert')->
@flash = $(".flash-container") @flash = $(".flash-container")
@flash.html("") @flash.html("")
......
...@@ -460,10 +460,10 @@ class GitLabDropdown ...@@ -460,10 +460,10 @@ class GitLabDropdown
el.addClass ACTIVE_CLASS el.addClass ACTIVE_CLASS
el.removeClass INDETERMINATE_CLASS el.removeClass INDETERMINATE_CLASS
if !value? if not value?
field.remove() field.remove()
if !field.length and fieldName if not field.length and fieldName
@addInput(fieldName, value) @addInput(fieldName, value)
return selectedObject return selectedObject
...@@ -491,14 +491,12 @@ class GitLabDropdown ...@@ -491,14 +491,12 @@ class GitLabDropdown
addInput: (fieldName, value)-> addInput: (fieldName, value)->
# Create hidden input for form # Create hidden input for form
input = "<input type='hidden' name='#{fieldName}' value='#{value}' />" $input = $("<input type='hidden' name='#{fieldName}' value='#{value}' />")
if @options.inputId? if @options.inputId?
input = $(input) $input.attr('id', @options.inputId)
.attr('id', @options.inputId)
@dropdown.before input
removeInputs: -> @dropdown.before $input
@dropdown.parent().find('input[type="hidden"]').remove()
selectRowAtIndex: (e, index) -> selectRowAtIndex: (e, index) ->
selector = ".dropdown-content li:not(.divider,.dropdown-header,.separator):eq(#{index}) a" selector = ".dropdown-content li:not(.divider,.dropdown-header,.separator):eq(#{index}) a"
......
...@@ -32,10 +32,9 @@ class @IssuableBulkActions ...@@ -32,10 +32,9 @@ class @IssuableBulkActions
location.reload() location.reload()
xhr.fail -> xhr.fail ->
console.error 'fail' new Flash("Issue update failed")
xhr.always -> xhr.always @onFormSubmitAlways.bind(@)
_this.onFormSubmitAlways()
onFormSubmitAlways: -> onFormSubmitAlways: ->
@form.find('[type="submit"]').enable() @form.find('[type="submit"]').enable()
...@@ -49,7 +48,7 @@ class @IssuableBulkActions ...@@ -49,7 +48,7 @@ class @IssuableBulkActions
@getSelectedIssues().map -> @getSelectedIssues().map ->
_labels = $(@).data('labels') _labels = $(@).data('labels')
if _labels if _labels
_labels.map (labelId)-> _labels.map (labelId) ->
labels.push(labelId) if labels.indexOf(labelId) is -1 labels.push(labelId) if labels.indexOf(labelId) is -1
labels labels
...@@ -85,10 +84,10 @@ class @IssuableBulkActions ...@@ -85,10 +84,10 @@ class @IssuableBulkActions
add_label_ids : [] add_label_ids : []
remove_label_ids : [] remove_label_ids : []
for id in @getLabelsToApply() @getLabelsToApply().map (id) ->
formData.update.add_label_ids.push id formData.update.add_label_ids.push id
for id in @getLabelsToRemove() @getLabelsToRemove().map (id) ->
formData.update.remove_label_ids.push id formData.update.remove_label_ids.push id
formData formData
...@@ -97,7 +96,7 @@ class @IssuableBulkActions ...@@ -97,7 +96,7 @@ class @IssuableBulkActions
labelIds = [] labelIds = []
$labels = @form.find('.labels-filter input[name="update[label_ids][]"]') $labels = @form.find('.labels-filter input[name="update[label_ids][]"]')
for label in $labels $labels.each (k, label) ->
labelIds.push $(label).val() if label labelIds.push $(label).val() if label
labelIds labelIds
......
...@@ -27,7 +27,7 @@ feature 'Issues > Labels bulk assignment', feature: true do ...@@ -27,7 +27,7 @@ feature 'Issues > Labels bulk assignment', feature: true do
before do before do
check 'check_all_issues' check 'check_all_issues'
open_labels_dropdown ['bug'] open_labels_dropdown ['bug']
click_button 'Update issues' update_issues
end end
it do it do
...@@ -40,7 +40,7 @@ feature 'Issues > Labels bulk assignment', feature: true do ...@@ -40,7 +40,7 @@ feature 'Issues > Labels bulk assignment', feature: true do
before do before do
check "selected_issue_#{issue1.id}" check "selected_issue_#{issue1.id}"
open_labels_dropdown ['bug'] open_labels_dropdown ['bug']
click_button 'Update issues' update_issues
end end
it do it do
...@@ -55,7 +55,7 @@ feature 'Issues > Labels bulk assignment', feature: true do ...@@ -55,7 +55,7 @@ feature 'Issues > Labels bulk assignment', feature: true do
before do before do
check 'check_all_issues' check 'check_all_issues'
open_labels_dropdown ['bug', 'feature'] open_labels_dropdown ['bug', 'feature']
click_button 'Update issues' update_issues
end end
it do it do
...@@ -70,7 +70,7 @@ feature 'Issues > Labels bulk assignment', feature: true do ...@@ -70,7 +70,7 @@ feature 'Issues > Labels bulk assignment', feature: true do
before do before do
check "selected_issue_#{issue1.id}" check "selected_issue_#{issue1.id}"
open_labels_dropdown ['bug', 'feature'] open_labels_dropdown ['bug', 'feature']
click_button 'Update issues' update_issues
end end
it do it do
...@@ -95,7 +95,7 @@ feature 'Issues > Labels bulk assignment', feature: true do ...@@ -95,7 +95,7 @@ feature 'Issues > Labels bulk assignment', feature: true do
check 'check_all_issues' check 'check_all_issues'
unmark_labels_in_dropdown ['bug', 'feature'] unmark_labels_in_dropdown ['bug', 'feature']
click_button 'Update issues' update_issues
end end
it do it do
...@@ -115,7 +115,7 @@ feature 'Issues > Labels bulk assignment', feature: true do ...@@ -115,7 +115,7 @@ feature 'Issues > Labels bulk assignment', feature: true do
check_issue issue1 check_issue issue1
unmark_labels_in_dropdown ['bug'] unmark_labels_in_dropdown ['bug']
click_button 'Update issues' update_issues
end end
it do it do
...@@ -136,7 +136,7 @@ feature 'Issues > Labels bulk assignment', feature: true do ...@@ -136,7 +136,7 @@ feature 'Issues > Labels bulk assignment', feature: true do
check_issue issue1 check_issue issue1
check_issue issue2 check_issue issue2
unmark_labels_in_dropdown ['bug'] unmark_labels_in_dropdown ['bug']
click_button 'Update issues' update_issues
end end
it do it do
...@@ -188,4 +188,9 @@ feature 'Issues > Labels bulk assignment', feature: true do ...@@ -188,4 +188,9 @@ feature 'Issues > Labels bulk assignment', feature: true do
check "selected_issue_#{issue.id}" check "selected_issue_#{issue.id}"
end end
end end
def update_issues
click_button 'Update issues'
wait_for_ajax
end
end end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment