Growstuff/growstuff

View on GitHub
app/views/home/_plantings.html.haml

Summary

Maintainability
Test Coverage
%h2= t('.recently_planted')
- Planting.homepage_records(6).each do |planting|
  = link_to planting_path(slug: planting['slug']), class: 'list-group-item list-group-item-action flex-column align-items-start' do
    .d-flex.w-100.justify-content-between.homepage--list-item
      %p.mb-2
        = image_tag planting['thumbnail_url'], width: 75, class: 'rounded shadow', alt: "Image of #{planting['crop_name']} by #{planting['owner_login_name']}"
      .text-right
        %h4= planting['crop_name']
        - if planting['planted_from'].present?
          %span.badge.badge-success= planting['planted_from'].pluralize
        %small.text-muted planted by #{planting['owner_login_name']}