unepwcmc/SAPI

View on GitHub
app/assets/javascripts/species/models/auto_complete_taxon_concept.js.coffee

Summary

Maintainability
Test Coverage
Species.AutoCompleteTaxonConcept = DS.Model.extend
  rankName: DS.attr("string")
  fullName: DS.attr("string")
  matchingNames: DS.attr("array")

  autoCompleteSuggestion: ( ->
    if @get('matchingNames') != undefined && @get('matchingNames').length > 0
      @get('fullName') + ' (' + @get('matchingNames').join( ', ') + ')'
    else
      @get('fullName')
  ).property('fullName', 'matchingNames')