Merge branch 'cxt_course' into develop

Conflicts:
	public/stylesheets/css/public.css
This commit is contained in:
cxt 2016-10-13 14:17:54 +08:00
commit 5fb7da4681
51 changed files with 1461 additions and 917 deletions

View File

@ -40,7 +40,14 @@ class BlogCommentsController < ApplicationController
end
def show
@article = BlogComment.find(params[:id])
all_comments = []
@replies = get_all_children(all_comments, @article)
@reply_count = @replies.count
@page = params[:page] ? params[:page].to_i + 1 : 0
@limit = 10
@replies = @replies[@page * @limit..@page * @limit + 9]
respond_to do |format|
format.js
format.html {render :layout=>'new_base_user'}
end
end

View File

@ -40,7 +40,14 @@ class OrgDocumentCommentsController < ApplicationController
@document = OrgDocumentComment.find(params[:id])
@org_subfield = OrgSubfield.where(:id => @document.org_subfield_id).first
@subfield_content = @organization.org_subfields.order("priority")
all_comments = []
@replies = get_all_children(all_comments, @document)
@reply_count = @replies.count
@page = params[:page] ? params[:page].to_i + 1 : 0
@limit = 10
@replies = @replies[@page * @limit..@page * @limit + 9]
respond_to do |format|
format.js
format.html {render :layout => (@organization.switch_type && @document && !@document.org_subfield_id.blank?) ? 'base_org_custom' : 'base_org'}
end
end

View File

@ -10,6 +10,7 @@ class PollController < ApplicationController
if @course
@is_teacher = User.current.allowed_to?(:as_teacher,@course)
if @is_teacher
remove_invalid_poll(@course)
polls = Poll.where("polls_type = 'Course' and polls_group_id = #{@course.id}")
else
polls = Poll.where("polls_type = 'Course' and polls_group_id = #{@course.id} and polls_status = 2")
@ -105,8 +106,12 @@ class PollController < ApplicationController
polls = Poll.where("polls_type = 'Course' and polls_group_id = #{@course.id} and polls_status = 2")
end
@polls = paginateHelper polls,20 #分页
respond_to do |format|
format.js
if params[:is_redirect]
redirect_to poll_index_url(:polls_type => "Course", :polls_group_id => @course.id)
else
respond_to do |format|
format.js
end
end
end
end
@ -150,6 +155,13 @@ class PollController < ApplicationController
@poll_questions.poll_answers.new question_option
end
end
if params[:question_other_answer]
question_option = {
:answer_position => params[:question_answer].count + 1,
:answer_text => ''
}
@poll_questions.poll_answers.new question_option
end
# 如果是插入的话那么从插入的这个id以后的question_num都将要+1
if params[:quest_id]
@is_insert = true
@ -191,6 +203,21 @@ class PollController < ApplicationController
@poll_question.poll_answers.new question_option
end
end
if params[:question_other_answer]
question = @poll_question.poll_answers.where("answer_text = ''").first
unless question
question_option = {
:answer_position => params[:question_answer].count + 1,
:answer_text => ''
}
@poll_question.poll_answers.new question_option
end
else
question = @poll_question.poll_answers.where("answer_text = ''").first
if question
question.destroy
end
end
end
@poll_question.save
respond_to do |format|
@ -248,6 +275,7 @@ class PollController < ApplicationController
end
#修改该题对应答案
pv.poll_answer_id = params[:poll_answer_id]
pv.vote_text = params[:vote_text] if params[:vote_text]
if pv.save
#保存成功返回成功信息及当前以答题百分比
@percent = get_percent(@poll,User.current)
@ -265,9 +293,10 @@ class PollController < ApplicationController
pv.user_id = User.current.id
pv.poll_question_id = params[:poll_question_id]
pv.poll_answer_id = params[:poll_answer_id]
pv.vote_text = params[:vote_text] if params[:vote_text]
if pv.save
@percent = get_percent(@poll,User.current)
render :json => {:text => "true",:percent => format("%.2f" ,@percent)}
render :json => {:text => "ok",:percent => format("%.2f" ,@percent)}
else
render :json => {:text => "failure"}
end
@ -280,8 +309,8 @@ class PollController < ApplicationController
render :json => {:text => "failure"}
end
end
elsif pq.question_type == 3 || pq.question_type == 4
#单行文本,多行文本题
elsif pq.question_type == 3
#单行文本
pv = PollVote.find_by_poll_question_id_and_user_id(params[:poll_question_id],User.current.id)
if pv.nil?
#pv为空之前尚未答题添加答案
@ -323,6 +352,50 @@ class PollController < ApplicationController
end
end
end
elsif pq.question_type == 4
#多行文本题
pv = PollVote.find_by_poll_question_id_and_poll_answer_id_and_user_id(params[:poll_question_id],params[:poll_answer_id],User.current.id)
if pv.nil?
#pv为空之前尚未答题添加答案
if params[:vote_text].nil? || params[:vote_text].blank?
#用户提交空答案,视作不作答
@percent = get_percent(@poll,User.current)
render :json => {:text => pv.vote_text,:percent => format("%.2f" ,@percent)}
else
#添加答案
pv = PollVote.new
pv.user_id = User.current.id
pv.poll_question_id = params[:poll_question_id]
pv.poll_answer_id = params[:poll_answer_id]
pv.vote_text = params[:vote_text]
if pv.save
@percent = get_percent(@poll,User.current)
render :json => {:text => pv.vote_text,:percent => format("%.2f" ,@percent)}
else
render :json => {:text => "failure"}
end
end
else
#pv不为空说明用户之前已作答
if params[:vote_text].nil? || params[:vote_text].blank?
#用户提交空答案,视为删除答案
if pv.delete
@percent = get_percent(@poll,User.current)
render :json => {:text => pv.vote_text,:percent => format("%.2f" ,@percent)}
else
render :json => {:text => "failure"}
end
else
#用户修改答案
pv.vote_text = params[:vote_text]
if pv.save
@percent = get_percent(@poll,User.current)
render :json => {:text => pv.vote_text,:percent => format("%.2f" ,@percent)}
else
render :json => {:text => "failure"}
end
end
end
else
render :json => {:text => "failure"}
@ -494,6 +567,17 @@ class PollController < ApplicationController
end
private
def remove_invalid_poll(course)
polls = Poll.where("polls_type = 'Course' and polls_group_id = #{course.id} and polls_name = ''")
unless polls.empty?
polls.each do |poll|
if poll.poll_questions.empty?
poll.destroy
end
end
end
end
def find_poll_and_course
@poll = Poll.find params[:id]
@course = Course.find @poll.polls_group_id
@ -533,9 +617,18 @@ class PollController < ApplicationController
uncomplete_question = []
necessary_questions.each do |question|
answers = get_user_answer(question,user)
if answers.nil? || answers.count < 1
uncomplete_question << question
if question.question_type != 4
if answers.nil? || answers.count < 1
uncomplete_question << question
end
else
if answers.nil? || answers.count < question.poll_answers.count
uncomplete_question << question
end
end
# if answers.nil? || answers.count < 1
# uncomplete_question << question
# end
end
uncomplete_question
end
@ -551,19 +644,31 @@ class PollController < ApplicationController
complete_question = []
questions.each do |question|
answers = get_user_answer(question,user)
if !(answers.nil? || answers.count < 1)
complete_question << question
if question.question_type != 4
if !(answers.nil? || answers.count < 1)
complete_question << question
end
else
if !(answers.nil? || answers.count < 1)
answers.each do |ans|
complete_question << ans
end
end
end
end
complete_question
end
def get_percent poll,user
complete_count = get_complete_question(poll,user).count
if poll.poll_questions.count == 0
return 0
else
return (complete_count.to_f / poll.poll_questions.count.to_f)*100
complete_count = get_complete_question(poll,user).count
all_count = poll.poll_questions.where("question_type != 4").count
poll.poll_questions.where("question_type = 4").each do |pq|
all_count += pq.poll_answers.count
end
return (complete_count.to_f / all_count.to_f)*100
end
end

View File

@ -3358,9 +3358,12 @@ class UsersController < ApplicationController
@my_syllabuses = @user.syllabuses
sy_courses = @user.courses.visible.where("is_delete =? and tea_id != ?", 0, @user.id)
my_syllabus_ids = @my_syllabuses.empty? ? "(-1)" : "(" + @my_syllabuses.map{|syllabus| syllabus.id}.join(',') + ")"
sy_courses = @user.courses.visible.not_deleted
syllabus_ids = sy_courses.empty? ? '(-1)' : "(" + sy_courses.map{|course| !course.syllabus_id.nil? && course.syllabus_id}.join(",") + ")"
@join_syllabuses = Syllabus.where("id in #{syllabus_ids} and user_id != #{@user.id}")
syllabus_members = SyllabusMember.where("user_id = #{@user.id}")
syllabus_member_ids = syllabus_members.empty? ? "(-1)" : "(" + syllabus_members.map{|syl_mem| syl_mem.syllabus_id}.join(',') + ")"
@join_syllabuses = Syllabus.where("(id in #{syllabus_ids} or id in #{syllabus_member_ids}) and user_id != #{@user.id}")
@my_syllabuses = syllabus_course_list_sort @my_syllabuses
@join_syllabuses = syllabus_course_list_sort @join_syllabuses

View File

@ -629,7 +629,7 @@ module CoursesHelper
month = Time.now.month
now_year = year.nil? ? Time.now.year : (Time.now.year <= year ? Time.now.year : year)
year = month < 2 && now_year >=Time.now.year ? now_year - 1 : now_year
for i in (year..year + 10)
for i in (year-3..year + 10)
option = []
option << i
option << i

View File

@ -29,12 +29,16 @@ module PollHelper
end
#获取文本题答案
def get_anwser_vote_text(question_id,user_id)
pv = PollVote.find_by_poll_question_id_and_user_id(question_id,user_id)
if pv.nil?
def get_anwser_vote_text(question_id,user_id,answer_id=0)
if answer_id != 0
pv = PollVote.find_by_poll_question_id_and_poll_answer_id_and_user_id(question_id,answer_id,user_id)
else
pv = PollVote.find_by_poll_question_id_and_user_id(question_id,user_id)
end
if pv.blank?
''
else
pv.vote_text
pv.vote_text.nil? ? '' : pv.vote_text
end
end

View File

@ -0,0 +1,63 @@
<% @replies.each do |comment| %>
<script type="text/javascript">
$(function(){
showNormalImage('reply_content_<%= comment.id %>');
autoUrl('reply_content_<%= comment.id %>');
});
</script>
<li class="homepagePostReplyContainer" nhname="reply_rec">
<div class="homepagePostReplyPortrait">
<%= link_to image_tag(url_to_avatar(comment.creator_user), :width => 33, :height => 33, :alt => "用户头像"), user_url_in_org(comment.creator_user.id) %>
</div>
<div class="homepagePostReplyDes" onmouseover="$('#delete_reply_<%=comment.id%>').show();" onmouseout="$('#delete_reply_<%=comment.id%>').hide();">
<%= render :partial => 'users/message_contents', :locals => {:comment => comment}%>
<% if !comment.content_detail.blank? %>
<div class="homepagePostReplyContent break_word list_style upload_img table_maxWidth" id="reply_content_<%= comment.id %>">
<%= comment.content_detail.html_safe %>
</div>
<div class="orig_reply mb10 mt-10">
<div class="reply">
<span class="reply-right">
<span id="reply_praise_count_<%=comment.id %>">
<%=render :partial=> "praise_tread/praise", :locals => {:activity=>comment, :user_activity_id=>comment.id,:type=>"reply"}%>
</span>
<span style="position: relative" class="fr mr20">
<%= link_to(
l(:button_reply),
{:controller => 'blog_comments', :action => 'quote', :user_id => comment.author_id, :blog_id => comment.blog_id, :id => comment.id},
:remote => true,
:method => 'get',
:title => l(:button_reply)) if !@article.locked? %>
<span id="reply_iconup_<%=comment.id %>" class="reply_iconup02" style="display: none"> ︿</span>
</span>
<% if comment.author == User.current %>
<%= link_to(
l(:button_delete),
{:controller => 'blog_comments', :action => 'destroy', :id => comment.id},
:method => :delete,
:id => "delete_reply_#{comment.id}",
:class => 'fr mr20 undis',
:data => {:confirm => l(:text_are_you_sure)},
:title => l(:button_delete)
) %>
<% end %>
</span>
<div class="cl"></div>
</div>
</div>
<p id="reply_message_<%= comment.id%>"></p>
<% end %>
</div>
<div class="cl"></div>
</li>
<% end %>
<% if @reply_count > @page * @limit + 10 %>
<div id="more_blog_replies">
<div class="detail_cont_hide clearfix">
<span class="orig_icon" >&darr; </span>
<span class="orig_icon" style="display:none;" > &uarr;</span>
<%= link_to '点击展开更多回复', blog_comment_path(@article, :page => @page),:remote=>true %>
</div>
</div>
<% end %>

View File

@ -105,13 +105,13 @@
<div class="cl"></div>
</div>
<div class="cl"></div>
<% all_comments = []%>
<% all_replies = get_all_children(all_comments, @article) %>
<% count= all_replies.count %>
<%# all_comments = []%>
<%# all_replies = get_all_children(all_comments, @article) %>
<%# count= all_replies.count %>
<div class="homepagePostReply">
<div class="homepagePostReplyBanner">
<div class="homepagePostReplyBannerCount">回复
<sapn class="mr15"><%= count>0 ? "#{count}" : "" %></sapn>
<sapn class="mr15"><%= @reply_count > 0 ? "#{@reply_count}" : "" %></sapn>
<span style="color: #cecece;">▪</span>
<span id="praise_count_<%= @article.id %>">
<%= render :partial => "praise_tread/praise", :locals => {:activity => @article, :user_activity_id => @article.id, :type => "activity"} %>
@ -120,62 +120,10 @@
<div class="homepagePostReplyBannerTime"></div>
</div>
<% comments = all_replies %>
<% if count > 0 %>
<%# comments = all_replies %>
<% if @reply_count > 0 %>
<div class="" id="reply_div_<%= @article.id %>">
<% comments.each do |comment| %>
<script type="text/javascript">
$(function(){
showNormalImage('reply_content_<%= comment.id %>');
autoUrl('reply_content_<%= comment.id %>');
});
</script>
<li class="homepagePostReplyContainer" nhname="reply_rec">
<div class="homepagePostReplyPortrait">
<%= link_to image_tag(url_to_avatar(comment.creator_user), :width => 33, :height => 33, :alt => "用户头像"), user_url_in_org(comment.creator_user.id) %>
</div>
<div class="homepagePostReplyDes" onmouseover="$('#delete_reply_<%=comment.id%>').show();" onmouseout="$('#delete_reply_<%=comment.id%>').hide();">
<%= render :partial => 'users/message_contents', :locals => {:comment => comment}%>
<% if !comment.content_detail.blank? %>
<div class="homepagePostReplyContent break_word list_style upload_img table_maxWidth" id="reply_content_<%= comment.id %>">
<%= comment.content_detail.html_safe %>
</div>
<div class="orig_reply mb10 mt-10">
<div class="reply">
<span class="reply-right">
<span id="reply_praise_count_<%=comment.id %>">
<%=render :partial=> "praise_tread/praise", :locals => {:activity=>comment, :user_activity_id=>comment.id,:type=>"reply"}%>
</span>
<span style="position: relative" class="fr mr20">
<%= link_to(
l(:button_reply),
{:controller => 'blog_comments', :action => 'quote', :user_id => comment.author_id, :blog_id => comment.blog_id, :id => comment.id},
:remote => true,
:method => 'get',
:title => l(:button_reply)) if !@article.locked? %>
<span id="reply_iconup_<%=comment.id %>" class="reply_iconup02" style="display: none"> ︿</span>
</span>
<% if comment.author == User.current %>
<%= link_to(
l(:button_delete),
{:controller => 'blog_comments', :action => 'destroy', :id => comment.id},
:method => :delete,
:id => "delete_reply_#{comment.id}",
:class => 'fr mr20 undis',
:data => {:confirm => l(:text_are_you_sure)},
:title => l(:button_delete)
) %>
<% end %>
</span>
<div class="cl"></div>
</div>
</div>
<p id="reply_message_<%= comment.id%>"></p>
<% end %>
</div>
<div class="cl"></div>
</li><% end %>
<%= render :partial => 'blog_comment_show_replies' %>
</div>
<% end %>

View File

@ -0,0 +1 @@
$("#more_blog_replies").replaceWith("<%= escape_javascript(render :partial => 'blog_comment_show_replies')%>");

View File

@ -36,12 +36,13 @@
<% end %>
<div class="cl"></div>
</li>
<% count=0 %>
<% if activity.parent %>
<% count=activity.parent.children.count%>
<% else %>
<% count=activity.children.count%>
<% end %>
<% all_comments = [] %>
<% count = (get_all_children all_comments, activity).count %>
<%# if activity.parent %>
<%# count=activity.parent.children.count%>
<%# else %>
<%# count=activity.children.count%>
<%# end %>
<li class="ml15">
<span class="grayTxt">发布:<%= format_time(activity.created_on) %></span>
<span class="grayTxt">更新:<%= format_time(activity.updated_on) %></span>

View File

@ -39,7 +39,7 @@
<div class="homepageRight mt0">
<div class="homepageRightBanner">
<div class="f16 fl fontGrey3">
<%= @user.name%>的博客
<%= @user.show_name%>的博客
</div>
</div>

View File

