ozfortress/citadel

View on GitHub
app/views/forums/_page.html.haml

Summary

Maintainability
Test Coverage
.btn-toolbar.guttered.mb-2
  - if user_can_create_thread?
    = link_to new_forums_thread_path(topic: parent_topic), class: 'btn btn-sm btn-primary' do
      = inline_svg_tag 'open_iconic/plus.svg', class: 'icon mr-2'
      New thread

  - if user_can_manage_topic?
    = link_to new_forums_topic_path(parent: parent_topic), class: 'btn btn-sm btn-admin' do
      = inline_svg_tag 'open_iconic/plus.svg', class: 'icon mr-2'
      Create topic

    = link_to edit_forums_topic_path(parent_topic), class: 'btn btn-sm btn-admin' do
      = inline_svg_tag 'open_iconic/pencil.svg', class: 'icon mr-2'
      Edit this topic

  .spacer.d-none.d-md-block

  - if user_signed_in?
    = render 'forums/topics/subscribe_btn', topic: parent_topic


- unless topics.empty?
  %ul.list-group.mb-3
    - topics.each do |topic|
      %li.list-group-item.bg-light
        = render 'forums/topics/listing', topic: topic

- unless topic.description.empty?
  .markdown.mb-3= present(topic).description

- if threads.empty?
  = render 'forums/threads/empty'
- else
  %ul.list-group.mb-3
    - threads.each do |thread|
      %li.list-group-item{ class: present(thread).status_classes }
        = render 'forums/threads/listing', thread: thread


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