improve blog comment replies
This commit is contained in:
@@ -30,6 +30,10 @@ class Blogpost < ActiveRecord::Base
|
|||||||
title
|
title
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def can_comment? user
|
||||||
|
!user.nil? && user.confirmed?
|
||||||
|
end
|
||||||
|
|
||||||
def send_new_mention_mail(old_content = "")
|
def send_new_mention_mail(old_content = "")
|
||||||
new_mentions = mentions(content) - mentions(old_content)
|
new_mentions = mentions(content) - mentions(old_content)
|
||||||
mails = []
|
mails = []
|
||||||
|
|||||||
@@ -22,5 +22,15 @@
|
|||||||
<%= render "comments/comment", c: c %>
|
<%= render "comments/comment", c: c %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<%= paginate @comments %>
|
<%= paginate @comments %>
|
||||||
<%= render "comments/new" %>
|
|
||||||
|
|
||||||
|
<% if current_user %>
|
||||||
|
<% if @post.can_comment? current_user %>
|
||||||
|
<%= render "comments/new" %>
|
||||||
|
<% else %>
|
||||||
|
<p>You don't have the required permission to reply here.</p>
|
||||||
|
<% end %>
|
||||||
|
<% else %>
|
||||||
|
<p>Please <%= link_to "Log in", login_path(return_path: request.env['PATH_INFO']), action: "new" %> to post a reply.</p>
|
||||||
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
@@ -1,7 +1,5 @@
|
|||||||
<% if current_user %>
|
<h3>New comment</h3>
|
||||||
<h3>New comment</h3>
|
<%= form_for [@post, @comment] do |f| %>
|
||||||
<%= form_for [@post, @comment] do |f| %>
|
<%= render partial: "md_editor", locals: {name: "comment[content]", content: @comment.content, mini: true} %>
|
||||||
<%= render partial: "md_editor", locals: {name: "comment[content]", content: @comment.content, mini: true} %>
|
<p><%= f.submit class: "btn blue" %></p>
|
||||||
<p><%= f.submit class: "btn blue" %></p>
|
|
||||||
<% end %>
|
|
||||||
<% end %>
|
<% end %>
|
||||||
Reference in New Issue
Block a user