@ -32,14 +32,14 @@
<div class="cl"></div>
<li class="ml45 mb10">
<label><span class="c_red">*</span>&nbsp;<%= l(:label_course_term)%>&nbsp;&nbsp;</label>
<%= select_tag :time,options_for_select(course_time_option(@course.time),@course.time), {:id=>"new_time"} %>
<%= select_tag :time,options_for_select(course_time_option(@course.time),Time.now.year), {:id=>"new_time"} %>
<%= select_tag :term,options_for_select(course_term_option,@course.term || cur_course_term),{:id=>"new_term"} %>
<span class="c_red" id="new_course_time_term_notice"></span>
</li>
<div class="cl"></div>
<li class="ml45 mb10">
<label><span class="c_red">*</span>&nbsp;结束学期&nbsp;&nbsp;</label>
<%= select_tag :end_time,options_for_select(course_time_option(@course.end_time),@course.end_time), {:id=>"new_end_time"} %>
<%= select_tag :end_time,options_for_select(course_time_option(@course.end_time),Time.now.year), {:id=>"new_end_time"} %>
<%= select_tag :end_term,options_for_select(course_term_option,@course.end_term || cur_course_term),{:id=>"new_end_term"} %>
<span class="mr15 c_red">仅针对跨越多个学期的班级,否则与开始学期保持一致。</span>
</li>

View File

@ -1,8 +1,10 @@
<%= render :partial => 'users/user_homework_list', :locals => {:homework_commons => homework_commons,:page => 0,:course_id => course_id} %>
<div style=" text-align:center;">
<ul class="wlist" style=" border:none; display:inline-block; float:none; margin-top:10px;">
<%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true%>
</ul>
<div class="cl"></div>
<div style="text-align:center;">
<div class="pages" style="width:auto; display:inline-block;">
<ul id="homework_pository_ref_pages">
<%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true, :is_new => true%>
</ul>
<div class="cl"></div>
</div>
</div>

View File

@ -79,8 +79,10 @@
<% is_TA = get_user_member_roles_course @course, User.current, 7 %>
<% is_TE = get_user_member_roles_course @course, User.current, 9 %>
<% is_ST = get_user_member_roles_course @course, User.current, 10 %>
<% if !is_teacher && (is_TA || is_TE) %>
<% if !is_teacher && is_TE %>
<%= link_to '教师身份', switch_role_course_path(@course, :user_id => User.current.id, :curr_role => 10, :tar_role => (is_TA ? 7 : 9)), :class => "sy_btn_orange mr10 fl", :title => "由学生身份切换至教师身份" %>
<% elsif !is_teacher && is_TA %>
<%= link_to '助教身份', switch_role_course_path(@course, :user_id => User.current.id, :curr_role => 10, :tar_role => (is_TA ? 7 : 9)), :class => "sy_btn_orange mr10 fl", :title => "由学生身份切换至教师身份" %>
<% elsif is_teacher && is_ST %>
<%= link_to '学生身份', switch_role_course_path(@course, :user_id => User.current.id, :curr_role => (is_TA ? 7 : 9), :tar_role => 10), :class => "sy_btn_orange mr10 fl", :title => "由教师身份切换至学生身份" %>
<% end %>

View File

@ -0,0 +1,64 @@
<div class="" id="reply_div_<%= @document.id %>">
<% @replies.each do |comment| %>
<script type="text/javascript">
$(function(){
showNormalImage('reply_content_<%= comment.id %>');
autoUrl('reply_content_<%= comment.id %>');
});
</script>
<li class="homepagePostReplyContainer" nhname="reply_rec">
<div class="homepagePostReplyPortrait">
<%= link_to image_tag(url_to_avatar(comment.creator_user), :width => 33, :height => 33, :alt => "用户头像"), user_url_in_org(comment.creator_user.id) %>
</div>
<div class="homepagePostReplyDes" onmouseover="$('#delete_reply_<%=comment.id%>').show();" onmouseout="$('#delete_reply_<%=comment.id%>').hide();">
<%= render :partial => 'users/message_contents', :locals => {:comment => comment}%>
<% if !comment.content_detail.blank? %>
<div class="homepagePostReplyContent break_word list_style upload_img table_maxWidth" id="reply_content_<%= comment.id %>">
<%= comment.content_detail.html_safe %>
</div>
<div class="orig_reply mb10 mt-10">
<div class="reply">
<span class="reply-right">
<span id="reply_praise_count_<%=comment.id %>">
<%=render :partial=> "praise_tread/praise", :locals => {:activity=>comment, :user_activity_id=>comment.id,:type=>"reply"}%>
</span>
<span style="position: relative" class="fr mr20">
<%= link_to(
l(:button_reply),
{:controller => 'org_document_comments',:action => 'quote',:user_id=>comment.creator_id, :id => comment.id},
:remote => true,
:method => 'get',
:title => l(:button_reply)) %>
<span id="reply_iconup_<%=comment.id %>" class="reply_iconup02" style="display: none"> ︿</span>
</span>
<% if comment.creator_user == User.current %>
<%= link_to(
l(:button_delete),
{:controller => 'org_document_comments',:action => 'delete_reply', :id => comment.id},
:method => :delete,
:id => "delete_reply_#{comment.id}",
:class => 'fr mr20 undis',
:data => {:confirm => l(:text_are_you_sure)},
:title => l(:button_delete)) %>
<% end %>
</span>
<div class="cl"></div>
</div>
</div>
<p id="reply_message_<%= comment.id%>"></p>
<% end %>
</div>
<div class="cl"></div>
</li>
<% end %>
</div>
<% if @reply_count > @page * @limit + 10 %>
<div id="more_document_replies">
<div class="detail_cont_hide clearfix">
<span class="orig_icon" >&darr; </span>
<span class="orig_icon" style="display:none;" > &uarr;</span>
<%= link_to '点击展开更多回复', org_document_comment_path(@document, :organization_id =>@organization.id, :page => @page),:remote=>true %>
</div>
</div>
<% end %>

View File

@ -74,77 +74,24 @@
<% end %>
</div>
</div>
<% all_comments = []%>
<% all_replies = get_all_children(all_comments, @document) %>
<% count = all_replies.count %>
<%# all_comments = []%>
<%# all_replies = get_all_children(all_comments, @document) %>
<%# count = all_replies.count %>
<div class="homepagePostReply fl" style="background-color: #f1f1f1;" id="<%= @document.id %>">
<%# if count > 0 %>
<div class="homepagePostReplyBanner">
<div class="homepagePostReplyBannerCount">回复
<sapn class="mr15"><%= count>0 ? "#{count}" : "" %></sapn><span style="color: #cecece;">▪</span>
<sapn class="mr15"><%= @reply_count>0 ? "#{@reply_count}" : "" %></sapn><span style="color: #cecece;">▪</span>
<span id="praise_count_<%=@document.id %>">
<%=render :partial=> "praise_tread/praise", :locals => {:activity=>@document, :user_activity_id=>@document.id,:type=>"activity"}%>
</span>
</div>
</div>
<% comments = all_replies %>
<div class="" id="reply_div_<%= @document.id %>">
<% comments.each do |comment| %>
<script type="text/javascript">
$(function(){
showNormalImage('reply_content_<%= comment.id %>');
autoUrl('reply_content_<%= comment.id %>');
});
</script>
<li class="homepagePostReplyContainer" nhname="reply_rec">
<div class="homepagePostReplyPortrait">
<%= link_to image_tag(url_to_avatar(comment.creator_user), :width => 33, :height => 33, :alt => "用户头像"), user_url_in_org(comment.creator_user.id) %>
</div>
<div class="homepagePostReplyDes" onmouseover="$('#delete_reply_<%=comment.id%>').show();" onmouseout="$('#delete_reply_<%=comment.id%>').hide();">
<%= render :partial => 'users/message_contents', :locals => {:comment => comment}%>
<% if !comment.content_detail.blank? %>
<div class="homepagePostReplyContent break_word list_style upload_img table_maxWidth" id="reply_content_<%= comment.id %>">
<%= comment.content_detail.html_safe %>
</div>
<div class="orig_reply mb10 mt-10">
<div class="reply">
<span class="reply-right">
<span id="reply_praise_count_<%=comment.id %>">
<%=render :partial=> "praise_tread/praise", :locals => {:activity=>comment, :user_activity_id=>comment.id,:type=>"reply"}%>
</span>
<span style="position: relative" class="fr mr20">
<%= link_to(
l(:button_reply),
{:controller => 'org_document_comments',:action => 'quote',:user_id=>comment.creator_id, :id => comment.id},
:remote => true,
:method => 'get',
:title => l(:button_reply)) %>
<span id="reply_iconup_<%=comment.id %>" class="reply_iconup02" style="display: none"> ︿</span>
</span>
<% if comment.creator_user == User.current %>
<%= link_to(
l(:button_delete),
{:controller => 'org_document_comments',:action => 'delete_reply', :id => comment.id},
:method => :delete,
:id => "delete_reply_#{comment.id}",
:class => 'fr mr20 undis',
:data => {:confirm => l(:text_are_you_sure)},
:title => l(:button_delete)) %>
<% end %>
</span>
<div class="cl"></div>
</div>
</div>
<p id="reply_message_<%= comment.id%>"></p>
<% end %>
</div>
<div class="cl"></div>
</li>
<% end %>
<%# comments = all_replies %>
<div class="" id="reply_div_<%= @document.id %>">
<%= render :partial => "document_show_replies" %>
</div>
<div class="cl"></div>
<%# end %>

View File

@ -0,0 +1 @@
$("#more_document_replies").replaceWith("<%= escape_javascript(render :partial => 'org_document_comments/document_show_replies')%>");

View File

@ -0,0 +1,18 @@
<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 class="mr70">&nbsp;</label>
<%= link_to('确 定', poll_path(poll.id, :is_redirect => 1),:method => 'delete', :class => "sy_btn_blue fl") %>
<a href="javascript:void(0);" class="sy_btn_grey fl ml20" onclick="hideModal()">取&nbsp;&nbsp;消</a>
<div class="cl"></div>
</li>
</ul>
</div>

View File

@ -8,7 +8,7 @@
</tr>
<% poll_question.poll_answers.each do |poll_answer| %>
<tr>
<td class="td327"><%= poll_answer.answer_text %> </td>
<td class="td327"><%= poll_answer.answer_text == "" ? "其他" :poll_answer.answer_text %> </td>
<td class="td42"><%= poll_answer.poll_votes.count %> </td>
<td class="td287">
<div class="Bar">

View File

@ -5,46 +5,68 @@
{
$("#poll_questions_title_<%=poll_question.id%>").val("<%= poll_question.question_title%>")
$("#is_necessary_<%=poll_question.id%>").replaceWith("<input type='checkbox' name='is_necessary' id='is_necessary_<%=poll_question.id%>' value='true' <%= poll_question.is_necessary == 1 ? 'checked' : ''%>/>");
$("#poll_answers_<%=poll_question.id%>").html("<% poll_question.poll_answers.reorder('answer_position').each do |poll_answer| %>" +
"<li class='ur_item'>" +
$("#poll_answers_<%=poll_question.id%>").html("<% poll_question.poll_answers.reorder('answer_position').each do |poll_answer| %> " +
"<% if poll_answer.answer_text != '' %>" +
"<li class='ur_item new_answer'>" +
"<label>选项<span class='ur_index'></span>&nbsp;&nbsp;&nbsp;</label>" +
"<input type='text' maxlength='200' name='question_answer[<%= poll_answer.id %>]' placeholder='新建选项' value='<%= poll_answer.answer_text%>'/>" +
"<a class='icon_add' title='向下插入选项' onclick='add_single_answer($(this));'></a>" +
"<input type='text' maxlength='200' name='question_answer[<%= poll_answer.id %>]' placeholder='输入选项内容' value='<%= poll_answer.answer_text%>'/>" +
"<a class='icon_remove' title='删除' onclick='remove_single_answer($(this))'></a>" +
"</li>" +
"<div class='cl'></div>" +
"<% else %>"+
"<li class='ur_item new_answer other_answer'>" +
"<label>其它<span class='ur_index'></span>&nbsp;&nbsp;&nbsp;</label>" +
"<input placeholder='由参加问卷的人输入内容' name='question_other_answer' readonly='readonly' class='disabled' type='text'/>" +
"<a class='icon_remove' title='删除' onclick='remove_single_answer($(this))'></a>" +
"</li>" +
"<div class='cl'></div>" +
"<% end %>"+
"<% end%>");
}
</script>
<div class="ur_editor radio">
<div class="questionEditContainer">
<div class="ur_editor_title">
<label>问题:&nbsp;&nbsp;</label>
<input type="hidden" name="question_type" value="<%= poll_question.question_type%>"/>
<input maxlength="250" class="ur_question_title" type="text" name="poll_questions_title" id="poll_questions_title_<%=poll_question.id%>" placeholder="请输入单选题题" value="<%= poll_question.question_title%>"/>
<input maxlength="250" class="questionTitle w570" type="text" name="poll_questions_title" id="poll_questions_title_<%=poll_question.id%>" placeholder="请输入单选题题" value="<%= poll_question.question_title%>"/>
<input type="checkbox" name="is_necessary" id="is_necessary_<%=poll_question.id%>" value="true" <%= poll_question.is_necessary == 1 ? "checked" : ""%>/>
<label>必答</label>
</div>
<div class="ur_editor_content">
<ul id="poll_answers_<%=poll_question.id%>">
<% poll_question.poll_answers.reorder("answer_position").each do |poll_answer| %>
<li class='ur_item'>
<label>选项<span class='ur_index'></span>&nbsp;&nbsp;&nbsp;</label>
<input type='text' maxlength="200" name='question_answer[<%= poll_answer.id %>]' placeholder='新建选项' value="<%= poll_answer.answer_text%>"/>
<a class='icon_add' title='向下插入选项' onclick='add_single_answer($(this));'></a>
<a class='icon_remove' title='删除' onclick='remove_single_answer($(this))'></a>
</li>
<div class='cl'></div>
<% if poll_answer.answer_text != '' %>
<li class='ur_item new_answer'>
<label>选项<span class='ur_index'></span>&nbsp;&nbsp;&nbsp;</label>
<input type='text' maxlength="200" name='question_answer[<%= poll_answer.id %>]' placeholder='输入选项内容' value="<%= poll_answer.answer_text%>"/>
<a class='icon_remove' title='删除' onclick='remove_single_answer($(this))'></a>
</li>
<div class='cl'></div>
<% else %>
<li class="ur_item new_answer other_answer">
<label>其它<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>
<input placeholder='由参加问卷的人输入内容' name='question_other_answer' readonly='readonly' class='disabled' type='text'>
<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>
</li>
<div class="cl"></div>
<% end %>
<% end%>
</ul>
<ul>
<li class="ur_item">
<div class="dash-block new-question" onclick='add_single_answer($(this));'>新建选项</div>
</li>
<div class='cl'></div>
<li class="ur_item">
<a href="javascript:void(0);" class="ml50 fontGrey2" onclick='add_other_answer($(this))'>添加[其他]选项</a>
</li>
<div class="cl"></div>
</ul>
</div>
<div class="ur_editor_footer">
<a class="btn btn_dark btn_submit c_white" data-button="ok" onclick="edit_poll_question($(this),<%= poll_question.id %>);">
<%= l(:label_button_ok)%>
</a>
<a class="btn btn_light btn_cancel" data-button="cancel" onclick="resetQuestion<%=poll_question.id%>();pollQuestionCancel(<%= poll_question.id%>);">
<%= l(:button_cancel)%>
</a>
<a data-button="cancel" onclick="resetQuestion<%=poll_question.id%>();pollQuestionCancel(<%= poll_question.id%>);" class="grey_btn fr borderRadius" ><%= l(:button_cancel)%></a>
<a data-button="ok" onclick="edit_poll_question($(this),<%= poll_question.id %>);" class="blue_btn fr borderRadius mr5" ><%= l(:label_button_ok)%></a>
</div>
<div class="cl"></div>
</div>

View File

@ -5,44 +5,66 @@
$("#poll_questions_title_<%=poll_question.id%>").val("<%= poll_question.question_title%>")
$("#is_necessary_<%=poll_question.id%>").replaceWith("<input type='checkbox' name='is_necessary' id='is_necessary_<%=poll_question.id%>' value='true' <%= poll_question.is_necessary == 1 ? 'checked' : ''%>/>");
$("#poll_answers_<%=poll_question.id%>").html("<% poll_question.poll_answers.reorder('answer_position').each do |poll_answer| %>" +
"<li class='ur_item'>" +
"<% if poll_answer.answer_text != '' %>" +
"<li class='ur_item new_answer'>" +
"<label>选项<span class='ur_index'></span>&nbsp;&nbsp;&nbsp;</label>" +
"<input type='text' maxlength='200' name='question_answer[<%= poll_answer.id %>]' placeholder='新建选项' value='<%= poll_answer.answer_text%>'/>" +
"<a class='icon_add' title='向下插入选项' onclick='add_single_answer($(this));'></a>" +
"<input type='text' maxlength='200' name='question_answer[<%= poll_answer.id %>]' placeholder='输入选项内容' value='<%= poll_answer.answer_text%>'/>" +
"<a class='icon_remove' title='删除' onclick='remove_single_answer($(this))'></a>" +
"</li>" +
"<div class='cl'></div>" +
"<% else %>"+
"<li class='ur_item new_answer other_answer'>" +
"<label>其它<span class='ur_index'></span>&nbsp;&nbsp;&nbsp;</label>" +
"<input placeholder='由参加问卷的人输入内容' name='question_other_answer' readonly='readonly' class='disabled' type='text'/>" +
"<a class='icon_remove' title='删除' onclick='remove_single_answer($(this))'></a>" +
"</li>" +
"<div class='cl'></div>" +
"<% end %>"+
"<% end%>");
}
</script>
<div class="ur_editor checkbox">
<div class="questionEditContainer">
<div class="ur_editor_title">
<label>问题:&nbsp;&nbsp;</label>
<input type="hidden" name="question_type" value="<%= poll_question.question_type%>"/>
<input maxlength="250" class="ur_question_title" type="text" name="poll_questions_title" id="poll_questions_title_<%=poll_question.id%>" placeholder="请输入多选题题" value="<%= poll_question.question_title%>"/>
<input maxlength="250" class="questionTitle w570" type="text" name="poll_questions_title" id="poll_questions_title_<%=poll_question.id%>" placeholder="请输入多选题题" value="<%= poll_question.question_title%>"/>
<input type="checkbox" name="is_necessary" id="is_necessary_<%=poll_question.id%>" value="true" <%= poll_question.is_necessary == 1 ? "checked" : ""%>/>
<label>必答</label>
</div>
<div class="ur_editor_content">
<ul id="poll_answers_<%=poll_question.id%>">
<% poll_question.poll_answers.reorder("answer_position").each do |poll_answer| %>
<li class='ur_item'>
<label>选项<span class='ur_index'></span>&nbsp;&nbsp;&nbsp;</label>
<input maxlength="200" type='text' name='question_answer[<%= poll_answer.id %>]' placeholder='新建选项' value="<%= poll_answer.answer_text%>"/>
<a class='icon_add' title='向下插入选项' onclick='add_single_answer($(this));'></a>
<a class='icon_remove' title='删除' onclick='remove_single_answer($(this))'></a>
</li>
<div class='cl'></div>
<% if poll_answer.answer_text != '' %>
<li class='ur_item new_answer'>
<label>选项<span class='ur_index'></span>&nbsp;&nbsp;&nbsp;</label>
<input type='text' maxlength="200" name='question_answer[<%= poll_answer.id %>]' placeholder='输入选项内容' value="<%= poll_answer.answer_text%>"/>
<a class='icon_remove' title='删除' onclick='remove_single_answer($(this))'></a>
</li>
<div class='cl'></div>
<% else %>
<li class="ur_item new_answer other_answer">
<label>其它<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>
<input placeholder='由参加问卷的人输入内容' name='question_other_answer' readonly='readonly' class='disabled' type='text'>
<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>
</li>
<div class="cl"></div>
<% end %>
<% end%>
</ul>
<ul>
<li class="ur_item">
<div class="dash-block new-question" onclick='add_single_answer($(this));'>新建选项</div>
</li>
<div class='cl'></div>
<li class="ur_item">
<a href="javascript:void(0);" class="ml50 fontGrey2" onclick='add_other_answer($(this))'>添加[其他]选项</a>
</li>
<div class="cl"></div>
</ul>
</div>
<div class="ur_editor_footer">
<a class="btn btn_dark btn_submit c_white" data-button="ok" onclick="edit_poll_question($(this),<%= poll_question.id %>);">
<%= l(:label_button_ok)%>
</a>
<a class="btn btn_light btn_cancel" data-button="cancel" onclick="resetQuestion<%=poll_question.id%>();pollQuestionCancel(<%= poll_question.id%>);">
<%= l(:button_cancel)%>
</a>
<a data-button="cancel" onclick="resetQuestion<%=poll_question.id%>();pollQuestionCancel(<%= poll_question.id%>);" class="grey_btn fr borderRadius" ><%= l(:button_cancel)%></a>
<a data-button="ok" onclick="edit_poll_question($(this),<%= poll_question.id %>);" class="blue_btn fr borderRadius mr5" ><%= l(:label_button_ok)%></a>
</div>
<div class="cl"></div>
</div><!--编辑多选 end-->

