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/modal-preview" %>
|
|
|
|
<%= javascript_include_tag "lib/file-type" %>
|
|
|
|
<%= javascript_include_tag "validator" %>
|
|
|
|
<% end %>
|
|
|
|
|
|
|
|
<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="#status" data-toggle="tab"><%= t(:status) %></a>
|
|
|
|
</li>
|
|
|
|
<li>
|
2023-06-04 14:41:53 +00:00
|
|
|
<a href="#imageupload" data-toggle="tab"><%= t("publication.cover") %></a>
|
2018-10-04 02:47:23 +00:00
|
|
|
</li>
|
|
|
|
|
|
|
|
</ul>
|
|
|
|
<!-- Module -->
|
|
|
|
<%= render partial: 'module_tag', locals: {f: f} %>
|
|
|
|
<!-- Language Tabs -->
|
|
|
|
<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>
|
|
|
|
|
|
|
|
<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" : '' %>">
|
|
|
|
<%= render partial: 'form_text_locale', locals: {f: f, node: :title, locale: locale, style: nil} %>
|
|
|
|
</div>
|
|
|
|
<% end %>
|
|
|
|
|
|
|
|
<!-- Date Time Picker -->
|
|
|
|
<div class="control-group input-title">
|
2023-06-04 14:41:53 +00:00
|
|
|
<label class="control-label muted"><%= t 'publication.pub_date' %></label>
|
2018-10-04 02:47:23 +00:00
|
|
|
<div class="controls">
|
2023-06-04 14:41:53 +00:00
|
|
|
<%= f.datetime_picker :pub_date, no_label: true, new_record: @publication.new_record?, data: {} %>
|
2018-10-04 02:47:23 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<% @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: :author, locale: locale, style: nil} %>
|
2018-10-04 05:29:27 +00:00
|
|
|
<%= render partial: 'form_text_area', locals: {f: f, node: :pub_information, locale: locale} %>
|
2018-10-04 02:47:23 +00:00
|
|
|
</div>
|
|
|
|
<% end %>
|
|
|
|
|
|
|
|
</div>
|
2023-06-23 10:25:35 +00:00
|
|
|
|
|
|
|
<div class="control-group">
|
|
|
|
<label class="control-label muted"><%= t("publication.full_file") %></label>
|
|
|
|
<div class="controls">
|
|
|
|
<%= f.fields_for :full_files, (f.object.full_files[0] || f.object.full_files.new) do |f| %>
|
|
|
|
<%= render :partial => '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>
|
|
|
|
|
|
|
|
<!-- Link -->
|
|
|
|
<div class="control-group">
|
|
|
|
<label class="control-label muted"><%= t(:link) %></label>
|
|
|
|
<div class="controls add-input">
|
|
|
|
|
|
|
|
<!-- Exist -->
|
|
|
|
<% if !f.object.publication_links.blank? %>
|
|
|
|
<div class="exist">
|
|
|
|
<% f.object.publication_links.each_with_index do |publication_link, i| %>
|
|
|
|
<%= f.fields_for :publication_links, publication_link do |f| %>
|
|
|
|
<%= render :partial => 'form_link', :object => publication_link, :locals => {:f => f, :i => i} %>
|
|
|
|
<% end %>
|
|
|
|
<% end %>
|
|
|
|
<hr>
|
|
|
|
</div>
|
|
|
|
<% end %>
|
|
|
|
|
|
|
|
<!-- Add -->
|
|
|
|
<div class="add-target">
|
|
|
|
</div>
|
|
|
|
<p class="add-btn">
|
|
|
|
<%= hidden_field_tag 'publication_link_field_count', f.object.publication_links.count %>
|
|
|
|
<a id="add_link" class="trigger btn btn-small btn-primary"><i class="icons-plus"></i> <%= t(:add) %></a>
|
|
|
|
</p>
|
|
|
|
|
|
|
|
</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">
|
|
|
|
input, textarea, .uneditable-input {
|
|
|
|
width: 300px;
|
|
|
|
}
|
|
|
|
</style>
|
|
|
|
<% end %>
|
|
|
|
|
|
|
|
<% content_for :page_specific_javascript do %>
|
|
|
|
<script>
|
2023-06-23 10:25:35 +00:00
|
|
|
$(document).on('click', '#add_link', function(){
|
|
|
|
var new_id = $(this).prev().attr('value');
|
|
|
|
var old_id = new RegExp("new_publication_links", "g");
|
|
|
|
var on = $('.language-nav li.active').index();
|
|
|
|
var le = $(this).parent('.add-btn').prev('.add-target').children('.start-line').length;
|
|
|
|
$(this).prev().attr('value', parseInt(new_id) + 1);
|
|
|
|
$(this).parent().siblings('.add-target').append(("<%= escape_javascript(add_attribute 'form_link', f, :publication_links) %>").replace(old_id, new_id));
|
|
|
|
$(this).parent('.add-btn').prev('.add-target').children('.start-line').eq(le).children('.tab-content').children('.tab-pane').eq(on).addClass('in active').siblings().removeClass('in active');
|
|
|
|
formTip();
|
|
|
|
});
|
|
|
|
$(document).on('click', '.delete_link', function(){
|
|
|
|
$(this).parents('.input-prepend').remove();
|
|
|
|
});
|
|
|
|
$(document).on('click', '.remove_existing_record', function(){
|
|
|
|
if(confirm("<%= I18n.t(:sure?)%>")){
|
|
|
|
$(this).children('.should_destroy').attr('value', 1);
|
|
|
|
$(this).parents('.start-line').hide();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
$(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
|
|
|
function Appendzero(obj)
|
|
|
|
{
|
|
|
|
if(obj<10) return "0" +""+ obj;
|
|
|
|
else return obj;
|
|
|
|
}
|
|
|
|
|
|
|
|
$(function() {
|
|
|
|
if (location.pathname.substr(-3)=='new'){
|
|
|
|
var getDate = new Date();
|
|
|
|
var toDay = getDate.getFullYear()+"/"+ (Appendzero(getDate.getMonth()+1))+"/"+Appendzero(getDate.getDate())+" "+Appendzero(getDate.getHours())+":"+Appendzero(getDate.getMinutes());
|
2023-06-04 14:41:53 +00:00
|
|
|
$('input[name="publication[pub_date]"]').val(toDay);
|
2018-10-04 02:47:23 +00:00
|
|
|
}
|
|
|
|
$("#main-wrap").after("");
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
<% end %>
|