Add hide button in the user interface

The little menu with the hide notification link and block user link
has been added to each proposal notification.

JS for adding the fade efect has also been added.
This commit is contained in:
iagirre
2018-05-18 11:41:29 +02:00
committed by decabeza
parent 8dadb228f1
commit 88a8aaa083
7 changed files with 40 additions and 5 deletions

View File

@@ -33,6 +33,7 @@
//= require moderator_comment
//= require moderator_debates
//= require moderator_proposals
//= require moderator_proposal_notifications
//= require prevent_double_submission
//= require gettext
//= require annotator

View File

@@ -0,0 +1,7 @@
App.ModeratorProposalNotifications =
add_class_faded: (id) ->
$("##{id}").addClass("faded")
hide_moderator_actions: (id) ->
$("##{id} .js-moderator-proposal-notifications-actions:first").hide()

View File

@@ -1963,7 +1963,8 @@ table {
}
}
.comment-body {
.comment-body,
.notification-body {
img {
margin-right: $line-height / 2;

View File

@@ -0,0 +1,14 @@
<div class="reply">
<span class='js-moderation-actions'>
<% if can? :hide, notification %>
<%= link_to t("admin.actions.hide").capitalize, hide_moderation_proposal_notification_path(notification),
method: :put, remote: true, data: { confirm: t('admin.actions.confirm') } %>
<% end %>
<% if can? :hide, notification.author %>
<span class="divider">&nbsp;&bull;&nbsp;</span>
<%= link_to t("admin.actions.hide_author").capitalize, hide_moderation_user_path(notification.author_id),
method: :put, data: { confirm: t('admin.actions.confirm') } %>
<% end %>
</span>
</div>

View File

@@ -1,6 +1,6 @@
<div class="tabs-panel" id="tab-notifications" role="tab">
<div class="row">
<div class="small-12 column">
<div id="proposal_notifications" class="small-12 column notification-body">
<% if @notifications.blank? %>
<div class="callout primary text-center">
<%= t('proposals.show.no_notifications') %>
@@ -8,9 +8,15 @@
<% end %>
<% @notifications.each do |notification| %>
<h3><%= notification.title %></h3>
<p class="more-info"><%= notification.created_at.to_date %></p>
<p><%= notification.body %></p>
<div id="<%= dom_id(notification) %>">
<h3><%= notification.title %></h3>
<p class="more-info"><%= notification.created_at.to_date %></p>
<%= simple_format text_with_links(notification.body), {}, sanitize: false %>
<span class="js-flag-actions">
<%= render 'proposal_notifications/actions', notification: notification %>
</span>
</div>
<% end %>
</div>
</div>

View File

@@ -103,6 +103,9 @@ en:
poll:
one: "Poll"
other: "Polls"
proposal_notification:
one: "Proposal notification"
other: "Proposal notifications"
attributes:
budget:
name: "Name"

View File

@@ -103,6 +103,9 @@ es:
poll:
one: "Votación"
other: "Votaciones"
proposal_notification:
one: "Notificación de propuesta"
other: "Notificaciones de propuestas"
attributes:
budget:
name: "Nombre"