class Procedure::EmailTemplateCardComponent < ApplicationComponent def initialize(email_template:) @email_template = email_template end private def title @email_template.class.const_get(:DISPLAYED_NAME) end def desc @email_template.subject if edited? end def error @email_template.errors.full_messages.first if @email_template.errors.present? end def tag if edited? "modifié le #{@email_template.updated_at.strftime('%d-%m-%Y')}" else "Modèle standard" end end def edited? @email_template.updated_at.present? end def edit_path edit_admin_procedure_mail_template_path(@email_template.procedure, @email_template.class.const_get(:SLUG)) end end