johnrees/fablabs

View on GitHub
app/views/machines/_machine.html.haml

Summary

Maintainability
Test Coverage
- cache ["v2", machine] do
  = content_tag_for :div, machine, class: 'col-sm-6 col-md-4 col-xl-3 mb-3' do
    .card.shadow.float-left.h-100.w-100
      .card-img-top.text-center
        = link_to machine do
          - if machine.photo.present?
            = image_tag machine.photo.thumb("230x245>").url

      .card-content.position-relative.px-4.py-3
        = link_to machine do
          .card-content.font-weight-bold.text-small= machine.brand
          .card-title= machine
          .card-text.text-small
            - if machine.tags.length > 0
              %ul.taglist.list-unstyled.list-inline
                - machine.tags.limit(3).each do |tag|
                  %li.gray.list-inline-item.mb-0
                    %strong
                      = link_to "##{tag}", machines_path(tag: tag.name)

              = link_to machine do
                = image_tag ("icons/arrow-right.svg"), :class => "card-arrow"