Commit 439a7280 authored by Phil Hughes's avatar Phil Hughes

Any label & no label out weigh other labels - these two will clear previously selected labels

Fixed issue with no label not working correctly
parent 75626d5f
......@@ -389,13 +389,13 @@ class GitLabDropdown
else
selectedObject
else
if !value?
field.remove()
if not @options.multiSelect
if not @options.multiSelect or el.hasClass('dropdown-clear-active')
@dropdown.find(".#{ACTIVE_CLASS}").removeClass ACTIVE_CLASS
@dropdown.parent().find("input[name='#{fieldName}']").remove()
if !value?
field.remove()
# Toggle active class for the tick mark
el.addClass ACTIVE_CLASS
......
......@@ -201,16 +201,21 @@ class @LabelsSelect
callback data
renderRow: (label) ->
selectedClass = ''
removesAll = label.id is 0 or label.id is undefined
selectedClass = []
if $form.find("input[type='hidden']\
[name='#{$dropdown.data('fieldName')}']\
[value='#{this.id(label)}']").length
selectedClass = 'is-active'
selectedClass.push 'is-active'
if $dropdown.hasClass('js-multiselect') and removesAll
selectedClass.push 'dropdown-clear-active'
color = if label.color? then "<span class='dropdown-label-box' style='background-color: #{label.color}'></span>" else ""
"<li>
<a href='#' class='#{selectedClass}'>
<a href='#' class='#{selectedClass.join(' ')}'>
#{color}
#{label.title}
</a>
......@@ -237,9 +242,7 @@ class @LabelsSelect
defaultLabel
fieldName: $dropdown.data('field-name')
id: (label) ->
if label.isAny?
''
else if $dropdown.hasClass "js-filter-submit"
if $dropdown.hasClass("js-filter-submit") and not label.isAny?
label.title
else
label.id
......
......@@ -117,7 +117,7 @@ class IssuableFinder
end
def filter_by_no_label?
labels? && params[:label_name] == Label::None.title
labels? && params[:label_name].include?(Label::None.title)
end
def labels
......
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