View File

@ -1,42 +1,31 @@
<%= form_for @poll,:remote => true do |f|%>
<div class="ur_editor ur_title_editor"> <!--编辑头部start-->
<div class="ur_title_editor_title">
<input type="text" maxlength="100" name="polls_name" id="polls_title" value="<%= @poll.polls_name %>" class="input_title" placeholder="问卷标题"/>
</div>
<div class="ur_title_editor_prefix">
<div contenteditable="true" id="polls_description_div" class="ur_textbox" style="min-height: 150px;width: 100%;background-color: #ffffff" onkeyup="edit_head();">
<%= @poll.polls_description.nil? ? "" : @poll.polls_description.html_safe%>
</div>
<textarea name="polls_description" maxlength="300" id="polls_description" class="textarea_editor" style="display: none">
<%= @poll.polls_description%>
</textarea>
</div>
<div class="ur_editor_footer" style="padding-top: 10px;">
<a class="btn_submit c_white" data-button="ok" onclick="pollsSubmit($(this));">
<%= l(:label_button_ok)%>
</a>
<a class="btn_cancel" data-button="cancel" onclick="pollsCancel();">
<%= l(:button_cancel)%>
</a>
<div class="testContainer"> <!--编辑头部start-->
<div>
<input type="text" maxlength="100" name="polls_name" id="polls_title" value="<%= @poll.polls_name %>" class="testTitle mb10" placeholder="新建问卷,请先输入问卷标题"/>
</div>
<textarea name="polls_description" maxlength="300" id="polls_description" class="testDes" placeholder="请在此输入问卷描述">
<%= @poll.polls_description.html_safe if !@poll.polls_description.blank? %>
</textarea>
<a data-button="cancel" onclick="pollsCancel();" class="grey_btn fr borderRadius">取消</a>
<a data-button="ok" onclick="pollsSubmit($(this));" class="blue_btn fr borderRadius mr5">保存</a>
<div class="cl"></div>
</div><!--编辑头部 end-->
<% end%>
<script type="text/javascript">
$(function(){
if($('#polls_description_div').html().trim() == '') {
$('#polls_description_div').html("<p style='color:#999999'>问卷描述</p>");
}
});
// $(function(){
// if($('#polls_description_div').html().trim() == '') {
// $('#polls_description_div').html("<p style='color:#999999'>问卷描述</p>");
// }
// });
$('#polls_description_div').focus(function(){
//alert($('#polls_description_div').html().trim());
if(/^\s*<\w*\s*\w*\=\"\w*\:\s*\#\d*\"\>[\u4e00-\u9fa5]*<\/\w*\>\s*$/.test($('#polls_description_div').html().trim())) {
$('#polls_description_div').html('');
}
}).blur(function(){
if($('#polls_description_div').html().trim() == '') {
$('#polls_description_div').html("<p style='color:#999999'>问卷描述</p>");
}
});
// $('#polls_description_div').focus(function(){
// //alert($('#polls_description_div').html().trim());
// if(/^\s*<\w*\s*\w*\=\"\w*\:\s*\#\d*\"\>[\u4e00-\u9fa5]*<\/\w*\>\s*$/.test($('#polls_description_div').html().trim())) {
// $('#polls_description_div').html('');
// }
// }).blur(function(){
// if($('#polls_description_div').html().trim() == '') {
// $('#polls_description_div').html("<p style='color:#999999'>问卷描述</p>");
// }
// });
</script>

View File

@ -2,30 +2,53 @@
<script type="text/javascript">
function resetQuestion<%=poll_question.id%>()
{
$("#poll_questions_title_<%=poll_question.id%>").val("<%= poll_question.question_title%>")
$("#poll_questions_title_<%=poll_question.id%>").val("<%= poll_question.question_title%>");
$("#is_necessary_<%=poll_question.id%>").replaceWith("<input type='checkbox' name='is_necessary' id='is_necessary_<%=poll_question.id%>' value='true' <%= poll_question.is_necessary == 1 ? 'checked' : ''%>/>");
$("#poll_answers_<%=poll_question.id%>").html("<% poll_question.poll_answers.reorder('answer_position').each do |poll_answer| %>" +
"<li class='ur_item new_answer'>" +
"<label class='ml50'>问题<span class='ur_index'></span>&nbsp;&nbsp;&nbsp;</label>" +
"<input type='text' maxlength='200' class='w520' name='question_answer[<%= poll_answer.id %>]' placeholder='请输入主观题分题的问题' value='<%= poll_answer.answer_text%>'/>" +
"<a class='icon_remove' title='删除' onclick='remove_single_answer($(this))'></a>" +
"</li>" +
"<div class='cl'></div>" +
"<% end%>");
}
</script>
<div class="ur_editor textarea"> <!--编辑多行文字start-->
<div class="questionEditContainer"> <!--编辑多行文字start-->
<div class="ur_editor_title">
<label for="ur_question_title">问题:&nbsp;&nbsp;</label>
<input type="hidden" name="question_type" value="<%= poll_question.question_type%>"/>
<input maxlength="250" class="ur_question_title" type="text" name="poll_questions_title" id="poll_questions_title_<%=poll_question.id%>" placeholder="请输入多行主观标题" value="<%= poll_question.question_title%>"/>
<input type="checkbox" id="is_necessary_<%=poll_question.id%>" name="is_necessary" value="true" <%= poll_question.is_necessary == 1 ? "checked" : ""%>/>
<label for="ur_question_require">必答</label>
<input maxlength="250" class="questionTitle w570" type="text" name="poll_questions_title" id="poll_questions_title_<%=poll_question.id%>" placeholder="请输入多行主观题的问题描述" value="<%= poll_question.question_title%>"/>
<label>
<input id="is_necessary_<%=poll_question.id%>" name="is_necessary" value="true" type="checkbox" <%= poll_question.is_necessary == 1 ? "checked" : ""%>/>
必答
</label>
</div>
<div class="ur_editor_toolbar">
<!--<label>尺寸:</label>-->
<!--<label>宽 <input name="cols" type="number" min="1" value="60"> 字</label>,-->
<!--<label>高 <input name="rows" type="number" min="1" value="5"> 行</label>-->
<div class="ur_editor_content">
<ul id="poll_answers_<%=poll_question.id%>">
<% poll_question.poll_answers.reorder("answer_position").each do |poll_answer| %>
<li class='ur_item new_answer'>
<label class="ml50">问题<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>
<input type='text' class="w520" maxlength="200" name='question_answer[<%= poll_answer.id %>]' placeholder='请输入主观题分题的问题' value="<%= poll_answer.answer_text%>"/>
<a class='icon_remove' title='删除' onclick='remove_single_answer($(this))'></a>
</li>
<div class='cl'></div>
<% end%>
</ul>
<ul>
<li class="ur_item">
<div class="dash-block new-subjective w520" onclick="add_multi_question($(this))">新建选项</div>
</li>
<div class="cl"></div>
</ul>
</div>
<div class="ur_editor_footer">
<a class="btn_submit c_white" data-button="ok" onclick="edit_poll_question($(this),<%= poll_question.id %>);">
<%= l(:label_button_ok)%>
</a>
<a class="btn_cancel" data-button="cancel" onclick="resetQuestion<%=poll_question.id%>();pollQuestionCancel(<%= poll_question.id%>);">
<a class="grey_btn fr borderRadius" data-button="cancel" onclick="resetQuestion<%=poll_question.id%>();pollQuestionCancel(<%= poll_question.id%>);">
<%= l(:button_cancel)%>
</a>
<a class="blue_btn fr borderRadius mr5" data-button="ok" onclick="edit_poll_question($(this),<%= poll_question.id %>);">
<%= l(:label_button_ok)%>
</a>
</div>
<div class="cl"></div>
</div><!--编辑多行文字end-->

View File

@ -6,22 +6,19 @@
$("#is_necessary_<%=poll_question.id%>").replaceWith("<input type='checkbox' name='is_necessary' id='is_necessary_<%=poll_question.id%>' value='true' <%= poll_question.is_necessary == 1 ? 'checked' : ''%>/>");
}
</script>
<div class="ur_editor text "> <!--编辑单行文字start-->
<div class="questionEditContainer"> <!--编辑单行文字start-->
<div class="ur_editor_title">
<label for="ur_question_title">问题:&nbsp;&nbsp;</label>
<input type="hidden" name="question_type" value="<%= poll_question.question_type%>"/>
<input maxlength="250" id="poll_questions_title_<%=poll_question.id%>" class="ur_question_title" contenteditable="true" type="text"
name="poll_questions_title" placeholder="请输入单行主观标题" value="<%= poll_question.question_title%>"/>
<input type="checkbox" id="is_necessary_<%=poll_question.id%>" name="is_necessary" value="true" <%= poll_question.is_necessary == 1 ? "checked" : ""%>/>
<label for="ur_question_require">必答</label>
<input maxlength="250" id="poll_questions_title_<%=poll_question.id%>" class="questionTitle w570" contenteditable="true" type="text"
name="poll_questions_title" placeholder="请输入单行主观题" value="<%= poll_question.question_title%>"/>
<label>
<input name="is_necessary" id="is_necessary_<%=poll_question.id%>" value="true" <%= poll_question.is_necessary == 1 ? "checked" : ""%> type="checkbox">
必答</label>
</div>
<div class="ur_editor_footer">
<a class="btn_submit c_white" data-button="ok" onclick="edit_poll_question($(this),<%= poll_question.id %>);">
<%= l(:label_button_ok)%>
</a>
<a class="btn_cancel" data-button="cancel" onclick="resetQuestion<%=poll_question.id%>();pollQuestionCancel(<%= poll_question.id%>);">
<%= l(:button_cancel)%>
</a>
<a data-button="cancel" onclick="resetQuestion<%=poll_question.id%>();pollQuestionCancel(<%= poll_question.id%>);" class="grey_btn fr borderRadius" ><%= l(:button_cancel)%></a>
<a data-button="ok" onclick="edit_poll_question($(this),<%= poll_question.id %>);" class="blue_btn fr borderRadius mr5" ><%= l(:label_button_ok)%></a>
</div>
<div class="cl"></div>
</div><!--编辑单行文字end-->

View File

@ -0,0 +1,31 @@
<% poll_question.poll_answers.each do |pa| %>
<div class="ml20">
<div class="ur_title_result">
<span class="title_index">
<%= pa.answer_position %>
</span>
<%= pa.answer_text %>
</div>
<div class="ur_table_result">
<table border="0" cellspacing="0" cellpadding="0" class="full_width">
<tbody>
<tr class="table_bluebg">
<td class="td_full"><%= l(:label_answer) %> </td>
</tr>
<% poll_question.poll_votes.where("poll_answer_id = #{pa.id}").each do |poll_vote| %>
<tr>
<td class="td_full"><%= poll_vote.vote_text.html_safe %> </td>
</tr>
<% end %>
<tr class="table_bluebg">
<td class="td_full">
<%= l(:label_poll_answer_valid_result) %>
<%= l(:label_answer_total) %>
<%= poll_question.poll_votes.where("poll_answer_id = #{pa.id}").count %>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<% end %>

View File

@ -1,46 +1,56 @@
<%= form_for PollQuestion.new,:url =>create_poll_question_poll_path(@poll.id),:remote => true do |f|%>
<!--新建单选start-->
<% insert_begin = insert_begin %>
<div class="ur_editor radio">
<div class="questionContainer">
<div class="ur_editor_title">
<label>问题:&nbsp;&nbsp;</label>
<input type="hidden" name="question_type" value="1"/>
<input maxlength="250" class="ur_question_title" type="text" name="poll_questions_title" id="poll_questions_title_new" placeholder="请输入单选题题"/>
<input maxlength="250" class="questionTitle W600" type="text" name="poll_questions_title" id="poll_questions_title_new" placeholder="请输入单选题题"/>
<input type="checkbox" name="is_necessary" value="true" checked/>
<label>必答</label>
</div>
<div class="ur_editor_content">
<ul>
<li class='ur_item'>
<li class='ur_item new_answer'>
<label>选项<span class='ur_index'></span>&nbsp;&nbsp;&nbsp;</label>
<input maxlength="200" type='text' name='question_answer[0]' placeholder='新建选项'/>
<a class='icon_add' title='向下插入选项' onclick='add_single_answer($(this));'></a>
<input maxlength="200" type='text' name='question_answer[0]' placeholder='输入选项内容'/>
<!--<a class='icon_add' title='向下插入选项' onclick='add_single_answer($(this));'></a>-->
<a class='icon_remove' title='删除' onclick='remove_single_answer($(this))'></a>
</li>
<div class='cl'></div>
<li class='ur_item new_answer'>
<label>选项<span class='ur_index'></span>&nbsp;&nbsp;&nbsp;</label>
<input maxlength="200" type='text' name='question_answer[1]' placeholder='输入选项内容'/>
<!--<a class='icon_add' title='向下插入选项' onclick='add_single_answer($(this));'></a>-->
<a class='icon_remove' title='删除' onclick='remove_single_answer($(this))'></a>
</li>
<div class='cl'></div>
<li class='ur_item'>
<li class='ur_item new_answer'>
<label>选项<span class='ur_index'></span>&nbsp;&nbsp;&nbsp;</label>
<input maxlength="200" type='text' name='question_answer[1]' placeholder='新建选项'/>
<a class='icon_add' title='向下插入选项' onclick='add_single_answer($(this));'></a>
<a class='icon_remove' title='删除' onclick='remove_single_answer($(this))'></a>
</li>
<div class='cl'></div>
<li class='ur_item'>
<label>选项<span class='ur_index'></span>&nbsp;&nbsp;&nbsp;</label>
<input maxlength="200" type='text' name='question_answer[2]' placeholder='新建选项'/>
<a class='icon_add' title='向下插入选项' onclick='add_single_answer($(this));'></a>
<input maxlength="200" type='text' name='question_answer[2]' placeholder='输入选项内容'/>
<!--<a class='icon_add' title='向下插入选项' onclick='add_single_answer($(this));'></a>-->
<a class='icon_remove' title='删除' onclick='remove_single_answer($(this))'></a>
</li>
<div class='cl'></div>
</ul>
<ul>
<li class="ur_item">
<div class="dash-block new-question" onclick='add_single_answer($(this));'>新建选项</div>
</li>
<div class='cl'></div>
<li class="ur_item">
<a href="javascript:void(0);" class="ml50 fontGrey2" onclick='add_other_answer($(this))'>添加[其他]选项</a>
</li>
<div class="cl"></div>
</ul>
</div>
<div class="ur_editor_footer">
<a class="btn btn_dark btn_submit c_white" data-button="ok" id="add_new_question_new">
<%= l(:label_button_ok)%>
</a>
<a class="btn btn_light btn_cancel" data-button="cancel" onclick="$(this).parent().parent().parent().remove();">
<a class="grey_btn fr borderRadius" data-button="cancel" onclick="$(this).parent().parent().parent().remove();">
<%= l(:button_cancel)%>
</a>
<a class="blue_btn fr borderRadius mr5" data-button="ok" id="add_new_question_new">
<%= l(:label_button_ok)%>
</a>
</div>
<div class="cl"></div>
</div>

