summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhil Hughes <me@iamphill.com>2016-07-18 18:57:44 +0100
committerPhil Hughes <me@iamphill.com>2016-07-20 10:48:02 +0100
commit0a81c00040c6bfe451a855f41dcc7b62eda4b009 (patch)
treecef5f429d0721d7dd50b255d4cd9bcfbfaee92aa
parent70d5493e21fbdf21020c5cfcf67919d157bfb9db (diff)
downloadgitlab-ce-0a81c00040c6bfe451a855f41dcc7b62eda4b009.tar.gz
Fixed 'no label' being in dropdown toggle label
-rw-r--r--app/assets/javascripts/labels_select.js.coffee10
-rw-r--r--app/views/shared/issuable/_label_dropdown.html.haml2
2 files changed, 5 insertions, 7 deletions
diff --git a/app/assets/javascripts/labels_select.js.coffee b/app/assets/javascripts/labels_select.js.coffee
index 8e7dee46fa6..5ae6d1766fb 100644
--- a/app/assets/javascripts/labels_select.js.coffee
+++ b/app/assets/javascripts/labels_select.js.coffee
@@ -212,7 +212,7 @@ class @LabelsSelect
$a = $('<a href="#">')
selectedClass = []
- removesAll = label.id is 0 or not label.id?
+ removesAll = label.id <= 0 or not label.id?
if $dropdown.hasClass('js-filter-bulk-update')
indeterminate = instance.indeterminateIds
@@ -281,7 +281,7 @@ class @LabelsSelect
selectedIds = $("input[name='#{fieldName}']").map(-> @value).get()
selected = _.filter glDropdown.fullData, (label) ->
- selectedIds.indexOf("#{label[propertyName]}") >= 0 if label[propertyName]?
+ selectedIds.indexOf("#{label[propertyName]}") >= 0 if label[propertyName]? and label.id > 0
if selected.length is 1
selected[0].title
@@ -292,11 +292,9 @@ class @LabelsSelect
defaultLabel: defaultLabel
fieldName: fieldName
id: (label) ->
+ return if label.id <= 0
if $dropdown.hasClass('js-issuable-form-dropdown')
- if label.id is 0
- return
- else
- return label.id
+ return label.id
if $dropdown.hasClass("js-filter-submit") and not label.isAny?
label.title
diff --git a/app/views/shared/issuable/_label_dropdown.html.haml b/app/views/shared/issuable/_label_dropdown.html.haml
index 666372b95a6..4899496dcc0 100644
--- a/app/views/shared/issuable/_label_dropdown.html.haml
+++ b/app/views/shared/issuable/_label_dropdown.html.haml
@@ -7,7 +7,7 @@
- classes = local_assigns.fetch(:classes, [])
- selected = local_assigns.fetch(:selected, nil)
- selected_toggle = local_assigns.fetch(:selected_toggle, nil)
-- dropdown_data = {toggle: 'dropdown', field_name: "label_name[]", show_no: "true", show_any: "true", selected: selected, project_id: project.try(:id), labels: labels_filter_path, default_label: "Label"}
+- dropdown_data = {toggle: 'dropdown', field_name: "label_name[]", show_no: "true", show_any: "true", selected: selected, project_id: project.try(:id), labels: labels_filter_path, default_label: "Labels"}
- dropdown_data.merge!(data_options)
- classes << 'js-extra-options' if extra_options
- classes << 'js-filter-submit' if filter_submit