andey/bestofama

View on GitHub
app/views/amas/show.html.slim

Summary

Maintainability
Test Coverage
- set_meta_tags title: @ama.title
- set_meta_tags canonical: ama_url(@ama)

section itemscope='itemscope' itemtype="http://schema.org/SocialEvent"
  - cache ["info", @ama] do
    .row.ama
      .hidden-xs.col-sm-2.col-md-1.col-lg-1
        .karma-meter-large= karma_meter(@ama.karma).html_safe

      .col-xs-12.col-sm-10.col-md-11.col-lg-11
        .page-header
          h1 itemprop='name'= @ama.title.html_safe
          .list-group
            - @ama.ops.each do |op|
              div itemprop='performer'
                = render partial: 'ops/snippet', locals: { op: op }
          p= @ama.tag_list.map { |t| link_to t, tag_path(t) }.join(', ').html_safe


        - if @ama.content == '[removed]' && @ama.previous_version
          .well.well-small.ama-content
            blockquote itemprop='description'= @ama.previous_version.content.html_safe
        - elsif !@ama.content.blank?
          .well.well-small.ama-content
            blockquote itemprop='description'= @ama.content.html_safe

        p.ama-meta
          strong Comments
          | : 
          = @ama.comments
          |  • 
          strong Responses: 
          = @ama.responses
          |   • 
          strong Date:
          |  
          time itemprop='startDate' data-time="#{@ama.date.to_i}"
            = @ama.date
          = link_to "source", reddit_ama_path(@ama.permalink), :class => "pull-right", :rel => :nofollow, :itemscope => 'itemscope', :itemtype => "http://schema.org/Place", :itemprop => "url"

        #share

    - cache ["comments", @ama], :skip_digest => true do
      .row.ama.ama-comments
        .col-xs-12.col-sm-12.col-md-12.col-lg-12
          = render partial: 'comments/tree', collection: Comment.includes(:user).where(parent_key: @ama.key, relevant: true).order(:karma).reverse_order, as: :comment, locals: {depth: 0}