osu-cascades/ecotone-web

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

Summary

Maintainability
Test Coverage
- content_for_title('Plots on Campus')
- content_for(:subnav) do
  = link_to('Add Plot', new_plot_path, class: 'button primary', title: 'Add a new plot', method: 'get') if current_user&.admin?
.gallery
  - @plots.each do |plot|
    .tile#plot
      - if plot.photo.attached?
        .img-tile{ :style => "background-image: url(#{rails_blob_url(photo(plot))})", :alt => "Photo of #{plot.photo}" }
      -else
        .img-tile.default
          = image_tag(photo(plot), alt: "Photo of #{plot.photo}")
      .desc
        %h3= "Plot ##{plot.plot_id}"
        %p= truncate(plot.formatted_location_description, length:75, separator:' ')
      = link_to "", plot, title: "Details of #{plot}", class: "tile-link"