18 lines
704 B
CoffeeScript
18 lines
704 B
CoffeeScript
Dunlop.register_setup 'ui-dropdown', (target) ->
|
|
target.find('.ui.dropdown').dropdown() # assume fomantic that has the clearable class option, a lot better than the below custom code
|
|
#Dunlop.register_setup 'ui-dropdown', (target) ->
|
|
# target.find('.ui.dropdown').each ->
|
|
# el = $(@)
|
|
# settings = el.data() || {}
|
|
# can_clear = not el.find('option:first').val()
|
|
# settings.fireOnInit = true
|
|
# settings.onChange = (value, text, item) ->
|
|
# return unless can_clear
|
|
# dropdown = $(@)
|
|
# if value
|
|
# clear_icon = $('<i class="delete icon"></i>').click ->
|
|
# dropdown.dropdown('clear')
|
|
# $(@).remove()
|
|
# el.after clear_icon
|
|
# el.dropdown settings
|