Merge branch 'develop' into ouyangxuhua
Conflicts: app/helpers/application_helper.rb app/views/organizations/_org_course_homework.html.erb app/views/organizations/_org_course_news.html.erb app/views/organizations/_org_project_issue.html.erb app/views/organizations/_project_message.html.erb app/views/organizations/_show_org_document.html.erb app/views/users/_user_message_course.html.erb
This commit is contained in:
commit
098844a910
|
@ -51,6 +51,37 @@ class AdminController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
#管理员界面精品课程列表
|
||||
def excellent_courses
|
||||
@courses = Course.where("is_excellent =? or excellent_option =?", 1, 1 )
|
||||
respond_to do |format|
|
||||
format.html
|
||||
end
|
||||
end
|
||||
|
||||
#管理员界面课程资源列表
|
||||
def course_resource_list
|
||||
@resource = Attachment.where(:container_type => 'Course')
|
||||
@resource = paginateHelper @resource,30
|
||||
@page = (params['page'] || 1).to_i - 1
|
||||
|
||||
respond_to do |format|
|
||||
format.html
|
||||
end
|
||||
end
|
||||
|
||||
#管理员界面項目资源列表
|
||||
def project_resource_list
|
||||
@pro_resource = Attachment.where(:container_type => 'Project')
|
||||
@pro_resource = paginateHelper @pro_resource,30
|
||||
@page = (params['page'] || 1).to_i - 1
|
||||
|
||||
respond_to do |format|
|
||||
format.html
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def users
|
||||
sort_init 'login', 'asc'
|
||||
sort_update %w(login firstname lastname mail admin created_on last_login_on)
|
||||
|
|
|
@ -251,7 +251,7 @@ class AttachmentsController < ApplicationController
|
|||
@history.version = @old_history.nil? ? 1 : @old_history.version + 1
|
||||
@history.save #历史记录保存完毕
|
||||
#将最新保存的记录 数据替换到 需要修改的文件记录
|
||||
@old_attachment.attributes = @attachment.attributes.dup.except("id","container_id","container_type","is_public","downloads")
|
||||
@old_attachment.attributes = @attachment.attributes.dup.except("id","container_id","container_type","is_public","downloads", "quotes")
|
||||
@old_attachment.save
|
||||
#删除当前记录
|
||||
@attachment.delete
|
||||
|
|
|
@ -240,6 +240,18 @@ class CoursesController < ApplicationController
|
|||
# req[:message] = l(:modal_valid_passing) if req[:message].blank?
|
||||
render :json => req
|
||||
end
|
||||
|
||||
def teacher_assign_group
|
||||
member = Member.where(:course_id => @course.id, :user_id => params[:user_id]).first
|
||||
member.course_group_id = params[:course_group_id].to_i
|
||||
member.save
|
||||
@course_groups = @course.course_groups
|
||||
@canShowCode = isCourseTeacher(User.current.id,@course) && params[:role] != '1'
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
def join_group
|
||||
@subPage_title = l :label_student_list
|
||||
group = CourseGroup.find(params[:object_id])
|
||||
|
@ -838,6 +850,8 @@ class CoursesController < ApplicationController
|
|||
# render_403
|
||||
# return
|
||||
# end
|
||||
# 统计访问量
|
||||
@course.update_attribute(:visits, @course.visits.to_i + 1)
|
||||
#更新创建课程消息状态
|
||||
create_course_messages = @course.course_messages.where("user_id =? and course_message_type =? and course_id =? and viewed =?", User.current.id, 'Course', @course.id, 0)
|
||||
create_course_messages.update_all(:viewed => true)
|
||||
|
@ -1067,7 +1081,7 @@ class CoursesController < ApplicationController
|
|||
sql_select = ""
|
||||
if groupid == 0
|
||||
sql_select = "SELECT members.*,(
|
||||
SELECT SUM(IF(student_works.final_score is null,null,student_works.final_score - student_works.absence_penalty - student_works.late_penalty))
|
||||
SELECT SUM(IF(student_works.final_score IS NULL,NULL,IF(student_works.final_score =0,0,student_works.final_score - student_works.absence_penalty - student_works.late_penalty)))
|
||||
FROM student_works,homework_commons
|
||||
WHERE student_works.homework_common_id = homework_commons.id
|
||||
AND homework_commons.course_id = #{@course.id}
|
||||
|
@ -1079,7 +1093,7 @@ class CoursesController < ApplicationController
|
|||
WHERE members.course_id = #{@course.id} ORDER BY score #{score_sort_by}"
|
||||
else
|
||||
sql_select = "SELECT members.*,(
|
||||
SELECT SUM(IF(student_works.final_score is null,null,student_works.final_score - student_works.absence_penalty - student_works.late_penalty))
|
||||
SELECT SUM(IF(student_works.final_score IS NULL,NULL,IF(student_works.final_score =0,0,student_works.final_score - student_works.absence_penalty - student_works.late_penalty)))
|
||||
FROM student_works,homework_commons
|
||||
WHERE student_works.homework_common_id = homework_commons.id
|
||||
AND homework_commons.course_id = #{@course.id}
|
||||
|
|
|
@ -559,7 +559,8 @@ class FilesController < ApplicationController
|
|||
end
|
||||
end
|
||||
# 更新课程英雄榜得分
|
||||
update_contributor_score(@course, attachments[:files].first)
|
||||
course_member_score(@course.id, attachments[:files].first.author_id, "Attachment")
|
||||
# end
|
||||
# end
|
||||
# TODO: 临时用 nyan
|
||||
sort_init 'created_on', 'desc'
|
||||
|
@ -632,18 +633,6 @@ class FilesController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
def update_contributor_score(course, file )
|
||||
course_contributor_score = CourseContributorScore.where("course_id =? and user_id =?", course.id, file.author.id).first
|
||||
if course_contributor_score.nil?
|
||||
CourseContributorScore.create(:course_id => course.id, :user_id => file.author.id, :message_num => 0, :message_reply_num => 0,
|
||||
:news_reply_num => 0, :resource_num => 5, :journal_num => 0, :journal_reply_num => 0, :total_score => 5)
|
||||
else
|
||||
score = course_contributor_score.resource_num + 5
|
||||
total_score = course_contributor_score.total_score + 5
|
||||
course_contributor_score.update_attributes(:resource_num => score, :total_score => total_score)
|
||||
end
|
||||
end
|
||||
|
||||
def get_project_tag_name_by_type_nmuber type
|
||||
case type
|
||||
when "1"
|
||||
|
@ -865,9 +854,7 @@ class FilesController < ApplicationController
|
|||
@result = visable_attachemnts @result
|
||||
if params[:other]
|
||||
@result = @result.select{|attachment|
|
||||
attachment.tag_list.exclude?('软件') &&
|
||||
attachment.tag_list.exclude?('媒体') &&
|
||||
attachment.tag_list.exclude?('代码')
|
||||
attachment.tag_list.index{|tag|tag != '软件' and tag != '媒体' and tag != '代码'}.present?
|
||||
}
|
||||
else
|
||||
@result = @result.select{|attachment| attachment.tag_list.include?(@tag_name)} unless @tag_name.blank?
|
||||
|
|
|
@ -1,378 +1,378 @@
|
|||
class HomeworkCommonController < ApplicationController
|
||||
require 'net/http'
|
||||
require 'json'
|
||||
require "base64"
|
||||
layout "base_courses"
|
||||
|
||||
include StudentWorkHelper
|
||||
before_filter :find_course, :only => [:index,:new,:create]
|
||||
before_filter :find_homework, :only => [:edit,:update,:alert_anonymous_comment,:start_anonymous_comment,:stop_anonymous_comment,:destroy,:start_evaluation_set,:set_evaluation_attr,:score_rule_set,:alert_forbidden_anonymous_comment,:alert_open_student_works,:open_student_works]
|
||||
before_filter :teacher_of_course, :only => [:new, :create, :edit, :update, :destroy, :start_anonymous_comment, :stop_anonymous_comment, :alert_anonymous_comment,:start_evaluation_set,:set_evaluation_attr,:score_rule_set,:alert_forbidden_anonymous_comment,:alert_open_student_works,:open_student_works]
|
||||
before_filter :member_of_course, :only => [:index]
|
||||
|
||||
def index
|
||||
@new_homework = HomeworkCommon.new
|
||||
@new_homework.homework_detail_manual = HomeworkDetailManual.new
|
||||
@new_homework.course = @course
|
||||
@page = params[:page] ? params[:page].to_i + 1 : 0
|
||||
@is_teacher = User.current.logged? && (User.current.admin? || User.current.allowed_to?(:as_teacher,@course))
|
||||
if @is_teacher
|
||||
@homeworks = @course.homework_commons.order("created_at desc").limit(10).offset(@page * 10)
|
||||
else
|
||||
@homeworks = @course.homework_commons.where("publish_time <= '#{Date.today}'").order("created_at desc").limit(10).offset(@page * 10)
|
||||
end
|
||||
@is_student = User.current.logged? && (User.current.admin? || (User.current.member_of_course?(@course) && !@is_teacher))
|
||||
@is_new = params[:is_new]
|
||||
|
||||
#设置at已读
|
||||
@homeworks.each do |homework|
|
||||
homework.journals_for_messages.each do |j|
|
||||
User.current.at_messages.unviewed('JournalsForMessage', j.id).each {|x| x.viewed!}
|
||||
end
|
||||
end
|
||||
|
||||
respond_to do |format|
|
||||
format.js
|
||||
format.html
|
||||
end
|
||||
end
|
||||
|
||||
#新建作业,在个人作业列表创建作业
|
||||
def new
|
||||
render_404
|
||||
end
|
||||
|
||||
#新建作业,在个人作业列表创建作业
|
||||
def create
|
||||
redirect_to user_homeworks_user_path(User.current.id)
|
||||
end
|
||||
|
||||
def edit
|
||||
@user = User.current
|
||||
@is_in_course = params[:is_in_course].to_i
|
||||
@course_activity = params[:course_activity].to_i
|
||||
respond_to do |format|
|
||||
format.html{render :layout => 'new_base_user'}
|
||||
end
|
||||
end
|
||||
|
||||
def update
|
||||
if params[:homework_common]
|
||||
@homework.name = params[:homework_common][:name]
|
||||
@homework.description = params[:homework_common][:description]
|
||||
if params[:homework_common][:publish_time] == ""
|
||||
@homework.publish_time = Date.today
|
||||
else
|
||||
@homework.publish_time = params[:homework_common][:publish_time]
|
||||
end
|
||||
@homework.end_time = params[:homework_common][:end_time] || Time.now
|
||||
@homework.course_id = params[:course_id]
|
||||
@homework.anonymous_comment = params[:homework_common][:anonymous_comment] ? params[:homework_common][:anonymous_comment] : 0
|
||||
|
||||
homework_detail_manual = @homework.homework_detail_manual || HomeworkDetailManual.new
|
||||
if @homework.publish_time <= Date.today && homework_detail_manual.comment_status == 0
|
||||
homework_detail_manual.comment_status = 1
|
||||
end
|
||||
homework_detail_manual.evaluation_start = params[:evaluation_start].blank? ? @homework.end_time + 7 : params[:evaluation_start]
|
||||
homework_detail_manual.evaluation_end = params[:evaluation_end].blank? ? homework_detail_manual.evaluation_start + 7 : params[:evaluation_end]
|
||||
|
||||
@homework.save_attachments(params[:attachments])
|
||||
render_attachment_warning_if_needed(@homework)
|
||||
|
||||
#编程作业相关属性
|
||||
if @homework.homework_type == 2
|
||||
@homework.homework_detail_programing ||= HomeworkDetailPrograming.new
|
||||
@homework_detail_programing = @homework.homework_detail_programing
|
||||
@homework_detail_programing.language = params[:language_type].to_i
|
||||
|
||||
@homework.homework_tests.delete_all
|
||||
inputs = params[:program][:input]
|
||||
if Array === inputs
|
||||
inputs.each_with_index do |val, i|
|
||||
@homework.homework_tests << HomeworkTest.new(
|
||||
input: val,
|
||||
output: params[:program][:output][i]
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
#分组作业
|
||||
if @homework.homework_type == 3
|
||||
@homework.homework_detail_group ||= HomeworkDetailGroup.new
|
||||
@homework_detail_group = @homework.homework_detail_group
|
||||
@homework_detail_group.min_num = params[:min_num].to_i
|
||||
@homework_detail_group.max_num = params[:max_num].to_i
|
||||
@homework_detail_group.base_on_project = params[:base_on_project].to_i
|
||||
end
|
||||
|
||||
if @homework.save
|
||||
@homework_detail_manual.save if @homework_detail_manual
|
||||
@homework_detail_programing.save if @homework_detail_programing
|
||||
@homework_detail_group.save if @homework_detail_group
|
||||
|
||||
if params[:is_in_course] == "1"
|
||||
redirect_to homework_common_index_path(:course => @course.id)
|
||||
elsif params[:is_in_course] == "0"
|
||||
redirect_to user_homeworks_user_path(User.current.id)
|
||||
elsif params[:is_in_course] == "-1" && params[:course_activity] == "0"
|
||||
redirect_to user_path(User.current.id)
|
||||
elsif params[:is_in_course] == "-1" && params[:course_activity] == "1"
|
||||
redirect_to course_path(@course.id)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def destroy
|
||||
if @homework.destroy
|
||||
respond_to do |format|
|
||||
format.html {
|
||||
if params[:is_in_course] == "1"
|
||||
redirect_to homework_common_index_path(:course => @course.id)
|
||||
elsif params[:is_in_course] == "0"
|
||||
redirect_to user_homeworks_user_path(User.current.id)
|
||||
elsif params[:is_in_course] == "-1" && params[:course_activity] == "0"
|
||||
redirect_to user_path(User.current.id)
|
||||
elsif params[:is_in_course] == "-1" && params[:course_activity] == "1"
|
||||
redirect_to course_path(@course.id)
|
||||
end
|
||||
}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
#开启匿评
|
||||
#statue 1:启动成功,2:启动失败,作业总数大于等于2份时才能启动匿评,3:已开启匿评,请务重复开启,4:没有开启匿评的权限
|
||||
def start_anonymous_comment
|
||||
@statue = 4 and return unless User.current.admin? || User.current.allowed_to?(:as_teacher,@course)
|
||||
@statue = 5 and return if Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") >= Time.now.strftime("%Y-%m-%d")
|
||||
if @homework_detail_manual.comment_status == 1
|
||||
student_works = @homework.student_works
|
||||
if student_works && student_works.size >= 2
|
||||
if @homework.homework_type == 3
|
||||
student_work_projects = @homework.student_work_projects.where("student_work_id is not null")
|
||||
student_work_projects.each_with_index do |pro_work, pro_index|
|
||||
n = @homework_detail_manual.evaluation_num
|
||||
n = n < student_works.size ? n : student_works.size - 1
|
||||
work_index = -1
|
||||
student_works.each_with_index do |stu_work, stu_index|
|
||||
if stu_work.id.to_i == pro_work.student_work_id.to_i
|
||||
work_index = stu_index
|
||||
end
|
||||
end
|
||||
assigned_homeworks = get_assigned_homeworks(student_works, n, work_index)
|
||||
assigned_homeworks.each do |h|
|
||||
student_works_evaluation_distributions = StudentWorksEvaluationDistribution.new(user_id: pro_work.user_id, student_work_id: h.id)
|
||||
student_works_evaluation_distributions.save
|
||||
end
|
||||
end
|
||||
else
|
||||
student_works.each_with_index do |work, index|
|
||||
user = work.user
|
||||
n = @homework_detail_manual.evaluation_num
|
||||
n = n < student_works.size ? n : student_works.size - 1
|
||||
assigned_homeworks = get_assigned_homeworks(student_works, n, index)
|
||||
assigned_homeworks.each do |h|
|
||||
student_works_evaluation_distributions = StudentWorksEvaluationDistribution.new(user_id: user.id, student_work_id: h.id)
|
||||
student_works_evaluation_distributions.save
|
||||
end
|
||||
end
|
||||
end
|
||||
@homework_detail_manual.update_column('comment_status', 2)
|
||||
@homework_detail_manual.update_column('evaluation_start', Date.today)
|
||||
@statue = 1
|
||||
# 匿评开启消息邮件通知
|
||||
send_message_anonymous_comment(@homework, m_status = 2)
|
||||
Mailer.send_mail_anonymous_comment_open(@homework).deliver
|
||||
else
|
||||
@statue = 2
|
||||
|
||||
end
|
||||
else
|
||||
@statue = 3
|
||||
end
|
||||
@user_activity_id = params[:user_activity_id].to_i
|
||||
@is_in_course = params[:is_in_course].to_i
|
||||
@course_activity = params[:course_activity].to_i
|
||||
end
|
||||
|
||||
#关闭匿评
|
||||
def stop_anonymous_comment
|
||||
@homework_detail_manual.update_column('comment_status', 3)
|
||||
@homework_detail_manual.update_column('evaluation_end', Date.today)
|
||||
#计算缺评扣分
|
||||
work_ids = "(" + @homework.student_works.map(&:id).join(",") + ")"
|
||||
@homework.student_works.each do |student_work|
|
||||
absence_penalty_count = student_work.user.student_works_evaluation_distributions.where("student_work_id IN #{work_ids}").count - student_work.user.student_works_scores.where("student_work_id IN #{work_ids}").count
|
||||
student_work.absence_penalty = absence_penalty_count > 0 ? absence_penalty_count * @homework_detail_manual.absence_penalty : 0
|
||||
student_work.save
|
||||
end
|
||||
# 匿评关闭消息邮件通知
|
||||
send_message_anonymous_comment(@homework, m_status = 3)
|
||||
Mailer.send_mail_anonymous_comment_close(@homework).deliver
|
||||
@user_activity_id = params[:user_activity_id].to_i
|
||||
@is_in_course = params[:is_in_course].to_i
|
||||
@course_activity = params[:course_activity].to_i
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
# 开启/关闭匿评消息通知
|
||||
def send_message_anonymous_comment(homework, m_status )
|
||||
# status 标记匿评状态 1为关闭 0为开启
|
||||
course = homework.course
|
||||
course.members.each do |m|
|
||||
@homework.course_messages << CourseMessage.new(:user_id => m.user_id, :course_id => course.id, :viewed => false, :status => m_status)
|
||||
end
|
||||
end
|
||||
#提示
|
||||
def alert_anonymous_comment
|
||||
@cur_size = 0
|
||||
@totle_size = 0
|
||||
if @homework_detail_manual.comment_status == 1
|
||||
@totle_size = @course.student.count
|
||||
@cur_size = @homework.student_works.size
|
||||
elsif @homework_detail_manual.comment_status == 2
|
||||
@homework.student_works.map { |work| @totle_size += work.student_works_evaluation_distributions.count}
|
||||
@cur_size = 0
|
||||
@homework.student_works.map { |work| @cur_size += work.student_works_scores.where(:reviewer_role => 3).count}
|
||||
end
|
||||
@percent = format("%.2f",(@cur_size.to_f / ( @totle_size == 0 ? 1 : @totle_size)) * 100)
|
||||
@user_activity_id = params[:user_activity_id].to_i
|
||||
@is_in_course = params[:is_in_course].to_i
|
||||
@course_activity = params[:course_activity].to_i
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
def alert_forbidden_anonymous_comment
|
||||
if params[:user_activity_id]
|
||||
@user_activity_id = params[:user_activity_id]
|
||||
else
|
||||
@user_activity_id = -1
|
||||
end
|
||||
@is_in_course = params[:is_in_course] if params[:is_in_course]
|
||||
@course_activity = params[:course_activity] if params[:course_Activity]
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
def open_student_works
|
||||
if @homework.is_open == 0
|
||||
@homework.update_attribute(:is_open, 1)
|
||||
else
|
||||
@homework.update_attribute(:is_open, 0)
|
||||
end
|
||||
@user_activity_id = params[:user_activity_id]
|
||||
@is_in_course = params[:is_in_course] if params[:is_in_course]
|
||||
@course_activity = params[:course_activity] if params[:course_Activity]
|
||||
end
|
||||
|
||||
def alert_open_student_works
|
||||
if params[:user_activity_id]
|
||||
@user_activity_id = params[:user_activity_id]
|
||||
else
|
||||
@user_activity_id = -1
|
||||
end
|
||||
@is_in_course = params[:is_in_course] if params[:is_in_course]
|
||||
@course_activity = params[:course_activity] if params[:course_Activity]
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
def programing_test
|
||||
test = {language:params[:language],src:Base64.encode64(params[:src]),input:[params[:input]],output:[params[:output]]}
|
||||
@index = params[:index]
|
||||
uri = URI('http://192.168.80.21:8080/api/realtime.json')
|
||||
body = test.to_json
|
||||
res = Net::HTTP.new(uri.host, uri.port).start do |client|
|
||||
request = Net::HTTP::Post.new(uri.path)
|
||||
request.body = body
|
||||
request["Content-Type"] = "application/json"
|
||||
client.request(request)
|
||||
end
|
||||
result = JSON.parse(res.body)
|
||||
@err_msg = result["compile_error_msg"]
|
||||
result["results"].each do |re|
|
||||
@result = re["status"]
|
||||
end
|
||||
end
|
||||
|
||||
#启动匿评参数设置
|
||||
def start_evaluation_set
|
||||
if params[:user_activity_id]
|
||||
@user_activity_id = params[:user_activity_id]
|
||||
else
|
||||
@user_activity_id = -1
|
||||
end
|
||||
@is_in_course = params[:is_in_course]
|
||||
@course_activity = params[:course_activity].to_i
|
||||
end
|
||||
|
||||
#设置匿评参数
|
||||
def set_evaluation_attr
|
||||
if @homework_detail_manual
|
||||
unless params[:evaluation_start].to_s == @homework_detail_manual.evaluation_start.to_s
|
||||
@homework_detail_manual.evaluation_start = params[:evaluation_start]
|
||||
end
|
||||
|
||||
unless @homework_detail_manual.evaluation_end.to_s == params[:evaluation_end].to_s
|
||||
@homework_detail_manual.evaluation_end = params[:evaluation_end]
|
||||
end
|
||||
|
||||
@homework_detail_manual.evaluation_num = params[:evaluation_num]
|
||||
@homework_detail_manual.save
|
||||
@user_activity_id = params[:user_activity_id].to_i
|
||||
@is_in_course = params[:is_in_course].to_i
|
||||
@course_activity = params[:course_activity].to_i
|
||||
end
|
||||
end
|
||||
|
||||
#评分设置
|
||||
def score_rule_set
|
||||
if params[:user_activity_id]
|
||||
@user_activity_id = params[:user_activity_id]
|
||||
else
|
||||
@user_activity_id = -1
|
||||
end
|
||||
@is_in_course = params[:is_in_course]
|
||||
@course_activity = params[:course_activity].to_i
|
||||
end
|
||||
|
||||
private
|
||||
#获取课程
|
||||
def find_course
|
||||
@course = Course.find params[:course]
|
||||
rescue
|
||||
render_404
|
||||
end
|
||||
#获取作业
|
||||
def find_homework
|
||||
@homework = HomeworkCommon.find params[:id]
|
||||
@homework_detail_manual = @homework.homework_detail_manual
|
||||
@homework_detail_programing = @homework.homework_detail_programing
|
||||
@homework_detail_group = @homework.homework_detail_group
|
||||
@course = @homework.course
|
||||
rescue
|
||||
render_404
|
||||
end
|
||||
#是不是课程的老师
|
||||
def teacher_of_course
|
||||
render_403 unless User.current.allowed_to?(:as_teacher,@course) || User.current.admin?
|
||||
end
|
||||
|
||||
#当前用户是不是课程的成员
|
||||
def member_of_course
|
||||
render_403 unless @course.is_public==1 || User.current.member_of_course?(@course) || User.current.admin?
|
||||
end
|
||||
|
||||
def get_assigned_homeworks(student_works, n, index)
|
||||
student_works += student_works
|
||||
student_works[index + 1 .. index + n]
|
||||
end
|
||||
end
|
||||
class HomeworkCommonController < ApplicationController
|
||||
require 'net/http'
|
||||
require 'json'
|
||||
require "base64"
|
||||
layout "base_courses"
|
||||
|
||||
include StudentWorkHelper
|
||||
before_filter :find_course, :only => [:index,:new,:create]
|
||||
before_filter :find_homework, :only => [:edit,:update,:alert_anonymous_comment,:start_anonymous_comment,:stop_anonymous_comment,:destroy,:start_evaluation_set,:set_evaluation_attr,:score_rule_set,:alert_forbidden_anonymous_comment,:alert_open_student_works,:open_student_works]
|
||||
before_filter :teacher_of_course, :only => [:new, :create, :edit, :update, :destroy, :start_anonymous_comment, :stop_anonymous_comment, :alert_anonymous_comment,:start_evaluation_set,:set_evaluation_attr,:score_rule_set,:alert_forbidden_anonymous_comment,:alert_open_student_works,:open_student_works]
|
||||
before_filter :member_of_course, :only => [:index]
|
||||
|
||||
def index
|
||||
@new_homework = HomeworkCommon.new
|
||||
@new_homework.homework_detail_manual = HomeworkDetailManual.new
|
||||
@new_homework.course = @course
|
||||
@page = params[:page] ? params[:page].to_i + 1 : 0
|
||||
@is_teacher = User.current.logged? && (User.current.admin? || User.current.allowed_to?(:as_teacher,@course))
|
||||
if @is_teacher
|
||||
@homeworks = @course.homework_commons.order("updated_at desc").limit(10).offset(@page * 10)
|
||||
else
|
||||
@homeworks = @course.homework_commons.where("publish_time <= '#{Date.today}'").order("updated_at desc").limit(10).offset(@page * 10)
|
||||
end
|
||||
@is_student = User.current.logged? && (User.current.admin? || (User.current.member_of_course?(@course) && !@is_teacher))
|
||||
@is_new = params[:is_new]
|
||||
|
||||
#设置at已读
|
||||
@homeworks.each do |homework|
|
||||
homework.journals_for_messages.each do |j|
|
||||
User.current.at_messages.unviewed('JournalsForMessage', j.id).each {|x| x.viewed!}
|
||||
end
|
||||
end
|
||||
|
||||
respond_to do |format|
|
||||
format.js
|
||||
format.html
|
||||
end
|
||||
end
|
||||
|
||||
#新建作业,在个人作业列表创建作业
|
||||
def new
|
||||
render_404
|
||||
end
|
||||
|
||||
#新建作业,在个人作业列表创建作业
|
||||
def create
|
||||
redirect_to user_homeworks_user_path(User.current.id)
|
||||
end
|
||||
|
||||
def edit
|
||||
@user = User.current
|
||||
@is_in_course = params[:is_in_course].to_i
|
||||
@course_activity = params[:course_activity].to_i
|
||||
respond_to do |format|
|
||||
format.html{render :layout => 'new_base_user'}
|
||||
end
|
||||
end
|
||||
|
||||
def update
|
||||
if params[:homework_common]
|
||||
@homework.name = params[:homework_common][:name]
|
||||
@homework.description = params[:homework_common][:description]
|
||||
if params[:homework_common][:publish_time] == ""
|
||||
@homework.publish_time = Date.today
|
||||
else
|
||||
@homework.publish_time = params[:homework_common][:publish_time]
|
||||
end
|
||||
@homework.end_time = params[:homework_common][:end_time] || Time.now
|
||||
@homework.course_id = params[:course_id]
|
||||
@homework.anonymous_comment = params[:homework_common][:anonymous_comment] ? params[:homework_common][:anonymous_comment] : 0
|
||||
|
||||
homework_detail_manual = @homework.homework_detail_manual || HomeworkDetailManual.new
|
||||
if @homework.publish_time <= Date.today && homework_detail_manual.comment_status == 0
|
||||
homework_detail_manual.comment_status = 1
|
||||
end
|
||||
homework_detail_manual.evaluation_start = params[:evaluation_start].blank? ? @homework.end_time + 7 : params[:evaluation_start]
|
||||
homework_detail_manual.evaluation_end = params[:evaluation_end].blank? ? homework_detail_manual.evaluation_start + 7 : params[:evaluation_end]
|
||||
|
||||
@homework.save_attachments(params[:attachments])
|
||||
render_attachment_warning_if_needed(@homework)
|
||||
|
||||
#编程作业相关属性
|
||||
if @homework.homework_type == 2
|
||||
@homework.homework_detail_programing ||= HomeworkDetailPrograming.new
|
||||
@homework_detail_programing = @homework.homework_detail_programing
|
||||
@homework_detail_programing.language = params[:language_type].to_i
|
||||
|
||||
@homework.homework_tests.delete_all
|
||||
inputs = params[:program][:input]
|
||||
if Array === inputs
|
||||
inputs.each_with_index do |val, i|
|
||||
@homework.homework_tests << HomeworkTest.new(
|
||||
input: val,
|
||||
output: params[:program][:output][i]
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
#分组作业
|
||||
if @homework.homework_type == 3
|
||||
@homework.homework_detail_group ||= HomeworkDetailGroup.new
|
||||
@homework_detail_group = @homework.homework_detail_group
|
||||
@homework_detail_group.min_num = params[:min_num].to_i
|
||||
@homework_detail_group.max_num = params[:max_num].to_i
|
||||
@homework_detail_group.base_on_project = params[:base_on_project].to_i
|
||||
end
|
||||
|
||||
if @homework.save
|
||||
@homework_detail_manual.save if @homework_detail_manual
|
||||
@homework_detail_programing.save if @homework_detail_programing
|
||||
@homework_detail_group.save if @homework_detail_group
|
||||
|
||||
if params[:is_in_course] == "1"
|
||||
redirect_to homework_common_index_path(:course => @course.id)
|
||||
elsif params[:is_in_course] == "0"
|
||||
redirect_to user_homeworks_user_path(User.current.id)
|
||||
elsif params[:is_in_course] == "-1" && params[:course_activity] == "0"
|
||||
redirect_to user_path(User.current.id)
|
||||
elsif params[:is_in_course] == "-1" && params[:course_activity] == "1"
|
||||
redirect_to course_path(@course.id)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def destroy
|
||||
if @homework.destroy
|
||||
respond_to do |format|
|
||||
format.html {
|
||||
if params[:is_in_course] == "1"
|
||||
redirect_to homework_common_index_path(:course => @course.id)
|
||||
elsif params[:is_in_course] == "0"
|
||||
redirect_to user_homeworks_user_path(User.current.id)
|
||||
elsif params[:is_in_course] == "-1" && params[:course_activity] == "0"
|
||||
redirect_to user_path(User.current.id)
|
||||
elsif params[:is_in_course] == "-1" && params[:course_activity] == "1"
|
||||
redirect_to course_path(@course.id)
|
||||
end
|
||||
}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
#开启匿评
|
||||
#statue 1:启动成功,2:启动失败,作业总数大于等于2份时才能启动匿评,3:已开启匿评,请务重复开启,4:没有开启匿评的权限
|
||||
def start_anonymous_comment
|
||||
@statue = 4 and return unless User.current.admin? || User.current.allowed_to?(:as_teacher,@course)
|
||||
@statue = 5 and return if Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") >= Time.now.strftime("%Y-%m-%d")
|
||||
if @homework_detail_manual.comment_status == 1
|
||||
student_works = @homework.student_works
|
||||
if student_works && student_works.size >= 2
|
||||
if @homework.homework_type == 3
|
||||
student_work_projects = @homework.student_work_projects.where("student_work_id is not null")
|
||||
student_work_projects.each_with_index do |pro_work, pro_index|
|
||||
n = @homework_detail_manual.evaluation_num
|
||||
n = n < student_works.size ? n : student_works.size - 1
|
||||
work_index = -1
|
||||
student_works.each_with_index do |stu_work, stu_index|
|
||||
if stu_work.id.to_i == pro_work.student_work_id.to_i
|
||||
work_index = stu_index
|
||||
end
|
||||
end
|
||||
assigned_homeworks = get_assigned_homeworks(student_works, n, work_index)
|
||||
assigned_homeworks.each do |h|
|
||||
student_works_evaluation_distributions = StudentWorksEvaluationDistribution.new(user_id: pro_work.user_id, student_work_id: h.id)
|
||||
student_works_evaluation_distributions.save
|
||||
end
|
||||
end
|
||||
else
|
||||
student_works.each_with_index do |work, index|
|
||||
user = work.user
|
||||
n = @homework_detail_manual.evaluation_num
|
||||
n = n < student_works.size ? n : student_works.size - 1
|
||||
assigned_homeworks = get_assigned_homeworks(student_works, n, index)
|
||||
assigned_homeworks.each do |h|
|
||||
student_works_evaluation_distributions = StudentWorksEvaluationDistribution.new(user_id: user.id, student_work_id: h.id)
|
||||
student_works_evaluation_distributions.save
|
||||
end
|
||||
end
|
||||
end
|
||||
@homework_detail_manual.update_column('comment_status', 2)
|
||||
@homework_detail_manual.update_column('evaluation_start', Date.today)
|
||||
@statue = 1
|
||||
# 匿评开启消息邮件通知
|
||||
send_message_anonymous_comment(@homework, m_status = 2)
|
||||
Mailer.send_mail_anonymous_comment_open(@homework).deliver
|
||||
else
|
||||
@statue = 2
|
||||
|
||||
end
|
||||
else
|
||||
@statue = 3
|
||||
end
|
||||
@user_activity_id = params[:user_activity_id].to_i
|
||||
@is_in_course = params[:is_in_course].to_i
|
||||
@course_activity = params[:course_activity].to_i
|
||||
end
|
||||
|
||||
#关闭匿评
|
||||
def stop_anonymous_comment
|
||||
@homework_detail_manual.update_column('comment_status', 3)
|
||||
@homework_detail_manual.update_column('evaluation_end', Date.today)
|
||||
#计算缺评扣分
|
||||
work_ids = "(" + @homework.student_works.map(&:id).join(",") + ")"
|
||||
@homework.student_works.each do |student_work|
|
||||
absence_penalty_count = student_work.user.student_works_evaluation_distributions.where("student_work_id IN #{work_ids}").count - student_work.user.student_works_scores.where("student_work_id IN #{work_ids}").count
|
||||
student_work.absence_penalty = absence_penalty_count > 0 ? absence_penalty_count * @homework_detail_manual.absence_penalty : 0
|
||||
student_work.save
|
||||
end
|
||||
# 匿评关闭消息邮件通知
|
||||
send_message_anonymous_comment(@homework, m_status = 3)
|
||||
Mailer.send_mail_anonymous_comment_close(@homework).deliver
|
||||
@user_activity_id = params[:user_activity_id].to_i
|
||||
@is_in_course = params[:is_in_course].to_i
|
||||
@course_activity = params[:course_activity].to_i
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
# 开启/关闭匿评消息通知
|
||||
def send_message_anonymous_comment(homework, m_status )
|
||||
# status 标记匿评状态 1为关闭 0为开启
|
||||
course = homework.course
|
||||
course.members.each do |m|
|
||||
@homework.course_messages << CourseMessage.new(:user_id => m.user_id, :course_id => course.id, :viewed => false, :status => m_status)
|
||||
end
|
||||
end
|
||||
#提示
|
||||
def alert_anonymous_comment
|
||||
@cur_size = 0
|
||||
@totle_size = 0
|
||||
if @homework_detail_manual.comment_status == 1
|
||||
@totle_size = @course.student.count
|
||||
@cur_size = @homework.student_works.size
|
||||
elsif @homework_detail_manual.comment_status == 2
|
||||
@homework.student_works.map { |work| @totle_size += work.student_works_evaluation_distributions.count}
|
||||
@cur_size = 0
|
||||
@homework.student_works.map { |work| @cur_size += work.student_works_scores.where(:reviewer_role => 3).count}
|
||||
end
|
||||
@percent = format("%.2f",(@cur_size.to_f / ( @totle_size == 0 ? 1 : @totle_size)) * 100)
|
||||
@user_activity_id = params[:user_activity_id].to_i
|
||||
@is_in_course = params[:is_in_course].to_i
|
||||
@course_activity = params[:course_activity].to_i
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
def alert_forbidden_anonymous_comment
|
||||
if params[:user_activity_id]
|
||||
@user_activity_id = params[:user_activity_id]
|
||||
else
|
||||
@user_activity_id = -1
|
||||
end
|
||||
@is_in_course = params[:is_in_course] if params[:is_in_course]
|
||||
@course_activity = params[:course_activity] if params[:course_Activity]
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
def open_student_works
|
||||
if @homework.is_open == 0
|
||||
@homework.update_attribute(:is_open, 1)
|
||||
else
|
||||
@homework.update_attribute(:is_open, 0)
|
||||
end
|
||||
@user_activity_id = params[:user_activity_id]
|
||||
@is_in_course = params[:is_in_course] if params[:is_in_course]
|
||||
@course_activity = params[:course_activity] if params[:course_Activity]
|
||||
end
|
||||
|
||||
def alert_open_student_works
|
||||
if params[:user_activity_id]
|
||||
@user_activity_id = params[:user_activity_id]
|
||||
else
|
||||
@user_activity_id = -1
|
||||
end
|
||||
@is_in_course = params[:is_in_course] if params[:is_in_course]
|
||||
@course_activity = params[:course_activity] if params[:course_Activity]
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
def programing_test
|
||||
test = {language:params[:language],src:Base64.encode64(params[:src]),input:[params[:input]],output:[params[:output]]}
|
||||
@index = params[:index]
|
||||
uri = URI('http://192.168.80.21:8080/api/realtime.json')
|
||||
body = test.to_json
|
||||
res = Net::HTTP.new(uri.host, uri.port).start do |client|
|
||||
request = Net::HTTP::Post.new(uri.path)
|
||||
request.body = body
|
||||
request["Content-Type"] = "application/json"
|
||||
client.request(request)
|
||||
end
|
||||
result = JSON.parse(res.body)
|
||||
@err_msg = result["compile_error_msg"]
|
||||
result["results"].each do |re|
|
||||
@result = re["status"]
|
||||
end
|
||||
end
|
||||
|
||||
#启动匿评参数设置
|
||||
def start_evaluation_set
|
||||
if params[:user_activity_id]
|
||||
@user_activity_id = params[:user_activity_id]
|
||||
else
|
||||
@user_activity_id = -1
|
||||
end
|
||||
@is_in_course = params[:is_in_course]
|
||||
@course_activity = params[:course_activity].to_i
|
||||
end
|
||||
|
||||
#设置匿评参数
|
||||
def set_evaluation_attr
|
||||
if @homework_detail_manual
|
||||
unless params[:evaluation_start].to_s == @homework_detail_manual.evaluation_start.to_s
|
||||
@homework_detail_manual.evaluation_start = params[:evaluation_start]
|
||||
end
|
||||
|
||||
unless @homework_detail_manual.evaluation_end.to_s == params[:evaluation_end].to_s
|
||||
@homework_detail_manual.evaluation_end = params[:evaluation_end]
|
||||
end
|
||||
|
||||
@homework_detail_manual.evaluation_num = params[:evaluation_num]
|
||||
@homework_detail_manual.save
|
||||
@user_activity_id = params[:user_activity_id].to_i
|
||||
@is_in_course = params[:is_in_course].to_i
|
||||
@course_activity = params[:course_activity].to_i
|
||||
end
|
||||
end
|
||||
|
||||
#评分设置
|
||||
def score_rule_set
|
||||
if params[:user_activity_id]
|
||||
@user_activity_id = params[:user_activity_id]
|
||||
else
|
||||
@user_activity_id = -1
|
||||
end
|
||||
@is_in_course = params[:is_in_course]
|
||||
@course_activity = params[:course_activity].to_i
|
||||
end
|
||||
|
||||
private
|
||||
#获取课程
|
||||
def find_course
|
||||
@course = Course.find params[:course]
|
||||
rescue
|
||||
render_404
|
||||
end
|
||||
#获取作业
|
||||
def find_homework
|
||||
@homework = HomeworkCommon.find params[:id]
|
||||
@homework_detail_manual = @homework.homework_detail_manual
|
||||
@homework_detail_programing = @homework.homework_detail_programing
|
||||
@homework_detail_group = @homework.homework_detail_group
|
||||
@course = @homework.course
|
||||
rescue
|
||||
render_404
|
||||
end
|
||||
#是不是课程的老师
|
||||
def teacher_of_course
|
||||
render_403 unless User.current.allowed_to?(:as_teacher,@course) || User.current.admin?
|
||||
end
|
||||
|
||||
#当前用户是不是课程的成员
|
||||
def member_of_course
|
||||
render_403 unless @course.is_public==1 || User.current.member_of_course?(@course) || User.current.admin?
|
||||
end
|
||||
|
||||
def get_assigned_homeworks(student_works, n, index)
|
||||
student_works += student_works
|
||||
student_works[index + 1 .. index + n]
|
||||
end
|
||||
end
|
||||
|
|
|
@ -107,32 +107,18 @@ class NewsController < ApplicationController
|
|||
|
||||
def show
|
||||
# 更新news对应的forge_messages的消息viewed字段
|
||||
ids = @news.comments.map { |comment| comment.id }.join(",") unless @news.comments.nil?
|
||||
if @project
|
||||
query_message_news = @news.forge_messages
|
||||
# 更新新闻
|
||||
query_message_news = ForgeMessage.where("forge_message_id =? and user_id =? and viewed =?", @news.id, User.current.id, 0).first
|
||||
# 更新新闻的时候一并更新回复
|
||||
ForgeMessage.where("forge_message_id in (#{ids}) and forge_message_type = 'Comment' and user_id = #{User.current.id}").update_all(:viewed => true) unless ids.blank?
|
||||
else
|
||||
query_message_news = @news.course_messages
|
||||
query_message_news = CourseMessage.where("course_message_id =? and user_id =? and viewed =?", @news.id, User.current.id, 0).first
|
||||
CourseMessage.where("course_message_id in (#{ids}) and course_message_type = 'Comment' and user_id = #{User.current.id}").update_all(:viewed => true) unless ids.blank?
|
||||
end
|
||||
query_message_news.each do |query|
|
||||
if User.current.id == query.user_id
|
||||
query.update_attributes(:viewed => true)
|
||||
end
|
||||
end
|
||||
# 更新项目新闻的评阅的消息viewed字段
|
||||
current_message_comments = @news.comments
|
||||
current_message_comments.each do |current_message_comment|
|
||||
if @project
|
||||
query_message_comment = current_message_comment.forge_messages
|
||||
else
|
||||
query_message_comment = current_message_comment.course_messages
|
||||
end
|
||||
query_message_comment.each do |query|
|
||||
if User.current.id == query.user_id
|
||||
query.update_attributes(:viewed => true)
|
||||
end
|
||||
end
|
||||
end
|
||||
# end
|
||||
|
||||
query_message_news.update_attribute(:viewed, true) unless query_message_news.nil?
|
||||
# over
|
||||
cs = CoursesService.new
|
||||
result = cs.show_course_news params,User.current
|
||||
@news = result[:news]
|
||||
|
|
|
@ -69,6 +69,8 @@ class OrganizationsController < ApplicationController
|
|||
def show
|
||||
if @organization.is_public? || User.current.admin? || User.current.member_of_org?(@organization)
|
||||
@organization = Organization.find(params[:id])
|
||||
# 统计访问量
|
||||
@organization.update_attribute(:visits, @organization.visits.to_i + 1)
|
||||
if params[:org_subfield_id]
|
||||
@org_subfield = OrgSubfield.find(params[:org_subfield_id])
|
||||
@org_subfield_ids = @org_subfield.org_document_comments.map(&:id) << 0
|
||||
|
|
|
@ -298,6 +298,8 @@ class ProjectsController < ApplicationController
|
|||
if params[:jump] && redirect_to_project_menu_item(@project, params[:jump])
|
||||
return
|
||||
end
|
||||
# 统计访问量
|
||||
@project.update_attribute(:visits, @project.visits.to_i + 1)
|
||||
=begin
|
||||
cond = @project.project_condition(Setting.display_subprojects_issues?)
|
||||
has = {
|
||||
|
@ -406,6 +408,7 @@ class ProjectsController < ApplicationController
|
|||
end
|
||||
flash.now[:error] = html if !html.to_s.blank?
|
||||
end
|
||||
# for:设置默认分支
|
||||
scm = params[:repository_scm] || (Redmine::Scm::Base.all & Setting.enabled_scm).first
|
||||
@repository = Repository.factory(scm)
|
||||
@repository.is_default = @project.repository.nil?
|
||||
|
|
|
@ -140,7 +140,7 @@ class RepositoriesController < ApplicationController
|
|||
attrs = {:parent_id => project.parent_id}.reject {|k,v| v.nil?}
|
||||
redirect_to new_project_url(attrs, :course => '0')
|
||||
else
|
||||
redirect_to settings_project_url(project)
|
||||
redirect_to project_path(project)
|
||||
end
|
||||
}
|
||||
format.api { render :action => 'show', :status => :created, :location => url_for(:controller => 'projects', :action => 'show', :id => project.id) }
|
||||
|
@ -431,7 +431,10 @@ update
|
|||
|
||||
def entry
|
||||
entry_and_raw(false)
|
||||
render :layout => 'base_projects'
|
||||
@content = @repository.cat(@path, @rev)
|
||||
if is_entry_text_data?(@content, @path)
|
||||
render :layout => 'base_projects'
|
||||
end
|
||||
end
|
||||
|
||||
def entry_and_raw(is_raw)
|
||||
|
@ -443,9 +446,7 @@ update
|
|||
|
||||
@content = @repository.cat(@path, @rev)
|
||||
(show_error_not_found; return) unless @content
|
||||
if is_raw ||
|
||||
(@content.size && @content.size > Setting.file_max_size_displayed.to_i.kilobyte) ||
|
||||
! is_entry_text_data?(@content, @path)
|
||||
if is_raw || (@content.size && @content.size > Setting.file_max_size_displayed.to_i.kilobyte) || !is_entry_text_data?(@content, @path)
|
||||
# Force the download
|
||||
send_opt = { :filename => filename_for_content_disposition(@path.split('/').last) }
|
||||
send_type = Redmine::MimeType.of(@path)
|
||||
|
|
|
@ -36,6 +36,14 @@ class StudentWorkController < ApplicationController
|
|||
unless student_work.save
|
||||
resultObj[:status] = 200
|
||||
else
|
||||
student_work.name = params[:title]
|
||||
student_work.description = params[:src]
|
||||
if Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") < Time.parse(Time.now.to_s).strftime("%Y-%m-%d")
|
||||
student_work.late_penalty = @homework.late_penalty
|
||||
else
|
||||
student_work.late_penalty = 0
|
||||
end
|
||||
student_work.save
|
||||
resultObj[:status] = result["status"].to_i
|
||||
resultObj[:time] = student_work_test.created_at.to_s(:db)
|
||||
resultObj[:index] = student_work.student_work_tests.count
|
||||
|
@ -91,25 +99,27 @@ class StudentWorkController < ApplicationController
|
|||
else
|
||||
student_in_group = '(' + group_students.map{|user| user.id}.join(',') + ')'
|
||||
end
|
||||
#老师 || 超级管理员 || 禁用匿评&&作业截止&&已提交作品 显示所有列表
|
||||
if @homework.is_open == 1
|
||||
@stundet_works = search_homework_member @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").joins(:user).where("users.id in #{student_in_group}").order("#{@order} #{@b_sort}"),@name
|
||||
#开放作品 || 老师 || 超级管理员 || 禁用匿评&&作业截止&&已提交作品 显示所有列表
|
||||
if @homework.is_open == 1 || @is_teacher || User.current.admin? || (User.current.member_of_course?(@course) && @homework.anonymous_comment == 1 && Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") < Time.now.strftime("%Y-%m-%d") && !@homework.student_works.where(:user_id => User.current.id).empty?)
|
||||
if @order == 'lastname'
|
||||
@stundet_works = search_homework_member @homework.student_works.select("student_works.*,IF(final_score is null,null,IF(final_score = 0, 0, final_score - absence_penalty - late_penalty)) as score").joins(:user).where("users.id in #{student_in_group}").order("CONVERT(lastname USING gbk) COLLATE gbk_chinese_ci #{@b_sort}, login #{@b_sort}"),@name
|
||||
elsif @order == 'student_id'
|
||||
@stundet_works = search_homework_member @homework.student_works.select("student_works.*,IF(final_score is null,null,IF(final_score = 0, 0, final_score - absence_penalty - late_penalty)) as score").joins(:user).where("users.id in #{student_in_group}").joins("join user_extensions on student_works.user_id = user_extensions.user_id").order("#{@order} #{@b_sort}"),@name
|
||||
else
|
||||
@stundet_works = search_homework_member @homework.student_works.select("student_works.*,IF(final_score is null,null,IF(final_score = 0, 0, final_score - absence_penalty - late_penalty)) as score").joins(:user).where("users.id in #{student_in_group}").order("#{@order} #{@b_sort}"),@name
|
||||
end
|
||||
@show_all = true
|
||||
elsif @homework.is_open == 0 && User.current.member_of_course?(@course) || User.current.admin?
|
||||
if @is_teacher || @homework.homework_detail_manual.nil? ||
|
||||
(@homework.anonymous_comment == 1 && Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") < Time.now.strftime("%Y-%m-%d") && !@homework.student_works.where(:user_id => User.current.id).empty?)
|
||||
@stundet_works = search_homework_member @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").joins(:user).where("users.id in #{student_in_group}").order("#{@order} #{@b_sort}"),@name
|
||||
@show_all = true
|
||||
elsif @homework.homework_detail_manual.comment_status == 1 #学生 && 未开启匿评 只看到自己的
|
||||
elsif User.current.member_of_course?(@course)
|
||||
if @homework.homework_detail_manual.comment_status == 1 #学生 && 未开启匿评 只看到自己的
|
||||
if @homework.homework_type == 3
|
||||
pro = @homework.student_work_projects.where(:user_id => User.current.id).first
|
||||
if pro.nil?
|
||||
@stundet_works = []
|
||||
else
|
||||
@stundet_works = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:id => pro.student_work_id)
|
||||
@stundet_works = @homework.student_works.select("student_works.*,IF(final_score is null,null,IF(final_score = 0, 0, final_score - absence_penalty - late_penalty)) as score").where(:id => pro.student_work_id)
|
||||
end
|
||||
else
|
||||
@stundet_works = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:user_id => User.current.id)
|
||||
@stundet_works = @homework.student_works.select("student_works.*,IF(final_score is null,null,IF(final_score = 0, 0, final_score - absence_penalty - late_penalty)) as score").where(:user_id => User.current.id)
|
||||
end
|
||||
elsif @homework.homework_detail_manual.comment_status == 2 #学生 && 开启匿评 看到匿评列表
|
||||
if @homework.homework_type == 3
|
||||
|
@ -129,15 +139,21 @@ class StudentWorkController < ApplicationController
|
|||
if pro.nil?
|
||||
my_work = []
|
||||
else
|
||||
my_work = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:id => pro.student_work_id)
|
||||
my_work = @homework.student_works.select("student_works.*,IF(final_score is null,null,IF(final_score = 0, 0, final_score - absence_penalty - late_penalty)) as score").where(:id => pro.student_work_id)
|
||||
end
|
||||
else
|
||||
my_work = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:user_id => User.current.id)
|
||||
my_work = @homework.student_works.select("student_works.*,IF(final_score is null,null,IF(final_score = 0, 0, final_score - absence_penalty - late_penalty)) as score").where(:user_id => User.current.id)
|
||||
end
|
||||
if my_work.empty?
|
||||
@stundet_works = []
|
||||
else
|
||||
@stundet_works = search_homework_member @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").joins(:user).where("users.id in #{student_in_group}").order("#{@order} #{@b_sort}"),@name
|
||||
if @order == 'lastname'
|
||||
@stundet_works = search_homework_member @homework.student_works.select("student_works.*,IF(final_score is null,null,IF(final_score = 0, 0, final_score - absence_penalty - late_penalty)) as score").joins(:user).where("users.id in #{student_in_group}").order("CONVERT(lastname USING gbk) COLLATE gbk_chinese_ci #{@b_sort}, login #{@b_sort}"),@name
|
||||
elsif @order == 'student_id'
|
||||
@stundet_works = search_homework_member @homework.student_works.select("student_works.*,IF(final_score is null,null,IF(final_score = 0, 0, final_score - absence_penalty - late_penalty)) as score").joins(:user).where("users.id in #{student_in_group}").joins("join user_extensions on student_works.user_id = user_extensions.user_id").order("#{@order} #{@b_sort}"),@name
|
||||
else
|
||||
@stundet_works = search_homework_member @homework.student_works.select("student_works.*,IF(final_score is null,null,IF(final_score = 0, 0, final_score - absence_penalty - late_penalty)) as score").joins(:user).where("users.id in #{student_in_group}").order("#{@order} #{@b_sort}"),@name
|
||||
end
|
||||
@show_all = true
|
||||
end
|
||||
else
|
||||
|
@ -148,25 +164,28 @@ class StudentWorkController < ApplicationController
|
|||
return
|
||||
end
|
||||
|
||||
@student_work_count = (search_homework_member @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").joins(:user).where("users.id in #{student_in_group}").order("#{@order} #{@b_sort}"),@name).count
|
||||
@student_work_count = (search_homework_member @homework.student_works.select("student_works.*,IF(final_score is null,null,IF(final_score = 0, 0, final_score - absence_penalty - late_penalty)) as score").joins(:user).where("users.id in #{student_in_group}").order("#{@order} #{@b_sort}"),@name).count
|
||||
else
|
||||
if @homework.is_open == 1
|
||||
@stundet_works = search_homework_member @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").order("#{@order} #{@b_sort}"),@name
|
||||
if @homework.is_open == 1 || @is_teacher || User.current.admin? || (User.current.member_of_course?(@course) && @homework.anonymous_comment == 1 && Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") < Time.now.strftime("%Y-%m-%d") && !@homework.student_works.where(:user_id => User.current.id).empty?)
|
||||
if @order == 'lastname'
|
||||
@stundet_works = search_homework_member @homework.student_works.select("student_works.*,IF(final_score is null,null,IF(final_score = 0, 0, final_score - absence_penalty - late_penalty)) as score").joins(:user).order("CONVERT(lastname USING gbk) COLLATE gbk_chinese_ci #{@b_sort}, login #{@b_sort}"),@name
|
||||
elsif @order == 'student_id'
|
||||
@stundet_works = search_homework_member @homework.student_works.select("student_works.*,IF(final_score is null,null,IF(final_score = 0, 0, final_score - absence_penalty - late_penalty)) as score").joins("join user_extensions on student_works.user_id = user_extensions.user_id").order("#{@order} #{@b_sort}"),@name
|
||||
else
|
||||
@stundet_works = search_homework_member @homework.student_works.select("student_works.*,IF(final_score is null,null,IF(final_score = 0, 0, final_score - absence_penalty - late_penalty)) as score").order("#{@order} #{@b_sort}"),@name
|
||||
end
|
||||
@show_all = true
|
||||
elsif @homework.is_open == 0 && User.current.member_of_course?(@course) || User.current.admin?
|
||||
if @is_teacher || @homework.homework_detail_manual.nil? || (@homework.anonymous_comment == 1 && Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") < Time.now.strftime("%Y-%m-%d") && !@homework.student_works.where(:user_id => User.current.id).empty?) #老师 || 超级管理员 显示所有列表
|
||||
@stundet_works = search_homework_member @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").order("#{@order} #{@b_sort}"),@name
|
||||
@show_all = true
|
||||
elsif @homework.homework_detail_manual.comment_status == 1 #学生 && 未开启匿评 只看到自己的
|
||||
elsif User.current.member_of_course?(@course)
|
||||
if @homework.homework_detail_manual.comment_status == 1 #学生 && 未开启匿评 只看到自己的
|
||||
if @homework.homework_type == 3
|
||||
pro = @homework.student_work_projects.where(:user_id => User.current.id).first
|
||||
if pro.nil?
|
||||
@stundet_works = []
|
||||
else
|
||||
@stundet_works = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:id => pro.student_work_id)
|
||||
@stundet_works = @homework.student_works.select("student_works.*,IF(final_score is null,null,IF(final_score = 0, 0, final_score - absence_penalty - late_penalty)) as score").where(:id => pro.student_work_id)
|
||||
end
|
||||
else
|
||||
@stundet_works = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:user_id => User.current.id)
|
||||
@stundet_works = @homework.student_works.select("student_works.*,IF(final_score is null,null,IF(final_score = 0, 0, final_score - absence_penalty - late_penalty)) as score").where(:user_id => User.current.id)
|
||||
end
|
||||
elsif @homework.homework_detail_manual.comment_status == 2 #学生 && 开启匿评 看到匿评列表
|
||||
if @homework.homework_type == 3
|
||||
|
@ -186,15 +205,21 @@ class StudentWorkController < ApplicationController
|
|||
if pro.nil?
|
||||
my_work = []
|
||||
else
|
||||
my_work = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:id => pro.student_work_id)
|
||||
my_work = @homework.student_works.select("student_works.*,IF(final_score is null,null,IF(final_score = 0, 0, final_score - absence_penalty - late_penalty)) as score").where(:id => pro.student_work_id)
|
||||
end
|
||||
else
|
||||
my_work = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:user_id => User.current.id)
|
||||
my_work = @homework.student_works.select("student_works.*,IF(final_score is null,null,IF(final_score = 0, 0, final_score - absence_penalty - late_penalty)) as score").where(:user_id => User.current.id)
|
||||
end
|
||||
if my_work.empty?
|
||||
@stundet_works = []
|
||||
else
|
||||
@stundet_works = search_homework_member @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").order("#{@order} #{@b_sort}"),@name
|
||||
if @order == 'lastname'
|
||||
@stundet_works = search_homework_member @homework.student_works.select("student_works.*,IF(final_score is null,null,IF(final_score = 0, 0, final_score - absence_penalty - late_penalty)) as score").joins(:user).order("CONVERT(lastname USING gbk) COLLATE gbk_chinese_ci #{@b_sort}, login #{@b_sort}"),@name
|
||||
elsif @order == 'student_id'
|
||||
@stundet_works = search_homework_member @homework.student_works.select("student_works.*,IF(final_score is null,null,IF(final_score = 0, 0, final_score - absence_penalty - late_penalty)) as score").joins("join user_extensions on student_works.user_id = user_extensions.user_id").order("#{@order} #{@b_sort}"),@name
|
||||
else
|
||||
@stundet_works = search_homework_member @homework.student_works.select("student_works.*,IF(final_score is null,null,IF(final_score = 0, 0, final_score - absence_penalty - late_penalty)) as score").order("#{@order} #{@b_sort}"),@name
|
||||
end
|
||||
@show_all = true
|
||||
end
|
||||
else
|
||||
|
@ -205,7 +230,7 @@ class StudentWorkController < ApplicationController
|
|||
return
|
||||
end
|
||||
|
||||
@student_work_count = (search_homework_member @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").order("#{@order} #{@b_sort}"),@name).count
|
||||
@student_work_count = (search_homework_member @homework.student_works.select("student_works.*,IF(final_score is null,null,IF(final_score = 0, 0, final_score - absence_penalty - late_penalty)) as score").order("#{@order} #{@b_sort}"),@name).count
|
||||
end
|
||||
|
||||
@score = @b_sort == "desc" ? "asc" : "desc"
|
||||
|
@ -303,6 +328,7 @@ class StudentWorkController < ApplicationController
|
|||
stu_project.save
|
||||
end
|
||||
end
|
||||
@homework.update_attributes(:updated_at => Time.now)
|
||||
update_course_activity(@homework.class,@homework.id)
|
||||
update_user_activity(@homework.class,@homework.id)
|
||||
update_org_activity(@homework.class,@homework.id)
|
||||
|
@ -500,6 +526,10 @@ class StudentWorkController < ApplicationController
|
|||
when 3 #学生评分 学生评分显示平均分
|
||||
@work.student_score = @work.student_works_scores.where(:reviewer_role => 3).average(:score).try(:round, 2).to_f
|
||||
end
|
||||
@homework.update_attributes(:updated_at => Time.now)
|
||||
update_course_activity(@homework.class,@homework.id)
|
||||
update_user_activity(@homework.class,@homework.id)
|
||||
update_org_activity(@homework.class,@homework.id)
|
||||
if @work.save
|
||||
respond_to do |format|
|
||||
format.js
|
||||
|
|
|
@ -58,6 +58,7 @@ class UsersController < ApplicationController
|
|||
helper :sort
|
||||
helper :attachments
|
||||
include SortHelper
|
||||
include ApplicationHelper
|
||||
helper :custom_fields
|
||||
include CustomFieldsHelper
|
||||
include AvatarHelper
|
||||
|
@ -375,13 +376,15 @@ class UsersController < ApplicationController
|
|||
|
||||
#用户作业列表
|
||||
def user_homeworks
|
||||
@order,@b_sort = params[:order] || "created_at",params[:sort] || "desc"
|
||||
@user = User.current
|
||||
@r_sort = @b_sort == "desc" ? "asc" : "desc"
|
||||
if(params[:type].blank? || params[:type] == "1") #公共题库
|
||||
visible_course = Course.where("is_public = 1 && is_delete = 0")
|
||||
visible_course_ids = visible_course.empty? ? "(-1)" : "(" + visible_course.map{|course| course.id}.join(",") + ")"
|
||||
@homeworks = HomeworkCommon.where("course_id in #{visible_course_ids} and publish_time <= '#{Date.today}'").order("created_at desc")
|
||||
@homeworks = HomeworkCommon.where("course_id in #{visible_course_ids} and publish_time <= '#{Date.today}'").order("#{@order} #{@b_sort}")
|
||||
elsif params[:type] == "2" #我的题库
|
||||
@homeworks = HomeworkCommon.where("user_id = #{@user.id} and publish_time <= '#{Date.today}'").order("created_at desc")
|
||||
@homeworks = HomeworkCommon.where("user_id = #{@user.id} and publish_time <= '#{Date.today}'").order("#{@order} #{@b_sort}")
|
||||
end
|
||||
@type = params[:type]
|
||||
@limit = 15
|
||||
|
@ -422,7 +425,7 @@ class UsersController < ApplicationController
|
|||
end
|
||||
|
||||
def choose_user_course
|
||||
homework = HomeworkCommon.find params[:homework].to_i
|
||||
homework = HomeworkCommon.find params[:send_id].to_i
|
||||
if !params[:search].nil?
|
||||
search = "%#{params[:search].to_s.strip.downcase}%"
|
||||
@course = @user.courses.where("is_delete = 0 and #{Course.table_name}.id != #{homework.course_id} and #{Course.table_name}.id = #{params[:search].to_i } or #{Course.table_name}.name like :p",:p=>search).select { |course| @user.allowed_to?(:as_teacher,course)}
|
||||
|
@ -524,20 +527,22 @@ class UsersController < ApplicationController
|
|||
end
|
||||
|
||||
def user_homework_type
|
||||
@order,@b_sort = params[:order] || "created_at",params[:sort] || "desc"
|
||||
@r_sort = @b_sort == "desc" ? "asc" : "desc"
|
||||
@user = User.current
|
||||
if(params[:type].blank? || params[:type] == "1") #公共题库
|
||||
visible_course = Course.where("is_public = 1 && is_delete = 0")
|
||||
visible_course_ids = visible_course.empty? ? "(-1)" : "(" + visible_course.map{|course| course.id}.join(",") + ")"
|
||||
@homeworks = HomeworkCommon.where("course_id in #{visible_course_ids} and publish_time <= '#{Date.today}'").order("created_at desc")
|
||||
@homeworks = HomeworkCommon.where("course_id in #{visible_course_ids} and publish_time <= '#{Date.today}'").order("#{@order} #{@b_sort}")
|
||||
elsif params[:type] == "2" #我的题库
|
||||
@homeworks = HomeworkCommon.where("user_id = #{@user.id} and publish_time <= '#{Date.today}'").order("created_at desc")
|
||||
@homeworks = HomeworkCommon.where("user_id = #{@user.id} and publish_time <= '#{Date.today}'").order("#{@order} #{@b_sort}")
|
||||
end
|
||||
if params[:property] && params[:property] == "1"
|
||||
@homeworks = @homeworks.where("homework_type = 1").reorder("created_at desc")
|
||||
@homeworks = @homeworks.where("homework_type = 1").reorder("#{@order} #{@b_sort}")
|
||||
elsif params[:property] && params[:property] == "2"
|
||||
@homeworks = @homeworks.where("homework_type = 2").reorder("created_at desc")
|
||||
@homeworks = @homeworks.where("homework_type = 2").reorder("#{@order} #{@b_sort}")
|
||||
elsif params[:property] && params[:property] == "3"
|
||||
@homeworks = @homeworks.where("homework_type = 3").reorder("created_at desc")
|
||||
@homeworks = @homeworks.where("homework_type = 3").reorder("#{@order} #{@b_sort}")
|
||||
end
|
||||
@type = params[:type]
|
||||
@property = params[:property]
|
||||
|
@ -563,6 +568,8 @@ class UsersController < ApplicationController
|
|||
|
||||
#用户主页过滤作业
|
||||
def user_search_homeworks
|
||||
@order,@b_sort = params[:order] || "created_at",params[:sort] || "desc"
|
||||
@r_sort = @b_sort == "desc" ? "asc" : "desc"
|
||||
@user = User.current
|
||||
search = params[:name].to_s.strip.downcase
|
||||
if(params[:type].blank? || params[:type] == "1") #全部
|
||||
|
@ -572,16 +579,16 @@ class UsersController < ApplicationController
|
|||
all_user_ids = all_homeworks.map{|hw| hw.user_id}
|
||||
user_str_ids = search_user_by_name all_user_ids, search
|
||||
user_ids = user_str_ids.empty? ? "(-1)" : "(" + user_str_ids.join(",") + ")"
|
||||
@homeworks = HomeworkCommon.where("course_id in #{visible_course_ids} and publish_time <= '#{Date.today}' and (name like '%#{search}%' or user_id in #{user_ids})").order("created_at desc")
|
||||
@homeworks = HomeworkCommon.where("course_id in #{visible_course_ids} and publish_time <= '#{Date.today}' and (name like '%#{search}%' or user_id in #{user_ids})").order("#{@order} #{@b_sort}")
|
||||
elsif params[:type] == "2" #课程资源
|
||||
@homeworks = HomeworkCommon.where("user_id = #{@user.id} and publish_time <= '#{Date.today}' and (name like '%#{search}%')").order("created_at desc")
|
||||
@homeworks = HomeworkCommon.where("user_id = #{@user.id} and publish_time <= '#{Date.today}' and (name like '%#{search}%')").order("#{@order} #{@b_sort}")
|
||||
end
|
||||
if params[:property] && params[:property] == "1"
|
||||
@homeworks = @homeworks.where("homework_type = 1").reorder("created_at desc")
|
||||
@homeworks = @homeworks.where("homework_type = 1").reorder("#{@order} #{@b_sort}")
|
||||
elsif params[:property] && params[:property] == "2"
|
||||
@homeworks = @homeworks.where("homework_type = 2").reorder("created_at desc")
|
||||
@homeworks = @homeworks.where("homework_type = 2").reorder("#{@order} #{@b_sort}")
|
||||
elsif params[:property] && params[:property] == "3"
|
||||
@homeworks = @homeworks.where("homework_type = 3").reorder("created_at desc")
|
||||
@homeworks = @homeworks.where("homework_type = 3").reorder("#{@order} #{@b_sort}")
|
||||
end
|
||||
@type = params[:type]
|
||||
@limit = 15
|
||||
|
@ -591,6 +598,8 @@ class UsersController < ApplicationController
|
|||
@offset ||= @hw_pages.offset
|
||||
@homeworks = paginateHelper @homeworks,15
|
||||
@is_import = params[:is_import]
|
||||
@property = params[:property]
|
||||
@search = search
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
|
@ -690,6 +699,11 @@ class UsersController < ApplicationController
|
|||
end
|
||||
|
||||
student_work.save
|
||||
homework.update_attributes(:updated_at => Time.now)
|
||||
update_course_activity(homework.class,homework.id)
|
||||
update_user_activity(homework.class,homework.id)
|
||||
update_org_activity(homework.class,homework.id)
|
||||
|
||||
flash[:notice] = l(:notice_successful_create)
|
||||
redirect_to student_work_index_url(:homework => params[:homework])
|
||||
else
|
||||
|
@ -1168,6 +1182,10 @@ class UsersController < ApplicationController
|
|||
end
|
||||
|
||||
def show
|
||||
# 统计访问量
|
||||
unless User.current == @user
|
||||
@user.update_attribute(:visits, @user.visits.to_i + 1)
|
||||
end
|
||||
#更新用户申请成为课程老师或教辅消息的状态
|
||||
if params[:course_id] != nil
|
||||
join_course_messages = CourseMessage.where("course_id =? and course_message_type =? and user_id =? and course_message_id =? and viewed =?",
|
||||
|
@ -1537,7 +1555,7 @@ class UsersController < ApplicationController
|
|||
@user = User.find(params[:id])
|
||||
#@user.save_attachments(params[:attachments],User.current)
|
||||
# Container_type为Principal
|
||||
Attachment.attach_filesex(@user, params[:attachments], params[:attachment_type])
|
||||
attach = Attachment.attach_filesex_public(@user, params[:attachments], params[:attachment_type], is_public = true)
|
||||
if(params[:type].blank? || params[:type] == "1") # 我的资源
|
||||
# 修正:我的资源库的话,那么应该是我上传的所有资源加上,我加入的课程、项目、组织的所有资源
|
||||
if params[:status] == 2
|
||||
|
@ -2322,9 +2340,7 @@ class UsersController < ApplicationController
|
|||
|
||||
# 获取公共资源
|
||||
def get_public_resources user_course_ids, user_project_ids
|
||||
attachments = Attachment.where("(is_publish = 1 and container_id is not null and container_type in('Project','OrgSubfield','Principal','Course')) "+
|
||||
"or (container_type = 'Course' and container_id in (#{user_course_ids.empty? ? '0': user_course_ids.join(',')}) and is_publish = 1 and container_id is not null)" +
|
||||
"or (container_type = 'Project' and container_id in (#{user_project_ids.empty? ? '0': user_project_ids.join(',')}) and is_publish = 1 and container_id is not null)" ).order("created_on desc")
|
||||
attachments = Attachment.where("(is_publish = 1 and is_public =1 and container_id is not null and container_type in('Project','OrgSubfield','Principal','Course')) ").order("created_on desc")
|
||||
end
|
||||
|
||||
# 获取我的资源
|
||||
|
@ -2341,7 +2357,7 @@ class UsersController < ApplicationController
|
|||
|
||||
# 获取公共资源课程
|
||||
def get_course_resources_public user_course_ids
|
||||
attchments = Attachment.where("(container_type = 'Course' and is_publish = 1) or (container_type = 'Course' and container_id in (#{user_course_ids.empty? ? '0': user_course_ids.join(',')}) and is_publish = 1) ").order("created_on desc")
|
||||
attchments = Attachment.where("(container_type = 'Course'and container_id is not null and is_publish = 1 and is_public =1)").order("created_on desc")
|
||||
end
|
||||
|
||||
# 获取我的项目资源
|
||||
|
@ -2351,7 +2367,7 @@ class UsersController < ApplicationController
|
|||
|
||||
# 获取公共资源的项目资源
|
||||
def get_project_resources_public user_project_ids
|
||||
attchments = Attachment.where("(container_type = 'Project') or (container_type = 'Project' and container_id in (#{user_project_ids.empty? ? '0': user_project_ids.join(',')}) and is_publish = 1) ").order("created_on desc")
|
||||
attchments = Attachment.where("container_type = 'Project' and container_id is not null and is_public =1").order("created_on desc")
|
||||
end
|
||||
|
||||
# 获取我上传的附件
|
||||
|
@ -2361,7 +2377,7 @@ class UsersController < ApplicationController
|
|||
|
||||
# 获取公共资源中我上传的附件
|
||||
def get_attch_resources_public
|
||||
attchments = Attachment.where("container_type in('Issue','Document','Message','News','StudentWorkScore','HomewCommon','OrgSubfield','Principal')").order("created_on desc")
|
||||
attchments = Attachment.where("container_type in('Issue','Document','Message','News','StudentWorkScore','HomewCommon','OrgSubfield','Principal') and container_id is not null and is_public =1").order("created_on desc")
|
||||
end
|
||||
|
||||
# 获取我的用户类型资源
|
||||
|
@ -2371,7 +2387,7 @@ class UsersController < ApplicationController
|
|||
|
||||
# 获取我的用户类型资源
|
||||
def get_principal_resources_public
|
||||
attchments = Attachment.where("container_type = 'Principal'").order("created_on desc")
|
||||
attchments = Attachment.where("container_type = 'Principal'and container_id is not null and is_public =1").order("created_on desc")
|
||||
end
|
||||
|
||||
# 资源库 分为全部 课程资源 项目资源 附件
|
||||
|
@ -2603,9 +2619,7 @@ class UsersController < ApplicationController
|
|||
end
|
||||
elsif params[:type] == "6" #全部资源
|
||||
# 公共资源库:所有公开资源或者我上传的私有资源
|
||||
@attachments = Attachment.where("((is_publish = 1 and container_id is not null and container_type in('Project','OrgSubfield','Principal','Course')) "+
|
||||
"or (container_type = 'Course' and container_id in (#{user_course_ids.empty? ? '0': user_course_ids.join(',')}) and is_publish = 1 and container_id is not null)" +
|
||||
"or (container_type = 'Project' and container_id in (#{user_project_ids.empty? ? '0': user_project_ids.join(',')}) and is_publish = 1 and container_id is not null)) and (filename like :p)" ,:p => search).order("created_on desc")
|
||||
@attachments = Attachment.where("is_publish = 1 and is_public = 1 and container_id is not null and container_type in('Project','OrgSubfield','Principal','Course') and (filename like :p)" ,:p => search).order("created_on desc")
|
||||
end
|
||||
@type = params[:type]
|
||||
@limit = 25
|
||||
|
|
|
@ -276,7 +276,7 @@ class WordsController < ApplicationController
|
|||
ids = params[:asset_id].split(',')
|
||||
update_kindeditor_assets_owner ids,feedback[:id],OwnerTypeHelper::JOURNALSFORMESSAGE
|
||||
end
|
||||
|
||||
@homework_common.update_attributes(:updated_at => Time.now)
|
||||
update_course_activity(@homework_common.class,@homework_common.id)
|
||||
update_user_activity(@homework_common.class,@homework_common.id)
|
||||
update_org_activity(@homework_common.class,@homework_common.id)
|
||||
|
|
|
@ -117,56 +117,102 @@ module ApplicationHelper
|
|||
when "HomeworkCommon"
|
||||
if course_contributor_score.nil?
|
||||
CourseContributorScore.create(:course_id => course_id, :user_id => user_id, :message_num => 0, :message_reply_num => 0,
|
||||
:news_reply_num => 0, :resource_num => 0, :journal_num => 0, :journal_reply_num => 0, :homework_journal_num => 1 , :total_score => 1)
|
||||
:news_reply_num => 0, :resource_num => 0, :journal_num => 0, :journal_reply_num => 0, :homework_journal_num => 1)
|
||||
else
|
||||
score = course_contributor_score.homework_journal_num + 1
|
||||
total_score = course_contributor_score.total_score + 1
|
||||
course_contributor_score.update_attributes(:homework_journal_num => score, :total_score => total_score)
|
||||
course_contributor_score.update_attributes(:homework_journal_num => score)
|
||||
end
|
||||
when "JournalForMessage"
|
||||
# 课程留言
|
||||
when "Course"
|
||||
if course_contributor_score.nil?
|
||||
CourseContributorScore.create(:course_id => course_id, :user_id => user_id, :message_num => 0, :message_reply_num => 0,
|
||||
:news_reply_num => 0, :resource_num => 0, :journal_num => 1, :journal_reply_num => 0, :total_score => 1)
|
||||
:news_reply_num => 0, :resource_num => 0, :journal_num => 1, :journal_reply_num => 0)
|
||||
else
|
||||
score = course_contributor_score.journal_num + 1
|
||||
total_score = course_contributor_score.total_score + 1
|
||||
course_contributor_score.update_attributes(:journal_num => score, :total_score => total_score)
|
||||
course_contributor_score.update_attributes(:journal_num => score)
|
||||
end
|
||||
when "Message"
|
||||
if course_contributor_score.nil?
|
||||
CourseContributorScore.create(:course_id => course_id, :user_id => user_id, :message_num => 2, :message_reply_num => 0,
|
||||
:news_reply_num => 0, :resource_num => 0, :journal_num => 0, :journal_reply_num => 0, :total_score => 2)
|
||||
CourseContributorScore.create(:course_id => course_id, :user_id => user_id, :message_num => 1, :message_reply_num => 0,
|
||||
:news_reply_num => 0, :resource_num => 0, :journal_num => 0, :journal_reply_num => 0)
|
||||
else
|
||||
score = course_contributor_score.message_num + 2
|
||||
total_score = course_contributor_score.total_score + 2
|
||||
course_contributor_score.update_attributes(:message_num => score, :total_score => total_score)
|
||||
score = course_contributor_score.message_num + 1
|
||||
course_contributor_score.update_attributes(:message_num => score)
|
||||
end
|
||||
when "MessageReply"
|
||||
if course_contributor_score.nil?
|
||||
CourseContributorScore.create(:course_id => course_id, :user_id => user_id, :message_num => 0, :message_reply_num => 1,
|
||||
:news_reply_num => 0, :resource_num => 0, :journal_num => 0, :journal_reply_num => 0, :total_score => 1)
|
||||
:news_reply_num => 0, :resource_num => 0, :journal_num => 0, :journal_reply_num => 0)
|
||||
else
|
||||
score = course_contributor_score.message_reply_num + 1
|
||||
total_score = course_contributor_score.total_score + 1
|
||||
course_contributor_score.update_attributes(:message_reply_num => score, :total_score => total_score)
|
||||
course_contributor_score.update_attributes(:message_reply_num => score)
|
||||
end
|
||||
when "NewReply"
|
||||
if course_contributor_score.nil?
|
||||
CourseContributorScore.create(:course_id => course_id, :user_id => user_id, :message_num => 0, :message_reply_num => 0,
|
||||
:news_reply_num => 1, :resource_num => 0, :journal_num => 0, :journal_reply_num => 0, :total_score => 1)
|
||||
:news_reply_num => 1, :resource_num => 0, :journal_num => 0, :journal_reply_num => 0)
|
||||
else
|
||||
score = course_contributor_score.news_reply_num + 1
|
||||
total_score = course_contributor_score.total_score + 1
|
||||
course_contributor_score.update_attributes(:news_reply_num => score, :total_score => total_score)
|
||||
course_contributor_score.update_attributes(:news_reply_num => score)
|
||||
end
|
||||
when "News"
|
||||
if course_contributor_score.nil?
|
||||
CourseContributorScore.create(:course_id => course_id, :user_id => user_id, :message_num => 0, :message_reply_num => 0,
|
||||
:news_reply_num => 0, :news_num => 1, :resource_num => 0, :journal_num => 0, :journal_reply_num => 0, :total_score => 1)
|
||||
:news_reply_num => 0, :news_num => 1, :resource_num => 0, :journal_num => 0, :journal_reply_num => 0)
|
||||
else
|
||||
score = course_contributor_score.news_num + 1
|
||||
total_score = course_contributor_score.total_score + 1
|
||||
course_contributor_score.update_attributes(:news_num => score, :total_score => total_score)
|
||||
course_contributor_score.update_attributes(:news_num => score)
|
||||
end
|
||||
when "Attachment"
|
||||
if course_contributor_score.nil?
|
||||
CourseContributorScore.create(:course_id => course_id, :user_id => user_id, :message_num => 0, :message_reply_num => 0,
|
||||
:news_reply_num => 0, :news_num => 0, :resource_num => 1, :journal_num => 0, :journal_reply_num => 0)
|
||||
else
|
||||
score = course_contributor_score.resource_num + 1
|
||||
course_contributor_score.update_attributes(:resource_num => score)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# 删除某条记录相应减少课程统计数
|
||||
def down_course_score_num (course_id,user_id,type)
|
||||
course_contributor_score = CourseContributorScore.where("course_id =? and user_id =?", course_id, user_id).first
|
||||
case type
|
||||
when "HomeworkCommon"
|
||||
unless course_contributor_score.nil?
|
||||
score = course_contributor_score.homework_journal_num - 1
|
||||
course_contributor_score.update_attribute(:homework_journal_num, score < 0 ? 0 : score)
|
||||
end
|
||||
# 课程留言
|
||||
when "Course"
|
||||
unless course_contributor_score.nil?
|
||||
score = course_contributor_score.journal_num - 1
|
||||
course_contributor_score.update_attribute(:journal_num, score < 0 ? 0 : score)
|
||||
end
|
||||
when "Message"
|
||||
unless course_contributor_score.nil?
|
||||
score = course_contributor_score.message_num - 1
|
||||
course_contributor_score.update_attribute(:message_num, score < 0 ? 0 : score)
|
||||
end
|
||||
when "MessageReply"
|
||||
unless course_contributor_score.nil?
|
||||
score = course_contributor_score.message_reply_num - 1
|
||||
course_contributor_score.update_attribute(:message_reply_num, score < 0 ? 0 : score)
|
||||
end
|
||||
when "NewReply"
|
||||
unless course_contributor_score.nil?
|
||||
score = course_contributor_score.news_reply_num - 1
|
||||
course_contributor_score.update_attribute(:news_reply_num, score < 0 ? 0 : score)
|
||||
end
|
||||
when "News"
|
||||
unless course_contributor_score.nil?
|
||||
score = course_contributor_score.news_num - 1
|
||||
course_contributor_score.update_attribute(:news_num, score < 0 ? 0 : score)
|
||||
end
|
||||
when "Attachment"
|
||||
unless course_contributor_score.nil?
|
||||
score = course_contributor_score.resource_num - 1
|
||||
course_contributor_score.update_attribute(:resource_num, score < 0 ? 0 : score)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -71,6 +71,11 @@ module CoursesHelper
|
|||
project.members.count
|
||||
end
|
||||
|
||||
# 统计课程中作品的数量
|
||||
def student_works_num course
|
||||
StudentWork.find_by_sql("SELECT * FROM student_works WHERE homework_common_id IN (SELECT id FROM homework_commons WHERE course_id = '#{course.id}')").count
|
||||
end
|
||||
|
||||
# 返回教师数量,即roles表中定义的Manager
|
||||
def teacherCount project
|
||||
project ? project.members.count - studentCount(project).to_i : 0
|
||||
|
@ -601,6 +606,24 @@ module CoursesHelper
|
|||
Course.tagged_with(tag_name).order('updated_at desc')
|
||||
end
|
||||
|
||||
#分班下拉框
|
||||
def course_group_option course
|
||||
type = []
|
||||
option1 = []
|
||||
option1 << "暂无"
|
||||
option1 << 0
|
||||
type << option1
|
||||
unless course.course_groups.nil?
|
||||
course.course_groups.each do |cg|
|
||||
option = []
|
||||
option << cg.name
|
||||
option << cg.id
|
||||
type << option
|
||||
end
|
||||
end
|
||||
type
|
||||
end
|
||||
|
||||
#课程实践年份下拉框
|
||||
def course_time_option year
|
||||
type = []
|
||||
|
@ -762,7 +785,7 @@ module CoursesHelper
|
|||
return[] unless course
|
||||
result = []
|
||||
course.attachments.each do |attachment|
|
||||
if attachment.is_public? ||User.current == attachment.author ||User.current.allowed_to?(:as_teacher,Course.find(attachment.container_id))|| (User.current.member_of_course?(course) && attachment.is_publish == 1) || User.current.admin?
|
||||
if (attachment.is_public? && attachment.is_publish == 1) ||User.current == attachment.author ||User.current.allowed_to?(:as_teacher,course)|| (User.current.member_of_course?(course) && attachment.is_publish == 1) || User.current.admin?
|
||||
result << attachment
|
||||
end
|
||||
end
|
||||
|
|
|
@ -121,7 +121,8 @@ module FilesHelper
|
|||
def visable_attachemnts attachments
|
||||
result = []
|
||||
attachments.each do |attachment|
|
||||
if attachment.is_public? ||
|
||||
if (attachment.is_public? && attachment.container_type != "Course") ||
|
||||
(attachment.is_public? && attachment.container_type == "Course" && attachment.is_publish == 1)||
|
||||
(attachment.container_type == "Project" && User.current.member_of?(attachment.project)) ||
|
||||
(attachment.container_type == "Course" && User.current.allowed_to?(:as_teacher,Course.find(attachment.container_id)))||
|
||||
(attachment.container_type == "Course" && User.current.member_of_course?(Course.find(attachment.container_id)) && attachment.is_publish == 1)||
|
||||
|
|
|
@ -43,6 +43,7 @@ class Attachment < ActiveRecord::Base
|
|||
|
||||
#elasticsearch
|
||||
include Elasticsearch::Model
|
||||
include ApplicationHelper
|
||||
#elasticsearch kaminari init
|
||||
Kaminari::Hooks.init
|
||||
Elasticsearch::Model::Response::Response.__send__ :include, Elasticsearch::Model::Response::Pagination::Kaminari
|
||||
|
@ -92,7 +93,7 @@ class Attachment < ActiveRecord::Base
|
|||
after_save :act_as_course_activity
|
||||
after_create :office_conver, :be_user_score,:act_as_forge_activity,:create_attachment_ealasticsearch_index
|
||||
after_update :office_conver, :be_user_score,:update_attachment_ealasticsearch_index
|
||||
after_destroy :delete_from_disk,:down_user_score,:delete_attachment_ealasticsearch_index, :decrease_attchments_count
|
||||
after_destroy :delete_from_disk,:down_user_score,:delete_attachment_ealasticsearch_index, :decrease_attchments_count, :down_course_score
|
||||
|
||||
# add by nwb
|
||||
# 获取所有可公开的资源文件列表
|
||||
|
@ -498,6 +499,12 @@ class Attachment < ActiveRecord::Base
|
|||
result
|
||||
end
|
||||
|
||||
def self.attach_filesex_public(obj, attachments,attachment_type, is_public)
|
||||
result = obj.save_attachmentsex_public(attachments, User.current,attachment_type, is_public)
|
||||
obj.attach_saved_attachments
|
||||
result
|
||||
end
|
||||
|
||||
def self.latest_attach(attachments, filename)
|
||||
attachments.sort_by(&:created_on).reverse.detect {
|
||||
|att| att.filename.downcase == filename.downcase
|
||||
|
@ -655,6 +662,12 @@ class Attachment < ActiveRecord::Base
|
|||
self.container.project_score.update_attribute(:attach_num, attach_count < 0 ? 0 : attach_count)
|
||||
end
|
||||
end
|
||||
|
||||
def down_course_score
|
||||
if self.container_type == "Course"
|
||||
down_course_score_num(self.container_id, self.author_id, "Attachment")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# Delete the previous articles index in Elasticsearch
|
||||
|
|
|
@ -36,6 +36,7 @@ class Comment < ActiveRecord::Base
|
|||
validates_presence_of :commented, :author, :comments
|
||||
safe_attributes 'comments'
|
||||
after_create :send_mail, :act_as_system_message, :act_as_student_score
|
||||
after_destroy :down_course_score
|
||||
|
||||
def act_as_system_message
|
||||
if self.commented.course
|
||||
|
@ -86,4 +87,11 @@ class Comment < ActiveRecord::Base
|
|||
end
|
||||
end
|
||||
|
||||
# 课程新闻数减少
|
||||
def down_course_score
|
||||
if self.commented.course
|
||||
down_course_score_num(self.commented.course.id, self.author_id, "NewReply")
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -73,7 +73,7 @@ class JournalsForMessage < ActiveRecord::Base
|
|||
#after_update :update_activity
|
||||
after_destroy :reset_counters!
|
||||
after_save :be_user_score
|
||||
after_destroy :down_user_score
|
||||
after_destroy :down_user_score, :down_course_score
|
||||
|
||||
# default_scope { where('m_parent_id IS NULL') }
|
||||
|
||||
|
@ -184,6 +184,7 @@ class JournalsForMessage < ActiveRecord::Base
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
# 更新用户分数 -by zjc
|
||||
def down_user_score
|
||||
#删除了留言回复
|
||||
|
@ -286,10 +287,19 @@ class JournalsForMessage < ActiveRecord::Base
|
|||
# 课程成员得分(活跃度)
|
||||
def act_as_student_score
|
||||
if self.jour_type == "Course"
|
||||
course_member_score(self.jour_id, self.user_id, "JournalForMessage")
|
||||
course_member_score(self.jour_id, self.user_id, "Course")
|
||||
elsif self.jour_type == "HomeworkCommon"
|
||||
course_member_score(self.jour.course_id, self.user_id, "HomeworkCommon")
|
||||
end
|
||||
end
|
||||
|
||||
# 删除操作的时候相应扣掉回复数
|
||||
def down_course_score
|
||||
if self.jour_type == "Course"
|
||||
down_course_score_num(self.jour_id, self.user_id, "Course")
|
||||
elsif self.jour_type == "HomeworkCommon"
|
||||
down_course_score_num(self.jour.course_id, self.user_id, "HomeworkCommon")
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -1,185 +1,185 @@
|
|||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2013 Jean-Philippe Lang
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
class Member < ActiveRecord::Base
|
||||
belongs_to :user
|
||||
belongs_to :principal, :foreign_key => 'user_id'
|
||||
has_many :member_roles, :dependent => :destroy
|
||||
has_many :roles, :through => :member_roles
|
||||
|
||||
belongs_to :project
|
||||
belongs_to :course
|
||||
|
||||
belongs_to :course_group
|
||||
validates_presence_of :principal
|
||||
validates_uniqueness_of :user_id, :scope => [:project_id,:course_id]
|
||||
validate :validate_role
|
||||
|
||||
before_destroy :set_issue_category_nil
|
||||
# 删除项目成员一并删除该成员的邀请记录
|
||||
after_destroy :delete_ivite_list
|
||||
|
||||
|
||||
|
||||
def role
|
||||
end
|
||||
|
||||
def role=
|
||||
end
|
||||
|
||||
def name
|
||||
self.user.name
|
||||
end
|
||||
|
||||
alias :base_role_ids= :role_ids=
|
||||
def role_ids=(arg)
|
||||
ids = (arg || []).collect(&:to_i) - [0]
|
||||
# Keep inherited roles
|
||||
ids += member_roles.select {|mr| !mr.inherited_from.nil?}.collect(&:role_id)
|
||||
|
||||
new_role_ids = ids - role_ids
|
||||
# Add new roles
|
||||
new_role_ids.each {|id| member_roles << MemberRole.new(:role_id => id) }
|
||||
# Remove roles (Rails' #role_ids= will not trigger MemberRole#on_destroy)
|
||||
member_roles_to_destroy = member_roles.select {|mr| !ids.include?(mr.role_id)}
|
||||
if member_roles_to_destroy.any?
|
||||
member_roles_to_destroy.each(&:destroy)
|
||||
end
|
||||
end
|
||||
|
||||
def <=>(member)
|
||||
a, b = roles.sort.first, member.roles.sort.first
|
||||
if a == b
|
||||
if principal
|
||||
principal <=> member.principal
|
||||
else
|
||||
1
|
||||
end
|
||||
elsif a
|
||||
a <=> b
|
||||
else
|
||||
1
|
||||
end
|
||||
end
|
||||
|
||||
def deletable?
|
||||
member_roles.detect {|mr| mr.inherited_from}.nil?
|
||||
end
|
||||
|
||||
def include?(user)
|
||||
if principal.is_a?(Group)
|
||||
!user.nil? && user.groups.include?(principal)
|
||||
else
|
||||
self.user == user
|
||||
end
|
||||
end
|
||||
|
||||
def set_issue_category_nil
|
||||
if user
|
||||
# remove category based auto assignments for this member
|
||||
#modify by nwb
|
||||
if project
|
||||
IssueCategory.update_all "assigned_to_id = NULL", ["project_id = ? AND assigned_to_id = ?", project.id, user.id]
|
||||
elsif course
|
||||
#IssueCategory.update_all "assigned_to_id = NULL", ["course_id = ? AND assigned_to_id = ?", course.id, user.id]
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
# 删除成员一并删除该成员的邀请信息
|
||||
def delete_ivite_list
|
||||
member_invite_lists = InviteList.where("user_id =? and project_id =?", self.user_id, self.project_id)
|
||||
unless member_invite_lists.nil?
|
||||
member_invite_lists.each do |member_invite_list|
|
||||
member_invite_list.destroy
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# Find or initilize a Member with an id, attributes, and for a Principal
|
||||
def self.edit_membership(id, new_attributes, principal=nil)
|
||||
@membership = id.present? ? Member.find(id) : Member.new(:principal => principal)
|
||||
@membership.attributes = new_attributes
|
||||
@membership
|
||||
end
|
||||
|
||||
# Finds or initilizes a Member for the given project and principal
|
||||
def self.find_or_new(project, principal)
|
||||
project_id = project.is_a?(Project) ? project.id : project
|
||||
principal_id = principal.is_a?(Principal) ? principal.id : principal
|
||||
|
||||
member = Member.find_by_project_id_and_user_id(project_id, principal_id)
|
||||
member ||= Member.new(:project_id => project_id, :user_id => principal_id)
|
||||
member
|
||||
end
|
||||
|
||||
# 查找每个学生每个作业的评分
|
||||
def student_homework_score
|
||||
homework_score = StudentWork.find_by_sql("SELECT homework_commons.name,student_works.final_score as score
|
||||
FROM student_works,homework_commons
|
||||
WHERE student_works.homework_common_id = homework_commons.id
|
||||
AND homework_commons.course_id = #{self.course_id}
|
||||
AND student_works.user_id = #{self.user_id}")
|
||||
score_count = StudentWork.joins(:homework_common).where("student_works.user_id = #{self.user_id} and homework_commons.course_id = #{self.course_id}").average(:final_score).try(:round, 2).to_f
|
||||
[homework_score, format("%0.2f", score_count)]
|
||||
end
|
||||
|
||||
def student_work_score
|
||||
StudentWork.select("homework_commons.name, student_works.final_score").joins(:homework_common).where("student_works.user_id = #{self.user_id} and homework_commons.course_id = #{self.course_id}")
|
||||
end
|
||||
|
||||
#当前课程的作业列表
|
||||
def homework_common_list
|
||||
HomeworkCommon.where(:course_id => self.course_id)
|
||||
end
|
||||
|
||||
#当前学生在指定作业内的得分
|
||||
def homework_common_score homework_common
|
||||
StudentWork.select("IF(final_score is null,null,final_score - absence_penalty - late_penalty) as final_score").where(:homework_common_id => homework_common.id,:user_id => self.user_id)
|
||||
end
|
||||
|
||||
def student_work_score_avg
|
||||
StudentWork.joins(:homework_common).where("student_works.user_id = #{self.user_id} and homework_commons.course_id = #{self.course_id}").average(:final_score).try(:round, 2).to_f
|
||||
end
|
||||
|
||||
def student_work_score_sum
|
||||
sql_select = "SELECT (SUM(IF(student_works.final_score is null,null,student_works.final_score - student_works.absence_penalty - student_works.late_penalty))) as score
|
||||
FROM student_works,homework_commons
|
||||
WHERE student_works.homework_common_id = homework_commons.id
|
||||
AND homework_commons.course_id = #{self.course_id}
|
||||
AND student_works.user_id = #{self.user_id}"
|
||||
score = StudentWork.find_by_sql(sql_select)
|
||||
end
|
||||
|
||||
protected
|
||||
|
||||
def validate_role
|
||||
errors.add_on_empty :role if member_roles.empty? && roles.empty?
|
||||
end
|
||||
|
||||
|
||||
|
||||
def searchTeacherAndAssistant project
|
||||
#searchPeopleByRoles(project, TeacherRoles)
|
||||
members = []
|
||||
project.members.each do |m|
|
||||
members << m if m && m.user && m.user.allowed_to?(:as_teacher,project)
|
||||
end
|
||||
members
|
||||
end
|
||||
end
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2013 Jean-Philippe Lang
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
class Member < ActiveRecord::Base
|
||||
belongs_to :user
|
||||
belongs_to :principal, :foreign_key => 'user_id'
|
||||
has_many :member_roles, :dependent => :destroy
|
||||
has_many :roles, :through => :member_roles
|
||||
|
||||
belongs_to :project
|
||||
belongs_to :course
|
||||
|
||||
belongs_to :course_group
|
||||
validates_presence_of :principal
|
||||
validates_uniqueness_of :user_id, :scope => [:project_id,:course_id]
|
||||
validate :validate_role
|
||||
|
||||
before_destroy :set_issue_category_nil
|
||||
# 删除项目成员一并删除该成员的邀请记录
|
||||
after_destroy :delete_ivite_list
|
||||
|
||||
|
||||
|
||||
def role
|
||||
end
|
||||
|
||||
def role=
|
||||
end
|
||||
|
||||
def name
|
||||
self.user.name
|
||||
end
|
||||
|
||||
alias :base_role_ids= :role_ids=
|
||||
def role_ids=(arg)
|
||||
ids = (arg || []).collect(&:to_i) - [0]
|
||||
# Keep inherited roles
|
||||
ids += member_roles.select {|mr| !mr.inherited_from.nil?}.collect(&:role_id)
|
||||
|
||||
new_role_ids = ids - role_ids
|
||||
# Add new roles
|
||||
new_role_ids.each {|id| member_roles << MemberRole.new(:role_id => id) }
|
||||
# Remove roles (Rails' #role_ids= will not trigger MemberRole#on_destroy)
|
||||
member_roles_to_destroy = member_roles.select {|mr| !ids.include?(mr.role_id)}
|
||||
if member_roles_to_destroy.any?
|
||||
member_roles_to_destroy.each(&:destroy)
|
||||
end
|
||||
end
|
||||
|
||||
def <=>(member)
|
||||
a, b = roles.sort.first, member.roles.sort.first
|
||||
if a == b
|
||||
if principal
|
||||
principal <=> member.principal
|
||||
else
|
||||
1
|
||||
end
|
||||
elsif a
|
||||
a <=> b
|
||||
else
|
||||
1
|
||||
end
|
||||
end
|
||||
|
||||
def deletable?
|
||||
member_roles.detect {|mr| mr.inherited_from}.nil?
|
||||
end
|
||||
|
||||
def include?(user)
|
||||
if principal.is_a?(Group)
|
||||
!user.nil? && user.groups.include?(principal)
|
||||
else
|
||||
self.user == user
|
||||
end
|
||||
end
|
||||
|
||||
def set_issue_category_nil
|
||||
if user
|
||||
# remove category based auto assignments for this member
|
||||
#modify by nwb
|
||||
if project
|
||||
IssueCategory.update_all "assigned_to_id = NULL", ["project_id = ? AND assigned_to_id = ?", project.id, user.id]
|
||||
elsif course
|
||||
#IssueCategory.update_all "assigned_to_id = NULL", ["course_id = ? AND assigned_to_id = ?", course.id, user.id]
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
# 删除成员一并删除该成员的邀请信息
|
||||
def delete_ivite_list
|
||||
member_invite_lists = InviteList.where("user_id =? and project_id =?", self.user_id, self.project_id)
|
||||
unless member_invite_lists.nil?
|
||||
member_invite_lists.each do |member_invite_list|
|
||||
member_invite_list.destroy
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# Find or initilize a Member with an id, attributes, and for a Principal
|
||||
def self.edit_membership(id, new_attributes, principal=nil)
|
||||
@membership = id.present? ? Member.find(id) : Member.new(:principal => principal)
|
||||
@membership.attributes = new_attributes
|
||||
@membership
|
||||
end
|
||||
|
||||
# Finds or initilizes a Member for the given project and principal
|
||||
def self.find_or_new(project, principal)
|
||||
project_id = project.is_a?(Project) ? project.id : project
|
||||
principal_id = principal.is_a?(Principal) ? principal.id : principal
|
||||
|
||||
member = Member.find_by_project_id_and_user_id(project_id, principal_id)
|
||||
member ||= Member.new(:project_id => project_id, :user_id => principal_id)
|
||||
member
|
||||
end
|
||||
|
||||
# 查找每个学生每个作业的评分
|
||||
def student_homework_score
|
||||
homework_score = StudentWork.find_by_sql("SELECT homework_commons.name,student_works.final_score as score
|
||||
FROM student_works,homework_commons
|
||||
WHERE student_works.homework_common_id = homework_commons.id
|
||||
AND homework_commons.course_id = #{self.course_id}
|
||||
AND student_works.user_id = #{self.user_id}")
|
||||
score_count = StudentWork.joins(:homework_common).where("student_works.user_id = #{self.user_id} and homework_commons.course_id = #{self.course_id}").average(:final_score).try(:round, 2).to_f
|
||||
[homework_score, format("%0.2f", score_count)]
|
||||
end
|
||||
|
||||
def student_work_score
|
||||
StudentWork.select("homework_commons.name, student_works.final_score").joins(:homework_common).where("student_works.user_id = #{self.user_id} and homework_commons.course_id = #{self.course_id}")
|
||||
end
|
||||
|
||||
#当前课程的作业列表
|
||||
def homework_common_list
|
||||
HomeworkCommon.where(:course_id => self.course_id)
|
||||
end
|
||||
|
||||
#当前学生在指定作业内的得分
|
||||
def homework_common_score homework_common
|
||||
StudentWork.select("IF(final_score is null,null,IF(final_score = 0, 0, final_score - absence_penalty - late_penalty)) as final_score").where(:homework_common_id => homework_common.id,:user_id => self.user_id)
|
||||
end
|
||||
|
||||
def student_work_score_avg
|
||||
StudentWork.joins(:homework_common).where("student_works.user_id = #{self.user_id} and homework_commons.course_id = #{self.course_id}").average(:final_score).try(:round, 2).to_f
|
||||
end
|
||||
|
||||
def student_work_score_sum
|
||||
sql_select = "SELECT (SUM(IF(student_works.final_score IS NULL,NULL,IF(student_works.final_score =0,0,student_works.final_score - student_works.absence_penalty - student_works.late_penalty)))) as score
|
||||
FROM student_works,homework_commons
|
||||
WHERE student_works.homework_common_id = homework_commons.id
|
||||
AND homework_commons.course_id = #{self.course_id}
|
||||
AND student_works.user_id = #{self.user_id}"
|
||||
score = StudentWork.find_by_sql(sql_select)
|
||||
end
|
||||
|
||||
protected
|
||||
|
||||
def validate_role
|
||||
errors.add_on_empty :role if member_roles.empty? && roles.empty?
|
||||
end
|
||||
|
||||
|
||||
|
||||
def searchTeacherAndAssistant project
|
||||
#searchPeopleByRoles(project, TeacherRoles)
|
||||
members = []
|
||||
project.members.each do |m|
|
||||
members << m if m && m.user && m.user.allowed_to?(:as_teacher,project)
|
||||
end
|
||||
members
|
||||
end
|
||||
end
|
||||
|
|
|
@ -79,7 +79,7 @@ class Message < ActiveRecord::Base
|
|||
|
||||
after_create :add_author_as_watcher, :reset_counters!, :add_boards_count
|
||||
after_update :update_messages_board, :update_activity
|
||||
after_destroy :reset_counters!,:down_user_score,:delete_kindeditor_assets, :decrease_boards_count
|
||||
after_destroy :reset_counters!,:down_user_score,:delete_kindeditor_assets, :decrease_boards_count, :down_course_score
|
||||
|
||||
after_create :act_as_activity,:act_as_course_activity,:be_user_score,:act_as_forge_activity, :act_as_system_message, :send_mail, :act_as_student_score, :act_as_at_message
|
||||
#before_save :be_user_score
|
||||
|
@ -354,6 +354,18 @@ class Message < ActiveRecord::Base
|
|||
end
|
||||
end
|
||||
|
||||
# 删除帖子的时候更新课程帖子总数, 删除回复的时候减少总数
|
||||
def down_course_score
|
||||
if self.course
|
||||
if self.parent_id.nil? # 发帖
|
||||
down_course_score_num(self.course.id, self.author_id, "Message")
|
||||
else
|
||||
# 回帖
|
||||
down_course_score_num(self.course.id, self.author_id, "MessageReply")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def delete_org_activities
|
||||
OrgActivity.where("org_act_type='Message' and org_act_id =#{self.id} and container_type='OrgSubfield'").destroy_all
|
||||
end
|
||||
|
|
|
@ -61,7 +61,7 @@ class News < ActiveRecord::Base
|
|||
|
||||
after_create :act_as_activity,:act_as_forge_activity, :act_as_course_activity,:act_as_system_message, :add_author_as_watcher, :send_mail, :add_news_count, :act_as_student_score
|
||||
after_update :update_activity
|
||||
after_destroy :delete_kindeditor_assets, :decrease_news_count, :delete_org_activities
|
||||
after_destroy :delete_kindeditor_assets, :decrease_news_count, :delete_org_activities, :down_course_score
|
||||
|
||||
scope :visible, lambda {|*args|
|
||||
includes(:project).where(Project.allowed_to_condition(args.shift || User.current, :view_news, *args))
|
||||
|
@ -195,10 +195,18 @@ class News < ActiveRecord::Base
|
|||
OrgActivity.where("container_type='OrgSubfield' and org_act_type='News' and org_act_id=?", self.id).destroy_all
|
||||
end
|
||||
|
||||
# 新增新闻统计数增加
|
||||
def act_as_student_score
|
||||
if self.course
|
||||
course_member_score(self.course.id, self.author_id, "News")
|
||||
end
|
||||
end
|
||||
|
||||
# 删除新闻统计数减少
|
||||
def down_course_score
|
||||
if self.course
|
||||
down_course_score_num(self.course.id, self.author_id, "News")
|
||||
end
|
||||
end
|
||||
|
||||
end
|
|
@ -2,8 +2,8 @@ class PraiseTread < ActiveRecord::Base
|
|||
attr_accessible :user_id,:praise_tread_object_id,:praise_tread_object_type,:praise_or_tread
|
||||
belongs_to :user
|
||||
belongs_to :praise_tread_object, polymorphic: true
|
||||
after_create :be_user_score
|
||||
after_destroy :down_user_score
|
||||
#after_create :be_user_score
|
||||
#after_destroy :down_user_score
|
||||
include UserScoreHelper
|
||||
def self.find_object_by_type_and_id(type,id)
|
||||
@obj = nil
|
||||
|
|
|
@ -0,0 +1,64 @@
|
|||
<h3><%=l(:label_course_resource_list)%></h3>
|
||||
|
||||
|
||||
<div class="autoscroll">
|
||||
<table class="list" style="width: 100%;table-layout: fixed">
|
||||
<thead>
|
||||
<tr>
|
||||
|
||||
<th style="width: 60px;">
|
||||
资源名称
|
||||
</th>
|
||||
<th style="width: 30px;">
|
||||
资源大小
|
||||
</th>
|
||||
<th style="width: 25px;">
|
||||
资源类型
|
||||
</th>
|
||||
<th style="width: 23px;">
|
||||
上传时间
|
||||
</th>
|
||||
<th style="width: 15px;">
|
||||
下载次数
|
||||
</th>
|
||||
<th style="width: 20px;">
|
||||
上传者
|
||||
</th>
|
||||
<th style="width: 35px;">
|
||||
所属课程
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% @resource.each do |resource| %>
|
||||
<tr class="<%= cycle("odd", "even") %>">
|
||||
<td style="text-align: left;">
|
||||
<%= link_to truncate(resource.filename, :length => 18), download_named_attachment_path(resource.id, resource.filename ), :title => resource.filename,:class=>'resourcesBlack'%>
|
||||
</td>
|
||||
<td style=" text-align: center;">
|
||||
<%= number_to_human_size(resource.filesize)%>
|
||||
</td>
|
||||
<td style=" text-align: center;">
|
||||
课程资源
|
||||
</td>
|
||||
<td style=" text-align: center;">
|
||||
<%= format_date(resource.created_on)%>
|
||||
</td>
|
||||
<td style=" text-align: center;">
|
||||
<%= resource.downloads %>
|
||||
</td>
|
||||
<td style=" text-align: center;">
|
||||
<%= link_to(User.find(resource.author_id).realname, user_path(User.find(resource.author_id)) ) %>
|
||||
</td>
|
||||
<td style=" text-align: center;">
|
||||
<%=link_to truncate(Course.find(resource.container_id).name, :length => 10), course_path(Course.find(resource.container_id)), :title => Course.find(resource.container_id).name, :class => "hidden fl w170" %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="pagination">
|
||||
<%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false %>
|
||||
</div>
|
|
@ -0,0 +1,75 @@
|
|||
<h3>
|
||||
<%=l(:label_excellent_courses_list)%>
|
||||
</h3>
|
||||
|
||||
<div class="autoscroll">
|
||||
<table class="list" style="width: 100%;table-layout: fixed">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="width: 25px;">
|
||||
序号
|
||||
</th>
|
||||
<th style="width: 120px;">
|
||||
课程名
|
||||
</th>
|
||||
<th style="width: 50px;">
|
||||
主讲老师
|
||||
</th>
|
||||
<th style="width: 30px;">
|
||||
学生数
|
||||
</th>
|
||||
<th style="width: 25px;">
|
||||
作业数
|
||||
</th>
|
||||
<th style="width: 25px;">
|
||||
作品数
|
||||
</th>
|
||||
<th style="width: 25px;">
|
||||
资源数
|
||||
</th>
|
||||
<th style="width: 70px;">
|
||||
帖子数
|
||||
</th>
|
||||
<th style="width: 70px;">
|
||||
动态数
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% @courses.each do |course| %>
|
||||
<tr class="<%= cycle("odd", "even") %>">
|
||||
<td style="text-align: center;">
|
||||
<%= course.id %>
|
||||
</td>
|
||||
<td style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" class="name" title='<%=course.name%>'>
|
||||
<span>
|
||||
<%= link_to(course.name, course_path(course.id)) %>
|
||||
</span>
|
||||
</td>
|
||||
<td align="center">
|
||||
<%= link_to(course.try(:teacher).try(:realname).truncate(6, omission: '...'), user_path(course.teacher)) %>
|
||||
</td>
|
||||
<td align="center">
|
||||
<%= studentCount(course) %>
|
||||
</td>
|
||||
<td class="center">
|
||||
<%= course.homework_commons.count%>
|
||||
</td>
|
||||
<td class="center">
|
||||
<%= student_works_num(course) %>
|
||||
</td>
|
||||
<td class="center">
|
||||
<%= visable_attachemnts_incourse(course).count%>
|
||||
</td>
|
||||
<td class="center">
|
||||
<%= course.boards.first.topics.count + Message.where("board_id =? and parent_id is not ?", course.boards.first.id, nil).count %>
|
||||
|
||||
</td>
|
||||
<td class="center">
|
||||
<%= course.course_activities.count%>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
|
@ -0,0 +1,64 @@
|
|||
<h3><%=l(:label_project_resource_list)%></h3>
|
||||
|
||||
|
||||
<div class="autoscroll">
|
||||
<table class="list" style="width: 100%;table-layout: fixed">
|
||||
<thead>
|
||||
<tr>
|
||||
|
||||
<th style="width: 60px;">
|
||||
资源名称
|
||||
</th>
|
||||
<th style="width: 30px;">
|
||||
资源大小
|
||||
</th>
|
||||
<th style="width: 25px;">
|
||||
资源类型
|
||||
</th>
|
||||
<th style="width: 23px;">
|
||||
上传时间
|
||||
</th>
|
||||
<th style="width: 15px;">
|
||||
下载次数
|
||||
</th>
|
||||
<th style="width: 20px;">
|
||||
上传者
|
||||
</th>
|
||||
<th style="width: 35px;">
|
||||
所属项目
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% @pro_resource.each do |pro_resource| %>
|
||||
<tr class="<%= cycle("odd", "even") %>">
|
||||
<td style="text-align: left;">
|
||||
<%= link_to truncate(pro_resource.filename, :length => 18), download_named_attachment_path(pro_resource.id, pro_resource.filename ), :title => pro_resource.filename,:class=>'resourcesBlack'%>
|
||||
</td>
|
||||
<td style=" text-align: center;">
|
||||
<%= number_to_human_size(pro_resource.filesize)%>
|
||||
</td>
|
||||
<td style=" text-align: center;">
|
||||
项目资源
|
||||
</td>
|
||||
<td style=" text-align: center;">
|
||||
<%= format_date(pro_resource.created_on)%>
|
||||
</td>
|
||||
<td style=" text-align: center;">
|
||||
<%= pro_resource.downloads %>
|
||||
</td>
|
||||
<td style=" text-align: center;">
|
||||
<%= link_to(User.find(pro_resource.author_id).realname, user_path(User.find(pro_resource.author_id)) ) %>
|
||||
</td>
|
||||
<td style=" text-align: center;">
|
||||
<%=link_to truncate(Project.find(pro_resource.container_id).name, :length => 10), project_path(Project.find(pro_resource.container_id)), :title => Project.find(pro_resource.container_id).name, :class => "hidden fl w170" %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="pagination">
|
||||
<%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false %>
|
||||
</div>
|
|
@ -1,21 +1,21 @@
|
|||
<div class="ReplyToMessageContainer borderBottomNone"id="reply_to_message_<%= reply.id%>">
|
||||
<div class="homepagePostReplyPortrait mr15 imageFuzzy" id="reply_image_<%= reply.id%>"><%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(User.current), :alt => "用户头像" %></div>
|
||||
<div class="ReplyToMessageInputContainer mb10">
|
||||
<div nhname='new_message_<%= reply.id%>'>
|
||||
<%= form_for @blog_comment, :as => :reply, :url => {:controller => 'blog_comments',:action => 'reply', :id => @blogComment.id}, :html => {:multipart => true, :id => 'new_form'} do |f| %>
|
||||
<input type="hidden" name="quote[quote]" id="quote_quote">
|
||||
<% if course_id%>
|
||||
<input type="hidden" name="course_id" id="" value="<%= course_id%>">
|
||||
<% end %>
|
||||
<input type="hidden" name="blog_comment[title]" id="reply_subject">
|
||||
<div nhname='toolbar_container_<%= reply.id%>'></div>
|
||||
<textarea placeholder="有问题或有建议,请直接给我留言吧!" style="display: none" nhname='new_message_textarea_<%= reply.id%>' name="blog_comment[content]"></textarea>
|
||||
<a id="new_message_submit_btn_<%= reply.id%>" href="javascript:void(0)" class="blue_n_btn fr" style="display:none;margin-top:2px;">发送</a>
|
||||
<div class="cl"></div>
|
||||
<p nhname='contentmsg_<%= reply.id%>'></p>
|
||||
<% end%>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<div class="ReplyToMessageContainer borderBottomNone"id="reply_to_message_<%= reply.id%>">
|
||||
<div class="homepagePostReplyPortrait mr15 imageFuzzy" id="reply_image_<%= reply.id%>"><%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(User.current), :alt => "用户头像" %></div>
|
||||
<div class="ReplyToMessageInputContainer mb10">
|
||||
<div nhname='new_message_<%= reply.id%>'>
|
||||
<%= form_for @blog_comment, :as => :reply, :url => {:controller => 'blog_comments',:action => 'reply', :id => @blogComment.id}, :html => {:multipart => true, :id => 'new_form'} do |f| %>
|
||||
<input type="hidden" name="quote[quote]" id="quote_quote">
|
||||
<% if course_id%>
|
||||
<input type="hidden" name="course_id" id="" value="<%= course_id%>">
|
||||
<% end %>
|
||||
<input type="hidden" name="blog_comment[title]" id="reply_subject">
|
||||
<div nhname='toolbar_container_<%= reply.id%>'></div>
|
||||
<textarea placeholder="有问题或有建议,请直接给我留言吧!" style="display: none" nhname='new_message_textarea_<%= reply.id%>' name="blog_comment[content]"></textarea>
|
||||
<a id="new_message_submit_btn_<%= reply.id%>" href="javascript:void(0)" onclick="this.style.display='none'" class="blue_n_btn fr" style="display:none;margin-top:2px;">发送</a>
|
||||
<div class="cl"></div>
|
||||
<p nhname='contentmsg_<%= reply.id%>'></p>
|
||||
<% end%>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
|
@ -1,226 +1,226 @@
|
|||
<div class="resources mt10" id="user_activity_<%= user_activity_id%>" >
|
||||
<div class="homepagePostBrief" onmouseover="$('#message_setting_<%=activity.id%>').show();" onmouseout="$('#message_setting_<%= activity.id%>').hide();">
|
||||
<div class="homepagePostPortrait">
|
||||
<%= link_to image_tag(url_to_avatar(activity.author), :width => "50", :height => "50"), user_path(activity.author_id,:host=>Setting.host_user), :alt => "用户头像" %>
|
||||
</div>
|
||||
<div class="homepagePostDes">
|
||||
<% if activity.author.id == User.current.id%>
|
||||
<div class="homepagePostSetting" id="message_setting_<%= activity.id%>" style="display: none">
|
||||
<ul>
|
||||
<li class="homepagePostSettingIcon">
|
||||
<ul class="homepagePostSettiongText">
|
||||
<li>
|
||||
<%= link_to(
|
||||
l(:button_edit),
|
||||
{:controller => 'blog_comments',:action => 'edit',:user_id=>activity.author_id,:blog_id=>activity.blog_id, :id => activity.id},
|
||||
:class => 'postOptionLink'
|
||||
) if User.current && User.current.id == activity.author.id %>
|
||||
</li>
|
||||
<li>
|
||||
<%= link_to(
|
||||
l(:button_delete),
|
||||
{:controller => 'blog_comments',:action => 'destroy',:user_id=>activity.author_id,:blog_id=>activity.blog_id, :id => activity.id},
|
||||
:method => :delete,
|
||||
:data => {:confirm => l(:text_are_you_sure)},
|
||||
:class => 'postOptionLink'
|
||||
) if User.current && User.current.id == activity.author.id %>
|
||||
</li>
|
||||
<li>
|
||||
<% if activity.id == activity.blog.homepage_id %>
|
||||
<%= link_to(
|
||||
l(:button_cancel_homepage),
|
||||
{:controller => 'blogs',:action => 'cancel_homepage',:user_id=>activity.author_id,:id=>activity.blog_id, :article_id => activity.id},
|
||||
:method => :post,
|
||||
:class => 'postOptionLink'
|
||||
) if User.current && User.current.id == activity.blog.author_id %>
|
||||
<% else %>
|
||||
<%= link_to(
|
||||
l(:button_set_homepage),
|
||||
{:controller => 'blogs',:action => 'set_homepage',:user_id=>activity.author_id,:id=>activity.blog_id, :article_id => activity.id},
|
||||
:method => :post,
|
||||
:class => 'postOptionLink'
|
||||
) if User.current && User.current.id == activity.blog.author_id %>
|
||||
<% end %>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<%end%>
|
||||
<div class="homepagePostTo mt-4 fl">
|
||||
<% if activity.try(:author).try(:realname) == ' ' %>
|
||||
<%= link_to activity.try(:author), user_path(activity.author_id,:host=>Setting.host_user), :class => "newsBlue mr15" %>
|
||||
<% else %>
|
||||
<%= link_to activity.try(:author).try(:realname), user_path(activity.author_id,:host=>Setting.host_user), :class => "newsBlue mr15" %>
|
||||
<% end %>
|
||||
TO
|
||||
<%= link_to activity.blog.name+" | 博客", user_blogs_path(:user_id=>activity.author_id,:host=>Setting.host_user), :class => "newsBlue ml15 mr5"%>
|
||||
<% if activity.blog.homepage_id and activity.id == activity.blog.homepage_id %>
|
||||
<span class="red_homework_btn_cir ml5">已设为首页</span>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<div class="homepagePostTitle hidden m_w530 fl">
|
||||
<% if activity.parent_id.nil? %> <!--+"(帖子标题)"-->
|
||||
<%= link_to activity.title.to_s.html_safe, user_blog_blog_comment_path(:user_id=>activity.author_id, :blog_id=>activity.blog.id,:id=>activity), :class=> "postGrey" %>
|
||||
<% else %>
|
||||
<%= link_to activity.title.subject.to_s.html_safe, user_blog_blog_comment_path(:user_id=>activity.author_id, :blog_id=>activity.blog.id,:id=>activity), :class=> "postGrey"%>
|
||||
<% end %>
|
||||
</div>
|
||||
<% if activity.sticky == 1%>
|
||||
<span class="sticky_btn_cir ml10">置顶</span>
|
||||
<% end%>
|
||||
<% if activity.locked%>
|
||||
<span class="locked_btn_cir ml10 fl" title="已锁定"> </span>
|
||||
<% end%>
|
||||
<div class="cl"></div>
|
||||
<div class="homepagePostDate fl">
|
||||
发帖时间:<%= format_time(activity.created_on) %>
|
||||
</div>
|
||||
<div class="homepagePostDate fl ml15">
|
||||
更新时间:<%= format_time(activity.updated_on) %>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<% if activity.parent_id.nil? %>
|
||||
<% content= activity.content%>
|
||||
<% else %>
|
||||
<% content= activity.parent.content%>
|
||||
<% end %>
|
||||
<%=render :partial =>"users/intro_content", :locals=>{:user_activity_id =>user_activity_id, :content=>content} %>
|
||||
|
||||
<div class="cl"></div>
|
||||
<!--<div class=" fl" style="width: 600px">
|
||||
<%# if activity.attachments.any?%>
|
||||
<%# options = {:author => true, :deletable => false } %>
|
||||
<%#= render :partial => 'blog_comments/attachments_links', :locals => {:attachments => activity.attachments, :options => options, :is_float => true} %>
|
||||
<%# end %>
|
||||
</div>
|
||||
<div class="cl"></div>-->
|
||||
<div id="intro_content_show_<%= user_activity_id%>" class="fr" style="display:none;"><a href="javascript:void(0);" class="linkBlue">[展开]</a></div>
|
||||
<div id="intro_content_hide_<%= user_activity_id%>" class="fr" style="display:none;"><a href="javascript:void(0);" class="linkBlue">[收起]</a></div>
|
||||
<div class="cl"></div>
|
||||
<div class="mt10" style="font-weight:normal;">
|
||||
<%= render :partial=>"attachments/activity_attach", :locals=>{:activity => activity} %>
|
||||
</div>
|
||||
<div class="homepagePostSetting" id="act-<%= user_activity_id %>" style="visibility: hidden">
|
||||
<ul>
|
||||
<li class="homepagePostSettingIcon">
|
||||
<ul class="homepagePostSettiongText">
|
||||
<li><a href="javascript:void(0);" class="postOptionLink">编辑</a></li>
|
||||
<li><a href="javascript:void(0);" class="postOptionLink">复制</a></li>
|
||||
<li><a href="javascript:void(0);" class="postOptionLink">删除</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<% count=0 %>
|
||||
<% if activity.parent %>
|
||||
<% count=activity.parent.children.count%>
|
||||
<% else %>
|
||||
<% count=activity.children.count%>
|
||||
<% end %>
|
||||
<div class="homepagePostReply">
|
||||
<div class="homepagePostReplyBanner">
|
||||
<div class="homepagePostReplyBannerCount">回复
|
||||
<sapn class="mr15"><%= count>0 ? "(#{count})" : "" %></sapn><span style="color: #cecece;">▪</span>
|
||||
<span id="praise_count_<%=user_activity_id %>">
|
||||
<% if activity.author == User.current %>
|
||||
<span class="ml15 likeButton" title="不能自己赞自己哦!"> <span class="likeText">赞</span><span class="likeNum"><%= get_praise_num(activity) > 0 ? "(#{get_praise_num(activity)})" : "" %></span></span>
|
||||
<% else %>
|
||||
<%=render :partial=> "praise_tread/praise", :locals => {:activity=>activity, :user_activity_id=>user_activity_id,:type=>"activity"}%>
|
||||
<% end %>
|
||||
</span>
|
||||
</div>
|
||||
<div class="homepagePostReplyBannerTime"><%#=format_date(activity.updated_on)%></div>
|
||||
<%if count > 3 %>
|
||||
<div class="homepagePostReplyBannerMore">
|
||||
<a id="reply_btn_<%=user_activity_id%>" onclick="expand_reply('#reply_div_<%= user_activity_id %> li','#reply_btn_<%=user_activity_id%>')" data-count="<%= count %>" data-init="0" class=" replyGrey" href="javascript:void(0)" value="show_help" >
|
||||
展开更多
|
||||
</a>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<% activity= activity.parent ? activity.parent : activity%>
|
||||
<% replies_all_i = 0 %>
|
||||
<% if count > 0 %>
|
||||
<div class="" id="reply_div_<%= user_activity_id %>">
|
||||
<ul>
|
||||
<% activity.children.reorder("created_on desc").each do |reply|%>
|
||||
<script type="text/javascript">
|
||||
$(function(){
|
||||
showNormalImage('reply_content_<%= reply.id %>');
|
||||
});
|
||||
</script>
|
||||
<% replies_all_i=replies_all_i+1 %>
|
||||
<li class="homepagePostReplyContainer" nhname="reply_rec" style="display:<%= replies_all_i>3 ? 'none' : '' %>">
|
||||
<div class="homepagePostReplyPortrait">
|
||||
<%= link_to image_tag(url_to_avatar(reply.author), :width => "33", :height => "33"), user_path(reply.author_id,:host=>Setting.host_user), :alt => "用户头像" %>
|
||||
</div>
|
||||
<div class="homepagePostReplyDes">
|
||||
<div class="homepagePostReplyPublisher mt-4">
|
||||
<% if reply.try(:author).try(:realname) == ' ' %>
|
||||
<%= link_to reply.try(:author), user_path(reply.author_id,:host=>Setting.host_user), :class => "newsBlue mr10 f14" %>
|
||||
<% else %>
|
||||
<%= link_to reply.try(:author).try(:realname), user_path(reply.author_id,:host=>Setting.host_user), :class => "newsBlue mr10 f14" %>
|
||||
<% end %>
|
||||
<%= format_time(reply.created_on) %>
|
||||
<span id="reply_praise_count_<%=reply.id %>">
|
||||
<% if reply.author == User.current %>
|
||||
<span class="fr likeButton" title="不能自己赞自己哦!"> <span class="likeText">赞</span><span class="likeNum"><%= get_praise_num(reply) > 0 ? "(#{get_praise_num(reply)})" : "" %></span></span>
|
||||
<% else %>
|
||||
<%=render :partial=> "praise_tread/praise", :locals => {:activity=>reply, :user_activity_id=>reply.id,:type=>"reply"}%>
|
||||
<% end %>
|
||||
</span>
|
||||
</div>
|
||||
<div class="homepagePostReplyContent break_word list_style upload_img" id="reply_content_<%= reply.id %>">
|
||||
<%= reply.content.html_safe %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<% if !activity.locked? %>
|
||||
<div class="homepagePostReplyContainer borderBottomNone minHeight48">
|
||||
<div class="homepagePostReplyPortrait mr15 imageFuzzy" id="reply_image_<%= user_activity_id%>"><%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(activity.author_id), :alt => "用户头像" %></div>
|
||||
<div class="homepagePostReplyInputContainer mb10">
|
||||
<div nhname='new_message_<%= user_activity_id%>' style="display:none;">
|
||||
<%= form_for('new_form',:url => {:controller=>'blog_comments',:action => 'reply', :id => activity.id, :blog_id => activity.blog.id, :user_id => activity.author_id},:method => "post",:remote=>true) do |f|%>
|
||||
<input type="hidden" name="quote[quote]" value="">
|
||||
<input type="hidden" name="blog_comment[sticky]" value="0">
|
||||
<input type="hidden" name="blog_comment[locked]" value="0">
|
||||
<input type="hidden" name="blog_comment[title]" value="RE:<%= activity.title%>">
|
||||
<input type="hidden" name="user_activity_id" value="<%=user_activity_id%>">
|
||||
<div nhname='toolbar_container_<%= user_activity_id%>'></div>
|
||||
<textarea placeholder="有问题或有建议,请直接给我留言吧!" style="display: none" nhname='new_message_textarea_<%= user_activity_id%>' name="blog_comment[content]"></textarea>
|
||||
<a id="new_message_submit_btn_<%= user_activity_id%>" href="javascript:void(0)" class="blue_n_btn fr" style="display:none;margin-top:6px;">发送</a>
|
||||
<div class="cl"></div>
|
||||
<p nhname='contentmsg_<%= user_activity_id%>'></p>
|
||||
<% end%>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
$("#moreProject_<%=user_activity_id %>").click(function(){
|
||||
$("#relatePWrap_<%=user_activity_id %>").toggleClass('relatePWrap');
|
||||
$("#relatePWrap_<%=user_activity_id %>").css("height","auto");
|
||||
$(this).hide();
|
||||
});
|
||||
$("#hideProject_<%=user_activity_id %>").click(function(){
|
||||
$("#relatePWrap_<%=user_activity_id %>").toggleClass('relatePWrap');
|
||||
$("#moreProject_<%=user_activity_id %>").show();
|
||||
});
|
||||
</script>
|
||||
<div class="resources mt10" id="user_activity_<%= user_activity_id%>" >
|
||||
<div class="homepagePostBrief" onmouseover="$('#message_setting_<%=activity.id%>').show();" onmouseout="$('#message_setting_<%= activity.id%>').hide();">
|
||||
<div class="homepagePostPortrait">
|
||||
<%= link_to image_tag(url_to_avatar(activity.author), :width => "50", :height => "50"), user_path(activity.author_id,:host=>Setting.host_user), :alt => "用户头像" %>
|
||||
</div>
|
||||
<div class="homepagePostDes">
|
||||
<% if activity.author.id == User.current.id%>
|
||||
<div class="homepagePostSetting" id="message_setting_<%= activity.id%>" style="display: none">
|
||||
<ul>
|
||||
<li class="homepagePostSettingIcon">
|
||||
<ul class="homepagePostSettiongText">
|
||||
<li>
|
||||
<%= link_to(
|
||||
l(:button_edit),
|
||||
{:controller => 'blog_comments',:action => 'edit',:user_id=>activity.author_id,:blog_id=>activity.blog_id, :id => activity.id},
|
||||
:class => 'postOptionLink'
|
||||
) if User.current && User.current.id == activity.author.id %>
|
||||
</li>
|
||||
<li>
|
||||
<%= link_to(
|
||||
l(:button_delete),
|
||||
{:controller => 'blog_comments',:action => 'destroy',:user_id=>activity.author_id,:blog_id=>activity.blog_id, :id => activity.id},
|
||||
:method => :delete,
|
||||
:data => {:confirm => l(:text_are_you_sure)},
|
||||
:class => 'postOptionLink'
|
||||
) if User.current && User.current.id == activity.author.id %>
|
||||
</li>
|
||||
<li>
|
||||
<% if activity.id == activity.blog.homepage_id %>
|
||||
<%= link_to(
|
||||
l(:button_cancel_homepage),
|
||||
{:controller => 'blogs',:action => 'cancel_homepage',:user_id=>activity.author_id,:id=>activity.blog_id, :article_id => activity.id},
|
||||
:method => :post,
|
||||
:class => 'postOptionLink'
|
||||
) if User.current && User.current.id == activity.blog.author_id %>
|
||||
<% else %>
|
||||
<%= link_to(
|
||||
l(:button_set_homepage),
|
||||
{:controller => 'blogs',:action => 'set_homepage',:user_id=>activity.author_id,:id=>activity.blog_id, :article_id => activity.id},
|
||||
:method => :post,
|
||||
:class => 'postOptionLink'
|
||||
) if User.current && User.current.id == activity.blog.author_id %>
|
||||
<% end %>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<%end%>
|
||||
<div class="homepagePostTo mt-4 fl">
|
||||
<% if activity.try(:author).try(:realname) == ' ' %>
|
||||
<%= link_to activity.try(:author), user_path(activity.author_id,:host=>Setting.host_user), :class => "newsBlue mr15" %>
|
||||
<% else %>
|
||||
<%= link_to activity.try(:author).try(:realname), user_path(activity.author_id,:host=>Setting.host_user), :class => "newsBlue mr15" %>
|
||||
<% end %>
|
||||
TO
|
||||
<%= link_to activity.blog.name+" | 博客", user_blogs_path(:user_id=>activity.author_id,:host=>Setting.host_user), :class => "newsBlue ml15 mr5"%>
|
||||
<% if activity.blog.homepage_id and activity.id == activity.blog.homepage_id %>
|
||||
<span class="red_homework_btn_cir ml5">已设为首页</span>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<div class="homepagePostTitle hidden m_w530 fl">
|
||||
<% if activity.parent_id.nil? %> <!--+"(帖子标题)"-->
|
||||
<%= link_to activity.title.to_s.html_safe, user_blog_blog_comment_path(:user_id=>activity.author_id, :blog_id=>activity.blog.id,:id=>activity), :class=> "postGrey" %>
|
||||
<% else %>
|
||||
<%= link_to activity.title.subject.to_s.html_safe, user_blog_blog_comment_path(:user_id=>activity.author_id, :blog_id=>activity.blog.id,:id=>activity), :class=> "postGrey"%>
|
||||
<% end %>
|
||||
</div>
|
||||
<% if activity.sticky == 1%>
|
||||
<span class="sticky_btn_cir ml10">置顶</span>
|
||||
<% end%>
|
||||
<% if activity.locked%>
|
||||
<span class="locked_btn_cir ml10 fl" title="已锁定"> </span>
|
||||
<% end%>
|
||||
<div class="cl"></div>
|
||||
<div class="homepagePostDate fl">
|
||||
发帖时间:<%= format_time(activity.created_on) %>
|
||||
</div>
|
||||
<div class="homepagePostDate fl ml15">
|
||||
更新时间:<%= format_time(activity.updated_on) %>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<% if activity.parent_id.nil? %>
|
||||
<% content= activity.content%>
|
||||
<% else %>
|
||||
<% content= activity.parent.content%>
|
||||
<% end %>
|
||||
<%=render :partial =>"users/intro_content", :locals=>{:user_activity_id =>user_activity_id, :content=>content} %>
|
||||
|
||||
<div class="cl"></div>
|
||||
<!--<div class=" fl" style="width: 600px">
|
||||
<%# if activity.attachments.any?%>
|
||||
<%# options = {:author => true, :deletable => false } %>
|
||||
<%#= render :partial => 'blog_comments/attachments_links', :locals => {:attachments => activity.attachments, :options => options, :is_float => true} %>
|
||||
<%# end %>
|
||||
</div>
|
||||
<div class="cl"></div>-->
|
||||
<div id="intro_content_show_<%= user_activity_id%>" class="fr" style="display:none;"><a href="javascript:void(0);" class="linkBlue">[展开]</a></div>
|
||||
<div id="intro_content_hide_<%= user_activity_id%>" class="fr" style="display:none;"><a href="javascript:void(0);" class="linkBlue">[收起]</a></div>
|
||||
<div class="cl"></div>
|
||||
<div class="mt10" style="font-weight:normal;">
|
||||
<%= render :partial=>"attachments/activity_attach", :locals=>{:activity => activity} %>
|
||||
</div>
|
||||
<div class="homepagePostSetting" id="act-<%= user_activity_id %>" style="visibility: hidden">
|
||||
<ul>
|
||||
<li class="homepagePostSettingIcon">
|
||||
<ul class="homepagePostSettiongText">
|
||||
<li><a href="javascript:void(0);" class="postOptionLink">编辑</a></li>
|
||||
<li><a href="javascript:void(0);" class="postOptionLink">复制</a></li>
|
||||
<li><a href="javascript:void(0);" class="postOptionLink">删除</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<% count=0 %>
|
||||
<% if activity.parent %>
|
||||
<% count=activity.parent.children.count%>
|
||||
<% else %>
|
||||
<% count=activity.children.count%>
|
||||
<% end %>
|
||||
<div class="homepagePostReply">
|
||||
<div class="homepagePostReplyBanner">
|
||||
<div class="homepagePostReplyBannerCount">回复
|
||||
<sapn class="mr15"><%= count>0 ? "(#{count})" : "" %></sapn><span style="color: #cecece;">▪</span>
|
||||
<span id="praise_count_<%=user_activity_id %>">
|
||||
<% if activity.author == User.current %>
|
||||
<span class="ml15 likeButton" title="不能自己赞自己哦!"> <span class="likeText">赞</span><span class="likeNum"><%= get_praise_num(activity) > 0 ? "(#{get_praise_num(activity)})" : "" %></span></span>
|
||||
<% else %>
|
||||
<%=render :partial=> "praise_tread/praise", :locals => {:activity=>activity, :user_activity_id=>user_activity_id,:type=>"activity"}%>
|
||||
<% end %>
|
||||
</span>
|
||||
</div>
|
||||
<div class="homepagePostReplyBannerTime"><%#=format_date(activity.updated_on)%></div>
|
||||
<%if count > 3 %>
|
||||
<div class="homepagePostReplyBannerMore">
|
||||
<a id="reply_btn_<%=user_activity_id%>" onclick="expand_reply('#reply_div_<%= user_activity_id %> li','#reply_btn_<%=user_activity_id%>')" data-count="<%= count %>" data-init="0" class=" replyGrey" href="javascript:void(0)" value="show_help" >
|
||||
展开更多
|
||||
</a>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<% activity= activity.parent ? activity.parent : activity%>
|
||||
<% replies_all_i = 0 %>
|
||||
<% if count > 0 %>
|
||||
<div class="" id="reply_div_<%= user_activity_id %>">
|
||||
<ul>
|
||||
<% activity.children.reorder("created_on desc").each do |reply|%>
|
||||
<script type="text/javascript">
|
||||
$(function(){
|
||||
showNormalImage('reply_content_<%= reply.id %>');
|
||||
});
|
||||
</script>
|
||||
<% replies_all_i=replies_all_i+1 %>
|
||||
<li class="homepagePostReplyContainer" nhname="reply_rec" style="display:<%= replies_all_i>3 ? 'none' : '' %>">
|
||||
<div class="homepagePostReplyPortrait">
|
||||
<%= link_to image_tag(url_to_avatar(reply.author), :width => "33", :height => "33"), user_path(reply.author_id,:host=>Setting.host_user), :alt => "用户头像" %>
|
||||
</div>
|
||||
<div class="homepagePostReplyDes">
|
||||
<div class="homepagePostReplyPublisher mt-4">
|
||||
<% if reply.try(:author).try(:realname) == ' ' %>
|
||||
<%= link_to reply.try(:author), user_path(reply.author_id,:host=>Setting.host_user), :class => "newsBlue mr10 f14" %>
|
||||
<% else %>
|
||||
<%= link_to reply.try(:author).try(:realname), user_path(reply.author_id,:host=>Setting.host_user), :class => "newsBlue mr10 f14" %>
|
||||
<% end %>
|
||||
<%= format_time(reply.created_on) %>
|
||||
<span id="reply_praise_count_<%=reply.id %>">
|
||||
<% if reply.author == User.current %>
|
||||
<span class="fr likeButton" title="不能自己赞自己哦!"> <span class="likeText">赞</span><span class="likeNum"><%= get_praise_num(reply) > 0 ? "(#{get_praise_num(reply)})" : "" %></span></span>
|
||||
<% else %>
|
||||
<%=render :partial=> "praise_tread/praise", :locals => {:activity=>reply, :user_activity_id=>reply.id,:type=>"reply"}%>
|
||||
<% end %>
|
||||
</span>
|
||||
</div>
|
||||
<div class="homepagePostReplyContent break_word list_style upload_img" id="reply_content_<%= reply.id %>">
|
||||
<%= reply.content.html_safe %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<% if !activity.locked? %>
|
||||
<div class="homepagePostReplyContainer borderBottomNone minHeight48">
|
||||
<div class="homepagePostReplyPortrait mr15 imageFuzzy" id="reply_image_<%= user_activity_id%>"><%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(activity.author_id), :alt => "用户头像" %></div>
|
||||
<div class="homepagePostReplyInputContainer mb10">
|
||||
<div nhname='new_message_<%= user_activity_id%>' style="display:none;">
|
||||
<%= form_for('new_form',:url => {:controller=>'blog_comments',:action => 'reply', :id => activity.id, :blog_id => activity.blog.id, :user_id => activity.author_id},:method => "post",:remote=>true) do |f|%>
|
||||
<input type="hidden" name="quote[quote]" value="">
|
||||
<input type="hidden" name="blog_comment[sticky]" value="0">
|
||||
<input type="hidden" name="blog_comment[locked]" value="0">
|
||||
<input type="hidden" name="blog_comment[title]" value="RE:<%= activity.title%>">
|
||||
<input type="hidden" name="user_activity_id" value="<%=user_activity_id%>">
|
||||
<div nhname='toolbar_container_<%= user_activity_id%>'></div>
|
||||
<textarea placeholder="有问题或有建议,请直接给我留言吧!" style="display: none" nhname='new_message_textarea_<%= user_activity_id%>' name="blog_comment[content]"></textarea>
|
||||
<a id="new_message_submit_btn_<%= user_activity_id%>" href="javascript:void(0)" onclick="this.style.display='none'" class="blue_n_btn fr" style="display:none;margin-top:6px;">发送</a>
|
||||
<div class="cl"></div>
|
||||
<p nhname='contentmsg_<%= user_activity_id%>'></p>
|
||||
<% end%>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
$("#moreProject_<%=user_activity_id %>").click(function(){
|
||||
$("#relatePWrap_<%=user_activity_id %>").toggleClass('relatePWrap');
|
||||
$("#relatePWrap_<%=user_activity_id %>").css("height","auto");
|
||||
$(this).hide();
|
||||
});
|
||||
$("#hideProject_<%=user_activity_id %>").click(function(){
|
||||
$("#relatePWrap_<%=user_activity_id %>").toggleClass('relatePWrap');
|
||||
$("#moreProject_<%=user_activity_id %>").show();
|
||||
});
|
||||
</script>
|
||||
|
|
|
@ -1,81 +1,139 @@
|
|||
<!-- 加入分班 -->
|
||||
<div style="margin-left: 15px">
|
||||
<% if User.current.logged? && User.current.member_of_course?(@course) && @group %>
|
||||
<%= join_in_course_group(@course.course_groups,@group, User.current) unless @canShowCode %>
|
||||
<span style="font-size: 12px; float: left; margin-right: 5px">
|
||||
<%= l(:label_current_group)%>:
|
||||
<%= @group.name %>
|
||||
</span>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
|
||||
<% if members.any? %>
|
||||
<% if @result_count %>
|
||||
<p style="font-size: 18px;">
|
||||
<%= l(:label_search_member_count) %>
|
||||
<%= @result_count %>
|
||||
<%= l(:label_member_people) %>
|
||||
</p>
|
||||
<div class="cl"></div>
|
||||
<% end %>
|
||||
|
||||
<div class="st_box">
|
||||
<ul class="st_box_top">
|
||||
<li class="ml50" style="padding-right: 5px;"><a href="">姓名</a></li>
|
||||
<li class="ml10" style="padding-right: 15px;"><a href="">学号</a></li>
|
||||
<li class="ml358">
|
||||
<%= link_to '作业积分', member_score_sort_course_path(:sort_by => (@score_sort_by == "desc" ? "asc" : "desc"), :group_id => (@group ? @group.id : 0),:search_name => (@search_name ? @search_name : nil)) ,:result => members,method: 'get', remote: true%>
|
||||
<% if @score_sort_by == 'desc' %>
|
||||
<a id="pic" href="javascript:" class= "st_down"></a>
|
||||
<% else %>
|
||||
<a id="pic" href="javascript:" class= "st_up"></a>
|
||||
<% end %>
|
||||
</li>
|
||||
<li class="ml50"><a href="javascript:void(0)" >加入时间</a></li>
|
||||
</ul>
|
||||
<div class="cl"></div><!--st_box_top end-->
|
||||
|
||||
<% members.each do |member| %>
|
||||
<div class="st_boxlist">
|
||||
<a href="javascript:" class="st_img">
|
||||
<%= member.user.nil? ? '' : (image_tag(url_to_avatar(member.user), :width => 32, :height => 32)) %>
|
||||
</a>
|
||||
<ul>
|
||||
<% if @canShowCode %>
|
||||
<li>
|
||||
<% if member.user.show_name == ''%>
|
||||
<%= link_to("#{l(:label_bidding_user_studentname)}:<span >#{member.user.name}</span>".html_safe,user_path(member.user)) %>
|
||||
<% else%>
|
||||
<%= link_to("#{l(:label_bidding_user_studentname)}:<span >#{member.user.show_name}</span>".html_safe,user_path(member.user)) %>
|
||||
<%end%>
|
||||
</li>
|
||||
<% else %>
|
||||
<li><%= link_to("#{l(:label_bidding_user_studentname)}:<span >#{member.user.name}</span>".html_safe, user_path(member.user)) %></li>
|
||||
<% end %>
|
||||
<br/>
|
||||
<% unless member.user.user_extensions.student_id == ''%>
|
||||
<li><%= link_to("#{l(:label_bidding_user_studentcode)}:<span >#{member.user.user_extensions.student_id}</span>".html_safe,user_path(member.user)) %></li>
|
||||
<% end%>
|
||||
</ul>
|
||||
<%= link_to format("%0.2f",member.score.nil? ? 0 : member.score.to_s), {
|
||||
:action => 'show_member_score',
|
||||
:member_id => member.id,
|
||||
:remote => true},
|
||||
:class => 'ml258 c_red' %>
|
||||
<span class="fr mr15 c_grey"><%= format_date(member.created_on)%></span>
|
||||
<%= call_hook(:view_projects_settings_members_table_row, { :course => @course, :member => member}) %>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<% end; reset_cycle %>
|
||||
</div>
|
||||
|
||||
<!--<ul class="wlist">
|
||||
<% #= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => @is_remote, :flag => true%>
|
||||
</ul>-->
|
||||
<% else%>
|
||||
<p class="nodata">
|
||||
<%= l(:label_no_data) %>
|
||||
</p>
|
||||
<% end%>
|
||||
|
||||
<!-- 加入分班 -->
|
||||
<div style="margin-left: 15px">
|
||||
<% if User.current.logged? && User.current.member_of_course?(@course) && @group %>
|
||||
<%= join_in_course_group(@course.course_groups,@group, User.current) unless @canShowCode %>
|
||||
<span style="font-size: 12px; float: left; margin-right: 5px">
|
||||
<%= l(:label_current_group)%>:
|
||||
<%= @group.name %>
|
||||
</span>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
|
||||
<% if members.any? %>
|
||||
<% if @result_count %>
|
||||
<p style="font-size: 18px;">
|
||||
<%= l(:label_search_member_count) %>
|
||||
<%= @result_count %>
|
||||
<%= l(:label_member_people) %>
|
||||
</p>
|
||||
<div class="cl"></div>
|
||||
<% end %>
|
||||
|
||||
<div class="st_box">
|
||||
<ul class="st_box_top">
|
||||
<li class="ml50" style="padding-right: 5px;"><a href="">姓名</a></li>
|
||||
<li class="ml10" style="padding-right: 15px;"><a href="">学号</a></li>
|
||||
<li style="padding-right: 55px; margin-left: 260px;"><a href="">分班</a></li>
|
||||
<li style="margin-left: 25px;">
|
||||
<%= link_to '作业积分', member_score_sort_course_path(:sort_by => (@score_sort_by == "desc" ? "asc" : "desc"), :group_id => (@group ? @group.id : 0),:search_name => (@search_name ? @search_name : nil)) ,:result => members,method: 'get', remote: true%>
|
||||
<% if @score_sort_by == 'desc' %>
|
||||
<a id="pic" href="javascript:" class= "st_down"></a>
|
||||
<% else %>
|
||||
<a id="pic" href="javascript:" class= "st_up"></a>
|
||||
<% end %>
|
||||
</li>
|
||||
<li class="ml50"><a href="javascript:void(0)" >加入时间</a></li>
|
||||
</ul>
|
||||
<div class="cl"></div><!--st_box_top end-->
|
||||
|
||||
<% members.each do |member| %>
|
||||
<div class="st_boxlist">
|
||||
<a href="javascript:" class="st_img">
|
||||
<%= member.user.nil? ? '' : (image_tag(url_to_avatar(member.user), :width => 32, :height => 32)) %>
|
||||
</a>
|
||||
<ul>
|
||||
<% if @canShowCode %>
|
||||
<li>
|
||||
<% if member.user.show_name == ''%>
|
||||
<%= link_to("#{l(:label_bidding_user_studentname)}:<span >#{member.user.name}</span>".html_safe,user_path(member.user)) %>
|
||||
<% else%>
|
||||
<%= link_to("#{l(:label_bidding_user_studentname)}:<span >#{member.user.show_name}</span>".html_safe,user_path(member.user)) %>
|
||||
<%end%>
|
||||
</li>
|
||||
<% else %>
|
||||
<li><%= link_to("#{l(:label_bidding_user_studentname)}:<span >#{member.user.name}</span>".html_safe, user_path(member.user)) %></li>
|
||||
<% end %>
|
||||
<br/>
|
||||
<% unless member.user.user_extensions.student_id == ''%>
|
||||
<li><%= link_to("#{l(:label_bidding_user_studentcode)}:<span >#{member.user.user_extensions.student_id}</span>".html_safe,user_path(member.user)) %></li>
|
||||
<% end%>
|
||||
</ul>
|
||||
<% if User.current.allowed_to?(:as_teacher, @course) || User.current.admin? %>
|
||||
<% if @course.course_groups.nil? || @group %>
|
||||
<div class="select-class-option fl" style="margin-left: 105px;">
|
||||
<span style="width: 100px; text-align: center; float: left;" class="hidden"><%=member.course_group_id == 0 ? "暂无" : member.course_group.name %></span>
|
||||
</div>
|
||||
<% else %>
|
||||
<%= form_tag({:controller => 'courses', :action => 'teacher_assign_group', :id => @course.id,:user_id => member.user_id},:remote=>'true', :method => 'post', :id=>"join_group_form_#{member.id}", :class => 'query_form') do %>
|
||||
<div class="select-class-option fl" style="margin-left: 105px;"><span style="width: 100px; text-align: center; float: left;" class="hidden"><%=member.course_group_id == 0 ? "暂无" : member.course_group.name %></span>
|
||||
<a style="display: inline-block;" href="javascript:void(0)" class="pic_edit2 ml5"></a>
|
||||
</div>
|
||||
<%= select( :name,:group_id, course_group_option(@course),
|
||||
{ :include_blank => false,:selected => member.course_group_id},
|
||||
{:onchange=>"join_group_function('#join_group_form_#{member.id}');", :id =>"course_group_id", :name => "course_group_id",:class=>"w125 undis class-edit fl", :style => "margin-left: 105px;"}) %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<div class="select-class-option fl" style="margin-left: 105px;">
|
||||
<span style="width: 100px; text-align: center; float: left;" class="hidden"><%=member.course_group_id == 0 ? "暂无" : member.course_group.name %></span>
|
||||
</div>
|
||||
<% end %>
|
||||
<%= link_to format("%0.2f",member.score.nil? ? 0 : member.score.to_s), {
|
||||
:action => 'show_member_score',
|
||||
:member_id => member.id,
|
||||
:remote => true},
|
||||
:class => 'ml25 c_red' %>
|
||||
<span class="fr mr15 c_grey"><%= format_date(member.created_on)%></span>
|
||||
<%= call_hook(:view_projects_settings_members_table_row, { :course => @course, :member => member}) %>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<% end; reset_cycle %>
|
||||
</div>
|
||||
|
||||
<!--<ul class="wlist">
|
||||
<% #= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => @is_remote, :flag => true%>
|
||||
</ul>-->
|
||||
<% else%>
|
||||
<p class="nodata">
|
||||
<%= l(:label_no_data) %>
|
||||
</p>
|
||||
<% end%>
|
||||
|
||||
<script>
|
||||
$(document).ready(function(){
|
||||
/*$(".select-class-option").mouseover(function(){
|
||||
$(this).children(".pic_edit2").css("display","inline-block");
|
||||
});
|
||||
$(".select-class-option").mouseout(function(){
|
||||
$(this).children(".pic_edit2").css("display","none");
|
||||
});*/
|
||||
$(".pic_edit2").click(function(){
|
||||
$(this).parent().hide();
|
||||
$(this).parent().next().show();
|
||||
});
|
||||
$(".class-edit").blur(function(){
|
||||
$(this).hide();
|
||||
$(this).prev().show();
|
||||
var editValue = $(this).children("option:selected").text();
|
||||
$(this).prev().children(":first").text(editValue);
|
||||
});
|
||||
function stopPropagation(e) {
|
||||
if (e.stopPropagation)
|
||||
e.stopPropagation();
|
||||
else
|
||||
e.cancelBubble = true;
|
||||
};
|
||||
$(document).bind('click',function(){
|
||||
$('.class-edit').css('display','none');
|
||||
$('.select-class-option').show();
|
||||
});
|
||||
$('.class-edit,.pic_edit2').bind('click',function(e){
|
||||
stopPropagation(e);
|
||||
});
|
||||
});
|
||||
function join_group_function(id){
|
||||
$(id).submit();
|
||||
}
|
||||
</script>
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
<li class="mt15"> <%= image_tag(url_to_avatar(e_course), :width => "40", :height => "40", :class => "fl mr10 rankPortrait", :alt => "logo") %>
|
||||
<div class="fl">
|
||||
<p class="f12 mb5"><%=link_to e_course.name, course_path(e_course.id), :class => "hidden fl w170" %></p>
|
||||
<p class="f12 mb5"><%=link_to e_course.name, course_path(e_course.id), :class => "hidden fl w170" %><div class="cl"></div> </p>
|
||||
<p class="f12">
|
||||
<% if e_course.attachments.count > 0 %>
|
||||
<span class="fl mr15 fontGrey4"><%= l(:project_module_attachments) %>(<%= link_to e_course.attachments.count, course_files_path(e_course), :class => "linkBlue2" %>)</span>
|
||||
|
@ -14,6 +14,7 @@
|
|||
<% if e_course.homework_commons.count > 0 %>
|
||||
<span class="fl fontGrey4"><%= l(:label_homework_commont) %>(<%= link_to e_course.homework_commons.count, homework_common_index_path(:course=>e_course.id), :class => "linkBlue2" %>)</span>
|
||||
<% end %>
|
||||
<div class="cl"></div>
|
||||
</p>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
|
|
|
@ -1,218 +1,218 @@
|
|||
|
||||
<%= content_for(:header_tags) do %>
|
||||
<%= import_ke(enable_at: true, prettify: false, init_activity: true) %>
|
||||
<%= javascript_include_tag 'blog' %>
|
||||
<% end %>
|
||||
|
||||
<script type="text/javascript">
|
||||
$(function(){
|
||||
$("#RSide").removeAttr("id");
|
||||
$("#Container").css("width","1000px");
|
||||
});
|
||||
</script>
|
||||
<script>
|
||||
function expand_reply(container,btnid){
|
||||
var target = $(container).children();
|
||||
var btn = $(btnid);
|
||||
if(btn.data('init')=='0'){
|
||||
btn.data('init',1);
|
||||
btn.html('收起回复');
|
||||
target.show();
|
||||
}else{
|
||||
btn.data('init',0);
|
||||
btn.html('展开更多');
|
||||
target.hide();
|
||||
target.eq(0).show();
|
||||
target.eq(1).show();
|
||||
target.eq(2).show();
|
||||
}
|
||||
}
|
||||
$(function() {
|
||||
//init_activity_KindEditor_data(<%= @article.id%>,null,"87%", "<%=@article.class.to_s%>");
|
||||
sd_create_editor_from_data(<%= @article.id%>,null,"100%", "<%=@article.class.to_s%>");
|
||||
showNormalImage('message_description_<%= @article.id %>');
|
||||
});
|
||||
</script>
|
||||
<div class="postRightContainer ml10" >
|
||||
<div class="postThemeContainer">
|
||||
<div class="postDetailPortrait">
|
||||
<%= link_to image_tag(url_to_avatar(@article.author),:width=>50,:height => 50,:alt=>'图像' ),user_path(@article.author) %>
|
||||
</div>
|
||||
<div class="postThemeWrap">
|
||||
<% if User.current && @article.author.id == User.current.id%>
|
||||
<div class="homepagePostSetting" id="message_setting_<%= @article.id%>" >
|
||||
<ul>
|
||||
<li class="homepagePostSettingIcon">
|
||||
<ul class="homepagePostSettiongText">
|
||||
<li>
|
||||
<a class="postOptionLink " onclick="course_outline('<%= @course.id%>','Y')" >重设大纲</a>
|
||||
</li>
|
||||
<li>
|
||||
<%= link_to(
|
||||
'取消大纲',
|
||||
{:controller => 'blog_comments',:action => 'destroy',:user_id=>BlogComment.find(@course.outline).author_id,:blog_id=>BlogComment.find(@course.outline).blog_id, :id => @course.outline,:course_id=>@course.id},
|
||||
:method => :delete,
|
||||
:data => {:confirm => '您确定要取消么?'},
|
||||
:class => 'postOptionLink'
|
||||
) if User.current && User.current.id == @article.author.id %>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<!--<div class="homepagePostSetting" id="message_setting_<%#= @article.id%>" >-->
|
||||
<!--<ul>-->
|
||||
<!--<li class="syllabusSettingIcon" >-->
|
||||
<!--</li>-->
|
||||
<!--</ul>-->
|
||||
<!--</div>-->
|
||||
<!--<a class="syllabusSettingIcon fr" style="width: 100px" onclick="course_outline('<%= @course.id%>')" ><span class="f14 fontGrey2" style="padding-left: 20px">[设置大纲]</span>-->
|
||||
<!--</a>-->
|
||||
<%end%>
|
||||
<div class="postDetailTitle fl" style="width: 550px !important;">
|
||||
<a href="javascript:void(0);" class="f14 linkGrey4 fb" style="overflow:hidden;">主题: <%= @article.title%></a>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
|
||||
<div class="postDetailCreater">
|
||||
<% if @article.try(:author).try(:realname) == ' ' %>
|
||||
<%= link_to @article.try(:author), user_path(@article.author,:host=>Setting.host_user), :class => "linkBlue2", :target=> "_blank" %>
|
||||
<% else %>
|
||||
<%= link_to @article.try(:author).try(:realname), user_path(@article.author,:host=>Setting.host_user), :class => "linkBlue2", :target=> "_blank" %>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="postDetailDate mb5"><%= format_time( @article.created_on)%></div>
|
||||
<div class="cl"></div>
|
||||
<div class="homepagePostIntro memo-content upload_img break_word" id="message_description_<%= @article.id %>" style="word-break: break-all; word-wrap:break-word;margin-bottom: 0px !important;" >
|
||||
<%= @article.content.html_safe%>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<div class=" fl" style="width: 600px">
|
||||
<%#= link_to_attachments_course @topic, :author => false %>
|
||||
<% if @article.attachments.any?%>
|
||||
<% options = {:author => true, :deletable => false} %>
|
||||
<%= render :partial => 'blog_comments/attachments_links', :locals => {:attachments => @article.attachments, :options => options, :is_float => true} %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<% count=0 %>
|
||||
<% if @article.parent %>
|
||||
<% count=@article.parent.children.count%>
|
||||
<% else %>
|
||||
<% count=@article.children.count%>
|
||||
<% end %>
|
||||
<div class="homepagePostReply">
|
||||
<% unless count == 0 %>
|
||||
<div class="homepagePostReplyBanner">
|
||||
<div class="homepagePostReplyBannerCount">回复(<%=count %>)</div>
|
||||
<div class="homepagePostReplyBannerTime"></div>
|
||||
<!-- <div class="homepagePostReplyBannerMore">
|
||||
<%# if @reply_count > 2%>
|
||||
<a href="javascript:void(0);" class="replyGrey" id="reply_btn_<%#= @topic.id%>" onclick="expand_reply('#reply_div_<%#= @topic.id %>','#reply_btn_<%#= @topic.id%>')" data-count="<%#= @reply_count %>" data-init="0" >点击展开更多回复</a>
|
||||
<%# end %>
|
||||
</div>-->
|
||||
</div>
|
||||
<div class="" id="reply_div_<%= @article.id %>">
|
||||
<%@article.children.reorder('created_on desc').each_with_index do |reply,i| %>
|
||||
<script type="text/javascript">
|
||||
$(function(){
|
||||
showNormalImage('reply_message_description_<%= reply.id %>');
|
||||
});
|
||||
</script>
|
||||
<div class="homepagePostReplyContainer" onmouseover="$('#reply_edit_menu_<%= reply.id%>').show();" onmouseout="$('#reply_edit_menu_<%= reply.id%>').hide();">
|
||||
<div class="homepagePostReplyPortrait">
|
||||
<%= link_to image_tag(url_to_avatar(reply.author), :width => 33,:height => 33), user_path(reply.author) %>
|
||||
</div>
|
||||
<div class="homepagePostReplyDes">
|
||||
<div class="homepagePostReplyPublisher">
|
||||
<% if reply.try(:author).try(:realname) == ' ' %>
|
||||
<%= link_to reply.try(:author), user_path(reply.author_id,:host=>Setting.host_user), :class => "newsBlue mr10 f14" %>
|
||||
<% else %>
|
||||
<%= link_to reply.try(:author).try(:realname), user_path(reply.author_id,:host=>Setting.host_user), :class => "newsBlue mr10 f14" %>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="homepagePostReplyContent upload_img break_word" id="reply_message_description_<%= reply.id %>">
|
||||
<%= reply.content.html_safe%>
|
||||
</div>
|
||||
<div style="margin-top: -7px; margin-bottom: 5px">
|
||||
<%= format_time(reply.created_on) %>
|
||||
<div class="fr" id="reply_edit_menu_<%= reply.id%>" style="display: none">
|
||||
<%= link_to(
|
||||
l(:button_reply),
|
||||
{:controller => 'blog_comments',:action => 'quote',:user_id=>reply.author_id,:blog_id=>reply.blog_id, :id => reply.id,:course_id=>@course.id},
|
||||
:remote => true,
|
||||
:method => 'get',
|
||||
:class => 'fr newsBlue',
|
||||
:title => l(:button_reply)) if !@article.locked? && User.current.logged? %>
|
||||
<%= link_to(
|
||||
l(:button_delete),
|
||||
{:controller => 'blog_comments',:action => 'destroy',:user_id=>reply.author_id,:blog_id=>reply.blog_id, :id => reply.id,:course_id=>@course.id},
|
||||
:method => :delete,
|
||||
:class => 'fr newsGrey mr10',
|
||||
:data => {:confirm => l(:text_are_you_sure)},
|
||||
:title => l(:button_delete)
|
||||
) if reply.author.id == User.current.id %>
|
||||
</div>
|
||||
</div>
|
||||
<p id="reply_message_<%= reply.id%>"></p>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<% end %>
|
||||
<div class="cl"></div>
|
||||
<% if !@article.locked? && User.current.logged?%>
|
||||
<!--<div class="talkWrapMsg" nhname="about_talk_reply">-->
|
||||
<!--<em class="talkWrapArrow"></em>-->
|
||||
<!--<div class="cl"></div>-->
|
||||
<!--<div class="talkConIpt ml5 mb10" id="reply<%#= @article.id %>">-->
|
||||
<!--<%#= form_for :blog_comment, :url => {:action => 'reply',:controller => 'blog_comments',:user_id=>@article.author.id,:blog_id=>@article.blog_id, :id => @article.id}, :html => {:multipart => true, :id => 'message_form'} do |f| %>-->
|
||||
<!--<input type="hidden" name="course_id" value="<%#= @course.id%>">-->
|
||||
<!--<%#= render :partial => 'blog_comments/reply_form', :locals => {:f => f,:user=>@user,:article=>@article} %>-->
|
||||
<!--<%#= link_to l(:button_cancel), "javascript:void(0)", :onclick => 'canel_message_replay();', :class => " grey_btn fr c_white mt10 mr5" %>-->
|
||||
<!--<%#= link_to l(:button_submit), "javascript:void(0)", :onclick => 'submit_message_replay();', :class => "blue_btn fr c_white mt10", :style => "margin-right: 5px;" %>-->
|
||||
<!--<%# end %>-->
|
||||
<!--<div class="cl"></div>-->
|
||||
<!--</div>-->
|
||||
<!--</div>-->
|
||||
<div class="homepagePostReplyContainer borderBottomNone minHeight48">
|
||||
<div class="homepagePostReplyPortrait mr15 imageFuzzy" id="reply_image_<%= @article.id%>"><%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(@article.author_id), :alt => "用户头像" %></div>
|
||||
<div class="homepagePostReplyInputContainer" style="margin-top: 8px">
|
||||
<div nhname='new_message_<%= @article.id%>' style="display:none;">
|
||||
<%= form_for 'blog_comment',:url => {:action => 'reply',:controller => 'blog_comments',:user_id=>@article.author.id,:blog_id=>@article.blog_id, :id => @article.id},:method => "post",:html => {:multipart => true, :id => 'message_form'} do |f|%>
|
||||
<input type="hidden" name="course_id" value="<%= @course.id%>">
|
||||
<input type="hidden" name="blog_comment[title]" value="RE:<%= @article.title%>">
|
||||
<input type="hidden" name="blog_comment[sticky]" value="0">
|
||||
<input type="hidden" name="quote[quote]" value="">
|
||||
<input type="hidden" name="blog_comment[locked]" value="0">
|
||||
<div nhname='toolbar_container_<%= @article.id%>'></div>
|
||||
<textarea placeholder="有问题或有建议,请直接给我留言吧!" style="display: none" nhname='new_message_textarea_<%= @article.id%>' name="blog_comment[content]"></textarea>
|
||||
<a id="new_message_submit_btn_<%= @article.id%>" href="javascript:void(0)" class="blue_n_btn fr" style="display:none;margin-top:2px;">发送</a>
|
||||
<div class="cl"></div>
|
||||
<p nhname='contentmsg_<%= @article.id%>'></p>
|
||||
<% end%>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
$(function(){
|
||||
$("#message_description_<%= @article.id %> p,#message_description_<%= @article.id %> span,#message_description_<%= @article.id %> em").each(function(){
|
||||
var postContent = $(this).html();
|
||||
postContent = postContent.replace(/ /g," ");
|
||||
postContent= postContent.replace(/ {2}/g," ");
|
||||
postContent=postContent.replace(/ /g," ");
|
||||
postContent=postContent.replace(/ /g," ");
|
||||
$(this).html(postContent);
|
||||
});
|
||||
});
|
||||
|
||||
<%= content_for(:header_tags) do %>
|
||||
<%= import_ke(enable_at: true, prettify: false, init_activity: true) %>
|
||||
<%= javascript_include_tag 'blog' %>
|
||||
<% end %>
|
||||
|
||||
<script type="text/javascript">
|
||||
$(function(){
|
||||
$("#RSide").removeAttr("id");
|
||||
$("#Container").css("width","1000px");
|
||||
});
|
||||
</script>
|
||||
<script>
|
||||
function expand_reply(container,btnid){
|
||||
var target = $(container).children();
|
||||
var btn = $(btnid);
|
||||
if(btn.data('init')=='0'){
|
||||
btn.data('init',1);
|
||||
btn.html('收起回复');
|
||||
target.show();
|
||||
}else{
|
||||
btn.data('init',0);
|
||||
btn.html('展开更多');
|
||||
target.hide();
|
||||
target.eq(0).show();
|
||||
target.eq(1).show();
|
||||
target.eq(2).show();
|
||||
}
|
||||
}
|
||||
$(function() {
|
||||
//init_activity_KindEditor_data(<%= @article.id%>,null,"87%", "<%=@article.class.to_s%>");
|
||||
sd_create_editor_from_data(<%= @article.id%>,null,"100%", "<%=@article.class.to_s%>");
|
||||
showNormalImage('message_description_<%= @article.id %>');
|
||||
});
|
||||
</script>
|
||||
<div class="postRightContainer ml10" >
|
||||
<div class="postThemeContainer">
|
||||
<div class="postDetailPortrait">
|
||||
<%= link_to image_tag(url_to_avatar(@article.author),:width=>50,:height => 50,:alt=>'图像' ),user_path(@article.author) %>
|
||||
</div>
|
||||
<div class="postThemeWrap">
|
||||
<% if User.current && @article.author.id == User.current.id%>
|
||||
<div class="homepagePostSetting" id="message_setting_<%= @article.id%>" >
|
||||
<ul>
|
||||
<li class="homepagePostSettingIcon">
|
||||
<ul class="homepagePostSettiongText">
|
||||
<li>
|
||||
<a class="postOptionLink " onclick="course_outline('<%= @course.id%>','Y')" >重设大纲</a>
|
||||
</li>
|
||||
<li>
|
||||
<%= link_to(
|
||||
'取消大纲',
|
||||
{:controller => 'blog_comments',:action => 'destroy',:user_id=>BlogComment.find(@course.outline).author_id,:blog_id=>BlogComment.find(@course.outline).blog_id, :id => @course.outline,:course_id=>@course.id},
|
||||
:method => :delete,
|
||||
:data => {:confirm => '您确定要取消么?'},
|
||||
:class => 'postOptionLink'
|
||||
) if User.current && User.current.id == @article.author.id %>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<!--<div class="homepagePostSetting" id="message_setting_<%#= @article.id%>" >-->
|
||||
<!--<ul>-->
|
||||
<!--<li class="syllabusSettingIcon" >-->
|
||||
<!--</li>-->
|
||||
<!--</ul>-->
|
||||
<!--</div>-->
|
||||
<!--<a class="syllabusSettingIcon fr" style="width: 100px" onclick="course_outline('<%= @course.id%>')" ><span class="f14 fontGrey2" style="padding-left: 20px">[设置大纲]</span>-->
|
||||
<!--</a>-->
|
||||
<%end%>
|
||||
<div class="postDetailTitle fl" style="width: 550px !important;">
|
||||
<a href="javascript:void(0);" class="f14 linkGrey4 fb" style="overflow:hidden;">主题: <%= @article.title%></a>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
|
||||
<div class="postDetailCreater">
|
||||
<% if @article.try(:author).try(:realname) == ' ' %>
|
||||
<%= link_to @article.try(:author), user_path(@article.author,:host=>Setting.host_user), :class => "linkBlue2", :target=> "_blank" %>
|
||||
<% else %>
|
||||
<%= link_to @article.try(:author).try(:realname), user_path(@article.author,:host=>Setting.host_user), :class => "linkBlue2", :target=> "_blank" %>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="postDetailDate mb5"><%= format_time( @article.created_on)%></div>
|
||||
<div class="cl"></div>
|
||||
<div class="homepagePostIntro memo-content upload_img break_word" id="message_description_<%= @article.id %>" style="word-break: break-all; word-wrap:break-word;margin-bottom: 0px !important;" >
|
||||
<%= @article.content.html_safe%>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<div class=" fl" style="width: 600px">
|
||||
<%#= link_to_attachments_course @topic, :author => false %>
|
||||
<% if @article.attachments.any?%>
|
||||
<% options = {:author => true, :deletable => false} %>
|
||||
<%= render :partial => 'blog_comments/attachments_links', :locals => {:attachments => @article.attachments, :options => options, :is_float => true} %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<% count=0 %>
|
||||
<% if @article.parent %>
|
||||
<% count=@article.parent.children.count%>
|
||||
<% else %>
|
||||
<% count=@article.children.count%>
|
||||
<% end %>
|
||||
<div class="homepagePostReply">
|
||||
<% unless count == 0 %>
|
||||
<div class="homepagePostReplyBanner">
|
||||
<div class="homepagePostReplyBannerCount">回复(<%=count %>)</div>
|
||||
<div class="homepagePostReplyBannerTime"></div>
|
||||
<!-- <div class="homepagePostReplyBannerMore">
|
||||
<%# if @reply_count > 2%>
|
||||
<a href="javascript:void(0);" class="replyGrey" id="reply_btn_<%#= @topic.id%>" onclick="expand_reply('#reply_div_<%#= @topic.id %>','#reply_btn_<%#= @topic.id%>')" data-count="<%#= @reply_count %>" data-init="0" >点击展开更多回复</a>
|
||||
<%# end %>
|
||||
</div>-->
|
||||
</div>
|
||||
<div class="" id="reply_div_<%= @article.id %>">
|
||||
<%@article.children.reorder('created_on desc').each_with_index do |reply,i| %>
|
||||
<script type="text/javascript">
|
||||
$(function(){
|
||||
showNormalImage('reply_message_description_<%= reply.id %>');
|
||||
});
|
||||
</script>
|
||||
<div class="homepagePostReplyContainer" onmouseover="$('#reply_edit_menu_<%= reply.id%>').show();" onmouseout="$('#reply_edit_menu_<%= reply.id%>').hide();">
|
||||
<div class="homepagePostReplyPortrait">
|
||||
<%= link_to image_tag(url_to_avatar(reply.author), :width => 33,:height => 33), user_path(reply.author) %>
|
||||
</div>
|
||||
<div class="homepagePostReplyDes">
|
||||
<div class="homepagePostReplyPublisher">
|
||||
<% if reply.try(:author).try(:realname) == ' ' %>
|
||||
<%= link_to reply.try(:author), user_path(reply.author_id,:host=>Setting.host_user), :class => "newsBlue mr10 f14" %>
|
||||
<% else %>
|
||||
<%= link_to reply.try(:author).try(:realname), user_path(reply.author_id,:host=>Setting.host_user), :class => "newsBlue mr10 f14" %>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="homepagePostReplyContent upload_img break_word" id="reply_message_description_<%= reply.id %>">
|
||||
<%= reply.content.html_safe%>
|
||||
</div>
|
||||
<div style="margin-top: -7px; margin-bottom: 5px">
|
||||
<%= format_time(reply.created_on) %>
|
||||
<div class="fr" id="reply_edit_menu_<%= reply.id%>" style="display: none">
|
||||
<%= link_to(
|
||||
l(:button_reply),
|
||||
{:controller => 'blog_comments',:action => 'quote',:user_id=>reply.author_id,:blog_id=>reply.blog_id, :id => reply.id,:course_id=>@course.id},
|
||||
:remote => true,
|
||||
:method => 'get',
|
||||
:class => 'fr newsBlue',
|
||||
:title => l(:button_reply)) if !@article.locked? && User.current.logged? %>
|
||||
<%= link_to(
|
||||
l(:button_delete),
|
||||
{:controller => 'blog_comments',:action => 'destroy',:user_id=>reply.author_id,:blog_id=>reply.blog_id, :id => reply.id,:course_id=>@course.id},
|
||||
:method => :delete,
|
||||
:class => 'fr newsGrey mr10',
|
||||
:data => {:confirm => l(:text_are_you_sure)},
|
||||
:title => l(:button_delete)
|
||||
) if reply.author.id == User.current.id %>
|
||||
</div>
|
||||
</div>
|
||||
<p id="reply_message_<%= reply.id%>"></p>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<% end %>
|
||||
<div class="cl"></div>
|
||||
<% if !@article.locked? && User.current.logged?%>
|
||||
<!--<div class="talkWrapMsg" nhname="about_talk_reply">-->
|
||||
<!--<em class="talkWrapArrow"></em>-->
|
||||
<!--<div class="cl"></div>-->
|
||||
<!--<div class="talkConIpt ml5 mb10" id="reply<%#= @article.id %>">-->
|
||||
<!--<%#= form_for :blog_comment, :url => {:action => 'reply',:controller => 'blog_comments',:user_id=>@article.author.id,:blog_id=>@article.blog_id, :id => @article.id}, :html => {:multipart => true, :id => 'message_form'} do |f| %>-->
|
||||
<!--<input type="hidden" name="course_id" value="<%#= @course.id%>">-->
|
||||
<!--<%#= render :partial => 'blog_comments/reply_form', :locals => {:f => f,:user=>@user,:article=>@article} %>-->
|
||||
<!--<%#= link_to l(:button_cancel), "javascript:void(0)", :onclick => 'canel_message_replay();', :class => " grey_btn fr c_white mt10 mr5" %>-->
|
||||
<!--<%#= link_to l(:button_submit), "javascript:void(0)", :onclick => 'submit_message_replay();', :class => "blue_btn fr c_white mt10", :style => "margin-right: 5px;" %>-->
|
||||
<!--<%# end %>-->
|
||||
<!--<div class="cl"></div>-->
|
||||
<!--</div>-->
|
||||
<!--</div>-->
|
||||
<div class="homepagePostReplyContainer borderBottomNone minHeight48">
|
||||
<div class="homepagePostReplyPortrait mr15 imageFuzzy" id="reply_image_<%= @article.id%>"><%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(@article.author_id), :alt => "用户头像" %></div>
|
||||
<div class="homepagePostReplyInputContainer" style="margin-top: 8px">
|
||||
<div nhname='new_message_<%= @article.id%>' style="display:none;">
|
||||
<%= form_for 'blog_comment',:url => {:action => 'reply',:controller => 'blog_comments',:user_id=>@article.author.id,:blog_id=>@article.blog_id, :id => @article.id},:method => "post",:html => {:multipart => true, :id => 'message_form'} do |f|%>
|
||||
<input type="hidden" name="course_id" value="<%= @course.id%>">
|
||||
<input type="hidden" name="blog_comment[title]" value="RE:<%= @article.title%>">
|
||||
<input type="hidden" name="blog_comment[sticky]" value="0">
|
||||
<input type="hidden" name="quote[quote]" value="">
|
||||
<input type="hidden" name="blog_comment[locked]" value="0">
|
||||
<div nhname='toolbar_container_<%= @article.id%>'></div>
|
||||
<textarea placeholder="有问题或有建议,请直接给我留言吧!" style="display: none" nhname='new_message_textarea_<%= @article.id%>' name="blog_comment[content]"></textarea>
|
||||
<a id="new_message_submit_btn_<%= @article.id%>" href="javascript:void(0)" onclick="this.style.display='none'" class="blue_n_btn fr" style="display:none;margin-top:2px;">发送</a>
|
||||
<div class="cl"></div>
|
||||
<p nhname='contentmsg_<%= @article.id%>'></p>
|
||||
<% end%>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
$(function(){
|
||||
$("#message_description_<%= @article.id %> p,#message_description_<%= @article.id %> span,#message_description_<%= @article.id %> em").each(function(){
|
||||
var postContent = $(this).html();
|
||||
postContent = postContent.replace(/ /g," ");
|
||||
postContent= postContent.replace(/ {2}/g," ");
|
||||
postContent=postContent.replace(/ /g," ");
|
||||
postContent=postContent.replace(/ /g," ");
|
||||
$(this).html(postContent);
|
||||
});
|
||||
});
|
||||
</script>
|
|
@ -0,0 +1 @@
|
|||
$("#st_groups").html("<%=escape_javascript(render :partial => 'new_groups_name', :locals => {:course_groups => @course_groups}) %>");
|
|
@ -25,7 +25,7 @@
|
|||
<div class="mb5">
|
||||
<label class="fl c_dark f14" style="margin-top: 4px;">附件描述:</label>
|
||||
<div class="fl">
|
||||
<input type="text" name="description" placeholder="文件描述" class="fl W120 ">
|
||||
<input type="text" name="description" placeholder="文件描述" class="InputBox fl W160">
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
|
|
|
@ -1,86 +1,86 @@
|
|||
<ul>
|
||||
<% issue.journals.reorder("created_on desc").each do |reply| %>
|
||||
<script type="text/javascript">
|
||||
$(function(){
|
||||
showNormalImage('reply_content_<%= reply.id %>');
|
||||
});
|
||||
</script>
|
||||
<% replies_all_i=replies_all_i + 1 %>
|
||||
<li class="homepagePostReplyContainer" nhname="reply_rec" onmouseover="$('#reply_edit_menu_<%= reply.id%>').show();" onmouseout="$('#reply_edit_menu_<%= reply.id%>').hide();" >
|
||||
<div class="homepagePostReplyPortrait" >
|
||||
<%= link_to image_tag(url_to_avatar(reply.user), :width => "33", :height => "33"), user_path(reply.user_id), :alt => "用户头像" %>
|
||||
</div>
|
||||
<div class="homepagePostReplyDes">
|
||||
<div class="homepagePostReplyPublisher mt-4">
|
||||
<% if reply.try(:user).try(:realname) == ' ' %>
|
||||
<%= link_to reply.try(:user), user_path(reply.user_id), :class => "newsBlue mr10 f14" %>
|
||||
<% else %>
|
||||
<%= link_to reply.try(:user).try(:realname), user_path(reply.user_id), :class => "newsBlue mr10 f14" %>
|
||||
<% end %>
|
||||
<%#= format_time(reply.created_on) %>
|
||||
</div>
|
||||
<div class="homepagePostReplyContent break_word list_style upload_img table_maxWidth" id="reply_content_<%= reply.id %>">
|
||||
<% if reply.details.any? %>
|
||||
<% details_to_strings(reply.details).each do |string| %>
|
||||
<p><%= string %></p>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<P><%= reply.notes.html_safe %></P>
|
||||
</div>
|
||||
<div style="margin-top: 7px">
|
||||
<%= format_time(reply.created_on) %>
|
||||
<div class="fr" id="reply_edit_menu_<%= reply.id%>" style="display: none">
|
||||
<%= link_to(
|
||||
l(:button_reply),
|
||||
{:controller => 'issues', :action => 'reply', :user_id => reply.user_id, :id => issue.id, :journal_id => reply.id},
|
||||
:remote => true,
|
||||
:method => 'get',
|
||||
:class => 'fr newsBlue',
|
||||
:title => l(:button_reply)) if User.current.logged? %>
|
||||
<%= link_to(
|
||||
l(:button_delete),
|
||||
{:controller => 'issues',:action => 'delete_journal', :id => issue.id,:journal_id=>reply.id},
|
||||
:method => :get,
|
||||
:remote=>true,
|
||||
:class => 'fr newsGrey mr10',
|
||||
:data => {:confirm => l(:text_are_you_sure)},
|
||||
:title => l(:button_delete)
|
||||
) if reply.user_id == User.current.id %>
|
||||
</div>
|
||||
</div>
|
||||
<p id="reply_message_<%= reply.id%>"></p>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
<div class="homepagePostReplyContainer borderBottomNone minHeight48">
|
||||
|
||||
<div class="homepagePostReplyPortrait mr15 imageFuzzy" id="reply_image_<%= @issue.id%>">
|
||||
<%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(@issue.author_id), :alt => "用户头像" %>
|
||||
</div>
|
||||
|
||||
<div class="homepagePostReplyInputContainer mb10">
|
||||
<div nhname='new_message_<%= @issue.id %>' style="display:none;">
|
||||
<%= form_for('new_form',:url => add_journal_issue_path(@issue.id),:method => "post", :remote => true) do |f| %>
|
||||
<%#= kindeditor_tag :notes,"",:height=>"33",:minHeight=>"33",:editor_id=>"issues_reply_editor"%>
|
||||
<!--<div class="cl"></div>-->
|
||||
<input type="hidden" name="issue_id" value="<%=@issue.id%>"/>
|
||||
<div nhname='toolbar_container_<%= @issue.id %>' ></div>
|
||||
<div class="cl"></div>
|
||||
<textarea placeholder="有问题或有建议,请直接给我留言吧!" style="display: none" nhname='new_message_textarea_<%= @issue.id %>' name="notes"></textarea>
|
||||
<div class="cl"></div>
|
||||
<div class="mt5 fl">
|
||||
<%= render :partial => 'attachments/issue_reply', :locals => {:container => @issue} %>
|
||||
</div>
|
||||
<span nhname='contentmsg_<%= @issue.id %>' class="fl"></span>
|
||||
<a id="new_message_submit_btn_<%= @issue.id %>" href="javascript:void(0)" class="blue_n_btn fr mt5" style="display:none;">发送</a>
|
||||
<div class="cl"></div>
|
||||
<% end %>
|
||||
</div>
|
||||
<!--<a href="javascript:void(0);" onclick="issues_reply_editor.sync();$(this).parent().submit();" class="homepagePostReplySubmit postReplySubmit fl mt5">发送</a>-->
|
||||
<div class="cl"></div>
|
||||
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<ul>
|
||||
<% issue.journals.reorder("created_on desc").each do |reply| %>
|
||||
<script type="text/javascript">
|
||||
$(function(){
|
||||
showNormalImage('reply_content_<%= reply.id %>');
|
||||
});
|
||||
</script>
|
||||
<% replies_all_i=replies_all_i + 1 %>
|
||||
<li class="homepagePostReplyContainer" nhname="reply_rec" onmouseover="$('#reply_edit_menu_<%= reply.id%>').show();" onmouseout="$('#reply_edit_menu_<%= reply.id%>').hide();" >
|
||||
<div class="homepagePostReplyPortrait" >
|
||||
<%= link_to image_tag(url_to_avatar(reply.user), :width => "33", :height => "33"), user_path(reply.user_id), :alt => "用户头像" %>
|
||||
</div>
|
||||
<div class="homepagePostReplyDes">
|
||||
<div class="homepagePostReplyPublisher mt-4">
|
||||
<% if reply.try(:user).try(:realname) == ' ' %>
|
||||
<%= link_to reply.try(:user), user_path(reply.user_id), :class => "newsBlue mr10 f14" %>
|
||||
<% else %>
|
||||
<%= link_to reply.try(:user).try(:realname), user_path(reply.user_id), :class => "newsBlue mr10 f14" %>
|
||||
<% end %>
|
||||
<%#= format_time(reply.created_on) %>
|
||||
</div>
|
||||
<div class="homepagePostReplyContent break_word list_style upload_img table_maxWidth" id="reply_content_<%= reply.id %>">
|
||||
<% if reply.details.any? %>
|
||||
<% details_to_strings(reply.details).each do |string| %>
|
||||
<p><%= string %></p>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<P><%= reply.notes.html_safe %></P>
|
||||
</div>
|
||||
<div style="margin-top: 7px">
|
||||
<%= format_time(reply.created_on) %>
|
||||
<div class="fr" id="reply_edit_menu_<%= reply.id%>" style="display: none">
|
||||
<%= link_to(
|
||||
l(:button_reply),
|
||||
{:controller => 'issues', :action => 'reply', :user_id => reply.user_id, :id => issue.id, :journal_id => reply.id},
|
||||
:remote => true,
|
||||
:method => 'get',
|
||||
:class => 'fr newsBlue',
|
||||
:title => l(:button_reply)) if User.current.logged? %>
|
||||
<%= link_to(
|
||||
l(:button_delete),
|
||||
{:controller => 'issues',:action => 'delete_journal', :id => issue.id,:journal_id=>reply.id},
|
||||
:method => :get,
|
||||
:remote=>true,
|
||||
:class => 'fr newsGrey mr10',
|
||||
:data => {:confirm => l(:text_are_you_sure)},
|
||||
:title => l(:button_delete)
|
||||
) if reply.user_id == User.current.id %>
|
||||
</div>
|
||||
</div>
|
||||
<p id="reply_message_<%= reply.id%>"></p>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
<div class="homepagePostReplyContainer borderBottomNone minHeight48">
|
||||
|
||||
<div class="homepagePostReplyPortrait mr15 imageFuzzy" id="reply_image_<%= @issue.id%>">
|
||||
<%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(@issue.author_id), :alt => "用户头像" %>
|
||||
</div>
|
||||
|
||||
<div class="homepagePostReplyInputContainer mb10">
|
||||
<div nhname='new_message_<%= @issue.id %>' style="display:none;">
|
||||
<%= form_for('new_form',:url => add_journal_issue_path(@issue.id),:method => "post", :remote => true) do |f| %>
|
||||
<%#= kindeditor_tag :notes,"",:height=>"33",:minHeight=>"33",:editor_id=>"issues_reply_editor"%>
|
||||
<!--<div class="cl"></div>-->
|
||||
<input type="hidden" name="issue_id" value="<%=@issue.id%>"/>
|
||||
<div nhname='toolbar_container_<%= @issue.id %>' ></div>
|
||||
<div class="cl"></div>
|
||||
<textarea placeholder="有问题或有建议,请直接给我留言吧!" style="display: none" nhname='new_message_textarea_<%= @issue.id %>' name="notes"></textarea>
|
||||
<div class="cl"></div>
|
||||
<div class="mt5 fl">
|
||||
<%= render :partial => 'attachments/issue_reply', :locals => {:container => @issue} %>
|
||||
</div>
|
||||
<span nhname='contentmsg_<%= @issue.id %>' class="fl"></span>
|
||||
<a id="new_message_submit_btn_<%= @issue.id %>" href="javascript:void(0)" onclick="this.style.display='none'" class="blue_n_btn fr mt5" style="display:none;">发送</a>
|
||||
<div class="cl"></div>
|
||||
<% end %>
|
||||
</div>
|
||||
<!--<a href="javascript:void(0);" onclick="issues_reply_editor.sync();$(this).parent().submit();" class="homepagePostReplySubmit postReplySubmit fl mt5">发送</a>-->
|
||||
<div class="cl"></div>
|
||||
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
|
@ -1,27 +1,27 @@
|
|||
<div class="ReplyToMessageContainer borderBottomNone " id="reply_to_message_<%= @issue.id%>">
|
||||
|
||||
<div class="homepagePostReplyPortrait mr15 imageFuzzy" id="reply_image_<%= @issue.id%>">
|
||||
<%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(@issue.author_id), :alt => "用户头像" %>
|
||||
</div>
|
||||
|
||||
<div class="ReplyToMessageInputContainer mb10">
|
||||
<div nhname='new_message_<%= @issue.id%>' style="display:none;">
|
||||
<%= form_for('new_form',:url => add_reply_issue_path(@issue.id),:method => "post", :remote => true) do |f|%>
|
||||
<%#= kindeditor_tag :notes,"",:height=>"33",:minHeight=>"33",:editor_id=>"issues_reply_editor"%>
|
||||
<!--<div class="cl"></div>-->
|
||||
<input type="hidden" name="quote" value=""/>
|
||||
<input type="hidden" name="issue_id" value="<%=@issue.id%>"/>
|
||||
<div nhname='toolbar_container_<%= @issue.id%>' ></div>
|
||||
<div class="cl"></div>
|
||||
<textarea placeholder="有问题或有建议,请直接给我留言吧!" style="display: none" nhname='new_message_textarea_<%= @issue.id%>' name="notes"></textarea>
|
||||
<div class="cl"></div>
|
||||
<span nhname='contentmsg_<%= @issue.id%>' class="fl"></span>
|
||||
<a id="new_message_submit_btn_<%= @issue.id%>" href="javascript:void(0)" class="blue_n_btn fr" style="display:none;margin-top:6px;">发送</a>
|
||||
<div class="cl"></div>
|
||||
<% end %>
|
||||
</div>
|
||||
<!--<a href="javascript:void(0);" onclick="issues_reply_editor.sync();$(this).parent().submit();" class="homepagePostReplySubmit postReplySubmit fl mt5">发送</a>-->
|
||||
<div class="cl"></div>
|
||||
|
||||
</div>
|
||||
<div class="ReplyToMessageContainer borderBottomNone " id="reply_to_message_<%= @issue.id%>">
|
||||
|
||||
<div class="homepagePostReplyPortrait mr15 imageFuzzy" id="reply_image_<%= @issue.id%>">
|
||||
<%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(@issue.author_id), :alt => "用户头像" %>
|
||||
</div>
|
||||
|
||||
<div class="ReplyToMessageInputContainer mb10">
|
||||
<div nhname='new_message_<%= @issue.id%>' style="display:none;">
|
||||
<%= form_for('new_form',:url => add_reply_issue_path(@issue.id),:method => "post", :remote => true) do |f|%>
|
||||
<%#= kindeditor_tag :notes,"",:height=>"33",:minHeight=>"33",:editor_id=>"issues_reply_editor"%>
|
||||
<!--<div class="cl"></div>-->
|
||||
<input type="hidden" name="quote" value=""/>
|
||||
<input type="hidden" name="issue_id" value="<%=@issue.id%>"/>
|
||||
<div nhname='toolbar_container_<%= @issue.id%>' ></div>
|
||||
<div class="cl"></div>
|
||||
<textarea placeholder="有问题或有建议,请直接给我留言吧!" style="display: none" nhname='new_message_textarea_<%= @issue.id%>' name="notes"></textarea>
|
||||
<div class="cl"></div>
|
||||
<span nhname='contentmsg_<%= @issue.id%>' class="fl"></span>
|
||||
<a id="new_message_submit_btn_<%= @issue.id%>" href="javascript:void(0)" onclick="this.style.display='none'" class="blue_n_btn fr" style="display:none;margin-top:6px;">发送</a>
|
||||
<div class="cl"></div>
|
||||
<% end %>
|
||||
</div>
|
||||
<!--<a href="javascript:void(0);" onclick="issues_reply_editor.sync();$(this).parent().submit();" class="homepagePostReplySubmit postReplySubmit fl mt5">发送</a>-->
|
||||
<div class="cl"></div>
|
||||
|
||||
</div>
|
||||
</div>
|
|
@ -77,10 +77,10 @@
|
|||
|
||||
</div>
|
||||
<div id="loginInButton" class="fr ml20">
|
||||
<a href="<%= signin_path(:login=>true) %>" class="c_white db">登录</a>
|
||||
<a href="<%= signin_url_without_domain %>" class="c_white db">登录</a>
|
||||
</div>
|
||||
<div id="loginSignButton" class="fr">
|
||||
<a href="<%= signin_path(:login=>false) %>" class="c_white db">注册</a>
|
||||
<a href="<%= register_url_without_domain %>" class="c_white db">注册</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<li class="homepageLeftMenuCoursesLine pr">
|
||||
<% is_teacher = User.current.logged? && (User.current.admin? || User.current.allowed_to?(:as_teacher,course)) %>
|
||||
<%= link_to course.name, course_path(course.id,:host=>Setting.host_course), :class => "coursesLineGrey hidden #{course_endTime_timeout?(course) ? 'c_dark_grey' : ''}",
|
||||
:id => "show_course_#{course.id}",:title => (course.is_public? ? "公开课程:":"私有课程:")+course.name+"("+current_time_and_term(course)+")"%>
|
||||
:id => "show_course_#{course.id}", :target => '_blank', :title => (course.is_public? ? "公开课程:":"私有课程:")+course.name+"("+current_time_and_term(course)+")"%>
|
||||
<% count = ShieldActivity.where("container_type='User' and container_id=#{user.id} and shield_type='Course' and shield_id=#{course.id}").count %>
|
||||
<ul class="<%= count > 0 ? 'shild shildP':'subNavArrow'%>">
|
||||
<li>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<% projects.each do |project|%>
|
||||
<li class="homepageLeftMenuCoursesLine pr">
|
||||
<% count = ShieldActivity.where("container_type='User' and container_id=#{user.id} and shield_type='Project' and shield_id=#{project.id}").count %>
|
||||
<%= link_to project.name, project_path(project.id,:host=>Setting.host_name), :class => "coursesLineGrey hidden",:id => "show_project_#{project.id}", :title => (project.is_public? ? "公开项目:":"私有项目:") + project.name%>
|
||||
<%= link_to project.name, project_path(project.id,:host=>Setting.host_name), :target => '_blank', :class => "coursesLineGrey hidden",:id => "show_project_#{project.id}", :title => (project.is_public? ? "公开项目:":"私有项目:") + project.name%>
|
||||
<ul class="<%= count > 0 ? 'shild shildP':'subNavArrow'%>">
|
||||
<li>
|
||||
<ul class="subNavMenu boxShadow">
|
||||
|
|
|
@ -143,18 +143,19 @@
|
|||
<% unless contributor_course_scor(@course.id).count == 0 %>
|
||||
<ul class="rankList">
|
||||
<h4>课程活跃度
|
||||
<a class="contributor_course" onmouseover ="message_titile_show2($(this),event)" onmouseout ="message_titile_hide2($(this))">积分规则</a>
|
||||
<a class="contributor_course" onmouseover ="message_titile_show2($(this),event)" onmouseout ="message_titile_hide2($(this))" style="cursor: pointer; position:relative;">积分规则</a>
|
||||
</h4>
|
||||
<div style="display: none;padding: 5px;" class="numIntro color_888">
|
||||
<div class="contributor_course_innor">积分规则</div>
|
||||
资源发布:资源数 x 5 </br>
|
||||
问答发布:发帖数 x 2 </br>
|
||||
通知发布:通知数 x 1 </br>
|
||||
问答回复:回复数 x 1 </br>
|
||||
作业留言:留言数 x 1 </br>
|
||||
通知留言:留言数 x 1 </br>
|
||||
课程留言:留言数 x 1 </br>
|
||||
总得分为以上得分之和
|
||||
<div class="numIntro undis" style="cursor:pointer;">
|
||||
<div class="active-degree-rule">
|
||||
积分规则<br/>
|
||||
资源发布:资源数 x 5 <br/>
|
||||
问答发布:发帖数 x 2 <br/>
|
||||
通知发布:通知数 x 1 <br/>
|
||||
问答回复:回复数 x 1 <br/>
|
||||
作业留言:留言数 x 1 <br/>
|
||||
通知留言:留言数 x 1 <br/>
|
||||
课程留言:留言数 x 1 <br/>
|
||||
总得分为以上得分之和</div>
|
||||
</div>
|
||||
|
||||
<% contributor_course_scor(@course.id).each do |contributor_score| %>
|
||||
|
@ -163,13 +164,13 @@
|
|||
+ contributor_score.homework_journal_num.to_i * 1 + contributor_score.news_reply_num.to_i * 1 +
|
||||
contributor_score.news_num.to_i * 1 %>
|
||||
<% unless total_score ==0 %>
|
||||
<li> <a href="javascript:void:(0);"><%=link_to image_tag(url_to_avatar(contributor_score.user), :width => "35", :height => "35", :class=> "rankPortrait"),user_path(contributor_score.user) %></a>
|
||||
<p><a href="javascript:void:(0);"><%=link_to contributor_score.user.show_name, user_path(contributor_score.user), :title => contributor_score.user.show_name %></a></p>
|
||||
<li><%=link_to image_tag(url_to_avatar(contributor_score.user), :width => "35", :height => "35", :class=> "rankPortrait"),user_path(contributor_score.user) %>
|
||||
<p><%=link_to contributor_score.user.show_name, user_path(contributor_score.user.id), :title => contributor_score.user.show_name %></p>
|
||||
<p><span class="c_green" style="cursor:pointer">
|
||||
<a onmouseover ="message_titile_show($(this),event)" onmouseout ="message_titile_hide($(this))" class="c_green">
|
||||
<%=total_score %></a></span></p>
|
||||
<div style="display: none" class="numIntro color_888">
|
||||
<div class="contributor_course_calculate">积分计算</div>
|
||||
<div style="display: none" class="numIntro">
|
||||
<div class="contributor-course-calculate">积分计算</div>
|
||||
<%# unless contributor_score.resource_num.to_i == 0 %>
|
||||
<div style="padding-left: 2px;padding-bottom: 2px;padding-right: 2px">
|
||||
资源发布数 x 5 = <%= contributor_score.resource_num.to_i %> x 5 = <%= contributor_score.resource_num.to_i * 5 %></br>
|
||||
|
@ -208,10 +209,11 @@
|
|||
<% unless hero_homework_scores.map(&:score).detect{|s| s.to_i != 0}.nil? %>
|
||||
<ul class="rankList">
|
||||
<h4><span>课程英雄榜</span>
|
||||
<a class="contributor_course" onmouseover ="message_titile_show2($(this),event)" onmouseout ="message_titile_hide2($(this))">积分规则</a></h4>
|
||||
<div style="display: none" class="numIntro color_888">
|
||||
<div class="hero_course_innor">积分规则</div>
|
||||
<a class="contributor_course" onmouseover ="message_titile_show2($(this),event)" onmouseout ="message_titile_hide2($(this))" style="cursor:pointer;">积分规则</a></h4>
|
||||
<div style="cursor:pointer;" class="numIntro undis">
|
||||
<div class="hero-degree-rule">积分规则<br/>
|
||||
英雄榜的得分是每个同学作业的得分总和
|
||||
</div>
|
||||
</div>
|
||||
<% hero_homework_scores.each do |student_score| %>
|
||||
<% if student_score.score.to_i != 0 %>
|
||||
|
@ -248,6 +250,7 @@
|
|||
</div><!--项目标签 end-->
|
||||
<!--课程推荐-->
|
||||
<%= render :partial => 'courses/recommendation', :locals => {:course => @course} %>
|
||||
<div class="fontGrey5 mt10 ml10 mb10">访问计数 <%= @course.visits.to_i %></div>
|
||||
</div><!--LSide end-->
|
||||
|
||||
<div id="RSide" class="fl">
|
||||
|
|
|
@ -132,6 +132,7 @@
|
|||
<div class="homepageLeftMenuContainer" id="sub_field_left_lists">
|
||||
<%= render :partial => "organizations/org_left_subfield_list", :locals => {:organization => @organization} %>
|
||||
</div>
|
||||
<div class="fontGrey5 mt10 ml20">访问计数 <%= @organization.visits.to_i %></div>
|
||||
</div>
|
||||
<div class="homepageRight" style="margin-top:<%= (params[:show_homepage].nil? && User.current.logged?) ? '10px':'0px' %>;">
|
||||
<%= render_flash_messages %>
|
||||
|
|
|
@ -158,9 +158,12 @@
|
|||
</div>
|
||||
<div class="cl"></div>
|
||||
</div><!--项目标签 end-->
|
||||
|
||||
<div class="fontGrey5 mt10 ml10 mb10">访问计数 <%= @project.visits.to_i %></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div id="RSide" class="fl">
|
||||
<%= render_flash_messages %>
|
||||
<%= yield %>
|
||||
|
|
|
@ -226,6 +226,7 @@
|
|||
<div class="cl"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="fontGrey5 mt10 ml20">访问计数 <%= @user.visits.to_i %></div>
|
||||
</div>
|
||||
<div class="homepageRight">
|
||||
<%= yield %>
|
||||
|
|
|
@ -61,7 +61,7 @@
|
|||
<%= link_to @memo.author.name, user_path(@memo.author), :class => "linkBlue2", :target=> "_blank"%></div>
|
||||
<div class="postDetailDate mb5"><%= format_date( @memo.created_at)%></div>
|
||||
<div class="cl"></div>
|
||||
<div class="homepagePostIntro memo-content" id="message_description_<%= @memo.id %>" style="word-break: break-all; word-wrap:break-word;margin-bottom: 0px !important;" >
|
||||
<div class="homepagePostIntro memo-content" id="activity_description_<%= @memo.id %>" style="word-break: break-all; word-wrap:break-word;margin-bottom: 0px !important;" >
|
||||
<%= @memo.content.html_safe%>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
|
@ -95,8 +95,21 @@
|
|||
</div>
|
||||
<div class="homepagePostReplyDes">
|
||||
<div class="homepagePostReplyPublisher mt-4"><a href="<%=user_path(reply.author)%>" class="newsBlue mr10 f14"><%= reply.author.name%></a><%= format_date(reply.created_at) %></div>
|
||||
<div class="homepagePostReplyContent"><%= reply.content.html_safe%></div>
|
||||
<div class="homepagePostReplyContent" id="activity_description_<%= reply.id %>"><%= reply.content.html_safe%></div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
$(function(){
|
||||
$("#activity_description_<%= reply.id %> p,#activity_description__<%= reply.id %> span,#activity_description_<%= reply.id %> em").each(function(){
|
||||
var postContent = $(this).html();
|
||||
postContent = postContent.replace(/ /g," ");
|
||||
postContent= postContent.replace(/ {2}/g," ");
|
||||
postContent=postContent.replace(/ /g," ");
|
||||
postContent=postContent.replace(/ /g," ");
|
||||
$(this).html(postContent);
|
||||
});
|
||||
description_show_hide(<%= reply.id %>);
|
||||
});
|
||||
</script>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<% end %>
|
||||
|
@ -113,7 +126,7 @@
|
|||
<%= hidden_field_tag :quote,"",:required => false,:style => 'display:none' %>
|
||||
<div nhname='toolbar_container_<%= @memo.id%>'></div>
|
||||
<textarea placeholder="有问题或有建议,请直接给我留言吧!" style="display: none" nhname='new_message_textarea_<%= @memo.id%>' name="memo[content]"></textarea>
|
||||
<a id="new_message_submit_btn_<%= @memo.id%>" href="javascript:void(0)" class="blue_n_btn fr" style="display:none;margin-top:6px;">发送</a>
|
||||
<a id="new_message_submit_btn_<%= @memo.id%>" href="javascript:void(0)" onclick="this.style.display='none'" class="blue_n_btn fr" style="display:none;margin-top:6px;">发送</a>
|
||||
<div class="cl"></div>
|
||||
<p nhname='contentmsg_<%= @memo.id%>'></p>
|
||||
<% end%>
|
||||
|
@ -126,7 +139,7 @@
|
|||
</div>
|
||||
<script type="text/javascript">
|
||||
$(function(){
|
||||
$("#message_description_<%= @memo.id %> p,#message_description_<%= @memo.id %> span,#message_description_<%= @memo.id %> em").each(function(){
|
||||
$("#activity_description_<%= @memo.id %> p,#activity_description__<%= @memo.id %> span,#activity_description_<%= @memo.id %> em").each(function(){
|
||||
var postContent = $(this).html();
|
||||
postContent = postContent.replace(/ /g," ");
|
||||
postContent= postContent.replace(/ {2}/g," ");
|
||||
|
@ -134,5 +147,6 @@
|
|||
postContent=postContent.replace(/ /g," ");
|
||||
$(this).html(postContent);
|
||||
});
|
||||
description_show_hide(<%= @memo.id %>);
|
||||
});
|
||||
</script>
|
|
@ -1,19 +1,19 @@
|
|||
|
||||
<div class="ReplyToMessageContainer borderBottomNone" id="reply_to_message_<%= reply.id%>">
|
||||
<div class="homepagePostReplyPortrait mr15 imageFuzzy" id="reply_image_<%= reply.id%>"><%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(User.current), :alt => "用户头像" %></div>
|
||||
<div class="ReplyToMessageInputContainer mb10">
|
||||
<div nhname='new_message_<%= reply.id%>'>
|
||||
<%= form_for @reply, :as => :reply, :url => {:action => 'reply', :id => @topic}, :html => {:multipart => true, :id => 'new_form'} do |f| %>
|
||||
<input type="hidden" name="quote[quote]" id="quote_quote">
|
||||
<input type="hidden" name="reply[subject]" id="reply_subject">
|
||||
<div nhname='toolbar_container_<%= reply.id%>'></div>
|
||||
<textarea placeholder="有问题或有建议,请直接给我留言吧!" style="display: none" nhname='new_message_textarea_<%= reply.id%>' name="reply[content]"></textarea>
|
||||
<a id="new_message_submit_btn_<%= reply.id%>" href="javascript:void(0)" class="blue_n_btn fr" style="display:none;margin-top:6px;">发送</a>
|
||||
<div class="cl"></div>
|
||||
<p nhname='contentmsg_<%= reply.id%>'></p>
|
||||
<% end%>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
|
||||
<div class="ReplyToMessageContainer borderBottomNone" id="reply_to_message_<%= reply.id%>">
|
||||
<div class="homepagePostReplyPortrait mr15 imageFuzzy" id="reply_image_<%= reply.id%>"><%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(User.current), :alt => "用户头像" %></div>
|
||||
<div class="ReplyToMessageInputContainer mb10">
|
||||
<div nhname='new_message_<%= reply.id%>'>
|
||||
<%= form_for @reply, :as => :reply, :url => {:action => 'reply', :id => @topic}, :html => {:multipart => true, :id => 'new_form'} do |f| %>
|
||||
<input type="hidden" name="quote[quote]" id="quote_quote">
|
||||
<input type="hidden" name="reply[subject]" id="reply_subject">
|
||||
<div nhname='toolbar_container_<%= reply.id%>'></div>
|
||||
<textarea placeholder="有问题或有建议,请直接给我留言吧!" style="display: none" nhname='new_message_textarea_<%= reply.id%>' name="reply[content]"></textarea>
|
||||
<a id="new_message_submit_btn_<%= reply.id%>" href="javascript:void(0)" onclick="this.style.display='none'" class="blue_n_btn fr" style="display:none;margin-top:6px;">发送</a>
|
||||
<div class="cl"></div>
|
||||
<p nhname='contentmsg_<%= reply.id%>'></p>
|
||||
<% end%>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
|
@ -1,18 +1,18 @@
|
|||
<div class="ReplyToMessageContainer borderBottomNone"id="reply_to_message_<%= reply.id%>">
|
||||
<div class="homepagePostReplyPortrait mr15 imageFuzzy" id="reply_image_<%= reply.id%>"><%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(User.current), :alt => "用户头像" %></div>
|
||||
<div class="ReplyToMessageInputContainer mb10">
|
||||
<div nhname='new_message_<%= reply.id%>'>
|
||||
<%= form_for @org_comment, :as => :reply, :url => {:controller => 'org_document_comments',:action => 'reply', :id => @org_comment.id}, :method => 'post', :html => {:multipart => true, :id => 'new_form'} do |f| %>
|
||||
<input type="hidden" name="quote[quote]" id="quote_quote">
|
||||
<input type="hidden" name="org_document_comment[title]" id="reply_subject">
|
||||
<div nhname='toolbar_container_<%= reply.id%>'></div>
|
||||
<textarea placeholder="有问题或有建议,请直接给我留言吧!" style="display: none" nhname='new_message_textarea_<%= reply.id%>' name="org_document_comment[content]"></textarea>
|
||||
<a id="new_message_submit_btn_<%= reply.id%>" href="javascript:void(0)" class="blue_n_btn fr" style="display:none;margin-top:2px;">发送</a>
|
||||
<div class="cl"></div>
|
||||
<p nhname='contentmsg_<%= reply.id%>'></p>
|
||||
<% end%>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<div class="ReplyToMessageContainer borderBottomNone"id="reply_to_message_<%= reply.id%>">
|
||||
<div class="homepagePostReplyPortrait mr15 imageFuzzy" id="reply_image_<%= reply.id%>"><%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(User.current), :alt => "用户头像" %></div>
|
||||
<div class="ReplyToMessageInputContainer mb10">
|
||||
<div nhname='new_message_<%= reply.id%>'>
|
||||
<%= form_for @org_comment, :as => :reply, :url => {:controller => 'org_document_comments',:action => 'reply', :id => @org_comment.id}, :method => 'post', :html => {:multipart => true, :id => 'new_form'} do |f| %>
|
||||
<input type="hidden" name="quote[quote]" id="quote_quote">
|
||||
<input type="hidden" name="org_document_comment[title]" id="reply_subject">
|
||||
<div nhname='toolbar_container_<%= reply.id%>'></div>
|
||||
<textarea placeholder="有问题或有建议,请直接给我留言吧!" style="display: none" nhname='new_message_textarea_<%= reply.id%>' name="org_document_comment[content]"></textarea>
|
||||
<a id="new_message_submit_btn_<%= reply.id%>" href="javascript:void(0)" onclick="this.style.display='none'" class="blue_n_btn fr" style="display:none;margin-top:2px;">发送</a>
|
||||
<div class="cl"></div>
|
||||
<p nhname='contentmsg_<%= reply.id%>'></p>
|
||||
<% end%>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
|
@ -144,7 +144,7 @@
|
|||
<input type="hidden" name="user_activity_id" value="<%=user_activity_id%>">
|
||||
<div nhname='toolbar_container_<%= user_activity_id%>'></div>
|
||||
<textarea placeholder="有问题或有建议,请直接给我留言吧!" style="display: none" nhname='new_message_textarea_<%= user_activity_id%>' name="reply[content]"></textarea>
|
||||
<a id="new_message_submit_btn_<%= user_activity_id%>" href="javascript:void(0)" class="blue_n_btn fr" style="display:none;margin-top:6px;">发送</a>
|
||||
<a id="new_message_submit_btn_<%= user_activity_id%>" href="javascript:void(0)" onclick="this.style.display='none'" class="blue_n_btn fr" style="display:none;margin-top:6px;">发送</a>
|
||||
<div class="cl"></div>
|
||||
<p nhname='contentmsg_<%= user_activity_id%>'></p>
|
||||
<% end%>
|
||||
|
|
|
@ -1,161 +1,161 @@
|
|||
<div class="resources mt10" id="user_activity_<%= user_activity_id%>">
|
||||
<div class="homepagePostBrief">
|
||||
<div class="homepagePostPortrait">
|
||||
<%= link_to image_tag(url_to_avatar(activity.author), :width => "50", :height => "50"), user_url_in_org(activity.author_id), :alt => "用户头像" %>
|
||||
<%= render :partial => 'users/show_detail_info', :locals => {:user => activity.author} %>
|
||||
</div>
|
||||
<div class="homepagePostDes">
|
||||
<div class="homepagePostTo break_word mt-4">
|
||||
<% if activity.try(:author).try(:realname) == ' ' %>
|
||||
<%= link_to activity.try(:author), user_url_in_org(activity.author_id), :class => "newsBlue mr15" %>
|
||||
<% else %>
|
||||
<%= link_to activity.try(:author).try(:realname), user_url_in_org(activity.author_id), :class => "newsBlue mr15" %>
|
||||
<% end %>
|
||||
TO
|
||||
<%= link_to activity.board.org_subfield.name.to_s+" | 帖子栏目讨论区",organization_path(activity.board.org_subfield.organization, :org_subfield_id => activity.board.org_subfield.id), :class => "newsBlue ml15 mr5"%>
|
||||
</div>
|
||||
<div class="homepagePostTitle break_word">
|
||||
<% if activity.parent_id.nil? %>
|
||||
<%= link_to activity.subject.to_s.html_safe, board_message_path(activity.board,activity), :class=> "postGrey"
|
||||
%>
|
||||
<% else %>
|
||||
<%= link_to activity.parent.subject.to_s.html_safe, board_message_path(activity.board,activity), :class=> "postGrey"
|
||||
%>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="homepagePostDate fl">
|
||||
发布时间:<%= format_time(activity.created_on) %>
|
||||
</div>
|
||||
<div class="homepagePostDate fl ml15">
|
||||
更新时间:<%= format_time(OrgActivity.where("org_act_type='#{activity.class}' and org_act_id =#{activity.id}").first.updated_at) %>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<% if activity.parent_id.nil? %>
|
||||
<% content = activity.content%>
|
||||
<% else %>
|
||||
<% content = activity.parent.content%>
|
||||
<% end %>
|
||||
<%=render :partial =>"users/intro_content", :locals=>{:user_activity_id =>user_activity_id, :content=>content} %>
|
||||
<div class="cl"></div>
|
||||
<div id="intro_content_show_<%= user_activity_id%>" class="fr" style="display:none;"><a href="javascript:void(0);" class="linkBlue">[展开]</a></div>
|
||||
<div id="intro_content_hide_<%= user_activity_id%>" class="fr" style="display:none;"><a href="javascript:void(0);" class="linkBlue">[收起]</a></div>
|
||||
<div class="cl"></div>
|
||||
<div class="mt10" style="font-weight:normal;">
|
||||
<%= render :partial=>"attachments/activity_attach", :locals=>{:activity => activity} %>
|
||||
</div>
|
||||
<div class="homepagePostSetting">
|
||||
<ul>
|
||||
<li class="homepagePostSettingIcon">
|
||||
<% if User.current.logged? %>
|
||||
<ul class="homepagePostSettiongText">
|
||||
<li><%= link_to("发送", 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send('#{activity.id}',#{User.current.id},'message')") %></li>
|
||||
<li>
|
||||
<%= link_to(
|
||||
l(:button_edit),
|
||||
{:controller => 'messages', :action => 'edit', :id => activity, :board_id => activity.board_id},
|
||||
:class => 'postOptionLink'
|
||||
) if activity.org_subfield_editable_by?(User.current) %>
|
||||
</li>
|
||||
<li>
|
||||
<%= link_to(
|
||||
l(:button_delete),
|
||||
{:controller => 'messages', :action => 'destroy', :id => activity, :board_id => activity.board_id},
|
||||
:method => 'post',
|
||||
:data => {:confirm => l(:text_are_you_sure)},
|
||||
:class => 'postOptionLink'
|
||||
) if activity.org_subfield_editable_by?(User.current) %>
|
||||
</li>
|
||||
</ul>
|
||||
<% end %>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<% count = 0 %>
|
||||
<% if activity.parent %>
|
||||
<% count=activity.parent.children.count%>
|
||||
<% else %>
|
||||
<% count=activity.children.count%>
|
||||
<% end %>
|
||||
<div class="homepagePostReply">
|
||||
<div class="homepagePostReplyBanner">
|
||||
<div class="homepagePostReplyBannerCount">回复
|
||||
<sapn class="mr15"><%= count>0 ? "(#{count})" : "" %></sapn><span style="color: #cecece;">▪</span>
|
||||
<span id="praise_count_<%=user_activity_id %>">
|
||||
<% if activity.author == User.current %>
|
||||
<span class="ml15 likeButton" title="不能自己赞自己哦!"> <span class="likeText">赞</span><span class="likeNum"><%= get_praise_num(activity) > 0 ? "(#{get_praise_num(activity)})" : "" %></span></span>
|
||||
<% else %>
|
||||
<%=render :partial=> "praise_tread/praise", :locals => {:activity=>activity, :user_activity_id=>user_activity_id,:type=>"activity"}%>
|
||||
<% end %>
|
||||
</span>
|
||||
</div>
|
||||
<%if count>3 %>
|
||||
<div class="homepagePostReplyBannerMore"><a id="reply_btn_<%=user_activity_id%>" onclick="expand_reply('#reply_div_<%= user_activity_id %> li','#reply_btn_<%=user_activity_id%>')" data-count="<%= count %>" data-init="0" class=" replyGrey" href="javascript:void(0)" value="show_help" >展开更多</a></div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<% activity= activity.parent_id.nil? ? activity : activity.parent %>
|
||||
<% replies_all_i = 0 %>
|
||||
<% if count > 0 %>
|
||||
<div class="" id="reply_div_<%= user_activity_id %>">
|
||||
<ul>
|
||||
<% activity.children.reorder("created_on desc").each do |reply| %>
|
||||
<script type="text/javascript">
|
||||
$(function(){
|
||||
showNormalImage('reply_content_<%= reply.id %>');
|
||||
});
|
||||
</script>
|
||||
<% replies_all_i=replies_all_i+1 %>
|
||||
<li class="homepagePostReplyContainer" nhname="reply_rec" style="display:<%= replies_all_i>3 ? 'none' : '' %>">
|
||||
<div class="homepagePostReplyPortrait">
|
||||
<%= link_to image_tag(url_to_avatar(reply.author), :width => "33", :height => "33"), user_url_in_org(reply.author_id), :alt => "用户头像" %>
|
||||
</div>
|
||||
<div class="homepagePostReplyDes">
|
||||
<div class="homepagePostReplyPublisher mt-4">
|
||||
<% if reply.try(:author).try(:realname) == ' ' %>
|
||||
<%= link_to reply.try(:author), user_url_in_org(reply.author_id), :class => "newsBlue mr10 f14" %>
|
||||
<% else %>
|
||||
<%= link_to reply.try(:author).try(:realname), user_url_in_org(reply.author_id), :class => "newsBlue mr10 f14" %>
|
||||
<% end %>
|
||||
<%= format_time(reply.created_on) %>
|
||||
<span id="reply_praise_count_<%=reply.id %>">
|
||||
<% if reply.author == User.current %>
|
||||
<span class="fr likeButton" title="不能自己赞自己哦!"> <span class="likeText">赞</span><span class="likeNum"><%= get_praise_num(reply) > 0 ? "(#{get_praise_num(reply)})" : "" %></span></span>
|
||||
<% else %>
|
||||
<%=render :partial=> "praise_tread/praise", :locals => {:activity=>reply, :user_activity_id=>reply.id,:type=>"reply"}%>
|
||||
<% end %>
|
||||
</span>
|
||||
</div>
|
||||
<div class="homepagePostReplyContent break_word list_style upload_img table_maxWidth" id="reply_content_<%= reply.id %>">
|
||||
<%= reply.content.html_safe %></div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<div class="homepagePostReplyContainer borderBottomNone minHeight48">
|
||||
<div class="homepagePostReplyPortrait mr15 imageFuzzy" id="reply_image_<%= user_activity_id%>"><%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_url_in_org(activity.author_id), :alt => "用户头像" %></div>
|
||||
<div class="homepagePostReplyInputContainer mb10">
|
||||
<div nhname='new_message_<%= user_activity_id%>' style="display:none;">
|
||||
<%= form_for('new_form',:url => {:controller=>'messages',:action => 'reply', :id => activity.id, :board_id => activity.board_id, :is_board => 'true'},:method => "post", :remote => true) do |f|%>
|
||||
<input type="hidden" name="quote[quote]" value="">
|
||||
<input type="hidden" name="user_activity_id" value="<%=user_activity_id%>">
|
||||
<div nhname='toolbar_container_<%= user_activity_id%>'></div>
|
||||
<textarea placeholder="有问题或有建议,请直接给我留言吧!" style="display: none" nhname='new_message_textarea_<%= user_activity_id%>' name="reply[content]"></textarea>
|
||||
<a id="new_message_submit_btn_<%= user_activity_id%>" href="javascript:void(0)" class="blue_n_btn fr" style="display:none;margin-top:6px;">发送</a>
|
||||
<div class="cl"></div>
|
||||
<p nhname='contentmsg_<%= user_activity_id%>'></p>
|
||||
<% end%>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="resources mt10" id="user_activity_<%= user_activity_id%>">
|
||||
<div class="homepagePostBrief">
|
||||
<div class="homepagePostPortrait">
|
||||
<%= link_to image_tag(url_to_avatar(activity.author), :width => "50", :height => "50"), user_url_in_org(activity.author_id), :alt => "用户头像" %>
|
||||
<%= render :partial => 'users/show_detail_info', :locals => {:user => activity.author} %>
|
||||
</div>
|
||||
<div class="homepagePostDes">
|
||||
<div class="homepagePostTo break_word mt-4">
|
||||
<% if activity.try(:author).try(:realname) == ' ' %>
|
||||
<%= link_to activity.try(:author), user_url_in_org(activity.author_id), :class => "newsBlue mr15" %>
|
||||
<% else %>
|
||||
<%= link_to activity.try(:author).try(:realname), user_url_in_org(activity.author_id), :class => "newsBlue mr15" %>
|
||||
<% end %>
|
||||
TO
|
||||
<%= link_to activity.board.org_subfield.name.to_s+" | 帖子栏目讨论区",organization_path(activity.board.org_subfield.organization, :org_subfield_id => activity.board.org_subfield.id), :class => "newsBlue ml15 mr5"%>
|
||||
</div>
|
||||
<div class="homepagePostTitle break_word">
|
||||
<% if activity.parent_id.nil? %>
|
||||
<%= link_to activity.subject.to_s.html_safe, board_message_path(activity.board,activity), :class=> "postGrey"
|
||||
%>
|
||||
<% else %>
|
||||
<%= link_to activity.parent.subject.to_s.html_safe, board_message_path(activity.board,activity), :class=> "postGrey"
|
||||
%>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="homepagePostDate fl">
|
||||
发布时间:<%= format_time(activity.created_on) %>
|
||||
</div>
|
||||
<div class="homepagePostDate fl ml15">
|
||||
更新时间:<%= format_time(OrgActivity.where("org_act_type='#{activity.class}' and org_act_id =#{activity.id}").first.updated_at) %>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<% if activity.parent_id.nil? %>
|
||||
<% content = activity.content%>
|
||||
<% else %>
|
||||
<% content = activity.parent.content%>
|
||||
<% end %>
|
||||
<%=render :partial =>"users/intro_content", :locals=>{:user_activity_id =>user_activity_id, :content=>content} %>
|
||||
<div class="cl"></div>
|
||||
<div id="intro_content_show_<%= user_activity_id%>" class="fr" style="display:none;"><a href="javascript:void(0);" class="linkBlue">[展开]</a></div>
|
||||
<div id="intro_content_hide_<%= user_activity_id%>" class="fr" style="display:none;"><a href="javascript:void(0);" class="linkBlue">[收起]</a></div>
|
||||
<div class="cl"></div>
|
||||
<div class="mt10" style="font-weight:normal;">
|
||||
<%= render :partial=>"attachments/activity_attach", :locals=>{:activity => activity} %>
|
||||
</div>
|
||||
<div class="homepagePostSetting">
|
||||
<ul>
|
||||
<li class="homepagePostSettingIcon">
|
||||
<% if User.current.logged? %>
|
||||
<ul class="homepagePostSettiongText">
|
||||
<li><%= link_to("发送", 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send('#{activity.id}',#{User.current.id},'message')") %></li>
|
||||
<li>
|
||||
<%= link_to(
|
||||
l(:button_edit),
|
||||
{:controller => 'messages', :action => 'edit', :id => activity, :board_id => activity.board_id},
|
||||
:class => 'postOptionLink'
|
||||
) if activity.org_subfield_editable_by?(User.current) %>
|
||||
</li>
|
||||
<li>
|
||||
<%= link_to(
|
||||
l(:button_delete),
|
||||
{:controller => 'messages', :action => 'destroy', :id => activity, :board_id => activity.board_id},
|
||||
:method => 'post',
|
||||
:data => {:confirm => l(:text_are_you_sure)},
|
||||
:class => 'postOptionLink'
|
||||
) if activity.org_subfield_editable_by?(User.current) %>
|
||||
</li>
|
||||
</ul>
|
||||
<% end %>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<% count = 0 %>
|
||||
<% if activity.parent %>
|
||||
<% count=activity.parent.children.count%>
|
||||
<% else %>
|
||||
<% count=activity.children.count%>
|
||||
<% end %>
|
||||
<div class="homepagePostReply">
|
||||
<div class="homepagePostReplyBanner">
|
||||
<div class="homepagePostReplyBannerCount">回复
|
||||
<sapn class="mr15"><%= count>0 ? "(#{count})" : "" %></sapn><span style="color: #cecece;">▪</span>
|
||||
<span id="praise_count_<%=user_activity_id %>">
|
||||
<% if activity.author == User.current %>
|
||||
<span class="ml15 likeButton" title="不能自己赞自己哦!"> <span class="likeText">赞</span><span class="likeNum"><%= get_praise_num(activity) > 0 ? "(#{get_praise_num(activity)})" : "" %></span></span>
|
||||
<% else %>
|
||||
<%=render :partial=> "praise_tread/praise", :locals => {:activity=>activity, :user_activity_id=>user_activity_id,:type=>"activity"}%>
|
||||
<% end %>
|
||||
</span>
|
||||
</div>
|
||||
<%if count>3 %>
|
||||
<div class="homepagePostReplyBannerMore"><a id="reply_btn_<%=user_activity_id%>" onclick="expand_reply('#reply_div_<%= user_activity_id %> li','#reply_btn_<%=user_activity_id%>')" data-count="<%= count %>" data-init="0" class=" replyGrey" href="javascript:void(0)" value="show_help" >展开更多</a></div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<% activity= activity.parent_id.nil? ? activity : activity.parent %>
|
||||
<% replies_all_i = 0 %>
|
||||
<% if count > 0 %>
|
||||
<div class="" id="reply_div_<%= user_activity_id %>">
|
||||
<ul>
|
||||
<% activity.children.reorder("created_on desc").each do |reply| %>
|
||||
<script type="text/javascript">
|
||||
$(function(){
|
||||
showNormalImage('reply_content_<%= reply.id %>');
|
||||
});
|
||||
</script>
|
||||
<% replies_all_i=replies_all_i+1 %>
|
||||
<li class="homepagePostReplyContainer" nhname="reply_rec" style="display:<%= replies_all_i>3 ? 'none' : '' %>">
|
||||
<div class="homepagePostReplyPortrait">
|
||||
<%= link_to image_tag(url_to_avatar(reply.author), :width => "33", :height => "33"), user_url_in_org(reply.author_id), :alt => "用户头像" %>
|
||||
</div>
|
||||
<div class="homepagePostReplyDes">
|
||||
<div class="homepagePostReplyPublisher mt-4">
|
||||
<% if reply.try(:author).try(:realname) == ' ' %>
|
||||
<%= link_to reply.try(:author), user_url_in_org(reply.author_id), :class => "newsBlue mr10 f14" %>
|
||||
<% else %>
|
||||
<%= link_to reply.try(:author).try(:realname), user_url_in_org(reply.author_id), :class => "newsBlue mr10 f14" %>
|
||||
<% end %>
|
||||
<%= format_time(reply.created_on) %>
|
||||
<span id="reply_praise_count_<%=reply.id %>">
|
||||
<% if reply.author == User.current %>
|
||||
<span class="fr likeButton" title="不能自己赞自己哦!"> <span class="likeText">赞</span><span class="likeNum"><%= get_praise_num(reply) > 0 ? "(#{get_praise_num(reply)})" : "" %></span></span>
|
||||
<% else %>
|
||||
<%=render :partial=> "praise_tread/praise", :locals => {:activity=>reply, :user_activity_id=>reply.id,:type=>"reply"}%>
|
||||
<% end %>
|
||||
</span>
|
||||
</div>
|
||||
<div class="homepagePostReplyContent break_word list_style upload_img table_maxWidth" id="reply_content_<%= reply.id %>">
|
||||
<%= reply.content.html_safe %></div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<div class="homepagePostReplyContainer borderBottomNone minHeight48">
|
||||
<div class="homepagePostReplyPortrait mr15 imageFuzzy" id="reply_image_<%= user_activity_id%>"><%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_url_in_org(activity.author_id), :alt => "用户头像" %></div>
|
||||
<div class="homepagePostReplyInputContainer mb10">
|
||||
<div nhname='new_message_<%= user_activity_id%>' style="display:none;">
|
||||
<%= form_for('new_form',:url => {:controller=>'messages',:action => 'reply', :id => activity.id, :board_id => activity.board_id, :is_board => 'true'},:method => "post", :remote => true) do |f|%>
|
||||
<input type="hidden" name="quote[quote]" value="">
|
||||
<input type="hidden" name="user_activity_id" value="<%=user_activity_id%>">
|
||||
<div nhname='toolbar_container_<%= user_activity_id%>'></div>
|
||||
<textarea placeholder="有问题或有建议,请直接给我留言吧!" style="display: none" nhname='new_message_textarea_<%= user_activity_id%>' name="reply[content]"></textarea>
|
||||
<a id="new_message_submit_btn_<%= user_activity_id%>" href="javascript:void(0)" onclick="this.style.display='none'" class="blue_n_btn fr" style="display:none;margin-top:6px;">发送</a>
|
||||
<div class="cl"></div>
|
||||
<p nhname='contentmsg_<%= user_activity_id%>'></p>
|
||||
<% end%>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -1,146 +1,146 @@
|
|||
<div class="resources mt10" id="user_activity_<%= user_activity_id %>">
|
||||
<div class="homepagePostBrief">
|
||||
<div class="homepagePostPortrait">
|
||||
<%= link_to image_tag(url_to_avatar(activity.author), :width => "50", :height => "50"), user_url_in_org(activity.author_id), :alt => "用户头像" %>
|
||||
<%= render :partial => 'users/show_detail_info', :locals => {:user => activity.author} %>
|
||||
</div>
|
||||
<div class="homepagePostDes">
|
||||
<div class="homepagePostTo break_word mt-4">
|
||||
<% if activity.try(:author).try(:realname) == ' ' %>
|
||||
<%= link_to activity.try(:author), user_url_in_org(activity.author_id), :class => "newsBlue mr15" %>
|
||||
<% else %>
|
||||
<%= link_to activity.try(:author).try(:realname), user_url_in_org(activity.author_id), :class => "newsBlue mr15" %>
|
||||
<% end %> TO <!--+"(课程名称)"-->
|
||||
<%= link_to activity.org_subfield.name.to_s+" | 帖子栏目通知", organization_path(activity.org_subfield.organization, :org_subfield_id => activity.org_subfield.id), :class => "newsBlue ml15" %>
|
||||
</div>
|
||||
<div class="homepagePostTitle break_word hidden fl m_w600"> <!--+"(通知标题)"-->
|
||||
<%= link_to activity.title.to_s, news_path(activity), :class => "postGrey" %>
|
||||
</div>
|
||||
|
||||
<div class="cl"></div>
|
||||
<div class="homepagePostDate fl">
|
||||
发布时间:<%= format_time(activity.created_on) %>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<%=render :partial =>"users/intro_content", :locals=>{:user_activity_id =>user_activity_id, :content=>activity.description} %>
|
||||
<div class="cl"></div>
|
||||
<div id="intro_content_show_<%= user_activity_id %>" class="fr" style="display:none;"><a href="javascript:void(0);" class="linkBlue">[展开]</a></div>
|
||||
<div id="intro_content_hide_<%= user_activity_id %>" class="fr" style="display:none;"><a href="javascript:void(0);" class="linkBlue">[收起]</a></div>
|
||||
<div class="cl"></div>
|
||||
<div class="mt10" style="font-weight:normal;">
|
||||
<%= render :partial=>"attachments/activity_attach", :locals=>{:activity => activity} %>
|
||||
</div>
|
||||
<div class="homepagePostSetting">
|
||||
<ul>
|
||||
<li class="homepagePostSettingIcon">
|
||||
<% if User.current.logged? %>
|
||||
<ul class="homepagePostSettiongText">
|
||||
<li><%= link_to("发送", 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send('#{activity.id}',#{User.current.id},'news')") %></li>
|
||||
<li>
|
||||
<%= link_to(
|
||||
l(:button_edit),
|
||||
{:controller => 'news', :action => 'edit', :id => activity},
|
||||
:class => 'postOptionLink'
|
||||
) if activity.author == User.current %>
|
||||
</li>
|
||||
<li>
|
||||
<%= delete_link(
|
||||
news_path(activity),
|
||||
:data => {:confirm => l(:text_are_you_sure)},
|
||||
:class => 'postOptionLink'
|
||||
) if activity.author == User.current %>
|
||||
</li>
|
||||
</ul>
|
||||
<% end %>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<% count=activity.comments.count %>
|
||||
<div class="homepagePostReply">
|
||||
<div class="homepagePostReplyBanner">
|
||||
<div class="homepagePostReplyBannerCount">回复
|
||||
<sapn class="mr15"><%= count>0 ? "(#{count})" : "" %></sapn><span style="color: #cecece;">▪</span>
|
||||
<span id="praise_count_<%= user_activity_id %>">
|
||||
<% if activity.author == User.current %>
|
||||
<span class="ml15 likeButton" title="不能自己赞自己哦!"> <span class="likeText">赞</span><span class="likeNum"><%= get_praise_num(activity) > 0 ? "(#{get_praise_num(activity)})" : "" %></span></span>
|
||||
<% else %>
|
||||
<%=render :partial=> "praise_tread/praise", :locals => {:activity=>activity, :user_activity_id=>user_activity_id,:type=>"activity"}%>
|
||||
<% end %>
|
||||
</span>
|
||||
</div>
|
||||
<div class="homepagePostReplyBannerTime"><%#= format_date(activity.updated_on) %></div>
|
||||
<%if count>3 %>
|
||||
<div class="homepagePostReplyBannerMore">
|
||||
<a id="reply_btn_<%=user_activity_id%>" onclick="expand_reply('#reply_div_<%= user_activity_id %> li','#reply_btn_<%=user_activity_id%>')" data-count="<%= count %>" data-init="0" class=" replyGrey" href="javascript:void(0)" value="show_help" >
|
||||
展开更多
|
||||
</a>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<% replies_all_i = 0 %>
|
||||
<% if count > 0 %>
|
||||
<div class="" id="reply_div_<%= user_activity_id %>">
|
||||
<ul>
|
||||
<% activity.comments.reorder("created_on desc").each do |comment| %>
|
||||
<script type="text/javascript">
|
||||
$(function(){
|
||||
showNormalImage('reply_content_<%= comment.id %>');
|
||||
});
|
||||
</script>
|
||||
<% replies_all_i = replies_all_i + 1 %>
|
||||
<li class="homepagePostReplyContainer" nhname="reply_rec" style="display:<%= replies_all_i > 3 ? 'none' : '' %>">
|
||||
<div class="homepagePostReplyPortrait">
|
||||
<%= link_to image_tag(url_to_avatar(comment.author), :width => "33", :height => "33"), user_url_in_org(comment.author_id), :alt => "用户头像" %>
|
||||
</div>
|
||||
<div class="homepagePostReplyDes">
|
||||
<div class="homepagePostReplyPublisher mt-4">
|
||||
<% if comment.try(:author).try(:realname) == ' ' %>
|
||||
<%= link_to comment.try(:author), user_url_in_org(comment.author_id), :class => "newsBlue mr10 f14" %>
|
||||
<% else %>
|
||||
<%= link_to comment.try(:author).try(:realname), user_url_in_org(comment.author_id), :class => "newsBlue mr10 f14" %>
|
||||
<% end %>
|
||||
<%= format_time(comment.created_on) %>
|
||||
<span id="reply_praise_count_<%=comment.id %>">
|
||||
<% if comment.author == User.current %>
|
||||
<span class="fr likeButton" title="不能自己赞自己哦!"> <span class="likeText">赞</span><span class="likeNum"><%= get_praise_num(comment) > 0 ? "(#{get_praise_num(comment)})" : "" %></span></span>
|
||||
<% else %>
|
||||
<%=render :partial=> "praise_tread/praise", :locals => {:activity=>comment, :user_activity_id=>comment.id,:type=>"reply"}%>
|
||||
<% end %>
|
||||
</span>
|
||||
</div>
|
||||
<div class="homepagePostReplyContent break_word list_style upload_img table_maxWidth" id="reply_content_<%= comment.id %>">
|
||||
<%= comment.comments.html_safe %></div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<div class="homepagePostReplyContainer borderBottomNone minHeight48">
|
||||
<div class="homepagePostReplyPortrait mr15 imageFuzzy" id="reply_image_<%= user_activity_id%>"><%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_url_in_org(activity.author_id), :alt => "用户头像" %></div>
|
||||
<div class="homepagePostReplyInputContainer mb10">
|
||||
<div nhname='new_message_<%= user_activity_id%>' style="display:none;">
|
||||
<%= form_for('new_form',:url => {:controller => 'comments', :action => 'create', :id => activity},:method => "post", :remote => true) do |f|%>
|
||||
<input type="hidden" name="user_activity_id" value="<%=user_activity_id%>">
|
||||
<div nhname='toolbar_container_<%= user_activity_id%>'></div>
|
||||
<textarea placeholder="有问题或有建议,请直接给我留言吧!" style="display: none" nhname='new_message_textarea_<%= user_activity_id%>' name="comment"></textarea>
|
||||
<a id="new_message_submit_btn_<%= user_activity_id%>" href="javascript:void(0)" class="blue_n_btn fr" style="display:none;margin-top:6px;">发送</a>
|
||||
<div class="cl"></div>
|
||||
<p nhname='contentmsg_<%= user_activity_id%>'></p>
|
||||
<% end%>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
$(description_show_hide(<%=user_activity_id %>));
|
||||
</script>
|
||||
<div class="resources mt10" id="user_activity_<%= user_activity_id %>">
|
||||
<div class="homepagePostBrief">
|
||||
<div class="homepagePostPortrait">
|
||||
<%= link_to image_tag(url_to_avatar(activity.author), :width => "50", :height => "50"), user_url_in_org(activity.author_id), :alt => "用户头像" %>
|
||||
<%= render :partial => 'users/show_detail_info', :locals => {:user => activity.author} %>
|
||||
</div>
|
||||
<div class="homepagePostDes">
|
||||
<div class="homepagePostTo break_word mt-4">
|
||||
<% if activity.try(:author).try(:realname) == ' ' %>
|
||||
<%= link_to activity.try(:author), user_url_in_org(activity.author_id), :class => "newsBlue mr15" %>
|
||||
<% else %>
|
||||
<%= link_to activity.try(:author).try(:realname), user_url_in_org(activity.author_id), :class => "newsBlue mr15" %>
|
||||
<% end %> TO <!--+"(课程名称)"-->
|
||||
<%= link_to activity.org_subfield.name.to_s+" | 帖子栏目通知", organization_path(activity.org_subfield.organization, :org_subfield_id => activity.org_subfield.id), :class => "newsBlue ml15" %>
|
||||
</div>
|
||||
<div class="homepagePostTitle break_word hidden fl m_w600"> <!--+"(通知标题)"-->
|
||||
<%= link_to activity.title.to_s, news_path(activity), :class => "postGrey" %>
|
||||
</div>
|
||||
|
||||
<div class="cl"></div>
|
||||
<div class="homepagePostDate fl">
|
||||
发布时间:<%= format_time(activity.created_on) %>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<%=render :partial =>"users/intro_content", :locals=>{:user_activity_id =>user_activity_id, :content=>activity.description} %>
|
||||
<div class="cl"></div>
|
||||
<div id="intro_content_show_<%= user_activity_id %>" class="fr" style="display:none;"><a href="javascript:void(0);" class="linkBlue">[展开]</a></div>
|
||||
<div id="intro_content_hide_<%= user_activity_id %>" class="fr" style="display:none;"><a href="javascript:void(0);" class="linkBlue">[收起]</a></div>
|
||||
<div class="cl"></div>
|
||||
<div class="mt10" style="font-weight:normal;">
|
||||
<%= render :partial=>"attachments/activity_attach", :locals=>{:activity => activity} %>
|
||||
</div>
|
||||
<div class="homepagePostSetting">
|
||||
<ul>
|
||||
<li class="homepagePostSettingIcon">
|
||||
<% if User.current.logged? %>
|
||||
<ul class="homepagePostSettiongText">
|
||||
<li><%= link_to("发送", 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send('#{activity.id}',#{User.current.id},'news')") %></li>
|
||||
<li>
|
||||
<%= link_to(
|
||||
l(:button_edit),
|
||||
{:controller => 'news', :action => 'edit', :id => activity},
|
||||
:class => 'postOptionLink'
|
||||
) if activity.author == User.current %>
|
||||
</li>
|
||||
<li>
|
||||
<%= delete_link(
|
||||
news_path(activity),
|
||||
:data => {:confirm => l(:text_are_you_sure)},
|
||||
:class => 'postOptionLink'
|
||||
) if activity.author == User.current %>
|
||||
</li>
|
||||
</ul>
|
||||
<% end %>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<% count=activity.comments.count %>
|
||||
<div class="homepagePostReply">
|
||||
<div class="homepagePostReplyBanner">
|
||||
<div class="homepagePostReplyBannerCount">回复
|
||||
<sapn class="mr15"><%= count>0 ? "(#{count})" : "" %></sapn><span style="color: #cecece;">▪</span>
|
||||
<span id="praise_count_<%= user_activity_id %>">
|
||||
<% if activity.author == User.current %>
|
||||
<span class="ml15 likeButton" title="不能自己赞自己哦!"> <span class="likeText">赞</span><span class="likeNum"><%= get_praise_num(activity) > 0 ? "(#{get_praise_num(activity)})" : "" %></span></span>
|
||||
<% else %>
|
||||
<%=render :partial=> "praise_tread/praise", :locals => {:activity=>activity, :user_activity_id=>user_activity_id,:type=>"activity"}%>
|
||||
<% end %>
|
||||
</span>
|
||||
</div>
|
||||
<div class="homepagePostReplyBannerTime"><%#= format_date(activity.updated_on) %></div>
|
||||
<%if count>3 %>
|
||||
<div class="homepagePostReplyBannerMore">
|
||||
<a id="reply_btn_<%=user_activity_id%>" onclick="expand_reply('#reply_div_<%= user_activity_id %> li','#reply_btn_<%=user_activity_id%>')" data-count="<%= count %>" data-init="0" class=" replyGrey" href="javascript:void(0)" value="show_help" >
|
||||
展开更多
|
||||
</a>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<% replies_all_i = 0 %>
|
||||
<% if count > 0 %>
|
||||
<div class="" id="reply_div_<%= user_activity_id %>">
|
||||
<ul>
|
||||
<% activity.comments.reorder("created_on desc").each do |comment| %>
|
||||
<script type="text/javascript">
|
||||
$(function(){
|
||||
showNormalImage('reply_content_<%= comment.id %>');
|
||||
});
|
||||
</script>
|
||||
<% replies_all_i = replies_all_i + 1 %>
|
||||
<li class="homepagePostReplyContainer" nhname="reply_rec" style="display:<%= replies_all_i > 3 ? 'none' : '' %>">
|
||||
<div class="homepagePostReplyPortrait">
|
||||
<%= link_to image_tag(url_to_avatar(comment.author), :width => "33", :height => "33"), user_url_in_org(comment.author_id), :alt => "用户头像" %>
|
||||
</div>
|
||||
<div class="homepagePostReplyDes">
|
||||
<div class="homepagePostReplyPublisher mt-4">
|
||||
<% if comment.try(:author).try(:realname) == ' ' %>
|
||||
<%= link_to comment.try(:author), user_url_in_org(comment.author_id), :class => "newsBlue mr10 f14" %>
|
||||
<% else %>
|
||||
<%= link_to comment.try(:author).try(:realname), user_url_in_org(comment.author_id), :class => "newsBlue mr10 f14" %>
|
||||
<% end %>
|
||||
<%= format_time(comment.created_on) %>
|
||||
<span id="reply_praise_count_<%=comment.id %>">
|
||||
<% if comment.author == User.current %>
|
||||
<span class="fr likeButton" title="不能自己赞自己哦!"> <span class="likeText">赞</span><span class="likeNum"><%= get_praise_num(comment) > 0 ? "(#{get_praise_num(comment)})" : "" %></span></span>
|
||||
<% else %>
|
||||
<%=render :partial=> "praise_tread/praise", :locals => {:activity=>comment, :user_activity_id=>comment.id,:type=>"reply"}%>
|
||||
<% end %>
|
||||
</span>
|
||||
</div>
|
||||
<div class="homepagePostReplyContent break_word list_style upload_img table_maxWidth" id="reply_content_<%= comment.id %>">
|
||||
<%= comment.comments.html_safe %></div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<div class="homepagePostReplyContainer borderBottomNone minHeight48">
|
||||
<div class="homepagePostReplyPortrait mr15 imageFuzzy" id="reply_image_<%= user_activity_id%>"><%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_url_in_org(activity.author_id), :alt => "用户头像" %></div>
|
||||
<div class="homepagePostReplyInputContainer mb10">
|
||||
<div nhname='new_message_<%= user_activity_id%>' style="display:none;">
|
||||
<%= form_for('new_form',:url => {:controller => 'comments', :action => 'create', :id => activity},:method => "post", :remote => true) do |f|%>
|
||||
<input type="hidden" name="user_activity_id" value="<%=user_activity_id%>">
|
||||
<div nhname='toolbar_container_<%= user_activity_id%>'></div>
|
||||
<textarea placeholder="有问题或有建议,请直接给我留言吧!" style="display: none" nhname='new_message_textarea_<%= user_activity_id%>' name="comment"></textarea>
|
||||
<a id="new_message_submit_btn_<%= user_activity_id%>" href="javascript:void(0)" onclick="this.style.display='none'" class="blue_n_btn fr" style="display:none;margin-top:6px;">发送</a>
|
||||
<div class="cl"></div>
|
||||
<p nhname='contentmsg_<%= user_activity_id%>'></p>
|
||||
<% end%>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
$(description_show_hide(<%=user_activity_id %>));
|
||||
</script>
|
||||
|
|
|
@ -1,123 +1,123 @@
|
|||
<div class="resources mt10" id="user_activity_<%= user_activity_id %>">
|
||||
<div class="homepagePostBrief">
|
||||
<div class="homepagePostPortrait">
|
||||
<%= link_to image_tag(url_to_avatar(activity.author), :width => "50", :height => "50"), user_path(activity.author_id), :alt => "用户头像" %>
|
||||
<%= render :partial => 'users/show_detail_info', :locals => {:user => activity.author} %>
|
||||
</div>
|
||||
<div class="homepagePostDes">
|
||||
<div class="homepagePostTo break_word mt-4">
|
||||
<% if activity.try(:author).try(:realname) == ' ' %>
|
||||
<%= link_to activity.try(:author), user_path(activity.author_id), :class => "newsBlue mr15" %>
|
||||
<% else %>
|
||||
<%= link_to activity.try(:author).try(:realname), user_path(activity.author_id), :class => "newsBlue mr15" %>
|
||||
<% end %> TO
|
||||
<%= link_to activity.project.name.to_s+" | 项目新闻", project_news_index_path(activity.project), :class => "newsBlue ml15" %>
|
||||
</div>
|
||||
<div class="homepagePostTitle break_word hidden fl m_w600"> <!--+"(通知标题)"-->
|
||||
<%= link_to activity.title.to_s, news_path(activity), :class => "postGrey" %>
|
||||
</div>
|
||||
<% if activity.sticky == 1%>
|
||||
<span class="sticky_btn_cir ml10">置顶</span>
|
||||
<% end%>
|
||||
<div class="cl"></div>
|
||||
<div class="homepagePostDate fl">
|
||||
发布时间:<%= format_time(activity.created_on) %>
|
||||
</div>
|
||||
<div class="homepagePostDate fl ml15">
|
||||
更新时间:<%= format_time(ForgeActivity.where("forge_act_type='#{activity.class}' and forge_act_id =#{activity.id}").first.updated_at) %>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<%=render :partial =>"users/intro_content", :locals=>{:user_activity_id =>user_activity_id, :content=>activity.description} %>
|
||||
<div class="cl"></div>
|
||||
<div id="intro_content_show_<%= user_activity_id %>" class="fr" style="display:none;"><a href="javascript:void(0);" class="linkBlue">[展开]</a></div>
|
||||
<div id="intro_content_hide_<%= user_activity_id %>" class="fr" style="display:none;"><a href="javascript:void(0);" class="linkBlue">[收起]</a></div>
|
||||
<div class="cl"></div>
|
||||
<div class="mt10" style="font-weight:normal;">
|
||||
<%= render :partial=>"attachments/activity_attach", :locals=>{:activity => activity} %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<% count=activity.comments.count %>
|
||||
<div class="homepagePostReply">
|
||||
<div class="homepagePostReplyBanner">
|
||||
<div class="homepagePostReplyBannerCount">回复
|
||||
<sapn class="mr15"><%= count>0 ? "(#{count})" : "" %></sapn><span style="color: #cecece;">▪</span>
|
||||
<span id="praise_count_<%=user_activity_id %>">
|
||||
<% if activity.author == User.current %>
|
||||
<span class="ml15 likeButton" title="不能自己赞自己哦!"> <span class="likeText">赞</span><span class="likeNum"><%= get_praise_num(activity) > 0 ? "(#{get_praise_num(activity)})" : "" %></span></span>
|
||||
<% else %>
|
||||
<%=render :partial=> "praise_tread/praise", :locals => {:activity=>activity, :user_activity_id=>user_activity_id,:type=>"activity"}%>
|
||||
<% end %>
|
||||
</span>
|
||||
</div>
|
||||
<div class="homepagePostReplyBannerTime"><%#= format_date(activity.updated_on) %></div>
|
||||
<%if count>3 %>
|
||||
<div class="homepagePostReplyBannerMore">
|
||||
<a id="reply_btn_<%=user_activity_id%>" onclick="expand_reply('#reply_div_<%= user_activity_id %> li','#reply_btn_<%=user_activity_id%>')" data-count="<%= count %>" data-init="0" class=" replyGrey" href="javascript:void(0)" value="show_help" >
|
||||
展开更多
|
||||
</a>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<% replies_all_i = 0 %>
|
||||
<% if count > 0 %>
|
||||
<div class="" id="reply_div_<%= user_activity_id %>">
|
||||
<ul>
|
||||
<% activity.comments.reorder("created_on desc").each do |comment| %>
|
||||
<script type="text/javascript">
|
||||
$(function(){
|
||||
showNormalImage('reply_content_<%= comment.id %>');
|
||||
});
|
||||
</script>
|
||||
<% replies_all_i = replies_all_i + 1 %>
|
||||
<li class="homepagePostReplyContainer" nhname="reply_rec" style="display:<%= replies_all_i > 3 ? 'none' : '' %>">
|
||||
<div class="homepagePostReplyPortrait">
|
||||
<%= link_to image_tag(url_to_avatar(comment.author), :width => "33", :height => "33"), user_path(comment.author_id), :alt => "用户头像" %>
|
||||
</div>
|
||||
<div class="homepagePostReplyDes">
|
||||
<div class="homepagePostReplyPublisher mt-4">
|
||||
<% if comment.try(:author).try(:realname) == ' ' %>
|
||||
<%= link_to comment.try(:author), user_path(comment.author_id), :class => "newsBlue mr10 f14" %>
|
||||
<% else %>
|
||||
<%= link_to comment.try(:author).try(:realname), user_path(comment.author_id), :class => "newsBlue mr10 f14" %>
|
||||
<% end %>
|
||||
<%= format_time(comment.created_on) %>
|
||||
<span id="reply_praise_count_<%=comment.id %>">
|
||||
<% if comment.author == User.current %>
|
||||
<span class="fr likeButton" title="不能自己赞自己哦!"> <span class="likeText">赞</span><span class="likeNum"><%= get_praise_num(comment) > 0 ? "(#{get_praise_num(comment)})" : "" %></span></span>
|
||||
<% else %>
|
||||
<%=render :partial=> "praise_tread/praise", :locals => {:activity=>comment, :user_activity_id=>comment.id,:type=>"reply"}%>
|
||||
<% end %>
|
||||
</span>
|
||||
</div>
|
||||
<div class="homepagePostReplyContent break_word list_style upload_img table_maxWidth" id="reply_content_<%= comment.id %>">
|
||||
<%= comment.comments.html_safe %></div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<div class="homepagePostReplyContainer borderBottomNone minHeight48">
|
||||
<div class="homepagePostReplyPortrait mr15 imageFuzzy" id="reply_image_<%= user_activity_id%>"><%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(activity.author_id), :alt => "用户头像" %></div>
|
||||
<div class="homepagePostReplyInputContainer mb10">
|
||||
<div nhname='new_message_<%= user_activity_id%>' style="display:none;">
|
||||
<%= form_for('new_form',:url => {:controller => 'comments', :action => 'create', :id => activity},:method => "post", :remote => true) do |f|%>
|
||||
<input type="hidden" name="user_activity_id" value="<%=user_activity_id%>">
|
||||
<div nhname='toolbar_container_<%= user_activity_id%>'></div>
|
||||
<textarea placeholder="有问题或有建议,请直接给我留言吧!" style="display: none" nhname='new_message_textarea_<%= user_activity_id%>' name="comment"></textarea>
|
||||
<a id="new_message_submit_btn_<%= user_activity_id%>" href="javascript:void(0)" class="blue_n_btn fr" style="display:none;margin-top:6px;">发送</a>
|
||||
<div class="cl"></div>
|
||||
<p nhname='contentmsg_<%= user_activity_id%>'></p>
|
||||
<% end%>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="resources mt10" id="user_activity_<%= user_activity_id %>">
|
||||
<div class="homepagePostBrief">
|
||||
<div class="homepagePostPortrait">
|
||||
<%= link_to image_tag(url_to_avatar(activity.author), :width => "50", :height => "50"), user_path(activity.author_id), :alt => "用户头像" %>
|
||||
<%= render :partial => 'users/show_detail_info', :locals => {:user => activity.author} %>
|
||||
</div>
|
||||
<div class="homepagePostDes">
|
||||
<div class="homepagePostTo break_word mt-4">
|
||||
<% if activity.try(:author).try(:realname) == ' ' %>
|
||||
<%= link_to activity.try(:author), user_path(activity.author_id), :class => "newsBlue mr15" %>
|
||||
<% else %>
|
||||
<%= link_to activity.try(:author).try(:realname), user_path(activity.author_id), :class => "newsBlue mr15" %>
|
||||
<% end %> TO
|
||||
<%= link_to activity.project.name.to_s+" | 项目新闻", project_news_index_path(activity.project), :class => "newsBlue ml15" %>
|
||||
</div>
|
||||
<div class="homepagePostTitle break_word hidden fl m_w600"> <!--+"(通知标题)"-->
|
||||
<%= link_to activity.title.to_s, news_path(activity), :class => "postGrey" %>
|
||||
</div>
|
||||
<% if activity.sticky == 1%>
|
||||
<span class="sticky_btn_cir ml10">置顶</span>
|
||||
<% end%>
|
||||
<div class="cl"></div>
|
||||
<div class="homepagePostDate fl">
|
||||
发布时间:<%= format_time(activity.created_on) %>
|
||||
</div>
|
||||
<div class="homepagePostDate fl ml15">
|
||||
更新时间:<%= format_time(ForgeActivity.where("forge_act_type='#{activity.class}' and forge_act_id =#{activity.id}").first.updated_at) %>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<%=render :partial =>"users/intro_content", :locals=>{:user_activity_id =>user_activity_id, :content=>activity.description} %>
|
||||
<div class="cl"></div>
|
||||
<div id="intro_content_show_<%= user_activity_id %>" class="fr" style="display:none;"><a href="javascript:void(0);" class="linkBlue">[展开]</a></div>
|
||||
<div id="intro_content_hide_<%= user_activity_id %>" class="fr" style="display:none;"><a href="javascript:void(0);" class="linkBlue">[收起]</a></div>
|
||||
<div class="cl"></div>
|
||||
<div class="mt10" style="font-weight:normal;">
|
||||
<%= render :partial=>"attachments/activity_attach", :locals=>{:activity => activity} %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<% count=activity.comments.count %>
|
||||
<div class="homepagePostReply">
|
||||
<div class="homepagePostReplyBanner">
|
||||
<div class="homepagePostReplyBannerCount">回复
|
||||
<sapn class="mr15"><%= count>0 ? "(#{count})" : "" %></sapn><span style="color: #cecece;">▪</span>
|
||||
<span id="praise_count_<%=user_activity_id %>">
|
||||
<% if activity.author == User.current %>
|
||||
<span class="ml15 likeButton" title="不能自己赞自己哦!"> <span class="likeText">赞</span><span class="likeNum"><%= get_praise_num(activity) > 0 ? "(#{get_praise_num(activity)})" : "" %></span></span>
|
||||
<% else %>
|
||||
<%=render :partial=> "praise_tread/praise", :locals => {:activity=>activity, :user_activity_id=>user_activity_id,:type=>"activity"}%>
|
||||
<% end %>
|
||||
</span>
|
||||
</div>
|
||||
<div class="homepagePostReplyBannerTime"><%#= format_date(activity.updated_on) %></div>
|
||||
<%if count>3 %>
|
||||
<div class="homepagePostReplyBannerMore">
|
||||
<a id="reply_btn_<%=user_activity_id%>" onclick="expand_reply('#reply_div_<%= user_activity_id %> li','#reply_btn_<%=user_activity_id%>')" data-count="<%= count %>" data-init="0" class=" replyGrey" href="javascript:void(0)" value="show_help" >
|
||||
展开更多
|
||||
</a>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<% replies_all_i = 0 %>
|
||||
<% if count > 0 %>
|
||||
<div class="" id="reply_div_<%= user_activity_id %>">
|
||||
<ul>
|
||||
<% activity.comments.reorder("created_on desc").each do |comment| %>
|
||||
<script type="text/javascript">
|
||||
$(function(){
|
||||
showNormalImage('reply_content_<%= comment.id %>');
|
||||
});
|
||||
</script>
|
||||
<% replies_all_i = replies_all_i + 1 %>
|
||||
<li class="homepagePostReplyContainer" nhname="reply_rec" style="display:<%= replies_all_i > 3 ? 'none' : '' %>">
|
||||
<div class="homepagePostReplyPortrait">
|
||||
<%= link_to image_tag(url_to_avatar(comment.author), :width => "33", :height => "33"), user_path(comment.author_id), :alt => "用户头像" %>
|
||||
</div>
|
||||
<div class="homepagePostReplyDes">
|
||||
<div class="homepagePostReplyPublisher mt-4">
|
||||
<% if comment.try(:author).try(:realname) == ' ' %>
|
||||
<%= link_to comment.try(:author), user_path(comment.author_id), :class => "newsBlue mr10 f14" %>
|
||||
<% else %>
|
||||
<%= link_to comment.try(:author).try(:realname), user_path(comment.author_id), :class => "newsBlue mr10 f14" %>
|
||||
<% end %>
|
||||
<%= format_time(comment.created_on) %>
|
||||
<span id="reply_praise_count_<%=comment.id %>">
|
||||
<% if comment.author == User.current %>
|
||||
<span class="fr likeButton" title="不能自己赞自己哦!"> <span class="likeText">赞</span><span class="likeNum"><%= get_praise_num(comment) > 0 ? "(#{get_praise_num(comment)})" : "" %></span></span>
|
||||
<% else %>
|
||||
<%=render :partial=> "praise_tread/praise", :locals => {:activity=>comment, :user_activity_id=>comment.id,:type=>"reply"}%>
|
||||
<% end %>
|
||||
</span>
|
||||
</div>
|
||||
<div class="homepagePostReplyContent break_word list_style upload_img table_maxWidth" id="reply_content_<%= comment.id %>">
|
||||
<%= comment.comments.html_safe %></div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<div class="homepagePostReplyContainer borderBottomNone minHeight48">
|
||||
<div class="homepagePostReplyPortrait mr15 imageFuzzy" id="reply_image_<%= user_activity_id%>"><%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(activity.author_id), :alt => "用户头像" %></div>
|
||||
<div class="homepagePostReplyInputContainer mb10">
|
||||
<div nhname='new_message_<%= user_activity_id%>' style="display:none;">
|
||||
<%= form_for('new_form',:url => {:controller => 'comments', :action => 'create', :id => activity},:method => "post", :remote => true) do |f|%>
|
||||
<input type="hidden" name="user_activity_id" value="<%=user_activity_id%>">
|
||||
<div nhname='toolbar_container_<%= user_activity_id%>'></div>
|
||||
<textarea placeholder="有问题或有建议,请直接给我留言吧!" style="display: none" nhname='new_message_textarea_<%= user_activity_id%>' name="comment"></textarea>
|
||||
<a id="new_message_submit_btn_<%= user_activity_id%>" href="javascript:void(0)" onclick="this.style.display='none'" class="blue_n_btn fr" style="display:none;margin-top:6px;">发送</a>
|
||||
<div class="cl"></div>
|
||||
<p nhname='contentmsg_<%= user_activity_id%>'></p>
|
||||
<% end%>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
|
@ -1,81 +1,81 @@
|
|||
<%= call_hook(:view_repositories_show_contextual, {:repository => @repository, :project => @project}) %>
|
||||
<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>
|
||||
<div class="repository_con" style="line-height:1.9;">
|
||||
<% if @entries.nil? %>
|
||||
<%# 未提交代码提示 %>
|
||||
<div class=" repository-url light-well">
|
||||
<% if @entries.nil? && authorize_for('repositories', 'browse') %>
|
||||
<div class="page-title">
|
||||
该版本库还没有上传代码!
|
||||
</div>
|
||||
<% end %>
|
||||
<% if @repository.type.to_s=="Repository::Gitlab" %>
|
||||
版本库地址:<%= @repos_url %>
|
||||
<% else %>
|
||||
版本库地址:<%= h @repository.url %>
|
||||
<% end %>
|
||||
<!-- added by bai -->
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<% else %>
|
||||
<%= render :partial => 'navigation' %>
|
||||
<div class="fl c_grey02 mt5 mr5">克隆网址:</div>
|
||||
<textarea id="copy_rep_content" class="cloneUrl mt5 fl" type="input" ><%= @repository.type.to_s=="Repository::Gitlab" ? @repos_url.to_s.lstrip : @repository.url %></textarea>
|
||||
<a href="javascript:void(0);" class="clone_btn mt5" onclick="jsCopy()"><span class="vl_copy" title="点击复制版本库地址"></span></a>
|
||||
<div class="fl mt5 ml15"><a href="javascript:void(0);" class="vl_btn fb" onclick="zip()"><span class="vl_zip"></span>ZIP</a> </div>
|
||||
<%# 针对公开项目:用户必须创建了项目,否则用户无法同步 %>
|
||||
<% if User.current.id != @project.user_id %>
|
||||
<div class="fr mt5"><%= link_to "<span class='vl_fork'></span>".html_safe+"Fork", {:controller => 'repositories', :action => 'forked'}, :class=>"vl_btn", :confirm=>"平台将为您创建一个新的同名项目和版本库,请问是否继续?" %>
|
||||
<span href="javascript:void(0);" class="vl_btn_2 fb"><%= @project.forked_count.to_i %></span>
|
||||
</div>
|
||||
<% end %>
|
||||
<div class="cl"></div>
|
||||
<div class="recordBanner mt10">
|
||||
<% if @changesets && !@changesets.empty? %>
|
||||
<% if !user_commit_rep(@changesets_latest_coimmit.author_email).nil? %>
|
||||
<%= image_tag(url_to_avatar(user_commit_rep(@changesets_latest_coimmit.author_email)), :width => "25", :height => "25", :class => "fl portraitRadius mt2 ml4 mr5") %>
|
||||
<span class="fl"><div class="fb fontGrey3 mr5 fl hidden maxwidth150"><%=link_to user_commit_rep(@changesets_latest_coimmit.author_email), user_path(user_commit_rep(@changesets_latest_coimmit.author_email)) %></div>
|
||||
<div class="fl">提交于<%= time_tag(@changesets_latest_coimmit.created_at) %>:</div>
|
||||
<div class="commit_content_dec fl" title="<%= @changesets_latest_coimmit.comments %>"><%= @changesets_latest_coimmit.message %></div>
|
||||
</span>
|
||||
<% else %>
|
||||
<span class="fl"><div class="fb fontGrey3 mr5 fl hidden maxwidth150"><%=@changesets_latest_coimmit.author_email %></div>
|
||||
<div class="fl">提交于<%= time_tag(@changesets_latest_coimmit.created_at) %>:</div>
|
||||
<div class="commit_content_dec fl" title="<%= @changesets_latest_coimmit.comments %>"><%= @changesets_latest_coimmit.message %></div>
|
||||
</span>
|
||||
<%end%>
|
||||
<% end %>
|
||||
<span class="fr mr5 "><font class="fb ml2 mr2 vl_branch mt2">
|
||||
<%= @repository.branches.count %></font> 个分支
|
||||
</span>
|
||||
|
||||
<span class="fr mr5"><font class="fb ml2 mr2 vl_commit">
|
||||
<%=link_to @changesets_all_count, {:action => 'changes', :path => to_path_param(@path), :id => @project, :repository_id => @repository.identifier_param, :rev => @rev,:page=>1 ,:commit_count =>"#{@changesets_all_count}"} %></font> 提交
|
||||
|
||||
</span>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<!--contextual end-->
|
||||
|
||||
<% if !@entries.nil? && authorize_for('repositories', 'browse') %>
|
||||
<%# 数据统计 %>
|
||||
<%#= render :partial => 'summary' %>
|
||||
<%# end %>
|
||||
<%= render :partial => 'dir_list' %>
|
||||
<% end %>
|
||||
<%#= render_properties(@properties) %>
|
||||
|
||||
<!-- 代码修订 -->
|
||||
<%#= render_properties(@properties) %>
|
||||
|
||||
|
||||
<a href="https://<%=Setting.host_name %>/forums/1/memos/1232" >如何提交代码</a>
|
||||
</div>
|
||||
<% content_for :header_tags do %>
|
||||
<%= stylesheet_link_tag "scm" %>
|
||||
<% end %>
|
||||
|
||||
<% html_title(l(:label_repository)) -%>
|
||||
<%= call_hook(:view_repositories_show_contextual, {:repository => @repository, :project => @project}) %>
|
||||
<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>
|
||||
<div class="repository_con" style="line-height:1.9;">
|
||||
<% if @entries.nil? %>
|
||||
<%# 未提交代码提示 %>
|
||||
<div class=" repository-url light-well">
|
||||
<% if @entries.nil? && authorize_for('repositories', 'browse') %>
|
||||
<div class="page-title">
|
||||
该版本库还没有上传代码!
|
||||
</div>
|
||||
<% end %>
|
||||
<% if @repository.type.to_s=="Repository::Gitlab" %>
|
||||
版本库地址:<%= @repos_url %>
|
||||
<% else %>
|
||||
版本库地址:<%= h @repository.url %>
|
||||
<% end %>
|
||||
<!-- added by bai -->
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<% else %>
|
||||
<%= render :partial => 'navigation' %>
|
||||
<div class="fl c_grey02 mt5 mr5">克隆网址:</div>
|
||||
<textarea id="copy_rep_content" class="cloneUrl mt5 fl" type="input" ><%= @repository.type.to_s=="Repository::Gitlab" ? @repos_url.to_s.lstrip : @repository.url %></textarea>
|
||||
<a href="javascript:void(0);" class="clone_btn mt5" onclick="jsCopy()"><span class="vl_copy" title="点击复制版本库地址"></span></a>
|
||||
<div class="fl mt5 ml15"><a href="javascript:void(0);" class="vl_btn fb" onclick="zip()"><span class="vl_zip"></span>ZIP</a> </div>
|
||||
<%# 针对公开项目:用户必须创建了项目,否则用户无法同步 %>
|
||||
<% if User.current.id != @project.user_id %>
|
||||
<div class="fr mt5"><%= link_to "<span class='vl_fork'></span>".html_safe+"Fork", {:controller => 'repositories', :action => 'forked'}, :class=>"vl_btn", :target => "_blank", :confirm=>"平台将为您创建一个新的同名项目和版本库,请问是否继续?" %>
|
||||
<span href="javascript:void(0);" class="vl_btn_2 fb"><%= @project.forked_count.to_i %></span>
|
||||
</div>
|
||||
<% end %>
|
||||
<div class="cl"></div>
|
||||
<div class="recordBanner mt10">
|
||||
<% if @changesets && !@changesets.empty? %>
|
||||
<% if !user_commit_rep(@changesets_latest_coimmit.author_email).nil? %>
|
||||
<%= image_tag(url_to_avatar(user_commit_rep(@changesets_latest_coimmit.author_email)), :width => "25", :height => "25", :class => "fl portraitRadius mt2 ml4 mr5") %>
|
||||
<span class="fl"><div class="fb fontGrey3 mr5 fl hidden maxwidth150"><%=link_to user_commit_rep(@changesets_latest_coimmit.author_email), user_path(user_commit_rep(@changesets_latest_coimmit.author_email)) %></div>
|
||||
<div class="fl">提交于<%= time_tag(@changesets_latest_coimmit.created_at) %>:</div>
|
||||
<div class="commit_content_dec fl" title="<%= @changesets_latest_coimmit.comments %>"><%= @changesets_latest_coimmit.message %></div>
|
||||
</span>
|
||||
<% else %>
|
||||
<span class="fl"><div class="fb fontGrey3 mr5 fl hidden maxwidth150"><%=@changesets_latest_coimmit.author_email %></div>
|
||||
<div class="fl">提交于<%= time_tag(@changesets_latest_coimmit.created_at) %>:</div>
|
||||
<div class="commit_content_dec fl" title="<%= @changesets_latest_coimmit.comments %>"><%= @changesets_latest_coimmit.message %></div>
|
||||
</span>
|
||||
<%end%>
|
||||
<% end %>
|
||||
<span class="fr mr5 "><font class="fb ml2 mr2 vl_branch mt2">
|
||||
<%= @repository.branches.count %></font> 个分支
|
||||
</span>
|
||||
|
||||
<span class="fr mr5"><font class="fb ml2 mr2 vl_commit">
|
||||
<%=link_to @changesets_all_count, {:action => 'changes', :path => to_path_param(@path), :id => @project, :repository_id => @repository.identifier_param, :rev => @rev,:page=>1 ,:commit_count =>"#{@changesets_all_count}"} %></font> 提交
|
||||
|
||||
</span>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<!--contextual end-->
|
||||
|
||||
<% if !@entries.nil? && authorize_for('repositories', 'browse') %>
|
||||
<%# 数据统计 %>
|
||||
<%#= render :partial => 'summary' %>
|
||||
<%# end %>
|
||||
<%= render :partial => 'dir_list' %>
|
||||
<% end %>
|
||||
<%#= render_properties(@properties) %>
|
||||
|
||||
<!-- 代码修订 -->
|
||||
<%#= render_properties(@properties) %>
|
||||
|
||||
|
||||
<a href="https://<%=Setting.host_name %>/forums/1/memos/1232" >如何提交代码</a>
|
||||
</div>
|
||||
<% content_for :header_tags do %>
|
||||
<%= stylesheet_link_tag "scm" %>
|
||||
<% end %>
|
||||
|
||||
<% html_title(l(:label_repository)) -%>
|
||||
|
|
|
@ -2,8 +2,16 @@
|
|||
<li class="hworkList340 hworkH30 <%= @homework.homework_type == 2 ? '' : 'width385'%>">
|
||||
<span class="c_dark f14 fb fl <%= @homework.homework_type == 2 ? 'mr90 ml50' : 'mr150 ml50'%>">作品名称</span>
|
||||
<% if @homework.homework_type != 3 %>
|
||||
<span class="c_dark f14 fb fl mr50">姓名</span>
|
||||
<span class="c_dark f14 fb fl">学号</span>
|
||||
<!--<span class="c_dark f14 fb fl mr50">姓名</span>-->
|
||||
<%= link_to "姓名",@show_all ? student_work_index_path(:homework => @homework.id,:order => "lastname", :sort => @score, :name => @name, :group => @group) : "javascript:void(0)",:class => "c_dark f14 fb fl" ,:remote => true%>
|
||||
<% if @show_all && @order == "lastname"%>
|
||||
<%= link_to "", student_work_index_path(:homework => @homework.id,:order => "lastname", :sort => @score, :name => @name, :group => @group) ,:class => "#{@score == 'desc' ? 'st_up' : 'st_down'} mt10" ,:remote => true%>
|
||||
<% end%>
|
||||
<!--<span class="c_dark f14 fb fl">学号</span>-->
|
||||
<%= link_to "学号",@show_all ? student_work_index_path(:homework => @homework.id,:order => "student_id", :sort => @score, :name => @name, :group => @group) : "javascript:void(0)",:class => "c_dark f14 fb fl ml50" ,:remote => true%>
|
||||
<% if @show_all && @order == "student_id"%>
|
||||
<%= link_to "", student_work_index_path(:homework => @homework.id,:order => "student_id", :sort => @score, :name => @name, :group => @group) ,:class => "#{@score == 'desc' ? 'st_up' : 'st_down'} mt10" ,:remote => true%>
|
||||
<% end%>
|
||||
<% elsif @homework.homework_type == 3 && @homework.homework_detail_group.base_on_project == 1 %>
|
||||
<span class="c_dark f14 fb fl">关联项目</span>
|
||||
<% end %>
|
||||
|
|
|
@ -1,102 +1,102 @@
|
|||
<!-- 匿评作品列表,显示某一个作品的信息 -->
|
||||
<ul class="hworkListRow" id="student_work_<%= student_work.id%>">
|
||||
<li class="hworkList340 <%= @homework.homework_type == 2 ? '' : 'width385'%>">
|
||||
<ul>
|
||||
<li class="hworkPortrait mt15 mr10">
|
||||
<%= link_to(image_tag(url_to_avatar(student_work.user),:width =>"40",:height => "40"),user_activities_path(student_work.user)) %>
|
||||
</li>
|
||||
<div onclick="show_student_work('<%= student_work_path(student_work)%>');" style="cursor: pointer;" class="student_work_<%= student_work.id%>">
|
||||
<li class="hworkName mt15 mr15 <%= @homework.homework_type == 2 ? '' : 'width165'%>">
|
||||
<% student_work_name = student_work.name.nil? || student_work.name.empty? ? student_work.user.show_name + '的作品' : student_work.name%>
|
||||
<div>
|
||||
<%= link_to student_work_name,"javascript:void(0)" ,:title => student_work_name, :class => "linkGrey f14 StudentName break_word #{@homework.homework_type == 2 ? '' : 'width165'}"%>
|
||||
</div>
|
||||
</li>
|
||||
<li>
|
||||
<% if @homework.homework_type != 3 %>
|
||||
<ul class="mt10 fl">
|
||||
<li class="hworkStName mr10 mt16" title="姓名">
|
||||
<%= student_work.user.show_name%>
|
||||
</li>
|
||||
<li class="hworkStID mt16" title="学号">
|
||||
<%= student_work.user.user_extensions.nil? ? "--" : student_work.user.user_extensions.student_id%>
|
||||
</li>
|
||||
</ul>
|
||||
<% elsif @homework.homework_type == 3 && @homework.homework_detail_group.base_on_project == 1 %>
|
||||
<ul class="mt10 fl">
|
||||
<li class="hworkPrName mr10 mt12" title="项目名称">
|
||||
<%= student_work.project.name %>
|
||||
</li>
|
||||
</ul>
|
||||
<% end %>
|
||||
</li>
|
||||
</div>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="hworkList130 c_grey student_work_<%= student_work.id%>" onclick="show_student_work('<%= student_work_path(student_work)%>');" style="cursor: pointer;">
|
||||
<% if student_work.created_at && @homework.end_time%>
|
||||
<%= Time.parse(format_time(student_work.created_at)).strftime("%m-%d %H:%M")%>
|
||||
<% if Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") < Time.parse(format_time(student_work.created_at)).strftime("%Y-%m-%d") %>
|
||||
<span class="c_red">[迟交]</span>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</li>
|
||||
<li class="hworkList50 <%= score_color student_work.teacher_score%>">
|
||||
<%= student_work.teacher_score.nil? ? "--" : format("%.1f",student_work.teacher_score)%>
|
||||
</li>
|
||||
<li class="hworkList50 <%= score_color student_work.teaching_asistant_score%>">
|
||||
<%= student_work.teaching_asistant_score.nil? ? "--" : format("%.1f",student_work.teaching_asistant_score)%>
|
||||
</li>
|
||||
|
||||
<% if @homework.homework_type == 2%>
|
||||
<!-- 系统评分 -->
|
||||
<li class="hworkList50 <%= score_color student_work.system_score%>">
|
||||
<%= student_work.system_score.nil? ? "--" : format("%.1f",student_work.system_score)%>
|
||||
</li>
|
||||
<% end%>
|
||||
|
||||
<% if @homework.anonymous_comment == 0%>
|
||||
<li class="hworkList50 <%= score_color student_work.student_score%> student_score_info">
|
||||
<%= student_work.student_score.nil? ? "未参与" : format("%.1f",student_work.student_score)%>
|
||||
<% unless student_work.student_score.nil?%>
|
||||
<span class="linkBlue">
|
||||
(<%= student_work.student_works_scores.where(:reviewer_role => 3).count%>)
|
||||
</span>
|
||||
<div class="infoNi none">
|
||||
现共有
|
||||
<span class="c_red"> <%= student_work.student_works_scores.where(:reviewer_role => 3).count%> </span>
|
||||
名学生进行了匿评,平均分为
|
||||
<span class="c_red"> <%= format("%.1f",student_work.student_score)%> </span>分。
|
||||
</div>
|
||||
<% end%>
|
||||
</li>
|
||||
<% end %>
|
||||
<!-- 成绩 -->
|
||||
<% score = student_work.respond_to?("score") ? student_work.score : (student_work.final_score || 0) - student_work.absence_penalty - student_work.late_penalty%>
|
||||
<li class="hworkList50 <%= score_color score%> student_final_scor_info">
|
||||
<%= score.nil? ? "--" : format("%.1f",score<0 ? 0 : score)%>
|
||||
<% unless score.nil?%>
|
||||
<div class="infoNi none width180">
|
||||
作品最终评分为
|
||||
<span class="c_red"> <%= student_work.final_score%> </span>分。
|
||||
迟交扣分
|
||||
<span class="c_red"> <%= student_work.late_penalty%> </span>分,
|
||||
缺评扣分
|
||||
<span class="c_red"> <%= student_work.absence_penalty%> </span>分,
|
||||
最终成绩为
|
||||
<span class="c_red"> <%= format("%.1f",score<0 ? 0 : score)%> </span>分。
|
||||
</div>
|
||||
<% end%>
|
||||
</li>
|
||||
<li class="hworkTip" style="display: none" id="work_click_<%= student_work.id%>"><em></em><span></span><font class="fontGrey2">点击查看详情</font></li>
|
||||
</ul>
|
||||
<script type="text/javascript">
|
||||
$(".student_work_<%= student_work.id%>").mouseenter(function(){
|
||||
if($("#about_hwork_<%= student_work.id%>").html().trim() == "") {
|
||||
$("#work_click_<%= student_work.id%>").show();
|
||||
}
|
||||
}).mouseleave(function(){
|
||||
$("#work_click_<%= student_work.id%>").hide();
|
||||
}).mouse;
|
||||
</script>
|
||||
|
||||
<!-- 匿评作品列表,显示某一个作品的信息 -->
|
||||
<ul class="hworkListRow" id="student_work_<%= student_work.id%>">
|
||||
<li class="hworkList340 <%= @homework.homework_type == 2 ? '' : 'width385'%>">
|
||||
<ul>
|
||||
<li class="hworkPortrait mt15 mr10">
|
||||
<%= link_to(image_tag(url_to_avatar(student_work.user),:width =>"40",:height => "40"),user_activities_path(student_work.user)) %>
|
||||
</li>
|
||||
<div onclick="show_student_work('<%= student_work_path(student_work)%>');" style="cursor: pointer;" class="student_work_<%= student_work.id%>">
|
||||
<li class="hworkName mt15 mr15 <%= @homework.homework_type == 2 ? '' : 'width165'%>">
|
||||
<% student_work_name = student_work.name.nil? || student_work.name.empty? ? student_work.user.show_name + '的作品' : student_work.name%>
|
||||
<div>
|
||||
<%= link_to student_work_name,"javascript:void(0)" ,:title => student_work_name, :class => "linkGrey f14 StudentName break_word #{@homework.homework_type == 2 ? '' : 'width165'}"%>
|
||||
</div>
|
||||
</li>
|
||||
<li>
|
||||
<% if @homework.homework_type != 3 %>
|
||||
<ul class="mt10 fl">
|
||||
<li class="hworkStName mr10 mt16" title="<%= student_work.user.show_name%>">
|
||||
<%= student_work.user.show_name%>
|
||||
</li>
|
||||
<li class="hworkStID mt16" title="<%= student_work.user.user_extensions.nil? ? "--" : student_work.user.user_extensions.student_id%>">
|
||||
<%= student_work.user.user_extensions.nil? ? "--" : student_work.user.user_extensions.student_id%>
|
||||
</li>
|
||||
</ul>
|
||||
<% elsif @homework.homework_type == 3 && @homework.homework_detail_group.base_on_project == 1 %>
|
||||
<ul class="mt10 fl">
|
||||
<li class="hworkPrName mr10 mt12" title="项目名称">
|
||||
<%= student_work.project.name %>
|
||||
</li>
|
||||
</ul>
|
||||
<% end %>
|
||||
</li>
|
||||
</div>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="hworkList130 c_grey student_work_<%= student_work.id%>" onclick="show_student_work('<%= student_work_path(student_work)%>');" style="cursor: pointer;">
|
||||
<% if student_work.created_at && @homework.end_time%>
|
||||
<%= Time.parse(format_time(student_work.created_at)).strftime("%m-%d %H:%M")%>
|
||||
<% if Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") < Time.parse(format_time(student_work.created_at)).strftime("%Y-%m-%d") %>
|
||||
<span class="c_red">[迟交]</span>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</li>
|
||||
<li class="hworkList50 <%= score_color student_work.teacher_score%>">
|
||||
<%= student_work.teacher_score.nil? ? "--" : format("%.1f",student_work.teacher_score)%>
|
||||
</li>
|
||||
<li class="hworkList50 <%= score_color student_work.teaching_asistant_score%>">
|
||||
<%= student_work.teaching_asistant_score.nil? ? "--" : format("%.1f",student_work.teaching_asistant_score)%>
|
||||
</li>
|
||||
|
||||
<% if @homework.homework_type == 2%>
|
||||
<!-- 系统评分 -->
|
||||
<li class="hworkList50 <%= score_color student_work.system_score%>">
|
||||
<%= student_work.system_score.nil? ? "--" : format("%.1f",student_work.system_score)%>
|
||||
</li>
|
||||
<% end%>
|
||||
|
||||
<% if @homework.anonymous_comment == 0%>
|
||||
<li class="hworkList50 <%= score_color student_work.student_score%> student_score_info">
|
||||
<%= student_work.student_score.nil? ? "未参与" : format("%.1f",student_work.student_score)%>
|
||||
<% unless student_work.student_score.nil?%>
|
||||
<span class="linkBlue">
|
||||
(<%= student_work.student_works_scores.where(:reviewer_role => 3).count%>)
|
||||
</span>
|
||||
<div class="infoNi none">
|
||||
现共有
|
||||
<span class="c_red"> <%= student_work.student_works_scores.where(:reviewer_role => 3).count%> </span>
|
||||
名学生进行了匿评,平均分为
|
||||
<span class="c_red"> <%= format("%.1f",student_work.student_score)%> </span>分。
|
||||
</div>
|
||||
<% end%>
|
||||
</li>
|
||||
<% end %>
|
||||
<!-- 成绩 -->
|
||||
<% score = student_work.respond_to?("score") ? student_work.score : (student_work.final_score || 0) - student_work.absence_penalty - student_work.late_penalty%>
|
||||
<li class="hworkList50 <%= score_color score%> student_final_scor_info">
|
||||
<%= score.nil? ? "--" : format("%.1f",score<0 ? 0 : score)%>
|
||||
<% unless score.nil?%>
|
||||
<div class="infoNi none width180">
|
||||
作品最终评分为
|
||||
<span class="c_red"> <%= student_work.final_score%> </span>分。
|
||||
迟交扣分
|
||||
<span class="c_red"> <%= student_work.late_penalty%> </span>分,
|
||||
缺评扣分
|
||||
<span class="c_red"> <%= student_work.absence_penalty%> </span>分,
|
||||
最终成绩为
|
||||
<span class="c_red"> <%= format("%.1f",score<0 ? 0 : score)%> </span>分。
|
||||
</div>
|
||||
<% end%>
|
||||
</li>
|
||||
<li class="hworkTip" style="display: none" id="work_click_<%= student_work.id%>"><em></em><span></span><font class="fontGrey2">点击查看详情</font></li>
|
||||
</ul>
|
||||
<script type="text/javascript">
|
||||
$(".student_work_<%= student_work.id%>").mouseenter(function(){
|
||||
if($("#about_hwork_<%= student_work.id%>").html().trim() == "") {
|
||||
$("#work_click_<%= student_work.id%>").show();
|
||||
}
|
||||
}).mouseleave(function(){
|
||||
$("#work_click_<%= student_work.id%>").hide();
|
||||
}).mouse;
|
||||
</script>
|
||||
|
||||
|
|
|
@ -21,10 +21,10 @@
|
|||
<li onclick="show_student_work('<%= student_work_path(student_work)%>');" style="cursor: pointer;" class="student_work_<%= student_work.id%>">
|
||||
<% if @homework.homework_type != 3 %>
|
||||
<ul class="mt10 fl">
|
||||
<li class="hworkStName mr10 mt16" title="姓名">
|
||||
<li class="hworkStName mr10 mt16" title="<%= student_work.user.show_name%>">
|
||||
<%= student_work.user.show_name%>
|
||||
</li>
|
||||
<li class="hworkStID mt16" title="学号">
|
||||
<li class="hworkStID mt16" title="<%= student_work.user.user_extensions.nil? ? "--" : student_work.user.user_extensions.student_id%>">
|
||||
<%= student_work.user.user_extensions.nil? ? "--" : student_work.user.user_extensions.student_id%>
|
||||
</li>
|
||||
</ul>
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
|
||||
<li >
|
||||
<span class="tit_fb ">编程代码:</span>
|
||||
<div class="showHworkP break_word"><pre id="work-src" style="display: none;"><%= work.description if work.description%></pre><div class="fontGrey2 font_cus" id="work-code">
|
||||
<div class="showHworkP break_word"><pre id="work-src" style="display: none;"><%= work.description if work.description%></pre><div class="fontGrey2 font_cus" id="work-code_<%= work.id%>">
|
||||
</div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
|
|
|
@ -63,7 +63,7 @@
|
|||
} else if(language==4){
|
||||
program_name = 'text/x-java';
|
||||
}
|
||||
var editor = CodeMirror(document.getElementById("work-code"), {
|
||||
var editor = CodeMirror(document.getElementById("work-code_<%= work.id%>"), {
|
||||
mode: {name: program_name,
|
||||
version: 2,
|
||||
singleLineStringErrors: false},
|
||||
|
|
|
@ -1,36 +1,36 @@
|
|||
if($("#about_hwork_<%= @work.id%>").children().length > 0){
|
||||
$("#about_hwork_<%= @work.id%>").html("");
|
||||
}
|
||||
else{
|
||||
<% if @homework.homework_type == 2%>
|
||||
$("#about_hwork_<%= @work.id%>").html("<%= escape_javascript(render :partial => 'programing_work_show',:locals => {:work =>@work,:score =>@score,:student_work_scores => @student_work_scores}) %>");
|
||||
|
||||
var program_name = "text/x-csrc";
|
||||
var language = <%= @homework.language %>;
|
||||
if (language == 1) {
|
||||
program_name = 'text/x-csrc';
|
||||
} else if(language==2){
|
||||
program_name = 'text/x-c++src';
|
||||
}else if(language==3){
|
||||
program_name = 'text/x-cython';
|
||||
} else if(language==4){
|
||||
program_name = 'text/x-java';
|
||||
}
|
||||
|
||||
var editor = CodeMirror(document.getElementById("work-code"), {
|
||||
mode: {name: program_name,
|
||||
version: 2,
|
||||
singleLineStringErrors: false},
|
||||
lineNumbers: true,
|
||||
indentUnit: 2,
|
||||
matchBrackets: true,
|
||||
readOnly: true,
|
||||
value: $("#work-src").text()
|
||||
}
|
||||
);
|
||||
|
||||
<% else%>
|
||||
$("#about_hwork_<%= @work.id%>").html("<%= escape_javascript(render :partial => 'show',:locals => {:work =>@work,:score =>@score,:student_work_scores => @student_work_scores}) %>");
|
||||
<% end%>
|
||||
$('#score_<%= @work.id%>').peSlider({range: 'min'});
|
||||
if($("#about_hwork_<%= @work.id%>").children().length > 0){
|
||||
$("#about_hwork_<%= @work.id%>").html("");
|
||||
}
|
||||
else{
|
||||
<% if @homework.homework_type == 2%>
|
||||
$("#about_hwork_<%= @work.id%>").html("<%= escape_javascript(render :partial => 'programing_work_show',:locals => {:work =>@work,:score =>@score,:student_work_scores => @student_work_scores}) %>");
|
||||
|
||||
var program_name = "text/x-csrc";
|
||||
var language = <%= @homework.language %>;
|
||||
if (language == 1) {
|
||||
program_name = 'text/x-csrc';
|
||||
} else if(language==2){
|
||||
program_name = 'text/x-c++src';
|
||||
}else if(language==3){
|
||||
program_name = 'text/x-cython';
|
||||
} else if(language==4){
|
||||
program_name = 'text/x-java';
|
||||
}
|
||||
|
||||
var editor = CodeMirror(document.getElementById("work-code_<%= @work.id%>"), {
|
||||
mode: {name: program_name,
|
||||
version: 2,
|
||||
singleLineStringErrors: false},
|
||||
lineNumbers: true,
|
||||
indentUnit: 2,
|
||||
matchBrackets: true,
|
||||
readOnly: true,
|
||||
value: $("#work-src").text()
|
||||
}
|
||||
);
|
||||
|
||||
<% else%>
|
||||
$("#about_hwork_<%= @work.id%>").html("<%= escape_javascript(render :partial => 'show',:locals => {:work =>@work,:score =>@score,:student_work_scores => @student_work_scores}) %>");
|
||||
<% end%>
|
||||
$('#score_<%= @work.id%>').peSlider({range: 'min'});
|
||||
}
|
|
@ -47,7 +47,7 @@
|
|||
<% end%>
|
||||
<div class="cl"></div>
|
||||
<% if activity.homework_type == 3 && activity.homework_detail_group.base_on_project == 1%>
|
||||
<span class="c_red">系统提示:该作业要求各组长<%=link_to "创建项目", new_project_path(:host=>Setting.host_name),:class=>"c_red",:title=>"新建项目",:style=>"text-decoration:underline;"%>,组成员加入项目,然后由组长关联项目。谢谢配合!</span>
|
||||
<span class="c_red">系统提示:该作业要求各组长<%=link_to "创建项目", new_project_path(:host=>Setting.host_name),:class=>"linkBlue",:title=>"新建项目",:style=>"text-decoration:underline;"%>,组成员加入项目,然后由组长关联项目。谢谢配合!</span>
|
||||
<% elsif activity.homework_type == 3 && activity.homework_detail_group.base_on_project == 0%>
|
||||
<span class="c_red">系统提示:该作业要求各组长提交作品,提交作品时请添加组成员。谢谢配合!</span>
|
||||
<% end %>
|
||||
|
@ -153,8 +153,18 @@
|
|||
<% end %>
|
||||
<% student_works.each_with_index do |sw, i| %>
|
||||
<div class="fl mr10 w100" style="text-align:center;">
|
||||
<a href="javascript:void(0);" class="linkBlue"><%= link_to image_tag(url_to_avatar(User.find sw.user_id), :width => "40", :height => "40"), student_work_index_path(:homework => activity.id), :alt => "学生头像" %>
|
||||
<p class="w100 hidden"><%= link_to sw.user.show_name, student_work_index_path(:homework => activity.id)%></p>
|
||||
<a href="javascript:void(0);" class="linkBlue">
|
||||
<% if User.current.member_of_course?(activity.course) || User.current.admin? || activity.is_open == 1 %>
|
||||
<%= link_to image_tag(url_to_avatar(User.find sw.user_id), :width => "40", :height => "40"), student_work_index_path(:homework => activity.id), :alt => "学生头像" %>
|
||||
<p class="w100 hidden">
|
||||
<%= link_to sw.user.show_name, student_work_index_path(:homework => activity.id)%>
|
||||
</p>
|
||||
<% else %>
|
||||
<%= image_tag(url_to_avatar(User.find sw.user_id), :width => "40", :height => "40", :title => '该作业的作品暂未公开') %>
|
||||
<p class="w100 hidden">
|
||||
<a href="javascript:void(0);" title="该作业的作品暂未公开"><%=sw.user.show_name %></a>
|
||||
</p>
|
||||
<% end %>
|
||||
</a>
|
||||
<% score = sw.respond_to?("score") ? sw.score : (sw.final_score || 0) - sw.absence_penalty - sw.late_penalty %>
|
||||
<p class="fontGrey2">分数:<span class="c_red"><%=format("%.1f",score.to_i<0 ? 0 : score.to_i) %>分</span></p>
|
||||
|
@ -346,7 +356,7 @@
|
|||
<%= hidden_field_tag 'course_activity',params[:course_activity],:value =>course_activity %>
|
||||
<div nhname='toolbar_container_<%= user_activity_id%>'></div>
|
||||
<textarea placeholder="有问题或有建议,请直接给我留言吧!" style="display: none" nhname='new_message_textarea_<%= user_activity_id%>' name="homework_message"></textarea>
|
||||
<a id="new_message_submit_btn_<%= user_activity_id%>" href="javascript:void(0)" class="blue_n_btn fr" style="display:none;margin-top:6px;">发送</a>
|
||||
<a id="new_message_submit_btn_<%= user_activity_id%>" href="javascript:void(0)" onclick="this.style.display='none'" class="blue_n_btn fr" style="display:none;margin-top:6px;">发送</a>
|
||||
<div class="cl"></div>
|
||||
<p nhname='contentmsg_<%= user_activity_id%>'></p>
|
||||
<% end%>
|
||||
|
|
|
@ -1,110 +1,110 @@
|
|||
<div class="resources mt10" id="user_activity_<%= user_activity_id%>">
|
||||
<div class="homepagePostBrief">
|
||||
<div class="homepagePostPortrait">
|
||||
<%= link_to image_tag(url_to_avatar(activity.user), :width => "50", :height => "50"), user_path(activity.user_id), :alt => "用户头像" %>
|
||||
<%= render :partial => 'users/show_detail_info', :locals => {:user => activity.user} %>
|
||||
</div>
|
||||
<div class="homepagePostDes">
|
||||
<div class="homepagePostTo break_word mt-4">
|
||||
<% if activity.try(:user).try(:realname) == ' ' %>
|
||||
<%= link_to activity.try(:user), user_path(activity.user_id), :class => "newsBlue mr15" %>
|
||||
<% else %>
|
||||
<%= link_to activity.try(:user).try(:realname), user_path(activity.user_id), :class => "newsBlue mr15" %>
|
||||
<% end %> TO
|
||||
<% course=Course.find(activity.jour_id) %>
|
||||
<%= link_to course.name.to_s+" | 课程留言", course_feedback_path(course), :class => "newsBlue ml15" %>
|
||||
</div>
|
||||
<div class="homepagePostTitle break_word list_style upload_img">
|
||||
<% if activity.parent %>
|
||||
<%= link_to activity.parent.notes.html_safe, course_feedback_path(course), :class => "postGrey" %>
|
||||
<% else %>
|
||||
<%= link_to activity.notes.html_safe, course_feedback_path(course), :class => "postGrey" %>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="homepagePostDate fl">
|
||||
留言时间:<%= format_time(activity.created_on) %>
|
||||
</div>
|
||||
<div class="homepagePostDate fl ml15">
|
||||
更新时间:<%= format_time(CourseActivity.where("course_act_type='#{activity.class}' and course_act_id =#{activity.id}").first.updated_at) %>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<% count = fetch_user_leaveWord_reply(activity).count %>
|
||||
<div class="homepagePostReply">
|
||||
<div class="topBorder" style="display: <%= count>0 ? 'none': '' %>"></div>
|
||||
<div class="homepagePostReplyBanner" style="display: <%= count>0 ? '': 'none' %>">
|
||||
<div class="homepagePostReplyBannerCount">
|
||||
回复(<%= count %>)
|
||||
</div>
|
||||
<div class="homepagePostReplyBannerTime"></div>
|
||||
<%if count>3 %>
|
||||
<div class="homepagePostReplyBannerMore">
|
||||
<a id="reply_btn_<%=user_activity_id%>" onclick="expand_reply('#reply_div_<%= user_activity_id %> li','#reply_btn_<%=user_activity_id%>')" data-count="<%= count %>" data-init="0" class=" replyGrey" href="javascript:void(0)" value="show_help" >
|
||||
展开更多
|
||||
</a>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<% replies_all_i = 0 %>
|
||||
<% if count > 0 %>
|
||||
<div class="" id="reply_div_<%= user_activity_id %>">
|
||||
<ul>
|
||||
<% fetch_user_leaveWord_reply(activity).each do |comment| unless fetch_user_leaveWord_reply(activity).nil? %>
|
||||
<script type="text/javascript">
|
||||
$(function(){
|
||||
showNormalImage('reply_content_<%= comment.id %>');
|
||||
});
|
||||
</script>
|
||||
<% replies_all_i = replies_all_i + 1 %>
|
||||
<li class="homepagePostReplyContainer" nhname="reply_rec" style="display:<%= replies_all_i > 3 ? 'none' : '' %>">
|
||||
<div class="homepagePostReplyPortrait">
|
||||
<%= link_to image_tag(url_to_avatar(comment.user), :width => "33", :height => "33", :class =>"mt8"), user_path(comment.user_id), :alt => "用户头像" %>
|
||||
</div>
|
||||
<div class="homepagePostReplyDes">
|
||||
<div class="homepagePostReplyPublisher">
|
||||
<% if comment.try(:user).try(:realname) == ' ' %>
|
||||
<%= link_to comment.try(:user), user_path(comment.user_id), :class => "newsBlue mr10 f14" %>
|
||||
<% else %>
|
||||
<%= link_to comment.try(:user).try(:realname), user_path(comment.user_id), :class => "newsBlue mr10 f14" %>
|
||||
<% end %>
|
||||
<%= format_time(comment.created_on) %>
|
||||
</div>
|
||||
<div class="homepagePostReplyContent break_word list_style upload_img table_maxWidth" id="reply_content_<%= comment.id %>">
|
||||
<%= comment.notes.html_safe %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</li>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<div class="homepagePostReplyContainer borderBottomNone minHeight48">
|
||||
<div class="homepagePostReplyPortrait mr15 imageFuzzy" id="reply_image_<%= user_activity_id%>"><%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), :alt => "用户头像" %></div>
|
||||
<div class="homepagePostReplyInputContainer mb10">
|
||||
<div nhname='new_message_<%= user_activity_id%>' style="display:none;">
|
||||
<%= form_for('new_form',:url => {:controller => 'words', :action => 'create_reply', :id => activity.id}, :method => "post", :remote => true) do |f|%>
|
||||
<%= hidden_field_tag 'reference_id', params[:reference_id], :value => activity.id %>
|
||||
<%= hidden_field_tag 'reference_user_id', params[:reference_user_id], :value => activity.user.id %>
|
||||
<%= hidden_field_tag 'reference_message_id', params[:reference_message_id], :value => activity.id %>
|
||||
<%= hidden_field_tag 'show_name',params[:show_name],:value =>true %>
|
||||
<%= hidden_field_tag 'user_activity_id',params[:user_activity_id],:value =>user_activity_id %>
|
||||
<div nhname='toolbar_container_<%= user_activity_id%>'></div>
|
||||
<textarea placeholder="有问题或有建议,请直接给我留言吧!" style="display: none" nhname='new_message_textarea_<%= user_activity_id%>' name="user_notes"></textarea>
|
||||
<a id="new_message_submit_btn_<%= user_activity_id%>" href="javascript:void(0)" class="blue_n_btn fr" style="display:none;margin-top:6px;">发送</a>
|
||||
<div class="cl"></div>
|
||||
<p nhname='contentmsg_<%= user_activity_id%>'></p>
|
||||
<% end%>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="resources mt10" id="user_activity_<%= user_activity_id%>">
|
||||
<div class="homepagePostBrief">
|
||||
<div class="homepagePostPortrait">
|
||||
<%= link_to image_tag(url_to_avatar(activity.user), :width => "50", :height => "50"), user_path(activity.user_id), :alt => "用户头像" %>
|
||||
<%= render :partial => 'users/show_detail_info', :locals => {:user => activity.user} %>
|
||||
</div>
|
||||
<div class="homepagePostDes">
|
||||
<div class="homepagePostTo break_word mt-4">
|
||||
<% if activity.try(:user).try(:realname) == ' ' %>
|
||||
<%= link_to activity.try(:user), user_path(activity.user_id), :class => "newsBlue mr15" %>
|
||||
<% else %>
|
||||
<%= link_to activity.try(:user).try(:realname), user_path(activity.user_id), :class => "newsBlue mr15" %>
|
||||
<% end %> TO
|
||||
<% course=Course.find(activity.jour_id) %>
|
||||
<%= link_to course.name.to_s+" | 课程留言", course_feedback_path(course), :class => "newsBlue ml15" %>
|
||||
</div>
|
||||
<div class="homepagePostTitle break_word list_style upload_img">
|
||||
<% if activity.parent %>
|
||||
<%= link_to activity.parent.notes.html_safe, course_feedback_path(course), :class => "postGrey" %>
|
||||
<% else %>
|
||||
<%= link_to activity.notes.html_safe, course_feedback_path(course), :class => "postGrey" %>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="homepagePostDate fl">
|
||||
留言时间:<%= format_time(activity.created_on) %>
|
||||
</div>
|
||||
<div class="homepagePostDate fl ml15">
|
||||
更新时间:<%= format_time(CourseActivity.where("course_act_type='#{activity.class}' and course_act_id =#{activity.id}").first.updated_at) %>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<% count = fetch_user_leaveWord_reply(activity).count %>
|
||||
<div class="homepagePostReply">
|
||||
<div class="topBorder" style="display: <%= count>0 ? 'none': '' %>"></div>
|
||||
<div class="homepagePostReplyBanner" style="display: <%= count>0 ? '': 'none' %>">
|
||||
<div class="homepagePostReplyBannerCount">
|
||||
回复(<%= count %>)
|
||||
</div>
|
||||
<div class="homepagePostReplyBannerTime"></div>
|
||||
<%if count>3 %>
|
||||
<div class="homepagePostReplyBannerMore">
|
||||
<a id="reply_btn_<%=user_activity_id%>" onclick="expand_reply('#reply_div_<%= user_activity_id %> li','#reply_btn_<%=user_activity_id%>')" data-count="<%= count %>" data-init="0" class=" replyGrey" href="javascript:void(0)" value="show_help" >
|
||||
展开更多
|
||||
</a>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<% replies_all_i = 0 %>
|
||||
<% if count > 0 %>
|
||||
<div class="" id="reply_div_<%= user_activity_id %>">
|
||||
<ul>
|
||||
<% fetch_user_leaveWord_reply(activity).each do |comment| unless fetch_user_leaveWord_reply(activity).nil? %>
|
||||
<script type="text/javascript">
|
||||
$(function(){
|
||||
showNormalImage('reply_content_<%= comment.id %>');
|
||||
});
|
||||
</script>
|
||||
<% replies_all_i = replies_all_i + 1 %>
|
||||
<li class="homepagePostReplyContainer" nhname="reply_rec" style="display:<%= replies_all_i > 3 ? 'none' : '' %>">
|
||||
<div class="homepagePostReplyPortrait">
|
||||
<%= link_to image_tag(url_to_avatar(comment.user), :width => "33", :height => "33", :class =>"mt8"), user_path(comment.user_id), :alt => "用户头像" %>
|
||||
</div>
|
||||
<div class="homepagePostReplyDes">
|
||||
<div class="homepagePostReplyPublisher">
|
||||
<% if comment.try(:user).try(:realname) == ' ' %>
|
||||
<%= link_to comment.try(:user), user_path(comment.user_id), :class => "newsBlue mr10 f14" %>
|
||||
<% else %>
|
||||
<%= link_to comment.try(:user).try(:realname), user_path(comment.user_id), :class => "newsBlue mr10 f14" %>
|
||||
<% end %>
|
||||
<%= format_time(comment.created_on) %>
|
||||
</div>
|
||||
<div class="homepagePostReplyContent break_word list_style upload_img table_maxWidth" id="reply_content_<%= comment.id %>">
|
||||
<%= comment.notes.html_safe %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</li>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<div class="homepagePostReplyContainer borderBottomNone minHeight48">
|
||||
<div class="homepagePostReplyPortrait mr15 imageFuzzy" id="reply_image_<%= user_activity_id%>"><%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), :alt => "用户头像" %></div>
|
||||
<div class="homepagePostReplyInputContainer mb10">
|
||||
<div nhname='new_message_<%= user_activity_id%>' style="display:none;">
|
||||
<%= form_for('new_form',:url => {:controller => 'words', :action => 'create_reply', :id => activity.id}, :method => "post", :remote => true) do |f|%>
|
||||
<%= hidden_field_tag 'reference_id', params[:reference_id], :value => activity.id %>
|
||||
<%= hidden_field_tag 'reference_user_id', params[:reference_user_id], :value => activity.user.id %>
|
||||
<%= hidden_field_tag 'reference_message_id', params[:reference_message_id], :value => activity.id %>
|
||||
<%= hidden_field_tag 'show_name',params[:show_name],:value =>true %>
|
||||
<%= hidden_field_tag 'user_activity_id',params[:user_activity_id],:value =>user_activity_id %>
|
||||
<div nhname='toolbar_container_<%= user_activity_id%>'></div>
|
||||
<textarea placeholder="有问题或有建议,请直接给我留言吧!" style="display: none" nhname='new_message_textarea_<%= user_activity_id%>' name="user_notes"></textarea>
|
||||
<a id="new_message_submit_btn_<%= user_activity_id%>" href="javascript:void(0)" onclick="this.style.display='none'" class="blue_n_btn fr" style="display:none;margin-top:6px;">发送</a>
|
||||
<div class="cl"></div>
|
||||
<p nhname='contentmsg_<%= user_activity_id%>'></p>
|
||||
<% end%>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -178,7 +178,7 @@
|
|||
<input type="hidden" name="user_activity_id" value="<%=user_activity_id%>">
|
||||
<div nhname='toolbar_container_<%= user_activity_id%>'></div>
|
||||
<textarea placeholder="有问题或有建议,请直接给我留言吧!" style="display: none" nhname='new_message_textarea_<%= user_activity_id%>' name="reply[content]"></textarea>
|
||||
<a id="new_message_submit_btn_<%= user_activity_id%>" href="javascript:void(0)" class="blue_n_btn fr" style="display:none;margin-top:6px;">发送</a>
|
||||
<a id="new_message_submit_btn_<%= user_activity_id%>" href="javascript:void(0)" onclick="this.style.display='none'" class="blue_n_btn fr" style="display:none;margin-top:6px;">发送</a>
|
||||
<div class="cl"></div>
|
||||
<p nhname='contentmsg_<%= user_activity_id%>'></p>
|
||||
<% end%>
|
||||
|
|
|
@ -1,148 +1,148 @@
|
|||
<div class="resources mt10" id="user_activity_<%= user_activity_id%>">
|
||||
<div class="homepagePostBrief">
|
||||
<div class="homepagePostPortrait">
|
||||
<%= link_to image_tag(url_to_avatar(activity.author), :width => "50", :height => "50"), user_path(activity.author_id), :alt => "用户头像" %>
|
||||
<%= render :partial => 'users/show_detail_info', :locals => {:user => activity.author} %>
|
||||
</div>
|
||||
<div class="homepagePostDes">
|
||||
<div class="homepagePostTo break_word mt-4">
|
||||
<% if @ctivity.try(:author).try(:realname) == ' ' %>
|
||||
<%= link_to activity.try(:author), user_path(activity.author_id), :class => "newsBlue mr15" %>
|
||||
<% else %>
|
||||
<%= link_to activity.try(:author).try(:realname), user_path(activity.author_id), :class => "newsBlue mr15" %>
|
||||
<% end %> TO <!--+"(课程名称)"-->
|
||||
<%= link_to activity.course.name.to_s+" | 课程通知", course_news_index_path(activity.course), :class => "newsBlue ml15" %>
|
||||
</div>
|
||||
<div class="homepagePostTitle break_word hidden fl m_w600"> <!--+"(通知标题)"-->
|
||||
<%= link_to activity.title.to_s, news_path(activity), :class => "postGrey" %>
|
||||
</div>
|
||||
<% if activity.sticky == 1%>
|
||||
<span class="sticky_btn_cir ml10">置顶</span>
|
||||
<% end%>
|
||||
<div class="cl"></div>
|
||||
<div class="homepagePostDate fl">
|
||||
发布时间:<%= format_time(activity.created_on) %>
|
||||
</div>
|
||||
<div class="homepagePostDate fl ml15">
|
||||
更新时间:<%= format_time(CourseActivity.where("course_act_type='#{activity.class}' and course_act_id =#{activity.id}").first.updated_at) %>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<%=render :partial =>"users/intro_content", :locals=>{:user_activity_id =>user_activity_id, :content=>activity.description} %>
|
||||
<div class="cl"></div>
|
||||
<div id="intro_content_show_<%= user_activity_id%>" class="fr" style="display:none;"><a href="javascript:void(0);" class="linkBlue">[展开]</a></div>
|
||||
<div id="intro_content_hide_<%= user_activity_id%>" class="fr" style="display:none;"><a href="javascript:void(0);" class="linkBlue">[收起]</a></div>
|
||||
<div class="cl"></div>
|
||||
<div class="mt10" style="font-weight:normal;">
|
||||
<%= render :partial=>"attachments/activity_attach", :locals=>{:activity => activity} %>
|
||||
</div>
|
||||
<div class="homepagePostSetting">
|
||||
<ul>
|
||||
<li class="homepagePostSettingIcon">
|
||||
<% if User.current.logged? %>
|
||||
<ul class="homepagePostSettiongText">
|
||||
<li><%= link_to("发送", 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send('#{activity.id}',#{User.current.id},'news')") %></li>
|
||||
<li>
|
||||
<%= link_to(
|
||||
l(:button_edit),
|
||||
{controller:'news', :action => 'edit', :id => activity.id},
|
||||
:class => 'postOptionLink'
|
||||
) if User.current.allowed_to?(:manage_news, activity.course) %>
|
||||
</li>
|
||||
<li>
|
||||
<%= delete_link(
|
||||
news_path(activity),
|
||||
:data => {:confirm => l(:text_are_you_sure)},
|
||||
:class => 'postOptionLink'
|
||||
) if User.current.allowed_to?(:manage_news, activity.course) %>
|
||||
</li>
|
||||
</ul>
|
||||
<% end %>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<% count=activity.comments.count %>
|
||||
<div class="homepagePostReply">
|
||||
<div class="homepagePostReplyBanner">
|
||||
<div class="homepagePostReplyBannerCount">回复
|
||||
<sapn class="mr15"><%= count>0 ? "(#{count})" : "" %></sapn><span style="color: #cecece;">▪</span>
|
||||
<span id="praise_count_<%=user_activity_id %>">
|
||||
<% if activity.author == User.current %>
|
||||
<span class="ml15 likeButton" title="不能自己赞自己哦!"> <span class="likeText">赞</span><span class="likeNum"><%= get_praise_num(activity) > 0 ? "(#{get_praise_num(activity)})" : "" %></span></span>
|
||||
<% else %>
|
||||
<%=render :partial=> "praise_tread/praise", :locals => {:activity=>activity, :user_activity_id=>user_activity_id,:type=>"activity"}%>
|
||||
<% end %>
|
||||
</span>
|
||||
</div>
|
||||
<div class="homepagePostReplyBannerTime"><%#= format_date(activity.updated_on) %></div>
|
||||
<%if count>3 %>
|
||||
<div class="homepagePostReplyBannerMore">
|
||||
<a id="reply_btn_<%=user_activity_id%>" onclick="expand_reply('#reply_div_<%= user_activity_id %> li','#reply_btn_<%=user_activity_id%>')" data-count="<%= count %>" data-init="0" class=" replyGrey" href="javascript:void(0)" value="show_help" >
|
||||
展开更多
|
||||
</a>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<% replies_all_i = 0 %>
|
||||
<% if count > 0 %>
|
||||
<div class="" id="reply_div_<%= user_activity_id %>">
|
||||
<ul>
|
||||
<% activity.comments.reorder("created_on desc").each do |comment| %>
|
||||
<script type="text/javascript">
|
||||
$(function(){
|
||||
showNormalImage('reply_content_<%= comment.id %>');
|
||||
});
|
||||
</script>
|
||||
<% replies_all_i = replies_all_i + 1 %>
|
||||
<li class="homepagePostReplyContainer" nhname="reply_rec" style="display:<%= replies_all_i > 3 ? 'none' : '' %>">
|
||||
<div class="homepagePostReplyPortrait">
|
||||
<%= link_to image_tag(url_to_avatar(comment.author), :width => "33", :height => "33"), user_path(comment.author_id), :alt => "用户头像" %>
|
||||
</div>
|
||||
<div class="homepagePostReplyDes">
|
||||
<div class="homepagePostReplyPublisher mt-4">
|
||||
<% if comment.try(:author).try(:realname) == ' ' %>
|
||||
<%= link_to comment.try(:author), user_path(comment.author_id), :class => "newsBlue mr10 f14" %>
|
||||
<% else %>
|
||||
<%= link_to comment.try(:author).try(:realname), user_path(comment.author_id), :class => "newsBlue mr10 f14" %>
|
||||
<% end %>
|
||||
<%= format_time(comment.created_on) %>
|
||||
<span id="reply_praise_count_<%=comment.id %>">
|
||||
<% if comment.author == User.current %>
|
||||
<span class="fr likeButton" title="不能自己赞自己哦!"> <span class="likeText">赞</span><span class="likeNum"><%= get_praise_num(comment) > 0 ? "(#{get_praise_num(comment)})" : "" %></span></span>
|
||||
<% else %>
|
||||
<%=render :partial=> "praise_tread/praise", :locals => {:activity=>comment, :user_activity_id=>comment.id,:type=>"reply"}%>
|
||||
<% end %>
|
||||
</span>
|
||||
</div>
|
||||
<div class="homepagePostReplyContent break_word list_style upload_img table_maxWidth" id="reply_content_<%= comment.id %>">
|
||||
<%= comment.comments.html_safe %></div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<div class="homepagePostReplyContainer borderBottomNone minHeight48">
|
||||
<div class="homepagePostReplyPortrait mr15 imageFuzzy" id="reply_image_<%= user_activity_id%>"><%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(activity.author_id), :alt => "用户头像" %></div>
|
||||
<div class="homepagePostReplyInputContainer mb10">
|
||||
<div nhname='new_message_<%= user_activity_id%>' style="display:none;">
|
||||
<%= form_for('new_form',:url => {:controller => 'comments', :action => 'create', :id => activity},:method => "post", :remote => true) do |f|%>
|
||||
<input type="hidden" name="user_activity_id" value="<%=user_activity_id%>">
|
||||
<div nhname='toolbar_container_<%= user_activity_id%>'></div>
|
||||
<textarea placeholder="有问题或有建议,请直接给我留言吧!" style="display: none" nhname='new_message_textarea_<%= user_activity_id%>' name="comment"></textarea>
|
||||
<a id="new_message_submit_btn_<%= user_activity_id%>" href="javascript:void(0)" class="blue_n_btn fr" style="display:none;margin-top:6px;">发送</a>
|
||||
<div class="cl"></div>
|
||||
<p nhname='contentmsg_<%= user_activity_id%>'></p>
|
||||
<% end%>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="resources mt10" id="user_activity_<%= user_activity_id%>">
|
||||
<div class="homepagePostBrief">
|
||||
<div class="homepagePostPortrait">
|
||||
<%= link_to image_tag(url_to_avatar(activity.author), :width => "50", :height => "50"), user_path(activity.author_id), :alt => "用户头像" %>
|
||||
<%= render :partial => 'users/show_detail_info', :locals => {:user => activity.author} %>
|
||||
</div>
|
||||
<div class="homepagePostDes">
|
||||
<div class="homepagePostTo break_word mt-4">
|
||||
<% if @ctivity.try(:author).try(:realname) == ' ' %>
|
||||
<%= link_to activity.try(:author), user_path(activity.author_id), :class => "newsBlue mr15" %>
|
||||
<% else %>
|
||||
<%= link_to activity.try(:author).try(:realname), user_path(activity.author_id), :class => "newsBlue mr15" %>
|
||||
<% end %> TO <!--+"(课程名称)"-->
|
||||
<%= link_to activity.course.name.to_s+" | 课程通知", course_news_index_path(activity.course), :class => "newsBlue ml15" %>
|
||||
</div>
|
||||
<div class="homepagePostTitle break_word hidden fl m_w600"> <!--+"(通知标题)"-->
|
||||
<%= link_to activity.title.to_s, news_path(activity), :class => "postGrey" %>
|
||||
</div>
|
||||
<% if activity.sticky == 1%>
|
||||
<span class="sticky_btn_cir ml10">置顶</span>
|
||||
<% end%>
|
||||
<div class="cl"></div>
|
||||
<div class="homepagePostDate fl">
|
||||
发布时间:<%= format_time(activity.created_on) %>
|
||||
</div>
|
||||
<div class="homepagePostDate fl ml15">
|
||||
更新时间:<%= format_time(CourseActivity.where("course_act_type='#{activity.class}' and course_act_id =#{activity.id}").first.updated_at) %>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<%=render :partial =>"users/intro_content", :locals=>{:user_activity_id =>user_activity_id, :content=>activity.description} %>
|
||||
<div class="cl"></div>
|
||||
<div id="intro_content_show_<%= user_activity_id%>" class="fr" style="display:none;"><a href="javascript:void(0);" class="linkBlue">[展开]</a></div>
|
||||
<div id="intro_content_hide_<%= user_activity_id%>" class="fr" style="display:none;"><a href="javascript:void(0);" class="linkBlue">[收起]</a></div>
|
||||
<div class="cl"></div>
|
||||
<div class="mt10" style="font-weight:normal;">
|
||||
<%= render :partial=>"attachments/activity_attach", :locals=>{:activity => activity} %>
|
||||
</div>
|
||||
<div class="homepagePostSetting">
|
||||
<ul>
|
||||
<li class="homepagePostSettingIcon">
|
||||
<% if User.current.logged? %>
|
||||
<ul class="homepagePostSettiongText">
|
||||
<li><%= link_to("发送", 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send('#{activity.id}',#{User.current.id},'news')") %></li>
|
||||
<li>
|
||||
<%= link_to(
|
||||
l(:button_edit),
|
||||
{controller:'news', :action => 'edit', :id => activity.id},
|
||||
:class => 'postOptionLink'
|
||||
) if User.current.allowed_to?(:manage_news, activity.course) %>
|
||||
</li>
|
||||
<li>
|
||||
<%= delete_link(
|
||||
news_path(activity),
|
||||
:data => {:confirm => l(:text_are_you_sure)},
|
||||
:class => 'postOptionLink'
|
||||
) if User.current.allowed_to?(:manage_news, activity.course) %>
|
||||
</li>
|
||||
</ul>
|
||||
<% end %>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<% count=activity.comments.count %>
|
||||
<div class="homepagePostReply">
|
||||
<div class="homepagePostReplyBanner">
|
||||
<div class="homepagePostReplyBannerCount">回复
|
||||
<sapn class="mr15"><%= count>0 ? "(#{count})" : "" %></sapn><span style="color: #cecece;">▪</span>
|
||||
<span id="praise_count_<%=user_activity_id %>">
|
||||
<% if activity.author == User.current %>
|
||||
<span class="ml15 likeButton" title="不能自己赞自己哦!"> <span class="likeText">赞</span><span class="likeNum"><%= get_praise_num(activity) > 0 ? "(#{get_praise_num(activity)})" : "" %></span></span>
|
||||
<% else %>
|
||||
<%=render :partial=> "praise_tread/praise", :locals => {:activity=>activity, :user_activity_id=>user_activity_id,:type=>"activity"}%>
|
||||
<% end %>
|
||||
</span>
|
||||
</div>
|
||||
<div class="homepagePostReplyBannerTime"><%#= format_date(activity.updated_on) %></div>
|
||||
<%if count>3 %>
|
||||
<div class="homepagePostReplyBannerMore">
|
||||
<a id="reply_btn_<%=user_activity_id%>" onclick="expand_reply('#reply_div_<%= user_activity_id %> li','#reply_btn_<%=user_activity_id%>')" data-count="<%= count %>" data-init="0" class=" replyGrey" href="javascript:void(0)" value="show_help" >
|
||||
展开更多
|
||||
</a>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<% replies_all_i = 0 %>
|
||||
<% if count > 0 %>
|
||||
<div class="" id="reply_div_<%= user_activity_id %>">
|
||||
<ul>
|
||||
<% activity.comments.reorder("created_on desc").each do |comment| %>
|
||||
<script type="text/javascript">
|
||||
$(function(){
|
||||
showNormalImage('reply_content_<%= comment.id %>');
|
||||
});
|
||||
</script>
|
||||
<% replies_all_i = replies_all_i + 1 %>
|
||||
<li class="homepagePostReplyContainer" nhname="reply_rec" style="display:<%= replies_all_i > 3 ? 'none' : '' %>">
|
||||
<div class="homepagePostReplyPortrait">
|
||||
<%= link_to image_tag(url_to_avatar(comment.author), :width => "33", :height => "33"), user_path(comment.author_id), :alt => "用户头像" %>
|
||||
</div>
|
||||
<div class="homepagePostReplyDes">
|
||||
<div class="homepagePostReplyPublisher mt-4">
|
||||
<% if comment.try(:author).try(:realname) == ' ' %>
|
||||
<%= link_to comment.try(:author), user_path(comment.author_id), :class => "newsBlue mr10 f14" %>
|
||||
<% else %>
|
||||
<%= link_to comment.try(:author).try(:realname), user_path(comment.author_id), :class => "newsBlue mr10 f14" %>
|
||||
<% end %>
|
||||
<%= format_time(comment.created_on) %>
|
||||
<span id="reply_praise_count_<%=comment.id %>">
|
||||
<% if comment.author == User.current %>
|
||||
<span class="fr likeButton" title="不能自己赞自己哦!"> <span class="likeText">赞</span><span class="likeNum"><%= get_praise_num(comment) > 0 ? "(#{get_praise_num(comment)})" : "" %></span></span>
|
||||
<% else %>
|
||||
<%=render :partial=> "praise_tread/praise", :locals => {:activity=>comment, :user_activity_id=>comment.id,:type=>"reply"}%>
|
||||
<% end %>
|
||||
</span>
|
||||
</div>
|
||||
<div class="homepagePostReplyContent break_word list_style upload_img table_maxWidth" id="reply_content_<%= comment.id %>">
|
||||
<%= comment.comments.html_safe %></div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<div class="homepagePostReplyContainer borderBottomNone minHeight48">
|
||||
<div class="homepagePostReplyPortrait mr15 imageFuzzy" id="reply_image_<%= user_activity_id%>"><%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(activity.author_id), :alt => "用户头像" %></div>
|
||||
<div class="homepagePostReplyInputContainer mb10">
|
||||
<div nhname='new_message_<%= user_activity_id%>' style="display:none;">
|
||||
<%= form_for('new_form',:url => {:controller => 'comments', :action => 'create', :id => activity},:method => "post", :remote => true) do |f|%>
|
||||
<input type="hidden" name="user_activity_id" value="<%=user_activity_id%>">
|
||||
<div nhname='toolbar_container_<%= user_activity_id%>'></div>
|
||||
<textarea placeholder="有问题或有建议,请直接给我留言吧!" style="display: none" nhname='new_message_textarea_<%= user_activity_id%>' name="comment"></textarea>
|
||||
<a id="new_message_submit_btn_<%= user_activity_id%>" href="javascript:void(0)" onclick="this.style.display='none'" class="blue_n_btn fr" style="display:none;margin-top:6px;">发送</a>
|
||||
<div class="cl"></div>
|
||||
<p nhname='contentmsg_<%= user_activity_id%>'></p>
|
||||
<% end%>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
<ul class="subject-list-banner">
|
||||
<li class="subject-list-name fl hidden"><span style="padding-left:15px;">作业名称</span></li>
|
||||
<li class="subject-list-from fl">来源</li>
|
||||
<li class="subject-list-type fl">类别</li>
|
||||
<li class="subject-list-publisher fl">贡献者</li>
|
||||
<li class="subject-list-count fl">
|
||||
<%= link_to "引用数",user_search_homeworks_user_path(@user,:name=>search,:type => type,:is_import=>is_import,:property=>property,:order => "quotes", :sort => @r_sort),:class => "fl",:remote => true%>
|
||||
<% if @order == "quotes"%>
|
||||
<%= link_to "", user_search_homeworks_user_path(@user,:name=>search,:type => type,:is_import=>is_import,:property=>property,:order => "quotes", :sort => @r_sort),:class => "#{@r_sort == 'desc' ? 'st_up' : 'st_down'} mt12" ,:remote => true%>
|
||||
<% end%>
|
||||
</li>
|
||||
<li class="fl subject-list-date">
|
||||
<%= link_to "发布时间",user_search_homeworks_user_path(@user,:name=>search,:type => type,:is_import=>is_import,:property=>property,:order => "created_at", :sort => @r_sort),:class => "fl",:remote => true%>
|
||||
<% if @order == "created_at"%>
|
||||
<%= link_to "", user_search_homeworks_user_path(@user,:name=>search,:type => type,:is_import=>is_import,:property=>property,:order => "created_at", :sort => @r_sort),:class => "#{@r_sort == 'desc' ? 'st_up' : 'st_down'} mt12" ,:remote => true%>
|
||||
<% end%>
|
||||
</li>
|
||||
</ul>
|
||||
<div id="homework_repository">
|
||||
<%=render :partial => 'homework_repository', :locals => {:homeworks => homeworks} %>
|
||||
</div>
|
|
@ -1,89 +1,89 @@
|
|||
<% count = activity.journals.count %>
|
||||
<div class="homepagePostReply">
|
||||
<div class="homepagePostReplyBanner">
|
||||
<div class="homepagePostReplyBannerCount">回复
|
||||
<sapn class="mr15"><%= count>0 ? "(#{count})" : "" %></sapn><span style="color: #cecece;">▪</span>
|
||||
<span id="praise_count_<%=user_activity_id %>">
|
||||
<% if activity.author == User.current %>
|
||||
<span class="ml15 likeButton" title="不能自己赞自己哦!"> <span class="likeText">赞</span><span class="likeNum"><%= get_praise_num(activity) > 0 ? "(#{get_praise_num(activity)})" : "" %></span></span>
|
||||
<% else %>
|
||||
<%=render :partial=> "praise_tread/praise", :locals => {:activity=>activity, :user_activity_id=>user_activity_id,:type=>"activity"}%>
|
||||
<% end %>
|
||||
</span>
|
||||
</div>
|
||||
<div class="homepagePostReplyBannerTime"><%#= format_date(activity.updated_on) %></div>
|
||||
<% if count > 3 %>
|
||||
<div class="homepagePostReplyBannerMore">
|
||||
<a id="reply_btn_<%= user_activity_id %>" onclick="expand_reply('#reply_div_<%= user_activity_id %> li','#reply_btn_<%=user_activity_id%>')" data-count="<%= count %>" data-init="0" class=" replyGrey" href="javascript:void(0)" value="show_help">
|
||||
展开更多
|
||||
</a>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<% replies_all_i = 0 %>
|
||||
<% if count > 0 %>
|
||||
<div class="" id="reply_div_<%= user_activity_id %>">
|
||||
<ul>
|
||||
<% activity.journals.reorder("created_on desc").each do |reply| %>
|
||||
<script type="text/javascript">
|
||||
$(function(){
|
||||
showNormalImage('reply_content_<%= reply.id %>');
|
||||
});
|
||||
</script>
|
||||
<% replies_all_i=replies_all_i + 1 %>
|
||||
<li class="homepagePostReplyContainer" nhname="reply_rec" style="display:<%= replies_all_i>3 ? 'none' : '' %>">
|
||||
<div class="homepagePostReplyPortrait">
|
||||
<%= link_to image_tag(url_to_avatar(reply.user), :width => "33", :height => "33"), user_path(reply.user_id), :alt => "用户头像" %>
|
||||
</div>
|
||||
<div class="homepagePostReplyDes">
|
||||
<div class="homepagePostReplyPublisher mt-4">
|
||||
<% if reply.try(:user).try(:realname) == ' ' %>
|
||||
<%= link_to reply.try(:user), user_path(reply.user_id), :class => "newsBlue mr10 f14" %>
|
||||
<% else %>
|
||||
<%= link_to reply.try(:user).try(:realname), user_path(reply.user_id), :class => "newsBlue mr10 f14" %>
|
||||
<% end %>
|
||||
<%= format_time(reply.created_on) %>
|
||||
<span id="reply_praise_count_<%=reply.id %>">
|
||||
<% if reply.user == User.current %>
|
||||
<span class="fr likeButton" title="不能自己赞自己哦!"> <span class="likeText">赞</span><span class="likeNum"><%= get_praise_num(reply) > 0 ? "(#{get_praise_num(reply)})" : "" %></span></span>
|
||||
<% else %>
|
||||
<%=render :partial=> "praise_tread/praise", :locals => {:activity=>reply, :user_activity_id=>reply.id,:type=>"reply"}%>
|
||||
<% end %>
|
||||
</span>
|
||||
</div>
|
||||
<div class="homepagePostReplyContent break_word list_style upload_img table_maxWidth" id="reply_content_<%= reply.id %>">
|
||||
<% if reply.details.any? %>
|
||||
<% details_to_strings(reply.details).each do |string| %>
|
||||
<p><%= string %></p>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<P><%= reply.notes.html_safe %></P>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<div class="homepagePostReplyContainer borderBottomNone minHeight48">
|
||||
<div class="homepagePostReplyPortrait mr15 imageFuzzy" id="reply_image_<%= user_activity_id%>"><%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(activity.author_id), :alt => "用户头像" %></div>
|
||||
<div class="homepagePostReplyInputContainer mb10">
|
||||
<div nhname='new_message_<%= user_activity_id %>' style="display:none;">
|
||||
<%= form_for('new_form',:url => add_journal_issue_path(activity.id, :user_activity_id => user_activity_id),:method => "post", :remote => true) do |f| %>
|
||||
<input type="hidden" name="user_activity_id" value="<%=user_activity_id%>">
|
||||
<div nhname='toolbar_container_<%= user_activity_id%>'></div>
|
||||
<textarea placeholder="有问题或有建议,请直接给我留言吧!" style="display: none" nhname='new_message_textarea_<%= user_activity_id%>' name="notes"></textarea>
|
||||
<a id="new_message_submit_btn_<%= user_activity_id%>" href="javascript:void(0)" class="blue_n_btn fr" style="display:none;margin-top:6px;">发送</a>
|
||||
<div class="cl"></div>
|
||||
<p nhname='contentmsg_<%= user_activity_id%>'></p>
|
||||
<% end%>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
|
||||
<% count = activity.journals.count %>
|
||||
<div class="homepagePostReply">
|
||||
<div class="homepagePostReplyBanner">
|
||||
<div class="homepagePostReplyBannerCount">回复
|
||||
<sapn class="mr15"><%= count>0 ? "(#{count})" : "" %></sapn><span style="color: #cecece;">▪</span>
|
||||
<span id="praise_count_<%=user_activity_id %>">
|
||||
<% if activity.author == User.current %>
|
||||
<span class="ml15 likeButton" title="不能自己赞自己哦!"> <span class="likeText">赞</span><span class="likeNum"><%= get_praise_num(activity) > 0 ? "(#{get_praise_num(activity)})" : "" %></span></span>
|
||||
<% else %>
|
||||
<%=render :partial=> "praise_tread/praise", :locals => {:activity=>activity, :user_activity_id=>user_activity_id,:type=>"activity"}%>
|
||||
<% end %>
|
||||
</span>
|
||||
</div>
|
||||
<div class="homepagePostReplyBannerTime"><%#= format_date(activity.updated_on) %></div>
|
||||
<% if count > 3 %>
|
||||
<div class="homepagePostReplyBannerMore">
|
||||
<a id="reply_btn_<%= user_activity_id %>" onclick="expand_reply('#reply_div_<%= user_activity_id %> li','#reply_btn_<%=user_activity_id%>')" data-count="<%= count %>" data-init="0" class=" replyGrey" href="javascript:void(0)" value="show_help">
|
||||
展开更多
|
||||
</a>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<% replies_all_i = 0 %>
|
||||
<% if count > 0 %>
|
||||
<div class="" id="reply_div_<%= user_activity_id %>">
|
||||
<ul>
|
||||
<% activity.journals.reorder("created_on desc").each do |reply| %>
|
||||
<script type="text/javascript">
|
||||
$(function(){
|
||||
showNormalImage('reply_content_<%= reply.id %>');
|
||||
});
|
||||
</script>
|
||||
<% replies_all_i=replies_all_i + 1 %>
|
||||
<li class="homepagePostReplyContainer" nhname="reply_rec" style="display:<%= replies_all_i>3 ? 'none' : '' %>">
|
||||
<div class="homepagePostReplyPortrait">
|
||||
<%= link_to image_tag(url_to_avatar(reply.user), :width => "33", :height => "33"), user_path(reply.user_id), :alt => "用户头像" %>
|
||||
</div>
|
||||
<div class="homepagePostReplyDes">
|
||||
<div class="homepagePostReplyPublisher mt-4">
|
||||
<% if reply.try(:user).try(:realname) == ' ' %>
|
||||
<%= link_to reply.try(:user), user_path(reply.user_id), :class => "newsBlue mr10 f14" %>
|
||||
<% else %>
|
||||
<%= link_to reply.try(:user).try(:realname), user_path(reply.user_id), :class => "newsBlue mr10 f14" %>
|
||||
<% end %>
|
||||
<%= format_time(reply.created_on) %>
|
||||
<span id="reply_praise_count_<%=reply.id %>">
|
||||
<% if reply.user == User.current %>
|
||||
<span class="fr likeButton" title="不能自己赞自己哦!"> <span class="likeText">赞</span><span class="likeNum"><%= get_praise_num(reply) > 0 ? "(#{get_praise_num(reply)})" : "" %></span></span>
|
||||
<% else %>
|
||||
<%=render :partial=> "praise_tread/praise", :locals => {:activity=>reply, :user_activity_id=>reply.id,:type=>"reply"}%>
|
||||
<% end %>
|
||||
</span>
|
||||
</div>
|
||||
<div class="homepagePostReplyContent break_word list_style upload_img table_maxWidth" id="reply_content_<%= reply.id %>">
|
||||
<% if reply.details.any? %>
|
||||
<% details_to_strings(reply.details).each do |string| %>
|
||||
<p><%= string %></p>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<P><%= reply.notes.html_safe %></P>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<div class="homepagePostReplyContainer borderBottomNone minHeight48">
|
||||
<div class="homepagePostReplyPortrait mr15 imageFuzzy" id="reply_image_<%= user_activity_id%>"><%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(activity.author_id), :alt => "用户头像" %></div>
|
||||
<div class="homepagePostReplyInputContainer mb10">
|
||||
<div nhname='new_message_<%= user_activity_id %>' style="display:none;">
|
||||
<%= form_for('new_form',:url => add_journal_issue_path(activity.id, :user_activity_id => user_activity_id),:method => "post", :remote => true) do |f| %>
|
||||
<input type="hidden" name="user_activity_id" value="<%=user_activity_id%>">
|
||||
<div nhname='toolbar_container_<%= user_activity_id%>'></div>
|
||||
<textarea placeholder="有问题或有建议,请直接给我留言吧!" style="display: none" nhname='new_message_textarea_<%= user_activity_id%>' name="notes"></textarea>
|
||||
<a id="new_message_submit_btn_<%= user_activity_id%>" href="javascript:void(0)" onclick="this.style.display='none'" class="blue_n_btn fr" style="display:none;margin-top:6px;">发送</a>
|
||||
<div class="cl"></div>
|
||||
<p nhname='contentmsg_<%= user_activity_id%>'></p>
|
||||
<% end%>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
|
||||
</div>
|
|
@ -154,7 +154,7 @@
|
|||
<input type="hidden" name="user_activity_id" value="<%=user_activity_id%>">
|
||||
<div nhname='toolbar_container_<%= user_activity_id%>'></div>
|
||||
<textarea placeholder="有问题或有建议,请直接给我留言吧!" style="display: none" nhname='new_message_textarea_<%= user_activity_id%>' name="reply[content]"></textarea>
|
||||
<a id="new_message_submit_btn_<%= user_activity_id%>" href="javascript:void(0)" class="blue_n_btn fr" style="display:none;margin-top:6px;">发送</a>
|
||||
<a id="new_message_submit_btn_<%= user_activity_id%>" href="javascript:void(0)" onclick="this.style.display='none'" class="blue_n_btn fr" style="display:none;margin-top:6px;">发送</a>
|
||||
<div class="cl"></div>
|
||||
<p nhname='contentmsg_<%= user_activity_id%>'></p>
|
||||
<% end%>
|
||||
|
|
|
@ -132,7 +132,7 @@
|
|||
<input type="hidden" name="user_activity_id" value="<%=user_activity_id%>">
|
||||
<div nhname='toolbar_container_<%= user_activity_id%>'></div>
|
||||
<textarea placeholder="有问题或有建议,请直接给我留言吧!" style="display: none" nhname='new_message_textarea_<%= user_activity_id%>' name="comment"></textarea>
|
||||
<a id="new_message_submit_btn_<%= user_activity_id%>" href="javascript:void(0)" class="blue_n_btn fr" style="display:none;margin-top:6px;">发送</a>
|
||||
<a id="new_message_submit_btn_<%= user_activity_id%>" href="javascript:void(0)" onclick="this.style.display='none'" class="blue_n_btn fr" style="display:none;margin-top:6px;">发送</a>
|
||||
<div class="cl"></div>
|
||||
<p nhname='contentmsg_<%= user_activity_id%>'></p>
|
||||
<% end%>
|
||||
|
|
|
@ -37,8 +37,8 @@
|
|||
|
||||
</div>
|
||||
<div class="uploadResourceIntr">
|
||||
<div class="uploadResourceName"><span id="upload_file_count">(未选择文件)</span></div>
|
||||
<div class="uploadResourceIntr2"><!--您可以上传小于<span class="c_red">50MB</span>的文件--></div>
|
||||
<div class="uploadResourceName fl"><span id="upload_file_count">(未选择文件)</span></div>
|
||||
<div class="uploadResourceIntr2 fl">您可以上传小于<span class="c_red">50MB</span>的文件</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
|
|
|
@ -1,21 +1,33 @@
|
|||
<% if AtMessage === ma && ma.at_valid? %>
|
||||
<ul class="homepageNewsList fl">
|
||||
<li class="homepageNewsPortrait fl"><a href="javascript:void(0);"><%=link_to image_tag(url_to_avatar(ma.author), :width => "30", :height => "30"),user_path(ma.author) %></a></li>
|
||||
<li class="homepageNewsPubType fl">
|
||||
<span class="newsBlue homepageNewsPublisher"><%= ma.author.login %></span><span class="homepageNewsType fl">提到了你:</span>
|
||||
</li>
|
||||
<li class="homepageNewsContent fl">
|
||||
<%= link_to ma.subject.html_safe, ma.url,
|
||||
:class =>"#{ma.viewed? ? "newsGrey" : "newsBlack"}",
|
||||
:onmouseover =>"message_titile_show($(this),event)",
|
||||
:onmouseout => "message_titile_hide($(this))" %></li>
|
||||
<div style="display: none" class="message_title_red system_message_style">
|
||||
<p><strong>标题:</strong><%= ma.subject %></p>
|
||||
<% unless ma.description.nil? %>
|
||||
<div class="fl"><strong>内容:</strong></div>
|
||||
<div class="ml36"><%= ma.description.html_safe %></div>
|
||||
<% end %>
|
||||
</div>
|
||||
<li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li>
|
||||
</ul>
|
||||
<% if AtMessage === ma && ma.at_valid? %>
|
||||
<ul class="homepageNewsList fl">
|
||||
<li class="homepageNewsPortrait fl"><a href="javascript:void(0);"><%=link_to image_tag(url_to_avatar(ma.author), :width => "30", :height => "30"),user_path(ma.author) %></a></li>
|
||||
<li class="homepageNewsPubType fl">
|
||||
<span class="newsBlue homepageNewsPublisher"><%= ma.author.login %></span><span class="homepageNewsType fl">提到了你:</span>
|
||||
</li>
|
||||
<li class="homepageNewsContent fl">
|
||||
<% if ma.at_message_type == "Message" && !ma.at_message.course.nil? %>
|
||||
<%= link_to ma.subject.html_safe, course_boards_path(ma.at_message.course,
|
||||
:parent_id => ma.at_message.parent_id ? ma.at_message.parent_id : ma.at_message.id, :topic_id => ma.at_message.id),
|
||||
:class =>"#{ma.viewed? ? "newsGrey" : "newsBlack"}",
|
||||
:onmouseover =>"message_titile_show($(this),event)",
|
||||
:onmouseout => "message_titile_hide($(this))" %>
|
||||
<% elsif ma.at_message_type == "Message" && !ma.at_message.project.nil? %>
|
||||
<%= link_to ma.subject.html_safe, project_boards_path(ma.at_message.project,
|
||||
:parent_id => ma.at_message.parent_id ? ma.at_message.parent_id : ma.at_message.id, :topic_id => ma.at_message.id),
|
||||
:class =>"#{ma.viewed? ? "newsGrey" : "newsBlack"}",
|
||||
:onmouseover =>"message_titile_show($(this),event)",
|
||||
:onmouseout => "message_titile_hide($(this))" %>
|
||||
<% else %>
|
||||
<%= link_to ma.subject.html_safe, ma.url, :class =>"#{ma.viewed? ? "newsGrey" : "newsBlack"}", :onmouseover =>"message_titile_show($(this),event)", :onmouseout => "message_titile_hide($(this))" %>
|
||||
<% end %>
|
||||
</li>
|
||||
<div style="display: none" class="message_title_red system_message_style">
|
||||
<p><strong>标题:</strong><%= ma.subject %></p>
|
||||
<% unless ma.description.nil? %>
|
||||
<div class="fl"><strong>内容:</strong></div>
|
||||
<div class="ml36"><%= ma.description.html_safe %></div>
|
||||
<% end %>
|
||||
</div>
|
||||
<li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li>
|
||||
</ul>
|
||||
<% end %>
|
|
@ -1,147 +1,147 @@
|
|||
<div class="resources mt10" id="user_activity_<%= user_activity_id%>">
|
||||
<div class="homepagePostBrief">
|
||||
<div class="homepagePostPortrait">
|
||||
<%= link_to image_tag(url_to_avatar(activity.author), :width => "50", :height => "50"), user_path(activity.author_id), :alt => "用户头像" %>
|
||||
<%= render :partial => 'users/show_detail_info', :locals => {:user => activity.author} %>
|
||||
</div>
|
||||
<div class="homepagePostDes">
|
||||
<div class="homepagePostTo break_word mt-4">
|
||||
<% if @ctivity.try(:author).try(:realname) == ' ' %>
|
||||
<%= link_to activity.try(:author), user_path(activity.author_id), :class => "newsBlue mr15" %>
|
||||
<% else %>
|
||||
<%= link_to activity.try(:author).try(:realname), user_path(activity.author_id), :class => "newsBlue mr15" %>
|
||||
<% end %> TO <!--+"(课程名称)"-->
|
||||
<%= link_to activity.author.name.to_s+" | 博客", user_blogs_path(:user_id=>activity.author_id), :class => "newsBlue ml15" %>
|
||||
</div>
|
||||
<div class="homepagePostTitle break_word"> <!--+"(通知标题)"-->
|
||||
<div class="fl">
|
||||
<%= link_to activity.title.to_s, user_blog_blog_comment_path(:user_id=>activity.author_id,:blog_id=>activity.blog_id,:id=>activity.id,:in_act => true), :class => "postGrey" %>
|
||||
</div>
|
||||
<% if activity.sticky == 1%>
|
||||
<span class="sticky_btn_cir ml10">置顶</span>
|
||||
<% end%>
|
||||
<% if activity.locked%>
|
||||
<span class="locked_btn_cir ml10 fl" title="已锁定"> </span>
|
||||
<% end%>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
|
||||
<div class="homepagePostDate fl">
|
||||
发布时间:<%= format_time(activity.created_on) %>
|
||||
</div>
|
||||
<div class="homepagePostDate fl ml15">
|
||||
更新时间:<%= format_time(UserActivity.where("act_type='#{activity.class}' and act_id =#{activity.id}").first.updated_at) %>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<%=render :partial =>"users/intro_content", :locals=>{:user_activity_id =>user_activity_id, :content=>activity.content} %>
|
||||
<div class="cl"></div>
|
||||
<div id="intro_content_show_<%= user_activity_id%>" class="fr" style="display:none;"><a href="javascript:void(0);" class="linkBlue">[展开]</a></div>
|
||||
<div id="intro_content_hide_<%= user_activity_id%>" class="fr" style="display:none;"><a href="javascript:void(0);" class="linkBlue">[收起]</a></div>
|
||||
<div class="cl"></div>
|
||||
<div class="mt10" style="font-weight:normal;">
|
||||
<%= render :partial=>"attachments/activity_attach", :locals=>{:activity => activity} %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<% count=activity.children.count %>
|
||||
<div class="homepagePostReply">
|
||||
<div class="homepagePostReplyBanner">
|
||||
<div class="homepagePostReplyBannerCount">回复
|
||||
<sapn class="mr15"><%= count>0 ? "(#{count})" : "" %></sapn><span style="color: #cecece;">▪</span>
|
||||
<span id="praise_count_<%=user_activity_id %>">
|
||||
<% if activity.author == User.current %>
|
||||
<span class="ml15 likeButton" title="不能自己赞自己哦!"> <span class="likeText">赞</span><span class="likeNum"><%= get_praise_num(activity) > 0 ? "(#{get_praise_num(activity)})" : "" %></span></span>
|
||||
<% else %>
|
||||
<%=render :partial=> "praise_tread/praise", :locals => {:activity=>activity, :user_activity_id=>user_activity_id,:type=>"activity"}%>
|
||||
<% end %>
|
||||
</span>
|
||||
</div>
|
||||
<div class="homepagePostReplyBannerTime"><%#= format_date(activity.updated_on) %></div>
|
||||
<%if count>3 %>
|
||||
<div class="homepagePostReplyBannerMore">
|
||||
<a id="reply_btn_<%=user_activity_id%>" onclick="expand_reply('#reply_div_<%= user_activity_id %> li','#reply_btn_<%=user_activity_id%>')" data-count="<%= count %>" data-init="0" class=" replyGrey" href="javascript:void(0)" value="show_help" >
|
||||
展开更多
|
||||
</a>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<% replies_all_i = 0 %>
|
||||
<% if count > 0 %>
|
||||
<div class="" id="reply_div_<%= user_activity_id %>">
|
||||
<ul>
|
||||
<% activity.children.reorder("created_on desc").each do |comment| %>
|
||||
<script type="text/javascript">
|
||||
$(function(){
|
||||
showNormalImage('reply_content_<%= comment.id %>');
|
||||
});
|
||||
</script>
|
||||
<% replies_all_i = replies_all_i + 1 %>
|
||||
<li class="homepagePostReplyContainer" nhname="reply_rec" style="display:<%= replies_all_i > 3 ? 'none' : '' %>">
|
||||
<div class="homepagePostReplyPortrait">
|
||||
<%= link_to image_tag(url_to_avatar(comment.author), :width => "33", :height => "33"), user_path(comment.author_id), :alt => "用户头像" %>
|
||||
</div>
|
||||
<div class="homepagePostReplyDes">
|
||||
<div class="homepagePostReplyPublisher mt-4">
|
||||
<% if comment.try(:author).try(:realname) == ' ' %>
|
||||
<%= link_to comment.try(:author), user_path(comment.author_id), :class => "newsBlue mr10 f14" %>
|
||||
<% else %>
|
||||
<%= link_to comment.try(:author).try(:realname), user_path(comment.author_id), :class => "newsBlue mr10 f14" %>
|
||||
<% end %>
|
||||
<%= format_time(comment.created_on) %>
|
||||
<span id="reply_praise_count_<%=comment.id %>">
|
||||
<% if comment.author == User.current %>
|
||||
<span class="fr likeButton" title="不能自己赞自己哦!"> <span class="likeText">赞</span><span class="likeNum"><%= get_praise_num(comment) > 0 ? "(#{get_praise_num(comment)})" : "" %></span></span>
|
||||
<% else %>
|
||||
<%=render :partial=> "praise_tread/praise", :locals => {:activity=>comment, :user_activity_id=>comment.id,:type=>"reply"}%>
|
||||
<% end %>
|
||||
</span>
|
||||
</div>
|
||||
<div class="homepagePostReplyContent break_word list_style upload_img table_maxWidth" id="reply_content_<%= comment.id %>">
|
||||
<%= comment.content.html_safe %></div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<% if activity.locked == false && User.current.logged?%>
|
||||
<div class="homepagePostReplyContainer borderBottomNone minHeight48">
|
||||
<div class="homepagePostReplyPortrait mr15 imageFuzzy" id="reply_image_<%= user_activity_id%>"><%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(activity.author_id), :alt => "用户头像" %></div>
|
||||
<div class="homepagePostReplyInputContainer mb10">
|
||||
<div nhname='new_message_<%= user_activity_id%>' style="display:none;">
|
||||
<%= form_for('new_form',:url => {:controller => 'blog_comments', :action => 'reply', :user_id=>activity.author_id,:blog_id=>activity.blog_id,:id=>activity.id},:method => "post", :remote => true) do |f|%>
|
||||
<input type="hidden" name="quote[quote]" value="">
|
||||
<input type="hidden" name="in_user_center" value="true">
|
||||
<input type="hidden" name="blog_comment[sticky]" value="0">
|
||||
<input type="hidden" name="blog_comment[locked]" value="0">
|
||||
<input type="hidden" name="blog_comment[title]" value="RE:<%= activity.title%>">
|
||||
<input type="hidden" name="user_activity_id" value="<%=user_activity_id%>">
|
||||
<div nhname='toolbar_container_<%= user_activity_id%>'></div>
|
||||
<textarea placeholder="有问题或有建议,请直接给我留言吧!" style="display: none" nhname='new_message_textarea_<%= user_activity_id%>' name="blog_comment[content]"></textarea>
|
||||
<a id="new_message_submit_btn_<%= user_activity_id%>" href="javascript:void(0)" class="blue_n_btn fr" style="display:none;margin-top:6px;">发送</a>
|
||||
<div class="cl"></div>
|
||||
<p nhname='contentmsg_<%= user_activity_id%>'></p>
|
||||
<% end%>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
$("#moreProject_<%=user_activity_id %>").click(function(){
|
||||
$("#relatePWrap_<%=user_activity_id %>").toggleClass('relatePWrap');
|
||||
$("#relatePWrap_<%=user_activity_id %>").css("height","auto");
|
||||
$(this).hide();
|
||||
});
|
||||
$("#hideProject_<%=user_activity_id %>").click(function(){
|
||||
$("#relatePWrap_<%=user_activity_id %>").toggleClass('relatePWrap');
|
||||
$("#moreProject_<%=user_activity_id %>").show();
|
||||
});
|
||||
</script>
|
||||
<div class="resources mt10" id="user_activity_<%= user_activity_id%>">
|
||||
<div class="homepagePostBrief">
|
||||
<div class="homepagePostPortrait">
|
||||
<%= link_to image_tag(url_to_avatar(activity.author), :width => "50", :height => "50"), user_path(activity.author_id), :alt => "用户头像" %>
|
||||
<%= render :partial => 'users/show_detail_info', :locals => {:user => activity.author} %>
|
||||
</div>
|
||||
<div class="homepagePostDes">
|
||||
<div class="homepagePostTo break_word mt-4">
|
||||
<% if @ctivity.try(:author).try(:realname) == ' ' %>
|
||||
<%= link_to activity.try(:author), user_path(activity.author_id), :class => "newsBlue mr15" %>
|
||||
<% else %>
|
||||
<%= link_to activity.try(:author).try(:realname), user_path(activity.author_id), :class => "newsBlue mr15" %>
|
||||
<% end %> TO <!--+"(课程名称)"-->
|
||||
<%= link_to activity.author.name.to_s+" | 博客", user_blogs_path(:user_id=>activity.author_id), :class => "newsBlue ml15" %>
|
||||
</div>
|
||||
<div class="homepagePostTitle break_word"> <!--+"(通知标题)"-->
|
||||
<div class="fl">
|
||||
<%= link_to activity.title.to_s, user_blog_blog_comment_path(:user_id=>activity.author_id,:blog_id=>activity.blog_id,:id=>activity.id,:in_act => true), :class => "postGrey" %>
|
||||
</div>
|
||||
<% if activity.sticky == 1%>
|
||||
<span class="sticky_btn_cir ml10">置顶</span>
|
||||
<% end%>
|
||||
<% if activity.locked%>
|
||||
<span class="locked_btn_cir ml10 fl" title="已锁定"> </span>
|
||||
<% end%>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
|
||||
<div class="homepagePostDate fl">
|
||||
发布时间:<%= format_time(activity.created_on) %>
|
||||
</div>
|
||||
<div class="homepagePostDate fl ml15">
|
||||
更新时间:<%= format_time(UserActivity.where("act_type='#{activity.class}' and act_id =#{activity.id}").first.updated_at) %>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<%=render :partial =>"users/intro_content", :locals=>{:user_activity_id =>user_activity_id, :content=>activity.content} %>
|
||||
<div class="cl"></div>
|
||||
<div id="intro_content_show_<%= user_activity_id%>" class="fr" style="display:none;"><a href="javascript:void(0);" class="linkBlue">[展开]</a></div>
|
||||
<div id="intro_content_hide_<%= user_activity_id%>" class="fr" style="display:none;"><a href="javascript:void(0);" class="linkBlue">[收起]</a></div>
|
||||
<div class="cl"></div>
|
||||
<div class="mt10" style="font-weight:normal;">
|
||||
<%= render :partial=>"attachments/activity_attach", :locals=>{:activity => activity} %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<% count=activity.children.count %>
|
||||
<div class="homepagePostReply">
|
||||
<div class="homepagePostReplyBanner">
|
||||
<div class="homepagePostReplyBannerCount">回复
|
||||
<sapn class="mr15"><%= count>0 ? "(#{count})" : "" %></sapn><span style="color: #cecece;">▪</span>
|
||||
<span id="praise_count_<%=user_activity_id %>">
|
||||
<% if activity.author == User.current %>
|
||||
<span class="ml15 likeButton" title="不能自己赞自己哦!"> <span class="likeText">赞</span><span class="likeNum"><%= get_praise_num(activity) > 0 ? "(#{get_praise_num(activity)})" : "" %></span></span>
|
||||
<% else %>
|
||||
<%=render :partial=> "praise_tread/praise", :locals => {:activity=>activity, :user_activity_id=>user_activity_id,:type=>"activity"}%>
|
||||
<% end %>
|
||||
</span>
|
||||
</div>
|
||||
<div class="homepagePostReplyBannerTime"><%#= format_date(activity.updated_on) %></div>
|
||||
<%if count>3 %>
|
||||
<div class="homepagePostReplyBannerMore">
|
||||
<a id="reply_btn_<%=user_activity_id%>" onclick="expand_reply('#reply_div_<%= user_activity_id %> li','#reply_btn_<%=user_activity_id%>')" data-count="<%= count %>" data-init="0" class=" replyGrey" href="javascript:void(0)" value="show_help" >
|
||||
展开更多
|
||||
</a>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<% replies_all_i = 0 %>
|
||||
<% if count > 0 %>
|
||||
<div class="" id="reply_div_<%= user_activity_id %>">
|
||||
<ul>
|
||||
<% activity.children.reorder("created_on desc").each do |comment| %>
|
||||
<script type="text/javascript">
|
||||
$(function(){
|
||||
showNormalImage('reply_content_<%= comment.id %>');
|
||||
});
|
||||
</script>
|
||||
<% replies_all_i = replies_all_i + 1 %>
|
||||
<li class="homepagePostReplyContainer" nhname="reply_rec" style="display:<%= replies_all_i > 3 ? 'none' : '' %>">
|
||||
<div class="homepagePostReplyPortrait">
|
||||
<%= link_to image_tag(url_to_avatar(comment.author), :width => "33", :height => "33"), user_path(comment.author_id), :alt => "用户头像" %>
|
||||
</div>
|
||||
<div class="homepagePostReplyDes">
|
||||
<div class="homepagePostReplyPublisher mt-4">
|
||||
<% if comment.try(:author).try(:realname) == ' ' %>
|
||||
<%= link_to comment.try(:author), user_path(comment.author_id), :class => "newsBlue mr10 f14" %>
|
||||
<% else %>
|
||||
<%= link_to comment.try(:author).try(:realname), user_path(comment.author_id), :class => "newsBlue mr10 f14" %>
|
||||
<% end %>
|
||||
<%= format_time(comment.created_on) %>
|
||||
<span id="reply_praise_count_<%=comment.id %>">
|
||||
<% if comment.author == User.current %>
|
||||
<span class="fr likeButton" title="不能自己赞自己哦!"> <span class="likeText">赞</span><span class="likeNum"><%= get_praise_num(comment) > 0 ? "(#{get_praise_num(comment)})" : "" %></span></span>
|
||||
<% else %>
|
||||
<%=render :partial=> "praise_tread/praise", :locals => {:activity=>comment, :user_activity_id=>comment.id,:type=>"reply"}%>
|
||||
<% end %>
|
||||
</span>
|
||||
</div>
|
||||
<div class="homepagePostReplyContent break_word list_style upload_img table_maxWidth" id="reply_content_<%= comment.id %>">
|
||||
<%= comment.content.html_safe %></div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<% if activity.locked == false && User.current.logged?%>
|
||||
<div class="homepagePostReplyContainer borderBottomNone minHeight48">
|
||||
<div class="homepagePostReplyPortrait mr15 imageFuzzy" id="reply_image_<%= user_activity_id%>"><%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(activity.author_id), :alt => "用户头像" %></div>
|
||||
<div class="homepagePostReplyInputContainer mb10">
|
||||
<div nhname='new_message_<%= user_activity_id%>' style="display:none;">
|
||||
<%= form_for('new_form',:url => {:controller => 'blog_comments', :action => 'reply', :user_id=>activity.author_id,:blog_id=>activity.blog_id,:id=>activity.id},:method => "post", :remote => true) do |f|%>
|
||||
<input type="hidden" name="quote[quote]" value="">
|
||||
<input type="hidden" name="in_user_center" value="true">
|
||||
<input type="hidden" name="blog_comment[sticky]" value="0">
|
||||
<input type="hidden" name="blog_comment[locked]" value="0">
|
||||
<input type="hidden" name="blog_comment[title]" value="RE:<%= activity.title%>">
|
||||
<input type="hidden" name="user_activity_id" value="<%=user_activity_id%>">
|
||||
<div nhname='toolbar_container_<%= user_activity_id%>'></div>
|
||||
<textarea placeholder="有问题或有建议,请直接给我留言吧!" style="display: none" nhname='new_message_textarea_<%= user_activity_id%>' name="blog_comment[content]"></textarea>
|
||||
<a id="new_message_submit_btn_<%= user_activity_id%>" href="javascript:void(0)" onclick="this.style.display='none'" class="blue_n_btn fr" style="display:none;margin-top:6px;">发送</a>
|
||||
<div class="cl"></div>
|
||||
<p nhname='contentmsg_<%= user_activity_id%>'></p>
|
||||
<% end%>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
$("#moreProject_<%=user_activity_id %>").click(function(){
|
||||
$("#relatePWrap_<%=user_activity_id %>").toggleClass('relatePWrap');
|
||||
$("#relatePWrap_<%=user_activity_id %>").css("height","auto");
|
||||
$(this).hide();
|
||||
});
|
||||
$("#hideProject_<%=user_activity_id %>").click(function(){
|
||||
$("#relatePWrap_<%=user_activity_id %>").toggleClass('relatePWrap');
|
||||
$("#moreProject_<%=user_activity_id %>").show();
|
||||
});
|
||||
</script>
|
||||
|
|
|
@ -48,7 +48,7 @@
|
|||
<% end%>
|
||||
<div class="cl"></div>
|
||||
<% if homework_common.homework_type == 3 && homework_common.homework_detail_group.base_on_project == 1%>
|
||||
<span class="c_red">系统提示:该作业要求各组长<%=link_to "创建项目", new_project_path(:host=>Setting.host_name),:class=>"c_red",:title=>"新建项目",:style=>"text-decoration:underline;"%>,组成员加入项目,然后由组长关联项目。谢谢配合!</span>
|
||||
<span class="c_red">系统提示:该作业要求各组长<%=link_to "创建项目", new_project_path(:host=>Setting.host_name),:class=>"linkBlue",:title=>"新建项目",:style=>"text-decoration:underline;"%>,组成员加入项目,然后由组长关联项目。谢谢配合!</span>
|
||||
<% elsif homework_common.homework_type == 3 && homework_common.homework_detail_group.base_on_project == 0%>
|
||||
<span class="c_red">系统提示:该作业要求各组长提交作品,提交作品时请添加组成员。谢谢配合!</span>
|
||||
<% end %>
|
||||
|
@ -157,8 +157,18 @@
|
|||
<% end %>
|
||||
<% student_works.each_with_index do |sw, i| %>
|
||||
<div class="fl mr10 w100" style="text-align:center;">
|
||||
<a href="javascript:void(0);" class="linkBlue"><%= link_to image_tag(url_to_avatar(User.find sw.user_id), :width => "40", :height => "40"), student_work_index_path(:homework => homework_common.id), :alt => "学生头像" %>
|
||||
<p class="w100 hidden"><%= link_to sw.user.show_name, student_work_index_path(:homework => homework_common.id)%></p>
|
||||
<a href="javascript:void(0);" class="linkBlue">
|
||||
<% if User.current.member_of_course?(homework_common.course) || User.current.admin? || homework_common.is_open == 1 %>
|
||||
<%= link_to image_tag(url_to_avatar(User.find sw.user_id), :width => "40", :height => "40"), student_work_index_path(:homework => homework_common.id), :alt => "学生头像" %>
|
||||
<p class="w100 hidden">
|
||||
<%= link_to sw.user.show_name, student_work_index_path(:homework => homework_common.id)%>
|
||||
</p>
|
||||
<% else %>
|
||||
<%= image_tag(url_to_avatar(User.find sw.user_id), :width => "40", :height => "40", :title => '该作业的作品暂未公开') %>
|
||||
<p class="w100 hidden">
|
||||
<a href="javascript:void(0);" title="该作业的作品暂未公开"><%=sw.user.show_name %></a>
|
||||
</p>
|
||||
<% end %>
|
||||
</a>
|
||||
<% score = sw.respond_to?("score") ? sw.score : (sw.final_score || 0) - sw.absence_penalty - sw.late_penalty %>
|
||||
<p class="fontGrey2">分数:<span class="c_red"><%=format("%.1f",score.to_i<0 ? 0 : score.to_i) %>分</span></p>
|
||||
|
@ -350,7 +360,7 @@
|
|||
<%= hidden_field_tag 'is_in_course',params[:is_in_course],:value =>is_in_course %>
|
||||
<div nhname='toolbar_container_<%= homework_common.id%>'></div>
|
||||
<textarea placeholder="有问题或有建议,请直接给我留言吧!" style="display: none" nhname='new_message_textarea_<%= homework_common.id%>' name="homework_message"></textarea>
|
||||
<a id="new_message_submit_btn_<%= homework_common.id%>" href="javascript:void(0)" class="blue_n_btn fr" style="display:none;margin-top:6px;">发送</a>
|
||||
<a id="new_message_submit_btn_<%= homework_common.id%>" href="javascript:void(0)" onclick="this.style.display='none'" class="blue_n_btn fr" style="display:none;margin-top:6px;">发送</a>
|
||||
<div class="cl"></div>
|
||||
<p nhname='contentmsg_<%= homework_common.id%>'></p>
|
||||
<% end%>
|
||||
|
|
|
@ -1,152 +1,152 @@
|
|||
<div class="resources mt10" id="user_activity_<%= user_activity_id%>" style="<%= activity.private == 1? 'background-color:#cecece;':'' %>">
|
||||
<div class="homepagePostBrief">
|
||||
<div class="homepagePostPortrait">
|
||||
<%= link_to image_tag(url_to_avatar(activity.user), :width => "50", :height => "50"), user_path(activity.user_id), :alt => "用户头像" %>
|
||||
<%= render :partial => 'users/show_detail_info', :locals => {:user => activity.user} %>
|
||||
</div>
|
||||
<div class="homepagePostDes">
|
||||
<div class="homepagePostTo break_word">
|
||||
<%= link_to activity.user.show_name, user_path(activity.user_id), :class => "newsBlue mr15" %>
|
||||
TO
|
||||
<% if activity.jour %>
|
||||
<%= link_to activity.jour.show_name+"("+(activity.jour.login ? activity.jour.login : activity.jour.show_name ).to_s+")的"+ (activity.private == 1? "私信":"留言"),
|
||||
feedback_path(activity.jour, :host=> Setting.host_user), :class => "newsBlue ml15" %>
|
||||
<% if activity.private == 1 %>
|
||||
<span class="PMTag ml15 f12">私信</span>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
<% if is_activity.to_i == 1 %>
|
||||
<div class="homepagePostTitle break_word list_style upload_img">
|
||||
<% if activity.parent %>
|
||||
<%= link_to activity.parent.notes.html_safe, feedback_path(activity.jour, :host=> Setting.host_user), :class => "postGrey" %>
|
||||
<% else %>
|
||||
<%= link_to activity.notes.html_safe, feedback_path(activity.jour, :host=> Setting.host_user), :class => "postGrey" %>
|
||||
<% end %>
|
||||
</div>
|
||||
<% else %>
|
||||
<% if activity.parent %>
|
||||
<% content = activity.parent.notes %>
|
||||
<% else %>
|
||||
<% content = activity.notes %>
|
||||
<% end %>
|
||||
<%=render :partial =>"users/intro_content", :locals=>{:user_activity_id =>user_activity_id, :content=>content} %>
|
||||
<% end %>
|
||||
<div class="homepagePostDate fl">
|
||||
留言时间:<%= format_time(activity.created_on) %>
|
||||
</div>
|
||||
<div class="homepagePostDate fl ml15">
|
||||
更新时间:<%= format_time(PrincipalActivity.where("principal_act_type='#{activity.class}' and principal_act_id =#{activity.id}").first.updated_at) %>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<% if activity.user == User.current || User.current.admin?%>
|
||||
<div class="homepagePostSetting">
|
||||
<ul>
|
||||
<li class="<%= activity.private == 1 ? 'whiteSettingIcon' : 'homepagePostSettingIcon' %>">
|
||||
<ul class="homepagePostSettiongText">
|
||||
<li>
|
||||
<%= link_to(l(:label_bid_respond_delete),
|
||||
{:controller => 'words', :action => 'destroy', :object_id => activity, :user_id => activity.user,:user_activity_id => user_activity_id,:is_activity=>is_activity},
|
||||
:confirm => l(:text_are_you_sure), :method => 'delete',
|
||||
:class => "postOptionLink", :title => l(:button_delete)) %>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<% end%>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<% count=fetch_user_leaveWord_reply(activity).count %>
|
||||
<div class="homepagePostReply">
|
||||
<div class="homepagePostReplyBanner">
|
||||
<div class="homepagePostReplyBannerCount">回复
|
||||
<sapn class="mr15"><%= count>0 ? "(#{count})" : "" %></sapn><span style="color: #cecece;">▪</span>
|
||||
<span id="praise_count_<%=user_activity_id %>">
|
||||
<% if activity.user == User.current %>
|
||||
<span class="ml15 likeButton" title="不能自己赞自己哦!"> <span class="likeText">赞</span><span class="likeNum"><%= get_praise_num(activity) > 0 ? "(#{get_praise_num(activity)})" : "" %></span></span>
|
||||
<% else %>
|
||||
<%=render :partial=> "praise_tread/praise", :locals => {:activity=>activity, :user_activity_id=>user_activity_id,:type=>"activity"}%>
|
||||
<% end %>
|
||||
</span>
|
||||
</div>
|
||||
<div class="homepagePostReplyBannerTime"></div>
|
||||
<%if count>3 %>
|
||||
<div class="homepagePostReplyBannerMore">
|
||||
<a id="reply_btn_<%=user_activity_id%>" onclick="expand_reply('#reply_div_<%= user_activity_id %> li','#reply_btn_<%=user_activity_id%>')" data-count="<%= count %>" data-init="0" class=" replyGrey" href="javascript:void(0)" value="show_help" >
|
||||
展开更多
|
||||
</a>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<% replies_all_i = 0 %>
|
||||
<% if count > 0 %>
|
||||
<div class="" id="reply_div_<%= user_activity_id %>">
|
||||
<ul>
|
||||
<% fetch_user_leaveWord_reply(activity).reorder("created_on desc").each do |comment| %>
|
||||
<% replies_all_i = replies_all_i + 1 %>
|
||||
<li class="homepagePostReplyContainer" nhname="reply_rec" onmouseover="$('#message_delete_<%= comment.id%>').show();" onmouseout="$('#message_delete_<%= comment.id%>').hide();" style="display:<%= replies_all_i > 3 ? 'none' : '' %>">
|
||||
<div class="homepagePostReplyPortrait">
|
||||
<%= link_to image_tag(url_to_avatar(comment.user), :width => "33", :height => "33", :class =>"mt8"), user_path(comment.user_id), :alt => "用户头像" %>
|
||||
</div>
|
||||
<div class="homepagePostReplyDes">
|
||||
<div class="homepagePostReplyPublisher">
|
||||
<% if comment.try(:user).try(:realname) == ' ' %>
|
||||
<%= link_to comment.try(:user), user_path(comment.user_id), :class => "newsBlue mr10 f14" %>
|
||||
<% else %>
|
||||
<%= link_to comment.try(:user).try(:realname), user_path(comment.user_id), :class => "newsBlue mr10 f14" %>
|
||||
<% end %>
|
||||
<%= format_time(comment.created_on) %>
|
||||
<span id="reply_praise_count_<%=comment.id %>">
|
||||
<% if comment.user == User.current %>
|
||||
<span class="fr likeButton" title="不能自己赞自己哦!"> <span class="likeText">赞</span><span class="likeNum"><%= get_praise_num(comment) > 0 ? "(#{get_praise_num(comment)})" : "" %></span></span>
|
||||
<% else %>
|
||||
<%=render :partial=> "praise_tread/praise", :locals => {:activity=>comment, :user_activity_id=>comment.id,:type=>"reply"}%>
|
||||
<% end %>
|
||||
</span>
|
||||
<div id="message_delete_<%=comment.id %>" style="display: none" class="mr10 fr">
|
||||
<% if comment.user == User.current|| User.current.admin? %>
|
||||
<%= link_to(l(:label_bid_respond_delete),
|
||||
{:controller => 'words', :action => 'destroy', :object_id => comment, :user_id => comment.user,:user_activity_id => user_activity_id,:is_activity=>is_activity},
|
||||
:remote => true, :confirm => l(:text_are_you_sure), :method => 'delete',
|
||||
:class => "delete", :title => l(:button_delete)) %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="homepagePostReplyContent break_word list_style upload_img table_maxWidth" id="reply_content_<%= user_activity_id %>">
|
||||
<%= comment.notes.html_safe %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<div class="homepagePostReplyContainer borderBottomNone minHeight48">
|
||||
<div class="homepagePostReplyPortrait mr15 imageFuzzy" id="reply_image_<%= user_activity_id%>"><%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), :alt => "用户头像" %></div>
|
||||
<div class="homepagePostReplyInputContainer mb10">
|
||||
<div nhname='new_message_<%= user_activity_id%>' style="display:none;">
|
||||
<%= form_for('new_form',:url => {:controller => 'words', :action => 'create_reply', :id => activity.id},:method => "post", :remote => true) do |f|%>
|
||||
<%= hidden_field_tag 'reference_id', params[:reference_id], :value => activity.id %>
|
||||
<%= hidden_field_tag 'reference_user_id', params[:reference_user_id], :value => activity.user.id %>
|
||||
<%= hidden_field_tag 'reference_message_id', params[:reference_message_id], :value => activity.id %>
|
||||
<%= hidden_field_tag 'show_name',params[:show_name],:value =>true %>
|
||||
<%= hidden_field_tag 'user_activity_id',params[:user_activity_id],:value =>user_activity_id %>
|
||||
<%= hidden_field_tag 'is_activity',params[:is_activity],:value =>is_activity %>
|
||||
<div nhname='toolbar_container_<%= user_activity_id%>'></div>
|
||||
<textarea placeholder="有问题或有建议,请直接给我留言吧!" style="display: none" nhname='new_message_textarea_<%= user_activity_id%>' name="user_notes"></textarea>
|
||||
<a id="new_message_submit_btn_<%= user_activity_id%>" href="javascript:void(0)" class="blue_n_btn fr" style="display:none;margin-top:6px;">发送</a>
|
||||
<div class="cl"></div>
|
||||
<p nhname='contentmsg_<%= user_activity_id%>'></p>
|
||||
<% end%>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="resources mt10" id="user_activity_<%= user_activity_id%>" style="<%= activity.private == 1? 'background-color:#cecece;':'' %>">
|
||||
<div class="homepagePostBrief">
|
||||
<div class="homepagePostPortrait">
|
||||
<%= link_to image_tag(url_to_avatar(activity.user), :width => "50", :height => "50"), user_path(activity.user_id), :alt => "用户头像" %>
|
||||
<%= render :partial => 'users/show_detail_info', :locals => {:user => activity.user} %>
|
||||
</div>
|
||||
<div class="homepagePostDes">
|
||||
<div class="homepagePostTo break_word">
|
||||
<%= link_to activity.user.show_name, user_path(activity.user_id), :class => "newsBlue mr15" %>
|
||||
TO
|
||||
<% if activity.jour %>
|
||||
<%= link_to activity.jour.show_name+"("+(activity.jour.login ? activity.jour.login : activity.jour.show_name ).to_s+")的"+ (activity.private == 1? "私信":"留言"),
|
||||
feedback_path(activity.jour, :host=> Setting.host_user), :class => "newsBlue ml15" %>
|
||||
<% if activity.private == 1 %>
|
||||
<span class="PMTag ml15 f12">私信</span>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
<% if is_activity.to_i == 1 %>
|
||||
<div class="homepagePostTitle break_word list_style upload_img">
|
||||
<% if activity.parent %>
|
||||
<%= link_to activity.parent.notes.html_safe, feedback_path(activity.jour, :host=> Setting.host_user), :class => "postGrey" %>
|
||||
<% else %>
|
||||
<%= link_to activity.notes.html_safe, feedback_path(activity.jour, :host=> Setting.host_user), :class => "postGrey" %>
|
||||
<% end %>
|
||||
</div>
|
||||
<% else %>
|
||||
<% if activity.parent %>
|
||||
<% content = activity.parent.notes %>
|
||||
<% else %>
|
||||
<% content = activity.notes %>
|
||||
<% end %>
|
||||
<%=render :partial =>"users/intro_content", :locals=>{:user_activity_id =>user_activity_id, :content=>content} %>
|
||||
<% end %>
|
||||
<div class="homepagePostDate fl">
|
||||
留言时间:<%= format_time(activity.created_on) %>
|
||||
</div>
|
||||
<div class="homepagePostDate fl ml15">
|
||||
更新时间:<%= format_time(PrincipalActivity.where("principal_act_type='#{activity.class}' and principal_act_id =#{activity.id}").first.updated_at) %>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<% if activity.user == User.current || User.current.admin?%>
|
||||
<div class="homepagePostSetting">
|
||||
<ul>
|
||||
<li class="<%= activity.private == 1 ? 'whiteSettingIcon' : 'homepagePostSettingIcon' %>">
|
||||
<ul class="homepagePostSettiongText">
|
||||
<li>
|
||||
<%= link_to(l(:label_bid_respond_delete),
|
||||
{:controller => 'words', :action => 'destroy', :object_id => activity, :user_id => activity.user,:user_activity_id => user_activity_id,:is_activity=>is_activity},
|
||||
:confirm => l(:text_are_you_sure), :method => 'delete',
|
||||
:class => "postOptionLink", :title => l(:button_delete)) %>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<% end%>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<% count=fetch_user_leaveWord_reply(activity).count %>
|
||||
<div class="homepagePostReply">
|
||||
<div class="homepagePostReplyBanner">
|
||||
<div class="homepagePostReplyBannerCount">回复
|
||||
<sapn class="mr15"><%= count>0 ? "(#{count})" : "" %></sapn><span style="color: #cecece;">▪</span>
|
||||
<span id="praise_count_<%=user_activity_id %>">
|
||||
<% if activity.user == User.current %>
|
||||
<span class="ml15 likeButton" title="不能自己赞自己哦!"> <span class="likeText">赞</span><span class="likeNum"><%= get_praise_num(activity) > 0 ? "(#{get_praise_num(activity)})" : "" %></span></span>
|
||||
<% else %>
|
||||
<%=render :partial=> "praise_tread/praise", :locals => {:activity=>activity, :user_activity_id=>user_activity_id,:type=>"activity"}%>
|
||||
<% end %>
|
||||
</span>
|
||||
</div>
|
||||
<div class="homepagePostReplyBannerTime"></div>
|
||||
<%if count>3 %>
|
||||
<div class="homepagePostReplyBannerMore">
|
||||
<a id="reply_btn_<%=user_activity_id%>" onclick="expand_reply('#reply_div_<%= user_activity_id %> li','#reply_btn_<%=user_activity_id%>')" data-count="<%= count %>" data-init="0" class=" replyGrey" href="javascript:void(0)" value="show_help" >
|
||||
展开更多
|
||||
</a>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<% replies_all_i = 0 %>
|
||||
<% if count > 0 %>
|
||||
<div class="" id="reply_div_<%= user_activity_id %>">
|
||||
<ul>
|
||||
<% fetch_user_leaveWord_reply(activity).reorder("created_on desc").each do |comment| %>
|
||||
<% replies_all_i = replies_all_i + 1 %>
|
||||
<li class="homepagePostReplyContainer" nhname="reply_rec" onmouseover="$('#message_delete_<%= comment.id%>').show();" onmouseout="$('#message_delete_<%= comment.id%>').hide();" style="display:<%= replies_all_i > 3 ? 'none' : '' %>">
|
||||
<div class="homepagePostReplyPortrait">
|
||||
<%= link_to image_tag(url_to_avatar(comment.user), :width => "33", :height => "33", :class =>"mt8"), user_path(comment.user_id), :alt => "用户头像" %>
|
||||
</div>
|
||||
<div class="homepagePostReplyDes">
|
||||
<div class="homepagePostReplyPublisher">
|
||||
<% if comment.try(:user).try(:realname) == ' ' %>
|
||||
<%= link_to comment.try(:user), user_path(comment.user_id), :class => "newsBlue mr10 f14" %>
|
||||
<% else %>
|
||||
<%= link_to comment.try(:user).try(:realname), user_path(comment.user_id), :class => "newsBlue mr10 f14" %>
|
||||
<% end %>
|
||||
<%= format_time(comment.created_on) %>
|
||||
<span id="reply_praise_count_<%=comment.id %>">
|
||||
<% if comment.user == User.current %>
|
||||
<span class="fr likeButton" title="不能自己赞自己哦!"> <span class="likeText">赞</span><span class="likeNum"><%= get_praise_num(comment) > 0 ? "(#{get_praise_num(comment)})" : "" %></span></span>
|
||||
<% else %>
|
||||
<%=render :partial=> "praise_tread/praise", :locals => {:activity=>comment, :user_activity_id=>comment.id,:type=>"reply"}%>
|
||||
<% end %>
|
||||
</span>
|
||||
<div id="message_delete_<%=comment.id %>" style="display: none" class="mr10 fr">
|
||||
<% if comment.user == User.current|| User.current.admin? %>
|
||||
<%= link_to(l(:label_bid_respond_delete),
|
||||
{:controller => 'words', :action => 'destroy', :object_id => comment, :user_id => comment.user,:user_activity_id => user_activity_id,:is_activity=>is_activity},
|
||||
:remote => true, :confirm => l(:text_are_you_sure), :method => 'delete',
|
||||
:class => "delete", :title => l(:button_delete)) %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="homepagePostReplyContent break_word list_style upload_img table_maxWidth" id="reply_content_<%= user_activity_id %>">
|
||||
<%= comment.notes.html_safe %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<div class="homepagePostReplyContainer borderBottomNone minHeight48">
|
||||
<div class="homepagePostReplyPortrait mr15 imageFuzzy" id="reply_image_<%= user_activity_id%>"><%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), :alt => "用户头像" %></div>
|
||||
<div class="homepagePostReplyInputContainer mb10">
|
||||
<div nhname='new_message_<%= user_activity_id%>' style="display:none;">
|
||||
<%= form_for('new_form',:url => {:controller => 'words', :action => 'create_reply', :id => activity.id},:method => "post", :remote => true) do |f|%>
|
||||
<%= hidden_field_tag 'reference_id', params[:reference_id], :value => activity.id %>
|
||||
<%= hidden_field_tag 'reference_user_id', params[:reference_user_id], :value => activity.user.id %>
|
||||
<%= hidden_field_tag 'reference_message_id', params[:reference_message_id], :value => activity.id %>
|
||||
<%= hidden_field_tag 'show_name',params[:show_name],:value =>true %>
|
||||
<%= hidden_field_tag 'user_activity_id',params[:user_activity_id],:value =>user_activity_id %>
|
||||
<%= hidden_field_tag 'is_activity',params[:is_activity],:value =>is_activity %>
|
||||
<div nhname='toolbar_container_<%= user_activity_id%>'></div>
|
||||
<textarea placeholder="有问题或有建议,请直接给我留言吧!" style="display: none" nhname='new_message_textarea_<%= user_activity_id%>' name="user_notes"></textarea>
|
||||
<a id="new_message_submit_btn_<%= user_activity_id%>" href="javascript:void(0)" onclick="this.style.display='none'" class="blue_n_btn fr" style="display:none;margin-top:6px;">发送</a>
|
||||
<div class="cl"></div>
|
||||
<p nhname='contentmsg_<%= user_activity_id%>'></p>
|
||||
<% end%>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
|
@ -246,7 +246,9 @@
|
|||
<% if ma.course_message_type == "Message" %>
|
||||
<ul class="homepageNewsList fl">
|
||||
<li class="homepageNewsPortrait fl"><a href="javascript:void(0);"><%=link_to image_tag(url_to_avatar(ma.course_message.author), :width => "30", :height => "30"), user_path(ma.course_message.author) %></a></li>
|
||||
<li class="homepageNewsPubType fl"><%=link_to ma.course_message.author, user_path(ma.course_message.author), :class => "newsBlue homepageNewsPublisher" %><span class="<%= ma.viewed == 0 ? "homepageNewsTypeNotRead fl":"homepageNewsType fl" %>"><%= ma.course_message.parent_id.nil? ? "发布了课程帖子:" : "评论了课程帖子:" %></span></li>
|
||||
<li class="homepageNewsPubType fl">
|
||||
<%=link_to ma.course_message.author, user_path(ma.course_message.author), :class => "newsBlue homepageNewsPublisher" %><span class="<%= ma.viewed == 0 ? "homepageNewsTypeNotRead fl":"homepageNewsType fl" %>">
|
||||
<%= ma.course_message.parent_id.nil? ? "发布了课程帖子:" : "评论了课程帖子:" %></span></li>
|
||||
<% if ma.course_message.parent_id.nil? %>
|
||||
<li class="homepageNewsContent fl"><a href="javascript:void(0);" class="newsGrey">
|
||||
<%= link_to ma.course_message.subject, course_boards_path(ma.course_message.course, :parent_id => ma.course_message.parent_id ? ma.course_message.parent_id : ma.course_message.id, :topic_id => ma.course_message.id),
|
||||
|
@ -382,7 +384,7 @@
|
|||
<% end %>
|
||||
<% end %>
|
||||
<!-- 作业迟交,不能参与匿评提醒消息 -->
|
||||
<% if ma.course_message_type == "StudentWork" && !ma.course_message.homework_common.nil? && ma.course_message.homework_common.user_id != User.current.id %>
|
||||
<% if ma.course_message_type == "StudentWork" && !ma.course_message.homework_common.nil? %>
|
||||
<ul class="homepageNewsList fl">
|
||||
<li class="homepageNewsPortrait fl"><a href="javascript:void(0);"><%= link_to image_tag(url_to_avatar(ma.course_message.homework_common.user), :width => "30", :height => "30"), user_path(ma.course_message.homework_common.user) %></a></li>
|
||||
<li class="homepageNewsPubType fl">
|
||||
|
|
|
@ -1,30 +1,30 @@
|
|||
<% if ma.class == UserFeedbackMessage %>
|
||||
<% if ma.journals_for_message_type == "JournalsForMessage" %>
|
||||
<ul class="homepageNewsList fl">
|
||||
<li class="homepageNewsPortrait fl">
|
||||
<a href="javascript:void(0);"><%=link_to image_tag(url_to_avatar(ma.journals_for_message.user), :width => "30", :height => "30"), user_path(ma.journals_for_message.user) %></a>
|
||||
</li>
|
||||
<li class="homepageNewsPubType fl">
|
||||
<%=link_to ma.journals_for_message.user, user_path(ma.journals_for_message.user), :class => "newsBlue homepageNewsPublisher" %>
|
||||
<span class="<%= ma.viewed == 0 ? "homepageNewsTypeNotRead fl":"homepageNewsType fl" %>"><%= ma.journals_for_message.reply_id == 0 ? "给你留言了:" : "回复了你的留言:" %></span>
|
||||
</li>
|
||||
<li class="homepageNewsContent fl"><a href="javascript:void(0);" class="newsGrey">
|
||||
<%= link_to ma.journals_for_message.notes.gsub("<p>","").gsub("</p>","").gsub("<br />","").html_safe, feedback_path(ma.journals_for_message.jour_id), :class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}",
|
||||
:onmouseover =>"message_titile_show($(this),event)",
|
||||
:onmouseout => "message_titile_hide($(this))" %></a>
|
||||
</li>
|
||||
<div style="display: none" class="message_title_red system_message_style" >
|
||||
<% if ma.journals_for_message.reply_id == 0 %>
|
||||
<%= ma.journals_for_message.notes.html_safe %>
|
||||
<% else %>
|
||||
<div class="fl"><strong>您的留言:</strong></div>
|
||||
<div class="ml60"><%= JournalsForMessage.find(ma.journals_for_message.m_reply_id).notes.html_safe %></div>
|
||||
<div class="fl"><strong>回复内容:</strong></div>
|
||||
<div class="ml60"><%= ma.journals_for_message.notes.html_safe %></div>
|
||||
<% end %>
|
||||
</div>
|
||||
<li class="homepageNewsTime fl"><%= time_tag(ma.journals_for_message.created_on).html_safe %> </li>
|
||||
|
||||
</ul>
|
||||
<% end %>
|
||||
<% if ma.class == UserFeedbackMessage %>
|
||||
<% if ma.journals_for_message_type == "JournalsForMessage" %>
|
||||
<ul class="homepageNewsList fl">
|
||||
<li class="homepageNewsPortrait fl">
|
||||
<a href="javascript:void(0);"><%=link_to image_tag(url_to_avatar(ma.journals_for_message.user), :width => "30", :height => "30"), user_path(ma.journals_for_message.user) %></a>
|
||||
</li>
|
||||
<li class="homepageNewsPubType fl">
|
||||
<%=link_to ma.journals_for_message.user, user_path(ma.journals_for_message.user), :class => "newsBlue homepageNewsPublisher" %>
|
||||
<span class="<%= ma.viewed == 0 ? "homepageNewsTypeNotRead fl":"homepageNewsType fl" %>"><%= ma.journals_for_message.reply_id == 0 ? "给你留言了:" : "回复了你的留言:" %></span>
|
||||
</li>
|
||||
<li class="homepageNewsContent fl">
|
||||
<%= link_to ma.journals_for_message.notes.gsub("<p>","").gsub("</p>","").gsub("<br />","").html_safe, feedback_path(ma.journals_for_message.jour_id), :class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}",
|
||||
:onmouseover =>"message_titile_show($(this),event)",
|
||||
:onmouseout => "message_titile_hide($(this))" %>
|
||||
</li>
|
||||
<div style="display: none" class="message_title_red system_message_style" >
|
||||
<% if ma.journals_for_message.reply_id == 0 %>
|
||||
<%= ma.journals_for_message.notes.html_safe %>
|
||||
<% else %>
|
||||
<div class="fl"><strong>您的留言:</strong></div>
|
||||
<div class="ml60"><%= JournalsForMessage.find(ma.journals_for_message.m_reply_id).notes.html_safe %></div>
|
||||
<div class="fl"><strong>回复内容:</strong></div>
|
||||
<div class="ml60"><%= ma.journals_for_message.notes.html_safe %></div>
|
||||
<% end %>
|
||||
</div>
|
||||
<li class="homepageNewsTime fl"><%= time_tag(ma.journals_for_message.created_on).html_safe %> </li>
|
||||
|
||||
</ul>
|
||||
<% end %>
|
||||
<% end %>
|
|
@ -3,7 +3,6 @@
|
|||
<div id="search_div">
|
||||
<%= render :partial => 'users/resource_search_form',:locals => {:user => @user, :type => @type} %>
|
||||
</div>
|
||||
<div style="float: left; margin-top: 7px; font-size: 14px; margin-left: 15px;"><span style="align:center ;font-size: 14px;color: gray;">为您找到<span id="res_all_count"><%= @atta_count %></span>个资源</span></div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<ul class="resource-list-tab mt10">
|
||||
|
|
|
@ -4,7 +4,7 @@ $("#homewrok_ref_pages").html('<%= pagination_links_full @hw_pages, @hw_count, :
|
|||
$("#homework_detail_information").html("<%=escape_javascript(render :partial => 'users/homework_detail_information', :locals => {:homework=>nil}) %>");
|
||||
$("#homework_search_input").html("<%=escape_javascript(render :partial=>'homework_search_input', :locals=>{:type=>@type,:is_import=>@is_import}) %>");
|
||||
<% else %>
|
||||
$("#homework_repository").html('<%= escape_javascript(render :partial => 'users/homework_repository', :locals => {:homeworks => @homeworks})%>');
|
||||
$("#homework_repository_list").html('<%= escape_javascript(render :partial => 'users/homework_repository_list', :locals => {:homeworks => @homeworks,:sort => @order,:b_sort => @b_sort,:type=>@type,:is_import => @is_import,:property => @property,:search=>''})%>');
|
||||
$("#homework_pository_ref_pages").html('<%= pagination_links_full @hw_pages, @hw_count, :per_page_links => false, :remote => @is_remote, :flag => true %>');
|
||||
$("#homework_repository_detail").html("<%=escape_javascript(render :partial => 'users/homework_repository_detail', :locals => {:homework=>nil}) %>");
|
||||
$("#homework_search_input").html("<%=escape_javascript(render :partial=>'homework_repository_search', :locals=>{:type=>@type,:is_import=>@is_import,:property=>@property}) %>");
|
||||
|
|
|
@ -58,40 +58,26 @@
|
|||
</ul>
|
||||
<div class="cl"></div>
|
||||
<div id="homework_search_input" class="mt10 fl">
|
||||
<%=render :partial=>'homework_repository_search', :locals=>{:type => @type,:is_import => 0,:property => @property} %>
|
||||
<%=render :partial=>'homework_repository_search', :locals=>{:type => @type,:is_import => 0,:property => @property} %>
|
||||
</div>
|
||||
<!--<form class="resourcesSearchloadBox mt10">
|
||||
<input type="text" name="serach" placeholder="输入题库关键词进行搜索" class="searchResource" />
|
||||
<a href="javascript:void(0);" class="homepageSearchIcon"></a>
|
||||
</form>-->
|
||||
<div class="cl"></div>
|
||||
<div class="w583 fl mr10 mt10">
|
||||
<ul class="subject-list-banner">
|
||||
<li class="subject-list-name fl hidden"><span style="padding-left:15px;">作业名称</span></li>
|
||||
<li class="subject-list-from fl">来源</li>
|
||||
<li class="subject-list-type fl">类别</li>
|
||||
<li class="subject-list-publisher fl">贡献者</li>
|
||||
<li class="subject-list-count fl">引用数</li>
|
||||
<li class="fl subject-list-date">发布时间</li>
|
||||
</ul>
|
||||
<div id="homework_repository">
|
||||
<%=render :partial => 'homework_repository', :locals => {:homeworks => @homeworks} %>
|
||||
<div class="w583 fl mr10 mt10" id="homework_repository_list">
|
||||
<%=render :partial => 'homework_repository_list', :locals => {:homeworks => @homeworks,:type=>@type,:is_import => 0,:property => @property,:search=>''} %>
|
||||
</div>
|
||||
<div id="homework_repository_detail">
|
||||
<%=render :partial => 'homework_repository_detail', :locals => {:homework => nil} %>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<div>
|
||||
<ul class="wlist mt10" id="homework_pository_ref_pages" style="margin-top: 5px;margin-right: 395px">
|
||||
<%= pagination_links_full @hw_pages, @hw_count, :per_page_links => false, :remote => @is_remote, :flag => true%>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="fl resourcesSelectSendButton mr15 inactive-border mt10">
|
||||
<a href="javascript:void(0)" onclick="choose_course('<%=User.current.id %>');" class="sendButtonBlue db inactive-text" data-remote="true">发送至</a>
|
||||
</div>
|
||||
<span class="c_red fl mt15" id="choose_homework_notice"></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="homework_repository_detail">
|
||||
<%=render :partial => 'homework_repository_detail', :locals => {:homework => nil} %>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<div>
|
||||
<ul class="wlist mt10" id="homework_pository_ref_pages" style="margin-top: 5px;margin-right: 395px">
|
||||
<%= pagination_links_full @hw_pages, @hw_count, :per_page_links => false, :remote => @is_remote, :flag => true%>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="fl resourcesSelectSendButton mr15 inactive-border mt10">
|
||||
<a href="javascript:void(0)" onclick="choose_course('<%=User.current.id %>');" class="sendButtonBlue db inactive-text" data-remote="true">发送至</a>
|
||||
</div>
|
||||
<span class="c_red fl mt15" id="choose_homework_notice"></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
|
@ -1,3 +1,4 @@
|
|||
$("#homework_repository").html('<%= escape_javascript(render :partial => 'users/homework_repository', :locals => {:homeworks => @homeworks})%>');
|
||||
/*$("#homework_repository").html('<%#= escape_javascript(render :partial => 'users/homework_repository', :locals => {:homeworks => @homeworks})%>');*/
|
||||
$("#homework_repository_list").html('<%= escape_javascript(render :partial => 'users/homework_repository_list', :locals => {:homeworks => @homeworks,:sort => @order,:b_sort => @b_sort,:type=>@type,:is_import => 0,:property => @property,:search=>''})%>');
|
||||
$("#homework_pository_ref_pages").html('<%= pagination_links_full @hw_pages, @hw_count, :per_page_links => false, :remote => @is_remote, :flag => true %>');
|
||||
$("#homework_repository_detail").html("<%=escape_javascript(render :partial => 'users/homework_repository_detail', :locals => {:homework=>nil}) %>");
|
||||
|
|
|
@ -3,7 +3,7 @@ $("#homework_list_form_show").html('<%= escape_javascript(render :partial => 'us
|
|||
$("#homewrok_ref_pages").html('<%= pagination_links_full @hw_pages, @hw_count, :per_page_links => false, :remote => @is_remote, :flag => true %>');
|
||||
$("#homework_detail_information").html("<%=escape_javascript(render :partial => 'users/homework_detail_information', :locals => {:homework=>nil}) %>");
|
||||
<% else %>
|
||||
$("#homework_repository").html('<%= escape_javascript(render :partial => 'users/homework_repository', :locals => {:homeworks => @homeworks})%>');
|
||||
$("#homework_repository_list").html('<%= escape_javascript(render :partial => 'users/homework_repository_list', :locals => {:homeworks => @homeworks,:sort => @order,:b_sort => @b_sort,:type=>@type,:is_import => @is_import,:property => @property,:search=>@search})%>');
|
||||
$("#homework_pository_ref_pages").html('<%= pagination_links_full @hw_pages, @hw_count, :per_page_links => false, :remote => @is_remote, :flag => true %>');
|
||||
$("#homework_repository_detail").html("<%=escape_javascript(render :partial => 'users/homework_repository_detail', :locals => {:homework=>nil}) %>");
|
||||
<% end %>
|
|
@ -21,6 +21,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 %>
|
|
@ -1520,6 +1520,9 @@ en:
|
|||
label_submit_comments: Submit_comments
|
||||
label_course_empty_select: You have not selected course!
|
||||
label_enterprise_page_made: enterprise_page
|
||||
label_excellent_courses_list: excellent_courses
|
||||
label_course_resource_list: course_resource_list
|
||||
label_project_resource_list: project_resource_list
|
||||
|
||||
#api
|
||||
label_recently_updated_notification: Recently updated notification
|
||||
|
|
|
@ -483,6 +483,9 @@ zh:
|
|||
label_requirement: 需求
|
||||
label_new_course: 课程列表
|
||||
label_course_all: 课程列表
|
||||
label_excellent_courses_list: 精品课程列表
|
||||
label_course_resource_list: 课程资源列表
|
||||
label_project_resource_list: 項目资源列表
|
||||
label_teacher_all: 所有教师
|
||||
label_requirement_enterprise_list: 众包列表
|
||||
label_new_homework: 作业
|
||||
|
|
|
@ -940,6 +940,9 @@ RedmineApp::Application.routes.draw do
|
|||
match 'admin', :to => 'admin#index', :via => :get
|
||||
match 'admin/projects', :via => :get
|
||||
get 'admin/courses'
|
||||
get 'admin/excellent_courses'
|
||||
get 'admin/course_resource_list'
|
||||
get 'admin/project_resource_list'
|
||||
match 'admin/users', :via => :get
|
||||
match 'admin/messages', :via => :get
|
||||
match 'admin/first_page_made', as: :first_page_made
|
||||
|
@ -1006,6 +1009,7 @@ RedmineApp::Application.routes.draw do
|
|||
get 'course_outline'
|
||||
post 'search_course_outline'
|
||||
post 'set_course_outline'
|
||||
post 'teacher_assign_group'
|
||||
get 'syllabus'
|
||||
get 'search_public_orgs_not_in_course'
|
||||
get "homework_search"
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
class UpdateHomeworkCommonUpdatedAt < ActiveRecord::Migration
|
||||
def up
|
||||
count = HomeworkCommon.all.count / 30 + 2
|
||||
transaction do
|
||||
for i in 1 ... count do i
|
||||
HomeworkCommon.page(i).per(30).each do |hw|
|
||||
ca = CourseActivity.where("course_act_type = 'HomeworkCommon' and course_act_id = #{hw.id}").first
|
||||
unless ca.nil?
|
||||
hw.update_attributes(:updated_at => ca.updated_at)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def down
|
||||
end
|
||||
end
|
|
@ -0,0 +1,50 @@
|
|||
class UpdateContributorAfterDelete < ActiveRecord::Migration
|
||||
def up
|
||||
Course.all.each do |course|
|
||||
if course.course_activities.count > 1
|
||||
course.members.each do |s|
|
||||
puts course.id
|
||||
puts course.name
|
||||
puts s.user_id
|
||||
# board_count = CourseActivity.where("user_id =? and course_id =? and course_act_type =?",s.student_id, course.id, "Message").count * 2
|
||||
# 发帖数
|
||||
board_count = Message.find_by_sql("select DISTINCT me.* from messages me, boards b where b.id = me.board_id and b.course_id = #{course.id} and b.project_id = '-1' and me.author_id = #{s.user_id} and me.parent_id is null;").count
|
||||
# 回帖数
|
||||
message_reply_count = Message.find_by_sql("select DISTINCT me.* from messages me, boards b where b.id = me.board_id and b.course_id = #{course.id} and b.project_id = '-1' and me.author_id = #{s.user_id} and me.parent_id is not null").count * 1
|
||||
# 新闻回复
|
||||
common_reply_count = Comment.find_by_sql("select cm.* from comments cm, news n where cm.author_id = #{s.user_id} and n.course_id = #{course.id} and cm.commented_id = n.id and cm.commented_type ='News'").count * 1
|
||||
# 通知
|
||||
common_count = News.find_by_sql("select n.* from news n where n.author_id = #{s.user_id} and n.course_id = #{course.id} ").count * 1
|
||||
# attachment_count = CourseActivity.where("user_id =? and course_id =? and course_act_type =?", s.student_id, course.id, "Attachment").count * 5
|
||||
# 附件数
|
||||
attachment_count = Attachment.find_by_sql("SELECT * FROM `attachments` where container_id = #{course.id} and author_id = #{s.user_id} and container_type ='Course'").count
|
||||
# 课程留言数
|
||||
journal_count = JournalsForMessage.where("user_id =? and jour_id =? and jour_type =? ", s.user_id, course.id, "Course").count * 1
|
||||
# 作业留言
|
||||
journal_homework_count = JournalsForMessage.find_by_sql("SELECT jfm.* FROM `journals_for_messages` jfm, homework_commons hc where hc.id = jfm.jour_id and hc.course_id =#{course.id} and jfm.user_id =#{s.user_id} and jfm.jour_type ='HomeworkCommon';").count * 1
|
||||
# journal_count = CourseActivity.where("user_id =? and course_id =? and course_act_type =?", s.student_id, course.id, "JournalsForMessage").count * 1
|
||||
# journal_reply_count = JournalsForMessage.where("user_id =? and jour_id =? and jour_type =? and status =?", s.student_id, course.id, "Course",1).count * 1
|
||||
total = board_count + message_reply_count + common_reply_count + attachment_count + journal_count
|
||||
course_contributor = CourseContributorScore.where("course_id =? and user_id =?", course.id, s.user_id).first
|
||||
if course_contributor.nil?
|
||||
CourseContributorScore.create(:course_id => course.id, :user_id => s.user_id, :message_num => board_count, :message_reply_num => message_reply_count,
|
||||
:news_reply_num => common_reply_count, :news_num => common_count, :resource_num => attachment_count, :journal_num => journal_count,
|
||||
:homework_journal_num => journal_homework_count, :journal_reply_num => 0, :total_score => total)
|
||||
else
|
||||
course_contributor.message_num = board_count
|
||||
course_contributor.message_reply_num = message_reply_count
|
||||
course_contributor.news_reply_num = common_reply_count
|
||||
course_contributor.news_num = common_count
|
||||
course_contributor.resource_num = attachment_count
|
||||
course_contributor.journal_num = journal_count
|
||||
course_contributor.homework_journal_num = journal_homework_count
|
||||
course_contributor.save
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def down
|
||||
end
|
||||
end
|
|
@ -0,0 +1,8 @@
|
|||
class DeleteStudentWorkData < ActiveRecord::Migration
|
||||
def up
|
||||
StudentWork.where("homework_common_id = 2604 AND user_id = 10763 AND final_score = 0").destroy_all
|
||||
end
|
||||
|
||||
def down
|
||||
end
|
||||
end
|
|
@ -0,0 +1,5 @@
|
|||
class AddVisitsToUser < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :users, :visits, :integer, :default => 0
|
||||
end
|
||||
end
|
|
@ -0,0 +1,5 @@
|
|||
class AddVisitsToProject < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :projects, :visits, :integer, :default => 0
|
||||
end
|
||||
end
|
|
@ -0,0 +1,5 @@
|
|||
class AddVisitsToCourse < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :courses, :visits, :integer, :default => 0
|
||||
end
|
||||
end
|
|
@ -0,0 +1,5 @@
|
|||
class AddVisitsToOrganization < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :organizations, :visits, :integer, :default => 0
|
||||
end
|
||||
end
|
14
db/schema.rb
14
db/schema.rb
|
@ -11,7 +11,7 @@
|
|||
#
|
||||
# It's strongly recommended to check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(:version => 20160304234903) do
|
||||
ActiveRecord::Schema.define(:version => 20160225031230) do
|
||||
|
||||
create_table "activities", :force => true do |t|
|
||||
t.integer "act_id", :null => false
|
||||
|
@ -432,11 +432,9 @@ ActiveRecord::Schema.define(:version => 20160304234903) do
|
|||
t.integer "resource_num"
|
||||
t.integer "journal_num"
|
||||
t.integer "journal_reply_num"
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
t.integer "total_score"
|
||||
t.integer "homework_journal_num", :default => 0
|
||||
t.integer "news_num", :default => 0
|
||||
end
|
||||
|
||||
create_table "course_groups", :force => true do |t|
|
||||
|
@ -1387,7 +1385,6 @@ ActiveRecord::Schema.define(:version => 20160304234903) do
|
|||
t.integer "changeset_num", :default => 0
|
||||
t.integer "board_message_num", :default => 0
|
||||
t.integer "board_num", :default => 0
|
||||
t.integer "act_num", :default => 0
|
||||
t.integer "attach_num", :default => 0
|
||||
t.datetime "commit_time"
|
||||
end
|
||||
|
@ -2016,6 +2013,11 @@ ActiveRecord::Schema.define(:version => 20160304234903) do
|
|||
|
||||
add_index "wikis", ["project_id"], :name => "wikis_project_id"
|
||||
|
||||
create_table "wlcs", :force => true do |t|
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
end
|
||||
|
||||
create_table "workflows", :force => true do |t|
|
||||
t.integer "tracker_id", :default => 0, :null => false
|
||||
t.integer "old_status_id", :default => 0, :null => false
|
||||
|
|
|
@ -99,6 +99,13 @@ module Redmine
|
|||
result
|
||||
end
|
||||
|
||||
def save_attachmentsex_public(attachments, author=User.current,attachment_type, is_public)
|
||||
@curattachment_type = attachment_type
|
||||
@is_public = true
|
||||
result = save_attachments(attachments,author)
|
||||
result
|
||||
end
|
||||
|
||||
def save_attachments(attachments, author=User.current)
|
||||
# 清除临时文件
|
||||
if attachments
|
||||
|
@ -142,7 +149,11 @@ module Redmine
|
|||
end
|
||||
|
||||
if a && !attachment['is_public_checkbox']
|
||||
a.is_public = false
|
||||
if @is_public
|
||||
a.is_public = true
|
||||
else
|
||||
a.is_public = false
|
||||
end
|
||||
elsif a && attachment['is_public_checkbox']
|
||||
a.is_public = true
|
||||
end
|
||||
|
|
|
@ -391,6 +391,9 @@ Redmine::MenuManager.map :admin_menu do |menu|
|
|||
menu.push :messages_list, {:controller => 'admin', :action => 'messages_list'}, :caption => :label_message_plural
|
||||
menu.push :notices, {:controller => 'admin', :action => 'notices'}, :caption => :label_notification_list
|
||||
menu.push :latest_login_users, {:controller => 'admin', :action => 'latest_login_users'}, :caption => :label_latest_login_user_list
|
||||
menu.push :excellent_courses, {:controller => 'admin', :action => 'excellent_courses'}, :caption => :label_excellent_courses_list
|
||||
menu.push :course_resource_list, {:controller => 'admin', :action => 'course_resource_list'}, :caption => :label_course_resource_list
|
||||
menu.push :project_resource_list, {:controller => 'admin', :action => 'project_resource_list'}, :caption => :label_project_resource_list
|
||||
menu.push :homework, {:controller => 'admin', :action => 'homework'}, :caption => :label_user_homework
|
||||
|
||||
end
|
||||
|
|
|
@ -1,73 +1,78 @@
|
|||
#coding=utf-8
|
||||
|
||||
module Trustie
|
||||
module Gitlab
|
||||
module Helper
|
||||
GUEST = 10
|
||||
REPORTER = 20
|
||||
DEVELOPER = 30
|
||||
MASTER = 40
|
||||
OWNER = 50
|
||||
# 项目公开和私有
|
||||
PUBLIC = 20
|
||||
PRIVATE = 0
|
||||
|
||||
def change_password(uid, en_pwd, salt)
|
||||
return unless uid
|
||||
options = {:encrypted_password=>en_pwd, :password_salt=>salt}
|
||||
self.g.put("/users/ext/#{uid}", :body => options)
|
||||
# g.edit_user(uid, :encrypted_password=>en_pwd, :password_salt=>salt)
|
||||
end
|
||||
|
||||
def find_user(user)
|
||||
us = self.g.get("/users?search=#{user.mail}")
|
||||
if Array === us
|
||||
us.each do |u|
|
||||
return u if u.email == user.mail
|
||||
end
|
||||
end
|
||||
return nil
|
||||
end
|
||||
|
||||
def add_user(user)
|
||||
u = nil
|
||||
begin
|
||||
u = find_user(user)
|
||||
unless u
|
||||
u = self.g.create_user(user.mail,
|
||||
user.hashed_password,
|
||||
name: user.show_name,
|
||||
username: user.login,
|
||||
confirm: "true")
|
||||
user.gid = u.id
|
||||
end
|
||||
change_password(u.id, user.hashed_password, user.salt)
|
||||
rescue => e
|
||||
puts e
|
||||
end
|
||||
return u
|
||||
end
|
||||
|
||||
def del_user(user)
|
||||
return unless user.gid
|
||||
self.g.delete_user(user.gid)
|
||||
end
|
||||
|
||||
def get_gitlab_role m
|
||||
case m.roles.first.position
|
||||
when 1,2
|
||||
GUEST
|
||||
when 5
|
||||
REPORTER
|
||||
when 4
|
||||
DEVELOPER
|
||||
when 3
|
||||
MASTER
|
||||
else
|
||||
GUEST
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
#coding=utf-8
|
||||
|
||||
module Trustie
|
||||
module Gitlab
|
||||
module Helper
|
||||
GUEST = 10
|
||||
REPORTER = 20
|
||||
DEVELOPER = 30
|
||||
MASTER = 40
|
||||
OWNER = 50
|
||||
# 项目公开和私有
|
||||
PUBLIC = 20
|
||||
PRIVATE = 0
|
||||
|
||||
def change_password(uid, en_pwd, salt)
|
||||
return unless uid
|
||||
options = {:encrypted_password=>en_pwd, :password_salt=>salt}
|
||||
self.g.put("/users/ext/#{uid}", :body => options)
|
||||
# g.edit_user(uid, :encrypted_password=>en_pwd, :password_salt=>salt)
|
||||
end
|
||||
|
||||
def find_user(user)
|
||||
us = self.g.get("/users?search=#{user.mail}")
|
||||
if Array === us
|
||||
us.each do |u|
|
||||
return u if u.email == user.mail
|
||||
end
|
||||
end
|
||||
return nil
|
||||
end
|
||||
|
||||
def add_user(user)
|
||||
u = nil
|
||||
begin
|
||||
u = find_user(user)
|
||||
unless u
|
||||
u = self.g.create_user(user.mail,
|
||||
user.hashed_password,
|
||||
name: user.show_name,
|
||||
username: user.login,
|
||||
confirm: "true")
|
||||
user.gid = u.id
|
||||
user.save
|
||||
end
|
||||
if user.gid.nil?
|
||||
user.gid = u.id
|
||||
user.save
|
||||
end
|
||||
change_password(u.id, user.hashed_password, user.salt)
|
||||
rescue => e
|
||||
puts e
|
||||
end
|
||||
return u
|
||||
end
|
||||
|
||||
def del_user(user)
|
||||
return unless user.gid
|
||||
self.g.delete_user(user.gid)
|
||||
end
|
||||
|
||||
def get_gitlab_role m
|
||||
case m.roles.first.position
|
||||
when 1,2
|
||||
GUEST
|
||||
when 5
|
||||
REPORTER
|
||||
when 4
|
||||
DEVELOPER
|
||||
when 3
|
||||
MASTER
|
||||
else
|
||||
GUEST
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
File diff suppressed because it is too large
Load Diff
|
@ -1,49 +1,51 @@
|
|||
.ke-content {
|
||||
font-size: 10pt;
|
||||
}
|
||||
.ke-content pre {
|
||||
font-size:9pt;
|
||||
font-family:Courier New,Arial;
|
||||
border:1px solid #ddd;
|
||||
border-left:5px solid #6CE26C;
|
||||
background:#f6f6f6;
|
||||
padding:5px;
|
||||
}
|
||||
|
||||
.ke-content code {
|
||||
margin: 0 2px;
|
||||
padding: 0 5px;
|
||||
white-space: nowrap;
|
||||
border: 1px solid #DDD;
|
||||
background-color: #F6F6F6;
|
||||
border-radius: 3px;
|
||||
}
|
||||
|
||||
.ke-content pre>code {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
white-space: pre;
|
||||
border: none;
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
.ke-content pre code {
|
||||
background-color: transparent;
|
||||
border: none;
|
||||
}
|
||||
|
||||
.ke-content p {
|
||||
/*margin: 0 0 15px 0;*/
|
||||
/*margin-bottom:15pt;*/
|
||||
line-height:1.5;
|
||||
/*letter-spacing: 1px;*/
|
||||
}
|
||||
|
||||
.ke-content div.ref {border:1px solid #ddd;margin:0 0 10px 0;padding:2px;font-size:9pt;background:#ffe;}
|
||||
.ke-content div.ref h4 {margin:0;padding:1px 3px;background:#CC9966;color:#fff;font-size:9pt;font-weight:normal;}
|
||||
.ke-content div.ref .ref_body {margin:0;padding:2px;line-height:20px;color:#666;font-size:9pt;}
|
||||
|
||||
|
||||
.ke-content blockquote {margin:15px 10px;border:2px solid #eee;padding:5px 5px 5px 35px;background:#f4f5f7 url('../img/blockquote.gif') no-repeat left top;color:#060;font-size:9pt;}
|
||||
span.at {color:#269ac9;}
|
||||
.ke-content {
|
||||
font-size: 12px;
|
||||
font: 14px/1.5 "sans serif",tahoma,verdana,helvetica;font-family: ΢ÈíÑźÚ, ËÎÌå;
|
||||
font-family:Tahoma;
|
||||
}
|
||||
.ke-content pre {
|
||||
font-size:9pt;
|
||||
font-family:Courier New,Arial;
|
||||
border:1px solid #ddd;
|
||||
border-left:5px solid #6CE26C;
|
||||
background:#f6f6f6;
|
||||
padding:5px;
|
||||
}
|
||||
|
||||
.ke-content code {
|
||||
margin: 0 2px;
|
||||
padding: 0 5px;
|
||||
white-space: nowrap;
|
||||
border: 1px solid #DDD;
|
||||
background-color: #F6F6F6;
|
||||
border-radius: 3px;
|
||||
}
|
||||
|
||||
.ke-content pre>code {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
white-space: pre;
|
||||
border: none;
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
.ke-content pre code {
|
||||
background-color: transparent;
|
||||
border: none;
|
||||
}
|
||||
|
||||
.ke-content p {
|
||||
/*margin: 0 0 15px 0;*/
|
||||
/*margin-bottom:15pt;*/
|
||||
line-height:1.5;
|
||||
/*letter-spacing: 1px;*/
|
||||
}
|
||||
|
||||
.ke-content div.ref {border:1px solid #ddd;margin:0 0 10px 0;padding:2px;font-size:9pt;background:#ffe;}
|
||||
.ke-content div.ref h4 {margin:0;padding:1px 3px;background:#CC9966;color:#fff;font-size:9pt;font-weight:normal;}
|
||||
.ke-content div.ref .ref_body {margin:0;padding:2px;line-height:20px;color:#666;font-size:9pt;}
|
||||
|
||||
|
||||
.ke-content blockquote {margin:15px 10px;border:2px solid #eee;padding:5px 5px 5px 35px;background:#f4f5f7 url('../img/blockquote.gif') no-repeat left top;color:#060;font-size:9pt;}
|
||||
span.at {color:#269ac9;}
|
||||
span.at a{color:#269ac9;text-decoration: none;}
|
|
@ -98,6 +98,9 @@ KindEditor.plugin('image', function(K) {
|
|||
yesBtn : {
|
||||
name : self.lang('yes'),
|
||||
click : function(e) {
|
||||
if(/^\s*<\w*\s*\w*\=\"\w*\"\s*\w*\=\"\w*\:\s*\#\d*\;\s*\w*\-\w*\:\s*\w*\;\"\>[\u4e00-\u9fa5]*<\/\w*\>\s*$/.test(self.edit.html())){
|
||||
self.edit.html('');
|
||||
}
|
||||
// Bugfix: http://code.google.com/p/kindeditor/issues/detail?id=319
|
||||
if (dialog.isLoading) {
|
||||
return;
|
||||
|
|
|
@ -1,38 +1,40 @@
|
|||
/*******************************************************************************
|
||||
* KindEditor - WYSIWYG HTML Editor for Internet
|
||||
* Copyright (C) 2006-2011 kindsoft.net
|
||||
*
|
||||
* @author Roddy <luolonghao@gmail.com>
|
||||
* @site http://www.kindsoft.net/
|
||||
* @licence http://www.kindsoft.net/license.php
|
||||
*******************************************************************************/
|
||||
|
||||
KindEditor.plugin('lineheight', function(K) {
|
||||
var self = this, name = 'lineheight', lang = self.lang(name + '.');
|
||||
self.clickToolbar(name, function() {
|
||||
var curVal = '', commonNode = self.cmd.commonNode({'*' : '.line-height'});
|
||||
if (commonNode) {
|
||||
curVal = commonNode.css('line-height');
|
||||
}
|
||||
var menu = self.createMenu({
|
||||
name : name,
|
||||
width : 150
|
||||
});
|
||||
K.each(lang.lineHeight, function(i, row) {
|
||||
K.each(row, function(key, val) {
|
||||
menu.addItem({
|
||||
title : val,
|
||||
checked : curVal === key,
|
||||
click : function() {
|
||||
self.cmd.toggle('<span style="line-height:' + key + ';"></span>', {
|
||||
span : '.line-height=' + key
|
||||
});
|
||||
self.updateState();
|
||||
self.addBookmark();
|
||||
self.hideMenu();
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
/*******************************************************************************
|
||||
* KindEditor - WYSIWYG HTML Editor for Internet
|
||||
* Copyright (C) 2006-2011 kindsoft.net
|
||||
*
|
||||
* @author Roddy <luolonghao@gmail.com>
|
||||
* @site http://www.kindsoft.net/
|
||||
* @licence http://www.kindsoft.net/license.php
|
||||
*******************************************************************************/
|
||||
|
||||
KindEditor.plugin('lineheight', function(K) {
|
||||
var self = this, name = 'lineheight', lang = self.lang(name + '.');
|
||||
self.clickToolbar(name, function() {
|
||||
var curVal = '', commonNode = self.cmd.commonNode({'*' : '.line-height'});
|
||||
if (commonNode) {
|
||||
curVal = commonNode.css('line-height');
|
||||
}
|
||||
var menu = self.createMenu({
|
||||
name : name,
|
||||
width : 150
|
||||
});
|
||||
K.each(lang.lineHeight, function(i, row) {
|
||||
K.each(row, function(key, val) {
|
||||
menu.addItem({
|
||||
title : val,
|
||||
checked : curVal === key,
|
||||
click : function() {
|
||||
self.cmd.toggle('<span style="line-height:' + key + ';"></span>', {
|
||||
span : '.line-height=' + key
|
||||
});
|
||||
self.updateState();
|
||||
self.addBookmark();
|
||||
//curVal = key;
|
||||
//self.cmd.doc.body.style.lineHeight = key;
|
||||
self.hideMenu();
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -47,6 +47,9 @@ KindEditor.plugin('media', function(K) {
|
|||
yesBtn : {
|
||||
name : self.lang('yes'),
|
||||
click : function(e) {
|
||||
if(/^\s*<\w*\s*\w*\=\"\w*\"\s*\w*\=\"\w*\:\s*\#\d*\;\s*\w*\-\w*\:\s*\w*\;\"\>[\u4e00-\u9fa5]*<\/\w*\>\s*$/.test(self.edit.html())){
|
||||
self.edit.html('');
|
||||
}
|
||||
var url = K.trim(urlBox.val()),
|
||||
width = widthBox.val(),
|
||||
height = heightBox.val();
|
||||
|
|
|
@ -25,7 +25,7 @@ KindEditor.plugin('preview', function(K) {
|
|||
doc.open();
|
||||
doc.write(self.fullHtml());
|
||||
doc.close();
|
||||
K(doc.body).css('background-color', '#FFF');
|
||||
K(doc.body).css({'background-color': '#FFF','word-break':'break-all','word-wrap':'wrap-all'});
|
||||
iframe[0].contentWindow.focus();
|
||||
});
|
||||
});
|
||||
|
|
File diff suppressed because it is too large
Load Diff
Binary file not shown.
After Width: | Height: | Size: 8.4 KiB |
File diff suppressed because it is too large
Load Diff
|
@ -1,177 +1,183 @@
|
|||
//需求:表情栏可以隐藏显示,高度只要一点高
|
||||
function sd_create_editor(params){
|
||||
// var minHeight; //最小高度
|
||||
var paramsHeight = params.height; //设定的高度
|
||||
var id = arguments[1] ? arguments[1] : undefined;
|
||||
var type = arguments[2] ? arguments[2] : '';
|
||||
var paramsWidth = params.width == undefined ? "100%" : params.width;
|
||||
|
||||
var editor = params.kindutil.create(params.textarea, {
|
||||
resizeType : 1,minWidth:"1px",width:"94%",
|
||||
height:"33px",// == undefined ? "30px":paramsHeight+"px",
|
||||
minHeight:"33px",// == undefined ? "30px":paramsHeight+"px",
|
||||
width:params.width,
|
||||
items:['emoticons','fontname',
|
||||
'forecolor', 'hilitecolor', 'bold', '|', 'justifyleft', 'justifycenter', 'insertorderedlist','insertunorderedlist', '|',
|
||||
'formatblock', 'fontsize', '|','indent', 'outdent',
|
||||
'|','imagedirectupload','more'],
|
||||
afterChange:function(){//按键事件
|
||||
var edit = this.edit;
|
||||
var body = edit.doc.body;
|
||||
edit.iframe.height(paramsHeight);
|
||||
this.resize(null, Math.max((params.kindutil.IE ? body.scrollHeight : (params.kindutil.GECKO ? body.offsetHeight+26:body.offsetHeight)) , paramsHeight));
|
||||
},
|
||||
afterBlur:function(){
|
||||
//params.toolbar_container.hide();
|
||||
sd_check_editor_form_field({content:this,contentmsg:params.contentmsg,textarea:params.textarea});
|
||||
if(this.isEmpty()) {
|
||||
this.edit.html("<span id='hint' style='color: #999999; font-size: 12px'>我要回复</span>");
|
||||
}
|
||||
//params.toolbar_container.hide();
|
||||
$('#reply_image_' + id).addClass('imageFuzzy');
|
||||
if(/^\s*<\w*\s*\w*\=\"\w*\"\s*\w*\=\"\w*\:\s*\#\d*\;\s*\w*\-\w*\:\s*\w*\;\"\>[\u4e00-\u9fa5]*<\/\w*\>\s*$/.test(this.edit.html())){
|
||||
params.submit_btn.hide();
|
||||
params.toolbar_container.hide();
|
||||
this.resize("100%", null);
|
||||
}else if(this.edit.html().trim() != ""){
|
||||
params.submit_btn.show();
|
||||
params.toolbar_container.show();
|
||||
}
|
||||
|
||||
//params.submit_btn.css("display","none");
|
||||
},
|
||||
afterFocus: function(){
|
||||
var edit = this.edit;
|
||||
var body = edit.doc.body;
|
||||
if(/^\s*<\w*\s*\w*\=\"\w*\"\s*\w*\=\"\w*\:\s*\#\d*\;\s*\w*\-\w*\:\s*\w*\;\"\>[\u4e00-\u9fa5]*<\/\w*\>\s*$/.test(edit.html())){
|
||||
edit.html('');
|
||||
}
|
||||
params.submit_btn.show();
|
||||
params.contentmsg.hide();
|
||||
params.toolbar_container.show();
|
||||
// params.toolbar_container.show();
|
||||
$('#reply_image_' + id).removeClass('imageFuzzy');
|
||||
//edit.iframe.width(paramsWidth);
|
||||
this.resize(paramsWidth, null);
|
||||
//params.submit_btn.show();
|
||||
},
|
||||
|
||||
afterCreate:function(){
|
||||
//params.submit_btn.hide();
|
||||
var toolbar = $("div[class='ke-toolbar']",params.div_form);
|
||||
toolbar.css('display','inline');
|
||||
toolbar.css('padding',0);
|
||||
$(".ke-outline>.ke-toolbar-icon",toolbar).append('表情');
|
||||
params.toolbar_container.append(toolbar);
|
||||
params.toolbar_container.hide();
|
||||
//init
|
||||
var edit = this.edit;
|
||||
var body = edit.doc.body;
|
||||
edit.iframe[0].scroll = 'no';
|
||||
body.style.overflowY = 'hidden';
|
||||
//reset height
|
||||
paramsHeight = paramsHeight == undefined ? params.kindutil.removeUnit(this.height) : paramsHeight;
|
||||
edit.iframe.height(paramsHeight);
|
||||
edit.html("<span id='hint' style='color: #999999; font-size: 12px'>我要回复</span>");
|
||||
this.resize(null,paramsHeight);// Math.max((params.kindutil.IE ? body.scrollHeight : body.offsetHeight)+ paramsHeight , paramsHeight)
|
||||
// params.toolbar_container.hide();
|
||||
if(typeof enableAt === 'function'){
|
||||
enableAt(this, id, type);
|
||||
}
|
||||
}
|
||||
}).loadPlugin('paste');
|
||||
return editor;
|
||||
}
|
||||
|
||||
function sd_check_editor_form_field(params){
|
||||
var result=true;
|
||||
if(params.content!=undefined){
|
||||
if(params.content.isEmpty()){
|
||||
result=false;
|
||||
}
|
||||
if(params.content.html()!=params.textarea.html() || params.issubmit==true){
|
||||
params.textarea.html(params.content.html());
|
||||
params.content.sync();
|
||||
if(params.content.isEmpty() || /^\s*<\w*\s*\w*\=\"\w*\"\s*\w*\=\"\w*\:\s*\#\d*\;\s*\w*\-\w*\:\s*\w*\;\"\>[\u4e00-\u9fa5]*<\/\w*\>\s*$/.test(params.textarea.html())){
|
||||
params.contentmsg.html('内容不能为空');
|
||||
params.contentmsg.css({color:'#ff0000'});
|
||||
}else{
|
||||
params.contentmsg.html('填写正确');
|
||||
params.contentmsg.css({color:'#008000'});
|
||||
}
|
||||
params.contentmsg.show();
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
function sd_create_form(params){
|
||||
params.form.submit(function(){
|
||||
var flag = false;
|
||||
if(params.form.attr('data-remote') != undefined ){
|
||||
flag = true
|
||||
}
|
||||
var is_checked = sd_check_editor_form_field({
|
||||
issubmit:true,
|
||||
content:params.editor,
|
||||
contentmsg:params.contentmsg,
|
||||
textarea:params.textarea
|
||||
});
|
||||
if(is_checked){
|
||||
if(flag){
|
||||
return true;
|
||||
}else{
|
||||
$(this)[0].submit();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
});
|
||||
}
|
||||
function sd_reset_editor_form(params){
|
||||
params.form[0].reset();
|
||||
params.textarea.empty();
|
||||
if(params.editor != undefined){
|
||||
params.editor.html(params.textarea.html());
|
||||
}
|
||||
params.contentmsg.hide();
|
||||
}
|
||||
//第二个参数是高度,可以传,可以不传
|
||||
function sd_create_editor_from_data(id){
|
||||
var height = arguments[1] ? arguments[1] : undefined;
|
||||
var width = arguments[2] ? arguments[2] : undefined;
|
||||
var type = arguments[3] ? arguments[3] : undefined;
|
||||
KindEditor.ready(function (K) {
|
||||
$("div[nhname='new_message_" + id + "']").each(function () {
|
||||
var params = {};
|
||||
params.kindutil = K;
|
||||
params.div_form = $(this);
|
||||
params.form = $("form", params.div_form);
|
||||
if (params.form == undefined || params.form.length == 0) {
|
||||
return;
|
||||
}
|
||||
params.textarea = $("textarea[nhname='new_message_textarea_" + id + "']", params.div_form);
|
||||
params.contentmsg = $("span[nhname='contentmsg_" + id + "']", params.div_form);
|
||||
params.toolbar_container = $("div[nhname='toolbar_container_" + id + "']", params.div_form);
|
||||
params.cancel_btn = $("#new_message_cancel_btn_" + id);
|
||||
params.submit_btn = $("#new_message_submit_btn_" + id);
|
||||
params.height = height;
|
||||
params.width = width;
|
||||
if (params.textarea.data('init') == undefined) {
|
||||
params.editor = sd_create_editor(params,id, type);
|
||||
sd_create_form(params);
|
||||
params.cancel_btn.click(function () {
|
||||
sd_reset_editor_form(params);
|
||||
});
|
||||
params.submit_btn.click(function () {
|
||||
params.form.submit();
|
||||
});
|
||||
params.textarea.data('init', 1);
|
||||
$(this).show();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
div_form = $("div[nhname='new_message_" + id + "']");
|
||||
$(".ke-edit", div_form).css("height","33px");
|
||||
$(".ke-edit-iframe",div_form).css("height","33px");
|
||||
//需求:表情栏可以隐藏显示,高度只要一点高
|
||||
function sd_create_editor(params){
|
||||
// var minHeight; //最小高度
|
||||
var paramsHeight = params.height; //设定的高度
|
||||
var id = arguments[1] ? arguments[1] : undefined;
|
||||
var type = arguments[2] ? arguments[2] : '';
|
||||
var paramsWidth = params.width == undefined ? "100%" : params.width;
|
||||
|
||||
var editor = params.kindutil.create(params.textarea, {
|
||||
resizeType : 1,minWidth:"1px",width:"94%",
|
||||
height:"33px",// == undefined ? "30px":paramsHeight+"px",
|
||||
minHeight:"33px",// == undefined ? "30px":paramsHeight+"px",
|
||||
width:params.width,
|
||||
/*
|
||||
items:['emoticons','fontname',
|
||||
'forecolor', 'hilitecolor', 'bold', '|', 'justifyleft', 'justifycenter', 'insertorderedlist','insertunorderedlist', '|',
|
||||
'formatblock', 'fontsize', '|','indent', 'outdent',
|
||||
'|','imagedirectupload','more'],*/
|
||||
items : ['code','emoticons','fontname',
|
||||
'forecolor', 'hilitecolor', 'bold', '|', 'justifyleft', 'justifycenter', 'insertorderedlist','insertunorderedlist', '|',
|
||||
'formatblock', 'fontsize', '|','indent', 'outdent',
|
||||
'|','imagedirectupload','table', 'media', 'preview',"more"
|
||||
],
|
||||
afterChange:function(){//按键事件
|
||||
var edit = this.edit;
|
||||
var body = edit.doc.body;
|
||||
edit.iframe.height(paramsHeight);
|
||||
this.resize(null, Math.max((params.kindutil.IE ? body.scrollHeight : (params.kindutil.GECKO ? body.offsetHeight+26:body.offsetHeight)) , paramsHeight));
|
||||
},
|
||||
afterBlur:function(){
|
||||
//params.toolbar_container.hide();
|
||||
sd_check_editor_form_field({content:this,contentmsg:params.contentmsg,textarea:params.textarea});
|
||||
if(this.isEmpty()) {
|
||||
this.edit.html("<span id='hint' style='color: #999999; font-size: 12px'>我要回复</span>");
|
||||
}
|
||||
//params.toolbar_container.hide();
|
||||
$('#reply_image_' + id).addClass('imageFuzzy');
|
||||
if(/^\s*<\w*\s*\w*\=\"\w*\"\s*\w*\=\"\w*\:\s*\#\d*\;\s*\w*\-\w*\:\s*\w*\;\"\>[\u4e00-\u9fa5]*<\/\w*\>\s*$/.test(this.edit.html())){
|
||||
params.submit_btn.hide();
|
||||
params.toolbar_container.hide();
|
||||
this.resize("100%", null);
|
||||
}else if(this.edit.html().trim() != ""){
|
||||
params.submit_btn.show();
|
||||
params.toolbar_container.show();
|
||||
}
|
||||
|
||||
//params.submit_btn.css("display","none");
|
||||
},
|
||||
afterFocus: function(){
|
||||
var edit = this.edit;
|
||||
var body = edit.doc.body;
|
||||
if(/^\s*<\w*\s*\w*\=\"\w*\"\s*\w*\=\"\w*\:\s*\#\d*\;\s*\w*\-\w*\:\s*\w*\;\"\>[\u4e00-\u9fa5]*<\/\w*\>\s*$/.test(edit.html())){
|
||||
edit.html('');
|
||||
}
|
||||
params.submit_btn.show();
|
||||
params.contentmsg.hide();
|
||||
params.toolbar_container.show();
|
||||
// params.toolbar_container.show();
|
||||
$('#reply_image_' + id).removeClass('imageFuzzy');
|
||||
//edit.iframe.width(paramsWidth);
|
||||
this.resize(paramsWidth, null);
|
||||
//params.submit_btn.show();
|
||||
},
|
||||
|
||||
afterCreate:function(){
|
||||
//params.submit_btn.hide();
|
||||
var toolbar = $("div[class='ke-toolbar']",params.div_form);
|
||||
toolbar.css('display','inline');
|
||||
toolbar.css('padding',0);
|
||||
$(".ke-outline>.ke-toolbar-icon",toolbar).append('表情');
|
||||
params.toolbar_container.append(toolbar);
|
||||
params.toolbar_container.hide();
|
||||
//init
|
||||
var edit = this.edit;
|
||||
var body = edit.doc.body;
|
||||
edit.iframe[0].scroll = 'no';
|
||||
body.style.overflowY = 'hidden';
|
||||
//reset height
|
||||
paramsHeight = paramsHeight == undefined ? params.kindutil.removeUnit(this.height) : paramsHeight;
|
||||
edit.iframe.height(paramsHeight);
|
||||
edit.html("<span id='hint' style='color: #999999; font-size: 12px'>我要回复</span>");
|
||||
this.resize(null,paramsHeight);// Math.max((params.kindutil.IE ? body.scrollHeight : body.offsetHeight)+ paramsHeight , paramsHeight)
|
||||
// params.toolbar_container.hide();
|
||||
if(typeof enableAt === 'function'){
|
||||
enableAt(this, id, type);
|
||||
}
|
||||
}
|
||||
}).loadPlugin('paste');
|
||||
return editor;
|
||||
}
|
||||
|
||||
function sd_check_editor_form_field(params){
|
||||
var result=true;
|
||||
if(params.content!=undefined){
|
||||
if(params.content.isEmpty()){
|
||||
result=false;
|
||||
}
|
||||
if(params.content.html()!=params.textarea.html() || params.issubmit==true){
|
||||
params.textarea.html(params.content.html());
|
||||
params.content.sync();
|
||||
if(params.content.isEmpty() || /^\s*<\w*\s*\w*\=\"\w*\"\s*\w*\=\"\w*\:\s*\#\d*\;\s*\w*\-\w*\:\s*\w*\;\"\>[\u4e00-\u9fa5]*<\/\w*\>\s*$/.test(params.textarea.html())){
|
||||
params.contentmsg.html('内容不能为空');
|
||||
params.contentmsg.css({color:'#ff0000'});
|
||||
}else{
|
||||
params.contentmsg.html('填写正确');
|
||||
params.contentmsg.css({color:'#008000'});
|
||||
}
|
||||
params.contentmsg.show();
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
function sd_create_form(params){
|
||||
params.form.submit(function(){
|
||||
var flag = false;
|
||||
if(params.form.attr('data-remote') != undefined ){
|
||||
flag = true
|
||||
}
|
||||
var is_checked = sd_check_editor_form_field({
|
||||
issubmit:true,
|
||||
content:params.editor,
|
||||
contentmsg:params.contentmsg,
|
||||
textarea:params.textarea
|
||||
});
|
||||
if(is_checked){
|
||||
if(flag){
|
||||
return true;
|
||||
}else{
|
||||
$(this)[0].submit();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
});
|
||||
}
|
||||
function sd_reset_editor_form(params){
|
||||
params.form[0].reset();
|
||||
params.textarea.empty();
|
||||
if(params.editor != undefined){
|
||||
params.editor.html(params.textarea.html());
|
||||
}
|
||||
params.contentmsg.hide();
|
||||
}
|
||||
//第二个参数是高度,可以传,可以不传
|
||||
function sd_create_editor_from_data(id){
|
||||
var height = arguments[1] ? arguments[1] : undefined;
|
||||
var width = arguments[2] ? arguments[2] : undefined;
|
||||
var type = arguments[3] ? arguments[3] : undefined;
|
||||
KindEditor.ready(function (K) {
|
||||
$("div[nhname='new_message_" + id + "']").each(function () {
|
||||
var params = {};
|
||||
params.kindutil = K;
|
||||
params.div_form = $(this);
|
||||
params.form = $("form", params.div_form);
|
||||
if (params.form == undefined || params.form.length == 0) {
|
||||
return;
|
||||
}
|
||||
params.textarea = $("textarea[nhname='new_message_textarea_" + id + "']", params.div_form);
|
||||
params.contentmsg = $("span[nhname='contentmsg_" + id + "']", params.div_form);
|
||||
params.toolbar_container = $("div[nhname='toolbar_container_" + id + "']", params.div_form);
|
||||
params.cancel_btn = $("#new_message_cancel_btn_" + id);
|
||||
params.submit_btn = $("#new_message_submit_btn_" + id);
|
||||
params.height = height;
|
||||
params.width = width;
|
||||
if (params.textarea.data('init') == undefined) {
|
||||
params.editor = sd_create_editor(params,id, type);
|
||||
sd_create_form(params);
|
||||
params.cancel_btn.click(function () {
|
||||
sd_reset_editor_form(params);
|
||||
});
|
||||
params.submit_btn.click(function () {
|
||||
params.form.submit();
|
||||
});
|
||||
params.textarea.data('init', 1);
|
||||
$(this).show();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
div_form = $("div[nhname='new_message_" + id + "']");
|
||||
$(".ke-edit", div_form).css("height","33px");
|
||||
$(".ke-edit-iframe",div_form).css("height","33px");
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue