epaper/app/views/admin/e_paper_criterias/_form.html.erb

145 lines
6.0 KiB
Plaintext

<% content_for :page_specific_css do %>
<%= stylesheet_link_tag "lib/main-forms" %>
<%= stylesheet_link_tag "lib/fileupload" %>
<%= stylesheet_link_tag "lib/main-list" %>
<% end %>
<% content_for :page_specific_javascript do %>
<%= javascript_include_tag "lib/bootstrap-fileupload" %>
<%= javascript_include_tag "lib/bootstrap-datetimepicker" %>
<%= javascript_include_tag "lib/datetimepicker/datetimepicker.js" %>
<%= javascript_include_tag "lib/file-type" %>
<%= javascript_include_tag "lib/module-area" %>
<% end %>
<div class="input-area">
<!-- Module Tabs -->
<div class="nav-name"><strong><%= t(:module) %></strong></div>
<ul class="nav nav-pills module-nav">
<li class="active"><a href="#basic" data-toggle="tab"><%= t(:basic) %></a></li>
<li><a href="#setting" data-toggle="tab"><%= t("e_paper.email_setting") %></a></li>
<li><a href="#record" data-toggle="tab"><%= t("e_paper.email_record") %></a></li>
<!-- <li><a href="#imageupload" data-toggle="tab"><%= t(:image) %></a></li> -->
</ul>
<div class="tab-content module-area">
<!-- Basic Module -->
<div class="tab-pane fade in active" id="basic">
<!-- Date Time Picker -->
<div class="control-group">
<label class="control-label muted"><%= t(:start_date) %></label>
<div class="controls">
<%= f.datetime_picker :start_date, :no_label => true, :new_record => @paper_criteria.new_record?, :data=>{"picker-type" => "range", "range" => "start"} %>
</div>
</div>
<div class="control-group">
<label class="control-label muted"><%= t(:end_date) %></label>
<div class="controls">
<%= f.datetime_picker :end_date, :no_label => true, :new_record => @paper_criteria.new_record?, :data=>{"picker-type" => "range", "range" => "end"} %>
</div>
</div>
</div>
<div class="tab-pane fade" id="setting">
<!-- Date Time Picker -->
<div class="control-group">
<label class="control-label muted"><%= t("e_paper.sending_time") %></label>
<div class="controls">
<%= f.datetime_picker :sending_time, :no_label => true, :new_record => @paper_criteria.new_record? %>
</div>
</div>
<% @site_in_use_locales.each_with_index do |locale, i| %>
<div class="control-group">
<label class="control-label muted"><%= t("e_paper.sending_title") + " (" + t(locale.to_s) + ")" %></label>
<div class="controls">
<%= f.fields_for :sending_title_translations do |f| %>
<%= f.text_field locale, value: (@paper_criteria.sending_title_translations[locale] rescue nil) %>
<% end %>
</div>
</div>
<% end %>
<div class="control-group">
<label class="control-label muted"><%= t("e_paper.sending_notes") %></label>
<div class="controls">
<%= f.text_area :sending_notes %>
</div>
</div>
<div class="control-group">
<label class="control-label muted"><%= t("e_paper.languages") %></label>
<% @site_in_use_locales.each_with_index do |locale, i| %>
<div class="controls">
<label>
<input type="checkbox" <%= @paper_criteria.language_to_send.include?(locale.to_s) ? "checked=checked" : "" %> name="paper_criteria[language_to_send][]" value="<%= locale.to_s %>"> <%= t(locale.to_s) %>
</label>
</div>
<% end %>
</div>
<div class="control-group">
<label class="control-label muted"><%= t("e_paper.receivers") %></label>
<div class="controls">
<label>
<input type="checkbox" <%= @paper_criteria.receivers.include?("subscriber") ? "checked=checked" : "" %> name="paper_criteria[receivers][]" value="subscriber"> <%= t("e_paper.subscriber") %>
</label>
</div>
<div class="controls">
<label>
<input type="checkbox" <%= @paper_criteria.receivers.include?("website_member") ? "checked=checked" : "" %> name="paper_criteria[receivers][]" value="member"> <%= t("e_paper.website_member") %>
<label>
</div>
</div>
<div class="control-group">
<label class="control-label muted"><%= t("e_paper.other_emails") %></label>
<div class="controls">
<%= f.text_area :other_emails %>
<div class="hint">Separated by , (comma)</div>
</div>
</div>
</div>
<div class="tab-pane fade" id="record">
</div>
</div>
<div class="nav-name"><strong><%= t(:language) %></strong></div>
<ul class="nav nav-pills language-nav">
<% @site_in_use_locales.each_with_index do |locale, i| %>
<li class="<%= 'active' if i == 0 %>">
<a data-toggle="tab" href=".<%= locale %>"><%= t(locale) %></a>
</li>
<% end %>
</ul>
<!-- Language -->
<div class="tab-content language-area">
<% @site_in_use_locales.each_with_index do |locale, i| %>
<div class="<%= locale %> tab-pane fade <%= ( i == 0 ) ? "in active" : '' %>">
<!-- Title-->
<div class="control-group input-title">
<label class="control-label muted"><%= t(:title) %></label>
<div class="controls">
<%= f.fields_for :title_translations do |f| %>
<%= f.text_field locale, class: "input-block-level", placeholder: t(:title), value: (@paper_criteria.title_translations[locale] rescue nil) %>
<% end %>
</div>
</div>
<!-- Sub Title -->
<div class="control-group input-subtitle">
<label class="control-label muted"><%= t(:subtitle) %></label>
<div class="controls">
<div class="textarea">
<%= f.fields_for :description_translations do |f| %>
<%= f.text_area locale, rows: 2, class: "input-block-level", value: (@paper_criteria.description_translations[locale] rescue nil) %>
<% end %>
</div>
</div>
</div>
</div>
<% end %>
</div>
<!-- Form Actions -->
<div class="form-actions">
<%= f.submit t('submit'), class: 'btn btn-primary' %>
</div>