%= stylesheet_link_tag "lib/fileupload"%> <%= javascript_include_tag 'lib/bootstrap-fileupload' %>
<%=t('olympiamanagement.'+(!@olympia_student_data.new_record? ? 'edit_sign_up_student_data' : 'add_sign_up_student_data'))%>
<%=form_for @olympia_student_data ,:url=>{:controller=>"olympiamanagements" ,:action=>"update_student_data",:type=>"add_student_data",:id=>params[:id]}, :html => {:multipart => true} do |form|%>
<% @student_data_field.student_data_fields.each do |field| %>
<% @extra_class = ((field.values[0]["required"] == "true")? " required" : "")%> <% @extra_text = ((field.values[0]["required"] == "true")? "*" : "")%> <%if !["StudentBirthYear","StudentBirthMonth","StudentBirthDay"].include?(field.keys[0]) %>
<%= @extra_text+t('olympiamanagement.'+field.keys[0]) %>
<%elsif field.keys[0]=="StudentBirthYear"%>
<%= @extra_text+t('olympiamanagement.birth_date') %>
<%end%>
<% if field.values[0][:type] == 'String' %>
" value="<%= @olympia_student_data[field.keys[0]].to_s %>" size="<%=field.values[0][:size]%>" id="<%= field.keys[0] %>" class="col_input<%= @extra_class%>"/> <% elsif field.values[0][:type] == 'select_num' %> <% @please_choice = (I18n.locale.to_s == "zh_tw") ? "請選擇" : "Please select." %>
" id="<%=field.keys[0]%>" class="required" value="<%= @olympia_student_data[field.keys[0]] %>" style="width: auto;">
<%=@please_choice%>
<% for @num in field.values[0]["range"][0] .. field.values[0]["range"][1] %> <%= ('
' + @num.to_s + (field.values[0][:unit][I18n.locale.to_s] rescue "") + '
').html_safe %> <% end %>
<%if ["StudentBirthMonth","StudentBirthDay"].include?(field.keys[0]) %> <%=t('olympiamanagement.'+field.keys[0])%> <%end%> <% elsif field.values[0][:type] == 'Year' %> <%=t('olympiamanagement.a_d_')%> <% @please_choice = (I18n.locale.to_s == "zh_tw") ? "請選擇" : "Please select." %>
" id="<%=field.keys[0]%>" class="required" value="<%= @olympia_student_data[field.keys[0]] %>" style="width: auto;">
<%=@please_choice%>
<% for @num in (Time.now.year.to_i-15) .. (Time.now.year.to_i) %> <%= ('
' + @num.to_s + (field.values[0][:unit][I18n.locale.to_s] rescue "") + '
').html_safe %> <% end %>
<%=t('olympiamanagement.year')%> <% elsif field.values[0][:type] == 'select_string' %> <% @please_choice = (I18n.locale.to_s == "zh_tw") ? "請選擇" : "Please select." %>
" id="<%=field.keys[0]%>" class="required" value="<%= @olympia_student_data[field.keys[0]] %>" style="width: auto;">
<%=@please_choice%>
<% field.values[0]["values"][I18n.locale.to_s].each_with_index do |value,i| %> <%= ('
' + value.to_s + '
').html_safe %> <% end %>
<% elsif field.values[0][:type] == 'radio' %> <%field.values[0][:choices].each_with_index do |choice,i|%>
" id="<%="#{field.keys[0]}_#{choice}"%>" class="required" value="<%=choice%>" <%= (@olympia_student_data[field.keys[0]].to_s== choice.to_s) ? 'checked=checked' : '' %>>
"><%=field.values[0][:values][I18n.locale.to_s][i]%>
<% end %> <% elsif field.values[0][:type] == 'File' %> <%= fields_for :add_student_data do |student_data| %> <%= render :partial => 'image_form', :object => @olympia_student_data, :locals => {:f => student_data,:@extra_class=>@extra_class,:image_field_name=>:olympia_student_images,:field_name=>:student_file,:image_id=>field.keys[0]} %> <%end%> <% end %>
<% if !field.values[0][:hint][I18n.locale.to_s].blank? %>
<%=field.values[0][:hint][I18n.locale.to_s]%>
<% end %>
<% end %>
<% if @olympia_student_data.new_record? %>
<% else %>
<% end %> <% end %>