Sha256: 3b31fcf03141258623627c21911e28daf7082862d28ad61df3321308356afdb5

Contents?: true

Size: 1.47 KB

Versions: 9

Compression:

Stored size: 1.47 KB

Contents

= effective_form_with(model: [:admin, poll_notification], engine: true) do |f|
  - if inline_datatable?
    = f.hidden_field :poll_id
  - else
    = f.select :poll_id, Effective::Poll.sorted.all

  = f.select :category, Effective::PollNotification::CATEGORIES,
    label: 'Send an email notification'

  - # Render email templates
  - Effective::PollNotification::CATEGORIES.each do |category|
    - template = 'poll_' + category.parameterize.underscore

    = f.show_if :category, category do
      = render "/admin/poll_notifications/form_#{template}", f: f

      - if f.object.category == category
        = f.email_field :from
        = f.text_field :subject
        = f.text_area :body, rows: 10

      - elsif EffectivePolls.use_effective_email_templates == false
        = f.email_field :from, value: EffectivePolls.mailer[:default_from]
        = f.text_field :subject, value: ''
        = f.text_area :body, rows: 10, value: ''

      - else
        - email_template = Effective::EmailTemplate.where(template_name: template).first!

        = f.email_field :from, value: email_template.from
        = f.text_field :subject, value: email_template.subject
        = f.text_area :body, rows: 10, value: email_template.body

        %p The available variables are:

        %ul
          - Effective::PollNotification::EMAIL_TEMPLATE_VARIABLES.each do |variable|
            %li {{ #{variable} }}

        %small.text-muted Only a developer can add additional variables

  = effective_submit(f)

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
effective_polls-0.3.0 app/views/admin/poll_notifications/_form.html.haml
effective_polls-0.2.0 app/views/admin/poll_notifications/_form.html.haml
effective_polls-0.1.6 app/views/admin/poll_notifications/_form.html.haml
effective_polls-0.1.5 app/views/admin/poll_notifications/_form.html.haml
effective_polls-0.1.4 app/views/admin/poll_notifications/_form.html.haml
effective_polls-0.1.3 app/views/admin/poll_notifications/_form.html.haml
effective_polls-0.1.2 app/views/admin/poll_notifications/_form.html.haml
effective_polls-0.1.1 app/views/admin/poll_notifications/_form.html.haml
effective_polls-0.1.0 app/views/admin/poll_notifications/_form.html.haml