Add default actions list on admin dashboard actions index

This commit is contained in:
decabeza
2019-04-15 17:39:47 +02:00
parent 7b6619528c
commit 0a40c747a3
7 changed files with 37 additions and 11 deletions

View File

@@ -3,4 +3,8 @@ module Admin::ProposalDashboardActionsHelper
return t("admin.dashboard.actions.index.active") if active return t("admin.dashboard.actions.index.active") if active
t("admin.dashboard.actions.index.inactive") t("admin.dashboard.actions.index.inactive")
end end
def default_actions
%w[polls email poster]
end
end end

View File

@@ -0,0 +1,13 @@
<% default_actions.each do |action| %>
<tr>
<td><%= t("admin.dashboard.actions.index.default.#{action}") %></td>
<td><%= t("admin.dashboard.actions.action_type.resource") %></td>
<td class="text-center"><%= t("admin.dashboard.actions.index.active") %></td>
<td colspan="4">&nbsp;</td>
<td class="text-right">
<%= link_to t("admin.dashboard.actions.index.edit"),
admin_settings_path(anchor: "tab-proposals"),
class: "button hollow" %>
</td>
</tr>
<% end %>

View File

@@ -22,12 +22,6 @@
</thead> </thead>
<tbody> <tbody>
<% if @dashboard_actions.empty? %>
<tr>
<td colspan="100%"><%= t("admin.dashboard.actions.index.no_records") %></td>
</tr>
<% end %>
<% @dashboard_actions.each do |action| %> <% @dashboard_actions.each do |action| %>
<tr id="<%= dom_id(action) %>"> <tr id="<%= dom_id(action) %>">
<td><%= action.title %></td> <td><%= action.title %></td>
@@ -49,5 +43,7 @@
</td> </td>
</tr> </tr>
<% end %> <% end %>
<%= render "default_actions" %>
</tbody> </tbody>
</table> </table>

View File

@@ -154,6 +154,7 @@ ignore_unused:
- "admin.admin_notifications.*.submit_button" - "admin.admin_notifications.*.submit_button"
- "admin.homepage.*" - "admin.homepage.*"
- "admin.dashboard.administrator_tasks.index.filter*" - "admin.dashboard.administrator_tasks.index.filter*"
- "admin.dashboard.actions.index.default.*"
- "moderation.comments.index.filter*" - "moderation.comments.index.filter*"
- "moderation.comments.index.order*" - "moderation.comments.index.order*"
- "moderation.debates.index.filter*" - "moderation.debates.index.filter*"

View File

@@ -379,7 +379,6 @@ en:
create: Create resource or action create: Create resource or action
edit: Edit edit: Edit
delete: Delete delete: Delete
no_records: No records found
active: 'Yes' active: 'Yes'
inactive: 'No' inactive: 'No'
title: Resources and actions title: Resources and actions
@@ -390,6 +389,10 @@ en:
action_active: Active action_active: Active
order: Order order: Order
published_proposal: Published proposal published_proposal: Published proposal
default:
email: Email
polls: Polls
poster: Poster
new: new:
creating: New action for the proposals dashboard creating: New action for the proposals dashboard
back: Back to list back: Back to list

View File

@@ -379,7 +379,6 @@ es:
create: Crear recurso o acción create: Crear recurso o acción
edit: Editar edit: Editar
delete: Borrar delete: Borrar
no_records: No se encontraron registros
active: 'Si' active: 'Si'
inactive: 'No' inactive: 'No'
title: Recursos y acciones title: Recursos y acciones
@@ -390,6 +389,10 @@ es:
action_active: Activo action_active: Activo
order: Orden order: Orden
published_proposal: Propuesta publicada published_proposal: Propuesta publicada
default:
email: Correo electrónico
polls: Encuestas
poster: Póster
new: new:
creating: Nueva acción para el dashboard de propuestas creating: Nueva acción para el dashboard de propuestas
back: Volver a la lista back: Volver a la lista

View File

@@ -22,8 +22,12 @@ feature "Admin dashboard actions" do
visit admin_dashboard_actions_path visit admin_dashboard_actions_path
end end
scenario "shows that there are no records available" do scenario "shows only default actions" do
expect(page).to have_content("No records found") expect(page).to have_content("Polls")
expect(page).to have_content("Email")
expect(page).to have_content("Poster")
expect(page).to have_selector("a", text: "Edit", count: 3)
end end
end end
@@ -69,8 +73,10 @@ feature "Admin dashboard actions" do
before do before do
visit admin_dashboard_actions_path visit admin_dashboard_actions_path
within ("#dashboard_action_#{action.id}") do
click_link "Edit" click_link "Edit"
end end
end
scenario "Updates the action" do scenario "Updates the action" do
fill_in "dashboard_action_title", with: title fill_in "dashboard_action_title", with: title