diff options
author | Phil Hughes <me@iamphill.com> | 2016-03-08 15:18:01 +0000 |
---|---|---|
committer | Phil Hughes <me@iamphill.com> | 2016-03-10 13:54:54 +0000 |
commit | 7744b67f7518727dceb83682402772432870cdab (patch) | |
tree | 73e5584c572cff2aebe4f94c75be0b90d8558031 /app/assets/javascripts | |
parent | dd35de1ad8e6ff8436552666d3f9f9bec0a309d9 (diff) | |
download | gitlab-ce-7744b67f7518727dceb83682402772432870cdab.tar.gz |
Stops excute remote data fetcher when already recieved data
Diffstat (limited to 'app/assets/javascripts')
-rw-r--r-- | app/assets/javascripts/gl_dropdown.js.coffee | 3 | ||||
-rw-r--r-- | app/assets/javascripts/labels_select.js.coffee | 18 |
2 files changed, 19 insertions, 2 deletions
diff --git a/app/assets/javascripts/gl_dropdown.js.coffee b/app/assets/javascripts/gl_dropdown.js.coffee index a714ba3d675..591e0b6f41d 100644 --- a/app/assets/javascripts/gl_dropdown.js.coffee +++ b/app/assets/javascripts/gl_dropdown.js.coffee @@ -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 diff --git a/app/assets/javascripts/labels_select.js.coffee b/app/assets/javascripts/labels_select.js.coffee index 14ee529ba35..b4708f6537a 100644 --- a/app/assets/javascripts/labels_select.js.coffee +++ b/app/assets/javascripts/labels_select.js.coffee @@ -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) -> |