ozfortress/citadel

View on GitHub
app/views/forums/threads/show.html.haml

Summary

Maintainability
Test Coverage
- content_for(:title) { "#{@thread.title} | Forums" }

.mb-5
  = render 'forums/head', object: @thread, subheading: present(@thread).status_icons

  .btn-toolbar.guttered.mb-2
    - if user_can_edit_thread?
      = link_to edit_forums_thread_path(@thread), class: 'btn btn-sm btn-admin' do
        = inline_svg_tag 'open_iconic/pencil.svg', class: 'icon mr-2'
        %span
          Edit thread

    .col.d-none.d-md-block

    - if user_signed_in?
      = render 'forums/threads/subscribe_btn', thread: @thread

  - @posts.each do |post|
    = render post, quote_id: 'wmd-input-new-forums-post'

  = bootstrap_paginate @posts, list_classes: ['pagination justify-content-center mt-4']

  - if user_can_create_post?
    = bootstrap_form_for @post, url: forums_thread_posts_path(@thread, page: @page) do |f|
      = render 'forums/posts/form', f: f

      .d-flex.justify-content-end
        = f.submit 'Post', class: 'btn btn-primary'