Unifies bulk & debates moderation forms in a single one

This commit is contained in:
kikito
2015-09-21 15:41:01 +02:00
parent 8fc2058bd9
commit 757205a93e
15 changed files with 229 additions and 283 deletions

View File

@@ -31,12 +31,5 @@
<%= t("moderation.menu.users") %>
<% end %>
</li>
<li <%= "class=active" if controller_name == "bulk" %>>
<%= link_to moderation_bulk_path do %>
<i class="icon-debates"></i>
<%= t("moderation.menu.bulk") %>
<% end %>
</li>
</ul>
</nav>

View File

@@ -1,46 +0,0 @@
<h2><%= t("moderation.bulk.index.title") %></h2>
<h3><%= page_entries_info @debates %></h3>
<%= form_tag moderation_bulk_hide_path, method: :put do %>
<p class="right">
<%= t('moderation.bulk.index.check') %>:
<%= link_to t('moderation.bulk.index.check_all'), '#', data: {check_all: "debate_ids[]"} %>
|
<%= link_to t('moderation.bulk.index.check_none'), '#', data: {check_none: "debate_ids[]"} %>
</p>
<table>
<tr>
<th>
<%= t("moderation.bulk.index.headers.debate") %>
</th>
<th class="text-center"><%= t("moderation.bulk.index.headers.flags") %></th>
<th>
<%= t("moderation.bulk.index.headers.moderate") %>
</th>
</tr>
<% @debates.each do |debate| %>
<tr id="debate_<%= debate.id %>">
<td>
<%= link_to debate.title, debate, target: "_blank" %>
<span class="bullet">&nbsp;&bull;&nbsp;</span>
<%= debate.author.username %>
<span class="bullet">&nbsp;&bull;&nbsp;</span>
<span class="date"><%= l debate.updated_at.to_date %></span>
<br>
<%= debate.description %>
</td>
<td class="text-center"><%= debate.flags_count %></td>
<td class="text-center">
<%= check_box_tag "debate_ids[]", debate.id, nil, id: "#{dom_id(debate)}_check" %>
</td>
</tr>
<% end %>
</table>
<%= submit_tag t('moderation.bulk.index.hide_debates'), class: "button radius", data: {confirm: t('moderation.bulk.index.confirm')} %>
<%= submit_tag t('moderation.bulk.index.block_authors'), class: "button radius", data: {confirm: t('moderation.bulk.index.confirm')} %>
<% end %>
<%= paginate @debates %>

View File

@@ -13,7 +13,7 @@
</th>
<th><%= t("moderation.comments.index.headers.comment") %></th>
<th class="text-center"><%= t("moderation.comments.index.headers.flags") %></th>
<th class="text-center" colspan="2"><%= t("moderation.debates.index.headers.actions") %></th>
<th class="text-center" colspan="2">&nbsp;</th>
</tr>
<% @comments.each do |comment| %>
<tr id="comment_<%= comment.id %>">

View File

@@ -2,43 +2,74 @@
<%= render 'shared/filter_subnav', i18n_namespace: "moderation.debates.index" %>
<h3><%= page_entries_info @debates %></h3>
<div class="row">
<h3 class="small-8 large-8 columns"><%= page_entries_info @debates %></h3>
<div class="small-4 large-4 columns">
<div class="right">
<%= t("moderation.debates.index.order") %>
<%= render 'shared/order_selector', i18n_namespace: "moderation.debates.index" %>
</div>
</div>
</div>
<table>
<tr>
<th>
<%= t("moderation.debates.index.headers.title") %>&nbsp;|&nbsp;
<%= t("moderation.debates.index.headers.updated_at") %>&nbsp;|&nbsp;
<%= t("moderation.debates.index.headers.description") %>
</th>
<th class="text-center"><%= t("moderation.debates.index.headers.flags") %></th>
<th class="text-center" colspan="2"><%= t("moderation.debates.index.headers.actions") %></th>
</tr>
<% @debates.each do |debate| %>
<tr id="debate_<%= debate.id %>">
<td>
<%= link_to debate.title, debate, target: "_blank" %>
<br>
<span class="date"><%= l debate.updated_at.to_date %></span>
<br>
<%= debate.description %>
</td>
<td class="text-center"><%= debate.flags_count %></td>
<td>
<%= link_to t("moderation.debates.index.hide"), hide_in_moderation_screen_moderation_debate_path(debate, request.query_parameters), method: :put, class: "delete" %>
</td>
<% if can? :ignore_flag, debate %>
<td>
<%= link_to t("moderation.debates.index.ignore_flag"), ignore_flag_moderation_debate_path(debate, request.query_parameters), method: :put, class: "button radius tiny warning" %>
</td>
<% end %>
<% if debate.ignored_flag? %>
<td class="ignored">
<%= t("moderation.debates.index.ignored_flag") %>
</td>
<% end %>
<%= form_tag moderate_moderation_debates_path(request.query_parameters), method: :put do %>
<p class="right js-check">
<%= t('shared.check') %>:
<%= link_to t('shared.check_all'), '#', data: {check_all: "debate_ids[]"} %>
|
<%= link_to t('shared.check_none'), '#', data: {check_none: "debate_ids[]"} %>
</p>
<table>
<tr>
<th>
<%= t("moderation.debates.index.headers.debate") %>
</th>
<th>
<%= t("moderation.debates.index.headers.moderate") %>
</th>
</tr>
<% end %>
</table>
<% @debates.each do |debate| %>
<tr id="debate_<%= debate.id %>">
<td>
<%= link_to debate.title, debate, target: "_blank" %>
<br>
<span class="date"><%= l debate.updated_at.to_date %></span>
<span class="bullet">&nbsp;&bull;&nbsp;</span>
<%= debate.flags_count %><i class="icon-flag flag-disable"></i>
<span class="bullet">&nbsp;&bull;&nbsp;</span>
<%= debate.author.username %>
<br>
<div style="debate-description">
<%= debate.description %>
</div>
</td>
<td class="text-center">
<%= check_box_tag "debate_ids[]", debate.id, nil, id: "#{dom_id(debate)}_check" %>
</td>
</tr>
<% end %>
</table>
<%= paginate @debates %>
<%= submit_tag t('moderation.debates.index.block_authors'),
name: "block_authors",
class: "button radius alert",
data: {confirm: t('moderation.debates.index.confirm')}
%>
<div class="right">
<%= submit_tag t('moderation.debates.index.hide_debates'),
name: "hide_debates",
class: "button radius alert",
data: {confirm: t('moderation.debates.index.confirm')}
%>
<%= submit_tag t('moderation.debates.index.ignore_flags'),
name: "ignore_flags",
class: "button radius success",
data: {confirm: t('moderation.debates.index.confirm')}
%>
</div>
<%= paginate @debates %>
<% end %>