<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 @research.new_record? %>
      <%= submit_tag t("cancel"), :type => "button", "callback-method"=>"cancelresearch", "ajax-remote" => "get", :href => panel_personal_research_desktop_personal_researchs_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 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 :research_title_translations do |f| %>
                  <%= f.text_field locale,
                    size: "20",
                    placeholder: t("personal_research.research_title")+ "("+I18nVariable.from_locale(locale)+")",
                    class: "s_grid_12 s_grid",
                    value: (@research.research_title_translations[locale.to_s] rescue nil) %>
                <% end %>
           
               <%= f.fields_for :extracted_chapters_translations do |f| %>
                  <%= f.text_field locale,
                    size: "20",
                    placeholder: t("personal_research.extracted_chapters")+ "("+I18nVariable.from_locale(locale)+")",
                    class: "s_grid_12 s_grid",
                    value: (@research.extracted_chapters_translations[locale.to_s] rescue nil) %>
                <% end %>
            </div>
            <% end %>
          </li>
             <li class="s_grid_row">
                <%= label_tag("", t("personal_research.publication_date"), class: "s_grid_4 s_grid") %>
                <%= f.date_select :publish_date, {:use_month_numbers => true, :start_year => Time.now.year, :end_year => 1930, :order => [:year] }, {:class => 's_grid_4 s_grid'} %>
                <%= f.date_select :publish_date, {:use_month_numbers => true, :order => [:month, :day] }, {:class => 's_grid_2 s_grid'} %>
            </li>
             <li class="s_grid_row">
              <%= label_tag("", t("personal_research.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">
              <%= f.text_area :keywords, size: "20x3", placeholder: t("personal_research.keywords"), class: "s_grid_12 s_grid_h_2 s_grid"%>
            </li>
              <li class="s_grid_row">
                <%= f.label :language, t("personal_research.language"), :class => "s_grid s_grid_4" %>
                <%= f.select :language, Research::LANGUAGE_TYPES,{} ,{:class => "s_grid s_grid_8"} %>
             </li>
             <li class="s_grid_row">
                <%= f.text_area :note, size: "20x3", placeholder: t("personal_research.note"), class: "s_grid_12 s_grid s_grid_h_3 s_grid_h_full"%>
            </li>
   
          <li class="s_grid_row">
          <table class="s_table">
            <thead>
              <tr>
                <th class="s_grid_2"><%= t("personal_research.file")%></th>
                <th class="s_grid_4"><%= t("personal_research.file_name")%></th>
                <th class="s_grid_4"><%= t("personal_research.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', @research.research_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>
              <% @research.research_files.each_with_index do |research_file, i| %>
                <%= f.fields_for :research_files, research_file do |f| %>
                  <%= render :partial => 'form_file', :object => research_file, :locals => {:f => f, :i => i} %>
                <% end %>
              <% end %>
            </tbody>
          </table>
          </li>
        </ul>
</div>
<script>
  var get_html = function(old_id,new_id){
    return ("<%= escape_javascript(add_attribute 'form_file', f, :research_files) %>").replace(old_id, new_id);
  }
</script>