Commit 0a81c000 authored by Phil Hughes's avatar Phil Hughes

Fixed 'no label' being in dropdown toggle label

parent 70d5493e
...@@ -212,7 +212,7 @@ class @LabelsSelect ...@@ -212,7 +212,7 @@ class @LabelsSelect
$a = $('<a href="#">') $a = $('<a href="#">')
selectedClass = [] 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') if $dropdown.hasClass('js-filter-bulk-update')
indeterminate = instance.indeterminateIds indeterminate = instance.indeterminateIds
...@@ -281,7 +281,7 @@ class @LabelsSelect ...@@ -281,7 +281,7 @@ class @LabelsSelect
selectedIds = $("input[name='#{fieldName}']").map(-> @value).get() selectedIds = $("input[name='#{fieldName}']").map(-> @value).get()
selected = _.filter glDropdown.fullData, (label) -> 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 if selected.length is 1
selected[0].title selected[0].title
...@@ -292,10 +292,8 @@ class @LabelsSelect ...@@ -292,10 +292,8 @@ class @LabelsSelect
defaultLabel: defaultLabel defaultLabel: defaultLabel
fieldName: fieldName fieldName: fieldName
id: (label) -> id: (label) ->
return if label.id <= 0
if $dropdown.hasClass('js-issuable-form-dropdown') 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? if $dropdown.hasClass("js-filter-submit") and not label.isAny?
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
- classes = local_assigns.fetch(:classes, []) - classes = local_assigns.fetch(:classes, [])
- selected = local_assigns.fetch(:selected, nil) - selected = local_assigns.fetch(:selected, nil)
- selected_toggle = local_assigns.fetch(:selected_toggle, 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) - dropdown_data.merge!(data_options)
- classes << 'js-extra-options' if extra_options - classes << 'js-extra-options' if extra_options
- classes << 'js-filter-submit' if filter_submit - classes << 'js-filter-submit' if filter_submit
......
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