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
