unepwcmc/SAPI

View on GitHub
app/assets/javascripts/species/views/elibrary_search_form/single_dropdown_component.js.coffee

Summary

Maintainability
Test Coverage
Species.SingleDropdownComponent = Ember.Component.extend
  layoutName: 'species/components/single-dropdown'
  classNames: ['popup-area']

  placeholderOrSelection: ( ->
    if @get('selection')
      @get('selection.name')
    else
      @get('placeholder')
  ).property('selection')

  actions:
    handleSelection: (selection) ->
      @sendAction('action', selection)

    handleDeselection: (selection) ->
      @sendAction('clearAction', selection)