Sha256: f66f1765a1b71f525bf54ec9e3257970e675b745e2c0631d68578e0162251cf1

Contents?: true

Size: 1.41 KB

Versions: 10

Compression:

Stored size: 1.41 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
      .my-3= render "/admin/poll_notifications/form_#{template}", f: f
      
      - if f.object.category == category && f.object.persisted?
        = f.select :from, mailer_froms_collection(), label: 'From'
        = f.text_field :subject
        = f.text_area :body, rows: 10
      - else
        - email_template = Effective::EmailTemplate.where(template_name: template).first!
        - from_value = email_template.from || EffectiveResources.mailer_froms.first

        = f.select :from, mailer_froms_collection(), label: 'From', value: from_value
        = 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 Please contact us to add additional variables

  = effective_submit(f)

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
effective_polls-0.6.2 app/views/admin/poll_notifications/_form.html.haml
effective_polls-0.6.1 app/views/admin/poll_notifications/_form.html.haml
effective_polls-0.6.0 app/views/admin/poll_notifications/_form.html.haml
effective_polls-0.5.6 app/views/admin/poll_notifications/_form.html.haml
effective_polls-0.5.5 app/views/admin/poll_notifications/_form.html.haml
effective_polls-0.5.4 app/views/admin/poll_notifications/_form.html.haml
effective_polls-0.5.3 app/views/admin/poll_notifications/_form.html.haml
effective_polls-0.5.2 app/views/admin/poll_notifications/_form.html.haml
effective_polls-0.5.1 app/views/admin/poll_notifications/_form.html.haml
effective_polls-0.5.0 app/views/admin/poll_notifications/_form.html.haml