Sha256: 974612775cbcf6d2a4c6558663d320d31135f6de0048b897a646176797d56b59
Contents?: true
Size: 1.61 KB
Versions: 46
Compression:
Stored size: 1.61 KB
Contents
# frozen_string_literal: true module Decidim module Conferences module Admin # A custom mailer for sending the diploma of the conference to # a registered user who attends to the conference. class SendConferenceDiplomaMailer < Decidim::ApplicationMailer include Decidim::TranslationsHelper include Decidim::SanitizeHelper helper Decidim::ResourceHelper helper Decidim::TranslationsHelper # Send an email to an user with the diploma of conference attendance attached. # # user - The user being invited # conference - The conference being joined. def diploma(conference, user) with_user(user) do @user = user @conference = conference @organization = @conference.organization @locator = Decidim::ResourceLocatorPresenter.new(@conference) add_diploma_attachment subject = I18n.t("diploma.subject", scope: "decidim.conferences.mailer.send_conference_diploma_mailer") mail(to: user.email, subject: subject) end end private def add_diploma_attachment diploma = WickedPdf.new.pdf_from_string( render_to_string(pdf: "conference-diploma", template: "decidim/conferences/admin/send_conference_diploma_mailer/diploma_user.html.erb", layout: "decidim/diploma.html.erb"), orientation: "Landscape" ) attachments["conference-#{@user.nickname.parameterize}-diploma.pdf"] = diploma end end end end end
Version data entries
46 entries across 46 versions & 1 rubygems