Merge pull request #281 from AyuntamientoMadrid/hidden_comments

Estilo y ocultación de comentarios
This commit is contained in:
Raimond Garcia
2015-08-28 19:26:44 +02:00
6 changed files with 24 additions and 15 deletions

View File

@@ -574,6 +574,8 @@
padding: rem-calc(6) rem-calc(12);
}
&.is-admin {
background: $comment-admin;
padding: rem-calc(6) rem-calc(12);
@@ -585,6 +587,12 @@
}
}
.is-deleted {
background: $deleted;
margin-left: rem-calc(42);
padding: rem-calc(6) rem-calc(12);
}
.comment-children {
border-left: 1px dashed $border;
margin-left: rem-calc(42);

View File

@@ -822,6 +822,10 @@ img.initialjs-avatar {
background: $association;
}
.is-deleted {
background: $deleted;
}
.level-1 {
background: $level-1;
}

View File

@@ -76,6 +76,7 @@ $level-5: #F08A24;
$author: #008CCF;
$association: #C0392B;
$deleted: #E7E7E7;
$comment-author: rgba(45,144,248,.15);
$comment-level-5: rgba(255,241,204,1);

View File

@@ -61,10 +61,6 @@ class Comment < ActiveRecord::Base
cached_votes_down
end
def not_visible?
hidden? || user.hidden?
end
def ignored_flag?
ignored_flag_at.present?
end

View File

@@ -1,16 +1,18 @@
<div class="row">
<div id="<%= dom_id(comment) %>" class="comment small-12 column">
<% if comment.not_visible? %>
<%= t("debates.comment.deleted") %>
<% if comment.hidden? || comment.user.hidden? %>
<% if comment.children_count > 0 %>
<div class="is-deleted">
<p><%= t("debates.comment.deleted") %></p>
</div>
<% end %>
<% else %>
<% if comment.as_administrator? %>
<%= image_tag("admin_avatar.png", size: 32, class: "admin-avatar left") %>
<% elsif comment.as_moderator? %>
<%= image_tag("moderator_avatar.png", size: 32, class: "moderator-avatar left") %>
<% else %>
<% if comment.user.organization? %>
<%= image_tag("collective_avatar.png", size: 32, class: "avatar left") %>
<% else %>
@@ -19,7 +21,6 @@
<% if comment.user.hidden? %>
<i class="icon-deleted user-deleted"></i>
<% end %>
<% end %>
<div class="comment-body">
@@ -91,11 +92,10 @@
<% end %>
</div>
</div>
<% end %>
<div class="comment-children">
<%= render comment.children.for_render.reorder('id DESC, lft') %>
</div>
<div class="comment-children">
<%= render comment.children.for_render.reorder('id DESC, lft') %>
</div>
</div>
</div>

View File

@@ -4,7 +4,7 @@ feature 'Moderate Comments' do
feature 'Hiding Comments' do
scenario 'Hide', :js do
scenario 'Hide without children hides the comment completely', :js do
citizen = create(:user)
moderator = create(:moderator)
@@ -23,7 +23,7 @@ feature 'Moderate Comments' do
visit debate_path(debate)
expect(page).to have_css('.comment', count: 1)
expect(page).to have_content('This comment has been deleted')
expect(page).to_not have_content('This comment has been deleted')
expect(page).to_not have_content('SPAM')
end