openaustralia/morph

View on GitHub
app/views/search/search.html.haml

Summary

Maintainability
Test Coverage
- title "Search#{" ‘#{@q}’" if @q}"
- description "Search morph.io scrapers and users#{" for ‘#{@q}’" if @q}"

.container
  %h1.label-heading
    Search
  = render partial: "search_form", locals: { q: @q, type: @type, show: @show }
  - if @q
    - if @all_scrapers.total_count.zero? && @owners.empty?
      %h2 No results found
      %p= no_search_results_message("scrapers or users", @q)
      %p
        Suggestions:
      %ul
        %li check the spelling
        %li try some more general or alternate terms
      %p You could also try browsing all #{link_to 'scrapers', scrapers_path} or #{link_to 'users', users_path}.
    - else
      .search-results.row
        .col-xs-12
          = render partial: "search_type_nav", locals: { q: @q, show: @show, type: @type, all_scrapers: @all_scrapers, owners: @owners }

        - if @type == "users"
          = render "results_owners", q: @q, owners: @owners
        - else
          = render "results_scrapers", q: @q, show: @show, scrapers: @scrapers, filtered_scrapers: @filtered_scrapers, all_scrapers: @all_scrapers