Merge branch 'develop' into rep_quality

Conflicts:
	public/stylesheets/css/project.css
This commit is contained in:
huang 2016-10-14 15:43:45 +08:00
commit b9d87b1b29
108 changed files with 2341 additions and 2228 deletions

View File

@ -50,10 +50,10 @@ gem 'elasticsearch-model'
gem 'elasticsearch-rails'
#rails 3.2.22.2 bug
gem "test-unit", "~>3.0"
# gem "test-unit", "~>3.0"
### profile
gem 'oneapm_rpm'
# gem 'oneapm_rpm'
group :development do
gem 'grape-swagger'

View File

@ -112,7 +112,7 @@ module Mobile
# end
if reply_type == nil || reply_type == 0
homework_common = HomeworkCommon.find(params[:id])
feedback = HomeworkCommon.add_homework_jour(current_user, params[:content], params[:id])
feedback = HomeworkCommon.add_homework_jour(current_user, params[:content], params[:id], params[:id])
if (feedback.errors.empty?)
homework_common.update_column(:updated_at, Time.now)
result = 2
@ -124,7 +124,7 @@ module Mobile
homework_common = HomeworkCommon.find reply.jour_id
options = {:notes => params[:content], :reply_id => reply.user_id,:user_id => current_user.id,:m_parent_id => params[:id].to_i,:m_reply_id => params[:id].to_i}
feedback = HomeworkCommon.add_homework_jour(current_user, params[:content], reply.jour_id, options)
feedback = HomeworkCommon.add_homework_jour(current_user, params[:content], reply.jour_id, reply.jour_id, options)
if (feedback.errors.empty?)
homework_common.update_column(:updated_at, Time.now)
result = 2
@ -189,6 +189,7 @@ module Mobile
reply.content = params[:content]
reply.parent_id = params[:id]
reply.subject = "RE: #{topic.subject}"
reply.root_id = topic.id
if message.children << reply
result = 2
update_id = topic.id
@ -224,6 +225,7 @@ module Mobile
:m_parent_id => parent_id,
:m_reply_id => reply_id,
:reply_id => reply_user_id,
:root_id => jour.id,
:notes => content,
:is_readed => false}
jfm = jour.user.add_jour(nil, nil, nil, options)
@ -278,6 +280,7 @@ module Mobile
blogComment.blog = blog.blog
blogComment.content = params[:content]
blogComment.title = "RE: #{blog.title}"
blogComment.root_id = blog.id
if blog.children << blogComment
result = 2
update_id = blog.id
@ -293,6 +296,7 @@ module Mobile
parent = BlogComment.find params[:id]
blogComment.parent_id = params[:id] #被回复的回复
blogComment.reply_id = parent.author.id #被回复者id
blogComment.root_id = blog.id
if parent.children << blogComment
result = 2

View File

@ -25,8 +25,10 @@ module Mobile
elsif ac.act_type == "News"
ac.nil? || ac.act.nil? ? 0 : ac.act.comments.count
elsif ac.act_type == "Message" || ac.act_type == "BlogComment" || ac.act_type == "JournalsForMessage"
all_comments = []
ac.nil? || ac.act.nil? ? 0 : get_all_children(all_comments, ac.act).count
className = ac.act_type.classify.constantize
# all_comments = []
# ac.nil? || ac.act.nil? ? 0 : get_all_children(all_comments, ac.act).count
ac.nil? || ac.act.nil? ? 0 : className.where("root_id = #{ac.act.id}").count
elsif ac.act_type == "Issue"
ac.nil? || ac.act.nil? ? 0 : ac.act.journals.where("notes is not null and notes != ''").count
end

View File

@ -31,6 +31,7 @@ class AdminController < ApplicationController
@no_configuration_data = Redmine::DefaultData::Loader::no_data?
end
# 管理员界面 项目列表
def projects
=begin
@status = params[:status] || 1
@ -39,7 +40,11 @@ class AdminController < ApplicationController
scope = scope.like(params[:name]) if params[:name].present?
@projects = scope.where(project_type: Project::ProjectType_project).reorder("created_on desc").all
=end
@projects = Project.like(@name).order('created_on desc')
# 搜索功能
@name = params[:name] || ""
condition = "#{@name.strip}".gsub(" ","")
@projects = Project.like(condition).order('created_on desc')
# 分页
@projects = paginateHelper @projects,30
@page = (params['page'] || 1).to_i - 1
render :action => "projects", :layout => false if request.xhr?

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
@ -145,10 +152,12 @@ class BlogCommentsController < ApplicationController
@blogComment.content = params[:blog_comment][:content]
parent = BlogComment.find params[:parent_id]
@blogComment.reply_id = params[:id]
@blogComment.root_id = parent.root_id.nil? ? parent.id : parent.root_id
parent.children << @blogComment
else
@quote = params[:quote][:quote] || ""
@blogComment.content = @quote + @blogComment.content
@blogComment.root_id = @article.id
@article.children << @blogComment
end
@article.save

View File

@ -126,7 +126,8 @@ class BoardsController < ApplicationController
@type = 2
@topics.each do |topic|
all_comments = []
count=get_all_children(all_comments, topic).count
#count=get_all_children(all_comments, topic).count
count=Message.where("root_id = #{topic.id}").count
topic[:infocount] = get_praise_num(topic) + count
if topic[:infocount] < 0
topic[:infocount] = 0

View File

@ -296,12 +296,12 @@ class ForumsController < ApplicationController
#检查forum的名字
def check_forum_name
forum_name_exist = true
if params[:forum_id]
forum_name_exist = Forum.where("name = '#{params[:forum_name]}' and id != #{params[:forum_id]}").count >= 1 ? true : false
else
forum_name_exist = false
# if params[:forum_id]
# forum_name_exist = Forum.where("name = '#{params[:forum_name]}' and id != #{params[:forum_id]}").count >= 1 ? true : false
# else
forum_name_exist = Forum.where("name = '#{params[:forum_name]}' ").count >= 1 ? true : false
end
# end
render :text => forum_name_exist
end

View File

@ -45,7 +45,7 @@ class MessagesController < ApplicationController
# page = 1 + offset / REPLIES_PER_PAGE
# end
all_comments = []
@replies = get_all_children(all_comments, @topic)
@replies = Message.where("root_id = #{@topic.id}").reorder("created_on desc")
@reply_count = @replies.count
@page = params[:page] ? params[:page].to_i + 1 : 0
@limit = 10
@ -165,6 +165,7 @@ class MessagesController < ApplicationController
@reply.content = params[:content]
@reply.subject = "RE: #{@topic.subject}"
@reply.reply_id = params[:id]
@reply.root_id = parent.root_id.nil? ? parent.id : parent.root_id
# @reply.reply_id = params[:id]
parent.children << @reply
@user_activity_id = params[:user_activity_id] if params[:user_activity_id]
@ -178,6 +179,7 @@ class MessagesController < ApplicationController
@reply.safe_attributes = params[:reply]
@reply.content = @quote + @reply.content
@reply.subject = "RE: #{@topic.subject}" unless params[:reply][:subject]
@reply.root_id = @topic.id
@topic.children << @reply
# @reply.reply_id = params[:id]
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
@ -89,6 +96,7 @@ class OrgDocumentCommentsController < ApplicationController
@act = OrgActivity.find(params[:act_id])
@comment = OrgDocumentComment.new(:organization_id => @document.organization_id, :creator_id => User.current.id, :reply_id => params[:id])
@comment.content = params[:org_content]
@comment.root_id = @document.id
@document.children << @comment
@document.save
end
@ -102,6 +110,7 @@ class OrgDocumentCommentsController < ApplicationController
@comment.content = params[:org_comment][:org_content]
end
@comment.root_id = @document.id
@document.children << @comment
@document.save
respond_to do |format|
@ -161,6 +170,7 @@ class OrgDocumentCommentsController < ApplicationController
@org_document.title = params[:org_document_comment][:title]
@org_document.content = params[:org_document_comment][:content]
@org_document.root_id = @document.root_id.nil? ? @document.id : @document.root_id
@document.children << @org_document
@document = @document.root

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
@ -3524,19 +3527,19 @@ class UsersController < ApplicationController
if params[:type].present?
case params[:type]
when 'OrgDocumentComment'
obj = OrgDocumentComment.where('id = ?', params[:id].to_i).first
#obj = OrgDocumentComment.where('id = ?', params[:id].to_i).first
@user_activity_id = params[:div_id].to_i if params[:div_id]
@type = 'OrgDocumentComment'
comments = []
@journals = get_all_children(comments, obj)
#comments = []
@journals = OrgDocumentComment.where("root_id = #{params[:id].to_i}").reorder("created_at desc")
when 'Message'
obj = Message.where('id = ?', params[:id].to_i).first
#obj = Message.where('id = ?', params[:id].to_i).first
@type = 'Message'
@is_course = params[:is_course]
@is_board = params[:is_board]
@user_activity_id = params[:div_id].to_i if params[:div_id]
comments = []
@journals = get_all_children(comments, obj)
#comments = []
@journals = Message.where("root_id = #{params[:id].to_i}").reorder("created_on desc")
when 'News'
obj = News.where('id = ?', params[:id].to_i).first
@journals = obj.comments.reorder("created_on desc")
@ -3548,9 +3551,9 @@ class UsersController < ApplicationController
@type = 'Syllabus'
@user_activity_id = params[:div_id].to_i if params[:div_id]
when 'JournalsForMessage'
obj = JournalsForMessage.where('id = ?', params[:id].to_i).first
journals = []
@journals = get_all_children(journals, obj)
#obj = JournalsForMessage.where('id = ?', params[:id].to_i).first
#journals = []
@journals = JournalsForMessage.where("root_id = #{params[:id].to_i}").reorder("created_on desc")
@type = 'JournalsForMessage'
@user_activity_id = params[:div_id].to_i if params[:div_id]
when 'Issue'
@ -3559,13 +3562,13 @@ class UsersController < ApplicationController
@type = 'Issue'
@user_activity_id = params[:div_id].to_i if params[:div_id]
when 'BlogComment'
obj = BlogComment.where('id = ?', params[:id].to_i).first
#obj = BlogComment.where('id = ?', params[:id].to_i).first
@user_activity_id = params[:div_id].to_i if params[:div_id]
@homepage = params[:homepage].to_i
@type = 'BlogComment'
@user_id = obj.author_id
comments = []
@journals = get_all_children(comments, obj)
#comments = []
@journals = BlogComment.where("root_id = #{params[:id].to_i}").reorder("created_on desc")
when 'HomeworkCommon'
obj = HomeworkCommon.where('id = ?', params[:id].to_i).first
@type = 'HomeworkCommon'

View File

@ -153,72 +153,10 @@ class WelcomeController < ApplicationController
def search
@name = params[:q]
@search_type = params[:search_type]
case params[:search_type]
when 'all'
@alls = Elasticsearch::Model.search({
query: {
multi_match: {
query: @name,
type:"most_fields",
operator: "or",
fields: ['login', 'firstname','lastname','name','description^0.5','filename','subject','content^0.5']
}
},
highlight: {
pre_tags: ['<span class="c_red">'],
post_tags: ['</span>'],
fields: {
login: {},
firstname: {},
lastname: {},
name:{},
description:{},
filename:{},
subject:{},
content:{}
}
}
},[User,Course,Attachment,Project,Memo] ).page(params[:page] || 1).per(20).results
when 'user'
@users = User.search(@name).page(params[:page] || 1).per(20)
when 'project'
@projects = Project.search(@name).page(params[:page] || 1).per(20).results
when 'course'
@courses = Course.search(@name).page(params[:page] || 1).per(20).results
when 'attachment'
@attachments = Attachment.search(@name).page(params[:page] || 1).per(20).results
when 'memo'
@memos = Memo.search(@name).page(params[:page] || 1).per(20).results
else
@alls = Elasticsearch::Model.search({
query: {
multi_match: {
query: @name,
type:"most_fields",
operator: "or",
fields: ['login', 'firstname','lastname','name','description^0.5','filename','subject','content^0.5']
}
},
highlight: {
pre_tags: ['<span class="c_red">'],
post_tags: ['</span>'],
fields: {
login: {},
firstname: {},
lastname: {},
name:{},
description:{},
filename:{},
subject:{},
content:{}
}
}
},[User,Course,Attachment,Project,Memo] ).page(params[:page] || 1).per(20).results
end
page = (params[:page] || 1).to_i
@users_count = User.search(@name).results.total
@syllabus_count = Syllabus.search(@name).results.total
@course_count = Course.search(@name).results.total
@attach_count = Attachment.search(@name).results.total
@project_count = Project.search(@name).results.total
@ -229,7 +167,7 @@ class WelcomeController < ApplicationController
query: @name,
type:"most_fields",
operator: "or",
fields: ['login', 'firstname','lastname','name','description^0.5','filename','subject','content^0.5']
fields: ['login', 'firstname','lastname','title','name','description^0.5','filename','subject','content^0.5']
}
},
highlight: {
@ -239,6 +177,7 @@ class WelcomeController < ApplicationController
login: {},
firstname: {},
lastname: {},
title:{},
name:{},
description:{},
filename:{},
@ -246,7 +185,110 @@ class WelcomeController < ApplicationController
content:{}
}
}
},[User,Course,Attachment,Project,Memo] ).results.total
},[User,Syllabus,Course,Attachment,Project,Memo] ).results.total
case params[:search_type]
when 'all'
if (page-1)*20 >= @total_count
page = 1
params[:page] = "1"
end
@alls = Elasticsearch::Model.search({
query: {
multi_match: {
query: @name,
type:"most_fields",
operator: "or",
fields: ['login', 'firstname','lastname','title','name','description^0.5','filename','subject','content^0.5']
}
},
highlight: {
pre_tags: ['<span class="c_red">'],
post_tags: ['</span>'],
fields: {
login: {},
firstname: {},
lastname: {},
title:{},
name:{},
description:{},
filename:{},
subject:{},
content:{}
}
}
},[User,Syllabus,Course,Attachment,Project,Memo] ).page(page).per(20).results
when 'user'
if (page-1)*20 >= @users_count
page = 1
params[:page] = "1"
end
@users = User.search(@name).page(page).per(20)
when 'syllabus'
if (page-1)*20 >= @syllabus_count
page = 1
params[:page] = "1"
end
@syllabuses = Syllabus.search(@name).page(page).per(20).results
when 'project'
if (page-1)*20 >= @project_count
page = 1
end
@projects = Project.search(@name).page(page).per(20).results
when 'course'
if (page-1)*20 >= @course_count
page = 1
params[:page] = "1"
end
@courses = Course.search(@name).page(page).per(20).results
when 'attachment'
if (page-1)*20 >= @attach_count
page = 1
params[:page] = "1"
end
@attachments = Attachment.search(@name).page(page).per(20).results
when 'memo'
if (page-1)*20 >= @memo_count
page = 1
params[:page] = "1"
end
@memos = Memo.search(@name).page(page).per(20).results
else
if (page-1)*20 >= @total_count
page = 1
params[:page] = "1"
end
@alls = Elasticsearch::Model.search({
query: {
multi_match: {
query: @name,
type:"most_fields",
operator: "or",
fields: ['login', 'firstname','lastname','title','name','description^0.5','filename','subject','content^0.5']
}
},
highlight: {
pre_tags: ['<span class="c_red">'],
post_tags: ['</span>'],
fields: {
login: {},
firstname: {},
lastname: {},
title:{},
name:{},
description:{},
filename:{},
subject:{},
content:{}
}
}
},[User,Syllabus,Course,Attachment,Project,Memo] ).page(page).per(20).results
end
# search_type = params[:search_type].to_sym unless search_condition.blank?
# search_by = params[:search_by]
#

