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

202 lines
8.5 KiB
Plaintext
Raw Normal View History

2019-05-28 15:54:32 +00:00
<% 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('e_paper.image') %></a></li>
2019-05-28 15:54:32 +00:00
</ul>
<div class="tab-content module-area">
<!-- Basic Module -->
<div class="tab-pane fade in active" id="basic">
<!-- Date Time Picker -->
2019-07-08 12:49:31 +00:00
<div class="control-group">
2019-05-28 15:54:32 +00:00
<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 -->
2019-07-08 12:49:31 +00:00
<!-- <div class="control-group">
2019-05-28 15:54:32 +00:00
<label class="control-label muted"><%= t("e_paper.sending_time") %></label>
<div class="controls">
2019-07-08 12:49:31 +00:00
<%#= f.datetime_picker :sending_time, :no_label => true, :new_record => @paper_criteria.new_record? %>
2019-05-28 15:54:32 +00:00
</div>
2019-07-08 12:49:31 +00:00
</div> -->
2019-05-28 15:54:32 +00:00
<% @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">
2019-05-28 15:54:32 +00:00
<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> -->
2019-05-28 15:54:32 +00:00
<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>
2024-09-15 02:22:04 +00:00
<div class="content-box">
<div class="control-group">
<label class="control-label muted"><%= t("e_paper.email_sentdate") %></label>
<div class="controls">
<%= f.datetime_picker :email_sentdate, :no_label => true, :new_record => @paper_criteria.new_record? %>
</div>
</div>
</div>
2019-05-28 15:54:32 +00:00
</div>
<div class="tab-pane fade" id="record">
</div>
<!-- Images Module -->
<div class="tab-pane fade" id="imageupload">
<!-- Images Upload -->
<div class="control-group">
<label class="control-label muted"><%= t(:image) %></label>
<div class="controls">
<div class="fileupload fileupload-new clearfix <%= 'fileupload-edit' if @paper_criteria.image.file %>" data-provides="fileupload">
<div class="fileupload-new thumbnail pull-left">
<% if @paper_criteria.image.file %>
<%= image_tag @paper_criteria.image %>
<% else %>
<img src="/assets/e_paper/AAAAAA" />
<% end %>
</div>
<div class="fileupload-preview fileupload-exists thumbnail pull-left"></div>
<span class="btn btn-file">
<span class="fileupload-new"><%= t(:select_image) %></span>
<span class="fileupload-exists"><%= t(:change) %></span>
<%= f.file_field :image %>
</span>
<a href="#" class="btn fileupload-exists" data-dismiss="fileupload"><%= t(:cancel) %></a>
<div class="controls" data-toggle="buttons-checkbox">
<label class="checkbox inline btn btn-danger fileupload-remove">
<%= f.check_box :remove_image %><%= t(:remove) %>
</label>
</div>
</div>
</div>
</div>
</div>
2019-05-28 15:54:32 +00:00
</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>
<!-- Content -->
<div class="control-group input-content">
<label class="control-label muted"><%= t(:content) + " (#{t(locale.to_s)})" %></label>
<div class="controls">
<div class="textarea">
<%= f.fields_for :content_translations do |f| %>
<%= f.cktext_area locale, rows: 5, class: "input-block-level", :value => @paper_criteria.content_translations[locale] %>
<% end %>
</div>
</div>
</div>
2019-05-28 15:54:32 +00:00
</div>
<% end %>
</div>
<!-- Form Actions -->
<div class="form-actions">
<%= f.submit t('submit'), class: 'btn btn-primary' %>
</div>
<script type="text/javascript">
$(document).on('click', '.fileupload-remove', function(){
if($(this).find(".delete_image").length != 0){
$(this).parents('.image_group').remove();
}
});
</script>