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 ...@@ -148,7 +148,8 @@ class GitLabDropdown
@appendMenu(full_html) @appendMenu(full_html)
opened: => opened: =>
if @remote contentHtml = $('.dropdown-content', @dropdown).html()
if @remote && contentHtml is ""
@remote.execute() @remote.execute()
if @options.filterable if @options.filterable
......
...@@ -6,6 +6,8 @@ class @LabelsSelect ...@@ -6,6 +6,8 @@ class @LabelsSelect
selectedLabel = $(dropdown).data('selected') selectedLabel = $(dropdown).data('selected')
newLabelField = $('#new_label_name') newLabelField = $('#new_label_name')
newColorField = $('#new_label_color') newColorField = $('#new_label_color')
showNo = $(dropdown).data('show-no')
showAny = $(dropdown).data('show-any')
if newLabelField.length if newLabelField.length
$('.suggest-colors-dropdown a').on "click", (e) -> $('.suggest-colors-dropdown a').on "click", (e) ->
...@@ -45,6 +47,20 @@ class @LabelsSelect ...@@ -45,6 +47,20 @@ class @LabelsSelect
title: $(@).text().trim() 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 callback data
renderRow: (label) -> renderRow: (label) ->
selected = if label.title is selectedLabel then "is-active" else "" selected = if label.title is selectedLabel then "is-active" else ""
...@@ -56,7 +72,7 @@ class @LabelsSelect ...@@ -56,7 +72,7 @@ class @LabelsSelect
</li>" </li>"
filterable: true filterable: true
search: search:
fields: ['name'] fields: ['title']
selectable: true selectable: true
fieldName: $(dropdown).data('field-name') fieldName: $(dropdown).data('field-name')
id: (label) -> id: (label) ->
......
...@@ -39,7 +39,7 @@ ...@@ -39,7 +39,7 @@
- if params[:label_name] - if params[:label_name]
= hidden_field_tag(:label_name, params[:label_name]) = hidden_field_tag(:label_name, params[:label_name])
.dropdown .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 %span.dropdown-toggle-text
Label Label
= icon('chevron-down') = 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