Merge pull request #3376 from LextrendIT/3350_rename_debates_comments_admin

Refactor admin/debates and admin/comments to hidden
This commit is contained in:
Javier Martín
2019-06-05 19:15:21 +02:00
committed by GitHub
20 changed files with 63 additions and 62 deletions

View File

@@ -1,4 +1,4 @@
class Admin::CommentsController < Admin::BaseController
class Admin::HiddenCommentsController < Admin::BaseController
has_filters %w{without_confirmed_hide all with_confirmed_hide}
before_action :load_comment, only: [:confirm_hide, :restore]

View File

@@ -1,4 +1,4 @@
class Admin::DebatesController < Admin::BaseController
class Admin::HiddenDebatesController < Admin::BaseController
include FeatureFlags
feature_flag :debates
@@ -29,4 +29,4 @@ class Admin::DebatesController < Admin::BaseController
@debate = Debate.with_hidden.find(params[:id])
end
end
end

View File

@@ -45,5 +45,4 @@ class Officing::BaseController < ApplicationController
def current_booth
Poll::Booth.where(id: session[:booth_id]).first
end
end

View File

@@ -25,7 +25,7 @@ module AdminHelper
end
def moderated_sections
["hidden_proposals", "debates", "comments", "hidden_users", "activity",
["hidden_proposals", "hidden_debates", "hidden_comments", "hidden_users", "activity",
"hidden_budget_investments"]
end

View File

@@ -141,8 +141,8 @@
<% end %>
<% if feature?(:debates) %>
<li <%= "class=is-active" if controller_name == "debates" %>>
<%= link_to t("admin.menu.hidden_debates"), admin_debates_path %>
<li <%= "class=is-active" if controller_name == "hidden_debates" %>>
<%= link_to t("admin.menu.hidden_debates"), admin_hidden_debates_path %>
</li>
<% end %>
@@ -152,8 +152,8 @@
</li>
<% end %>
<li <%= "class=is-active" if controller_name == "comments" %>>
<%= link_to t("admin.menu.hidden_comments"), admin_comments_path %>
<li <%= "class=is-active" if controller_name == "hidden_comments" %>>
<%= link_to t("admin.menu.hidden_comments"), admin_hidden_comments_path %>
</li>
<li <%= "class=is-active" if controller_name == "proposal_notifications" %>>

View File

@@ -2,6 +2,7 @@
admin_budget_budget_investments_path(csv_params),
class: "float-right small clear" %>
<% if params[:advanced_filters].include?("winners") %>
<% if display_calculate_winners_button?(@budget) %>
<%= link_to calculate_winner_button_text(@budget),

View File

@@ -1,7 +1,8 @@
<h2><%= t("admin.comments.index.title") %></h2>
<h2><%= t("admin.hidden_comments.index.title") %></h2>
<p><%= t("admin.shared.moderated_content") %></p>
<%= render "shared/filter_subnav", i18n_namespace: "admin.comments.index" %>
<%= render "shared/filter_subnav", i18n_namespace: "admin.hidden_comments.index" %>
<% if @comments.any? %>
<h3 class="margin"><%= page_entries_info @comments %></h3>
@@ -17,20 +18,20 @@
<td>
<%= text_with_links comment.body %><br>
<% if comment.commentable.hidden? %>
(<%= t("admin.comments.index.hidden_#{comment.commentable_type.downcase}") %>: <%= comment.commentable.title %>)
(<%= t("admin.hidden_comments.index.hidden_#{comment.commentable_type.downcase}") %>: <%= comment.commentable.title %>)
<% else %>
<%= link_to comment.commentable.title, commentable_path(comment) %>
<% end %>
</td>
<td>
<%= link_to t("admin.actions.restore"),
restore_admin_comment_path(comment, request.query_parameters),
restore_admin_hidden_comment_path(comment, request.query_parameters),
method: :put,
data: { confirm: t("admin.actions.confirm") },
class: "button hollow warning" %>
<% unless comment.confirmed_hide? %>
<%= link_to t("admin.actions.confirm_hide"),
confirm_hide_admin_comment_path(comment, request.query_parameters),
confirm_hide_admin_hidden_comment_path(comment, request.query_parameters),
method: :put,
class: "button" %>
<% end %>
@@ -43,6 +44,6 @@
<%= paginate @comments %>
<% else %>
<div class="callout primary margin">
<%= t("admin.comments.index.no_hidden_comments") %>
<%= t("admin.hidden_comments.index.no_hidden_comments") %>
</div>
<% end %>

View File

@@ -1,7 +1,8 @@
<h2><%= t("admin.debates.index.title") %></h2>
<h2><%= t("admin.hidden_debates.index.title") %></h2>
<p><%= t("admin.shared.moderated_content") %></p>
<%= render "shared/filter_subnav", i18n_namespace: "admin.debates.index" %>
<%= render "shared/filter_subnav", i18n_namespace: "admin.hidden_debates.index" %>
<% if @debates.any? %>
<h3 class="margin"><%= page_entries_info @debates %></h3>
@@ -25,13 +26,13 @@
</td>
<td class="align-top">
<%= link_to t("admin.actions.restore"),
restore_admin_debate_path(debate, request.query_parameters),
restore_admin_hidden_debate_path(debate, request.query_parameters),
method: :put,
data: { confirm: t("admin.actions.confirm") },
class: "button hollow warning" %>
<% unless debate.confirmed_hide? %>
<%= link_to t("admin.actions.confirm_hide"),
confirm_hide_admin_debate_path(debate, request.query_parameters),
confirm_hide_admin_hidden_debate_path(debate, request.query_parameters),
method: :put,
class: "button" %>
<% end %>
@@ -44,6 +45,6 @@
<%= paginate @debates %>
<% else %>
<div class="callout primary margin">
<%= t("admin.debates.index.no_hidden_debates") %>
<%= t("admin.hidden_debates.index.no_hidden_debates") %>
</div>
<% end %>

View File

@@ -2,5 +2,5 @@
<h2 class="sidebar-title"><%= t("shared.tags_cloud.districts") %></h2>
<br>
<%= link_to map_proposals_path, id: "map", title: t("shared.tags_cloud.districts_list") do %>
<%= image_tag(image_path_for("map.jpg", alt: t("shared.tags_cloud.districts_list")) %>
<%= image_tag(image_path_for("map.jpg", alt: t("shared.tags_cloud.districts_list"))) %>
<% end %>

View File

@@ -1,6 +1,6 @@
{
"<%= t("stats.index.visits") %>" : "<%= number_with_delimiter(@visits) %>",
"<%= t("stats.index.debates") %>" : <%= number_with_delimiter(@debates) %>",
"<%= t("stats.index.debates") %>" : "<%= number_with_delimiter(@debates) %>",
"<%= t("stats.index.proposals") %>" : "<%= number_with_delimiter(@proposals) %>",
"<%= t("stats.index.comments") %>" : "<%= number_with_delimiter(@comments) %>",
"<%= t("stats.index.proposal_votes") %>" : "<%= number_with_delimiter(@proposal_votes) %>",
@@ -9,4 +9,4 @@
"<%= t("stats.index.votes") %>" : "<%= number_with_delimiter(@votes) %>",
"<%= t("stats.index.verified_users") %>" : "<%= number_with_delimiter(@verified_users) %>",
"<%= t("stats.index.unverified_users") %>" : "<%= number_with_delimiter(@unverified_users) %>"
}
}