Merge pull request #643 from Serabe/feature/paragraphs-in-comments
Add paragraphs to comments
This commit is contained in:
@@ -2,7 +2,7 @@ module TextWithLinksHelper
|
||||
|
||||
def text_with_links(text)
|
||||
return unless text
|
||||
sanitized = sanitize text, tags: [], attributes: []
|
||||
sanitized = sanitize(text, tags: [], attributes: [])
|
||||
Rinku.auto_link(sanitized, :all, 'target="_blank" rel="nofollow"').html_safe
|
||||
end
|
||||
|
||||
|
||||
@@ -63,17 +63,17 @@
|
||||
</div>
|
||||
|
||||
<% if comment.as_administrator? %>
|
||||
<p class="comment-user is-admin"><%= text_with_links comment.body %></p>
|
||||
<div class="comment-user is-admin"><%= simple_format text_with_links comment.body %></div>
|
||||
<% elsif comment.as_moderator? %>
|
||||
<p class="comment-user is-moderator"><%= text_with_links comment.body %></p>
|
||||
<div class="comment-user is-moderator"><%= simple_format text_with_links comment.body %></div>
|
||||
<% elsif comment.user.official? && comment.user_id == @commentable.author_id %>
|
||||
<p class="comment-user level-<%= comment.user.official_level %> is-author"><%= text_with_links comment.body %></p>
|
||||
<div class="comment-user level-<%= comment.user.official_level %> is-author"><%= simple_format text_with_links comment.body %></div>
|
||||
<% elsif comment.user.official? %>
|
||||
<p class="comment-user level-<%= comment.user.official_level %>"><%= text_with_links comment.body %></p>
|
||||
<div class="comment-user level-<%= comment.user.official_level %>"><%= simple_format text_with_links comment.body %></div>
|
||||
<% elsif comment.user_id == @commentable.author_id %>
|
||||
<p class="comment-user is-author"><%= text_with_links comment.body %></p>
|
||||
<div class="comment-user is-author"><%= simple_format text_with_links comment.body %></div>
|
||||
<% else %>
|
||||
<p class="comment-user"><%= text_with_links comment.body %></p>
|
||||
<div class="comment-user"><%= simple_format text_with_links comment.body %></div>
|
||||
<% end %>
|
||||
<span id="<%= dom_id(comment) %>_votes" class="comment-votes right">
|
||||
<%= render 'comments/votes', comment: comment %>
|
||||
|
||||
@@ -219,7 +219,7 @@ feature 'Commenting debates' do
|
||||
within "#comments" do
|
||||
expect(page).to have_content "I am moderating!"
|
||||
expect(page).to have_content "Moderator ##{moderator.id}"
|
||||
expect(page).to have_css "p.is-moderator"
|
||||
expect(page).to have_css "div.is-moderator"
|
||||
expect(page).to have_css "img.moderator-avatar"
|
||||
end
|
||||
end
|
||||
@@ -244,7 +244,7 @@ feature 'Commenting debates' do
|
||||
within "#comment_#{comment.id}" do
|
||||
expect(page).to have_content "I am moderating!"
|
||||
expect(page).to have_content "Moderator ##{moderator.id}"
|
||||
expect(page).to have_css "p.is-moderator"
|
||||
expect(page).to have_css "div.is-moderator"
|
||||
expect(page).to have_css "img.moderator-avatar"
|
||||
end
|
||||
|
||||
@@ -275,7 +275,7 @@ feature 'Commenting debates' do
|
||||
within "#comments" do
|
||||
expect(page).to have_content "I am your Admin!"
|
||||
expect(page).to have_content "Administrator ##{admin.id}"
|
||||
expect(page).to have_css "p.is-admin"
|
||||
expect(page).to have_css "div.is-admin"
|
||||
expect(page).to have_css "img.admin-avatar"
|
||||
end
|
||||
end
|
||||
@@ -300,7 +300,7 @@ feature 'Commenting debates' do
|
||||
within "#comment_#{comment.id}" do
|
||||
expect(page).to have_content "Top of the world!"
|
||||
expect(page).to have_content "Administrator ##{admin.id}"
|
||||
expect(page).to have_css "p.is-admin"
|
||||
expect(page).to have_css "div.is-admin"
|
||||
expect(page).to have_css "img.admin-avatar"
|
||||
end
|
||||
|
||||
|
||||
@@ -219,7 +219,7 @@ feature 'Commenting proposals' do
|
||||
within "#comments" do
|
||||
expect(page).to have_content "I am moderating!"
|
||||
expect(page).to have_content "Moderator ##{moderator.id}"
|
||||
expect(page).to have_css "p.is-moderator"
|
||||
expect(page).to have_css "div.is-moderator"
|
||||
expect(page).to have_css "img.moderator-avatar"
|
||||
end
|
||||
end
|
||||
@@ -244,7 +244,7 @@ feature 'Commenting proposals' do
|
||||
within "#comment_#{comment.id}" do
|
||||
expect(page).to have_content "I am moderating!"
|
||||
expect(page).to have_content "Moderator ##{moderator.id}"
|
||||
expect(page).to have_css "p.is-moderator"
|
||||
expect(page).to have_css "div.is-moderator"
|
||||
expect(page).to have_css "img.moderator-avatar"
|
||||
end
|
||||
|
||||
@@ -275,7 +275,7 @@ feature 'Commenting proposals' do
|
||||
within "#comments" do
|
||||
expect(page).to have_content "I am your Admin!"
|
||||
expect(page).to have_content "Administrator ##{admin.id}"
|
||||
expect(page).to have_css "p.is-admin"
|
||||
expect(page).to have_css "div.is-admin"
|
||||
expect(page).to have_css "img.admin-avatar"
|
||||
end
|
||||
end
|
||||
@@ -300,7 +300,7 @@ feature 'Commenting proposals' do
|
||||
within "#comment_#{comment.id}" do
|
||||
expect(page).to have_content "Top of the world!"
|
||||
expect(page).to have_content "Administrator ##{admin.id}"
|
||||
expect(page).to have_css "p.is-admin"
|
||||
expect(page).to have_css "div.is-admin"
|
||||
expect(page).to have_css "img.admin-avatar"
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user