Merge branch 'develop' of https://git.trustie.net/jacknudt/trustieforge into develop

This commit is contained in:
Tim 2016-10-15 15:48:02 +08:00
commit 6ae066937d
7 changed files with 49 additions and 6 deletions

View File

@ -1,10 +1,10 @@
#encoding utf-8
class PollController < ApplicationController
before_filter :find_poll_and_course, :only => [:edit,:update,:destroy,:show,:statistics_result,:create_poll_question,:commit_poll,:commit_answer,:publish_poll,:republish_poll,:poll_result,:close_poll,:export_poll]
before_filter :find_poll_and_course, :only => [:edit,:update,:destroy,:show,:statistics_result,:create_poll_question,:commit_poll,:commit_answer,:publish_poll,:republish_poll,:poll_result,:close_poll,:export_poll,:save_poll]
before_filter :find_container, :only => [:new,:create, :index]
before_filter :is_logged, :only => [:index, :show, :poll_result,:new,:create,:edit,:update,:destroy,:publish_poll,:republish_poll,:close_poll,:export_poll,:commit_answer,:commit_poll,:statistics_result]
before_filter :is_logged, :only => [:index, :show, :poll_result,:new,:create,:edit,:update,:destroy,:publish_poll,:republish_poll,:close_poll,:export_poll,:commit_answer,:commit_poll,:statistics_result,:save_poll]
before_filter :is_member_of_course, :only => [:index,:show,:poll_result]
before_filter :is_course_teacher, :only => [:new,:create,:edit,:update,:destroy,:publish_poll,:republish_poll,:close_poll,:export_poll]
before_filter :is_course_teacher, :only => [:new,:create,:edit,:update,:destroy,:publish_poll,:republish_poll,:close_poll,:export_poll,:save_poll]
include PollHelper
def index
if @course
@ -245,7 +245,7 @@ class PollController < ApplicationController
def publish_poll
@poll.polls_status = 2
@poll.published_at = Time.now
@poll.show_result = params[:show_result]
@poll.show_result = params[:show_result].to_i if params[:show_result]
if @poll.save
if params[:is_remote]
redirect_to poll_index_url(:polls_type => "Course", :polls_group_id => @course.id)
@ -257,6 +257,16 @@ class PollController < ApplicationController
end
end
#保存问卷
def save_poll
@poll.show_result = params[:show_result].to_i
if @poll.save
respond_to do |format|
format.js
end
end
end
#提交答案
def commit_answer
pq = PollQuestion.find(params[:poll_question_id])

View File

@ -497,7 +497,15 @@ function insert_MCQ(quest_type,quest_num,quest_id){
}else if(forms.length > 0){
alert("请先保存正在编辑的题目。");
} else {
window.location.href = "<%=edit_poll_path(@poll) %>";
if($("#show_result").is(":checked")) {
$.get(
'<%= save_poll_poll_path(@poll.id) %>'+'?show_result=1'
)
} else{
$.get(
'<%= save_poll_poll_path(@poll.id) %>'+'?show_result=0'
)
}
}
}
function poll_submit()

View File

@ -0,0 +1,21 @@
<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>
<ul class="sy_popup_add mt10 mb10">
<li>
<p style="text-align: center">
问卷保存成功
</p>
</li>
<li>
<label style="margin-right: 117px;">&nbsp;</label>
<%= link_to('确 定', edit_poll_path(@poll), :class => "sy_btn_blue fl") %>
<div class="cl"></div>
</li>
</ul>
</div>

View File

@ -0,0 +1,2 @@
var htmlvalue = "<%= escape_javascript(render :partial => 'poll_save', locals: { :poll => @poll,:is_remote => false,:show_result=> 1}) %>";
pop_box_new(htmlvalue,460,190);

View File

@ -263,6 +263,7 @@ RedmineApp::Application.routes.draw do
post 'create_poll_question'
post 'commit_poll'
get 'publish_poll'
get 'save_poll'
get 'republish_poll'
get 'poll_result'
get 'close_poll'

View File

@ -3,6 +3,7 @@ require 'trustie/gitlab/sync'
namespace :gitlab do
namespace :sync do
desc "sync users to gitlab"
Rails.logger.info("--------------------------------sync users to gitlab")
task :users => :environment do
# User.where(username: 'root').find_each do |user|
s = Trustie::Gitlab::Sync.new

View File

@ -265,7 +265,7 @@ h4{ font-size:14px;}/*color:#3b3b3b;*/
.w557{ width:557px;}
.w570 {width:570px !important;}
.w576{ width:576px;}
.w590{ width:590px; !important;}
.w590{ width:590px !important;}
.w607 {width:607px;}
.w664{ width:664px;}
.w683{ width:683px;}