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

157 lines
5.6 KiB
Plaintext
Executable File

<% 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" %>
<% end %>
<%#= f.error_messages %>
<fieldset>
<!-- Input Area -->
<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="#imageupload" data-toggle="tab"><%= t(:image) %></a>
</li>
<li><a href="#tag" data-toggle="tab"><%= t(:tags) %></a></li>
</ul>
<!-- Module -->
<div class="tab-content module-area">
<!-- Basic Module -->
<div class="tab-pane fade in active" id="basic">
<!-- Category -->
<div class="control-group">
<%= f.label :category ,t(:category), :class=>"control-label muted" %>
<div class="controls">
<%= select_category(f, @module_app) %>
</div>
</div>
<div class="control-group input-period">
<%= f.label :period ,t('e_paper.period'), :class => "control-label muted" %>
<div class="controls">
<%= f.datetime_picker :period, :no_label => true, :new_record => @paper.new_record? %>
</div>
</div>
<div class="control-group input-period">
<%= f.label :article_author ,t('e_paper.article_author'), :class => "control-label muted" %>
<div class="controls">
<div class="content-box">
<%= render partial: 'admin/member_selects/email_selection_box', locals: {field: 'e_paper_topic[article_authors][]', email_members: @paper.article_author_profiles} %>
</div>
</div>
</div>
</div>
<!-- Images Upload -->
<div class="tab-pane fade" id="imageupload">
<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.image.file %>" data-provides="fileupload">
<div class="fileupload-new thumbnail pull-left">
<% if @paper.image.file %>
<%= image_tag @paper.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>
<!-- Tag Module -->
<div class="tab-pane fade" id="tag">
<div class="control-group">
<label class="control-label muted"><%= t(:tags) %></label>
<%= select_tags(f, @module_app) %>
</div>
</div>
</div>
<!-- Language Tabs -->
<div class="nav-name"><strong>Language</strong></div>
<ul class="nav nav-pills language-nav">
<% @site_in_use_locales.each_with_index do |locale, i| %>
<li <%= ( i == 0 ) ? "class=active" : '' %>><a data-toggle="tab" href=".<%= locale %>"><%= t(locale.to_s) %></a></li>
<% end %>
</ul>
<!-- Language -->
<div class="tab-content language-area">
<% @site_in_use_locales.each_with_index do |locale, i| %>
<div class="<%= locale %> fade tab-pane <%= ( i == 0 ) ? "in active" : '' %>">
<div class="control-group input-title">
<%= f.label :title , t('e_paper.title'), :class=>"control-label muted" %>
<div class="controls">
<%= f.fields_for :title_translations do |f| %>
<%= f.text_field locale, :class=>'input-block-level', :value => (@paper.title_translations[locale.to_s] rescue nil) %>
<% end %>
</div>
</div>
<div class="control-group input-description">
<%= f.label :description ,t('e_paper.description'), :class => "control-label muted" %>
<%= f.fields_for :description_translations do |f| %>
<div class="controls">
<%= f.text_area locale, :class=>'input-block-level', :value => (@paper.description_translations[locale] rescue nil) %>
</div>
<% end %>
</div>
<div class="control-group input-content">
<label class="control-label muted"><%= t('e_paper.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.content_translations[locale] rescue nil) %>
<% end %>
</div>
</div>
</div>
</div>
<% end %>
<!-- Form Actions -->
<div class="form-actions">
<input type="hidden" name="referer_url" value="<%= request.referer %>">
<%= 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>
</fieldset>