<%= form_for @mailing do |f| %> <%= f.error_messages %> <% if @all_mailing_lists.length == 1 %><%= hidden_field_tag 'mailing[mailing_list_ids][]', @mailing.mailing_lists.first.try(:id) %><% end %> <%= f.label :subject %> <%= f.text_field :subject, title: "The email subject" %>
<%= f.label :from_email_address %> <%= f.text_field :from_email_address, title: "The from email address. Default value configured in /config/mail_manager.yml", placeholder: "Example, Inc. " %>
<% if @mailables.length > 0 %> <%= f.label "Select a newsletter" %> <%= select_tag 'mailing[mailable_class_and_id]', options_for_select(@mailables_for_select, @mailing.mailable_thing_and_id), :onChange => "if($('mailing_mailable')."+ "getValue() == 'Mailable_new') {$('new_mailable').show();}else"+ "{$('new_mailable').hide();}" %>
<% else %> <% end %> <% unless @mailable.nil? %> <%= div_for @mailable, (@mailables.length == 0) ? {} : {:style => 'display:none'} do %> <% f.fields_for @mailable do |fm| %> <%= fm.label :email_html %> <%= fm.text_area :email_html %>
<%= fm.label :email_text %> <%= fm.text_area :email_html %>
<% end %> <% end %> <% end %> <%= f.label :scheduled_at %> <%= f.text_field :scheduled_at, {class: 'datetime-picker', value: l(f.object.scheduled_at || Time.now)} %>
<%= f.label :include_images %> <%= f.check_box :include_images %>
Note: If checked, images are encoded and attached to the email (except for contacts with yahoo.com, gmail.com and hotmail.com emails). If unchecked, remote image references are used for all contacts. <% if @all_mailing_lists.length > 0 %>

Send to these mailing lists:

<% @all_mailing_lists.each do |mailing_list| %> <%= check_box_tag 'mailing[mailing_list_ids][]', mailing_list.id, @mailing.mailing_lists.include?(mailing_list) %> <%= label_tag :mailing_mailing_list_ids_, "#{mailing_list.name}" %>
<% end %>

<% end %>
<%= f.submit "Submit", :class => 'button' %>
<% end %> <%= content_for :head do %> <% end %>