View File

@ -41,6 +41,7 @@ class WordsController < ApplicationController
# 删除留言功能要调用destroy也记得在destroy.js中修改
# deny api. api useless
parent = JournalsForMessage.find params[:reference_id].to_i
parent_id = params[:reference_id]
author_id = User.current.id
reply_user_id = params[:reference_user_id]
@ -52,7 +53,8 @@ class WordsController < ApplicationController
:m_parent_id => parent_id,
:m_reply_id => reply_id,
:reply_id => reply_user_id,
:notes => content,
:notes => content,
:root_id => parent.root_id.nil? ? parent.id : parent.root_id,
:is_readed => false}
@activity = params[:activity_id].nil? ? JournalsForMessage.find(parent_id) : JournalsForMessage.find(params[:activity_id].to_i)
@jfm = add_reply_adapter(@activity, options)
@ -274,7 +276,7 @@ class WordsController < ApplicationController
@user = User.current
@syllabus = Syllabus.find(params[:id]);
if params[:comment].size>0 && User.current.logged? && @user
feedback = Syllabus.add_syllabus_jour(@user, params[:comment], params[:id])
feedback = Syllabus.add_syllabus_jour(@user, params[:comment], params[:id], @syllabus.id)
if (feedback.errors.empty?)
if params[:asset_id]
ids = params[:asset_id].split(',')
@ -296,7 +298,7 @@ class WordsController < ApplicationController
@user = User.current
@homework_common = HomeworkCommon.find(params[:id]);
if params[:homework_message].size>0 && User.current.logged? && @user
feedback = HomeworkCommon.add_homework_jour(@user, params[:homework_message], params[:id])
feedback = HomeworkCommon.add_homework_jour(@user, params[:homework_message], params[:id], @homework_common.id)
if (feedback.errors.empty?)
if params[:asset_id]
ids = params[:asset_id].split(',')
@ -329,7 +331,7 @@ class WordsController < ApplicationController
reply = JournalsForMessage.find params[:id].to_i
@homework_common = HomeworkCommon.find reply.jour_id
if params[:reply_message].size>0 && User.current.logged? && @user
options = {:notes => params[:reply_message], :reply_id => reply.user_id,:user_id => @user.id,:m_parent_id => params[:id].to_i,:m_reply_id => params[:id].to_i}
options = {:notes => params[:reply_message], :reply_id => reply.user_id,:user_id => @user.id,:m_parent_id => params[:id].to_i,:m_reply_id => params[:id].to_i, :root_id => reply.root_id}
feedback = HomeworkCommon.add_homework_jour(@user, params[:reply_message], reply.jour_id, options)
if (feedback.errors.empty?)
if params[:asset_id]
@ -363,7 +365,7 @@ class WordsController < ApplicationController
reply = JournalsForMessage.find params[:id].to_i
@syllabus = Syllabus.find reply.jour_id
if params[:reply_message].size>0 && User.current.logged? && @user
options = {:notes => params[:reply_message], :reply_id => reply.user_id,:user_id => @user.id,:m_parent_id => params[:id].to_i,:m_reply_id => params[:id].to_i}
options = {:notes => params[:reply_message], :reply_id => reply.user_id,:user_id => @user.id,:m_parent_id => params[:id].to_i,:m_reply_id => params[:id].to_i, :root_id => reply.root_id}
feedback = Syllabus.add_syllabus_jour(@user, params[:reply_message], reply.jour_id, options)
if (feedback.errors.empty?)
if params[:asset_id]

View File

@ -1438,7 +1438,7 @@ module ApplicationHelper
:id => wiki_page_id, :version => nil, :anchor => anchor, :parent => parent)
end
end
link_to(title.present? ? title.html_safe : h(page), url, :class => ('wiki-page' + (wiki_page ? '' : ' new')))
link_to(title.present? ? title.html_safe : h(page), User.current.logged? ? url : signin_url_without_domain, :class => ('wiki-page' + (wiki_page ? '' : ' new')))
else
# project or wiki doesn't exist
all
@ -2965,7 +2965,7 @@ module ApplicationHelper
def file_preview_eye(file, html_options={})
if %w(pdf pptx doc docx xls xlsx).any?{|x| file.filename.downcase.end_with?(x)}
link_to '', download_named_attachment_path(file.id, file.filename, preview: true),html_options
link_to '', User.current.logged? ? download_named_attachment_path(file.id, file.filename, preview: true) : signin_url_without_domain, html_options
end
end

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
@ -791,7 +791,11 @@ module CoursesHelper
link = link_to(text, url, :remote => true, :method => method, :id => "#{course.id}", :class => "sy_btn_grey fl")
end
else
link = "<a href='javascript:void(0)' class='sy_btn_grey fl ml10' >#{l(:label_course_join_student)}</a>"
if User.current.logged?
link = "<a href='javascript:void(0)' class='sy_btn_grey fl ml10' >#{l(:label_course_join_student)}</a>"
else
link = link_to(l(:label_course_join_student), signin_url_without_domain, :class => "sy_btn_grey fl ml10")
end
end
link.html_safe
end

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

@ -19,7 +19,7 @@ class BlogComment < ActiveRecord::Base
validates_presence_of :title, :content
validates_length_of :title, :maximum => 255
#validate :cannot_reply_to_locked_comment, :on => :create
safe_attributes 'title', 'content',"sticky", "locked"
safe_attributes 'title', 'content',"sticky", "locked", "root_id"
after_save :add_user_activity
after_update :update_activity

View File

@ -113,10 +113,10 @@ class HomeworkCommon < ActiveRecord::Base
end
###添加回复
def self.add_homework_jour(user, notes, id , options = {})
def self.add_homework_jour(user, notes, id, root_id, options = {})
homework = HomeworkCommon.find(id)
if options.count == 0
jfm = homework.journals_for_messages.build(:user_id => user.id, :notes => notes, :reply_id => 0)
jfm = homework.journals_for_messages.build(:user_id => user.id, :notes => notes, :reply_id => 0, :root_id => root_id)
else
jfm = homework.journals_for_messages.build(options)
end

View File

@ -19,7 +19,8 @@ class JournalsForMessage < ActiveRecord::Base
"m_reply_count", # 留言的回复数量
"m_reply_id" , # 回复某留言的留言id(a留言回复了b留言这是b留言的id)
"is_comprehensive_evaluation", # 1 教师评论、2 匿评、3 留言
"private"
"private",
"root_id"
acts_as_tree :foreign_key => 'm_parent_id', :counter_cache => :m_reply_count, :order => "#{JournalsForMessage.table_name}.created_on ASC"
after_destroy :delete_kindeditor_assets
belongs_to :project,

View File

