olympiamanagement/app/views/admin/olympiamanagements/sign_up_setting.html.erb

166 lines
11 KiB
Plaintext
Raw Permalink Normal View History

2020-01-31 10:52:53 +00:00
<link rel="stylesheet" media="screen" type="text/css" href="/assets/admin/olympiamanagement.scss">
<link rel="stylesheet" media="print" type="text/css" href="/assets/admin/olympiamanagement.scss">
<script src="/assets/admin/olympiamanagement.js"></script>
<fieldset class="fieldset_block sign_up_setting_block">
<legend class="fieldset_title"><%=t('olympiamanagement.sign_up_setting')%></legend>
2020-02-04 11:51:05 +00:00
<%=form_for @sign_up_setting ,:url=>{:controller=>"olympiamanagements" ,:action=>"update_school_data",:type=>"sign_up_setting",:id=>@sign_up_setting.id} do |form|%>
2020-02-05 13:44:49 +00:00
<a href="#" onclick="if( window.confirm('<%=t('olympiamanagement.please_confirm_delete')%>') ) { window.location='<%=admin_olympiamanagements_update_sign_up_data_path + '?type=delete_old_data'%>'; }" onkeypress="if( window.confirm('<%=t('olympiamanagement.please_confirm_delete')%>') ) { window.location='<%=admin_olympiamanagements_update_sign_up_data_path + '?type=delete_old_data'%>'; }">
2020-01-31 10:52:53 +00:00
<img src="/assets/trash.gif" alt="<%=t('olympiamanagement.delete_all_sign_up_data')%>" align="top" width="24"><%=t('olympiamanagement.delete_all_sign_up_data')%></a>
<hr style="border-color: black;border-top: 0em;">
2020-02-05 13:44:49 +00:00
<div style="clear: both;"></div>
<%=render :partial=>'checkbox',:locals=>{:name=>t('olympiamanagement.new_sign_up'),:params_name=>'new_sign_up',:id=>'new_sign_up',:extra_class=>'lleft red_text',:is_checked=>nil}%>
<div style="clear: both;"></div>
<hr style="border-color: black;border-top: 0em;">
<div class="col_text">
<h4 class="col" for="StudentArea"><%= t('olympiamanagement.StudentArea')%></h4>
<div class="col_r" id="StudentArea">
<% index = @student_data_field.student_data_fields.map{|h| h.keys.first}.index('StudentArea') %>
<% for i in 0...(@student_data_field.student_data_fields[index]['StudentArea']['values'][@site_locales.first.to_s].count) %>
<div style="clear: both;">
<div class="remove_btn"><a class="remove_locale_fields" href="#" title="<%=t(:remove)%>">❌</a></div>
<div class="locale_fields">
<% @site_locales.each_with_index do |locale,locale_index|%>
<input class="locale_text" type="text" name="[StudentArea][<%=locale%>][]" value="<%= @student_data_field.student_data_fields[index]['StudentArea']['values'][locale.to_s][i]%>" <%=locale_index != 0 ? 'style=display:none;' : ''%>>
<% end %>
</div>
<div class="locale_buttons">
<% @site_locales.each_with_index do |locale,locale_index|%>
<a title="<%=t(locale)%>" class="btn show_locale_field_btn <%=locale_index == 0 ? 'active' : ''%>"><%=t(locale)%></a>
<% end %>
</div>
</div>
<% end %>
<div style="clear: both;">
<a id="add_area_choice" class="btn btn-small btn-primary"><i class="icons-plus"></i><%=t(:add)%></a>
</div>
</div>
</div>
<div style="clear: both;"></div>
<hr style="border-color: black;border-top: 0em;">
2020-01-31 10:52:53 +00:00
<div class="col_text">
<li class="col" for="start_time"><%= t('olympiamanagement.sign_up_start_time')%></li>
<li class="col_r" id="start_time">
<span style="float: left;padding: 0.3em;"><%= t('olympiamanagement.a_d_')%></span>
<%=render :partial=>'select',:locals=>{:name=>'[sign_up_setting][start_year]',:id=>'start_year',:value=> @sign_up_setting['start_year'],:unit=>'',:range=>[Time.now.year-10,Time.now.year+10],:extra_class=>'lleft',:is_add_zero=>false}%>
<span style="float: left;padding: 0.3em;"><%= t('olympiamanagement.year')%></span>
<%=render :partial=>'select',:locals=>{:name=>'[sign_up_setting][start_month]',:id=>'start_month',:value=>@sign_up_setting['start_month'],:unit=>'',:range=>[1,12],:extra_class=>'lleft',:is_add_zero=>true}%>
<span style="float: left;padding: 0.3em;"><%= t('olympiamanagement.month')%></span>
<%=render :partial=>'select',:locals=>{:name=>'[sign_up_setting][start_day]',:id=>'start_day',:value=>@sign_up_setting['start_day'],:unit=>'',:range=>[1,31],:extra_class=>'lleft',:is_add_zero=>true}%>
<span style="float: left;padding: 0.3em;"><%= t('olympiamanagement.day')%></span>
<%=render :partial=>'select',:locals=>{:name=>'[sign_up_setting][start_o_clock]',:id=>'start_o_clock',:value=>@sign_up_setting['start_o_clock'],:unit=>'',:range=>[0,23],:extra_class=>'lleft',:is_add_zero=>true}%>
<span style="float: left;padding: 0.3em;"><%= t('olympiamanagement.o_clock')%></span>
<%=render :partial=>'select',:locals=>{:name=>'[sign_up_setting][start_minute]',:id=>'start_minute',:value=>@sign_up_setting['start_minute'],:unit=>'',:range=>[0,59],:extra_class=>'lleft',:is_add_zero=>true}%>
<span style="float: left;padding: 0.3em;"><%= t('olympiamanagement.minute')%></span>
</li>
</div>
<div class="col_text">
<li class="col" for="end_time"><%= t('olympiamanagement.sign_up_end_time')%></li>
<li class="col_r" id="end_time">
<span style="float: left;padding: 0.3em;"><%= t('olympiamanagement.a_d_')%></span>
<%=render :partial=>'select',:locals=>{:name=>'[sign_up_setting][end_year]',:id=>'end_year',:value=>@sign_up_setting['end_year'],:unit=>'',:range=>[Time.now.year-10,Time.now.year+10],:extra_class=>'lleft',:is_add_zero=>false}%>
<span style="float: left;padding: 0.3em;"><%= t('olympiamanagement.year')%></span>
<%=render :partial=>'select',:locals=>{:name=>'[sign_up_setting][end_month]',:id=>'end_month',:value=>@sign_up_setting['end_month'],:unit=>'',:range=>[1,12],:extra_class=>'lleft',:is_add_zero=>true}%>
<span style="float: left;padding: 0.3em;"><%= t('olympiamanagement.month')%></span>
<%=render :partial=>'select',:locals=>{:name=>'[sign_up_setting][end_day]',:id=>'end_day',:value=>@sign_up_setting['end_day'],:unit=>'',:range=>[1,31],:extra_class=>'lleft',:is_add_zero=>true}%>
<span style="float: left;padding: 0.3em;"><%= t('olympiamanagement.day')%></span>
<%=render :partial=>'select',:locals=>{:name=>'[sign_up_setting][end_o_clock]',:id=>'end_o_clock',:value=>@sign_up_setting['end_o_clock'],:unit=>'',:range=>[0,23],:extra_class=>'lleft',:is_add_zero=>true}%>
<span style="float: left;padding: 0.3em;"><%= t('olympiamanagement.o_clock')%></span>
<%=render :partial=>'select',:locals=>{:name=>'[sign_up_setting][end_minute]',:id=>'end_minute',:value=>@sign_up_setting['end_minute'],:unit=>'',:range=>[0,59],:extra_class=>'lleft',:is_add_zero=>true}%>
<span style="float: left;padding: 0.3em;"><%= t('olympiamanagement.minute')%></span>
</li>
</div>
<div class="col_text">
<li class="col" for="default_password"><%= t('olympiamanagement.default_password') %></li>
<li class="col_r" style="margin-right: 0.5em;">
<input name="[sign_up_setting][default_password]" type="text" id="default_password" size="20" class="col_input" <%= @sign_up_setting.default_password.nil? ? nil : "value=#{@sign_up_setting.default_password}"%>>
</li>
<%=render :partial=>'checkbox',:locals=>{:name=>t('olympiamanagement.sign_up_setting_hint'),:params_name=>'[sign_up_setting][set_default_password]',:id=>'set_default_password',:extra_class=>'lleft',:is_checked=>nil}%>
</div>
<div style="clear:both;"></div>
2020-01-31 14:56:46 +00:00
<h4 id="remark"><%= t('olympiamanagement.remark')+"(#{t('olympiamanagement.print_registration_form')})" %></h4>
2020-01-31 10:52:53 +00:00
<ul class="nav nav-pills language-nav">
<% @site_locales.each_with_index do |locale,i|%>
<li <%= (i == 0) ? "class=active" : "" %>>
<a href=".<%=locale.to_s%>" data-toggle="tab"><%=t(locale.to_s)%></a>
</li>
<% end %>
</ul>
<div class="tab-content language-area">
<% @site_locales.each_with_index do |locale,i|%>
<div class="tab-pane fade <%=locale.to_s%> <%= (i == 0) ? "active in": "" %>">
<div class="control-group input-content">
<textarea id="remark_field_<%=locale.to_s%>" name="[sign_up_setting][remark_field][<%=locale.to_s%>]">
<%=@sign_up_setting.remark_field[locale] %>
</textarea>
</div>
</div>
<% end %>
</div>
2020-01-31 14:56:46 +00:00
<h4 id="registration_instructions"><%= t('olympiamanagement.registration_instructions') %></h4>
2020-01-31 10:52:53 +00:00
<ul class="nav nav-pills language-nav">
<% @site_locales.each_with_index do |locale,i|%>
<li <%= (i == 0) ? "class=active" : "" %>>
<a href=".<%=locale.to_s%>" data-toggle="tab"><%=t(locale.to_s)%></a>
</li>
<% end %>
</ul>
<div class="tab-content language-area">
<% @site_locales.each_with_index do |locale,i|%>
<div class="tab-pane fade <%=locale.to_s%> <%= (i == 0) ? "active in": "" %>">
<div class="control-group input-content">
<textarea id="registration_instructions_<%=locale.to_s%>" name="[sign_up_setting][registration_instructions][<%=locale.to_s%>]">
<%=@sign_up_setting.registration_instructions[locale] %>
</textarea>
</div>
</div>
<% end %>
</div>
<div style="clear:both;"></div>
<input type="submit" name="Submit" value="<%=t('olympiamanagement.confirm')%>">
<input type="reset" name="Submit" value="<%=t('olympiamanagement.cancel')%>">
<% end %>
</fieldset>
<style type="text/css">
.locale_buttons{
float: left;
}
.locale_fields{
float: left;
}
.remove_btn{
float: left;
}
.icons-plus{
margin-right: 0.3em;
}
</style>
<script type="text/javascript">
$(document).ready(function(){
$('.show_locale_field_btn').off('click').on('click',function(){
var index = $(this).index();
$(this).parent().siblings('.locale_fields').find('.locale_text').css('display','none');
$(this).parent().siblings('.locale_fields').find('.locale_text').eq(index).css('display','block');
$(this).parent().find('.show_locale_field_btn').removeClass('active');
$(this).addClass('active');
});
$('#add_area_choice').click(function(){
var new_locale_fields_html = '<div style="clear: both;"><div class="remove_btn"><a class="remove_locale_fields" href="#" title="<%=t(:remove)%>">❌</a></div><div class="locale_fields"><% @site_locales.each_with_index do |locale,locale_index|%><input class="locale_text" type="text" name="[StudentArea][<%=locale%>][]" value="" <%=locale_index != 0 ? 'style=display:none;' : ''%>><% end %></div><div class="locale_buttons"><% @site_locales.each_with_index do |locale,locale_index|%><a title="<%=t(locale)%>" class="btn show_locale_field_btn <%=locale_index == 0 ? 'active' : ''%>"><%=t(locale)%></a><% end %></div></div>';
$(this).parent().before(new_locale_fields_html);
$('.remove_locale_fields').off('click').on('click',function(){
if( window.confirm('請確認是否刪除?'))
$(this).parent().parent().remove();
});
$('.show_locale_field_btn').off('click').on('click',function(){
var index = $(this).index();
$(this).parent().siblings('.locale_fields').find('.locale_text').css('display','none');
$(this).parent().siblings('.locale_fields').find('.locale_text').eq(index).css('display','block');
$(this).parent().find('.show_locale_field_btn').removeClass('active');
$(this).addClass('active');
});
});
$('.remove_locale_fields').off('click').on('click',function(){
if( window.confirm('請確認是否刪除?'))
$(this).parent().parent().remove();
});
});
</script>