socialforge/app/views/poll/_other_poll.html.erb

45 lines
1.9 KiB
Plaintext

<div id="muban_popup_box" style="width:500px;">
<div class="muban_popup_top">
<h3 class="fl">选择问卷导入本班级</h3>
<a href="javascript:void(0);" class="muban_icons_close fr"></a>
<div class="cl"></div>
</div>
<div class="muban_popup_con clear">
<%= form_tag import_other_poll_poll_index_path,
method: :post,
id: "relation_file_form" do %>
<input type="hidden" name="course_id" value="<%= polls_group_id%>" />
<div class="import_poll_div">
<% polls.each do |poll| %>
<li>
<input style="vertical-align:middle" type="checkbox" name="polls[]" id="poll_check_box_<%=poll.id %>" value="<%=poll.id %>"/>
<label style="vertical-align:middle" for="poll_check_box_<%=poll.id %>" class="break_word"><%=h poll.polls_name.blank? ? l(:label_poll_new) : poll.polls_name %> [<%=h Course.find(poll.polls_group_id).name %>]</label>
</li>
<% end %>
</div>
<p class="none c_red" style="margin-left: 33px;" id="error_show"></p>
<div class="cl"></div>
<a href="javascript:void(0);" class="fr sy_btn_blue mr35" id="submit_quote" onclick="submit_quote();">导&nbsp;&nbsp;入</a>
<a href="javascript:void(0);" class="fr sy_btn_grey mr5" onclick="hideModal();">取&nbsp;&nbsp;消</a>
<% end -%>
</div>
</div>
<script>
function submit_quote() {
$('#error_show').html('');
var selected = false;
for(var i = 0; i < $("input[name='polls[]']").length;i++){
if($("input[name='polls[]']")[i].checked){
selected = true;
}
}
if (selected){
$('#submit_quote').parent().submit();
closeModal();
}else{
$('#error_show').html('您没有选择任何问卷');
$('#error_show').show();
}
}
</script>