shammond42/higgins-catalog

View on GitHub
app/views/artifacts/index.html.haml

Summary

Maintainability
Test Coverage
- set_subtitle "#{params[:query].try(:titlecase) || 'Search'}"
- content_for(:sidebar) do 
  = render partial: 'artifacts/search_options'

%h1 Artifact List

- if @artifacts.any?
  %ul.search-results
    - @artifacts.each do |artifact|
      %a{href: "/artifacts/#{artifact.accession_number}"}
        %li{style: 'margin-bottom: 5px; padding: 10px;'}
          - if key_image(artifact).present?
            =image_tag key_image(artifact).image.thumb.url, style: 'float: right; height: 60px; width: 80px; border: solid 1px black; margin-top: -5px;'
          %strong= format_artifact_name(artifact)
          %br
          %span.muted
            %span.origin
              = artifact.origin_with_date
            %span.accession_number
              == HAM (#{artifact.accession_number})

  - if using_phone?
    .pagination-info
      = page_entries_info(@artifacts)
      = will_paginate @artifacts, page_links:false, class: 'pagination pagination-centered'
  - else
    = will_paginate @artifacts, inner_window: 2, outer_window: 1,
      class: 'pagination pagination-centered'
- else
  .alert
    %h2 Sorry, we didn't any matches for your search.
    %p Please change your search criteria in the search panel on the right and try again.