View File

@ -1,44 +1,51 @@
<%= form_for PollQuestion.new,:url =>create_poll_question_poll_path(@poll.id),:remote => true do |f|%><!--新建多选start-->
<div class="ur_editor checkbox">
<div class="questionContainer">
<div class="ur_editor_title">
<label>问题:&nbsp;&nbsp;</label>
<input type="hidden" name="question_type" value="2"/>
<input maxlength="250" class="ur_question_title" type="text" name="poll_questions_title" id="poll_questions_title_new" placeholder="请输入多选题题"/>
<input maxlength="250" class="questionTitle W600" type="text" name="poll_questions_title" id="poll_questions_title_new" placeholder="请输入多选题题"/>
<input type="checkbox" name="is_necessary" value="true" checked/>
<label>必答</label>
</div>
<div class="ur_editor_content">
<ul>
<li class='ur_item'>
<li class='ur_item new_answer'>
<label>选项<span class='ur_index'></span>&nbsp;&nbsp;&nbsp;</label>
<input maxlength="200" type='text' name='question_answer[0]' placeholder='新建选项'/>
<a class='icon_add' title='向下插入选项' onclick='add_single_answer($(this));'></a>
<a class='icon_remove' title='删除' onclick='remove_single_answer($(this))'></a>
</li>
<div class='cl'></div>
<li class='ur_item'>
<li class='ur_item new_answer'>
<label>选项<span class='ur_index'></span>&nbsp;&nbsp;&nbsp;</label>
<input maxlength="200" type='text' name='question_answer[1]' placeholder='新建选项'/>
<a class='icon_add' title='向下插入选项' onclick='add_single_answer($(this));'></a>
<a class='icon_remove' title='删除' onclick='remove_single_answer($(this))'></a>
</li>
<div class='cl'></div>
<li class='ur_item'>
<li class='ur_item new_answer'>
<label>选项<span class='ur_index'></span>&nbsp;&nbsp;&nbsp;</label>
<input maxlength="200" type='text' name='question_answer[2]' placeholder='新建选项'/>
<a class='icon_add' title='向下插入选项' onclick='add_single_answer($(this));'></a>
<a class='icon_remove' title='删除' onclick='remove_single_answer($(this))'></a>
</li>
<div class='cl'></div>
</ul>
<ul>
<li class="ur_item">
<div class="dash-block new-question" onclick='add_single_answer($(this));'>新建选项</div>
</li>
<div class='cl'></div>
<li class="ur_item">
<a href="javascript:void(0);" class="ml50 fontGrey2" onclick='add_other_answer($(this))'>添加[其他]选项</a>
</li>
<div class="cl"></div>
</ul>
</div>
<div class="ur_editor_footer">
<a class="btn btn_dark btn_submit c_white" data-button="ok" id="add_new_question_new">
<%= l(:label_button_ok)%>
</a>
<a class="btn btn_light btn_cancel" data-button="cancel" onclick="$(this).parent().parent().parent().remove();">
<a class="grey_btn fr borderRadius" data-button="cancel" onclick="$(this).parent().parent().parent().remove();">
<%= l(:button_cancel)%>
</a>
<a class="blue_btn fr borderRadius mr5" data-button="ok" id="add_new_question_new">
<%= l(:label_button_ok)%>
</a>
</div>
<div class="cl"></div>
</div>

View File

@ -1,24 +1,44 @@
<%= form_for PollQuestion.new,:url =>create_poll_question_poll_path(@poll.id),:remote => true do |f|%>
<div class="ur_editor textarea"> <!--编辑多行文字start-->
<div class="questionContainer"> <!--编辑多行文字start-->
<div class="ur_editor_title">
<label for="ur_question_title">问题:&nbsp;&nbsp;</label>
<input type="hidden" name="question_type" value="4"/>
<input maxlength="250" id="poll_questions_title_new" class="ur_question_title" contenteditable="true" type="text" name="poll_questions_title" placeholder="请输入多行主观标题"/>
<input type="checkbox" name="is_necessary" value="true" checked/>
<label>必答</label>
<input maxlength="250" id="poll_questions_title_new" class="questionTitle W600" contenteditable="true" type="text" name="poll_questions_title" placeholder="请输入多行主观题的问题描述"/>
<label>
<input name="is_necessary" value="true" checked type="checkbox">
必答
</label>
</div>
<div class="ur_editor_toolbar">
<div class="ur_editor_content">
<ul>
<li class="ur_item new_answer">
<label class="ml50">问题<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>
<input placeholder="请输入主观题分题的问题" style="width:520px;" type="text" name="question_answer[0]">
<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a> </li>
<div class="cl"></div>
<li class="ur_item new_answer">
<label class="ml50">问题<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>
<input placeholder="请输入主观题分题的问题" style="width:520px;" type="text" name="question_answer[1]">
<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a> </li>
<div class="cl"></div>
</ul>
<ul>
<li class="ur_item">
<div class="dash-block new-subjective" onclick='add_multi_question($(this));'>新建选项</div>
</li>
<div class="cl"></div>
</ul>
<!--<label>尺寸:</label>-->
<!--<label>宽 <input name="cols" type="number" min="1" value="60"> 字</label>,-->
<!--<label>高 <input name="rows" type="number" min="1" value="5"> 行</label>-->
</div>
<div class="ur_editor_footer">
<a class="btn_submit c_white" data-button="ok" id="add_new_question_new">
<%= l(:label_button_ok)%>
</a>
<a class="btn_cancel" data-button="cancel" onclick="$(this).parent().parent().parent().remove();">
<a class="grey_btn fr borderRadius" data-button="cancel" onclick="$(this).parent().parent().parent().remove();">
<%= l(:button_cancel)%>
</a>
<a class="blue_btn fr borderRadius mr5" data-button="ok" id="add_new_question_new">
<%= l(:label_button_ok)%>
</a>
</div>
<div class="cl"></div>
</div><!--编辑多行文字end-->

View File

@ -1,19 +1,21 @@
<%= form_for PollQuestion.new,:url =>create_poll_question_poll_path(@poll.id),:remote => true do |f|%>
<div class="ur_editor text "> <!--编辑单行文字start-->
<div class="questionContainer"> <!--编辑单行文字start-->
<div class="ur_editor_title">
<label for="ur_question_title">问题:&nbsp;&nbsp;</label>
<input type="hidden" name="question_type" value="3"/>
<input maxlength="250" id="poll_questions_title_new" class="ur_question_title" contenteditable="true" type="text" name="poll_questions_title" placeholder="请输入单行主观标题"/>
<input type="checkbox" name="is_necessary" value="true" checked/>
<label for="ur_question_require">必答</label>
<input maxlength="250" id="poll_questions_title_new" class="questionTitle W600" contenteditable="true" type="text" name="poll_questions_title" placeholder="请输入单行主观题"/>
<label>
<input name="is_necessary" value="true" checked type="checkbox">
必答
</label>
</div>
<div class="ur_editor_footer">
<a class="btn_submit c_white" data-button="ok" id="add_new_question_new">
<%= l(:label_button_ok)%>
</a>
<a class="btn_cancel" data-button="cancel" onclick="$(this).parent().parent().parent().remove();">
<a class="grey_btn fr borderRadius" data-button="cancel" onclick="$(this).parent().parent().parent().remove();">
<%= l(:button_cancel)%>
</a>
<a class="blue_btn fr borderRadius mr5" data-button="ok" id="add_new_question_new">
<%= l(:label_button_ok)%>
</a>
</div>
<div class="cl"></div>
</div><!--编辑单行文字end-->

View File

@ -1,26 +1,56 @@
<% poll.poll_questions.each do |poll_question|%>
<div id="poll_questions_<%= poll_question.id%>">
<div id="show_poll_questions_<%= poll_question.id %>">
<% if poll_question.question_type == 1%>
<%= render :partial => 'show_MC', :locals => {:poll_question => poll_question} %>
<% elsif poll_question.question_type == 2%>
<%= render :partial => 'show_MCQ', :locals => {:poll_question => poll_question} %>
<% elsif poll_question.question_type == 3%>
<%= render :partial => 'show_single', :locals => {:poll_question => poll_question} %>
<% elsif poll_question.question_type == 4%>
<%= render :partial => 'show_mulit', :locals => {:poll_question => poll_question} %>
<% end%>
<% mc_question_list = poll.poll_questions.where("question_type=1") %>
<% mcq_question_list = poll.poll_questions.where("question_type=2") %>
<% single_question_list = poll.poll_questions.where("question_type=3") %>
<% multi_question_list = poll.poll_questions.where("question_type=4") %>
<div class="testStatus" id="mc_question_list" style="display: <%=mc_question_list.count > 0 ? "" : "none" %>">
<h3 class="fontGrey3">单选题</h3>
<% mc_question_list.each do |poll_question| %>
<div id="poll_questions_<%= poll_question.id%>">
<div id="show_poll_questions_<%= poll_question.id %>">
<%= render :partial => 'show_MC', :locals => {:poll_question => poll_question} %>
</div>
<div id="edit_poll_questions_<%= poll_question.id %>" style="display: none;">
<%= render :partial => 'edit_MC', :locals => {:poll_question => poll_question} %>
</div>
</div>
<div id="edit_poll_questions_<%= poll_question.id %>" style="display: none;">
<% if poll_question.question_type == 1%>
<%= render :partial => 'edit_MC', :locals => {:poll_question => poll_question} %>
<% elsif poll_question.question_type == 2%>
<%= render :partial => 'edit_MCQ', :locals => {:poll_question => poll_question} %>
<% elsif poll_question.question_type == 3%>
<%= render :partial => 'edit_single', :locals => {:poll_question => poll_question} %>
<% elsif poll_question.question_type == 4%>
<%= render :partial => 'edit_mulit', :locals => {:poll_question => poll_question} %>
<% end%>
<% end %>
</div>
<div class="testStatus" id="mcq_question_list" style="display: <%=mcq_question_list.count > 0 ? "" : "none" %>">
<h3 class="fontGrey3">多选题</h3>
<% mcq_question_list.each do |poll_question| %>
<div id="poll_questions_<%= poll_question.id%>">
<div id="show_poll_questions_<%= poll_question.id %>">
<%= render :partial => 'show_MCQ', :locals => {:poll_question => poll_question} %>
</div>
<div id="edit_poll_questions_<%= poll_question.id %>" style="display: none;">
<%= render :partial => 'edit_MCQ', :locals => {:poll_question => poll_question} %>
</div>
</div>
</div>
<% end %>
<% end %>
</div>
<div class="testStatus" id="single_question_list" style="display: <%=single_question_list.count > 0 ? "" : "none" %>">
<h3 class="fontGrey3">单行主观题</h3>
<% single_question_list.each do |poll_question| %>
<div id="poll_questions_<%= poll_question.id%>">
<div id="show_poll_questions_<%= poll_question.id %>">
<%= render :partial => 'show_single', :locals => {:poll_question => poll_question} %>
</div>
<div id="edit_poll_questions_<%= poll_question.id %>" style="display: none;">
<%= render :partial => 'edit_single', :locals => {:poll_question => poll_question} %>
</div>
</div>
<% end %>
</div>
<div class="testStatus" id="multi_question_list" style="display: <%=multi_question_list.count > 0 ? "" : "none" %>">
<h3 class="fontGrey3">多行主观题</h3>
<% multi_question_list.each do |poll_question| %>
<div id="poll_questions_<%= poll_question.id%>">
<div id="show_poll_questions_<%= poll_question.id %>">
<%= render :partial => 'show_mulit', :locals => {:poll_question => poll_question} %>
</div>
<div id="edit_poll_questions_<%= poll_question.id %>" style="display: none;">
<%= render :partial => 'edit_mulit', :locals => {:poll_question => poll_question} %>
</div>
</div>
<% end %>
</div>

View File

