hummingbird-me/hummingbird

View on GitHub
frontend/app/templates/components/instant-search.hbs

Summary

Maintainability
Test Coverage
<span {{bind-attr class="collapsed:hidden"}}>
  <form {{action submitQuery on="submit"}}>
    {{input value=query classNames="search-field" placeholder="Search for..."}}
  </form>

  {{#if searchResults}}
    <ul class="search-dropdown">
      {{#each searchResults as |result|}}
        <li class="search-result">
          {{#link-to result.type result.link title=result.title}}
            <div class="search-result-thumb">
              <img {{bind-attr src="result.image"}} />
            </div>
            <div class="search-result-title">{{result.title}}</div>
            <span {{bind-attr class=":search-result-badge :badge result.type"}}>{{result.type}}</span>
            <div class="search-result-break"></div>
          {{/link-to}}
        </li>
      {{/each}}
      <li class="search-result show-more">
        {{#link-to 'search' (query-params query=query)}}Show More{{/link-to}}
      </li>
    </ul>
  {{/if}}
</span>

<a class="search-link" {{action 'toggleSearchVisibility'}}>
  <i class="fa fa-search"></i>
</a>