Growstuff/growstuff

View on GitHub
app/views/photos/_card.html.haml

Summary

Maintainability
Test Coverage
.card.photo-card{id: "photo-#{photo.id}"}
  = link_to photo_path(id: photo.id) do
    = image_tag(photo.source == 'flickr' ? photo.fullsize_url : photo.thumbnail_url, alt: photo.title, class: 'img img-card')
  .card-body
    %h5.ellipsis
      = photo_icon
      = link_to photo.title, photo_path(id: photo.id)
    - if photo.owner_slug
      %i by #{link_to photo.owner_login_name, member_path(slug: photo.owner_slug)}
    - if photo.date_taken.present?
      %small.text-muted
        %time{datetime: photo.date_taken}= I18n.l(photo.date_taken.to_date)
    = render 'photos/likes', photo: photo