<div class="toolbar hh1">
  <div class="fn_g hp">

    <%= f.submit t("save"), name: "commit", class: "fn_btn ini_input hp hh1 thmc2 thmtxt" %>
    <% if not @writing_journal.new_record? %>
      <%= submit_tag t("cancel"), :type => "button", "callback-method"=>"cancelpaper", "ajax-remote" => "get", :href => panel_personal_journal_desktop_journal_pages_path, class: "fn_btn ini_input hp hh1 admbg2 admtxt" %>

    <% end %>
  </div>
  <div class="hh1 hp sdm">
    <div class="sdm_t hh1 ">Language</div>
    <div class="admbg sdm_o language_select">
      <ul>
        <% @site_in_use_locales.each_with_index do |locale, i| %>
          <li><a class="hp hh1 admtxt" href="" data-lang="<%= locale %>"><%= I18nVariable.from_locale(locale) %></a></li>
        <% end %>
      </ul>
    </div>
  </div>
  <div class="hh1 hp sdm">
    <div class="sdm_t hh1"><span class="icon-question-sign"></span></div>
  </div>
</div>
<!-- <div id="paper_add" class="tinycanvas vp">
  <div class="scrollbar sb_h vp">
    <div class="track">
      <div class="thumb thmc2">
        <div class="end"></div>
      </div>
    </div>
  </div>
  <div class="viewport"> -->
    <div class="overview" content-layout="simple" base-width="420">
          <ul class="s_form" isotope="true">
            <li class="s_grid_row" >
            <% @site_in_use_locales.each_with_index do |locale, i| %>
              <% style = locale != I18n.locale.to_s ? 'style=display:none;' : "" %>
              <% data = "data-language=" + locale  %>
            <div class="form_fix" <%= style %> <%= data %>>
            <%= f.fields_for :paper_title_translations do |f| %>
              <%= f.text_area locale,
                class: "s_grid_12 s_grid s_grid_h_3",
                size: "20x4",
                placeholder: t("personal_journal.paper_title")+ "("+I18nVariable.from_locale(locale)+")",
                value: (@writing_journal.paper_title_translations[locale.to_s] rescue nil) %>
            <% end %>

            <%= f.fields_for :journal_title_translations do |f| %>
              <%= f.text_field locale,
                size: "20",
                placeholder: t("personal_journal.journal_title")+ "("+I18nVariable.from_locale(locale)+")",
                class: "s_grid_12 s_grid",
                value: (@writing_journal.journal_title_translations[locale.to_s] rescue nil) %>
            <% end %>
            
            </div>
            <% end %>
          </li>
            <li class="s_grid_row">
            <%= label_tag("", t("personal_journal.level_type"), :class => 's_grid s_grid_4') %>
            <div class="s_select_g s_grid s_grid_8 s_grid_h_2">
              
              <ul>
                <% @level_types.each_with_index do |level_type, i| %>
                  <li>
                  <%= check_box_tag "writing_journal[journal_level_type_ids][]",
                    level_type.id,
                    @writing_journal.journal_level_type_ids.include?(level_type.id),
                    id: "field-#{i}"
                    %><%= label_tag("field-#{i}", level_type.title) %>
                  </li>
                <% end %>
              </ul>
            </div>
            </li>

            <li class="s_grid_row">
            <%= label_tag("", t("personal_journal.isbn"), class: "s_grid_4 s_grid") %><%= f.text_field :isbn, size: "20", class: "s_grid_8 s_grid"%>
            </li>

            <li class="s_grid_row">
            <%= label_tag("",  t("personal_journal.vol_no"), class: "s_grid_4 s_grid") %><%= f.text_field :vol_no, size: "20", class: "s_grid_8 s_grid"%>
            </li>

            <li class="s_grid_row">
            <%= label_tag("", t("personal_journal.issue_no"), class: "s_grid_4 s_grid") %><%= f.text_field :issue_no, size: "20", class: "s_grid_8 s_grid"%>
            </li>
            <li class="s_grid_row">
            <%= label_tag("", t("personal_journal.total_pages"), class: "s_grid_4 s_grid") %>
            <%= f.text_field :form_to_start, size: "10", class: "s_grid_2 s_grid"%>
            <%= label_tag("", t("personal_journal.to"), class: "s_grid_1 s_grid") %>
            <%= f.text_field :form_to_end, size: "10", class: "s_grid_2 s_grid"%>
            <label class="s_grid_1 s_grid" for="">共</label>
            <%= f.text_field :total_pages, size: "20", class: "s_grid_2 s_grid"%>
            </li>
      
            <li class="s_grid_row">
            <%= f.text_area :author_tokens,
              class: "s_grid_12 s_grid",
              size: "20x2",
              placeholder: t("personal_journal.authors"),
               "autocomplete" => "/panel/personal_journal/desktop/journal_pages/new.json",
               "autocomplete-format" => "--:[text,email]",
              "data-pre" => generate_authors_name(@writing_journal.journal_co_author_ids) %>
            <%#= f.fields_for :authors_translations do |f| %>
              <%#= f.text_area locale,
              class: "s_grid_6 s_grid",
              size: "20x2",
              placeholder: t("personal_journal.authors"),
              "autocomplete-list" => "coauthor_autocomplete_list",
              value:  (@writing_journal.authors_translations[locale.to_s] rescue nil) %>
            <%# end %>
            
            </li>
            <li class="s_grid_row">

            <select name="writing_journal[journal_author_type_ids][]" id="" class="s_grid s_grid_8">
              <%= options_for_select(
                [t("personal_journal.author_type")] +
                @author_types.map do |author_type|
                  [author_type.title, author_type.id]
                end
              )%>
            </select>

            <select name="writing_journal[journal_paper_type_ids][]" id="" class="s_grid s_grid_4">
              <%= options_for_select(
                [t("personal_journal.level_type")] +
                @paper_types.map do |paper_type|
                  [paper_type.title, paper_type.id]
                end
              )%>
            </select>
            </li>
    <li class="s_grid_row">
    <%= label_tag("", t("personal_journal.publication_date"), class: "s_grid_4 s_grid") %>
    <%= f.date_select :publication_date, {:use_month_numbers => true, :start_year => Time.now.year, :end_year => 1930, :order => [:year] }, {:class => 's_grid_4 s_grid'} %>
    <%= f.date_select :publication_date, {:use_month_numbers => true, :order => [:month, :day] }, {:class => 's_grid_2 s_grid'} %>
    </li>
    <li class="s_grid_row">
    <%= f.text_area :keywords, size: "20x3", placeholder: t("personal_journal.keywords"), class: "s_grid_12 s_grid_h_2 s_grid"%>
    </li>

    <li class="s_grid_row">
    <%= f.label :year, t("personal_journal.year"), :class => "s_grid_4 s_grid" %>
    <%= select_year((@writing_journal.year ? @writing_journal.year.to_i : DateTime.now.year), {:start_year => DateTime.now.year, :end_year => 1930}, {:name => 'writing_journal[year]', :class => "s_grid_8 s_grid"} ) %>
    </li>

    <li class="s_grid_row">
    <%= f.label :language, t("personal_journal.language"), :class => "s_grid s_grid_4" %>
    <%= f.select :language, WritingJournal::LANGUAGE_TYPES,{} ,{:class => "s_grid s_grid_8"} %>
     </li>

    <li class="s_grid_row">
      <input class="s_grid s_grid_12" type="text" placeholder=<%= t("personal_journal.tags") %>>
      
    </li>
    <li class="s_grid_row">
      <label for="" class="s_grid s_grid_4">Status</label>
    <select name="" id="" class="s_grid s_grid_8">
      <option value="">Status</option>
      <option value="">Published</option>
      <option value="">Pending</option>
      <option value="">Writing</option>
    </select>
    </li>
    <li class="s_grid_row">
    <%= label_tag("", t("personal_journal.url"), class: "s_grid_4 s_grid") %><%= f.text_field :url, size: "20", class: "s_grid_8 s_grid"%>
    </li>
        
          <li class="s_grid_row">
          <table class="s_table">
            <thead>
              <tr>
                <th class="s_grid_2"><%= t("personal_journal.file")%></th>
                <th class="s_grid_4"><%= t("personal_journal.file_name")%></th>
                <th class="s_grid_4"><%= t("personal_journal.description") %></th>
                <th class="s_grid_2"></th>
              </tr>
            </thead>
            <tfoot>
              <tr>
                <td colspan="4">
                  <div id='add_plugin_file' class="info_input plugin_files_block s_action">
                    <%= hidden_field_tag 'plugin_file_field_count', @writing_journal.writing_journal_files.count %>
                    <a class="add setting_btn thmc1 thmtxt w1 hh1 hp" href="#"><i class="icon-plus icon-white"></i> add</a>
                  </div>
                </td>
              </tr>
            </tfoot>
            <tbody>
              <% @writing_journal.writing_journal_files.each_with_index do |writing_journal_file, i| %>
                <%= f.fields_for :writing_journal_files, writing_journal_file do |f| %>
                  <%= render :partial => 'form_file', :object => writing_journal_file, :locals => {:f => f, :i => i} %>
                <% end %>
              <% end %>
            </tbody>
          </table>
          </li>
  
            <li class="s_grid_row">
            <%= f.text_area :note, size: "20x22", placeholder: t("personal_journal.note"), class: "s_grid_12 s_grid s_grid_h_10 s_grid_h_full"%>
            </li>
      
            <li class="s_grid_row">
            <%= f.text_area :abstract, size: "20x22", placeholder: t("personal_journal.abstract"), class: "s_grid_12 s_grid s_grid_h_10 s_grid_h_full"%>
            </li>
          </ul>
        </div>
      </div>
    </div>
    </div>
<!--   </div>
</div>
 -->

<script>
  var get_html = function(old_id,new_id){
    return ("<%= escape_javascript(add_attribute 'form_file', f, :writing_journal_files) %>").replace(old_id, new_id);
  }
</script>
