weathermen/soundstorm

View on GitHub
app/views/searches/show.html.haml

Summary

Maintainability
Test Coverage
%article.search
  %header.search__summary
    %h1.search__title
      #{@search.total_count} results for "#{@search.query}"
    %nav.search__filters
      - Search::TYPES.each do |type|
        = link_to search_filter_url(type), class: search_filter_class(type) do
          .search-filter__count= @search.count_for(type)
          .search-filter__name= type.titleize.pluralize
  %main.search__listing
    %ul.search__results{ class: @search.css_class }
      - if @search.any?
        - @search.each do |result|
          %li.search-result{ class: "search-result--#{result.param_key}" }
            = render result
      - else
        %p.search__no-results
          - if params[:type].present?
            = t('.no_results', type: params[:type], query: params[:q])
          - else
            = t('.nothing_found', query: params[:q])