Skip to content
Snippets Groups Projects
Commit 9b777f41 authored by Alfredo Sumaran's avatar Alfredo Sumaran
Browse files

Pass dropdown instance to toggleLabel callback

parent 00906b5b
Branches
Tags
1 merge request!4771Set button label when picking an option from status dropdown
Loading
Loading
@@ -454,7 +454,7 @@ class GitLabDropdown
 
# Toggle the dropdown label
if @options.toggleLabel
@updateLabel()
@updateLabel(selectedObject, el, @)
else
selectedObject
else if el.hasClass(INDETERMINATE_CLASS)
Loading
Loading
@@ -481,7 +481,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)
Loading
Loading
@@ -580,8 +580,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 ->
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment