app/views/comments/_comment.html.haml
%li{class: 'media', id: dom_id(comment)}
= link_to user_path(comment.commenter), :class => 'pull-left' do
= image_tag(comment.commenter.gravatar_url(:size => "40"), class: "media-object img-rounded", alt: comment.commenter.name, title: comment.commenter.name)
.media-body
%h6.media-heading
= time_ago_in_words(comment.created_at)
ago by
= link_to user_path(comment.commenter) do
= comment.commenter.name
|
%a{ 'href' => 'javascript:void(0)', 'data-target' => "#replyComment#{dom_id(comment)}", 'data-toggle' => 'modal' }
Reply
- if can? :update, comment
|
%a{ 'href' => 'javascript:void(0)', 'data-target' => "#editComment#{dom_id(comment)}", 'data-toggle' => 'modal', type: 'button' }
Edit
%p
:markdown
#{ emojify comment.text }
- if !comment.comments.empty?
%ul.media-list
= render :partial => 'comments/comment', :collection => comment.comments, object: comment
.modal.fade{ id: "editComment#{dom_id(comment)}", role: "dialog", tabindex: "-1"}
.modal-dialog{role: "document"}
.modal-content
.modal-header
%button.close{"data-dismiss" => "modal", type: "button"}
%span{"aria-hidden" => "true"} ×
%h4.modal-title
Edit Comment
= comment.id
.modal-body
= render partial: 'comments/form', locals: { comment: comment, parent: comment.commentable, id: rand(36**10).to_s(36).upcase[0,5] }
.modal-footer
.modal.fade{ id: "replyComment#{dom_id(comment)}", role: "dialog", tabindex: "-1"}
.modal-dialog{role: "document"}
.modal-content
.modal-header
%button.close{'data-dismiss' => 'modal', type: 'button'}
%span{'aria-hidden' => 'true'} ×
%h4.modal-title
Reply to
= comment.commenter.name
.modal-body
%p
:markdown
#{ emojify comment.text }
%hr
#replyform
= render partial: 'comments/form', locals: { comment: @new_comment, parent: comment, id: rand(36**10).to_s(36).upcase[0,5] }
.modal-footer