diff options
author | Phil Hughes <me@iamphill.com> | 2016-04-20 19:23:10 +0300 |
---|---|---|
committer | Phil Hughes <me@iamphill.com> | 2016-04-20 19:23:10 +0300 |
commit | 439a72803b32be97253ce689659251530afbca21 (patch) | |
tree | 7b2da9ab680f7692a324874a2335389adfd057b1 /app | |
parent | 75626d5f0134770065a18c73223bdd798866fa5b (diff) |
Any label & no label out weigh other labels - these two will clear previously selected labels
Fixed issue with no label not working correctly
Diffstat (limited to 'app')
-rw-r--r-- | app/assets/javascripts/gl_dropdown.js.coffee | 8 | ||||
-rw-r--r-- | app/assets/javascripts/labels_select.js.coffee | 15 | ||||
-rw-r--r-- | app/finders/issuable_finder.rb | 2 |
3 files changed, 14 insertions, 11 deletions
diff --git a/app/assets/javascripts/gl_dropdown.js.coffee b/app/assets/javascripts/gl_dropdown.js.coffee index 2dc37257e22..e37b3fb5707 100644 --- a/app/assets/javascripts/gl_dropdown.js.coffee +++ b/app/assets/javascripts/gl_dropdown.js.coffee @@ -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 diff --git a/app/assets/javascripts/labels_select.js.coffee b/app/assets/javascripts/labels_select.js.coffee index 0b39efa8d78..ab1a57f7d30 100644 --- a/app/assets/javascripts/labels_select.js.coffee +++ b/app/assets/javascripts/labels_select.js.coffee @@ -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 diff --git a/app/finders/issuable_finder.rb b/app/finders/issuable_finder.rb index d7c5b0a598c..5eb1d3f5aac 100644 --- a/app/finders/issuable_finder.rb +++ b/app/finders/issuable_finder.rb @@ -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 |