<%= 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 %> <% if @mailables.length > 0 %> <% else %> <% end %> <% unless @mailable.nil? %> <%= div_for @mailable, (@mailables.length == 0) ? {} : {:style => 'display:none'} do %> <% f.fields_for @mailable do |fm| %> <% end %> <% end %> <% end %> <% if @all_mailing_lists.length > 1 %> <% end %>
<%= f.label :subject %> <%= f.text_field :subject %>
<%= f.label :from_email_address %> <%= f.text_field :from_email_address %>
<%= f.label "Select Mailable Item" %> <%= 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();}" %>
<%= fm.label :email_html %> <%= fm.text_area :email_html %>
<%= fm.label :email_text %> <%= fm.text_area :email_html %>
<%= 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 %>
<%= f.submit "Submit", :class => 'button' %>
<% end %> <%= content_for :head do %> <% end %>