<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 @project.new_record? %>
      <%= submit_tag t("cancel"), :type => "button", "callback-method"=>"cancelproject", "ajax-remote" => "get", :href => panel_personal_project_desktop_personal_projects_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 :project_title_translations do |f| %>
                  <%= f.text_field locale,
                    size: "20",
                    placeholder: t("personal_project.project_title")+ "("+I18nVariable.from_locale(locale)+")",
                    class: "s_grid_12 s_grid",
                    value: (@project.project_title_translations[locale.to_s] rescue nil) %>
                <% end %>
        
               <%= f.fields_for :job_title_translations do |f| %>
                  <%= f.text_field locale,
                    size: "20",
                    placeholder: t("personal_project.job_title")+ "("+I18nVariable.from_locale(locale)+")",
                    class: "s_grid_12 s_grid",
                    value: (@project.job_title_translations[locale.to_s] rescue nil) %>
                <% end %>
           
               <%= f.fields_for :participator_translations do |f| %>
                  <%= f.text_field locale,
                    size: "20",
                    placeholder: t("personal_project.participator")+ "("+I18nVariable.from_locale(locale)+")",
                    class: "s_grid_12 s_grid",
                    value: (@project.participator_translations[locale.to_s] rescue nil) %>
                <% end %>
          
               <%= f.fields_for :unit_translations do |f| %>
                  <%= f.text_field locale,
                    size: "20",
                    placeholder: t("personal_project.unit")+ "("+I18nVariable.from_locale(locale)+")",
                    class: "s_grid_12 s_grid",
                    value: (@project.unit_translations[locale.to_s] rescue nil) %>
                <% end %>
            </div>
            <% end %>
          </li>
             <li class="s_grid_row">
                <%= label_tag("", t("personal_project.start_date"), class: "s_grid_4 s_grid") %>
                <%= f.date_select :period_start_date, {:use_month_numbers => true, :start_year => Time.now.year, :end_year => 1930, :order => [:year] }, {:class => 's_grid_4 s_grid'} %>
                <%= f.date_select :period_start_date, {:use_month_numbers => true, :order => [:month, :day] }, {:class => 's_grid_2 s_grid'} %>
            </li>
            <li class="s_grid_row">
                <%= label_tag("", t("personal_project.end_date"), class: "s_grid_4 s_grid") %>
                <%= f.date_select :period_end_date, {:use_month_numbers => true, :start_year => Time.now.year, :end_year => 1930, :order => [:year] }, {:class => 's_grid_4 s_grid'} %>
                <%= f.date_select :period_end_date, {:use_month_numbers => true, :order => [:month, :day] }, {:class => 's_grid_2 s_grid'} %>
            </li>
             <li class="s_grid_row">
                <%= label_tag("", t("personal_project.year"), class: "s_grid_4 s_grid") %>
                <%= select_year((@project.year ? @project.year.to_i : DateTime.now.year), {:start_year => DateTime.now.year, :end_year => 1930}, {:name => 'lab[year]',:class => 's_grid_4 s_grid'} ) %>
            </li>
              <li class="s_grid_row">
              <%= label_tag("", t("personal_project.project_category"), class: "s_grid_4 s_grid") %>
              <%= f.select :project_category_id, ProjectCategory.all.collect {|t| [ t.title, t.id ]}, {:class => "s_grid s_grid_8"} %>
            </li>
             <li class="s_grid_row">
              <%= label_tag("", t("personal_project.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_project.keywords"), class: "s_grid_12 s_grid_h_2 s_grid"%>
            </li>
            <li class="s_grid_row">
                <%= f.label :language, t("personal_project.language"), :class => "s_grid s_grid_4" %>
                <%= f.select :language, Project::LANGUAGE_TYPES,{} ,{:class => "s_grid s_grid_8"} %>
             </li>             
              <li class="s_grid_row">
                <%= f.text_area :note, size: "20x3", placeholder: t("personal_project.note"), class: "s_grid_12 s_grid s_grid_h_7 s_grid_h_full"%>
            </li>
   
             <li class="s_grid_row">
            <%= f.text_area :abstract, size: "20x22", placeholder: t("personal_project.abstract"), class: "s_grid_12 s_grid s_grid_h_10 s_grid_h_full"%>
            </li>
     
          <li class="s_grid_row">
          <table class="s_table">
            <thead>
              <tr>
                <th class="s_grid_2"><%= t("personal_project.file")%></th>
                <th class="s_grid_4"><%= t("personal_project.file_name")%></th>
                <th class="s_grid_4"><%= t("personal_project.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', @project.project_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>
              <% @project.project_files.each_with_index do |project_file, i| %>
                <%= f.fields_for :project_files, project_file do |f| %>
                  <%= render :partial => 'form_file', :object => project_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, :project_files) %>").replace(old_id, new_id);
  }
</script>