Allow moderators to moderate investments
This commit is contained in:
@@ -1,15 +1,27 @@
|
||||
module AdminHelper
|
||||
|
||||
def side_menu
|
||||
render "/#{namespace}/menu"
|
||||
if namespace == 'moderation/budgets'
|
||||
render "/moderation/menu"
|
||||
else
|
||||
render "/#{namespace}/menu"
|
||||
end
|
||||
end
|
||||
|
||||
def namespaced_root_path
|
||||
"/#{namespace}"
|
||||
if namespace == 'moderation/budgets'
|
||||
"/moderation"
|
||||
else
|
||||
"/#{namespace}"
|
||||
end
|
||||
end
|
||||
|
||||
def namespaced_header_title
|
||||
t("#{namespace}.header.title")
|
||||
if namespace == 'moderation/budgets'
|
||||
t("moderation.header.title")
|
||||
else
|
||||
t("#{namespace}.header.title")
|
||||
end
|
||||
end
|
||||
|
||||
def menu_moderated_content?
|
||||
|
||||
@@ -78,6 +78,8 @@ class Budget
|
||||
scope :winners, -> { selected.compatible.where(winner: true) }
|
||||
scope :unselected, -> { not_unfeasible.where(selected: false) }
|
||||
scope :last_week, -> { where("created_at >= ?", 7.days.ago)}
|
||||
scope :sort_by_flags, -> { order(flags_count: :desc, updated_at: :desc) }
|
||||
scope :sort_by_created_at, -> { reorder(created_at: :desc) }
|
||||
|
||||
scope :by_budget, ->(budget) { where(budget: budget) }
|
||||
scope :by_group, ->(group_id) { where(group_id: group_id) }
|
||||
|
||||
@@ -29,6 +29,15 @@
|
||||
</li>
|
||||
<% end %>
|
||||
|
||||
<% if feature?(:budgets) %>
|
||||
<li <%= "class=is-active" if controller_name == "investments" %>>
|
||||
<%= link_to moderation_budget_investments_path do %>
|
||||
<span class="icon-budget"></span>
|
||||
<%= t("moderation.menu.flagged_investments") %>
|
||||
<% end %>
|
||||
</li>
|
||||
<% end %>
|
||||
|
||||
<li <%= "class=is-active" if controller_name == "comments" %>>
|
||||
<%= link_to moderation_comments_path do %>
|
||||
<span class="icon-comments"></span>
|
||||
|
||||
82
app/views/moderation/budgets/investments/index.html.erb
Normal file
82
app/views/moderation/budgets/investments/index.html.erb
Normal file
@@ -0,0 +1,82 @@
|
||||
<h2><%= t("moderation.budget_investments.index.title") %></h2>
|
||||
|
||||
<%= render "shared/filter_subnav", i18n_namespace: "moderation.budget_investments.index" %>
|
||||
|
||||
<div class="row">
|
||||
<h3 class="small-8 large-8 columns"><%= page_entries_info @budget_investments %></h3>
|
||||
<div class="small-4 large-4 columns">
|
||||
<div class="float-right">
|
||||
<%= t("moderation.budget_investments.index.order") %>
|
||||
<%= render "shared/order_selector", i18n_namespace: "moderation.budget_investments.index" %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<%= form_tag moderate_moderation_budget_investments_path(request.query_parameters), method: :put do %>
|
||||
<p class="js-check">
|
||||
<%= t("shared.check") %>:
|
||||
<%= link_to t("shared.check_all"), "#", data: { check_all: "budget_investment_ids[]" } %>
|
||||
|
|
||||
<%= link_to t("shared.check_none"), "#", data: { check_none: "budget_investment_ids[]" } %>
|
||||
</p>
|
||||
|
||||
<table class="clear">
|
||||
<tr>
|
||||
<th>
|
||||
<%= t("moderation.budget_investments.index.headers.budget_investment") %>
|
||||
</th>
|
||||
<th>
|
||||
<%= t("moderation.budget_investments.index.headers.moderate") %>
|
||||
</th>
|
||||
</tr>
|
||||
<% @budget_investments.each do |investment| %>
|
||||
<tr id="investment_<%= investment.id %>">
|
||||
<td>
|
||||
<%= link_to investment.title, admin_budget_budget_investment_path(
|
||||
budget_id: investment.budget_id,
|
||||
id: investment.id
|
||||
), target: "_blank" %>
|
||||
<br>
|
||||
<span class="date"><%= l investment.updated_at.to_date %></span>
|
||||
<span class="bullet"> • </span>
|
||||
<%= investment.flags_count %><span class="icon-flag flag-disable"></span>
|
||||
<span class="bullet"> • </span>
|
||||
<%= investment.author.username %>
|
||||
<br>
|
||||
<div class="moderation-description">
|
||||
<%= investment.description %>
|
||||
</div>
|
||||
</td>
|
||||
<td class="text-center">
|
||||
<%= check_box_tag "budget_investment_ids[]", investment.id, nil, id: "#{dom_id(investment)}_check" %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</table>
|
||||
|
||||
<%= submit_tag t("moderation.budget_investments.index.block_authors"),
|
||||
name: "block_authors",
|
||||
class: "button hollow alert",
|
||||
data: {
|
||||
confirm: t("moderation.budget_investments.index.confirm")
|
||||
} %>
|
||||
|
||||
<div class="float-right">
|
||||
<%= submit_tag t("moderation.budget_investments.index.hide_budget_investments"),
|
||||
name: "hide_budget_investments",
|
||||
class: "button hollow alert",
|
||||
data: {
|
||||
confirm: t("moderation.budget_investments.index.confirm")
|
||||
} %>
|
||||
|
||||
<%= submit_tag t("moderation.budget_investments.index.ignore_flags"),
|
||||
name: "ignore_flags",
|
||||
class: "button hollow",
|
||||
data: {
|
||||
confirm: t("moderation.budget_investments.index.confirm")
|
||||
} %>
|
||||
</div>
|
||||
|
||||
<%= paginate @budget_investments %>
|
||||
|
||||
<% end %>
|
||||
@@ -46,6 +46,7 @@ en:
|
||||
menu:
|
||||
flagged_comments: Comments
|
||||
flagged_debates: Debates
|
||||
flagged_investments: Budget investments
|
||||
proposals: Proposals
|
||||
proposal_notifications: Proposals notifications
|
||||
users: Block users
|
||||
@@ -68,6 +69,25 @@ en:
|
||||
created_at: Most recent
|
||||
flags: Most flagged
|
||||
title: Proposals
|
||||
budget_investments:
|
||||
index:
|
||||
block_authors: Block authors
|
||||
confirm: Are you sure?
|
||||
filter: Filter
|
||||
filters:
|
||||
all: All
|
||||
pending_flag_review: Pending
|
||||
with_ignored_flag: Marked as viewed
|
||||
headers:
|
||||
moderate: Moderate
|
||||
budget_investment: Budget investment
|
||||
hide_budget_investments: Hide budget investments
|
||||
ignore_flags: Mark as viewed
|
||||
order: Order by
|
||||
orders:
|
||||
created_at: Most recent
|
||||
flags: Most flagged
|
||||
title: Budget investments
|
||||
proposal_notifications:
|
||||
index:
|
||||
block_authors: Block authors
|
||||
|
||||
@@ -46,6 +46,7 @@ es:
|
||||
menu:
|
||||
flagged_comments: Comentarios
|
||||
flagged_debates: Debates
|
||||
flagged_investments: Proyectos de gasto
|
||||
proposals: Propuestas
|
||||
proposal_notifications: Notificaciones de propuestas
|
||||
users: Bloquear usuarios
|
||||
@@ -68,6 +69,25 @@ es:
|
||||
created_at: Más recientes
|
||||
flags: Más denunciadas
|
||||
title: Propuestas
|
||||
budget_investments:
|
||||
index:
|
||||
block_authors: Bloquear autores
|
||||
confirm: '¿Estás seguro?'
|
||||
filter: Filtro
|
||||
filters:
|
||||
all: Todos
|
||||
pending_flag_review: Pendientes de revisión
|
||||
with_ignored_flag: Marcadas como revisadas
|
||||
headers:
|
||||
moderate: Moderar
|
||||
budget_investment: Proyecto de gasto
|
||||
hide_budget_investments: Ocultar proyectos de gasto
|
||||
ignore_flags: Marcar como revisadas
|
||||
order: Ordenar por
|
||||
orders:
|
||||
created_at: Más recientes
|
||||
flags: Más denunciadas
|
||||
title: Proyectos de gasto
|
||||
proposal_notifications:
|
||||
index:
|
||||
block_authors: Bloquear autores
|
||||
|
||||
Reference in New Issue
Block a user