@ -96,7 +96,7 @@ class Message < ActiveRecord::Base
}
safe_attributes 'subject', 'content', 'reply_id'
safe_attributes 'subject', 'content', 'reply_id', 'root_id'
safe_attributes 'board_id','locked', 'sticky',
:if => lambda {|message, user|
if message.project

View File

@ -1,6 +1,6 @@
class OrgDocumentComment < ActiveRecord::Base
# status: 1 模式二中置顶 0模式二中正常显示
attr_accessible :content, :creator_id, :organization_id, :parent_id, :reply_id, :title, :sticky, :locked, :status
attr_accessible :content, :creator_id, :organization_id, :parent_id, :reply_id, :title, :sticky, :locked, :status, :root_id
include Redmine::SafeAttributes
include ApplicationHelper
belongs_to :organization

View File

@ -2,6 +2,18 @@
class Syllabus < ActiveRecord::Base
include Redmine::SafeAttributes
include ApplicationHelper
#elasticsearch
include Elasticsearch::Model
#elasticsearch kaminari init
Kaminari::Hooks.init
Elasticsearch::Model::Response::Response.__send__ :include, Elasticsearch::Model::Response::Pagination::Kaminari
settings index: { number_of_shards: 5 } do
mappings dynamic: 'false' do
indexes :title, analyzer: 'smartcn',index_options: 'offsets'
indexes :description, analyzer: 'smartcn',index_options: 'offsets'
indexes :updated_at, index:"not_analyzed", type:'date'
end
end
acts_as_taggable
acts_as_attachable
has_many_kindeditor_assets :assets, :dependent => :destroy
@ -17,6 +29,12 @@ class Syllabus < ActiveRecord::Base
validates :title, :user_id, presence: true
after_update :update_syllabus_ealasticsearch_index
after_create :create_syllabus_ealasticsearch_index
before_destroy :delete_syllabus_ealasticsearch_index
scope :indexable,lambda { where(nil) }#用于elastic建索引的scope
scope :like, lambda {|arg|
if arg.blank?
where(nil)
@ -47,14 +65,65 @@ class Syllabus < ActiveRecord::Base
end
###添加回复
def self.add_syllabus_jour(user, notes, id , options = {})
def self.add_syllabus_jour(user, notes, id, root_id, options = {})
syllabus = Syllabus.find(id)
if options.count == 0
jfm = syllabus.journals_for_messages.build(:user_id => user.id, :notes => notes, :reply_id => 0)
jfm = syllabus.journals_for_messages.build(:user_id => user.id, :notes => notes, :reply_id => 0, :root_id => root_id)
else
jfm = syllabus.journals_for_messages.build(options)
end
jfm.save
jfm
end
def create_syllabus_ealasticsearch_index
return if Rails.env.development?
self.__elasticsearch__.index_document
end
def update_syllabus_ealasticsearch_index
return if Rails.env.development?
begin
self.__elasticsearch__.update_document
rescue => e
self.__elasticsearch__.index_document
end
end
def delete_syllabus_ealasticsearch_index
return if Rails.env.development?
begin
self.__elasticsearch__.delete_document
rescue => e
end
end
def self.search(query)
__elasticsearch__.search(
{
query: {
multi_match: {
query: query,
type:"most_fields",
operator: "or",
fields: ['title']
}
},
sort: {
_score:{order: "desc" },
updated_at:{order:"desc"}
},
highlight: {
pre_tags: ['<span class="c_red">'],
post_tags: ['</span>'],
fields: {
title: {},
description: {}
}
}
}
)
end
end

View File

@ -431,6 +431,12 @@ class User < Principal
name = lastname + firstname
name.empty? || name.nil? ? login : name
end
def show_occupation
if self.user_extensions && self.user_extensions.school
self.user_extensions.school.name
end
end
## end
def get_at_show_name

View File

@ -18,7 +18,7 @@
<label for='name'>
<%= l(:label_project) %>:
</label>
<%= text_field_tag 'name', params[:name], :size => 30 %>
<%= text_field_tag 'name', params[:name], :size => 30, :placeholder => '输入项目名称进行搜索' %>
<%= submit_tag l(:button_apply), :class => "small", :name => nil %>
<%= link_to l(:button_clear), {:controller => 'admin', :action => 'projects'}, :class => 'icon icon-reload' %>
</fieldset>

View File

@ -35,9 +35,17 @@
<% end%>
<span title="<%= attachment.filename %>" id = "attachment_">
<% if options[:length] %>
<%= link_to_short_attachment attachment, :class => ' link_file_board', :download => true,:length => options[:length] -%>
<% if User.current.logged? %>
<%= link_to_short_attachment attachment, :class => ' link_file_board', :download => true,:length => options[:length] -%>
<% else %>
<%= link_to(attachment.filename, signin_url_without_domain, :class => "link_file_board", :length => options[:length]) %>
<% end %>
<% else %>
<%= link_to_short_attachment attachment, :length=> 58,:class => 'hidden link_file_a fl newsBlue mw400', :download => true -%>
<% if User.current.logged? %>
<%= link_to_short_attachment attachment, :length=> 58,:class => 'hidden link_file_a fl newsBlue mw400', :download => true -%>
<% else %>
<%= link_to(attachment.filename, signin_url_without_domain,:length=> 58, :class => "hidden link_file_a fl newsBlue mw400") %>
<% end %>
<% end %>
</span>
<%if is_float%>
@ -92,7 +100,7 @@
<% end %>
<% if options[:author] %>
<span class="author" title="<%= attachment.author.show_name%>">
<%= link_to h(truncate(attachment.author.show_name, length: 10, omission: '...')),user_path(attachment.author),:class => "link-blue" %>,
<%= link_to h(truncate(attachment.author.show_name, length: 10, omission: '...')), User.current.logged? ? user_path(attachment.author) : signin_url_without_domain, :class => "link-blue" %>,
<%= format_time(attachment.created_on) %>
</span>
<% 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

@ -92,7 +92,11 @@
<div class="postDetailDate mb5"><%= format_time( @article.created_on)%></div>
<div class="cl"></div>
<%=render :partial =>"users/intro_content", :locals=>{:user_activity_id =>@article.id, :content=>@article.content} %>
<div class="homepagePostIntro break_word upload_img table_maxWidth " id="activity_description_<%= @article.id%>">
<div id="intro_content_<%= @article.id%>">
<%= @article.content.to_s.html_safe %>
</div>
</div>
<div class="cl"></div>
<div class=" fl" style="width: 600px">
<%#= link_to_attachments_course @topic, :author => false %>
@ -106,12 +110,12 @@
</div>
<div class="cl"></div>
<% all_comments = []%>
<% all_replies = get_all_children(all_comments, @article) %>
<% all_replies = BlogComment.where("root_id = #{@article.id}").reorder("created_on desc") %>
<% 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 +124,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,13 +36,7 @@
<% end %>
<div class="cl"></div>
</li>
<% count=0 %>
<% if activity.parent %>
<% count=activity.parent.children.count%>
<% else %>
<% count=activity.children.count%>
<% end %>
<li class="ml15">
<% count=BlogComment.where("root_id = #{activity.id}").count%> <li class="ml15">
<span class="grayTxt">发布:<%= format_time(activity.created_on) %></span>
<span class="grayTxt">更新:<%= format_time(activity.updated_on) %></span>
<p class="list-info fr grayTxt">

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

@ -46,7 +46,7 @@
<div class="cl"></div>
</div>
<% all_comments = []%>
<% all_repies = get_all_children(all_comments, activity) %>
<% all_repies = BlogComment.where("root_id = #{activity.id}").reorder("created_on desc") %>
<% count = all_repies.count %>
<div class="homepagePostReply">
<%= render :partial => 'users/reply_banner', :locals => {:count => count, :activity => activity, :user_activity_id => user_activity_id, :homepage => 1} %>

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

@ -11,15 +11,15 @@
<%# 如果有历史版本则提供历史版本下载 %>
<% if file.attachment_histories.count == 0 %>
<%= link_to truncate(file.filename,length: 35, omission: '...'),
download_named_attachment_path(file.id, file.filename),
User.current.logged? ? download_named_attachment_path(file.id, file.filename) : signin_url_without_domain,
:title => file.filename+"\n"+file.description.to_s, :style => "overflow: hidden; white-space: nowrap;text-overflow: ellipsis;",:class => "linkGrey3 f_14" %>
<% else %>
<%= link_to truncate(file.filename,length: 35, omission: '...'), attachment_history_download_path(file.id),
<%= link_to truncate(file.filename,length: 35, omission: '...'), User.current.logged? ? attachment_history_download_path(file.id) : signin_url_without_domain,
:title => file.filename+"\n"+file.description.to_s,
:class => "linkGrey3 f_14",
:style => "overflow: hidden; white-space: nowrap;text-overflow: ellipsis;", :remote=>true %>
<% end %>
<%= file_preview_eye(file, class: 'preview') %>
<%= file_preview_eye(file, class: 'preview') %>
<span id="image_private_<%= file.id%>">
<% if file.is_public? == false%>
<span class="img_private ml5">私有</span>

View File

@ -74,6 +74,7 @@
});
function check_and_submit(doc){
$("#error").html('').hide();
check_forum_name();
if( $("textarea[name='forum[name]']").val().trim() == "" && $("textarea[name='forum[description]']").val().trim() != "" ){
$("#error").html("名称不能为空").show();
return;

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

@ -1,121 +1,3 @@
<%= content_for(:header_tags) do %>
<%= import_ke(enable_at: true,init_activity: true) %>
<% end %>
<script xmlns="http://www.w3.org/1999/html">
//issues列表
/*function g(o){
return document.getElementById(o);
}
function HoverLi(n){
//如果有N个标签,就将i<=N;
for(var i=1;i<=3;i++){
g('issues_list_nav_'+i).className='issues_nav_nomal';
}
g('issues_list_nav_'+n).className='issues_nav_hover';
}*/
$(function(){
$("#RSide").removeAttr("id");
$("#Container").css("width","1000px");
$("input[nhname='date_show']").change(function(){
if($(this).val()=='创建日期起始' || $(this).val()=='创建日期结束')return;
$("input[nhname='date_val']",$(this).parent('div')).val($(this).val());
remote_function();
});
});
function remote_function() {
if($.trim($("#issue_create_date_end_show").val()) !="" && Date.parse($.trim($("#issue_create_date_end_show").val())) < Date.parse($.trim($("#issue_create_date_start_show").val()))){
alert("开始日期不能大于结束日期!");
}
$("#issue_query_form").submit();
// $.ajax({
// url:'<%#= project_issues_path(@project)%>',
// data:{
// subject:$("#v_subject").attr("value").replace(/(^\s*)|(\s*$)/g, ""),
// status_id: $("#status_id").attr("value").replace(/(^\s*)|(\s*$)/g, ""),
// assigned_to_id: $("#assigned_to_id option:selected").attr("value").replace(/(^\s*)|(\s*$)/g, ""),
// priority_id: $("#priority_id option:selected").attr("value").replace(/(^\s*)|(\s*$)/g, ""),
// author_id: $("#author_id option:selected").attr("value").replace(/(^\s*)|(\s*$)/g, "")
// },
// success: function(data){
// },
// error: function(data){
// }
// });
}
function remote_function_export(project_id) {
// $("#export_issue_hidden").attr("value","1");
// $("#issue_query_form").attr("set_filter","1");
// $("#issue_query_form").attr("action","/projects/"+project_id+"/issues.xls");
// $("#issue_query_form").submit();
// $("#issue_query_form").attr("action","/projects/"+project_id+"/issues");
// $("#issue_query_form").removeAttr("format");
// $("#issue_query_form").attr("set_filter","0");
// $("#export_issue_hidden").attr("value","0");
var tracker_id = $("#tracker_id").attr("value");
var subject = $("#v_subject").attr("value");
var assigned_to_id = $("#assigned_to_id").attr("value");
var fixed_version_id = $("#fixed_version_id").attr("value");
var status_id = $("#status_id").attr("value");
var done_ratio = $("#done_ratio").attr("value");
var test = $("#test").attr("value");
var author_id = $("#author_id").attr("value");
var issue_create_date_start = $("#issue_date_start_issue_export").attr("value");
var issue_create_date_end = $("#issue_date_end_issue_export").attr("value");
$("#sendexcel").attr("href","/projects/"+project_id+"/issues.xls?export=true&set_filter=1&tracker_id="+tracker_id+"&assigned_to_id="+assigned_to_id+"&fixed_version_id="+fixed_version_id+"&status_id="+status_id+"&done_ratio="+done_ratio+"&test="+test+"&author_id="+author_id+"&subject="+subject+"&issue_create_date_start="+issue_create_date_start+"&issue_create_date_end="+issue_create_date_end);
///projects/1811/issues.xls?export=true&set_filter=1
}
// function nh_reset_form() {
// $("#issue_query_form")[0].reset();
// $("input[nhname='date_val']").val('');//涛哥的火狐reset 清不掉这个值 我擦
// remote_function();
// }
function EnterPress(e){
var e = e || window.event;
if(e.keyCode == 13){
remote_function();
}
}
// 点击的时候让过滤条件选中assign_to
function switch_assign_to(assign) {
var assign = "option[value =" + assign + "]";
$("#issues_type_2").click(function(){
});
$("select[id='assigned_to_id']").find(assign).attr("selected", "selected");
$("select[id='author_id']").val('');
remote_function();
}
// 点击的时候让过滤条件选中user_id
function createByMe(user_id) {
var user = "option[value =" + user_id + "]";
$("#createByMe").click(function(){
});
$("select[id='author_id']").find(user).attr("selected", "selected");
remote_function();
}
// 清楚表单所有选项
function all_reset_form() {
$("#issue_query_form")[0].reset();
$("select[id='author_id']").val('');
$("select[id='assigned_to_id']").val('');
$("input[nhname='date_val']").val('');
remote_function();
}
</script>
<div class="homepageRight mt0 ml10" >
<div class="issues_con fl">
<div class="clear mb5">
@ -127,7 +9,7 @@
<li>关闭<a class="issues_greycirbg_btn "><%#= @issues_filter_author_count %><%= @issue_close_count %></a></li>
</ul>
</div><!--issues_statistics end-->
<!--<input type="button" class="hw_btn_blue fr" value="导出EXCEL" onclick="remote_function_export('<%= @project.id %>')">-->
<!--<input type="button" class="hw_btn_blue fr" value="导出EXCEL" onclick="remote_function_export('<%#= @project.id %>')">-->
<a href="<%=project_issues_path(:project_id => @project, :format => 'xls', :export => true, :set_filter => "1")%>" id="sendexcel" class="hw_btn_blue fr" alt="导出EXCEL" onclick="remote_function_export('<%= @project.id %>')">导出EXCEL</a>
</div>
<% unless @project.enabled_modules.where("name = 'issue_tracking'").empty? %>
@ -142,25 +24,25 @@
</div>
<a href="javascript:void(0);" class="sy_btn_grey fl ml5" onclick="all_reset_form();">清除</a>
<div class="calendar_div fr">
<input id="issue_date_end_issue_export" name="issue_create_date_end" nhname="date_val" type="hidden"/>
<input type="text" nhname="date_show" id="issue_create_date_end_show" class="InputBox fl W120 calendar_input" readonly="readonly" size="13" placeholder="结束日期">
<%= calendar_for('issue_create_date_end_show')%>
</div>
<div class="calendar_div fr">
<input id="issue_date_start_issue_export" name="issue_create_date_start" nhname="date_val" type="hidden"/>
<input type="text" nhname="date_show" id="issue_create_date_start_show" class="InputBox fl W120 calendar_input" readonly="readonly" size="13" placeholder="开始日期">
<%= calendar_for('issue_create_date_start_show')%>
</div>
<!--<input type="text" placeholder="开始日期" class="issues_calendar_input fl " ><a href="" class="issues_data_img fl" style="border-right:none;"></a>-->
<!--<input type="text" placeholder="结束日期" class="issues_calendar_input fl " ><a href="" class="issues_data_img fl"></a>-->
<div class="calendar_div fr">
<input id="issue_date_end_issue_export" name="issue_create_date_end" nhname="date_val" type="hidden"/>
<input type="text" nhname="date_show" id="issue_create_date_end_show" class="InputBox fl W120 calendar_input" readonly="readonly" size="13" placeholder="结束日期">
<%= calendar_for('issue_create_date_end_show')%>
</div>
<div class="calendar_div fr">
<input id="issue_date_start_issue_export" name="issue_create_date_start" nhname="date_val" type="hidden"/>
<input type="text" nhname="date_show" id="issue_create_date_start_show" class="InputBox fl W120 calendar_input" readonly="readonly" size="13" placeholder="开始日期">
<%= calendar_for('issue_create_date_start_show')%>
</div>
<!--<input type="text" placeholder="开始日期" class="issues_calendar_input fl " ><a href="" class="issues_data_img fl" style="border-right:none;"></a>-->
<!--<input type="text" placeholder="结束日期" class="issues_calendar_input fl " ><a href="" class="issues_data_img fl"></a>-->
</div>
<div class="issues_con_list" style="position: relative;">
<ul id="issues_list_nav" >
<li id="issues_list_nav_1" onclick="HoverLi(1);all_reset_form();">
<a href="javascript:void(0);" onclick="all_reset_form();" id="issues_type_1" >所有</a>
<span id="issue_filter_all"><%= render :partial => "issues/issue_filter_all" %></span>
<span id="issue_filter_all"><%= render :partial => "issues/issue_filter_all" %></span>
</li>
<!--li id="issues_list_nav_2" onclick="HoverLi(2);">
<a href="javascript:void(0);" onclick="switch_assign_to(<%#= User.current.id %>)" id="issues_type_2" >指派给我
@ -286,4 +168,4 @@
</div><!--issues_con_list end-->
</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

@ -51,7 +51,7 @@
<% name = name%>
<%= form_tag({controller: :welcome, action: :search },:class=>'navHomepageSearchBox', method: :get) do %>
<input type="text" name="q" value="<%= name.nil? ? "" : name%>" id="navHomepageSearchInput" class="navHomepageSearchInput" placeholder="请输入关键词搜索公开的班级、项目、用户、资源以及帖子"/>
<input type="text" name="q" value="<%= name.nil? ? "" : name%>" id="navHomepageSearchInput" class="navHomepageSearchInput" placeholder="请输入关键词搜索公开的课程、班级、项目、用户、资源以及帖子"/>
<input type="hidden" name="search_type" id="type" value="all"/>
<input type="text" style="display: none;"/>
<a href="javascript:void(0);" class="homepageSearchIcon" onclick="search_in_header($(this));"></a>

View File

@ -68,7 +68,7 @@
<li id="sy_02" class="sy_icons_boards">
<% count = @course.boards.first ? (@course.boards.first.topics.count + Message.where("board_id =? and parent_id is not ?", @course.boards.first.id, nil).count) : 0 %>
<a href="<%=course_boards_path(@course) %>">讨论区<span><%=count %></span></a>
<%= link_to( "",course_boards_path(@course, :flag => true, :is_new => 1), :class => 'sy_class_add', :title =>"#{l(:label_message_new)}") %>
<%= link_to( "",course_boards_path(@course, :flag => true, :is_new => 1), :class => 'sy_class_add', :title =>"#{l(:label_message_new)}") if is_teacher %>
</li>
<% end %>
<% unless show_nav?(@course.homework_commons.count) %>
@ -94,7 +94,7 @@
<% unless show_nav?(course_feedback_count) %>
<li id="sy_06" class="sy_icons_feedback">
<a href="<%=course_feedback_path(@course) %>">留言<span id="course_jour_count"><%=course_feedback_count %></span></a>
<%= link_to "", course_feedback_path(@course), :class => 'sy_class_add', :title =>"#{l(:label_course_feedback)}"%>
<%= link_to( "", course_feedback_path(@course), :class => 'sy_class_add', :title =>"#{l(:label_course_feedback)}") if is_teacher %>
</li>
<% end %>
<% unless show_nav?(course_poll_count) %>
@ -106,7 +106,7 @@
<% count = User.current.allowed_to?(:as_teacher,@course)? @course.exercises.count : @course.exercises.where("exercise_status <> 1").count %>
<% unless show_nav?(count) %>
<li id="sy_08" class="sy_icons_exercise">
<a href="<%=exercise_index_path(:course_id => @course.id) %>">在线测验<span><%=count %></span></a>
<a href="<%= User.current.logged? ? exercise_index_path(:course_id => @course.id) : signin_url_without_domain %>">在线测验<span><%=count %></span></a>
<%= link_to( "", new_exercise_path(:course_id => @course.id), :class => 'sy_class_add', :title =>"新建试卷") if is_teacher %>
</li>
<% end %>

View File

@ -125,7 +125,7 @@
<% end%>
</div>
<div>
<div class="user_info_intro">
<div class="user_info_intro" style="word-wrap:break-word; text-align:justify;">
<div id="user_brief_introduction_show">
<%= render :partial => 'layouts/user_brief_introduction', :locals => {:user => @user} %>
</div>

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

@ -75,76 +75,23 @@
</div>
</div>
<% all_comments = []%>
<% all_replies = get_all_children(all_comments, @document) %>
<% all_replies = OrgDocumentComment.where("root_id = #{@document.id}").reorder("created_at desc") %>
<% 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

@ -70,7 +70,7 @@
<div class="cl"></div>
</div>
<% all_comments = []%>
<% all_replies = get_all_children(all_comments, activity) %>
<% all_replies = OrgDocumentComment.where("root_id = #{activity.id}").reorder("created_at desc") %>
<% count = all_replies.count %>
<div class="homepagePostReply">
<%= render :partial => 'users/reply_banner', :locals => {:count => count, :activity => activity, :user_activity_id => user_activity_id,:is_course => 0,:is_board =>0} %>

View File

@ -68,7 +68,7 @@
</div>
</div>
<% all_comments = []%>
<% all_replies = get_all_children(all_comments, document) %>
<% all_replies = OrgDocumentComment.where("root_id = #{document.id}").reorder("created_at desc") %>
<% count = all_replies.count %>
<div class="homepagePostReply fl" style="background-color: #f1f1f1;" id="<%= document.id %>">

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

@ -1,6 +1,6 @@
<% if !@changes.blank? && @type == "3" %>
<% @changes.each do |cd| %>
<div class="showing-changes-row fontGrey2" style="width:710px;">
<div class="showing-changes-row fontGrey2">
<a class="linkGrey3" id="changed-files">
<img src="/images/vlicon/file.png" width="18" height="20" style="vertical-align:middle;" class="mr5" /><%= cd['new_path'] %>
</a>

View File

@ -1,55 +1,59 @@
<div class="project_r_h">
<div class="fl"><h2 class="project_h2_repository"><%= render :partial => 'breadcrumbs', :locals => {:path => @path, :kind => 'dir', :revision => @rev} %></h2></div>
</div>
<!--<script>-->
<!--// $(document).ready(function(){-->
<!--// $("#changed-files").click(function(){-->
<!--// $("#changed-files-detail").toggle();-->
<!--// });-->
<!--// });-->
<!--</script>-->
<div class="showing-changes-info fontGrey2"> Commit <a href="javascript:void()" class="linkGrey3">
<%= @commit_details.id %></a><br />
<li class="commit js-toggle-container">
<%= render :partial => 'commit_details', :locals => {:changeset => @commit_details} %>
</li>
</div>
<div class="showing-changes-project f14"><%= @commit_details.message %></div>
<!--<div class="showing-changes-row fontGrey2">Showing <a href="javascript:void()" class="linkGrey3" id="changed-files">3 changed files</a> with <span class="c_green">3 additions</span> and <span class="c_red">3 deletions</span>-->
<!--<ol class="mt10" id="changed-files-detail">-->
<!--<li><a href="javascript:void()" class="linkGrey3" id="changed-files">app/views/organizations/_org_course_homework.html.erb</a> </li>-->
<!--<li><a href="javascript:void()" class="linkGrey3" id="changed-files">app/views/users/_course_homework.html.erb</a> </li>-->
<!--<li><a href="javascript:void()" class="linkGrey3" id="changed-files">app/views/users/_user_homework_detail.html.erb</a> </li>-->
<!--</ol>-->
<!--</div>-->
<% @commit_diff.each do |cd| %>
<div class="showing-changes-row fontGrey2">
<a href="javascript:void()" class="linkGrey3" id="changed-files">
<img src="/images/vlicon/file.png" width="18" height="20" style="vertical-align:middle;" class="mr5" /><%= cd.new_path %>
</a>
</div>
<div class="autoscroll">
<table class="filecontent syntaxhl" style="width:100%;" >
<tbody>
<% line_num = diff_line_num(cd.diff) %>
<% diff_content = diff_content(cd.diff) %>
<% syntax_highlight_lines(cd.new_path, Redmine::CodesetUtil.to_utf8_by_setting(diff_content)).each do |line| %>
<tr>
<th class="line-num" id="L<%= line_num %>" style="vertical-align: top;">
<a href="#L<%= line_num %>" style="padding-top: 0px;"><%= line_num %></a>
</th>
<% if line[0,1] == "-" %>
<td class="line-code diff_out"><pre style="width:auto;white-space: nowrap; "><%= line.html_safe %></pre></td>
<% elsif line[0,1] == "+" %>
<td class="line-code diff_in"><pre style="width:auto;white-space: nowrap; "><%= line.html_safe %></pre></td>
<% else%>
<td class="line-code"><pre style="width:auto;white-space: nowrap; "><%= line.html_safe %></pre></td>
<% end %>
</tr>
<% line_num += 1 %>
<% end %>
</tbody>
</table>
</div>
<% end %>
<div class="project_r_h" style="width:730px;">
<div class="fl"><h2 class="project_h2_repository"><%= render :partial => 'breadcrumbs', :locals => {:path => @path, :kind => 'dir', :revision => @rev} %></h2></div>
</div>
<!--<script>-->
<!--// $(document).ready(function(){-->
<!--// $("#changed-files").click(function(){-->
<!--// $("#changed-files-detail").toggle();-->
<!--// });-->
<!--// });-->
<!--</script>-->
<div class="showing-changes-info fontGrey2"> Commit <a href="javascript:void()" class="linkGrey3">
<%= @commit_details.id %></a><br />
<li class="commit js-toggle-container">
<%= render :partial => 'commit_details', :locals => {:changeset => @commit_details} %>
</li>
</div>
<div class="showing-changes-project f14"><%= @commit_details.message %></div>
<!--<div class="showing-changes-row fontGrey2">Showing <a href="javascript:void()" class="linkGrey3" id="changed-files">3 changed files</a> with <span class="c_green">3 additions</span> and <span class="c_red">3 deletions</span>-->
<!--<ol class="mt10" id="changed-files-detail">-->
<!--<li><a href="javascript:void()" class="linkGrey3" id="changed-files">app/views/organizations/_org_course_homework.html.erb</a> </li>-->
<!--<li><a href="javascript:void()" class="linkGrey3" id="changed-files">app/views/users/_course_homework.html.erb</a> </li>-->
<!--<li><a href="javascript:void()" class="linkGrey3" id="changed-files">app/views/users/_user_homework_detail.html.erb</a> </li>-->
<!--</ol>-->
<!--</div>-->
<% @commit_diff.each do |cd| %>
<div class="showing-changes-row fontGrey2">
<a href="javascript:void()" class="linkGrey3" id="changed-files">
<img src="/images/vlicon/file.png" width="18" height="20" style="vertical-align:middle;" class="mr5" /><%= cd.new_path %>
</a>
</div>
<div class="autoscroll">
<table class="filecontent syntaxhl" style="width:100%;" >
<tbody>
<% line_num = diff_line_num(cd.diff) %>
<% diff_content = diff_content(cd.diff) %>
<% syntax_highlight_lines(cd.new_path, Redmine::CodesetUtil.to_utf8_by_setting(diff_content)).each do |line| %>
<tr>
<th class="line-num" id="L<%= line_num %>" style="vertical-align: top;">
<a href="#L<%= line_num %>" style="padding-top: 0px;"><%= line_num %></a>
</th>
<% if line[0,1] == "-" %>
<td class="line-code diff_out"><pre style="width:auto;white-space: nowrap; "><%= line.html_safe %></pre></td>
<% elsif line[0,1] == "+" %>
<td class="line-code diff_in"><pre style="width:auto;white-space: nowrap; "><%= line.html_safe %></pre></td>
<% else%>
<td class="line-code"><pre style="width:auto;white-space: nowrap; "><%= line.html_safe %></pre></td>
<% end %>
</tr>
<% line_num += 1 %>
<% end %>
</tbody>
</table>
</div>
<% end %>
<script>
$(".project_r_h").parent().css({"width":"730px","background-color":"#fff","padding":"10px","margin-left":"10px","margin-bottom":"10px"});
</script>

View File

@ -1,7 +1,7 @@
<% is_expand = st.student_work_projects.empty? %>
<ul id="syllabus_course_ul">
<li class="syllabus_class_list" style="line-height:44px; vertical-align:middle;">
<div class="syllabus_class_w fontGrey3 student_work_<%= st.id%>" style="<%=!is_expand ? '' : 'cursor: pointer;' %>" <%= !is_expand ? '' : "onclick = "+"show_student_work('"+"#{student_work_path(st)}"+"')" %>>
<div class="syllabus_class_w fontGrey3" style="<%=!is_expand ? '' : 'cursor: pointer;' %>" <%= !is_expand ? '' : "onclick = "+"show_student_work('"+"#{student_work_path(st)}"+"')" %>>
<%= link_to(image_tag(url_to_avatar(st.user),:width =>"40",:height => "40", :style => "display:block;"),user_activities_path(st.user), :class => "fl") %>
<% if !is_expand %>
<span class="fl student_work_<%= st.id%>" style="width:105px;">
@ -20,10 +20,10 @@
</span>
<% end %>
<div class="flex-container fl" style="width:376px;">
<div class="flex-cell"><span class="<%= score_color st.teacher_score%> ml35"><%= st.teacher_score.nil? ? "--" : format("%.1f",st.teacher_score)%></span></div>
<div class="flex-cell"><span class="<%= score_color st.teaching_asistant_score%> ml35"><%= st.teaching_asistant_score.nil? ? "--" : format("%.1f",st.teaching_asistant_score)%></span></div>
<div class="flex-cell student_work_<%= st.id%>"><span class="<%= score_color st.teacher_score%> ml35"><%= st.teacher_score.nil? ? "--" : format("%.1f",st.teacher_score)%></span></div>
<div class="flex-cell student_work_<%= st.id%>"><span class="<%= score_color st.teaching_asistant_score%> ml35"><%= st.teaching_asistant_score.nil? ? "--" : format("%.1f",st.teaching_asistant_score)%></span></div>
<% if @homework.anonymous_comment == 0 %>
<div class="flex-cell">
<div class="flex-cell student_work_<%= st.id%>">
<div class="<%= score_color st.student_score%> student_score_info ml35 pr">
<% if st.student_score.nil? %>
<span title="该作品未被匿评">未参与</span>
@ -49,7 +49,9 @@
<div class="<%= score_color score%> student_final_scor_info ml35 pr" style="display: inline">
<%= score.nil? ? "--" : format("%.1f",score<0 ? 0 : score)%>
<% unless score.nil?%>
<div class="g_infoNi none width180" style="line-height: 18px;">
<div class="score-tip none tl" style="line-height: 18px; top:-32px; right:-233px;">
<em></em>
<font></font>
作品最终评分为
<span class="c_red">&nbsp;<%= st.final_score%>&nbsp;</span>分<br/>
迟交扣分
@ -71,7 +73,7 @@
<div class="fr ml5" style="width:25px; color: #3b94d6; white-space:nowrap; text-align:right; margin-right:5px;" onclick = "show_student_work(<%= student_work_path(st)%>)">评分</div>
<% end %>
</div>
<div class="hworkTip" style="display: none; left:700px; top:20px; white-space:nowrap; right:auto;" id="work_click_<%= st.id%>"><em></em><span></span><font class="fontGrey2"><%= !st.student_work_projects.empty? ? '大作品评分即组长的评分' : '点击进行评分' %></font></div>
<div class="hworkTip" style="display: none; left:710px; top:20px; white-space:nowrap; right:auto;" id="work_click_<%= st.id%>"><em></em><span></span><font class="fontGrey2"><%= !st.student_work_projects.empty? ? '大作品评分即组长的评分' : '点击进行评分' %></font></div>
</li>
</ul>

View File

@ -50,7 +50,9 @@
<div class="<%= score_color score%> student_final_scor_info pr" style="display: inline">
<%= score.nil? ? "--" : format("%.1f",score<0 ? 0 : score)%>
<% unless score.nil?%>
<div class="g_infoNi none width180">
<div class="score-tip none tl" style="top:-48px; right:-229px;">
<em></em>
<font></font>
作品最终评分为
<span class="c_red">&nbsp;<%= student_work.final_score%>&nbsp;</span>分。<br/>
迟交扣分

View File

@ -77,7 +77,9 @@
<span class="linkBlue">
(<%= student_work.student_works_scores.where(:reviewer_role => 3).group_by(&:user_id).count%>)
</span>
<div class="infoNi none">
<div class="anonymous-tip none">
<em></em>
<font></font>
现共有
<span class="c_red">&nbsp;<%= student_work.student_works_scores.where(:reviewer_role => 3).group_by(&:user_id).count%>&nbsp;</span>
名学生进行了匿评,平均分为
@ -95,7 +97,9 @@
<td class="hworkList70 <%= score_color score%> student_final_scor_info">
<%= score.nil? ? "--" : format("%.1f",score<0 ? 0 : score)%>
<% unless score.nil?%>
<div class="infoNi none width180" style="line-height: 18px;">
<div class="score-tip none tl" style="line-height: 18px;">
<em></em>
<font></font>
作品最终评分为
<span class="c_red">&nbsp;<%= student_work.final_score%>&nbsp;</span>分<br/>
迟交扣分

View File

@ -62,7 +62,7 @@
<% if User.current.member_of_course?(course) %>
<%=link_to '进入班级', course_path(course), :class => 'btn_orange_big fr mt5', :target => '_blank' %>
<% else %>
<%= link_to "加入班级",join_private_courses_courses_path,:remote => true,:class => "hw_btn_green2 fr mt5",:method => "post"%>
<%= link_to "加入班级",join_private_courses_courses_path,:remote => true,:class => "hw_btn_green fr mt5",:method => "post"%>
<% end %>
<div class="cl"></div>
</ul>

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

@ -19,19 +19,19 @@
<% topics.each do |activity| %>
<div class="list-file">
<div><span class="item_list fl"></span>
<% if activity.parent_id.nil? %> <!--+"(帖子标题)"-->
<%= link_to activity.subject.to_s.html_safe, board_message_path(activity.board_id, activity), :class=> "list-title fl" %>
<% else %>
<%= link_to activity.parent.subject.to_s.html_safe, board_message_path(activity.board_id, activity), :class=> "list-title f1" %>
<% end %>
<% if activity.sticky == 1 %>
<span class="fl ml10 red-cir-btn">顶</span>
<% end%>
<% if activity.locked %>
<span class="fl ml10 green-cir-btn" title="已锁定">锁</span>
<% end %>
<% u = User.where("id=?",activity.author_id).first%>
<div class="cl"></div>
<% if activity.parent_id.nil? %> <!--+"(帖子标题)"-->
<%= link_to activity.subject.to_s.html_safe, User.current.logged? ? board_message_path(activity.board_id, activity) : signin_url_without_domain, :class => "list-title fl" %>
<% else %>
<%= link_to activity.parent.subject.to_s.html_safe, User.current.logged? ? board_message_path(activity.board_id, activity) : signin_url_without_domain, :class => "list-title f1" %>
<% end %>
<% if activity.sticky == 1 %>
<span class="fl ml10 red-cir-btn">顶</span>
<% end%>
<% if activity.locked %>
<span class="fl ml10 green-cir-btn" title="已锁定">锁</span>
<% end %>
<% u = User.where("id=?",activity.author_id).first%>
<div class="cl"></div>
</div>
<div class="massages-content ml15">
<% if activity.parent_id.nil? %>
@ -47,7 +47,7 @@
</span>
<span class="grayTxt">更新:<%= format_time(activity.children.any? ? activity.children.last[:created_on] : activity[:created_on] ) %></span>
<% all_comments = []%>
<% count=get_all_children(all_comments, activity).count %>
<% count=Message.where("root_id = #{activity.id}").count %>
<p class="list-info fr grayTxt"><span><%= count>0 ? "#{count}" : "0" %></span><span>回复</span><span>|</span><span><%= get_praise_num(activity) > 0 ? "#{get_praise_num(activity)}" : "0" %></span><span>赞</span></p>
</div>
<div class="cl"></div>

View File

@ -41,7 +41,7 @@
<div class="cl"></div>
</div>
<% all_comments = []%>
<% all_replies = get_all_children(all_comments, activity) %>
<% all_replies = JournalsForMessage.where("root_id = #{activity.id}").reorder("created_on desc") %>
<% count = all_replies.count %>
<div class="homepagePostReply">
<%= render :partial => 'users/reply_banner', :locals => {:count => count, :activity => activity, :user_activity_id => user_activity_id} %>

View File

@ -81,7 +81,8 @@
<div class="cl"></div>
</div>
<% all_comments = []%>
<% all_replies = get_all_children(all_comments, activity) %>
<%# all_replies = get_all_children(all_comments, activity) %>
<% all_replies = Message.where("root_id = #{activity.id}").reorder("created_on desc") %>
<% count = all_replies.count %>
<div class="homepagePostReply">
<%= render :partial => 'users/reply_banner', :locals => {:count => count, :activity => activity, :user_activity_id => user_activity_id,:is_course => is_course,:is_board =>is_board} %>

View File

@ -19,12 +19,11 @@
<% topics.each do |activity| %>
<div class="list-file">
<div><span class="item_list fl"></span>
<%= link_to activity.title.to_s, news_path(activity), :class => "list-title fl" %>
<%= link_to activity.title.to_s, User.current.logged? ? news_path(activity) : signin_url_without_domain, :class => "list-title fl" %>
<% if activity.sticky == 1 %>
<span class="fl ml10 red-cir-btn">顶</span>
<% end%>
<%# u = User.where("id=?",activity.author_id).first%>
<div class="cl"></div>
<% u = User.where("id=?",activity.author_id).first%> <div class="cl"></div>
</div>
<div class="massages-content ml15">
<p><%=render :partial =>"users/intro_content_ex", :locals=>{:user_activity_id =>activity.id, :content=>activity.description, :maxheight=>54, :maxwordsnum=>100, :maxwidth=>563} %></p>

View File

@ -20,9 +20,9 @@
<div class="list-file">
<div><span class="item_list fl"></span>
<% if activity.parent_id.nil? %> <!--+"(帖子标题)"-->
<%= link_to activity.subject.to_s.html_safe, board_message_path(activity.board_id, activity), :class=> "list-title fl" %>
<%= link_to activity.subject.to_s.html_safe, User.current.logged? ? board_message_path(activity.board_id, activity) : signin_url_without_domain, :class=> "list-title fl" %>
<% else %>
<%= link_to activity.parent.subject.to_s.html_safe, board_message_path(activity.board_id, activity), :class=> "list-title f1" %>
<%= link_to activity.parent.subject.to_s.html_safe, User.current.logged? ? board_message_path(activity.board_id, activity) : signin_url_without_domain, :class=> "list-title f1" %>
<% end %>
<% if activity.sticky == 1 %>
<span class="fl ml10 red-cir-btn">顶</span>
@ -47,7 +47,7 @@
</span>
<span class="grayTxt">更新:<%= format_time(activity.children.any? ? activity.children.last[:created_on] : activity[:created_on] ) %></span>
<% all_comments = []%>
<% count=get_all_children(all_comments, activity).count %>
<% count=Message.where("root_id = #{activity.id}").count %>
<p class="list-info fr grayTxt"><span><%= count>0 ? "#{count}" : "0" %></span><span>回复</span><span>|</span><span><%= get_praise_num(activity) > 0 ? "#{get_praise_num(activity)}" : "0" %></span><span>赞</span></p>
</div>
<div class="cl"></div>

View File

@ -82,7 +82,7 @@
<div class="cl"></div>
</div>
<% all_comments = []%>
<% all_replies = get_all_children(all_comments, activity) %>
<% all_replies = Message.where("root_id = #{activity.id}").reorder("created_on desc") %>
<% count = all_replies.count %>
<%# allow_delete = (activity.user == User.current || User.current.admin? || User.current.allowed_to?(:as_teacher,activity.course)) %>
<%# count = fetch_user_leaveWord_reply(activity).count %>

View File

@ -41,8 +41,8 @@
</div>
<div class="cl"></div>
</div>
<% all_comments = []%>
<% all_replies = get_all_children(all_comments, activity) %>
<%# all_comments = []%>
<% all_replies = BlogComment.where("root_id = #{activity.id}").reorder("created_on desc") %>
<% count = all_replies.count %>
<div class="homepagePostReply">
<%= render :partial => 'users/reply_banner', :locals => {:count => count, :activity => activity, :user_activity_id => user_activity_id, :homepage => 0} %>

View File

@ -63,7 +63,7 @@
<div class="cl"></div>
</div>
<% all_comments = []%>
<% all_replies = get_all_children(all_comments, activity) %>
<% all_replies = JournalsForMessage.where("root_id = #{activity.id}").reorder("created_on desc") %>
<% count = all_replies.count %>
<div class="homepagePostReply">
<%= render :partial => 'users/reply_banner', :locals => {:count => count, :activity => activity, :user_activity_id => user_activity_id} %>

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

@ -1,83 +1,87 @@
<!--modified by young-->
<div class="project_r_h">
<h2 class="project_h2"><%= l(:label_roadmap) %></h2>
</div>
<div class="contextual" style="overflow: hidden;text-overflow: ellipsis;white-space: nowrap;">
<%= link_to(l(:button_edit), edit_version_path(@version), :class => 'icon icon-edit') if User.current.allowed_to?(:manage_versions, @version.project) %>
<%#= link_to_if_authorized(l(:button_edit_associated_wikipage,
:page_title => @version.wiki_page_title.truncate(30, omission: '...')),
{:controller => 'wiki',
:action => 'edit',
:project_id => @version.project,
:id => Wiki.titleize(@version.wiki_page_title)},
:class => 'icon icon-edit') unless @version.wiki_page_title.blank? || @version.project.wiki.nil? %>
<%= delete_link version_path(@version, :back_url => url_for(:controller => 'versions',
:action => 'index',
:project_id => @version.project)) if User.current.allowed_to?(:manage_versions, @version.project) %>
<%= call_hook(:view_versions_show_contextual, { :version => @version, :project => @project }) %>
</div>
<h3 style="word-break: break-all;word-wrap: break-word;color: #64BDD9;">
<%= h(@version.name) %>
</h3>
<div id="roadmap">
<%= render :partial => 'versions/overview', :locals => {:version => @version} %>
<%= render(:partial => "wiki/content", :locals => {:content => @version.wiki_page.content}) if @version.wiki_page %>
<div class="splitcontent">
<% if @version.estimated_hours > 0 || User.current.allowed_to?(:view_time_entries, @project) %>
<fieldset class="time_tracter f14"><legend><%= l(:label_time_tracking) %></legend>
<table>
<tr>
<th>
<p class="fl c_grey f12"><%= l(:field_estimated_hours) %></p>
</th>
<td class="total-hours">
<%= html_hours(l_hours(@version.estimated_hours)) %>
</td>
</tr>
<% if User.current.allowed_to?(:view_time_entries, @project) %>
<tr>
<th>
<p class="fr c_grey f12"><%= l(:label_spent_time) %></p>
</th>
<td class="total-hours">
<%= html_hours(l_hours(@version.spent_hours)) %>
</td>
</tr>
<% end %>
</table>
</fieldset>
<% end %>
<div id="status_by" style="margin-top:10px;"><!--by young-->
<%= render_issue_status_by(@version, params[:status_by]) if @version.fixed_issues.count > 0 %>
</div>
</div>
<% if @issues.present? %>
<%= form_tag({}) do -%>
<table class="list related-issues">
<caption>
<%= l(:label_related_issues) %>
</caption>
<%- @issues.each do |issue| -%>
<tr class="hascontextmenu">
<td class="checkbox">
<%= check_box_tag 'ids[]', issue.id, false, :id => nil %>
</td>
<td>
<%= link_to_issue(issue, :project => (@project != issue.project)) %>
</td>
</tr>
<% end %>
</table>
<% end %>
<%= context_menu issues_context_menu_path %>
<% end %>
</div>
<%= call_hook :view_versions_show_bottom, :version => @version %>
<% html_title @version.name %>
<!--modified by young-->
<div class="project_r_h">
<h2 class="project_h2"><%= l(:label_roadmap) %></h2>
</div>
<div class="contextual" style="overflow: hidden;text-overflow: ellipsis;white-space: nowrap;">
<%= link_to(l(:button_edit), edit_version_path(@version), :class => 'icon icon-edit') if User.current.allowed_to?(:manage_versions, @version.project) %>
<%#= link_to_if_authorized(l(:button_edit_associated_wikipage,
:page_title => @version.wiki_page_title.truncate(30, omission: '...')),
{:controller => 'wiki',
:action => 'edit',
:project_id => @version.project,
:id => Wiki.titleize(@version.wiki_page_title)},
:class => 'icon icon-edit') unless @version.wiki_page_title.blank? || @version.project.wiki.nil? %>
<%= delete_link version_path(@version, :back_url => url_for(:controller => 'versions',
:action => 'index',
:project_id => @version.project)) if User.current.allowed_to?(:manage_versions, @version.project) %>
<%= call_hook(:view_versions_show_contextual, { :version => @version, :project => @project }) %>
</div>
<h3 style="word-break: break-all;word-wrap: break-word;color: #64BDD9;">
<%= h(@version.name) %>
</h3>
<div id="roadmap">
<%= render :partial => 'versions/overview', :locals => {:version => @version} %>
<%= render(:partial => "wiki/content", :locals => {:content => @version.wiki_page.content}) if @version.wiki_page %>
<div class="splitcontent">
<% if @version.estimated_hours > 0 || User.current.allowed_to?(:view_time_entries, @project) %>
<fieldset class="time_tracter f14"><legend><%= l(:label_time_tracking) %></legend>
<table>
<tr>
<th>
<p class="fl c_grey f12"><%= l(:field_estimated_hours) %></p>
</th>
<td class="total-hours">
<%= html_hours(l_hours(@version.estimated_hours)) %>
</td>
</tr>
<% if User.current.allowed_to?(:view_time_entries, @project) %>
<tr>
<th>
<p class="fr c_grey f12"><%= l(:label_spent_time) %></p>
</th>
<td class="total-hours">
<%= html_hours(l_hours(@version.spent_hours)) %>
</td>
</tr>
<% end %>
</table>
</fieldset>
<% end %>
<div id="status_by" style="margin-top:10px;"><!--by young-->
<%= render_issue_status_by(@version, params[:status_by]) if @version.fixed_issues.count > 0 %>
</div>
</div>
<% if @issues.present? %>
<%= form_tag({}) do -%>
<table class="list related-issues">
<caption>
<%= l(:label_related_issues) %>
</caption>
<%- @issues.each do |issue| -%>
<tr class="hascontextmenu">
<td class="checkbox">
<%= check_box_tag 'ids[]', issue.id, false, :id => nil %>
</td>
<td>
<%= link_to_issue(issue, :project => (@project != issue.project)) %>
</td>
</tr>
<% end %>
</table>
<% end %>
<%= context_menu issues_context_menu_path %>
<% end %>
</div>
<%= call_hook :view_versions_show_bottom, :version => @version %>
<% html_title @version.name %>
<script>
$(".project_r_h").parent().css({"width":"730px","background-color":"#fff","padding":"10px","margin-left":"10px","margin-bottom":"10px"});
</script>

