fix
This commit is contained in:
parent
2d0e43787c
commit
6a93c393df
|
@ -196,7 +196,7 @@ class OlympiamanagementsController < ApplicationController
|
||||||
render_contents_in_index_page(@breadcumb+"<p><a href=#{school_connection_data_olympiamanagements_path}>#{I18n.t('olympiamanagement.please_set_school_connect_data')}</a></p>".html_safe)
|
render_contents_in_index_page(@breadcumb+"<p><a href=#{school_connection_data_olympiamanagements_path}>#{I18n.t('olympiamanagement.please_set_school_connect_data')}</a></p>".html_safe)
|
||||||
else
|
else
|
||||||
@student_data_field = StudentDataField.first
|
@student_data_field = StudentDataField.first
|
||||||
@olympia_student_data = OlympiaStudentDataFields.new
|
@olympia_student_data = (OlympiaStudentDataFields.find(params[:id]) rescue OlympiaStudentDataFields.new)
|
||||||
@page_content = render_to_string(:formats=> [:html] ,:partial=>'add_student_data.html',:locals=>{:@error=>(@@error rescue nil),:@student_data_field=>@student_data_field,:@olympia_student_data=>@olympia_student_data})
|
@page_content = render_to_string(:formats=> [:html] ,:partial=>'add_student_data.html',:locals=>{:@error=>(@@error rescue nil),:@student_data_field=>@student_data_field,:@olympia_student_data=>@olympia_student_data})
|
||||||
render_contents_in_index_page(@breadcumb+@page_content.html_safe)
|
render_contents_in_index_page(@breadcumb+@page_content.html_safe)
|
||||||
end
|
end
|
||||||
|
@ -529,8 +529,9 @@ class OlympiamanagementsController < ApplicationController
|
||||||
end
|
end
|
||||||
def updata_student_data
|
def updata_student_data
|
||||||
if params[:type] == 'add_student_data'
|
if params[:type] == 'add_student_data'
|
||||||
@olympia_student_data = OlympiaStudentDataFields.create(params.require(:add_student_data).permit(:StudentIdentity,:StudentName,:StudentSex,:StudentIDNO,
|
@student_params = params.require(:add_student_data).permit(:StudentIdentity,:StudentName,:StudentSex,:StudentIDNO,:StudentBirthMonth,:StudentBirthDay,:StudentClass,:StudentPhone,:StudentCode,:StudentAddress,:StudentArea,:StudentFile)
|
||||||
:StudentBirthMonth,:StudentBirthDay,:StudentClass,:StudentPhone,:StudentCode,:StudentAddress,:StudentArea,:StudentFile))
|
@olympia_student_data = OlympiaStudentDataFields.find(params[:id]) rescue nil
|
||||||
|
@olympia_student_data.nil? ? OlympiaStudentDataFields.create(@student_params) : @olympia_student_data.update_attributes(@student_params)
|
||||||
redirect_to sign_up_student_data_list_olympiamanagements_path
|
redirect_to sign_up_student_data_list_olympiamanagements_path
|
||||||
else
|
else
|
||||||
render :html => '404'
|
render :html => '404'
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
<%end%>
|
<%end%>
|
||||||
<li class="col_r">
|
<li class="col_r">
|
||||||
<% if field.values[0][:type] == 'String' %>
|
<% if field.values[0][:type] == 'String' %>
|
||||||
<input type="text" name="<%="[add_student_data][#{field.keys[0]}]"%>" value="<%= (field.keys[0]=="enrollment_limited"&&(@olympia_student_data[field.keys[0]].nil? || @olympia_school_data_field[field.keys[0]] == 0) ) ? "" : @olympia_school_data_field[field.keys[0]] %>" size="<%=field.values[0][:size]%>" id="<%= field.keys[0] %>" class="col_input<%= @extra_class%>"/>
|
<input type="text" name="<%="[add_student_data][#{field.keys[0]}]"%>" 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' %>
|
<% elsif field.values[0][:type] == 'select_num' %>
|
||||||
<% @please_choice = (I18n.locale.to_s == "zh_tw") ? "請選擇" : "Please select." %>
|
<% @please_choice = (I18n.locale.to_s == "zh_tw") ? "請選擇" : "Please select." %>
|
||||||
<select name="<%="[add_student_data][#{field.keys[0]}]"%>" id="<%=field.keys[0]%>" class="required" value="<%= @olympia_student_data[field.keys[0]] %>" style="width: auto;"><option value=""><%=@please_choice%></option>
|
<select name="<%="[add_student_data][#{field.keys[0]}]"%>" id="<%=field.keys[0]%>" class="required" value="<%= @olympia_student_data[field.keys[0]] %>" style="width: auto;"><option value=""><%=@please_choice%></option>
|
||||||
|
@ -44,11 +44,11 @@
|
||||||
</select>
|
</select>
|
||||||
<% elsif field.values[0][:type] == 'radio' %>
|
<% elsif field.values[0][:type] == 'radio' %>
|
||||||
<%field.values[0][:choices].each_with_index do |choice,i|%>
|
<%field.values[0][:choices].each_with_index do |choice,i|%>
|
||||||
<input type="radio" size="<%=field.values[0][:size]%>" name="<%="[add_student_data][#{field.keys[0]}]"%>" id="<%="#{field.keys[0]}_#{choice}"%>" class="required" value="<%=choice%>" "<%= (@olympia_student_data[field.keys[0]]== choice) ? 'checked' : '' %>">
|
<input type="radio" size="<%=field.values[0][:size]%>" name="<%="[add_student_data][#{field.keys[0]}]"%>" id="<%="#{field.keys[0]}_#{choice}"%>" class="required" value="<%=choice%>" <%= (@olympia_student_data[field.keys[0]].to_s== choice.to_s) ? 'checked=checked' : '' %>>
|
||||||
<label for="<%="#{field.keys[0]}_#{choice}"%>"><%=field.values[0][:values][I18n.locale.to_s][i]%></label>
|
<label for="<%="#{field.keys[0]}_#{choice}"%>"><%=field.values[0][:values][I18n.locale.to_s][i]%></label>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% elsif field.values[0][:type] == 'File' %>
|
<% elsif field.values[0][:type] == 'File' %>
|
||||||
<input type="file" name="<%="[add_student_data][#{field.keys[0]}]"%>" value="<%= (field.keys[0]=="enrollment_limited"&&(@olympia_student_data[field.keys[0]].nil? || @olympia_school_data_field[field.keys[0]] == 0) ) ? "" : @olympia_school_data_field[field.keys[0]] %>" size="<%=field.values[0][:size]%>" id="<%= field.keys[0] %>" style="margin-top: 1em;" class="col_input<%= @extra_class%>"/>
|
<input type="file" name="<%="[add_student_data][#{field.keys[0]}]"%>" value="<%= @olympia_student_data[field.keys[0]] %>" size="<%=field.values[0][:size]%>" id="<%= field.keys[0] %>" style="margin-top: 1em;" class="col_input<%= @extra_class%>"/>
|
||||||
<% end %>
|
<% end %>
|
||||||
</li>
|
</li>
|
||||||
<% if !field.values[0][:hint][I18n.locale.to_s].blank? %>
|
<% if !field.values[0][:hint][I18n.locale.to_s].blank? %>
|
||||||
|
|
Loading…
Reference in New Issue