hummingbird-me/hummingbird

View on GitHub
app/views/reviews/_review.html.haml

Summary

Maintainability
Test Coverage
%hr
.large-12.columns.no-padding.popular-reviews
  .large-1.columns.no-padding.center
    - if image == :user
      = avatar_link review.user, :thumb_small
    - elsif image == :anime
      = link_to image_tag(review.anime.poster_image.url(:medium), alt: review.anime.canonical_title(current_user)), anime_review_path(review.anime, review)
  .large-9.columns.review-left-wrapper
    %h5 
      - if image == :anime
        = anime_link review.anime
        review by
      - else
        Review by
      = link_to review.user.name, review.user
    %p= review.summary || truncate(strip_tags(review.content), length: 140, separator: ' ', omission: '...')
    %p= link_to "Read Review", anime_review_path(review.anime, review)
  .large-2.columns.no-padding
    - if review.rating
      .chart{:"data-percent" => review.rating * 10}
        = review.rating