View File

@ -16,15 +16,31 @@
<div class="mt5 fl"><%= image_tag("search_icon_03.png", :width=>"8", :height=>"16" ,:class=>"fl") %><span class="searchTag"><%= get_user_identity(User.find(item.id).user_extensions.identity) %></span></div>
<div class="cl"></div>
</li>
<li class="fontGrey3 mb5"><%= User.find(item.id).user_extensions && User.find(item.id).user_extensions.brief_introduction.present? ? User.find(item.id).user_extensions.brief_introduction : '这位童鞋很懒,什么也没有留下~'%></li>
<% user = User.find(item.id)%>
<li class="fontGrey3 mb5"><%= user.user_extensions && user.user_extensions.brief_introduction.present? ? user.user_extensions.brief_introduction : '这位童鞋很懒,什么也没有留下~'%></li>
<li class="f12 fontGrey2">
<span class="mr30">加入时间:<%= format_date( User.find(item.id).created_on)%></span><span class="mr30">
最后登录时间:<%= format_date( User.find(item.id).last_login_on)%></span><span class="mr30">
<%= User.find(item.id).user_extensions.occupation.present? ? '单位:'+User.find(item.id).user_extensions.occupation : ''%></span></li>
<span class="mr30">加入时间:<%= format_date( user.created_on)%></span><span class="mr30">
最后登录时间:<%= format_date( user.last_login_on)%></span><span class="mr30">
<%=user.show_occupation.nil? ? "": "单位:"+user.show_occupation %></span></li>
</ul>
</li>
<div class="cl"></div>
</ul>
<% when 'syllabus'%>
<ul class="searchContent w968">
<li class="f16 mb5 fontGrey3">
<a href="<%= syllabus_path(item.id)%>" class="fontGrey3 fl"><%= item.try(:highlight).try(:title) ? item.highlight.title[0].html_safe : item.title %>课程</a>
<div class="mt5 fl"><%= image_tag("search_icon_03.png", :width=>"8", :height=>"16" ,:class=>"fl") %><span class="searchTag">课程</span></div><div class="cl"></div></li>
<li class="f12 fontGrey2">
<% user = User.find(item.user_id)%>
<% syllabus = Syllabus.find(item.id) %>
<span class="mr30">创建者:<%=user.login+"("+user.show_name+")"%></span>
<span class="mr30">教师团队:<%=syllabus.syllabus_members.count%></span>
<span class="mr30">班级:<%=syllabus.courses.count%></span>
<span class="mr30">更新时间:<%=format_date(item.updated_at)%></span>
<span class="mr30"><%=user.show_occupation.nil? ? "": "单位:"+user.show_occupation %></span>
</li>
</ul>
<% when 'course'%>
<ul class="searchContent">
<li class="fl">
@ -38,10 +54,11 @@
</li>
<li class="fontGrey3 mb5"><%= item.try(:highlight).try(:description) ? item.highlight.description[0].html_safe : item.description %></li>
<li class="f12 fontGrey2">
<span class="mr30">教师:<%= User.find(item.tea_id).realname %></span>
<% user = User.find(item.tea_id)%>
<span class="mr30">教师:<%= user.realname %></span>
<span class="mr30">授课时间:<%= item.time.to_s + item.term%></span>
<span class="mr30">更新时间:<%= format_date(item.updated_at)%></span>
<span class="mr30"><%= User.find(item.tea_id).user_extensions.occupation.present? ? '单位:'+User.find(item.tea_id).user_extensions.occupation : ''%></span></li>
<span class="mr30"><%=user.show_occupation.nil? ? "": "单位:"+user.show_occupation %></span></li>
</ul>
</li>
<div class="cl"></div>
@ -56,7 +73,8 @@
<div class="mt5 fl"><%= image_tag("search_icon_03.png", :width=>"8", :height=>"16" ,:class=>"fl") %><span class="searchTag">资源</span></div>
<div class="cl"></div>
</li>
<li class="f12 fontGrey2"><span class="mr30">发布者:<%= User.find(item.author_id).login%><%= User.find(item.author_id).realname%></span>
<% user = User.find(item.author_id)%>
<li class="f12 fontGrey2"><span class="mr30">发布者:<%= user.login%><%= user.realname%></span>
<!--<span class="mr30">职称:<%#= get_technical_title User.find(item.author_id) %></span>-->
<span class="mr30">发布时间:<%= format_date(item.created_on)%></span>
<span class="mr30">下载次数:<%= item.downloads%>次</span>

