Growstuff/growstuff

View on GitHub
app/views/crops/_thumbnail.html.haml

Summary

Maintainability
Test Coverage
- cache crop do
  .card.crop-thumbnail
    = link_to crop_path(slug: crop.slug) do
      = image_tag(crop.thumbnail_url.presence || placeholder_image,
                          alt: "Image of #{crop.name}",
                          class: 'img img-card')


    .text
      %h3.crop-name= link_to crop.name, crop_path(slug: crop.slug)
      - if crop.scientific_names.any?
        %div.crop-sci-name
          = crop.scientific_names.first