<% # 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" %> <%= javascript_include_tag "lib/bootstrap-datetimepicker.js" %> <%= javascript_include_tag "lib/bootstrap-typeahead.js" %> <%= javascript_include_tag "lib/datetimepicker/date.time.picker.js" %> <%= javascript_include_tag "lib/datetimepicker/datetimepicker" %> <% end %>
<% @author_types.each do |author_type| %> <%= content_tag :label,:class => "checkbox inline" do -%> <%= check_box_tag 'book[book_author_type_ids][]', author_type.id, @book.book_author_type_ids.include?(author_type.id)%> <%= author_type.title %> <% end %> <% end %>
<%= f.text_field :member_profile_id, id: "member_autocomplete", autocomplete: "off", data: { provide: "typeahead"}, class: "input-block-level", value: (@book.member_profile.name rescue nil), placeholder: t("personal_journal.author")%> <%= f.hidden_field :member_profile_id, value: (@book.member_profile_id ? @book.member_profile_id : ""), id: "member_value" %>
<%= f.select :book_type_id, @book_types.collect {|t| [ t.title, t.id ]} %>
<%= select_year((@book.year ? @book.year.to_i : DateTime.now.year), {:start_year => DateTime.now.year, :end_year => 1930}, {:name => 'writing_book[year]',:class => 'span1'} ) %>
<%= f.datetime_picker :publish_date, :no_label => true %>
<%= f.datetime_picker :publication_date, :no_label => true %>
<%= f.text_field :url , :class => "span6" %>
<%= f.text_field :keywords %>
<%= f.text_field :pages %>
<%= f.text_field :isbn %>
<%= f.radio_button :language, "zh_tw" %> <%= t("personal_book.Chinese") %> <%= f.radio_button :language, "en" %> <%= t("personal_book.English") %>
<%= f.text_area :note, rows: 2, class: "input-block-level" %>
<% @site_in_use_locales.each_with_index do |locale, i| %>
">
<%= f.fields_for :book_title_translations do |f| %> <%= f.text_field locale, class: "input-block-level", placeholder: t("personal_book.book_title"), value: (@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: (@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: (@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: (@book.editor_translations[locale] rescue nil) %> <% end %>
<% end %>
<% if @book && !@book.book_authors.blank? %>
<% @book.book_authors.each_with_index do |author, i| %> <%= f.fields_for :book_authors, author do |f| %> <%= render :partial => 'form_author', :object => author, :locals => {:f => f, :i => i} %> <% end %> <% end %>
<% end %>

<%= t(:add) %>

<% if @book && !@book.book_files.blank? %>
<% @book.book_files.each_with_index do |book_file, i| %> <%= f.fields_for :book_files, book_file do |f| %> <%= render :partial => 'form_file', :object => book_file, :locals => {:f => f, :i => i} %> <% end %> <% end %>
<% end %>

<%= hidden_field_tag 'plugin_file_field_count', @book.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 %> <%= render 'author_autocomplete'%> <% end %>