发布问卷时默认选中“允许学生查看调查结果”

This commit is contained in:
cxt 2016-02-20 10:50:46 +08:00
parent 8b5896ae1c
commit 096320d04c
3 changed files with 8 additions and 3 deletions

View File

@ -214,6 +214,7 @@ class PollController < ApplicationController
def publish_poll
@poll.polls_status = 2
@poll.published_at = Time.now
@poll.show_result = params[:show_result]
if @poll.save
if params[:is_remote]
redirect_to poll_index_url(:polls_type => "Course", :polls_group_id => @course.id)

View File

@ -315,7 +315,11 @@ function insert_MCQ(quest_type,quest_num,quest_id){
alert("问卷标题不能为空");
}
else{
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'poll_submit', locals: { :poll => @poll,:is_remote => false}) %>');
if($("#show_result").is(":checked")) {
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'poll_submit', locals: { :poll => @poll,:is_remote => false,:show_result=> 1}) %>');
} else{
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'poll_submit', locals: { :poll => @poll,:is_remote => false,:show_result=> 0}) %>');
}
showModal('ajax-modal', '310px');
$('#ajax-modal').css('height','120px');
$('#ajax-modal').siblings().remove();
@ -377,7 +381,7 @@ function insert_MCQ(quest_type,quest_num,quest_id){
<%= l(:label_memo_create)%>
</a>
<div class="polls_cha">
<input type="checkbox" name="" value="" >
<input id="show_result" type="checkbox" checked name="show_result" value="1" >
<label for="">允许学生查看调查结果</label>
</div>
</div>

View File

@ -1219,7 +1219,6 @@ ActiveRecord::Schema.define(:version => 20160202034530) do
create_table "org_members", :force => true do |t|
t.integer "user_id"
t.integer "organization_id"
t.string "role"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end
@ -1374,6 +1373,7 @@ ActiveRecord::Schema.define(:version => 20160202034530) do
t.integer "changeset_num", :default => 0
t.integer "board_message_num", :default => 0
t.integer "board_num", :default => 0
t.integer "act_num", :default => 0
t.integer "attach_num", :default => 0
t.datetime "commit_time"
end