ozfortress/citadel

View on GitHub
app/views/leagues/rosters/comments/edit.html.haml

Summary

Maintainability
Test Coverage
- content_for(:title) { "Edit Comment | #{@roster.name}" }

= render 'shared/head', heading: 'Leagues / Roster', subheading: 'Editing admin comment'

%hr

.alert.alert-admin.d-inline-flex.px-3.py-2.mb-3
  %b
    Editing
    = link_to "admin comment ##{@comment.id}", edit_roster_path(@roster) + "##{@comment.paths.dom_id}"
    of roster
    = link_to @roster.name, edit_roster_path(@roster)
    for league
    = link_to @league.name, league_path(@league)


.card.bg-light.mb-3
  .card-body
    = bootstrap_form_for @comment, as: :comment, url: roster_comment_path(@roster, @comment) do |f|
      = render 'form', f: f

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


.alert.alert-danger.mb-3
  %label.font-weight-bold.alert-heading
    Danger Zone

  .btn-toolbar.guttered
    - if @comment.exists?
      = button_to @comment.paths.destroy, method: :delete, class: 'btn btn-sm btn-danger',
                  data: { confirm: 'Are you sure you want to delete this Comment?' } do
        = inline_svg_tag 'open_iconic/trash.svg', class: 'icon mr-2'
        Delete

    - else
      = button_to @comment.paths.restore, method: :patch, class: 'btn btn-sm btn-warning',
                    data: { confirm: 'Are you sure you want to restore this Comment?' } do
        = inline_svg_tag 'open_iconic/pulse.svg', class: 'icon mr-2'
        Restore