Add System emails menu & list to admin panel

We need a section to list all System Emails to view the templates and
preview an example of what would be sent.
This commit is contained in:
Bertocq
2018-04-12 19:13:49 +02:00
committed by decabeza
parent 3fd97b0a9b
commit b9c6da245a
6 changed files with 59 additions and 1 deletions

View File

@@ -0,0 +1,7 @@
class Admin::SystemEmailsController < Admin::BaseController
def index
@system_emails = %w(proposal_notification_digest)
end
end

View File

@@ -79,7 +79,7 @@
</li> </li>
<% end %> <% end %>
<% messages_sections = %w(newsletters emails_download admin_notifications) %> <% messages_sections = %w(newsletters emails_download admin_notifications system_emails) %>
<% messages_menu_active = messages_sections.include?(controller_name) %> <% messages_menu_active = messages_sections.include?(controller_name) %>
<li class="section-title" <%= "class=is-active" if messages_menu_active %>> <li class="section-title" <%= "class=is-active" if messages_menu_active %>>
<a href="#"> <a href="#">
@@ -93,6 +93,9 @@
<li <%= "class=is-active" if controller_name == "admin_notifications" %>> <li <%= "class=is-active" if controller_name == "admin_notifications" %>>
<%= link_to t("admin.menu.admin_notifications"), admin_admin_notifications_path %> <%= link_to t("admin.menu.admin_notifications"), admin_admin_notifications_path %>
</li> </li>
<li <%= "class=is-active" if controller_name == "system_emails" %>>
<%= link_to t("admin.menu.system_emails"), admin_system_emails_path %>
</li>
<li <%= "class=is-active" if controller_name == "emails_download" %>> <li <%= "class=is-active" if controller_name == "emails_download" %>>
<%= link_to t("admin.menu.emails_download"), admin_emails_download_index_path %> <%= link_to t("admin.menu.emails_download"), admin_emails_download_index_path %>
</li> </li>

View File

@@ -0,0 +1,29 @@
<h2 class="inline-block"><%= t("admin.menu.system_emails") %></h2>
<table id="system_emails">
<thead>
<tr>
<th><%= t("admin.shared.title") %></th>
<th><%= t("admin.shared.description") %></th>
<th class="small-5 text-right"><%= t("admin.shared.actions") %></th>
</tr>
</thead>
<tbody>
<% @system_emails.each do |system_email| %>
<tr id="<%= system_email %>" class="system_email">
<td>
<%= t("admin.system_emails.#{system_email}.title") %>
</td>
<td>
<%= t("admin.system_emails.#{system_email}.description") %>
</td>
<td class="text-right">
<%= link_to t("admin.shared.view"), admin_system_email_view_path(system_email),
class: "button hollow" %>
<%= link_to t("admin.shared.preview"), admin_system_email_preview_path(system_email),
class: "button" %>
</td>
</tr>
<% end %>
</tbody>
</table>

View File

@@ -521,6 +521,7 @@ en:
messaging_users: Messages to users messaging_users: Messages to users
newsletters: Newsletters newsletters: Newsletters
admin_notifications: Notifications admin_notifications: Notifications
system_emails: System Emails
emails_download: Emails download emails_download: Emails download
valuators: Valuators valuators: Valuators
poll_officers: Poll officers poll_officers: Poll officers
@@ -649,6 +650,10 @@ en:
preview_guide: "This is how the users will see the notification:" preview_guide: "This is how the users will see the notification:"
sent_guide: "This is how the users see the notification:" sent_guide: "This is how the users see the notification:"
send_alert: Are you sure you want to send this notification to %{n} users? send_alert: Are you sure you want to send this notification to %{n} users?
system_emails:
proposal_notification_digest:
title: Proposal Notification Digest
description: Gathers all proposal notifications for an user in a single message, to avoid too much emails.
emails_download: emails_download:
index: index:
title: Emails download title: Emails download
@@ -1045,6 +1050,8 @@ en:
image: Image image: Image
show_image: Show image show_image: Show image
moderated_content: "Check the content moderated by the moderators, and confirm if the moderation has been done correctly." moderated_content: "Check the content moderated by the moderators, and confirm if the moderation has been done correctly."
view: View
preview: Preview
spending_proposals: spending_proposals:
index: index:
geozone_filter_all: All zones geozone_filter_all: All zones

View File

@@ -522,6 +522,7 @@ es:
messaging_users: Mensajes a usuarios messaging_users: Mensajes a usuarios
newsletters: Newsletters newsletters: Newsletters
admin_notifications: Notificaciones admin_notifications: Notificaciones
system_emails: Emails del sistema
emails_download: Descarga de emails emails_download: Descarga de emails
valuators: Evaluadores valuators: Evaluadores
poll_officers: Presidentes de mesa poll_officers: Presidentes de mesa
@@ -650,6 +651,10 @@ es:
preview_guide: "Así es como los usuarios verán la notificación:" preview_guide: "Así es como los usuarios verán la notificación:"
sent_guide: "Así es como los usuarios ven la notificación:" sent_guide: "Así es como los usuarios ven la notificación:"
send_alert: ¿Estás seguro/a de que quieres enviar esta notificación a %{n} usuarios? send_alert: ¿Estás seguro/a de que quieres enviar esta notificación a %{n} usuarios?
system_emails:
proposal_notification_digest:
title: Resumen de Notificationes de Propuestas
description: Reune todas las notificaciones de propuestas en un único mensaje, para evitar demasiados emails.
emails_download: emails_download:
index: index:
title: Descarga de emails title: Descarga de emails
@@ -1046,6 +1051,8 @@ es:
image: Imagen image: Imagen
show_image: Mostrar imagen show_image: Mostrar imagen
moderated_content: "Revisa el contenido moderado por los moderadores, y confirma si la moderación se ha realizado correctamente." moderated_content: "Revisa el contenido moderado por los moderadores, y confirma si la moderación se ha realizado correctamente."
view: Ver
preview: Previsualizar
spending_proposals: spending_proposals:
index: index:
geozone_filter_all: Todos los ámbitos de actuación geozone_filter_all: Todos los ámbitos de actuación

View File

@@ -165,6 +165,11 @@ namespace :admin do
end end
end end
resources :system_emails, only: [:index] do
get :view
get :preview
end
resources :emails_download, only: :index do resources :emails_download, only: :index do
get :generate_csv, on: :collection get :generate_csv, on: :collection
end end