socialforge/app/views/contests/_join_contest_box.html.erb

77 lines
3.4 KiB
Plaintext

<div id="sy_popup_box" style="width:460px;">
<div class="sy_popup_top">
<h3 class="fl">欢迎加入竞赛</h3>
<a href="javascript:void(0);" class="sy_icons_close fr" onclick="hideModal()"></a>
<div class="cl"></div>
</div>
<div class="sy_popup_con">
<%= form_tag({:controller => 'contests', :action => 'join_contest_multi_role'}, :remote => true, :method => :post, :id => 'new-watcher-form') do %>
<ul class="sy_popup_add ">
<li>
<label>竞赛邀请码:</label>
<input class=" sy_input_txt fl" name="invite_code" placeholder="请输入四位竞赛邀请码">
<div class="cl"></div>
</li>
<li>
<label>身份:</label>
<input type="checkbox" name="role[]" value="13" id="join_course_role_13" class="ml5 mr5"/><span class="mr10">管理员</span>
<input type="checkbox" name="role[]" value="14" id="join_course_role_14" class="ml5 mr5"/><span class="mr10">评委</span>
<input type="checkbox" name="role[]" value="15" id="join_course_role_15" class="ml5 mr5"/><span class="mr10">参赛者</span>
<div class="cl"></div>
</li>
<p id="none_checked_notice" class="c_red none f12" style="margin-left: 42px;">请至少选择一个身份</p>
<li class="mt10">
<label>&nbsp;</label>
<a href="javascript:void(0);" class="sy_btn_blue fl" onclick="submit_join_course();">确&nbsp;&nbsp;定</a>
<a href="javascript:void(0);" class="sy_btn_grey fl ml20" onclick="hideModal()">取&nbsp;&nbsp;消</a>
<div class="cl"></div>
</li>
</ul>
<% end %>
</div>
</div>
<script>
function submit_join_course(){
if ($("input[name='role[]']:checked").length >= 1){
$("#none_checked_notice").hide();
$('#new-watcher-form').submit();
hideModal();
}else{
$("#none_checked_notice").show();
}
}
function disable_contestant_choose(){
if($("#join_course_role_13").is(":checked") || $("#join_course_role_14").is(":checked")) {
$("#join_course_role_15").attr('disabled', 'disabled');
} else {
$("#join_course_role_15").removeAttr('disabled');
}
}
$(function() {
$("#join_course_role_13").on('click', function(){
if($("#join_course_role_13").is(":checked") || $("#join_course_role_14").is(":checked")) {
$("#join_course_role_15").attr('disabled', 'disabled');
} else {
$("#join_course_role_15").removeAttr('disabled');
}
});
$("#join_course_role_14").on('click', function(){
if($("#join_course_role_13").is(":checked") || $("#join_course_role_14").is(":checked")) {
$("#join_course_role_15").attr('disabled', 'disabled');
} else {
$("#join_course_role_15").removeAttr('disabled');
}
});
$("#join_course_role_15").on('click', function(){
if($("#join_course_role_15").is(":checked")) {
$("#join_course_role_13").attr('disabled', 'disabled');
$("#join_course_role_14").attr('disabled', 'disabled');
} else {
$("#join_course_role_13").removeAttr('disabled');
$("#join_course_role_14").removeAttr('disabled');
}
});
});
</script>