Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh
This commit is contained in:
commit
a1dfe13728
|
@ -177,11 +177,11 @@ class FilesController < ApplicationController
|
||||||
def index
|
def index
|
||||||
@flag = params[:flag] || false
|
@flag = params[:flag] || false
|
||||||
#sort_init 'filename', 'asc'
|
#sort_init 'filename', 'asc'
|
||||||
sort_init 'created_on', 'desc'
|
# sort_init 'created_on', 'desc'
|
||||||
sort_update 'created_on' => "#{Attachment.table_name}.created_on",
|
# sort_update 'created_on' => "#{Attachment.table_name}.created_on",
|
||||||
'filename' => "#{Attachment.table_name}.filename",
|
# 'filename' => "#{Attachment.table_name}.filename",
|
||||||
'size' => "#{Attachment.table_name}.filesize",
|
# 'size' => "#{Attachment.table_name}.filesize",
|
||||||
'downloads' => "#{Attachment.table_name}.downloads"
|
# 'downloads' => "#{Attachment.table_name}.downloads"
|
||||||
sort = ""
|
sort = ""
|
||||||
@sort = ""
|
@sort = ""
|
||||||
@order = ""
|
@order = ""
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
#encoding utf-8
|
||||||
class PollController < ApplicationController
|
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]
|
||||||
before_filter :find_container, :only => [:new,:create, :index]
|
before_filter :find_container, :only => [:new,:create, :index]
|
||||||
|
@ -412,8 +413,10 @@ class PollController < ApplicationController
|
||||||
|
|
||||||
# 将其他地方的问卷导出来
|
# 将其他地方的问卷导出来
|
||||||
def other_poll
|
def other_poll
|
||||||
# 查作者是我,且不在当前课程内的问卷 进行导入
|
# 查作者是我,或者作者是当前课程的老师,且不在当前课程内的问卷 进行导入
|
||||||
@polls = Poll.where("user_id = #{User.current.id} and polls_type = 'course' and polls_group_id != #{params[:polls_group_id]}")
|
tea_ids = '('
|
||||||
|
tea_ids << Course.find(params[:polls_group_id]).tea_id.to_s << ','<< User.current.id.to_s << ')'
|
||||||
|
@polls = Poll.where("user_id in #{tea_ids} and polls_type = 'course' and polls_group_id != #{params[:polls_group_id]}")
|
||||||
@polls_group_id = params[:polls_group_id]
|
@polls_group_id = params[:polls_group_id]
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.js
|
format.js
|
||||||
|
@ -427,7 +430,7 @@ class PollController < ApplicationController
|
||||||
params[:polls].each_with_index do |p,i|
|
params[:polls].each_with_index do |p,i|
|
||||||
poll = Poll.find(p)
|
poll = Poll.find(p)
|
||||||
option = {
|
option = {
|
||||||
:polls_name => poll.polls_name,
|
:polls_name => poll.polls_name || l(:label_poll_new),
|
||||||
:polls_type => 'Course',
|
:polls_type => 'Course',
|
||||||
:polls_group_id => course_id,
|
:polls_group_id => course_id,
|
||||||
:polls_status => 1,
|
:polls_status => 1,
|
||||||
|
|
|
@ -78,7 +78,7 @@ module PollHelper
|
||||||
def poll_check_box_tags(name,polls,current_poll)
|
def poll_check_box_tags(name,polls,current_poll)
|
||||||
s = ''
|
s = ''
|
||||||
polls.each do |poll|
|
polls.each do |poll|
|
||||||
s << "<label>#{ check_box_tag name, poll.id, false, :id => nil } #{h poll.polls_name} [#{ h Course.find(poll.polls_group_id).name}]</label><br/>"
|
s << "<label>#{ check_box_tag name, poll.id, false, :id => nil } #{h poll.polls_name.blank? ? l(:label_poll_new) : poll.polls_name } [#{ h Course.find(poll.polls_group_id).name}]</label><br/>"
|
||||||
end
|
end
|
||||||
s.html_safe
|
s.html_safe
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<div id="popbox_upload" style="margin-top: -30px;margin-left: -20px;margin-right: -10px;">
|
<div id="popbox_upload" style="margin-top: -30px;margin-left: -20px;margin-right: -10px;">
|
||||||
<div class="upload_con">
|
<div class="upload_con">
|
||||||
<h2>将以下问卷导入本课程</h2>
|
<h2>选择问卷导入本课程</h2>
|
||||||
<div class="upload_box">
|
<div class="upload_box">
|
||||||
<div id="error_show" style="color: red;"></div>
|
<div id="error_show" style="color: red;"></div>
|
||||||
<%= form_tag import_other_poll_poll_index_path,
|
<%= form_tag import_other_poll_poll_index_path,
|
||||||
|
@ -8,7 +8,7 @@
|
||||||
remote: true,
|
remote: true,
|
||||||
id: "relation_file_form" do %>
|
id: "relation_file_form" do %>
|
||||||
<input type="hidden" name="course_id" value="<%= polls_group_id%>" />
|
<input type="hidden" name="course_id" value="<%= polls_group_id%>" />
|
||||||
<%= content_tag('div', poll_check_box_tags('polls[]', polls,polls_group_id), :id => 'courses')%>
|
<%= content_tag('div', poll_check_box_tags('polls[]', polls,polls_group_id), :id => 'courses',:style=> 'width: 300px;')%>
|
||||||
<a id="submit_quote" href="javascript:void(0)" class="blue_btn fl c_white" style="margin-left: 0px !important;" onclick="submit_quote();">导 入</a>
|
<a id="submit_quote" href="javascript:void(0)" class="blue_btn fl c_white" style="margin-left: 0px !important;" onclick="submit_quote();">导 入</a>
|
||||||
<a href="javascript:void(0)" class="blue_btn grey_btn fl c_white " onclick="closeModal();">取 消</a>
|
<a href="javascript:void(0)" class="blue_btn grey_btn fl c_white " onclick="closeModal();">取 消</a>
|
||||||
<% end -%>
|
<% end -%>
|
||||||
|
@ -19,9 +19,19 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
function submit_quote()
|
function submit_quote() {
|
||||||
{
|
$('#error_show').html('');
|
||||||
$('#submit_quote').parent().submit();
|
var selected = false;
|
||||||
closeModal();
|
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('您没有选择任何问卷');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
|
@ -1,9 +1,13 @@
|
||||||
|
|
||||||
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'other_poll',:locals => {:polls => @polls,:polls_group_id=>@polls_group_id}) %>');
|
<% if @polls.empty? %>
|
||||||
|
alert('您目前还没有自己新建的问卷');
|
||||||
|
<% else %>
|
||||||
|
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'other_poll',:locals => {:polls => @polls,:polls_group_id=>@polls_group_id}) %>');
|
||||||
|
|
||||||
|
|
||||||
showModal('ajax-modal', '513px');
|
showModal('ajax-modal', '513px');
|
||||||
$('#ajax-modal').siblings().remove();
|
$('#ajax-modal').siblings().remove();
|
||||||
$('#ajax-modal').before("<a href='javascript:void(0)' onclick='closeModal()' style='margin-left: 480px;'><img src='/images/bid/close.png' width='26px' height='26px' /></a>");
|
$('#ajax-modal').before("<a href='javascript:void(0)' onclick='closeModal()' style='margin-left: 480px;'><img src='/images/bid/close.png' width='26px' height='26px' /></a>");
|
||||||
$('#ajax-modal').parent().css("top","").css("left","");
|
$('#ajax-modal').parent().css("top","").css("left","");
|
||||||
$('#ajax-modal').parent().addClass("popbox_polls");
|
$('#ajax-modal').parent().addClass("popbox_polls");
|
||||||
|
<% end %>
|
Loading…
Reference in New Issue