summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacob Schatz <jschatz@gitlab.com>2016-06-23 21:42:04 +0000
committerJacob Schatz <jschatz@gitlab.com>2016-06-23 21:42:04 +0000
commitd61c69f450f338f745e73c7dfba8c37416b443cd (patch)
treef0d9d0c1a6507625434c80064367de9b7a50cd4c
parentcf832135144bc41c6ed4fb69e9b36d70b1752324 (diff)
parentfcfe87510bc6add78a6be291400df7504c84de54 (diff)
downloadgitlab-ce-d61c69f450f338f745e73c7dfba8c37416b443cd.tar.gz
Merge branch '18536_status_dropdown_label' into 'master'
Set button label when picking an option from status dropdown ## What does this MR do? Fixes an issue with the status dropdown. It was not setting up the correct label after picking an option ## What are the relevant issue numbers? Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/18536 ## Screenshots (if relevant) **Previous** ![status-select-previous](/uploads/7c6adbd6c5ba2660dc39a762d53d3b68/status-select-previous.gif) **After** ![status-select](/uploads/91483efed8fbd63a79a01c9ca2154b74/status-select.gif) ## Does this MR meet the acceptance criteria? - [ ] [CHANGELOG](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CHANGELOG) entry added - [ ] [Documentation created/updated](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/development/doc_styleguide.md) - [ ] API support added - [ ] Tests - [ ] Added for this feature/bug - [x] All builds are passing - [ ] Conform by the [style guides](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CONTRIBUTING.md#style-guides) - [x] Branch has no merge conflicts with `master` (if you do - rebase it please) - [ ] [Squashed related commits together](https://git-scm.com/book/en/Git-Tools-Rewriting-History#Squashing-Commits) See merge request !4771
-rw-r--r--app/assets/javascripts/gl_dropdown.js.coffee8
-rw-r--r--app/assets/javascripts/issue_status_select.js.coffee7
2 files changed, 11 insertions, 4 deletions
diff --git a/app/assets/javascripts/gl_dropdown.js.coffee b/app/assets/javascripts/gl_dropdown.js.coffee
index deaed6c11e8..703128fecb3 100644
--- a/app/assets/javascripts/gl_dropdown.js.coffee
+++ b/app/assets/javascripts/gl_dropdown.js.coffee
@@ -462,7 +462,7 @@ class GitLabDropdown
# Toggle the dropdown label
if @options.toggleLabel
- @updateLabel()
+ @updateLabel(selectedObject, el, @)
else
selectedObject
else if el.hasClass(INDETERMINATE_CLASS)
@@ -489,7 +489,7 @@ class GitLabDropdown
# Toggle the dropdown label
if @options.toggleLabel
- @updateLabel(selectedObject, el)
+ @updateLabel(selectedObject, el, @)
if value?
if !field.length and fieldName
@addInput(fieldName, value)
@@ -588,8 +588,8 @@ class GitLabDropdown
# Scroll the dropdown content up
$dropdownContent.scrollTop(listItemTop - dropdownContentTop)
- updateLabel: (selected = null, el = null) =>
- $(@el).find(".dropdown-toggle-text").text @options.toggleLabel(selected, el)
+ updateLabel: (selected = null, el = null, instance = null) =>
+ $(@el).find(".dropdown-toggle-text").text @options.toggleLabel(selected, el, instance)
$.fn.glDropdown = (opts) ->
return @.each ->
diff --git a/app/assets/javascripts/issue_status_select.js.coffee b/app/assets/javascripts/issue_status_select.js.coffee
index c5740f27ddd..ed50e2e698f 100644
--- a/app/assets/javascripts/issue_status_select.js.coffee
+++ b/app/assets/javascripts/issue_status_select.js.coffee
@@ -6,6 +6,13 @@ class @IssueStatusSelect
$(el).glDropdown(
selectable: true
fieldName: fieldName
+ toggleLabel: (selected, el, instance) =>
+ label = 'Author'
+ $item = instance.dropdown.find('.is-active')
+ label = $item.text() if $item.length
+ label
+ clicked: (item, $el, e)->
+ e.preventDefault()
id: (obj, el) ->
$(el).data("id")
)