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>
<% 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) %>
<li class="section-title" <%= "class=is-active" if messages_menu_active %>>
<a href="#">
@@ -93,6 +93,9 @@
<li <%= "class=is-active" if controller_name == "admin_notifications" %>>
<%= link_to t("admin.menu.admin_notifications"), admin_admin_notifications_path %>
</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" %>>
<%= link_to t("admin.menu.emails_download"), admin_emails_download_index_path %>
</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>