@ -51,198 +51,299 @@ function chooseQuestionType(quest_type,quest_id){
}
function add_MC(){
$("#new_poll_question_new").html("<%= escape_javascript(render :partial => 'new_MC') %>");
$("#poll_questions_title_new").focus();
var forms = $("form.new_poll_question");
if($("#polls_head_edit").is(":visible")){
alert("请先保存问卷标题及问卷描述。");
}else if(forms.length > 0){
alert("请先保存正在编辑的题目再新建。");
} else{
$("#new_poll_question_new").html("<%= escape_javascript(render :partial => 'new_MC') %>");
$("#poll_questions_title_new").focus();
}
}
function insert_MC(quest_type,quest_num,quest_id){
$("#insert_new_poll_question_"+quest_type+"_"+quest_id).html(
var forms = $("form.new_poll_question");
if($.trim($("#insert_new_poll_question_"+quest_type+"_"+quest_id).html()) == "") {
if(forms.length > 0){
alert("请先保存正在编辑的题目再新建。");
} else{
$("#insert_new_poll_question_"+quest_type+"_"+quest_id).html(
'<%= form_for PollQuestion.new,:url =>create_poll_question_poll_path(@poll.id),:remote => true do |f|%>'+
' <div class="ur_editor radio"> '+
' <div class="questionEditContainer"> '+
'<div class="ur_editor_title"> '+
'<label>问题:&nbsp;&nbsp;</label>'+
'<input type="hidden" name="quest_id" value="'+quest_id+'"/>'+
'<input type="hidden" name="quest_num" value="'+quest_num+'"/>'+
'<input type="hidden" name="question_type" value="1"/>'+
'<input maxlength="250" class="ur_question_title" type="text" name="poll_questions_title" id="poll_questions_title" placeholder="请输入单选题题"/>'+
'<input maxlength="250" class="questionTitle w570" type="text" name="poll_questions_title" id="poll_questions_title" placeholder="请输入单选题题"/>'+
'<input type="checkbox" name="is_necessary" value="true" checked/>'+
'<label>必答</label>'+
'</div>'+
'<div class="ur_editor_content">'+
'<ul>'+
'<li class="ur_item">'+
'<li class="ur_item new_answer">'+
'<label>选项<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>'+
'<input maxlength="200" type="text" name="question_answer[0]" placeholder="新建选项"/>'+
'<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>'+
'<input maxlength="200" type="text" name="question_answer[0]" placeholder="输入选项内容"/>'+
'<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>'+
'</li>'+
'<div class="cl"></div>'+
'<li class="ur_item">'+
'<li class="ur_item new_answer">'+
'<label>选项<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>'+
'<input maxlength="200" type="text" name="question_answer[1]" placeholder="新建选项"/>'+
'<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>'+
'<input maxlength="200" type="text" name="question_answer[1]" placeholder="输入选项内容"/>'+
'<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>'+
'</li>'+
'<div class="cl"></div>'+
'<li class="ur_item">'+
'<li class="ur_item new_answer">'+
'<label>选项<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>'+
'<input maxlength="200" type="text" name="question_answer[2]" placeholder="新建选项"/>'+
'<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>'+
'<input maxlength="200" type="text" name="question_answer[2]" placeholder="输入选项内容"/>'+
'<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>'+
'</li>'+
'<div class="cl"></div>'+
'</ul>'+
'<ul>'+
'<li class="ur_item">'+
'<div class="dash-block new-question" onclick="add_single_answer($(this));">新建选项</div>'+
'</li>'+
'<div class="cl"></div>'+
'<li class="ur_item">'+
'<a href="javascript:void(0);" class="ml50 fontGrey2" onclick="add_other_answer($(this))">添加[其他]选项</a>'+
'</li>'+
'<div class="cl"></div>'+
'</ul>'+
'</div>'+
'<div class="ur_editor_footer">'+
'<a class="btn btn_dark btn_submit c_white" data-button="ok" id="add_new_question">'+
'<%= l(:label_button_ok)%>'+
'</a>'+
'<a class="btn btn_light btn_cancel" data-button="cancel" onclick="$(this).parent().parent().parent().remove();">'+
'<a class="grey_btn fr borderRadius" data-button="cancel" onclick="$(this).parent().parent().parent().remove();">'+
'<%= l(:button_cancel)%>'+
'</a>'+
'<a class="blue_btn fr borderRadius mr5" data-button="ok" id="add_new_question">'+
'<%= l(:label_button_ok)%>'+
'</a>'+
'</div>'+
'<div class="cl"></div>'+
'</div>'+
'<% end%>'
);
$("#poll_questions_title").focus();
$("#add_new_question").one('click', function(){
add_poll_question($(this));
});
);
$("#poll_questions_title").focus();
$("#add_new_question").one('click', function(){
add_poll_question($(this));
});
}
}
else {
$("#insert_new_poll_question_"+quest_type+"_"+quest_id).html("");
}
}
function add_MCQ(){
$("#new_poll_question_new").html("<%= escape_javascript(render :partial => 'new_MCQ') %>");
$("#poll_questions_title_new").focus();
var forms = $("form.new_poll_question");
if($("#polls_head_edit").is(":visible")){
alert("请先保存问卷标题及问卷描述。");
}else if(forms.length > 0){
alert("请先保存正在编辑的题目再新建。");
} else{
$("#new_poll_question_new").html("<%= escape_javascript(render :partial => 'new_MCQ') %>");
$("#poll_questions_title_new").focus();
}
}
function insert_MCQ(quest_type,quest_num,quest_id){
$("#insert_new_poll_question_"+quest_type+"_"+quest_id).html(
'<%= form_for PollQuestion.new,:url =>create_poll_question_poll_path(@poll.id),:remote => true do |f|%>'+
'<div class="ur_editor checkbox">'+
'<div class="ur_editor_title">'+
'<label>问题:&nbsp;&nbsp;</label>'+
'<input type="hidden" name="quest_id" value="'+quest_id+'"/>'+
'<input type="hidden" name="quest_num" value="'+quest_num+'"/>'+
'<input type="hidden" name="question_type" value="2"/>'+
'<input maxlength="250" class="ur_question_title" type="text" name="poll_questions_title" id="poll_questions_title" placeholder="请输入多选题标题"/>'+
'<input type="checkbox" name="is_necessary" value="true" checked/>'+
'<label>必答</label>'+
'</div>'+
'<div class="ur_editor_content">'+
var forms = $("form.new_poll_question");
if($.trim($("#insert_new_poll_question_"+quest_type+"_"+quest_id).html()) == "") {
if(forms.length > 0){
alert("请先保存正在编辑的题目再新建。");
} else{
$("#insert_new_poll_question_"+quest_type+"_"+quest_id).html(
'<%= form_for PollQuestion.new,:url =>create_poll_question_poll_path(@poll.id),:remote => true do |f|%>'+
'<div class="questionEditContainer">'+
'<div class="ur_editor_title">'+
'<label>问题:&nbsp;&nbsp;</label>'+
'<input type="hidden" name="quest_id" value="'+quest_id+'"/>'+
'<input type="hidden" name="quest_num" value="'+quest_num+'"/>'+
'<input type="hidden" name="question_type" value="2"/>'+
'<input maxlength="250" class="questionTitle w570" type="text" name="poll_questions_title" id="poll_questions_title" placeholder="请输入多选题题目"/>'+
'<input type="checkbox" name="is_necessary" value="true" checked/>'+
'<label>必答</label>'+
'</div>'+
'<div class="ur_editor_content">'+
'<ul>'+
'<li class="ur_item">'+
'<label>选项<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>'+
'<input maxlength="200" type="text" name="question_answer[0]" placeholder="输入选项内容"/>'+
'<a class="icon_remove" title="删除"" onclick="remove_single_answer($(this))"></a>'+
'</li>'+
'<div class="cl"></div>'+
'<li class="ur_item">'+
'<label>选项<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>'+
'<input maxlength="200" type="text" name="question_answer[1]" placeholder="输入选项内容"/>'+
'<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>'+
'</li>'+
'<div class="cl"></div>'+
'<li class="ur_item">'+
'<label>选项<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>'+
'<input maxlength="200" type="text" name="question_answer[2]" placeholder="输入选项内容"/>'+
'<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>'+
'</li>'+
'<div class="cl"></div>'+
'</ul>'+
'<ul>'+
'<li class="ur_item">'+
'<label>选项<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>'+
'<input maxlength="200" type="text" name="question_answer[0]" placeholder="新建选项"/>'+
'<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>'+
'<a class="icon_remove" title="删除"" onclick="remove_single_answer($(this))"></a>'+
'</li>'+
'<div class="cl"></div>'+
'<li class="ur_item">'+
'<label>选项<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>'+
'<input maxlength="200" type="text" name="question_answer[1]" placeholder="新建选项"/>'+
'<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>'+
'<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>'+
'</li>'+
'<div class="cl"></div>'+
'<li class="ur_item">'+
'<label>选项<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>'+
'<input maxlength="200" type="text" name="question_answer[2]" placeholder="新建选项"/>'+
'<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>'+
'<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>'+
'</li>'+
'<div class="cl"></div>'+
'</ul>'+
'</div>'+
'<div class="ur_editor_footer">'+
'<a class="btn btn_dark btn_submit c_white" data-button="ok" id="add_new_question">'+
'<%= l(:label_button_ok)%>'+
'</a>'+
'<a class="btn btn_light btn_cancel" data-button="cancel" onclick="$(this).parent().parent().parent().remove();">'+
'<%= l(:button_cancel)%>'+
'</a>'+
'</div>'+
'<div class="cl"></div>'+
'</div>'+
'<% end%>'
);
$("#poll_questions_title").focus();
$("#add_new_question").one('click', function(){
add_poll_question($(this));
});
'<div class="dash-block new-question" onclick="add_single_answer($(this));">新建选项</div>'+
'</li>'+
'<div class="cl"></div>'+
'<li class="ur_item">'+
'<a href="javascript:void(0);" class="ml50 fontGrey2" onclick="add_other_answer($(this))">添加[其他]选项</a>'+
'</li>'+
'<div class="cl"></div>'+
'</ul>'+
'</div>'+
'<div class="ur_editor_footer">'+
'<a class="grey_btn fr borderRadius" data-button="cancel" onclick="$(this).parent().parent().parent().remove();">'+
'<%= l(:button_cancel)%>'+
'</a>'+
'<a class="blue_btn fr borderRadius mr5" data-button="ok" id="add_new_question">'+
'<%= l(:label_button_ok)%>'+
'</a>'+
'</div>'+
'<div class="cl"></div>'+
'</div>'+
'<% end%>'
);
$("#poll_questions_title").focus();
$("#add_new_question").one('click', function(){
add_poll_question($(this));
});
}
}
else {
$("#insert_new_poll_question_"+quest_type+"_"+quest_id).html("");
}
}
function add_single(){
$("#new_poll_question_new").html("<%= escape_javascript(render :partial => 'new_single') %>");
$("#poll_questions_title_new").focus();
var forms = $("form.new_poll_question");
if($("#polls_head_edit").is(":visible")){
alert("请先保存问卷标题及问卷描述。");
}else if(forms.length > 0){
alert("请先保存正在编辑的题目再新建。");
} else{
$("#new_poll_question_new").html("<%= escape_javascript(render :partial => 'new_single') %>");
$("#poll_questions_title_new").focus();
}
}
function insert_SINGLE(quest_type,quest_num,quest_id){
$("#insert_new_poll_question_"+quest_type+"_"+quest_id).html(
'<%= form_for PollQuestion.new,:url =>create_poll_question_poll_path(@poll.id),:remote => true do |f|%>'+
'<div class="ur_editor text ">'+
'<div class="ur_editor_title">'+
'<label for="ur_question_title">问题:&nbsp;&nbsp;</label>'+
'<input type="hidden" name="quest_id" value="'+quest_id+'"/>'+
'<input type="hidden" name="quest_num" value="'+quest_num+'"/>'+
'<input type="hidden" name="question_type" value="3"/>'+
'<input maxlength="250" id="poll_questions_title" class="ur_question_title" contenteditable="true" type="text" name="poll_questions_title" placeholder="请输入单行主观标题"/>'+
'<input type="checkbox" name="is_necessary" value="true" checked/>'+
'<label for="ur_question_require">必答</label>'+
'</div>'+
'<div class="ur_editor_footer">'+
'<a class="btn_submit c_white" data-button="ok" id="add_new_question">'+
'<%= l(:label_button_ok)%>'+
'</a>'+
'<a class="btn_cancel" data-button="cancel" onclick="$(this).parent().parent().parent().remove();">'+
'<%= l(:button_cancel)%>'+
'</a>'+
'</div>'+
'<div class="cl"></div>'+
'</div>'+
'<% end%>'
);
$("#poll_questions_title").focus();
$("#add_new_question").one('click', function(){
add_poll_question($(this));
});
var forms = $("form.new_poll_question");
if($.trim($("#insert_new_poll_question_"+quest_type+"_"+quest_id).html()) == "") {
if(forms.length > 0){
alert("请先保存正在编辑的题目再新建。");
} else{
$("#insert_new_poll_question_"+quest_type+"_"+quest_id).html(
'<%= form_for PollQuestion.new,:url =>create_poll_question_poll_path(@poll.id),:remote => true do |f|%>'+
'<div class="questionEditContainer">'+
'<div class="ur_editor_title">'+
'<label for="ur_question_title">问题:&nbsp;&nbsp;</label>'+
'<input type="hidden" name="quest_id" value="'+quest_id+'"/>'+
'<input type="hidden" name="quest_num" value="'+quest_num+'"/>'+
'<input type="hidden" name="question_type" value="3"/>'+
'<input maxlength="250" id="poll_questions_title" class="questionTitle w570" contenteditable="true" type="text" name="poll_questions_title" placeholder="请输入单行主观题"/>'+
'<input type="checkbox" name="is_necessary" value="true" checked/>'+
'<label for="ur_question_require">必答</label>'+
'</div>'+
'<div class="ur_editor_footer">'+
'<a class="grey_btn fr borderRadius" data-button="cancel" onclick="$(this).parent().parent().parent().remove();">'+
'<%= l(:button_cancel)%>'+
'</a>'+
'<a class="blue_btn fr borderRadius mr5" data-button="ok" id="add_new_question">'+
'<%= l(:label_button_ok)%>'+
'</a>'+
'</div>'+
'<div class="cl"></div>'+
'</div>'+
'<% end%>'
);
$("#poll_questions_title").focus();
$("#add_new_question").one('click', function(){
add_poll_question($(this));
});
}
}
else {
$("#insert_new_poll_question_"+quest_type+"_"+quest_id).html("");
}
}
function add_mulit(){
$("#new_poll_question_new").html("<%= escape_javascript(render :partial => 'new_mulit') %>");
$("#poll_questions_title_new").focus();
var forms = $("form.new_poll_question");
if($("#polls_head_edit").is(":visible")){
alert("请先保存问卷标题及问卷描述。");
}else if(forms.length > 0){
alert("请先保存正在编辑的题目再新建。");
} else{
$("#new_poll_question_new").html("<%= escape_javascript(render :partial => 'new_mulit') %>");
$("#poll_questions_title_new").focus();
}
}
function insert_MULIT(quest_type,quest_num,quest_id){
$("#insert_new_poll_question_"+quest_type+"_"+quest_id).html(
'<%= form_for PollQuestion.new,:url =>create_poll_question_poll_path(@poll.id),:remote => true do |f|%>'+
'<div class="ur_editor textarea">'+
'<div class="ur_editor_title">'+
'<label for="ur_question_title">问题:&nbsp;&nbsp;</label>'+
'<input type="hidden" name="quest_id" value="'+quest_id+'"/>'+
'<input type="hidden" name="quest_num" value="'+quest_num+'"/>'+
'<input type="hidden" name="question_type" value="4"/>'+
'<input maxlength="250" id="poll_questions_title" class="ur_question_title" contenteditable="true" type="text" name="poll_questions_title" placeholder="请输入多行主观标题"/>'+
'<input type="checkbox" name="is_necessary" value="true" checked/>'+
'<label>必答</label>'+
'</div>'+
'<div class="ur_editor_toolbar">'+
'</div>'+
'<div class="ur_editor_footer">'+
'<a class="btn_submit c_white" data-button="ok" id="add_new_question">'+
'<%= l(:label_button_ok)%>'+
'</a>'+
'<a class="btn_cancel" data-button="cancel" onclick="$(this).parent().parent().parent().remove();">'+
var forms = $("form.new_poll_question");
if($.trim($("#insert_new_poll_question_"+quest_type+"_"+quest_id).html()) == "") {
if(forms.length > 0){
alert("请先保存正在编辑的题目再新建。");
} else{
$("#insert_new_poll_question_"+quest_type+"_"+quest_id).html(
'<%= form_for PollQuestion.new,:url =>create_poll_question_poll_path(@poll.id),:remote => true do |f|%>'+
'<div class="questionEditContainer">'+
'<div class="ur_editor_title">'+
'<label for="ur_question_title">问题:&nbsp;&nbsp;</label>'+
'<input type="hidden" name="quest_id" value="'+quest_id+'"/>'+
'<input type="hidden" name="quest_num" value="'+quest_num+'"/>'+
'<input type="hidden" name="question_type" value="4"/>'+
'<input maxlength="250" id="poll_questions_title" class="questionTitle w570" contenteditable="true" type="text" name="poll_questions_title" placeholder="请输入多行主观题的问题描述"/>'+
'<label><input type="checkbox" name="is_necessary" value="true" checked/>'+
'必答</label>'+
'</div>'+
'<div class="ur_editor_content">'+
'<ul>'+
'<li class="ur_item new_answer">'+
'<label class="ml50">问题<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>'+
'<input placeholder="请输入主观题分题的问题" class="w520" type="text" name="question_answer[0]">'+
'<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>'+
'</li>'+
'<div class="cl"></div>'+
'<li class="ur_item new_answer">'+
'<label class="ml50">问题<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>'+
'<input placeholder="请输入主观题分题的问题" class="w520" type="text" name="question_answer[1]">'+
'<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a> </li>'+
'<div class="cl"></div>'+
'</ul>'+
'<ul>'+
'<li class="ur_item">'+
'<div class="dash-block new-subjective w520" onclick="add_multi_question($(this))">新建选项</div>'+
'</li>'+
'<div class="cl"></div>'+
'</ul>'+
'</div>'+
'<div class="ur_editor_footer">'+
'<a class="grey_btn fr borderRadius" data-button="cancel" onclick="$(this).parent().parent().parent().remove();">'+
'<%= l(:button_cancel)%>'+
'</a>'+
'</div>'+
'<div class="cl"></div>'+
'</div>'+
'<% end%>'
);
$("#poll_questions_title").focus();
$("#add_new_question").one('click', function(){
add_poll_question($(this));
});
'<a class="blue_btn fr borderRadius mr5" data-button="ok" id="add_new_question">'+
'<%= l(:label_button_ok)%>'+
'</a>'+
'</div>'+
'<div class="cl"></div>'+
'</div>'+
'<% end%>'
);
$("#poll_questions_title").focus();
$("#add_new_question").one('click', function(){
add_poll_question($(this));
});
}
}
else {
$("#insert_new_poll_question_"+quest_type+"_"+quest_id).html("");
}
}
//选择导入调查问卷
@ -290,7 +391,7 @@ function insert_MCQ(quest_type,quest_num,quest_id){
if(title.length == 0){
alert("标题不能为空");
doc.one('click', function(){
add_poll_question($(this));
add_poll_question_new($(this));
});
}else{
doc.parent().parent().parent().submit();
@ -307,7 +408,7 @@ function insert_MCQ(quest_type,quest_num,quest_id){
function pollsCancel(){$("#polls_head_edit").hide();$("#polls_head_show").show();}
function pollsSubmit(doc){
var title = $.trim($("#polls_title").val());
if(title.length == 0){alert("问卷标题不能为空");}else{doc.parent().parent().parent().submit();}
if(title.length == 0){alert("问卷标题不能为空");}else{doc.parent().parent().submit();}
}
function pollsEdit(){$("#polls_head_edit").show();$("#polls_head_show").hide();}
//
@ -320,57 +421,89 @@ function insert_MCQ(quest_type,quest_num,quest_id){
$("#edit_poll_questions_"+question_id).show();
$("#poll_questions_title_"+question_id).focus();
}
//多行主观增加分题
function add_multi_question(doc)
{
doc.parent().parent().prev().append("<li class='ur_item new_answer'><label class='ml50'>问题<span class='ur_index'></span>&nbsp;&nbsp;&nbsp;</label><input maxlength='200' style='width:520px;' type='text' name='question_answer["+new Date().getTime()+"]' placeholder='请输入主观题分题的问题'/>" +
"<a class='icon_remove' title='删除' onclick='remove_single_answer($(this))'></a>"+
"</li><div class='cl'></div>");
}
//单选题
function add_single_answer(doc)
{
doc.parent().after("<li class='ur_item'><label>选项<span class='ur_index'></span>&nbsp;&nbsp;&nbsp;</label><input maxlength='200' type='text' name='question_answer["+new Date().getTime()+"]' placeholder='新建选项'/>" +
"<a class='icon_add' title='向下插入选项' onclick='add_single_answer($(this));'></a><a class='icon_remove' title='删除' onclick='remove_single_answer($(this))'></a>"+
"</li><div class='cl'></div>");
if (doc.parent().parent().prev().children('li:last').hasClass('other_answer')) {
doc.parent().parent().prev().children('li:last').before("<li class='ur_item new_answer'><label>选项<span class='ur_index'></span>&nbsp;&nbsp;&nbsp;</label><input maxlength='200' type='text' name='question_answer["+new Date().getTime()+"]' placeholder='输入选项内容'/>" +
"<a class='icon_remove' title='删除' onclick='remove_single_answer($(this))'></a>"+
"</li><div class='cl'></div>");
} else {
doc.parent().parent().prev().append("<li class='ur_item new_answer'><label>选项<span class='ur_index'></span>&nbsp;&nbsp;&nbsp;</label><input maxlength='200' type='text' name='question_answer["+new Date().getTime()+"]' placeholder='输入选项内容'/>" +
"<a class='icon_remove' title='删除' onclick='remove_single_answer($(this))'></a>"+
"</li><div class='cl'></div>");
}
// doc.parent().before("<li class='ur_item new_answer'><label>选项<span class='ur_index'></span>&nbsp;&nbsp;&nbsp;</label><input maxlength='200' type='text' name='question_answer["+new Date().getTime()+"]' placeholder='输入选项内容'/>" +
// "<a class='icon_remove' title='删除' onclick='remove_single_answer($(this))'></a>"+
// "</li><div class='cl'></div>");
}
function remove_single_answer(doc)
{
if(doc.parent().siblings("li").length == 0)
if(doc.parent().siblings("li.new_answer").length == 0)
{
alert("选择题至少有一个选项");
alert("至少有一个选项");
}
else
{
doc.parent().remove();
}
}
//其他选项
function add_other_answer(doc)
{
if(doc.parent().parent().prev().children('li.other_answer').length == 0) {
doc.parent().parent().prev().append("<li class='ur_item new_answer other_answer'><label>其它<span class='ur_index'></span>&nbsp;&nbsp;&nbsp;</label><input maxlength='200' type='text' style='background-color:#f5f5f5;' readonly='readonly' name='question_other_answer' placeholder='由参加问卷的人输入内容'/>" +
"<a class='icon_remove' title='删除' onclick='remove_single_answer($(this))'></a>"+
"</li><div class='cl'></div>");
}
}
function poll_cancel()
{
var htmlvalue = "<%= escape_javascript(render :partial => 'cancel_poll', locals: {:poll => @poll}) %>";
pop_box_new(htmlvalue,460,190);
}
function poll_save()
{
var forms = $("form.new_poll_question");
if($("#polls_head_edit").is(":visible")){
alert("请先保存问卷标题及问卷描述。");
}else if(forms.length > 0){
alert("请先保存正在编辑的题目。");
} else {
window.location.href = "<%=edit_poll_path(@poll) %>";
}
}
function poll_submit()
{
var title = $.trim($("#polls_name_h").html());
if(title.length == 0)
{
alert("问卷标题不能为空");
}
else{
var forms = $("form.new_poll_question");
if($("#polls_head_edit").is(":visible")){
alert("请先保存问卷标题及问卷描述。");
}else if(forms.length > 0){
alert("请先保存正在编辑的题目再发布。");
} else{
if($("#show_result").is(":checked")) {
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'poll_submit', locals: { :poll => @poll,:is_remote => false,:show_result=> 1}) %>');
var htmlvalue = "<%= 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}) %>');
var htmlvalue = "<%= 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();
$('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" +
"<a href='javascript:' onclick='clickCanel();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>");
$('#ajax-modal').parent().removeClass("alert_praise");
$('#ajax-modal').parent().css("top","").css("left","").css("border","3px solid #269ac9");
$('#ajax-modal').parent().addClass("popbox_polls");
pop_box_new(htmlvalue,460,190);
}
}
</script>
<div class="courseRSide fl">
<div class=" polls_content polls_edit" id="polls">
<div class="homepageRight mt0 ml10">
<div class="resources" id="polls">
<!-- 头部 -->
<div id="polls_head_show" style="display: none;">
<div id="polls_head_show" style="<%=@poll.polls_name == "" ? 'display: none;' : '' %>">
<%= render :partial => 'show_head', :locals => {:poll => @poll}%>
</div>
<div id="polls_head_edit">
<div id="polls_head_edit" style="<%=@poll.polls_name == "" ? '' : 'display: none;' %>">
<%= render :partial => 'edit_head', :locals => {:poll => @poll}%>
</div>
@ -379,9 +512,10 @@ function insert_MCQ(quest_type,quest_num,quest_id){
<%= render :partial => 'poll_content', :locals => {:poll => @poll}%>
</div>
<div class="tabs">
<ul class="tabs_list">
<li class="tab_item02 " >
<div class="testQuestion">
<span class="fl mt10 mr18">题型</span>
<ul class="tabs_list fl">
<li class="tab_item02 ">
<a title="<%= l(:label_MC) %>" class="tab_icon icon_radio" onclick="add_MC();">
<%= l(:label_MC) %>
</a>
@ -409,14 +543,23 @@ function insert_MCQ(quest_type,quest_num,quest_id){
<div id="new_poll_question_new">
</div>
<div class="ur_buttons">
<a class="ur_button_submit" onclick="poll_submit();">
<%= l(:label_memo_create)%>
</a>
<div class="polls_cha">
<input id="show_result" type="checkbox" checked name="show_result" value="1" >
<label for="">允许学生查看调查结果</label>
</div>
<!--<div class="ur_buttons">-->
<!--<a class="ur_button_submit" onclick="poll_submit();">-->
<!--<%= l(:label_memo_create)%>-->
<!--</a>-->
<!--<div class="polls_cha">-->
<!--<input id="show_result" type="checkbox" checked name="show_result" value="1" >-->
<!--<label for="">允许学生查看调查结果</label>-->
<!--</div>-->
<!--</div>-->
<div class="tac">
<input name="show_result" value="1" type="checkbox" checked id="show_result">
<label for="">允许学生查看调查结果</label>
</div>
<div>
<a href="javascript:void(0);" onclick="poll_cancel();" class="grey_btn fr borderRadius">取消</a>
<a href="javascript:void(0);" onclick="poll_save();" class="blue_btn fr borderRadius mr5">保存</a>
<a href="javascript:void(0);" onclick="poll_submit();" class="blue_btn fr borderRadius mr5" >发布</a>
</div>
<div class="cl"></div>
<!-- 新增问题 -->

View File

@ -1,29 +1,23 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript">
function clickCanel(){hideModal("#popbox02");}
</script>
</head>
<body>
<div id="popbox02">
<div class="upload_con">
<div class="upload_box">
<p class="polls_box_p">问卷发布后将不能对问卷进行修改,
<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">问卷发布后将不能对问卷进行修改,
<br />
是否确定发布该问卷?
</p>
<div class="polls_btn_box">
<%= link_to "确 定",publish_poll_poll_path(poll.id,:is_remote => is_remote,:show_result => show_result), :class => "upload_btn", :onclick => "clickCanel();" %>
<a class="upload_btn upload_btn_grey" onclick="clickCanel();">
取&nbsp;&nbsp;消
</a>
</div>
</li>
<li>
<label class="mr70">&nbsp;</label>
<%= link_to('确 定', publish_poll_poll_path(poll.id,:is_remote => is_remote,:show_result => show_result), :class => "sy_btn_blue fl") %>
<a href="javascript:void(0);" class="sy_btn_grey fl ml20" onclick="hideModal()">取&nbsp;&nbsp;消</a>
<div class="cl"></div>
</div>
</div>
</li>
</ul>
</div>
</body>
</html>

View File

@ -1,33 +1,34 @@
<script>
</script>
<div class="ur_question_item radio ur_editor02">
<div class="ur_title">
<span class="title_index">
第<%= poll_question.question_number%>题:
</span>
<div>
<div class="testEditTitle">
第<%= poll_question.question_number%>题:
<%= poll_question.question_title %>
<span class="title_index">[单选题]</span>
<%if poll_question.is_necessary == 1%>
<span class="ur_required" title="必答">*</span>
<span class="c_red ml5" title="必答">*</span>
<%end%>
</div>
<%= link_to("", delete_poll_question_poll_index_path(:poll_question => poll_question.id),
method: :delete, :confirm => l(:text_are_you_sure), :remote => true, :class => "ur_icon_de") %>
<a class="ur_icon_edit" title="编辑" onclick="pollQuestionEdit(<%= poll_question.id%>);"></a>
<a class='ur_icon_add' title='向下插入' id="add_mc_<%=poll_question.id%>" onclick="chooseQuestionType('mc',<%=poll_question.id%>);"></a>
<a class='ur_icon_add' title='向下插入' id="add_mc_<%=poll_question.id%>" onclick="dismiss('mc',<%=poll_question.id%>);insert_MC('mc',<%=poll_question.question_number%>,<%=poll_question.id%>);"></a>
<div class="cl"></div>
<div class="ur_inputs">
<table class="ur_table" >
<table class="ur_table" style="width:675px;">
<tbody>
<% poll_question.poll_answers.reorder("answer_position").each do |poll_answer| %>
<tr>
<td>
<label>
<input class="ur_radio" type="radio" name="<%= poll_question %>" value="<%= poll_answer.answer_text%>" >
<%= poll_answer.answer_text%>
</label>
<% if poll_answer.answer_text != '' %>
<label>
<input class="ur_radio" type="radio" name="<%= poll_question %>" value="<%= poll_answer.answer_text%>" >
<%= poll_answer.answer_text%>
</label>
<% else %>
<label>
<input class="ur_radio" name="<%= poll_question %>" value="" type="radio">
</label>
<input placeholder="其它" readonly="readonly" class="disabled questionnaire-input w300" type="text">
<% end %>
</td>
</tr>
<% end %>
@ -38,11 +39,3 @@
<!-- 新增问题 -->
<div id="insert_new_poll_question_mc_<%=poll_question.id%>">
</div>
<div id="div_mc_<%=poll_question.id%>" style="width: 50px;border: 1px solid #cbcbcb; display:none;position: absolute;padding: 5px;background: white">
<ul>
<li><a href="javascript:void(0);" onclick=" dismiss('mc',<%=poll_question.id%>);insert_MC('mc',<%=poll_question.question_number%>,<%=poll_question.id%>);">单选</a></li>
<li><a href="javascript:void(0);" onclick=" dismiss('mc',<%=poll_question.id%>);insert_MCQ('mc',<%=poll_question.question_number%>,<%=poll_question.id%>);">多选</a></li>
<li><a href="javascript:void(0);" onclick=" dismiss('mc',<%=poll_question.id%>);insert_SINGLE('mc',<%=poll_question.question_number%>,<%=poll_question.id%>);">单行主观</a></li>
<li><a href="javascript:void(0);" onclick=" dismiss('mc',<%=poll_question.id%>);insert_MULIT('mc',<%=poll_question.question_number%>,<%=poll_question.id%>);">多行主观</a></li>
</ul>
</div>

View File

@ -1,10 +1,7 @@
<div class="ur_question_item checkbox ur_editor02">
<div class="ur_title">
<span class="title_index">
第<%= poll_question.question_number%>题:
</span>
<div>
<div class="testEditTitle">
第<%= poll_question.question_number%>题:
<%= poll_question.question_title %>
<span class="title_index">[多选题]</span>
<%if poll_question.is_necessary == 1%>
<span class="ur_required" title="必答">*</span>
<%end%>
@ -12,18 +9,25 @@
<%= link_to("", delete_poll_question_poll_index_path(:poll_question => poll_question.id),
method: :delete, :confirm => l(:text_are_you_sure), :remote => true, :class => "ur_icon_de") %>
<a class="ur_icon_edit" title="编辑" onclick="pollQuestionEdit(<%= poll_question.id%>);"></a>
<a class='ur_icon_add' title='向下插入' id="add_mcq_<%=poll_question.id%>" onclick="chooseQuestionType('mcq',<%=poll_question.id%>);"></a>
<a class='ur_icon_add' title='向下插入' id="add_mcq_<%=poll_question.id%>" onclick="dismiss('mcq',<%=poll_question.id%>);insert_MCQ('mcq',<%=poll_question.question_number%>,<%=poll_question.id%>);"></a>
<div class="cl"></div>
<div class="ur_inputs">
<table class="ur_table">
<div class="ur_inputs" style="width:675px;">
<table class="ur_table" style="width:675px;">
<tbody>
<% poll_question.poll_answers.reorder("answer_position").each do |poll_answer| %>
<tr>
<td>
<label>
<input class="ur_radio" type="checkbox" name="<%= poll_question %>" value="<%= poll_answer.answer_text%>" >
<%= poll_answer.answer_text%>
</label>
<% if poll_answer.answer_text != '' %>
<label>
<input class="ur_radio" type="checkbox" name="<%= poll_question %>" value="<%= poll_answer.answer_text%>" >
<%= poll_answer.answer_text%>
</label>
<% else %>
<label>
<input class="ur_radio" name="<%= poll_question %>" value="" type="checkbox">
</label>
<input placeholder="其它" readonly="readonly" class="disabled questionnaire-input w300" type="text">
<% end %>
</td>
</tr>
<% end %>
@ -33,12 +37,4 @@
</div><!--多选题显示 end-->
<!-- 新增问题 -->
<div id="insert_new_poll_question_mcq_<%=poll_question.id%>">
</div>
<div id="div_mcq_<%=poll_question.id%>" style="width: 50px;border: 1px solid #cbcbcb; display:none;position: absolute;padding: 5px;background: white">
<ul>
<li><a href="javascript:void(0);" onclick=" dismiss('mcq',<%=poll_question.id%>);insert_MC('mcq',<%=poll_question.question_number%>,<%=poll_question.id%>);">单选</a></li>
<li><a href="javascript:void(0);" onclick=" dismiss('mcq',<%=poll_question.id%>);insert_MCQ('mcq',<%=poll_question.question_number%>,<%=poll_question.id%>);">多选</a></li>
<li><a href="javascript:void(0);" onclick=" dismiss('mcq',<%=poll_question.id%>);insert_SINGLE('mcq',<%=poll_question.question_number%>,<%=poll_question.id%>);">单行主观</a></li>
<li><a href="javascript:void(0);" onclick=" dismiss('mcq',<%=poll_question.id%>);insert_MULIT('mcq',<%=poll_question.question_number%>,<%=poll_question.id%>);">多行主观</a></li>
</ul>
</div>

View File

@ -1,26 +1,25 @@
<li class="ur_question_item checkbox">
<div class="ur_title">
<span class="title_index">
第<%= poll_question.question_number%>题:
</span>
<div>
<div class="testEditTitle">
第<%= poll_question.question_number%>题:
<%= poll_question.question_title %>
<span class="title_index">[多选题]</span>
<%if poll_question.is_necessary == 1%>
<span class="ur_required" title="必答">*</span>
<%end%>
</div>
<div class="cl"></div>
<div class="ur_inputs">
<table class="ur_table">
<table class="ur_table" style="width:675px;">
<tbody>
<% poll_question.poll_votes.where("user_id = #{User.current.id}").each do |answer|%>
<tr>
<td>
<%= answer.poll_answer.answer_text %>
<p class="ml20">
<%= answer.poll_answer.answer_text == "" ? (answer.vote_text.nil? ? "其他" : answer.vote_text) : answer.poll_answer.answer_text %>
</p>
</td>
</tr>
<% end%>
</tbody>
</table>
</div>
</li><!--多选题 end-->
</div><!--多选题 end-->

View File

@ -1,22 +1,21 @@
<li class="ur_question_item radio">
<div class="ur_title">
<span class="title_index">
第<%= poll_question.question_number%>题:
</span>
<div>
<div class="testEditTitle">
第<%= poll_question.question_number%>题:
<%= poll_question.question_title %>
<span class="title_index">[单选题]</span>
<%if poll_question.is_necessary == 1%>
<span class="ur_required" title="必答">*</span>
<%end%>
</div>
<div class="cl"></div>
<div class="ur_inputs">
<table class="ur_table" >
<table class="ur_table" style="width:675px;">
<tbody>
<% poll_question.poll_votes.where("user_id = #{User.current.id}").each do |answer|%>
<tr>
<td>
<%= answer.poll_answer.answer_text %>
<p class="ml20">
<%= answer.poll_answer.answer_text == "" ? (answer.vote_text.nil? ? "其他" : answer.vote_text) : answer.poll_answer.answer_text %>
</p>
</td>
</tr>
<% end%>
@ -24,4 +23,4 @@
</tbody>
</table>
</div>
</li><!--单选题 end-->
</div><!--单选题 end-->

View File

@ -1,9 +1,7 @@
<div class="ur_page_head ur_editor02" ><!--头部显示 start-->
<a href="javascript:" class="ur_icon_edit" title="编辑" onclick="pollsEdit();"></a>
<div class="testStatus" ><!--头部显示 start-->
<a href="javascript:" class="testEdit" title="编辑" onclick="pollsEdit();"></a>
<!-- <a class='ur_icon_add' title='导入' id="import_btn" onclick="importPoll();"></a> -->
<h1 class="ur_page_title" id="polls_name_h"><%= poll.polls_name%></h1>
<%= @poll.polls_description.nil? ? "" : @poll.polls_description.html_safe%>
<div class="testDesEdit mt5"><%= @poll.polls_description.nil? ? "" : @poll.polls_description.html_safe%></div>
<div class="cl"></div>
</div><!--头部显示 end-->

View File

@ -1,33 +1,23 @@
<div class="ur_question_item textarea ur_editor02">
<div class="ur_preview">
<div class="ur_title">
<span class="title_index">
第<%= poll_question.question_number%>题:
</span>
<%= poll_question.question_title %>
<span class="title_index">[多行主观]</span>
<%if poll_question.is_necessary == 1%>
<span class="ur_required" title="必答">*</span>
<%end%>
</div>
<%= link_to("", delete_poll_question_poll_index_path(:poll_question => poll_question.id),
method: :delete, :confirm => l(:text_are_you_sure), :remote => true, :class => "ur_icon_de") %>
<a class="ur_icon_edit" title="编辑" onclick="pollQuestionEdit(<%= poll_question.id%>);"></a>
<a class='ur_icon_add' title='向下插入' id="add_mulit_<%=poll_question.id%>" onclick="chooseQuestionType('mulit',<%=poll_question.id%>);"></a>
<div class="cl"></div>
<div class="ur_inputs">
<textarea class="ur_textbox" rows="5" cols="60"></textarea>
</div>
<div>
<div class="testEditTitle">
第<%= poll_question.question_number%>题:
<%= poll_question.question_title %>
<%if poll_question.is_necessary == 1%>
<span class="ur_required" title="必答">*</span>
<%end%>
</div>
<%= link_to("", delete_poll_question_poll_index_path(:poll_question => poll_question.id),
method: :delete, :confirm => l(:text_are_you_sure), :remote => true, :class => "ur_icon_de") %>
<a class="ur_icon_edit" title="编辑" onclick="pollQuestionEdit(<%= poll_question.id%>);"></a>
<a class='ur_icon_add' title='向下插入' id="add_mulit_<%=poll_question.id%>" onclick="dismiss('mulit',<%=poll_question.id%>);insert_MULIT('mulit',<%=poll_question.question_number%>,<%=poll_question.id%>);"></a>
<div class="cl"></div>
<% poll_question.poll_answers.reorder("answer_position").each_with_index do |poll_answer, i| %>
<div class="ml40 mb10">
<p class="mb10"><%= i + 1 %>.<%= poll_answer.answer_text%></p>
<input type="text" class="questionnaire-input" name="<%= poll_question %>" style="width:652px;" />
</div>
<% end %>
</div><!--多行展示 end-->
<!-- 新增问题 -->
<div id="insert_new_poll_question_mulit_<%=poll_question.id%>">
</div>
<div id="div_mulit_<%=poll_question.id%>" style="width: 50px;border: 1px solid #cbcbcb; display:none;position: absolute;padding: 5px;background: white">
<ul>
<li><a href="javascript:void(0);" onclick=" dismiss('mulit',<%=poll_question.id%>);insert_MC('mulit',<%=poll_question.question_number%>,<%=poll_question.id%>);">单选</a></li>
<li><a href="javascript:void(0);" onclick=" dismiss('mulit',<%=poll_question.id%>);insert_MCQ('mulit',<%=poll_question.question_number%>,<%=poll_question.id%>);">多选</a></li>
<li><a href="javascript:void(0);" onclick=" dismiss('mulit',<%=poll_question.id%>);insert_SINGLE('mulit',<%=poll_question.question_number%>,<%=poll_question.id%>);">单行主观</a></li>
<li><a href="javascript:void(0);" onclick=" dismiss('mulit',<%=poll_question.id%>);insert_MULIT('mulit',<%=poll_question.question_number%>,<%=poll_question.id%>);">多行主观</a></li>
</ul>
</div>

View File

@ -1,20 +1,18 @@
<li class="ur_question_item textarea">
<div class="ur_preview">
<div class="ur_title">
<span class="title_index">
第<%= poll_question.question_number%>题:
</span>
<%= poll_question.question_title %>
<span class="title_index">[多行主观]</span>
<%if poll_question.is_necessary == 1%>
<span class="ur_required" title="必答">*</span>
<%end%>
</div>
<div class="cl"></div>
<div class="ur_inputs">
<p>
<%= get_anwser_vote_text(poll_question.id,User.current.id).html_safe%>
</p>
</div>
<div>
<div class="testEditTitle">
第<%= poll_question.question_number%>题:
<%= poll_question.question_title %>
<%if poll_question.is_necessary == 1%>
<span class="ur_required" title="必答">*</span>
<%end%>
</div>
<div class="cl"></div>
<% poll_question.poll_answers.reorder("answer_position").each_with_index do |poll_answer, i| %>
<div class="ml40 mb10">
<p class="mb10"><%= i + 1 %>.<%= poll_answer.answer_text%></p>
<p class="ml20">
<%= get_anwser_vote_text(poll_question.id,User.current.id,poll_answer.id).html_safe%>
</p>
</div>
</li><!--多行输入 end-->
<% end %>
</div>

View File

@ -1,10 +1,7 @@
<div class="ur_question_item text ur_editor02 ">
<div class="ur_title">
<span class="title_index">
第<%= poll_question.question_number%>题:
</span>
<div>
<div class="testEditTitle">
第<%= poll_question.question_number%>题:
<%= poll_question.question_title %>
<span class="title_index">[单行主观]</span>
<%if poll_question.is_necessary == 1%>
<span class="ur_required" title="必答">*</span>
<%end%>
@ -12,20 +9,12 @@
<%= link_to("", delete_poll_question_poll_index_path(:poll_question => poll_question.id),
method: :delete, :confirm => l(:text_are_you_sure), :remote => true, :class => "ur_icon_de") %>
<a class="ur_icon_edit" title="编辑" onclick="pollQuestionEdit(<%= poll_question.id%>);"></a>
<a class='ur_icon_add' title='向下插入' id="add_single_<%=poll_question.id%>" onclick="chooseQuestionType('single',<%=poll_question.id%>);"></a>
<a class='ur_icon_add' title='向下插入' id="add_single_<%=poll_question.id%>" onclick="dismiss('single',<%=poll_question.id%>);insert_SINGLE('single',<%=poll_question.question_number%>,<%=poll_question.id%>);"></a>
<div class="cl"></div>
<div class="ur_inputs">
<input class="ur_text ur_textbox" type="text" size="" maxlength=""value="">
<input class="questionnaire-input" type="text" size="" maxlength="" value="" style="width:692px;">
</div>
</div><!--单行文字展示 end-->
<!-- 新增问题 -->
<div id="insert_new_poll_question_single_<%=poll_question.id%>">
</div>
<div id="div_single_<%=poll_question.id%>" style="width: 50px;border: 1px solid #cbcbcb; display:none;position: absolute;padding: 5px;background: white">
<ul>
<li><a href="javascript:void(0);" onclick=" dismiss('single',<%=poll_question.id%>);insert_MC('single',<%=poll_question.question_number%>,<%=poll_question.id%>);">单选</a></li>
<li><a href="javascript:void(0);" onclick=" dismiss('single',<%=poll_question.id%>);insert_MCQ('single',<%=poll_question.question_number%>,<%=poll_question.id%>);">多选</a></li>
<li><a href="javascript:void(0);" onclick=" dismiss('single',<%=poll_question.id%>);insert_SINGLE('single',<%=poll_question.question_number%>,<%=poll_question.id%>);">单行主观</a></li>
<li><a href="javascript:void(0);" onclick=" dismiss('single',<%=poll_question.id%>);insert_MULIT('single',<%=poll_question.question_number%>,<%=poll_question.id%>);">多行主观</a></li>
</ul>
</div>

View File

@ -1,18 +1,15 @@
<li class="ur_question_item text">
<div class="ur_title">
<span class="title_index">
第<%= poll_question.question_number%>题:
</span>
<div>
<div class="testEditTitle">
第<%= poll_question.question_number%>题:
<%= poll_question.question_title %>
<span class="title_index">[单行主观]</span>
<%if poll_question.is_necessary == 1%>
<span class="ur_required" title="必答">*</span>
<%end%>
</div>
<div class="cl"></div>
<div class="ur_inputs">
<p>
<p class="ml20">
<%= get_anwser_vote_text poll_question.id,User.current.id%>
</p>
</div>
</li><!--当行输入 end-->
</div><!--当行输入 end-->

View File

@ -1,30 +1,42 @@
<% if @is_insert %>
$("#poll_content").html('<%= escape_javascript(render :partial => 'poll_content', :locals => {:poll => @poll})%>');
$("#poll_content").html('<%= escape_javascript(render :partial => 'poll_content', :locals => {:poll => @poll})%>');
<% else %>
$("#new_poll_question_new").html("");
$("#poll_content").append("<div id='poll_questions_<%= @poll_questions.id%>'>" +
"<div id='show_poll_questions_<%= @poll_questions.id %>'>" +
"<% if @poll_questions.question_type == 1%>" +
$("#new_poll_question_new").html("");
<%if @poll_questions.question_type == 1%>
$("#mc_question_list").show().append("<div id='poll_questions_<%= @poll_questions.id%>'>" +
"<div id='show_poll_questions_<%= @poll_questions.id %>'>" +
"<%= escape_javascript(render :partial => 'show_MC', :locals => {:poll_question => @poll_questions}) %>" +
"<% elsif @poll_questions.question_type == 2%>" +
"<%= escape_javascript(render :partial => 'show_MCQ', :locals => {:poll_question => @poll_questions}) %>" +
"<% elsif @poll_questions.question_type == 3%>" +
"<%= escape_javascript(render :partial => 'show_single', :locals => {:poll_question => @poll_questions}) %>" +
"<% elsif @poll_questions.question_type == 4%>" +
"<%= escape_javascript(render :partial => 'show_mulit', :locals => {:poll_question => @poll_questions}) %>" +
"<% end%>" +
"</div>" +
"<div id='edit_poll_questions_<%= @poll_questions.id %>' style='display: none;'>" +
"<% if @poll_questions.question_type == 1%>" +
"</div>" +
"<div id='edit_poll_questions_<%= @poll_questions.id %>' style='display: none;'>" +
"<%= escape_javascript(render :partial => 'edit_MC', :locals => {:poll_question => @poll_questions}) %>" +
"<% elsif @poll_questions.question_type == 2%>" +
"</div>" +
"</div>");
<%elsif @poll_questions.question_type == 2%>
$("#mcq_question_list").show().append("<div id='poll_questions_<%= @poll_questions.id%>'>" +
"<div id='show_poll_questions_<%= @poll_questions.id %>'>" +
"<%= escape_javascript(render :partial => 'show_MCQ', :locals => {:poll_question => @poll_questions}) %>" +
"</div>" +
"<div id='edit_poll_questions_<%= @poll_questions.id %>' style='display: none;'>" +
"<%= escape_javascript(render :partial => 'edit_MCQ', :locals => {:poll_question => @poll_questions}) %>" +
"<% elsif @poll_questions.question_type == 3%>" +
"</div>" +
"</div>");
<%elsif @poll_questions.question_type == 3%>
$("#single_question_list").show().append("<div id='poll_questions_<%= @poll_questions.id%>'>" +
"<div id='show_poll_questions_<%= @poll_questions.id %>'>" +
"<%= escape_javascript(render :partial => 'show_single', :locals => {:poll_question => @poll_questions}) %>" +
"</div>" +
"<div id='edit_poll_questions_<%= @poll_questions.id %>' style='display: none;'>" +
"<%= escape_javascript(render :partial => 'edit_single', :locals => {:poll_question => @poll_questions}) %>" +
"<% elsif @poll_questions.question_type == 4%>" +
"</div>" +
"</div>");
<%elsif @poll_questions.question_type == 4%>
$("#multi_question_list").show().append("<div id='poll_questions_<%= @poll_questions.id%>'>" +
"<div id='show_poll_questions_<%= @poll_questions.id %>'>" +
"<%= escape_javascript(render :partial => 'show_mulit', :locals => {:poll_question => @poll_questions}) %>" +
"</div>" +
"<div id='edit_poll_questions_<%= @poll_questions.id %>' style='display: none;'>" +
"<%= escape_javascript(render :partial => 'edit_mulit', :locals => {:poll_question => @poll_questions}) %>" +
"<% end%>" +
"</div>" +
"</div>");
"</div>" +
"</div>");
<% end %>
<% end %>

View File

@ -1,34 +1,57 @@
<%= stylesheet_link_tag 'polls', :media => 'all' %>
<div class="polls_content polls_box break_word">
<div class="ur_page_head" >
<h1 class="ur_page_title">
<%= @poll.polls_name.empty? ? l(:label_poll_new) : @poll.polls_name %>
</h1>
<%= @poll.polls_description.nil? ? "" : @poll.polls_description.html_safe%>
<div class="homepageRight mt0 ml10">
<div class="resources" >
<div class="testStatus">
<h1 class="ur_page_title">
<%= @poll.polls_name.empty? ? l(:label_poll_new) : @poll.polls_name %>
</h1>
<div class="testDesEdit mt5"><%= @poll.polls_description.nil? ? "" : @poll.polls_description.html_safe%></div>
</div>
<% mc_question_list = @poll.poll_questions.where("question_type=1") %>
<% mcq_question_list = @poll.poll_questions.where("question_type=2") %>
<% single_question_list = @poll.poll_questions.where("question_type=3") %>
<% multi_question_list = @poll.poll_questions.where("question_type=4") %>
<div class="testStatus" id="mc_question_list" style="display: <%=mc_question_list.count > 0 ? "" : "none" %>">
<h3 class="fontGrey3">单选题</h3>
<% mc_question_list.each do |poll_question| %>
<div id="poll_questions_<%= poll_question.id%>">
<div id="show_poll_questions_<%= poll_question.id %>">
<%= render :partial => 'show_MC_result', :locals => {:poll_question => poll_question} %>
</div>
</div>
<% end %>
</div>
<div class="testStatus" id="mcq_question_list" style="display: <%=mcq_question_list.count > 0 ? "" : "none" %>">
<h3 class="fontGrey3">多选题</h3>
<% mcq_question_list.each do |poll_question| %>
<div id="poll_questions_<%= poll_question.id%>">
<div id="show_poll_questions_<%= poll_question.id %>">
<%= render :partial => 'show_MCQ_result', :locals => {:poll_question => poll_question} %>
</div>
</div>
<% end %>
</div>
<div class="testStatus" id="single_question_list" style="display: <%=single_question_list.count > 0 ? "" : "none" %>">
<h3 class="fontGrey3">单行主观题</h3>
<% single_question_list.each do |poll_question| %>
<div id="poll_questions_<%= poll_question.id%>">
<div id="show_poll_questions_<%= poll_question.id %>">
<%= render :partial => 'show_single_result', :locals => {:poll_question => poll_question} %>
</div>
</div>
<% end %>
</div>
<div class="testStatus" id="multi_question_list" style="display: <%=multi_question_list.count > 0 ? "" : "none" %>">
<h3 class="fontGrey3">多行主观题</h3>
<% multi_question_list.each do |poll_question| %>
<div id="poll_questions_<%= poll_question.id%>">
<div id="show_poll_questions_<%= poll_question.id %>">
<%= render :partial => 'show_mulit_result', :locals => {:poll_question => poll_question} %>
</div>
</div>
<% end %>
</div>
<div class="ur_card">
<ol class="ur_questions">
<% @poll_questions.each do |poll_question|%>
<% if poll_question.question_type == 1%>
<%= render :partial => 'show_MC_result', :locals => {:poll_question => poll_question} %>
<% elsif poll_question.question_type == 2%>
<%= render :partial => 'show_MCQ_result', :locals => {:poll_question => poll_question} %>
<% elsif poll_question.question_type == 3%>
<%= render :partial => 'show_single_result', :locals => {:poll_question => poll_question} %>
<% elsif poll_question.question_type == 4%>
<%= render :partial => 'show_mulit_result', :locals => {:poll_question => poll_question} %>
<% end%>
<% end%>
</ol>
</div> <!--ur_cards end-->
<div class="cl"></div>
<!-- 分页 -->
<div class="polls_content" id="polls">
<ul class="wlist">
<%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true%>
</ul>
<div class="cl"></div>
</div>
</div><!--问卷内容end-->

View File

@ -1,225 +1,298 @@
<%= stylesheet_link_tag 'polls', :media => 'all' %>
<div class="courseRSide fl">
<div class="polls_content polls_box" id="polls">
<div class="ur_page_head" >
<div class="homepageRight mt0 ml10">
<div class="resources" id="polls">
<div class="testStatus" >
<h1 class="ur_page_title">
<%= @poll.polls_name%>
</h1>
<%= @poll.polls_description.nil? ? "" : @poll.polls_description.html_safe%>
<div class="testDesEdit mt5"><%= @poll.polls_description.nil? ? "" : @poll.polls_description.html_safe%></div>
</div>
<div class="ur_card">
<ol class="ur_questions">
<% @poll_questions.each do |pq| %>
<% if pq.question_type == 1 %>
<!-- 单选题 -->
<li class="ur_question_item radio">
<div class="ur_title">
<span class="title_index"><%= l(:label_question_number,:question_number => pq.question_number) %></span>
<%= pq.question_title %>
<span class="title_index">[单选题]</span>
<% if pq.is_necessary == 1 %>
<span class="ur_required" title="<%= l(:label_must_answer) %>">*</span>
<% end %>
</div>
<div class="cl"></div>
<div class="ur_inputs">
<form>
<table class="ur_table" >
<tbody>
<% pq.poll_answers.each do |pa| %>
<tr>
<td>
<label >
<script>
function click_<%= pa.id %>(obj)
{
$.ajax({
type: "post",
url: "<%= commit_answer_poll_path(@poll) %>",
data: {
poll_answer_id: <%= pa.id %>,
poll_question_id: <%= pq.id %>
},
success: function (data) {
var dataObj = eval(data);
obj.checked = true;
var span = $('#percent');
span.html(dataObj.percent);
}
});
}
</script>
<%= radio_button "poll_vote","poll_answer_id",pa.id,:class=>"ur_radio",:onclick =>"click_#{pa.id}(this);return false;",:checked => answer_be_selected?(pa,User.current),:disabled => !@can_edit_poll %>
<%= pa.answer_text %>
</label>
</td>
</tr>
<% end %>
</tbody>
</table>
</form>
</div>
</li>
<% elsif pq.question_type == 2 %>
<!-- 多选题 -->
<li class="ur_question_item checkbox">
<div class="ur_title">
<span class="title_index"><%= l(:label_question_number,:question_number => pq.question_number) %></span>
<%= pq.question_title %>
<span class="title_index">[多选题]</span>
<% if pq.is_necessary == 1 %>
<span class="ur_required" title="<%= l(:label_must_answer) %>">*</span>
<% end %>
</div>
<div class="cl"></div>
<div class="ur_inputs">
<form>
<table class="ur_table" >
<tbody>
<% pq.poll_answers.each do |pa| %>
<tr>
<td>
<label >
<script>
function click_<%= pa.id %>(obj)
{
$.ajax({
type: "post",
url: "<%= commit_answer_poll_path(@poll) %>",
data: {
poll_answer_id: <%= pa.id %>,
poll_question_id: <%= pq.id %>
},
success: function (data) {
var dataObj = eval(data);
if(dataObj.text == "true")
{
obj.checked = true;
}
else
{
obj.checked = false;
}
var span = $('#percent');
span.html(dataObj.percent);
}
});
}
</script>
<input class="ur_checkbox" type="checkbox" onclick="click_<%= pa.id %>(this);return false;" <%= answer_be_selected?(pa,User.current) ? "checked":"" %> <%= @can_edit_poll?"":"disabled=disabled" %> >
<%= pa.answer_text %>
</label>
</td>
</tr>
<% end %>
</tbody>
</table>
</form>
</div>
</li>
<% elsif pq.question_type == 3 %>
<!-- 单行文字-->
<li class="ur_question_item text">
<div class="ur_title">
<span class="title_index"><%= l(:label_question_number,:question_number => pq.question_number) %></span>
<%= pq.question_title %>
<span class="title_index">[单行主观]</span>
<% if pq.is_necessary == 1 %>
<span class="ur_required" title="<%= l(:label_must_answer) %>">*</span>
<% end %>
</div>
<div class="cl"></div>
<div class="ur_inputs">
<script>
function onblur_<%= pq.id %>(obj)
{
$(window).unbind('beforeunload');
$.ajax({
type: "post",
url: "<%= commit_answer_poll_path(@poll) %>",
data: {
poll_question_id: <%= pq.id %> ,
vote_text: obj.value
},
success: function (data) {
var dataObj = eval(data);
var span = $('#percent');
span.html(dataObj.percent);
// obj.value = data;
}
});
<% mc_question_list = @poll.poll_questions.where("question_type=1") %>
<% mcq_question_list = @poll.poll_questions.where("question_type=2") %>
<% single_question_list = @poll.poll_questions.where("question_type=3") %>
<% multi_question_list = @poll.poll_questions.where("question_type=4") %>
<div class="testStatus" id="mc_question_list" style="display: <%=mc_question_list.count > 0 ? "" : "none" %>">
<h3 class="fontGrey3">单选题</h3>
<% mc_question_list.each_with_index do |pq, list_index| %>
<div id="poll_questions_<%= pq.id%>">
<div id="show_poll_questions_<%= pq.id %>">
<div>
<div class="testEditTitle">
<%= l(:label_question_number,:question_number => pq.question_number) %>
<%= pq.question_title %>
<% if pq.is_necessary == 1 %>
<span class="ur_required" title="<%= l(:label_must_answer) %>">*</span>
<% end %>
</div>
<div class="cl"></div>
<div class="ur_inputs">
<table class="ur_table" style="width:675px;">
<tbody>
<% pq.poll_answers.each do |pa| %>
<tr>
<td>
<label>
<script>
function onblur_<%= pa.id %>(obj)
{
$(window).unbind('beforeunload');
$.ajax({
type: "post",
url: "<%= commit_answer_poll_path(@poll) %>",
data: {
poll_question_id: <%= pq.id %>,
poll_answer_id: <%= pa.id %>,
vote_text: obj.value
},
success: function (data) {
var dataObj = eval(data);
document.getElementById("poll_vote_<%=pq.id %>poll_answer_id_<%=pa.id %>").checked = true;
var span = $('#percent');
span.html(dataObj.percent);
}
});
}
</script>
<input class="ur_text ur_textbox" type="text" size="" maxlength="" style="width: 100%" value="<%= get_anwser_vote_text(pq.id,User.current.id).html_safe %>" onblur="onblur_<%= pq.id %>(this);" <%= @can_edit_poll?"":"disabled=disabled" %>>
</div>
</li><!--单行输入 end-->
<% elsif pq.question_type == 4 %>
<!-- 多行文字-->
<li class="ur_question_item textarea">
<div class="ur_preview">
<div class="ur_title">
<span class="title_index"><%= l(:label_question_number,:question_number => pq.question_number) %></span>
<%= pq.question_title %>
<span class="title_index">[多行主观]</span>
<% if pq.is_necessary == 1 %>
<span class="ur_required" title="<%= l(:label_must_answer) %>">*</span>
<% end %>
</div>
<div class="cl"></div>
<div class="ur_inputs">
}
function click_<%= pa.id %>(obj)
{
$.ajax({
type: "post",
url: "<%= commit_answer_poll_path(@poll) %>",
data: {
poll_answer_id: <%= pa.id %>,
poll_question_id: <%= pq.id %>
},
success: function (data) {
var dataObj = eval(data);
if(dataObj.text == "ok")
{
obj.checked = true;
}
else
{
obj.checked = false;
}
var span = $('#percent');
span.html(dataObj.percent);
},
error: function () {
alert("网络异常,答题失败,请确认网络正常连接后再答题。");
}
});
}
</script>
<%= radio_button "poll_vote",pq.id.to_s+"poll_answer_id",pa.id,:class=>"ur_radio",:onclick =>"click_#{pa.id}(this);return false;",:checked => answer_be_selected?(pa,User.current),:disabled => !@can_edit_poll %>
<% if pa.answer_text == "" %>
<input class="ur_text ur_textbox" type="text" size="" maxlength="" style="width: 93%" value="<%= get_anwser_vote_text(pq.id,User.current.id).html_safe %>" onblur="onblur_<%= pa.id %>(this);" <%= @can_edit_poll?"":"disabled=disabled" %> placeholder="其他">
<% else %>
<%= pa.answer_text %>
<% end %>
</label>
</td>
</tr>
<% end %>
</tbody>
</table>
</div>
</div>
</div>
</div>
<% end %>
</div>
<div class="testStatus" id="mcq_question_list" style="display: <%=mcq_question_list.count > 0 ? "" : "none" %>">
<h3 class="fontGrey3">多选题</h3>
<% mcq_question_list.each do |pq| %>
<div id="poll_questions_<%= pq.id%>">
<div id="show_poll_questions_<%= pq.id %>">
<div>
<div class="testEditTitle">
<%= l(:label_question_number,:question_number => pq.question_number) %>
<%= pq.question_title %>
<% if pq.is_necessary == 1 %>
<span class="ur_required" title="<%= l(:label_must_answer) %>">*</span>
<% end %>
</div>
<div class="cl"></div>
<div class="ur_inputs">
<table class="ur_table" style="width:675px;">
<tbody>
<% pq.poll_answers.each do |pa| %>
<tr>
<td>
<label>
<script>
function onblur_<%= pa.id %>(obj)
{
$(window).unbind('beforeunload');
$.ajax({
type: "post",
url: "<%= commit_answer_poll_path(@poll) %>",
data: {
poll_question_id: <%= pq.id %>,
poll_answer_id: <%= pa.id %>,
vote_text: obj.value
},
success: function (data) {
var dataObj = eval(data);
document.getElementById("poll_vote_<%=pq.id %>poll_answer_id_<%=pa.id %>").checked = true;
var span = $('#percent');
span.html(dataObj.percent);
}
});
}
function click_<%= pa.id %>(obj)
{
$.ajax({
type: "post",
url: "<%= commit_answer_poll_path(@poll) %>",
data: {
poll_answer_id: <%= pa.id %>,
poll_question_id: <%= pq.id %>
},
success: function (data) {
var dataObj = eval(data);
if(dataObj.text == "ok")
{
obj.checked = true;
}
else
{
obj.checked = false;
}
var span = $('#percent');
span.html(dataObj.percent);
},
error: function () {
alert("网络异常,答题失败,请确认网络正常连接后再答题。");
}
});
}
</script>
<input class="ur_radio" id="poll_vote_<%=pq.id %>poll_answer_id_<%=pa.id %>" type="checkbox" onclick="click_<%= pa.id %>(this);return false;" <%= answer_be_selected?(pa,User.current) ? "checked":"" %> <%= @can_edit_poll?"":"disabled=disabled" %> >
<% if pa.answer_text == "" %>
<input class="ur_text ur_textbox" type="text" size="" maxlength="" style="width: 93%" value="<%= get_anwser_vote_text(pq.id,User.current.id).html_safe %>" onblur="onblur_<%= pa.id %>(this);" <%= @can_edit_poll?"":"disabled=disabled" %> placeholder="其他">
<% else %>
<%= pa.answer_text %>
<% end %>
</label>
</td>
</tr>
<% end %>
</tbody>
</table>
</div>
</div><!--多选题显示 end-->
</div>
</div>
<% end %>
</div>
<div class="testStatus" id="single_question_list" style="display: <%=single_question_list.count > 0 ? "" : "none" %>">
<h3 class="fontGrey3">单行主观题</h3>
<% single_question_list.each do |pq| %>
<div id="poll_questions_<%= pq.id%>">
<div id="show_poll_questions_<%= pq.id %>">
<div>
<div class="testEditTitle">
<%= l(:label_question_number,:question_number => pq.question_number) %>
<%= pq.question_title %>
<% if pq.is_necessary == 1 %>
<span class="ur_required" title="<%= l(:label_must_answer) %>">*</span>
<% end %>
</div>
<div class="cl"></div>
<div>
<script>
function onblur_<%= pq.id %>(obj)
{
$(window).unbind('beforeunload');
$.ajax({
type: "post",
url: "<%= commit_answer_poll_path(@poll) %>",
data: {
poll_question_id: <%= pq.id %> ,
vote_text: obj.value
},
success: function (data) {
var dataObj = eval(data);
obj.value = dataObj.text;
var span = $('#percent');
span.html(dataObj.percent);
},
error: function () {
alert("网络异常,答题失败,请确认网络正常连接后再答题。");
}
});
}
</script>
<input class="fillInput" placeholder="在此填入答案" type="text" value="<%= get_anwser_vote_text(pq.id,User.current.id).html_safe %>" onblur="onblur_<%= pq.id %>(this);" <%= @can_edit_poll?"":"disabled=disabled" %>>
</div>
</div>
</div>
</div>
<% end %>
</div>
<div class="testStatus" id="single_question_list" style="display: <%=single_question_list.count > 0 ? "" : "none" %>">
<h3 class="fontGrey3">多行主观题</h3>
<% multi_question_list.each do |pq| %>
<div id="poll_questions_<%= pq.id%>">
<div id="show_poll_questions_<%= pq.id %>">
<div>
<div class="testEditTitle">
<%= l(:label_question_number,:question_number => pq.question_number) %>
<%= pq.question_title %>
<% if pq.is_necessary == 1 %>
<span class="ur_required" title="<%= l(:label_must_answer) %>">*</span>
<% end %>
</div>
<div class="cl"></div>
<% pq.poll_answers.each_with_index do |pa, i| %>
<div class="ml40 mb10">
<script>
function onblur_<%= pq.id %>(obj)
function onblur_<%= pa.id %>(obj)
{
$(window).unbind('beforeunload');
$.ajax({
type: "post",
url: "<%= commit_answer_poll_path(@poll) %>",
data: {
poll_question_id: <%= pq.id %> ,
vote_text: obj.innerHTML
poll_answer_id: <%= pa.id %>,
vote_text: obj.value
},
success: function (data) {
var dataObj = eval(data);
if(dataObj.text != 'failure')
{
var span = $('#percent');
span.html(dataObj.percent);
}
else
{
alert("error");
}
obj.value = dataObj.text;
var span = $('#percent');
span.html(dataObj.percent);
},
error: function () {
alert("网络异常,答题失败,请确认网络正常连接后再答题。");
}
});
}
</script>
<div contenteditable='<%= @can_edit_poll %>' class="ur_textbox" style="min-height: 150px;width: 100%;<%= @can_edit_poll?"":"background-color:#DCDCDC;" %>" onblur="onblur_<%= pq.id %>(this);"><%= get_anwser_vote_text(pq.id,User.current.id).html_safe %></div>
<p class="mb10"><%= i + 1 %>.<%= pa.answer_text%></p>
<input class="questionnaire-input" placeholder="在此填入答案" style="width: 93%" type="text" value="<%= get_anwser_vote_text(pq.id,User.current.id,pa.id).html_safe %>" onblur="onblur_<%= pa.id %>(this);" <%= @can_edit_poll?"":"disabled=disabled" %>>
</div>
</div>
</li><!--多行输入 end-->
<% else %>
<!-- 未知题型 -->
<% end %>
<% end %>
</ol>
<ul class="wlist">
<%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true%>
</ul>
<div class="cl"></div>
<div class="ur_buttons" style="width: 100px;">
<% if @poll.polls_status == 2 %>
<%= link_to l(:button_submit),commit_poll_poll_path(@poll), :method => :post,:class => "ur_button",:format => 'js',:remote=>true %>
<% end %>
</div>
<div class="cl"></div>
<div class="ur_progress_text">
<%= l(:label_complete_question) %>
<strong class="ur_progress_number">
<span id="percent"><%= format "%.2f" ,@percent %></span>%
</strong>
</div>
<% end %>
</div>
</div>
</div>
<% end %>
</div>
<div class="ur_buttons" style="width: 77px;">
<% if @poll.polls_status == 2 %>
<%= link_to l(:button_submit),commit_poll_poll_path(@poll), :method => :post,:class => "BlueCirBtn",:format => 'js',:remote=>true %>
<% end %>
</div>
<div class="cl"></div>
<div class="ur_progress_text">
<%= l(:label_complete_question) %>
<strong class="ur_progress_number">
<span id="percent"><%= format "%.2f" ,@percent %></span>%
</strong>
</div>
</div><!--问卷内容end-->
</div>

View File

@ -22,8 +22,10 @@
</div>
<% if poll_question.question_type == 1 || poll_question.question_type == 2 %>
<%= render :partial =>'choice_show', :locals =>{ :poll_question => poll_question } %>
<% else %>
<% elsif poll_question.question_type == 3 %>
<%= render :partial =>'quiz_answers', :locals =>{ :poll_question => poll_question } %>
<% else %>
<%= render :partial =>'multi_answers', :locals =>{ :poll_question => poll_question } %>
<% end %>
</li>
</ol>

View File

@ -32,8 +32,8 @@
<% end%>
</td>
<% courses = user.courses.not_deleted %>
<td><%= courses.where("tea_id = #{user.id}").count %></td>
<td><%= courses.where("tea_id != #{user.id}").count %></td>
<td><%= courses.where("tea_id = #{user.id} and syllabus_id = #{@syllabus.id}").count %></td>
<td><%= courses.where("tea_id != #{user.id} and syllabus_id = #{@syllabus.id}").count %></td>
<% if is_admin %>
<td>
<% if user == @syllabus.user %>

View File

@ -8,7 +8,7 @@
<li>
<ul class="homepagePostTypeHomework fl">
<% if hidden_unproject_infos %>
<li class="f14">课程动态</li>
<li class="f14">班级动态</li>
<li><%= link_to "作业动态", {:controller => "users", :action => "show", :type => "course_homework"}, :class => "homepagePostTypeAssignment postTypeGrey"%>
<!--<a href="javascript:void(0);" class="homepagePostTypeAssignment postTypeGrey">作业动态</a>--></li>
<li><%= link_to "通知动态", {:controller => "users", :action => "show", :type => "course_news"}, :class => "homepagePostTypeNotice postTypeGrey"%>

View File

@ -260,9 +260,10 @@ h4{ font-size:14px;}/*color:#3b3b3b;*/
.w460{ width:460px;}
.w465{width:465px !important;}
.w490{width:490px;}
.w520{ width:520px;}
.w520{ width:520px !important;}
.w543{ width:543px;}
.w557{ width:557px;}
.w570 {width:570px !important;}
.w576{ width:576px;}
.w607 {width:607px;}
.w664{ width:664px;}
@ -468,7 +469,7 @@ a:hover.grey_n_btn{ background:#717171; color:#fff;}
a.green_btn{background:#28be6c;color:#fff; font-weight:normal; padding:2px 10px; text-align:center;}
a:hover.green_btn{ background:#14ad5a;}
.blue_btn{ background:#64bdd9; color:#fff; font-weight:normal;padding:2px 10px; text-align:center;}
a.blue_btn{background:#64bdd9;color:#fff; font-weight:normal; padding:2px 10px; text-align:center;}
a.blue_btn{background:#3b94d6;color:#fff; font-weight:normal; padding:2px 10px; text-align:center;}
a:hover.blue_btn{ background:#329cbd;}
.red_btn{ background:red; color:#fff; font-size:14px; font-weight:normal;padding:2px 8px; text-align:center;}
a.red_btn{background:red; color:#fff;font-size:14px; font-weight:normal; padding:2px 8px; text-align:center;cursor: pointer;}
@ -655,4 +656,7 @@ a:hover.hw_btn_blue,a:active.hw_btn_blue{ background: #3b94d6; color:#fff;}
/*状态提示图标*/
.success-icon {background:url("/images/icons_ziliao.png") 0 -28px no-repeat; padding-left:25px;}
.error-icon {background:url("/images/icons_ziliao.png") 0 -56px no-repeat; padding-left:25px;}
.error-icon {background:url("/images/icons_ziliao.png") 0 -56px no-repeat; padding-left:25px;}
/*禁用*/
.disabled {background-color:#f5f5f5;}

View File

@ -551,4 +551,9 @@ a:hover.blueCir{ background:#3598db; color:#fff;}
.homework-detail-tab li {float:left; width:100px; text-align:center; padding:3px 0; border-bottom:2px solid #ddd;}
.homework-detail-tab li.selected {border-bottom:2px solid #f00;}
.test-set-table, .test-set-table tr, .test-set-table th, .test-set-table td {border-collapse:collapse; text-align:left; border:1px solid #ddd; color:#484848;}
.test-set-table th, .test-set-table td {padding:2px 5px;}
.test-set-table th, .test-set-table td {padding:2px 5px;}
/*20160912问卷调查*/
.new-question {width:324px; height:30px; color:#888; background-color:#fff; padding-left:5px; margin-left:46px; cursor:pointer;}
.new-subjective {width:550px; height:30px; color:#888; background-color:#fff; padding-left:5px; margin-left:96px; cursor:pointer;}
.questionnaire-input {height:30px; border:1px solid #cbcbcb; padding-left:5px;}

View File

@ -1,7 +1,7 @@
@charset "utf-8";
/* CSS Document */
.ui-widget {
font-family: Verdana, sans-serif;
font-family: "微软雅黑","宋体",Verdana, sans-serif;
font-size: 1.1em;
}
.ui-widget-content {

View File

@ -1509,3 +1509,6 @@ a.syllabusbox_a_blue{
.syllabus_info_tishi a{
color:#3b94d6;
}
/*20160912问卷调查*/
.dash-block {border:1px dashed #ddd;}