Commit 7744b67f authored by Phil Hughes's avatar Phil Hughes

Stops excute remote data fetcher when already recieved data

parent dd35de1a
......@@ -148,7 +148,8 @@ class GitLabDropdown
@appendMenu(full_html)
opened: =>
if @remote
contentHtml = $('.dropdown-content', @dropdown).html()
if @remote && contentHtml is ""
@remote.execute()
if @options.filterable
......
......@@ -6,6 +6,8 @@ class @LabelsSelect
selectedLabel = $(dropdown).data('selected')
newLabelField = $('#new_label_name')
newColorField = $('#new_label_color')
showNo = $(dropdown).data('show-no')
showAny = $(dropdown).data('show-any')
if newLabelField.length
$('.suggest-colors-dropdown a').on "click", (e) ->
......@@ -45,6 +47,20 @@ class @LabelsSelect
title: $(@).text().trim()
)
if showNo
data.unshift(
id: "0"
title: 'No label'
)
if showAny
data.unshift(
title: 'Any label'
)
if data.length > 2
data.splice 2, 0, "divider"
callback data
renderRow: (label) ->
selected = if label.title is selectedLabel then "is-active" else ""
......@@ -56,7 +72,7 @@ class @LabelsSelect
</li>"
filterable: true
search:
fields: ['name']
fields: ['title']
selectable: true
fieldName: $(dropdown).data('field-name')
id: (label) ->
......
......@@ -39,7 +39,7 @@
- if params[:label_name]
= hidden_field_tag(:label_name, params[:label_name])
.dropdown
%button.dropdown-menu-toggle.js-label-select.js-filter-submit{type: "button", data: {toggle: "dropdown", field_name: "label_name", selected: params[:label_name], project_id: @project.id, labels: namespace_project_labels_path(@project.namespace, @project, :js)}}
%button.dropdown-menu-toggle.js-label-select.js-filter-submit{type: "button", data: {toggle: "dropdown", field_name: "label_name", show_no: "true", show_any: "true", selected: params[:label_name], project_id: @project.id, labels: namespace_project_labels_path(@project.namespace, @project, :js)}}
%span.dropdown-toggle-text
Label
= icon('chevron-down')
......
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