View File

@ -10,7 +10,8 @@
<div class="mt5 fl"><%= image_tag("search_icon_03.png", :width=>"8", :height=>"16" ,:class=>"fl") %><span class="searchTag">资源</span></div>
<div class="cl"></div>
</li>
<li class="f12 fontGrey2"><span class="mr30">发布者:<%= User.find(attachment.author_id).login%><%= User.find(attachment.author_id).realname%></span>
<% user = User.find(attachment.author_id)%>
<li class="f12 fontGrey2"><span class="mr30">发布者:<%= user.login%><%= user.realname%></span>
<!--<span class="mr30">职称:<%#= get_technical_title User.find(attachment.author_id) %></span>-->
<span class="mr30">发布时间:<%= format_date(attachment.created_on)%></span>
<span class="mr30">下载次数:<%= attachment.downloads%>次</span>
@ -21,6 +22,6 @@
</ul>
<% end %>
<div class="pageRoll">
<!%= paginate attachments,:params => {:controller => 'welcome', :action => 'search',:search_type=>'attachment'}%>
<%= paginate attachments,:params => {:controller => 'welcome', :action => 'search',:search_type=>'attachment'}%>
</div>
<% end %>

View File

@ -13,10 +13,11 @@
</li>
<li class="fontGrey3 mb5"><%= course.try(:highlight).try(:description) ? course.highlight.description[0].html_safe : (course.description.present? ? course.description : '暂时没有该班级描述') %></li>
<li class="f12 fontGrey2">
<span class="mr30">教师:<%= User.find(course.tea_id).realname %></span>
<% user = User.find(course.tea_id)%>
<span class="mr30">教师:<%= user.realname %></span>
<span class="mr30">授课时间:<%= course.time.to_s + course.term%></span>
<span class="mr30">更新时间:<%= format_date(course.updated_at)%></span>
<span class="mr30"><%= User.find(course.tea_id).user_extensions.occupation.present? ? '单位:'+User.find(course.tea_id).user_extensions.occupation : ''%></span></li>
<span class="mr30"><%=user.show_occupation.nil? ? "": "单位:"+user.show_occupation %></span></li>
</ul>
</li>
<div class="cl"></div>

