publication/app/views/admin/chapters/_form.html.erb

117 lines
4.5 KiB
Plaintext
Raw Permalink Normal View History

2018-10-04 02:47:23 +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/module-area" %>
<%= javascript_include_tag "validator" %>
<% end %>
<fieldset>
<div class="input-area">
2023-06-23 10:25:35 +00:00
<!-- Module Tabs -->
<div class="nav-name"><strong><%= t(:module) %></strong></div>
<ul class="nav nav-pills module-nav">
<li class="active"><a href="#tag" data-toggle="tab"><%= t(:tags) %></a></li>
</ul>
<!-- Module -->
<div class="tab-content module-area">
<!-- Tag Module -->
<div class="tab-pane fade active in" id="tag">
<div class="control-group">
<label class="control-label muted"><%= t(:tags) %></label>
<%= select_tags(f, @module_app) %>
2018-10-04 02:47:23 +00:00
</div>
</div>
</div>
2023-06-23 10:25:35 +00:00
<input type="hidden" name="chapter[publication_id]" value="<%= @publication.id.to_s %>">
2018-10-04 02:47:23 +00:00
<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 <%= ( i == 0 ) ? "class=active" : '' %>><a data-toggle="tab" href=".<%= locale %>"><%= t(locale.to_s) %></a></li>
<% end %>
</ul>
<% @site_in_use_locales.each_with_index do |locale, i| %>
<div class="<%= locale %> fade tab-pane <%= ( i == 0 ) ? "in active" : '' %>">
<%= render partial: 'form_text_locale', locals: {f: f, node: :title, locale: locale, style: 'long'}%>
</div>
<% end %>
<%= render partial: 'form_text_org', locals: {f: f, node: :page} %>
<% @site_in_use_locales.each_with_index do |locale, i| %>
<div class="<%= locale %> fade tab-pane <%= ( i == 0 ) ? "in active" : '' %>">
2018-10-04 05:29:27 +00:00
<%= render partial: 'form_text_locale', locals: {f: f, node: :author, locale: locale, style: 'long'}%>
2023-06-23 10:25:35 +00:00
</div>
<% end %>
<div class="control-group input-title">
<%= f.label :author_url, t("chapter.author_url"), class: "control-label muted" %>
<div class="controls">
<%= f.text_field :author_url, class: "post-title long" %>
</div>
</div>
<% @site_in_use_locales.each_with_index do |locale, i| %>
<div class="<%= locale %> fade tab-pane <%= ( i == 0 ) ? "in active" : '' %>">
2018-10-04 05:29:27 +00:00
<%= render partial: 'form_text_area', locals: {f: f, node: :author_description, locale: locale} %>
2018-10-04 02:47:23 +00:00
<%= render partial: 'form_text_area', locals: {f: f, node: :text, locale: locale} %>
2023-06-23 10:25:35 +00:00
<%= render partial: 'form_text_locale', locals: {f: f, node: :keywords, locale: locale, style: 'long'}%>
2018-10-04 02:47:23 +00:00
</div>
<% end %>
2023-06-23 10:25:35 +00:00
<!-- File Upload -->
<div class="control-group">
<label class="control-label muted"><%= t("chapter.file") %></label>
<div class="controls">
<%= f.fields_for :chapter_files, (f.object.chapter_files[0] || f.object.chapter_files.new) do |f| %>
<%= render :partial => '/admin/publications/form_file', :object => f.object, :locals => {:f => f, :i => 0, accept: 'application/pdf'} %>
<% end %>
<div>
<label>
<%= f.check_box :is_online_flipping_reader %>
<%= t('publication.is_online_flipping_reader') %>
</label>
</div>
</div>
</div>
2018-10-04 02:47:23 +00:00
</div>
<!-- Form Actions -->
<div class="form-actions">
<input type="hidden" name="referer_url" value="<%= request.referer %>">
<%= f.submit t('submit'), class: 'btn btn-primary' %>
</div>
</fieldset>
<% content_for :page_specific_css do %>
<style media="screen">
.tab-pane.active {
display: block;
}
.tab-pane {
display: none;
}
input, textarea, .uneditable-input {
width: 300px;
}
</style>
<% end %>
<script type="text/javascript">
var form = new FormValidator($("#new_chapter"));
2023-06-23 10:25:35 +00:00
$(document).on('click', '.clear_file', function(){
if(confirm("<%= I18n.t(:sure?)%>")){
$(this).children('.should_destroy').attr('value', 1);
$(this).parents('.start-line').find('input').filter(':not(.clear_file input)').val('');
$(this).parents('.start-line').find('.file-link').remove();
}
});
$(document).on('change', '.upload-file', function(){
$(this).parents('.start-line').find('.should_destroy').attr('value', '');
});
2018-10-04 02:47:23 +00:00
</script>