Growstuff/growstuff

View on GitHub
app/views/comments/_single.html.haml

Summary

Maintainability
Test Coverage
.card.comment
  .card-body
    .row
      .col
        = render "members/tiny", member: comment.author
        - if can?(:edit, comment) || can?(:destroy, comment)
          %hr/
          .dropdown
            %button#comment-edit-button.btn.dropdown-toggle{"aria-expanded" => "false", "aria-haspopup" => "true", "data-bs-toggle" => "dropdown", type: "button"} Actions
            .dropdown-menu.dropdown-menu-xs{"aria-labelledby" => "comment-edit-button"}
              - if can? :edit, comment
                = link_to edit_comment_path(comment), class: 'dropdown-item' do
                  = edit_icon
                  Edit
              - if can? :destroy, comment
                = link_to comment, method: :delete,
                  data: { confirm: 'Are you sure?' }, class: 'dropdown-item text-danger' do
                  = delete_icon
                  Delete
      .col-md-9.border-left
        .comment-meta.text-muted
          Posted by
          - if comment.author.discarded?
            Member Deleted
          - else
            = link_to comment.author.login_name, member_path(comment.author)
          on
          = comment.created_at
          - if comment.updated_at > comment.created_at
            and edited at
            = comment.updated_at

        .comment-body
          :markdown
            #{ strip_tags markdownify(comment.body) }