View File

@ -0,0 +1,22 @@
<% unless syllabuses.nil? || syllabuses.empty?%>
<% syllabuses.each do |item|%>
<ul class="searchContent w968">
<li class="f16 mb5 fontGrey3">
<!--<a href="<%#= syllabus_path(syllabus.id)%>" class="fontGrey3 fl"><span class="c_red"><%#= syllabus.title %></span>课程</a>-->
<a href="<%= syllabus_path(item.id)%>" class="fontGrey3 fl"><%= item.try(:highlight).try(:title) ? item.highlight.title[0].html_safe : item.title %>课程</a>
<div class="mt5 fl"><%= image_tag("search_icon_03.png", :width=>"8", :height=>"16" ,:class=>"fl") %><span class="searchTag">课程</span></div><div class="cl"></div></li>
<li class="f12 fontGrey2">
<% user = User.find(item.user_id)%>
<% syllabus = Syllabus.find(item.id) %>
<span class="mr30">创建者:<%=user.login+"("+user.show_name+")"%></span>
<span class="mr30">教师团队:<%=syllabus.syllabus_members.count%></span>
<span class="mr30">班级:<%=syllabus.courses.count%></span>
<span class="mr30">更新时间:<%=format_date(syllabus.updated_at)%></span>
<span class="mr30"><%=user.show_occupation.nil? ? "": "单位:"+user.show_occupation %></span>
</li>
</ul>
<% end %>
<div class="pageRoll">
<%= paginate syllabuses,:params => {:controller => 'welcome', :action => 'search',:search_type=>'syllabus'}%>
</div>
<% end %>

View File

@ -1,20 +1,21 @@
<% unless users.nil? || users.empty?%>
<% users.each do |user|%>
<% users.each do |item|%>
<ul class="searchContent">
<li class="fl">
<!--<img src="images/homepageImage.jpg" alt="个人图片" width="75" height="75" class="searchCourseImage" />-->
<%= link_to image_tag(url_to_avatar(User.find(user.id)), :width => "75", :height => "75",:class=>'searchCourseImage'), user_path(user.id), :alt => "用户头像" %>
<% user = User.find(item.id)%>
<%= link_to image_tag(url_to_avatar(user), :width => "75", :height => "75",:class=>'searchCourseImage'), user_path(user.id), :alt => "用户头像" %>
</li>
<li class="fl searchContentDes">
<ul class="fl">
<li class="f16 mb5"><a href="<%= user_path(user.id)%>" class="fontGrey3 fl"><%= user.try(:highlight).try(:login) ? user.highlight.login[0].html_safe : user.login %>(<%= user.try(:highlight).try(:lastname) ? user.highlight.lastname[0].html_safe : user.lastname%><%= user.try(:highlight).try(:firstname) ? user.highlight.firstname[0].html_safe : user.firstname %>)</a>
<div class="mt5 fl"><%= image_tag("search_icon_03.png", :width=>"8", :height=>"16" ,:class=>"fl") %><span class="searchTag"><%= get_user_identity(User.find(user.id).user_extensions.identity) %></span></div>
<li class="f16 mb5"><a href="<%= user_path(user.id)%>" class="fontGrey3 fl"><%= item.try(:highlight).try(:login) ? item.highlight.login[0].html_safe : user.login %>(<%= item.try(:highlight).try(:lastname) ? item.highlight.lastname[0].html_safe : user.lastname%><%= item.try(:highlight).try(:firstname) ? item.highlight.firstname[0].html_safe : user.firstname %>)</a>
<div class="mt5 fl"><%= image_tag("search_icon_03.png", :width=>"8", :height=>"16" ,:class=>"fl") %><span class="searchTag"><%= get_user_identity(user.user_extensions.identity) %></span></div>
<div class="cl"></div>
</li>
<li class="fontGrey3 mb5"><%= User.find(user.id).user_extensions && User.find(user.id).user_extensions.brief_introduction.present? ? User.find(user.id).user_extensions.brief_introduction : '这位童鞋很懒,什么也没有留下~'%></li>
<li class="f12 fontGrey2"><span class="mr30">加入时间:<%= format_date( User.find(user.id).created_on)%></span><span class="mr30">
最后登录时间:<%= format_date( User.find(user.id).last_login_on)%></span><span class="mr30">
<%= User.find(user.id).user_extensions.occupation.present? ? '单位:'+User.find(user.id).user_extensions.occupation : ''%></span></li>
<li class="fontGrey3 mb5"><%= user.user_extensions && user.user_extensions.brief_introduction.present? ? user.user_extensions.brief_introduction : '这位童鞋很懒,什么也没有留下~'%></li>
<li class="f12 fontGrey2"><span class="mr30">加入时间:<%= format_date( user.created_on)%></span><span class="mr30">
最后登录时间:<%= format_date( user.last_login_on)%></span><span class="mr30">
<%=user.show_occupation.nil? ? "": "单位:"+user.show_occupation %></span></li>
</ul>
</li>
<div class="cl"></div>

View File

@ -3,7 +3,7 @@
function g(o){return document.getElementById(o);}
function HoverLi(n){
//如果有N个标签,就将i<=N;
for(var i=1;i<=6;i++){
for(var i=1;i<=7;i++){
g('searchBaner_'+i).className='searchBannerNormal';
g('searchContent_'+i).className='undis';g('searchNum_'+i).className="numRed";
g('searchType_'+i).className="fontGrey2 f14";
@ -23,12 +23,14 @@
//$("#searchContent_2").html('<%#= escape_javascript(render :partial => 'search_user_results',:locals => {:users=>@users})%>');
search('user')
}else if(n == 3){
search('course')
search('syllabus')
}else if(n == 4){
search('attachment')
search('course')
}else if(n == 5){
search('project')
search('attachment')
}else if(n == 6){
search('project')
}else if(n == 7){
search('memo')
}
}
@ -49,19 +51,22 @@
}else if('<%= @search_type%>' == 'user'){
HoverLi(2)
$("#searchContent_2").html('<%= escape_javascript(render :partial => 'search_user_results',:locals => {:users=>@users})%>');
}else if('<%= @search_type%>' == 'course'){
}else if('<%= @search_type%>' == 'syllabus'){
HoverLi(3)
$("#searchContent_3").html('<%= escape_javascript(render :partial => 'search_course_results',:locals => {:courses=>@courses})%>');
}else if('<%= @search_type%>' == 'attachment'){
$("#searchContent_3").html('<%= escape_javascript(render :partial => 'search_syllabus_results',:locals => {:syllabuses=>@syllabuses})%>');
}else if('<%= @search_type%>' == 'course'){
HoverLi(4)
$("#searchContent_4").html('<%= escape_javascript(render :partial => 'search_attachment_results',:locals => {:attachments=>@attachments})%>');
}else if('<%= @search_type%>' == 'project'){
$("#searchContent_4").html('<%= escape_javascript(render :partial => 'search_course_results',:locals => {:courses=>@courses})%>');
}else if('<%= @search_type%>' == 'attachment'){
HoverLi(5)
$("#searchContent_5").html('<%= escape_javascript(render :partial => 'search_project_results',:locals => {:projects=>@projects})%>');
$("#searchContent_5").html('<%= escape_javascript(render :partial => 'search_attachment_results',:locals => {:attachments=>@attachments})%>');
}else if('<%= @search_type%>' == 'project'){
HoverLi(6)
$("#searchContent_6").html('<%= escape_javascript(render :partial => 'search_project_results',:locals => {:projects=>@projects})%>');
}else if('<%= @search_type%>' == 'memo')
{
HoverLi(6)
$("#searchContent_6").html('<%= escape_javascript(render :partial => 'search_memo_results',:locals => {:memos=>@memos})%>');
HoverLi(7)
$("#searchContent_7").html('<%= escape_javascript(render :partial => 'search_memo_results',:locals => {:memos=>@memos})%>');
}
})
//如果要做成点击后再转到请将<li>中的onmouseover 改成 onclick;
@ -79,10 +84,11 @@
<ul id="searchBanner">
<li id="searchBaner_1" class="searchBannerActive" onclick="HoverLi(1);on_click_search(1);"><a href="javascript:void(0);" id="searchType_1" class="fontGrey3 f14">全部<span style="font-weight:normal;"><font id="searchNum_1" class="c_red">(<%= @total_count%>)</font></span></a></li>
<li id="searchBaner_2" onclick="HoverLi(2);on_click_search(2);"><a href="javascript:void(0);" id="searchType_2" class="fontGrey2 f14">用户<span class="numRed" style="font-weight:normal;"><font id="searchNum_2" class="numRed">(<%= @users_count%>)</font></span></a></li>
<li id="searchBaner_3" onclick="HoverLi(3);on_click_search(3);"><a href="javascript:void(0);" id="searchType_3" class="fontGrey2 f14">班级<span style="font-weight:normal;"><font id="searchNum_3" class="numRed">(<%=@course_count%>)</font></span></a></li>
<li id="searchBaner_4" onclick="HoverLi(4);on_click_search(4);"><a href="javascript:void(0);" id="searchType_4" class="fontGrey2 f14">资源<span class="numRed" style="font-weight:normal;"><font id="searchNum_4" class="numRed">(<%= @attach_count%>)</font></span></a></li>
<li id="searchBaner_5" onclick="HoverLi(5);on_click_search(5);"><a href="javascript:void(0);" id="searchType_5" class="fontGrey2 f14">项目<span class="numRed" style="font-weight:normal;"><font id="searchNum_5" class="numRed">(<%= @project_count%>)</font></span></a></li>
<li id="searchBaner_6" onclick="HoverLi(6);on_click_search(6);"><a href="javascript:void(0);" id="searchType_6" class="fontGrey2 f14">帖子<span class="numRed" style="font-weight:normal;"><font id="searchNum_6" class="numRed">(<%= @memo_count%>)</font></span></a></li>
<li id="searchBaner_3" onclick="HoverLi(3);on_click_search(3);"><a href="javascript:void(0);" id="searchType_3" class="fontGrey2 f14">课程<span style="font-weight:normal;"><font id="searchNum_3" class="numRed">(<%=@syllabus_count%>)</font></span></a></li>
<li id="searchBaner_4" onclick="HoverLi(4);on_click_search(4);"><a href="javascript:void(0);" id="searchType_4" class="fontGrey2 f14">班级<span style="font-weight:normal;"><font id="searchNum_4" class="numRed">(<%=@course_count%>)</font></span></a></li>
<li id="searchBaner_5" onclick="HoverLi(5);on_click_search(5);"><a href="javascript:void(0);" id="searchType_5" class="fontGrey2 f14">资源<span class="numRed" style="font-weight:normal;"><font id="searchNum_5" class="numRed">(<%= @attach_count%>)</font></span></a></li>
<li id="searchBaner_6" onclick="HoverLi(6);on_click_search(6);"><a href="javascript:void(0);" id="searchType_6" class="fontGrey2 f14">项目<span class="numRed" style="font-weight:normal;"><font id="searchNum_6" class="numRed">(<%= @project_count%>)</font></span></a></li>
<li id="searchBaner_7" onclick="HoverLi(7);on_click_search(7);"><a href="javascript:void(0);" id="searchType_7" class="fontGrey2 f14">帖子<span class="numRed" style="font-weight:normal;"><font id="searchNum_7" class="numRed">(<%= @memo_count%>)</font></span></a></li>
<div class="cl"></div>
</ul>
<ul id="searchTips" style="display:none;">
@ -97,13 +103,15 @@
<div id="searchContent_3" class="undis">
</div>
<div id="searchContent_4" class="undis">
</div>
<div id="searchContent_5" class="undis">
</div>
<div id="searchContent_6" class="undis">
</div>
<div id="searchContent_7" class="undis">
</div>
</div>
</div>

