class Search pics: [] showSpinner: -> $('.search-container input').attr(disabled: 'disabled').blur() $('.search-container img').show() $('.autocomplete-container').hide() $('.artist_loading.failed').hide() this.hideSuggestions() false hideSpinner: -> $('.search-container input').removeAttr 'disabled' $('.search_field').focus() $('.search-container img').hide() false showSuggestions: (values) -> for item in values $('.suggestions ul').append '
  • ' +item.name+ ' ' +(if item.desc then '
    '+ item.desc +'' else '')+ '
  • ' $('.suggestions').show() false hideSuggestions: -> $('.suggestions ul li').remove() $('.suggestions').hide() false showArtistPics: (pics) -> $('.artist_loading.ok, .artist_pics').show() for pic in pics if @pics.indexOf(pic) == -1 @pics.push(pic); $('.artist_pics').append '
    ' false showError: -> $('.artist_loading.ok, .artist_pics').hide() $('.artist_loading.failed').show() @pics = [] $ -> window.search = new Search() false $('.search').live 'click', -> ajax.loadSearchPage() false $('#search_form').live 'submit', -> $('.autocomplete-container').remove() ajax.loadArtistData $('#search_field').val() false $('.suggestions a').live 'click', -> $('#search_field').val $(this).text() false