Sha256: a07f1263bb5c29aca9ef1e12ac38222f07a4fbd001ff838f0edba2d49c9bf3f2
Contents?: true
Size: 1.27 KB
Versions: 2
Compression:
Stored size: 1.27 KB
Contents
# frozen_string_literal: true module EffectiveActsAsEmailFormHelper def email_form_fields(form, action = nil, skip: true, to: nil, variables: nil, partial: nil) raise('expected a form') unless form.respond_to?(:object) resource = form.object raise('expected an acts_as_email_form resource') unless resource.class.respond_to?(:acts_as_email_form?) # Load the template. email_template = if action.present? && defined?(EffectiveEmailTemplates) action.kind_of?(Effective::EmailTemplate) ? action : Effective::EmailTemplate.where(template_name: action).first! end # These defaults are only used when there is no email_template email_defaults = form.object.email_form_defaults(action) unless email_template.present? locals = { form: form, email_to: to, email_skip: skip, email_action: (action || true), email_defaults: email_defaults, email_template: email_template, email_variables: variables } render(partial: (partial || 'effective/acts_as_email_form/fields'), locals: locals) end def mailer_froms_collection(froms: nil) froms ||= EffectiveResources.mailer_froms froms.map do |from| html = content_tag(:span, escape_once(from)) [from, from, 'data-html': html] end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
effective_resources-2.16.0 | app/helpers/effective_acts_as_email_form_helper.rb |
effective_resources-2.15.0 | app/helpers/effective_acts_as_email_form_helper.rb |