ozfortress/citadel

View on GitHub
app/views/forums/posts/edit.html.haml

Summary

Maintainability
Test Coverage
- thread_title = @post.thread.title
- content_for(:title) { "Edit Post | #{thread_title}" }

= render 'forums/head', object: @post.thread, subheading: 'Editing post'

.card.bg-light.mb-3
  .card-body
    = bootstrap_form_for @post do |f|
      = render 'form', f: f

      .d-flex.justify-content-end
        = link_to 'Cancel', :back, class: 'btn btn-link mr-2'
        = f.primary 'Update'

- if user_can_manage_thread?(@thread)
  .alert.alert-danger.mb-3
    %label.font-weight-bold.alert-heading
      Danger Zone

    .btn-toolbar.guttered
      = button_to forums_post_path(@post), method: :delete, class: 'btn btn-sm btn-danger',
                  data: { confirm: 'Are you sure you want to delete this Post?' } do
        = inline_svg_tag 'open_iconic/trash.svg', class: 'icon mr-2'
        Delete