View File

@ -3,13 +3,15 @@
$("#searchContent_1").html('<%= escape_javascript(render :partial => 'search_all_results',:locals => {:all_results=> @alls})%>');
<% when 'user'%>
$("#searchContent_2").html('<%= escape_javascript(render :partial => 'search_user_results',:locals => {:users=>@users})%>');
<% when 'syllabus'%>
$("#searchContent_3").html('<%= escape_javascript(render :partial => 'search_syllabus_results',:locals => {:syllabuses=>@syllabuses})%>');
<% when 'course'%>
$("#searchContent_3").html('<%= escape_javascript(render :partial => 'search_course_results',:locals => {:courses=>@courses})%>');
$("#searchContent_4").html('<%= escape_javascript(render :partial => 'search_course_results',:locals => {:courses=>@courses})%>');
<% when 'project'%>
$("#searchContent_5").html('<%= escape_javascript(render :partial => 'search_project_results',:locals => {:projects=>@projects})%>');
$("#searchContent_6").html('<%= escape_javascript(render :partial => 'search_project_results',:locals => {:projects=>@projects})%>');
<% when 'attachment'%>
$("#searchContent_4").html('<%= escape_javascript(render :partial => 'search_attachment_results',:locals => {:attachments=>@attachments})%>');
$("#searchContent_5").html('<%= escape_javascript(render :partial => 'search_attachment_results',:locals => {:attachments=>@attachments})%>');
<% when 'memo'%>
$("#searchContent_6").html('<%= escape_javascript(render :partial => 'search_memo_results',:locals => {:memos=>@memos})%>');
$("#searchContent_7").html('<%= escape_javascript(render :partial => 'search_memo_results',:locals => {:memos=>@memos})%>');
<%else%>
<%end %>

View File

@ -0,0 +1,73 @@
class AddRootId < ActiveRecord::Migration
def change
add_column :messages, :root_id, :integer, :default => nil
add_column :journals_for_messages, :root_id, :integer, :default => nil
add_column :blog_comments, :root_id, :integer, :default => nil
add_column :org_document_comments, :root_id, :integer, :default => nil
add_index :messages, :root_id
add_index :journals_for_messages,:root_id
add_index :blog_comments,:root_id
add_index :org_document_comments,:root_id
def get_base_parent comment
comm = comment
while comm.parent
comm = comm.parent
end
comm
end
count = Message.all.count / 30 + 2
transaction do
for i in 1 ... count do i
Message.page(i).per(30).each do |message|
unless message.parent.nil?
parent = get_base_parent message
message.update_column('root_id', parent.id)
end
end
end
end
count = JournalsForMessage.all.count / 30 + 2
transaction do
for i in 1 ... count do i
JournalsForMessage.page(i).per(30).each do |message|
if message.jour_type == "HomeworkCommon" || message.jour_type == "Syllabus"
message.update_column('root_id', message.jour_id)
else
unless message.parent.nil?
parent = get_base_parent message
message.update_column('root_id', parent.id)
end
end
end
end
end
count = BlogComment.all.count / 30 + 2
transaction do
for i in 1 ... count do i
BlogComment.page(i).per(30).each do |message|
unless message.parent.nil?
parent = get_base_parent message
message.update_column('root_id', parent.id)
end
end
end
end
count = OrgDocumentComment.all.count / 30 + 2
transaction do
for i in 1 ... count do i
OrgDocumentComment.page(i).per(30).each do |message|
unless message.parent.nil?
parent = get_base_parent message
message.update_column('root_id', parent.id)
end
end
end
end
end
end

View File

