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.
23 lines
552 B
Ruby
23 lines
552 B
Ruby
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
|