Add Admin System Emails view & first system email
Admins need to be able to see what a particular System Email looks like with dummy data. Also adding the first system email to be managed: the proposal notification digest. In case the current admin doesn't have any Notifications from ProposalNotifications there will be a crash. We'll solve this in later PR's with a system to "inject" sample text in email templates without having to generate records in the database.
This commit is contained in:
@@ -1,7 +1,22 @@
|
||||
class Admin::SystemEmailsController < Admin::BaseController
|
||||
|
||||
before_action :load_system_email, only: [:view]
|
||||
|
||||
def index
|
||||
@system_emails = %w(proposal_notification_digest)
|
||||
end
|
||||
|
||||
def view
|
||||
case @system_email
|
||||
when "proposal_notification_digest"
|
||||
@notifications = Notification.where(notifiable_type: "ProposalNotification").limit(2)
|
||||
@subject = t('mailers.proposal_notification_digest.title', org_name: Setting['org_name'])
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def load_system_email
|
||||
@system_email = params[:system_email_id]
|
||||
end
|
||||
end
|
||||
|
||||
@@ -20,8 +20,6 @@
|
||||
<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 %>
|
||||
|
||||
36
app/views/admin/system_emails/view.html.erb
Normal file
36
app/views/admin/system_emails/view.html.erb
Normal file
@@ -0,0 +1,36 @@
|
||||
<%= back_link_to admin_system_emails_path %>
|
||||
|
||||
<h2><%= t("admin.system_emails.#{@system_email}.title") %></h2>
|
||||
|
||||
<div class="small-12 column">
|
||||
<div class="callout highlight">
|
||||
<div class="row">
|
||||
<div class="small-12 medium-4 column">
|
||||
<strong><%= t("admin.newsletters.show.from") %></strong><br>
|
||||
<%= Setting['mailer_from_address'] %>
|
||||
</div>
|
||||
<div class="small-12 medium-8 column">
|
||||
<strong><%= t("admin.newsletters.show.subject") %></strong><br>
|
||||
<%= @subject %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<strong><%= t("admin.newsletters.show.body") %></strong>
|
||||
<p class="help-text" id="phase-description-help-text">
|
||||
<%= t("admin.newsletters.show.body_help_text") %>
|
||||
</p>
|
||||
<div class="newsletter-body-content">
|
||||
<%= render file: "app/views/layouts/_mailer_header.html.erb" %>
|
||||
|
||||
<table cellpadding="0" cellspacing="0" border="0" style="background: #fff; margin: 0 auto; max-width: 700px; width:100%;">
|
||||
<tbody>
|
||||
<tr>
|
||||
<%= render file: "app/views/mailer/#{@system_email}.html.erb" %>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<%= render file: "app/views/layouts/_mailer_footer.html.erb" %>
|
||||
</div>
|
||||
</div>
|
||||
Reference in New Issue
Block a user