@ -11,7 +11,7 @@
#
# It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20161009053958) do
ActiveRecord::Schema.define(:version => 20161011012114) do
create_table "activities", :force => true do |t|
t.integer "act_id", :null => false
@ -52,28 +52,6 @@ ActiveRecord::Schema.define(:version => 20161009053958) do
add_index "api_keys", ["access_token"], :name => "index_api_keys_on_access_token"
add_index "api_keys", ["user_id"], :name => "index_api_keys_on_user_id"
create_table "application_settings", :force => true do |t|
t.integer "default_projects_limit"
t.boolean "signup_enabled"
t.boolean "signin_enabled"
t.boolean "gravatar_enabled"
t.text "sign_in_text"
t.datetime "created_at"
t.datetime "updated_at"
t.string "home_page_url"
t.integer "default_branch_protection", :default => 2
t.boolean "twitter_sharing_enabled", :default => true
t.text "restricted_visibility_levels"
t.boolean "version_check_enabled", :default => true
t.integer "max_attachment_size", :default => 10, :null => false
t.integer "default_project_visibility"
t.integer "default_snippet_visibility"
t.text "restricted_signup_domains"
t.boolean "user_oauth_applications", :default => true
t.string "after_sign_out_path"
t.integer "session_expire_delay", :default => 10080, :null => false
end
create_table "applied_messages", :force => true do |t|
t.integer "user_id"
t.integer "applied_id"
@ -206,20 +184,6 @@ ActiveRecord::Schema.define(:version => 20161009053958) do
t.string "typeName", :limit => 50
end
create_table "audit_events", :force => true do |t|
t.integer "author_id", :null => false
t.string "type", :null => false
t.integer "entity_id", :null => false
t.string "entity_type", :null => false
t.text "details"
t.datetime "created_at"
t.datetime "updated_at"
end
add_index "audit_events", ["author_id"], :name => "index_audit_events_on_author_id"
add_index "audit_events", ["entity_id", "entity_type"], :name => "index_audit_events_on_entity_id_and_entity_type"
add_index "audit_events", ["type"], :name => "index_audit_events_on_type"
create_table "auth_sources", :force => true do |t|
t.string "type", :limit => 30, :default => "", :null => false
t.string "name", :limit => 60, :default => "", :null => false
@ -285,8 +249,11 @@ ActiveRecord::Schema.define(:version => 20161009053958) do
t.integer "reply_id"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.integer "root_id"
end
add_index "blog_comments", ["root_id"], :name => "index_blog_comments_on_root_id"
create_table "blogs", :force => true do |t|
t.string "name", :default => "", :null => false
t.text "description"
@ -317,17 +284,6 @@ ActiveRecord::Schema.define(:version => 20161009053958) do
add_index "boards", ["last_message_id"], :name => "index_boards_on_last_message_id"
add_index "boards", ["project_id"], :name => "boards_project_id"
create_table "broadcast_messages", :force => true do |t|
t.text "message", :null => false
t.datetime "starts_at"
t.datetime "ends_at"
t.integer "alert_type"
t.datetime "created_at"
t.datetime "updated_at"
t.string "color"
t.string "font"
end
create_table "bug_to_osps", :force => true do |t|
t.integer "osp_id"
t.integer "relative_memo_id"
@ -357,16 +313,14 @@ ActiveRecord::Schema.define(:version => 20161009053958) do
add_index "changeset_parents", ["parent_id"], :name => "changeset_parents_parent_ids"
create_table "changesets", :force => true do |t|
t.integer "repository_id", :null => false
t.string "revision", :null => false
t.integer "repository_id", :null => false
t.string "revision", :null => false
t.string "committer"
t.datetime "committed_on", :null => false
t.datetime "committed_on", :null => false
t.text "comments"
t.date "commit_date"
t.string "scmid"
t.integer "user_id"
t.integer "project_id"
t.integer "type", :default => 0
end
add_index "changesets", ["committed_on"], :name => "index_changesets_on_committed_on"
@ -715,15 +669,6 @@ ActiveRecord::Schema.define(:version => 20161009053958) do
add_index "delayed_jobs", ["priority", "run_at"], :name => "delayed_jobs_priority"
create_table "deploy_keys_projects", :force => true do |t|
t.integer "deploy_key_id", :null => false
t.integer "project_id", :null => false
t.datetime "created_at"
t.datetime "updated_at"
end
add_index "deploy_keys_projects", ["project_id"], :name => "index_deploy_keys_projects_on_project_id"
create_table "discuss_demos", :force => true do |t|
t.string "title"
t.text "body"
@ -773,16 +718,6 @@ ActiveRecord::Schema.define(:version => 20161009053958) do
t.datetime "created_at"
end
create_table "emails", :force => true do |t|
t.integer "user_id", :null => false
t.string "email", :null => false
t.datetime "created_at"
t.datetime "updated_at"
end
add_index "emails", ["email"], :name => "index_emails_on_email", :unique => true
add_index "emails", ["user_id"], :name => "index_emails_on_user_id"
create_table "enabled_modules", :force => true do |t|
t.integer "project_id"
t.string "name", :null => false
@ -805,25 +740,6 @@ ActiveRecord::Schema.define(:version => 20161009053958) do
add_index "enumerations", ["id", "type"], :name => "index_enumerations_on_id_and_type"
add_index "enumerations", ["project_id"], :name => "index_enumerations_on_project_id"
create_table "events", :force => true do |t|
t.string "target_type"
t.integer "target_id"
t.string "title"
t.text "data"
t.integer "project_id"
t.datetime "created_at"
t.datetime "updated_at"
t.integer "action"
t.integer "author_id"
end
add_index "events", ["action"], :name => "index_events_on_action"
add_index "events", ["author_id"], :name => "index_events_on_author_id"
add_index "events", ["created_at"], :name => "index_events_on_created_at"
add_index "events", ["project_id"], :name => "index_events_on_project_id"
add_index "events", ["target_id"], :name => "index_events_on_target_id"
add_index "events", ["target_type"], :name => "index_events_on_target_type"
create_table "exercise_answers", :force => true do |t|
t.integer "user_id"
t.integer "exercise_question_id"
@ -926,15 +842,6 @@ ActiveRecord::Schema.define(:version => 20161009053958) do
add_index "forge_messages", ["forge_message_id", "forge_message_type"], :name => "index_forge_messages_on_forge_message_id_and_forge_message_type"
add_index "forge_messages", ["user_id", "project_id", "created_at"], :name => "index_forge_messages_on_user_id_and_project_id_and_created_at"
create_table "forked_project_links", :force => true do |t|
t.integer "forked_to_project_id", :null => false
t.integer "forked_from_project_id", :null => false
t.datetime "created_at"
t.datetime "updated_at"
end
add_index "forked_project_links", ["forked_to_project_id"], :name => "index_forked_project_links_on_forked_to_project_id", :unique => true
create_table "forums", :force => true do |t|
t.string "name", :null => false
t.text "description"
@ -1064,21 +971,6 @@ ActiveRecord::Schema.define(:version => 20161009053958) do
t.datetime "updated_at", :null => false
end
create_table "identities", :force => true do |t|
t.string "extern_uid"
t.string "provider"
t.integer "user_id"
t.datetime "created_at"
t.datetime "updated_at"
end
add_index "identities", ["created_at", "id"], :name => "index_identities_on_created_at_and_id"
add_index "identities", ["user_id"], :name => "index_identities_on_user_id"
create_table "innodb_monitor", :id => false, :force => true do |t|
t.integer "a"
end
create_table "invite_lists", :force => true do |t|
t.integer "project_id"
t.integer "user_id"
@ -1223,21 +1115,10 @@ ActiveRecord::Schema.define(:version => 20161009053958) do
t.integer "m_reply_id"
t.integer "is_comprehensive_evaluation"
t.integer "private", :default => 0
t.integer "root_id"
end
create_table "keys", :force => true do |t|
t.integer "user_id"
t.datetime "created_at"
t.datetime "updated_at"
t.text "key"
t.string "title"
t.string "type"
t.string "fingerprint"
t.boolean "public", :default => false, :null => false
end
add_index "keys", ["created_at", "id"], :name => "index_keys_on_created_at_and_id"
add_index "keys", ["user_id"], :name => "index_keys_on_user_id"
add_index "journals_for_messages", ["root_id"], :name => "index_journals_for_messages_on_root_id"
create_table "kindeditor_assets", :force => true do |t|
t.string "asset"
@ -1250,27 +1131,6 @@ ActiveRecord::Schema.define(:version => 20161009053958) do
t.integer "owner_type", :default => 0
end
create_table "label_links", :force => true do |t|
t.integer "label_id"
t.integer "target_id"
t.string "target_type"
t.datetime "created_at"
t.datetime "updated_at"
end
add_index "label_links", ["label_id"], :name => "index_label_links_on_label_id"
add_index "label_links", ["target_id", "target_type"], :name => "index_label_links_on_target_id_and_target_type"
create_table "labels", :force => true do |t|
t.string "title"
t.string "color"
t.integer "project_id"
t.datetime "created_at"
t.datetime "updated_at"
end
add_index "labels", ["project_id"], :name => "index_labels_on_project_id"
create_table "member_roles", :force => true do |t|
t.integer "member_id", :null => false
t.integer "role_id", :null => false
@ -1324,47 +1184,6 @@ ActiveRecord::Schema.define(:version => 20161009053958) do
t.integer "viewed_count", :default => 0
end
create_table "merge_request_diffs", :force => true do |t|
t.string "state"
t.text "st_commits", :limit => 2147483647
t.text "st_diffs", :limit => 2147483647
t.integer "merge_request_id", :null => false
t.datetime "created_at"
t.datetime "updated_at"
end
add_index "merge_request_diffs", ["merge_request_id"], :name => "index_merge_request_diffs_on_merge_request_id", :unique => true
create_table "merge_requests", :force => true do |t|
t.string "target_branch", :null => false
t.string "source_branch", :null => false
t.integer "source_project_id", :null => false
t.integer "author_id"
t.integer "assignee_id"
t.string "title"
t.datetime "created_at"
t.datetime "updated_at"
t.integer "milestone_id"
t.string "state"
t.string "merge_status"
t.integer "target_project_id", :null => false
t.integer "iid"
t.text "description"
t.integer "position", :default => 0
t.datetime "locked_at"
end
add_index "merge_requests", ["assignee_id"], :name => "index_merge_requests_on_assignee_id"
add_index "merge_requests", ["author_id"], :name => "index_merge_requests_on_author_id"
add_index "merge_requests", ["created_at", "id"], :name => "index_merge_requests_on_created_at_and_id"
add_index "merge_requests", ["created_at"], :name => "index_merge_requests_on_created_at"
add_index "merge_requests", ["milestone_id"], :name => "index_merge_requests_on_milestone_id"
add_index "merge_requests", ["source_branch"], :name => "index_merge_requests_on_source_branch"
add_index "merge_requests", ["source_project_id"], :name => "index_merge_requests_on_source_project_id"
add_index "merge_requests", ["target_branch"], :name => "index_merge_requests_on_target_branch"
add_index "merge_requests", ["target_project_id", "iid"], :name => "index_merge_requests_on_target_project_id_and_iid", :unique => true
add_index "merge_requests", ["title"], :name => "index_merge_requests_on_title"
create_table "message_alls", :force => true do |t|
t.integer "user_id"
t.integer "message_id"
@ -1391,6 +1210,7 @@ ActiveRecord::Schema.define(:version => 20161009053958) do
t.integer "reply_id"
t.integer "quotes"
t.integer "status", :default => 0
t.integer "root_id"
end
add_index "messages", ["author_id"], :name => "index_messages_on_author_id"
@ -1398,39 +1218,7 @@ ActiveRecord::Schema.define(:version => 20161009053958) do
add_index "messages", ["created_on"], :name => "index_messages_on_created_on"
add_index "messages", ["last_reply_id"], :name => "index_messages_on_last_reply_id"
add_index "messages", ["parent_id"], :name => "messages_parent_id"
create_table "milestones", :force => true do |t|
t.string "title", :null => false
t.integer "project_id", :null => false
t.text "description"
t.date "due_date"
t.datetime "created_at"
t.datetime "updated_at"
t.string "state"
t.integer "iid"
end
add_index "milestones", ["created_at", "id"], :name => "index_milestones_on_created_at_and_id"
add_index "milestones", ["due_date"], :name => "index_milestones_on_due_date"
add_index "milestones", ["project_id", "iid"], :name => "index_milestones_on_project_id_and_iid", :unique => true
add_index "milestones", ["project_id"], :name => "index_milestones_on_project_id"
create_table "namespaces", :force => true do |t|
t.string "name", :null => false
t.string "path", :null => false
t.integer "owner_id"
t.datetime "created_at"
t.datetime "updated_at"
t.string "type"
t.string "description", :default => "", :null => false
t.string "avatar"
end
add_index "namespaces", ["created_at", "id"], :name => "index_namespaces_on_created_at_and_id"
add_index "namespaces", ["name"], :name => "index_namespaces_on_name", :unique => true
add_index "namespaces", ["owner_id"], :name => "index_namespaces_on_owner_id"
add_index "namespaces", ["path"], :name => "index_namespaces_on_path", :unique => true
add_index "namespaces", ["type"], :name => "index_namespaces_on_type"
add_index "messages", ["root_id"], :name => "index_messages_on_root_id"
create_table "news", :force => true do |t|
t.integer "project_id"
@ -1457,31 +1245,6 @@ ActiveRecord::Schema.define(:version => 20161009053958) do
t.datetime "updated_at", :null => false
end
create_table "notes", :force => true do |t|
t.text "note"
t.string "noteable_type"
t.integer "author_id"
t.datetime "created_at"
t.datetime "updated_at"
t.integer "project_id"
t.string "attachment"
t.string "line_code"
t.string "commit_id"
t.integer "noteable_id"
t.boolean "system", :default => false, :null => false
t.text "st_diff", :limit => 2147483647
end
add_index "notes", ["author_id"], :name => "index_notes_on_author_id"
add_index "notes", ["commit_id"], :name => "index_notes_on_commit_id"
add_index "notes", ["created_at", "id"], :name => "index_notes_on_created_at_and_id"
add_index "notes", ["created_at"], :name => "index_notes_on_created_at"
add_index "notes", ["noteable_id", "noteable_type"], :name => "index_notes_on_noteable_id_and_noteable_type"
add_index "notes", ["noteable_type"], :name => "index_notes_on_noteable_type"
add_index "notes", ["project_id", "noteable_type"], :name => "index_notes_on_project_id_and_noteable_type"
add_index "notes", ["project_id"], :name => "index_notes_on_project_id"
add_index "notes", ["updated_at"], :name => "index_notes_on_updated_at"
create_table "notificationcomments", :force => true do |t|
t.string "notificationcommented_type"
t.integer "notificationcommented_id"
@ -1491,49 +1254,6 @@ ActiveRecord::Schema.define(:version => 20161009053958) do
t.datetime "updated_at", :null => false
end
create_table "oauth_access_grants", :force => true do |t|
t.integer "resource_owner_id", :null => false
t.integer "application_id", :null => false
t.string "token", :null => false
t.integer "expires_in", :null => false
t.text "redirect_uri", :null => false
t.datetime "created_at", :null => false
t.datetime "revoked_at"
t.string "scopes"
end
add_index "oauth_access_grants", ["token"], :name => "index_oauth_access_grants_on_token", :unique => true
create_table "oauth_access_tokens", :force => true do |t|
t.integer "resource_owner_id"
t.integer "application_id"
t.string "token", :null => false
t.string "refresh_token"
t.integer "expires_in"
t.datetime "revoked_at"
t.datetime "created_at", :null => false
t.string "scopes"
end
add_index "oauth_access_tokens", ["refresh_token"], :name => "index_oauth_access_tokens_on_refresh_token", :unique => true
add_index "oauth_access_tokens", ["resource_owner_id"], :name => "index_oauth_access_tokens_on_resource_owner_id"
add_index "oauth_access_tokens", ["token"], :name => "index_oauth_access_tokens_on_token", :unique => true
create_table "oauth_applications", :force => true do |t|
t.string "name", :null => false
t.string "uid", :null => false
t.string "secret", :null => false
t.text "redirect_uri", :null => false
t.string "scopes", :default => "", :null => false
t.datetime "created_at"
t.datetime "updated_at"
t.integer "owner_id"
t.string "owner_type"
end
add_index "oauth_applications", ["owner_id", "owner_type"], :name => "index_oauth_applications_on_owner_id_and_owner_type"
add_index "oauth_applications", ["uid"], :name => "index_oauth_applications_on_uid", :unique => true
create_table "onclick_times", :force => true do |t|
t.integer "user_id"
t.datetime "onclick_time"
@ -1625,8 +1345,11 @@ ActiveRecord::Schema.define(:version => 20161009053958) do
t.integer "sticky", :default => 0
t.integer "org_subfield_id"
t.integer "status", :default => 0
t.integer "root_id"
end
add_index "org_document_comments", ["root_id"], :name => "index_org_document_comments_on_root_id"
create_table "org_member_roles", :force => true do |t|
t.integer "org_member_id"
t.integer "role_id"
@ -1691,23 +1414,6 @@ ActiveRecord::Schema.define(:version => 20161009053958) do
t.integer "allow_teacher", :default => 0
end
create_table "permissions", :force => true do |t|
t.string "controller", :limit => 30, :default => "", :null => false
t.string "action", :limit => 30, :default => "", :null => false
t.string "description", :limit => 60, :default => "", :null => false
t.boolean "is_public", :default => false, :null => false
t.integer "sort", :default => 0, :null => false
t.boolean "mail_option", :default => false, :null => false
t.boolean "mail_enabled", :default => false, :null => false
end
create_table "permissions_roles", :id => false, :force => true do |t|
t.integer "permission_id", :default => 0, :null => false
t.integer "role_id", :default => 0, :null => false
end
add_index "permissions_roles", ["role_id"], :name => "permissions_roles_role_id"
create_table "phone_app_versions", :force => true do |t|
t.string "version"
t.text "description"
@ -1790,11 +1496,6 @@ ActiveRecord::Schema.define(:version => 20161009053958) do
t.datetime "updated_at", :null => false
end
create_table "project_import_data", :force => true do |t|
t.integer "project_id"
t.text "data"
end
create_table "project_infos", :force => true do |t|
t.integer "project_id"
t.integer "user_id"
@ -1888,16 +1589,6 @@ ActiveRecord::Schema.define(:version => 20161009053958) do
add_index "projects_trackers", ["project_id", "tracker_id"], :name => "projects_trackers_unique", :unique => true
add_index "projects_trackers", ["project_id"], :name => "projects_trackers_project_id"
create_table "protected_branches", :force => true do |t|
t.integer "project_id", :null => false
t.string "name", :null => false
t.datetime "created_at"
t.datetime "updated_at"
t.boolean "developers_can_push", :default => false, :null => false
end
add_index "protected_branches", ["project_id"], :name => "index_protected_branches_on_project_id"
create_table "pull_requests", :force => true do |t|
t.integer "pull_request_id"
t.integer "gpid"
@ -2054,25 +1745,6 @@ ActiveRecord::Schema.define(:version => 20161009053958) do
t.integer "is_teacher_score", :default => 0
end
create_table "services", :force => true do |t|
t.string "type"
t.string "title"
t.integer "project_id"
t.datetime "created_at"
t.datetime "updated_at"
t.boolean "active", :default => false, :null => false
t.text "properties"
t.boolean "template", :default => false
t.boolean "push_events", :default => true
t.boolean "issues_events", :default => true
t.boolean "merge_requests_events", :default => true
t.boolean "tag_push_events", :default => true
t.boolean "note_events", :default => true, :null => false
end
add_index "services", ["created_at", "id"], :name => "index_services_on_created_at_and_id"
add_index "services", ["project_id"], :name => "index_services_on_project_id"
create_table "settings", :force => true do |t|
t.string "name", :default => "", :null => false
t.text "value"
@ -2111,26 +1783,6 @@ ActiveRecord::Schema.define(:version => 20161009053958) do
t.datetime "updated_at", :null => false
end
create_table "snippets", :force => true do |t|
t.string "title"
t.text "content", :limit => 2147483647
t.integer "author_id", :null => false
t.integer "project_id"
t.datetime "created_at"
t.datetime "updated_at"
t.string "file_name"
t.datetime "expires_at"
t.string "type"
t.integer "visibility_level", :default => 0, :null => false
end
add_index "snippets", ["author_id"], :name => "index_snippets_on_author_id"
add_index "snippets", ["created_at", "id"], :name => "index_snippets_on_created_at_and_id"
add_index "snippets", ["created_at"], :name => "index_snippets_on_created_at"
add_index "snippets", ["expires_at"], :name => "index_snippets_on_expires_at"
add_index "snippets", ["project_id"], :name => "index_snippets_on_project_id"
add_index "snippets", ["visibility_level"], :name => "index_snippets_on_visibility_level"
create_table "softapplications", :force => true do |t|
t.string "name"
t.text "description"
@ -2284,17 +1936,6 @@ ActiveRecord::Schema.define(:version => 20161009053958) do
t.datetime "updated_at", :null => false
end
create_table "subscriptions", :force => true do |t|
t.integer "user_id"
t.integer "subscribable_id"
t.string "subscribable_type"
t.boolean "subscribed"
t.datetime "created_at"
t.datetime "updated_at"
end
add_index "subscriptions", ["subscribable_id", "subscribable_type", "user_id"], :name => "subscriptions_user_id_and_ref_fields", :unique => true
create_table "syllabus_members", :force => true do |t|
t.integer "rank"
t.integer "syllabus_id"
@ -2568,17 +2209,6 @@ ActiveRecord::Schema.define(:version => 20161009053958) do
add_index "users", ["id", "type"], :name => "index_users_on_id_and_type"
add_index "users", ["type"], :name => "index_users_on_type"
create_table "users_star_projects", :force => true do |t|
t.integer "project_id", :null => false
t.integer "user_id", :null => false
t.datetime "created_at"
t.datetime "updated_at"
end
add_index "users_star_projects", ["project_id"], :name => "index_users_star_projects_on_project_id"
add_index "users_star_projects", ["user_id", "project_id"], :name => "index_users_star_projects_on_user_id_and_project_id", :unique => true
add_index "users_star_projects", ["user_id"], :name => "index_users_star_projects_on_user_id"
create_table "versions", :force => true do |t|
t.integer "project_id", :default => 0, :null => false
t.string "name", :default => "", :null => false
@ -2630,23 +2260,6 @@ ActiveRecord::Schema.define(:version => 20161009053958) do
t.datetime "updated_at", :null => false
end
create_table "web_hooks", :force => true do |t|
t.string "url"
t.integer "project_id"
t.datetime "created_at"
t.datetime "updated_at"
t.string "type", :default => "ProjectHook"
t.integer "service_id"
t.boolean "push_events", :default => true, :null => false
t.boolean "issues_events", :default => false, :null => false
t.boolean "merge_requests_events", :default => false, :null => false
t.boolean "tag_push_events", :default => false
t.boolean "note_events", :default => false, :null => false
end
add_index "web_hooks", ["created_at", "id"], :name => "index_web_hooks_on_created_at_and_id"
add_index "web_hooks", ["project_id"], :name => "index_web_hooks_on_project_id"
create_table "wechat_logs", :force => true do |t|
t.string "openid", :null => false
t.text "request_raw"

View File

@ -7,9 +7,8 @@ namespace :importer do
ENV['BATCH']='1000'
Rake::Task["elasticsearch:import:model"].execute
end
task :importproject => :environment do
ENV['CLASS']='Project'
task :importsyllabus => :environment do
ENV['CLASS']='Syllabus'
ENV['SCOPE']='indexable'
ENV['FORCE']='y'
ENV['BATCH']='1000'
@ -29,6 +28,14 @@ namespace :importer do
ENV['BATCH']='1000'
Rake::Task["elasticsearch:import:model"].execute
end
task :importproject => :environment do
ENV['CLASS']='Project'
ENV['SCOPE']='indexable'
ENV['FORCE']='y'
ENV['BATCH']='1000'
Rake::Task["elasticsearch:import:model"].execute
end
task :importmemo => :environment do
ENV['CLASS']='Memo'
ENV['SCOPE']='indexable'
@ -38,5 +45,5 @@ namespace :importer do
end
desc "Run all tasks"
task :all => [:importuser,:importproject,:importcourse,:importattachment,:importmemo]
task :all => [:importuser,:importsyllabus,:importcourse,:importattachment,:importproject,:importmemo]
end

Some files were not shown because too many files have changed in this diff Show More