diff --git a/app/helpers/admin/proposal_dashboard_actions_helper.rb b/app/helpers/admin/proposal_dashboard_actions_helper.rb index 2bcefd584..e02fea113 100644 --- a/app/helpers/admin/proposal_dashboard_actions_helper.rb +++ b/app/helpers/admin/proposal_dashboard_actions_helper.rb @@ -3,4 +3,8 @@ module Admin::ProposalDashboardActionsHelper return t("admin.dashboard.actions.index.active") if active t("admin.dashboard.actions.index.inactive") end + + def default_actions + %w[polls email poster] + end end diff --git a/app/views/admin/dashboard/actions/_default_actions.html.erb b/app/views/admin/dashboard/actions/_default_actions.html.erb new file mode 100644 index 000000000..feadd4464 --- /dev/null +++ b/app/views/admin/dashboard/actions/_default_actions.html.erb @@ -0,0 +1,13 @@ +<% default_actions.each do |action| %> + + <%= t("admin.dashboard.actions.index.default.#{action}") %> + <%= t("admin.dashboard.actions.action_type.resource") %> + <%= t("admin.dashboard.actions.index.active") %> +   + + <%= link_to t("admin.dashboard.actions.index.edit"), + admin_settings_path(anchor: "tab-proposals"), + class: "button hollow" %> + + +<% end %> diff --git a/app/views/admin/dashboard/actions/index.html.erb b/app/views/admin/dashboard/actions/index.html.erb index d8474a8ee..5d3e7ca61 100644 --- a/app/views/admin/dashboard/actions/index.html.erb +++ b/app/views/admin/dashboard/actions/index.html.erb @@ -22,12 +22,6 @@ - <% if @dashboard_actions.empty? %> - - <%= t("admin.dashboard.actions.index.no_records") %> - - <% end %> - <% @dashboard_actions.each do |action| %> <%= action.title %> @@ -49,5 +43,7 @@ <% end %> + + <%= render "default_actions" %> diff --git a/config/i18n-tasks.yml b/config/i18n-tasks.yml index 4ff4c2096..251efb113 100644 --- a/config/i18n-tasks.yml +++ b/config/i18n-tasks.yml @@ -154,6 +154,7 @@ ignore_unused: - "admin.admin_notifications.*.submit_button" - "admin.homepage.*" - "admin.dashboard.administrator_tasks.index.filter*" + - "admin.dashboard.actions.index.default.*" - "moderation.comments.index.filter*" - "moderation.comments.index.order*" - "moderation.debates.index.filter*" diff --git a/config/locales/en/admin.yml b/config/locales/en/admin.yml index 6aaa7b3e8..55c7142fc 100644 --- a/config/locales/en/admin.yml +++ b/config/locales/en/admin.yml @@ -379,7 +379,6 @@ en: create: Create resource or action edit: Edit delete: Delete - no_records: No records found active: 'Yes' inactive: 'No' title: Resources and actions @@ -390,6 +389,10 @@ en: action_active: Active order: Order published_proposal: Published proposal + default: + email: Email + polls: Polls + poster: Poster new: creating: New action for the proposals dashboard back: Back to list diff --git a/config/locales/es/admin.yml b/config/locales/es/admin.yml index a8e2088ec..54e7e9806 100644 --- a/config/locales/es/admin.yml +++ b/config/locales/es/admin.yml @@ -379,7 +379,6 @@ es: create: Crear recurso o acción edit: Editar delete: Borrar - no_records: No se encontraron registros active: 'Si' inactive: 'No' title: Recursos y acciones @@ -390,6 +389,10 @@ es: action_active: Activo order: Orden published_proposal: Propuesta publicada + default: + email: Correo electrónico + polls: Encuestas + poster: Póster new: creating: Nueva acción para el dashboard de propuestas back: Volver a la lista diff --git a/spec/features/admin/dashboard/actions_spec.rb b/spec/features/admin/dashboard/actions_spec.rb index 26050ca6a..0492bc56e 100644 --- a/spec/features/admin/dashboard/actions_spec.rb +++ b/spec/features/admin/dashboard/actions_spec.rb @@ -22,8 +22,12 @@ feature "Admin dashboard actions" do visit admin_dashboard_actions_path end - scenario "shows that there are no records available" do - expect(page).to have_content("No records found") + scenario "shows only default actions" do + 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 @@ -69,7 +73,9 @@ feature "Admin dashboard actions" do before do visit admin_dashboard_actions_path - click_link "Edit" + within ("#dashboard_action_#{action.id}") do + click_link "Edit" + end end scenario "Updates the action" do