Growstuff/growstuff

View on GitHub
app/views/posts/index.html.haml

Summary

Maintainability
Test Coverage
- content_for :title, @author ? t('.title.author_posts', author: @author) : t('.title.default')

- content_for :breadcrumbs do
  %li.breadcrumb-item= link_to 'Posts', posts_path
  - if @author.present?
    %li.breadcrumb-item= link_to @author, @author
    %li.breadcrumb-item.active= link_to 'posts', posts_path(author: @author.slug)

%h1= @author ? t('.title.author_posts', author: @author) : t('.title.default')

.row
  .col-md-2
  .col-md-8= will_paginate @posts
.row
  .col-md-2
    = render 'layouts/nav', model: Post
    %hr/
    %p
      - if @author
        = render @author
        Subscribe to
        = succeed "." do
          = link_to "#{@author}'s posts RSS feed", member_posts_path(@author, format: 'rss')

      - else
        Subscribe to the #{ENV['GROWSTUFF_SITE_NAME']}
        = link_to "posts RSS feed", posts_path(format: 'rss')
        or
        = succeed "." do
          = link_to "comments RSS feed", comments_path(format: 'rss')
  .col-md-10
    .row.posts
      - @posts.each do |post|
        .col-lg-3.col-md-6.mb-3.post
          = render 'posts/preview', post: post
    = will_paginate @posts