<% # encoding: utf-8 %> <% 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/file-type" %> <%= javascript_include_tag "lib/module-area" %> <% end %> <%= f.error_messages %>
<% if !params[:user_id].blank? %>
<%= User.from_id(params[:user_id]).name rescue ''%>
<% end %>
<% @author_types.each do |author_type| %> <%= content_tag :label,:class => "checkbox inline" do -%> <%= check_box_tag 'writing_book[book_author_type_ids][]', author_type.id, @writing_book.book_author_type_ids.include?(author_type.id)%> <%= author_type.title %> <%= hidden_field_tag 'writing_book[book_author_type_ids][]', '' %> <% end %> <% end %>
<%= f.select :book_paper_type_id, @paper_types.collect {|t| [ t.title, t.id ]} %>
<%= select_year((@writing_book.year ? @writing_book.year.to_i : DateTime.now.year), {:start_year => DateTime.now.year, :end_year => 1930}, {:name => 'writing_book[year]',:class => 'span1'} ) %>
<%= f.date_select :publish_date, {:use_month_numbers => true, :start_year => Time.now.year, :end_year => 1930, :order => [:year, :month, :day] }, {:class => 'span1'} %>
<%= f.date_select :publication_date, {:use_month_numbers => true, :start_year => Time.now.year, :end_year => 1890, :order => [:year, :month, :day] }, {:class => 'span1'} %>
<%= f.text_field :url , :class => "span6" %>
<%= f.text_field :keywords %>
<%= f.text_field :pages %>
<%= f.text_field :isbn %>
<%= f.radio_button :language, "Chinese" %> <%= t("personal_book.Chinese") %> <%= f.radio_button :language, "English" %> <%= t("personal_book.English") %>
<%= f.text_area :note, rows: 2, class: "input-block-level" %>
<% if show_form_status_field(@writing_book) %>
<% end %>
<% @tags.each do |tag| %> <% end %>
<% @site_in_use_locales.each_with_index do |locale, i| %>
">
<%= f.fields_for :paper_title_translations do |f| %> <%= f.text_field locale, class: "input-block-level", placeholder: t("personal_book.paper_title"), value: (@writing_book.paper_title_translations[locale] rescue nil) %> <% end %>
<%= f.fields_for :book_title_translations do |f| %> <%= f.text_field locale, class: "input-block-level", placeholder: t("personal_book.book_title"), value: (@writing_book.book_title_translations[locale] rescue nil) %> <% end %>
<%= f.fields_for :extracted_chapters_translations do |f| %> <%= f.text_field locale, class: "input-block-level", placeholder: t("personal_book.extracted_chapters"), value: (@writing_book.extracted_chapters_translations[locale] rescue nil) %> <% end %>
<%= f.fields_for :publisher_translations do |f| %> <%= f.text_field locale, class: "input-block-level", placeholder: t("personal_book.publisher"), value: (@writing_book.publisher_translations[locale] rescue nil) %> <% end %>
<%= f.fields_for :editor_translations do |f| %> <%= f.text_field locale, class: "input-block-level", placeholder: t("personal_book.editor"), value: (@writing_book.editor_translations[locale] rescue nil) %> <% end %>
<%= f.fields_for :authors_translations do |f| %> <%= f.text_area locale, rows: 2, class: "input-block-level", value: (@writing_book.authors_translations[locale] rescue nil) %> <% end %>
<% end %>
<% if @writing_book && !@writing_book.writing_book_files.blank? %>
<% @writing_book.writing_book_files.each_with_index do |writing_book_file, i| %> <%= f.fields_for :writing_book_files, writing_book_file do |f| %> <%= render :partial => 'form_file', :object => writing_book_file, :locals => {:f => f, :i => i} %> <% end %> <% end %>
<% end %>

<%= hidden_field_tag 'plugin_file_field_count', @writing_book.writing_book_files.count %> <%= t(:add) %>

<%= f.hidden_field :user_id, :value => params[:user_id] if !params[:user_id].blank? %> <%= f.submit t('submit'), class: 'btn btn-primary' %> <%= link_to t('cancel'), get_go_back, :class=>"btn" %>
<% content_for :page_specific_javascript do %> <% end %>