Merge pull request #643 from Serabe/feature/paragraphs-in-comments

Add paragraphs to comments
This commit is contained in:
Juanjo Bazán
2015-10-26 11:44:56 +01:00
4 changed files with 15 additions and 15 deletions

View File

@@ -2,7 +2,7 @@ module TextWithLinksHelper
def text_with_links(text) def text_with_links(text)
return unless 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 Rinku.auto_link(sanitized, :all, 'target="_blank" rel="nofollow"').html_safe
end end

View File

@@ -63,17 +63,17 @@
</div> </div>
<% if comment.as_administrator? %> <% 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? %> <% 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 %> <% 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? %> <% 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 %> <% 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 %> <% else %>
<p class="comment-user"><%= text_with_links comment.body %></p> <div class="comment-user"><%= simple_format text_with_links comment.body %></div>
<% end %> <% end %>
<span id="<%= dom_id(comment) %>_votes" class="comment-votes right"> <span id="<%= dom_id(comment) %>_votes" class="comment-votes right">
<%= render 'comments/votes', comment: comment %> <%= render 'comments/votes', comment: comment %>

View File

@@ -219,7 +219,7 @@ feature 'Commenting debates' do
within "#comments" do within "#comments" do
expect(page).to have_content "I am moderating!" expect(page).to have_content "I am moderating!"
expect(page).to have_content "Moderator ##{moderator.id}" 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" expect(page).to have_css "img.moderator-avatar"
end end
end end
@@ -244,7 +244,7 @@ feature 'Commenting debates' do
within "#comment_#{comment.id}" do within "#comment_#{comment.id}" do
expect(page).to have_content "I am moderating!" expect(page).to have_content "I am moderating!"
expect(page).to have_content "Moderator ##{moderator.id}" 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" expect(page).to have_css "img.moderator-avatar"
end end
@@ -275,7 +275,7 @@ feature 'Commenting debates' do
within "#comments" do within "#comments" do
expect(page).to have_content "I am your Admin!" expect(page).to have_content "I am your Admin!"
expect(page).to have_content "Administrator ##{admin.id}" 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" expect(page).to have_css "img.admin-avatar"
end end
end end
@@ -300,7 +300,7 @@ feature 'Commenting debates' do
within "#comment_#{comment.id}" do within "#comment_#{comment.id}" do
expect(page).to have_content "Top of the world!" expect(page).to have_content "Top of the world!"
expect(page).to have_content "Administrator ##{admin.id}" 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" expect(page).to have_css "img.admin-avatar"
end end

View File

@@ -219,7 +219,7 @@ feature 'Commenting proposals' do
within "#comments" do within "#comments" do
expect(page).to have_content "I am moderating!" expect(page).to have_content "I am moderating!"
expect(page).to have_content "Moderator ##{moderator.id}" 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" expect(page).to have_css "img.moderator-avatar"
end end
end end
@@ -244,7 +244,7 @@ feature 'Commenting proposals' do
within "#comment_#{comment.id}" do within "#comment_#{comment.id}" do
expect(page).to have_content "I am moderating!" expect(page).to have_content "I am moderating!"
expect(page).to have_content "Moderator ##{moderator.id}" 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" expect(page).to have_css "img.moderator-avatar"
end end
@@ -275,7 +275,7 @@ feature 'Commenting proposals' do
within "#comments" do within "#comments" do
expect(page).to have_content "I am your Admin!" expect(page).to have_content "I am your Admin!"
expect(page).to have_content "Administrator ##{admin.id}" 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" expect(page).to have_css "img.admin-avatar"
end end
end end
@@ -300,7 +300,7 @@ feature 'Commenting proposals' do
within "#comment_#{comment.id}" do within "#comment_#{comment.id}" do
expect(page).to have_content "Top of the world!" expect(page).to have_content "Top of the world!"
expect(page).to have_content "Administrator ##{admin.id}" 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" expect(page).to have_css "img.admin-avatar"
end end