Conflicts:
	app/models/system_message.rb
	app/views/admin/messages.html.erb

处理冲突、发布系统消息JS提醒!
tmp
ouyangxuhua 10 years ago
commit b053a1e43c

@ -42,6 +42,9 @@ group :development, :test do
gem 'pry-byebug' gem 'pry-byebug'
end end
gem 'pry-stack_explorer' gem 'pry-stack_explorer'
if RUBY_PLATFORM =~ /darwin/
gem 'puma'
end
end end
gem 'rspec-rails', '~> 3.0' gem 'rspec-rails', '~> 3.0'

File diff suppressed because it is too large Load Diff

@ -89,72 +89,54 @@ class MessagesController < ApplicationController
# Create a new topic # Create a new topic
def new def new
@message = Message.new if User.current.logged?
@message.author = User.current @message = Message.new
@message.board = @board @message.author = User.current
@message.safe_attributes = params[:message] @message.board = @board
if request.post? @message.safe_attributes = params[:message]
@message.save_attachments(params[:attachments]) if request.post?
if @message.save @message.save_attachments(params[:attachments])
# 更新kindeditor上传的图片资源所有者 if @message.save
if params[:asset_id] # 更新kindeditor上传的图片资源所有者
ids = params[:asset_id].split(',') if params[:asset_id]
update_kindeditor_assets_owner ids,@message.id,OwnerTypeHelper::MESSAGE ids = params[:asset_id].split(',')
end update_kindeditor_assets_owner ids,@message.id,OwnerTypeHelper::MESSAGE
# # 与我相关动态的记录add start end
# if(@board && @board.course) #项目的先不管
# teachers = searchTeacherAndAssistant(@board.course)
# for teacher in teachers
# if(teacher.user_id != User.current.id)
# notify = ActivityNotify.new()
# if(@board.course)
# notify.activity_container_id = @board.course_id
# notify.activity_container_type = 'Course'
# else
# notify.activity_container_id = @board.project_id
# notify.activity_container_type = 'Project'
# end
# notify.activity_id = @message.id
# notify.activity_type = 'Message'
# notify.notify_to = teacher.user_id
# notify.is_read = 0
# notify.save()
# end
# end
# end
# 与我相关动态的记录add end
call_hook(:controller_messages_new_after_save, { :params => params, :message => @message}) call_hook(:controller_messages_new_after_save, { :params => params, :message => @message})
render_attachment_warning_if_needed(@message) render_attachment_warning_if_needed(@message)
if params[:is_board] if params[:is_board]
if @project if @project
redirect_to project_boards_path(@project) redirect_to project_boards_path(@project)
elsif @course elsif @course
redirect_to course_boards_path(@course) redirect_to course_boards_path(@course)
end
else
redirect_to board_message_url(@board, @message)
end end
else else
redirect_to board_message_url(@board, @message) if params[:is_board]
if @project
redirect_to project_boards_path(@project, :flag => true)
elsif @course
redirect_to course_boards_path(@course, :flag => true)
end
else
layout_file = @project ? 'base_projects' : 'base_courses'
render :action => 'new', :layout => layout_file
end
end end
else else
if params[:is_board] respond_to do |format|
if @project format.html {
redirect_to project_boards_path(@project, :flag => true) layout_file = @project ? 'base_projects' : 'base_courses'
elsif @course render :layout => layout_file
redirect_to course_boards_path(@course, :flag => true) }
end
else
layout_file = @project ? 'base_projects' : 'base_courses'
render :action => 'new', :layout => layout_file
end end
end end
else else
respond_to do |format| redirect_to signin_path
format.html {
layout_file = @project ? 'base_projects' : 'base_courses'
render :layout => layout_file
}
end
end end
end end

@ -14,8 +14,8 @@ class StudentWorkController < ApplicationController
def program_test def program_test
is_test = params[:is_test] == 'true' is_test = params[:is_test] == 'true'
resultObj = {status: 0, results: [], error_msg: '', time: Time.now.strftime('%Y-%m-%d %T')} resultObj = {status: 0, results: [], error_msg: '', time: Time.now.strftime('%Y-%m-%d %T')}
unless is_test
student_work = find_or_save_student_work student_work = find_or_save_student_work(is_test)
unless student_work unless student_work
resultObj[:status] = 100 resultObj[:status] = 100
@ -42,26 +42,6 @@ class StudentWorkController < ApplicationController
end end
end end
else
if @homework.homework_type == 2 && @homework.homework_detail_programing
result = test_realtime(student_work, params[:src])
logger.debug result
resultObj[:status] = result["status"]
resultObj[:results] = result["results"]
resultObj[:error_msg] = result["error_msg"]
results = result["results"]
if result["status"].to_i == -2 #编译错误
results = [result["error_msg"]]
end
resultObj[:status] = result["status"].to_i
resultObj[:time] = Time.now.strftime('%Y-%m-%d %T')
resultObj[:index] = 0
end
end
render :json => resultObj render :json => resultObj
end end
@ -192,24 +172,23 @@ class StudentWorkController < ApplicationController
def create def create
if params[:student_work] if params[:student_work]
stundet_work = StudentWork.find(params[:student_work_id]) if params[:student_work_id] student_work = StudentWork.find(params[:student_work_id]) if params[:student_work_id]
stundet_work ||= StudentWork.new student_work ||= StudentWork.new
stundet_work.name = params[:student_work][:name] student_work.name = params[:student_work][:name]
stundet_work.description = params[:student_work][:description] student_work.description = params[:student_work][:description]
stundet_work.project_id = params[:student_work][:project_id] student_work.project_id = params[:student_work][:project_id]
stundet_work.homework_common_id = @homework.id student_work.homework_common_id = @homework.id
stundet_work.user_id = User.current.id student_work.user_id = User.current.id
stundet_work.save_attachments(params[:attachments]) student_work.save_attachments(params[:attachments])
if Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") < Time.parse(Time.now.to_s).strftime("%Y-%m-%d") if Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") < Time.parse(Time.now.to_s).strftime("%Y-%m-%d")
stundet_work.late_penalty = @homework.late_penalty student_work.late_penalty = @homework.late_penalty
else else
stundet_work.late_penalty = 0 student_work.late_penalty = 0
end end
render_attachment_warning_if_needed(stundet_work) render_attachment_warning_if_needed(student_work)
if stundet_work.save
if @homework.homework_type == 2 && @homework.homework_detail_programing #编程作业,学生提交作品后计算系统得分 if student_work.save
end
respond_to do |format| respond_to do |format|
format.html { format.html {
flash[:notice] = l(:notice_successful_create) flash[:notice] = l(:notice_successful_create)
@ -650,15 +629,17 @@ class StudentWorkController < ApplicationController
xls_report.string xls_report.string
end end
def find_or_save_student_work def find_or_save_student_work(is_test)
student_work = @homework.student_works.where(user_id: User.current.id).first student_work = StudentWork.where(homework_common_id: @homework.id, user_id: User.current.id).first
if student_work.nil? if student_work.nil?
@homework.student_works.build( @homework.student_works.build(
name: params[:title], name: params[:title],
description: params[:src], description: params[:src],
user_id: User.current.id user_id: User.current.id,
is_test: is_test
) )
unless @homework.save unless @homework.save
logger.debug @homework.errors.full_messages
else else
student_work = @homework.student_works.where(user_id: User.current.id).first student_work = @homework.student_works.where(user_id: User.current.id).first
end end

@ -44,6 +44,13 @@ class SystemMessagesController < ApplicationController
if @system_messages.save if @system_messages.save
format.html {redirect_to user_message_path(User.current, :type => "system_message")} format.html {redirect_to user_message_path(User.current, :type => "system_message")}
flash[:notice] = l(:notice_successful_message) flash[:notice] = l(:notice_successful_message)
else
if params[:system_message][:content].empty?
flash[:error] = l(:label_content_blank_fail)
else
flash[:error] = l(:label_admin_message_fail)
end
format.html {redirect_to admin_messages_path}
end end
end end
end end

@ -324,8 +324,9 @@ class UsersController < ApplicationController
def user_homeworks def user_homeworks
if User.current == @user if User.current == @user
@page = params[:page] ? params[:page].to_i + 1 : 0 @page = params[:page] ? params[:page].to_i + 1 : 0
user_course_ids = "(" + @user.courses.visible.map{|course| course.id}.join(",") + ")" user_course_ids = @user.courses.empty? ? "(-1)" :"(" + @user.courses.visible.map{|course| course.id}.join(",") + ")"
@homework_commons = HomeworkCommon.where("course_id in #{user_course_ids}").order("created_at desc").limit(10).offset(@page * 10) @homework_commons = HomeworkCommon.where("course_id in #{user_course_ids}").order("created_at desc").limit(10).offset(@page * 10)
@is_teacher = User.current.user_extensions && User.current.user_extensions.identity == 0 && User.current.allowed_to?(:add_course, nil, :global => true)
respond_to do |format| respond_to do |format|
format.js format.js
format.html {render :layout => 'new_base_user'} format.html {render :layout => 'new_base_user'}
@ -392,9 +393,29 @@ class UsersController < ApplicationController
end end
end end
#修改编程作业
def edit_user_commit_homework
if User.current.logged?
respond_to do |format|
format.js
format.html {render :layout => 'new_base_user'}
end
else
render_403
end
end
def user_commit_homework def user_commit_homework
flash[:notice] = l(:notice_successful_create) homework = HomeworkCommon.find(params[:homework])
redirect_to student_work_index_url(:homework => params[:homework]) student_work = homework.student_works.where(user_id: User.current.id).first
if student_work
student_work.save
flash[:notice] = l(:notice_successful_create)
redirect_to student_work_index_url(:homework => params[:homework])
else
render_403
end
end end
def user_new_homework def user_new_homework
@ -413,21 +434,21 @@ class UsersController < ApplicationController
homework.save_attachments(params[:attachments]) homework.save_attachments(params[:attachments])
render_attachment_warning_if_needed(homework) render_attachment_warning_if_needed(homework)
#匿评作业相关属性 homework_detail_manual = HomeworkDetailManual.new
if homework.homework_type == 1 homework_detail_manual.ta_proportion = params[:ta_proportion] || 0.6
homework_detail_manual = HomeworkDetailManual.new homework_detail_manual.comment_status = 1
homework_detail_manual.ta_proportion = params[:ta_proportion] || 0.6 homework_detail_manual.evaluation_start = Time.now
homework_detail_manual.comment_status = 1 homework_detail_manual.evaluation_end = Time.now
homework_detail_manual.evaluation_start = Time.now homework_detail_manual.evaluation_num = params[:evaluation_num] || 3
homework_detail_manual.evaluation_end = Time.now homework_detail_manual.absence_penalty = 2
homework_detail_manual.evaluation_num = params[:evaluation_num] || 3 homework.homework_detail_manual = homework_detail_manual
homework_detail_manual.absence_penalty = 2
homework.homework_detail_manual = homework_detail_manual #编程作业相关属性
else if homework.homework_type == 2
homework_detail_programing = HomeworkDetailPrograming.new homework_detail_programing = HomeworkDetailPrograming.new
homework.homework_detail_programing = homework_detail_programing homework.homework_detail_programing = homework_detail_programing
homework_detail_programing.ta_proportion = params[:ta_proportion] || 0.6 homework_detail_programing.ta_proportion = params[:ta_proportion] || 0.6
homework_detail_programing.language = params[:program][:language].to_i homework_detail_programing.language = params[:language_type].to_i
inputs = params[:program][:input] inputs = params[:program][:input]
if Array === inputs if Array === inputs
@ -826,11 +847,13 @@ class UsersController < ApplicationController
@user_activities = UserActivity.where("container_type = 'Project' and container_id in #{user_project_ids} and act_type = 'Issue'").order('created_at desc').limit(10).offset(@page * 10) @user_activities = UserActivity.where("container_type = 'Project' and container_id in #{user_project_ids} and act_type = 'Issue'").order('created_at desc').limit(10).offset(@page * 10)
when "project_message" when "project_message"
@user_activities = UserActivity.where("container_type = 'Project' and container_id in #{user_project_ids} and act_type = 'Message'").order('created_at desc').limit(10).offset(@page * 10) @user_activities = UserActivity.where("container_type = 'Project' and container_id in #{user_project_ids} and act_type = 'Message'").order('created_at desc').limit(10).offset(@page * 10)
when "current_user"
@user_activities = UserActivity.where("user_id = #{User.current.id} and ((container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types}) or (container_type = 'Course' and container_id in #{user_course_ids} and act_type in #{course_types}))").order('created_at desc').limit(10).offset(@page * 10)
else else
@user_activities = UserActivity.where("(container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types}) or (container_type = 'Course' and container_id in #{user_course_ids}) and act_type in #{course_types}").order('created_at desc').limit(10).offset(@page * 10) @user_activities = UserActivity.where("(container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types}) or (container_type = 'Course' and container_id in #{user_course_ids} and act_type in #{course_types})").order('created_at desc').limit(10).offset(@page * 10)
end end
else else
@user_activities = UserActivity.where("(container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types}) or (container_type = 'Course' and container_id in #{user_course_ids}) and act_type in #{course_types}").order('created_at desc').limit(10).offset(@page * 10) @user_activities = UserActivity.where("(container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types}) or (container_type = 'Course' and container_id in #{user_course_ids} and act_type in #{course_types})").order('created_at desc').limit(10).offset(@page * 10)
end end
# @user_activities = paginateHelper @user_activities,500 # @user_activities = paginateHelper @user_activities,500
@type = params[:type] @type = params[:type]

@ -202,11 +202,15 @@ class WordsController < ApplicationController
#给用户留言 #给用户留言
def leave_user_message def leave_user_message
@user = User.find(params[:id]) if User.current.logged?
if params[:new_form][:user_message].size>0 && User.current.logged? && @user @user = User.find(params[:id])
@user.add_jour(User.current, params[:new_form][:user_message]) if params[:new_form][:user_message].size>0 && User.current.logged? && @user
@user.add_jour(User.current, params[:new_form][:user_message])
end
redirect_to feedback_path(@user)
else
render_403
end end
redirect_to feedback_path(@user)
end end
# add by nwb # add by nwb

@ -2297,25 +2297,27 @@ module ApplicationHelper
#获取匿评相关连接代码 #获取匿评相关连接代码
def homework_anonymous_comment homework def homework_anonymous_comment homework
if homework.homework_type == 1 && homework.homework_detail_manual #匿评作业 # if homework.homework_type == 1 && homework.homework_detail_manual #匿评作业
if Time.parse(homework.end_time.to_s).strftime("%Y-%m-%d") >= Time.now.strftime("%Y-%m-%d") #
link = "<span class='fr mr10 pr_join_span ' title='作业截止日期之前不可以启动匿评'>启动匿评</span>".html_safe # elsif homework.homework_type == 2 && homework.homework_detail_programing #编程作业作业
elsif homework.student_works.count >= 2 #作业份数大于2 # link = "<span class='fr mr10 pr_join_span ' title='编程作业'>编程作业</span>".html_safe
case homework.homework_detail_manual.comment_status # else
when 1 # link = "<span class='fr mr10 pr_join_span ' title='未开启匿评作业不可以启动匿评'>启动匿评</span>".html_safe
link = link_to '启动匿评', alert_anonymous_comment_homework_common_path(homework), id: "#{homework.id}_start_anonymous_comment", remote: true, disable_with: '加载中...',:class => 'fr mr10 work_edit' # end
when 2
link = link_to '关闭匿评', alert_anonymous_comment_homework_common_path(homework), id: "#{homework.id}_stop_anonymous_comment", remote: true,:class => 'fr mr10 work_edit' if Time.parse(homework.end_time.to_s).strftime("%Y-%m-%d") >= Time.now.strftime("%Y-%m-%d")
when 3 link = "<span class='fr mr10 pr_join_span ' title='作业截止日期之前不可以启动匿评'>启动匿评</span>".html_safe
link = "<span class='fr pr_join_span mr10' title='匿评结束'>匿评结束</span>".html_safe elsif homework.student_works.count >= 2 #作业份数大于2
end case homework.homework_detail_manual.comment_status
else when 1
link = "<span class='fr mr10 pr_join_span ' title='学生提交作业数大于2时才可以启动匿评'>启动匿评</span>".html_safe link = link_to '启动匿评', alert_anonymous_comment_homework_common_path(homework), id: "#{homework.id}_start_anonymous_comment", remote: true, disable_with: '加载中...',:class => 'fr mr10 work_edit'
when 2
link = link_to '关闭匿评', alert_anonymous_comment_homework_common_path(homework), id: "#{homework.id}_stop_anonymous_comment", remote: true,:class => 'fr mr10 work_edit'
when 3
link = "<span class='fr pr_join_span mr10' title='匿评结束'>匿评结束</span>".html_safe
end end
elsif homework.homework_type == 2 && homework.homework_detail_programing #编程作业作业
link = "<span class='fr mr10 pr_join_span ' title='编程作业'>编程作业</span>".html_safe
else else
link = "<span class='fr mr10 pr_join_span ' title='未开启匿评作业不可以启动匿评'>启动匿评</span>".html_safe link = "<span class='fr mr10 pr_join_span ' title='学生提交作业数大于2时才可以启动匿评'>启动匿评</span>".html_safe
end end
link link
end end
@ -2334,6 +2336,20 @@ module ApplicationHelper
end end
end end
end end
#动态列表中,确定学生是该提交还是进列表
def student_work_activity_submit_status(opt={})
default_opt = {class: 'c_blue'}.merge(opt)
is_teacher = User.current.user_extensions && User.current.user_extensions.identity == 0 && User.current.allowed_to?(:add_course, nil, :global => true)
homework = default_opt[:homework]
work = cur_user_works_for_homework homework
if work.nil? && !is_teacher
link_to "提交("+homework.student_works.count.to_s+")", new_student_work_path(:homework => homework.id), :class=> default_opt[:class]
else
link_to "提交("+homework.student_works.count.to_s+")", student_work_index_path(:homework => homework.id), :class=> default_opt[:class]
end
end
#根据传入作业确定显示为编辑作品还是新建作品,或者显示作品数量 #根据传入作业确定显示为编辑作品还是新建作品,或者显示作品数量
def user_for_homework_common homework,is_teacher def user_for_homework_common homework,is_teacher
@ -2345,7 +2361,7 @@ module ApplicationHelper
link_to "提交作品", new_student_work_path(:homework => homework.id),:class => 'c_blue' link_to "提交作品", new_student_work_path(:homework => homework.id),:class => 'c_blue'
else else
if homework.homework_type == 1 && homework.homework_detail_manual && homework.homework_detail_manual.comment_status != 1 #匿评作业,且作业状态不是在开启匿评之前 if homework.homework_type == 1 && homework.homework_detail_manual && homework.homework_detail_manual.comment_status != 1 #匿评作业,且作业状态不是在开启匿评之前
link_to "修改作品", "", :class => 'c_blue', :title => "开启匿评后不可修改作品" link_to "作品已交", "", :class => 'c_blue', :title => "开启匿评后不可修改作品"
elsif homework.homework_type == 2 #编程作业不能修改作品 elsif homework.homework_type == 2 #编程作业不能修改作品
link_to "作品已交", student_work_index_path(:homework => homework.id),:class => 'c_blue',:title => "编程作业不可修改作品" link_to "作品已交", student_work_index_path(:homework => homework.id),:class => 'c_blue',:title => "编程作业不可修改作品"
else else

@ -1,4 +1,5 @@
# encoding: utf-8 # encoding: utf-8
include UsersHelper
module HomeworkCommonHelper module HomeworkCommonHelper
#迟交扣分下拉框 #迟交扣分下拉框
def late_penalty_option def late_penalty_option

@ -19,6 +19,7 @@ class CourseActivity < ActiveRecord::Base
user_activity.act_type = self.course_act_type user_activity.act_type = self.course_act_type
user_activity.container_type = "Course" user_activity.container_type = "Course"
user_activity.container_id = self.course_id user_activity.container_id = self.course_id
user_activity.user_id = self.user_id
user_activity.save user_activity.save
end end
end end

@ -10,7 +10,7 @@ class HomeworkCommon < ActiveRecord::Base
has_one :homework_detail_manual, :dependent => :destroy has_one :homework_detail_manual, :dependent => :destroy
has_one :homework_detail_programing, :dependent => :destroy has_one :homework_detail_programing, :dependent => :destroy
has_many :homework_tests, :dependent => :destroy has_many :homework_tests, :dependent => :destroy
has_many :student_works, :dependent => :destroy has_many :student_works, :dependent => :destroy, :conditions => "is_test=0"
has_many :student_works_evaluation_distributions, :through => :student_works #一个作业的分配的匿评列表 has_many :student_works_evaluation_distributions, :through => :student_works #一个作业的分配的匿评列表
has_many :acts, :class_name => 'Activity', :as => :act, :dependent => :destroy #用户活动 has_many :acts, :class_name => 'Activity', :as => :act, :dependent => :destroy #用户活动
# 课程动态 # 课程动态
@ -56,6 +56,10 @@ class HomeworkCommon < ActiveRecord::Base
Mailer.run.homework_added(self) Mailer.run.homework_added(self)
end end
def is_program_homework?
self.homework_type == 2 && self.homework_detail_programing
end
delegate :language_name, :to => :homework_detail_programing delegate :language_name, :to => :homework_detail_programing
end end

@ -1,6 +1,6 @@
#学生提交作品表 #学生提交作品表
class StudentWork < ActiveRecord::Base class StudentWork < ActiveRecord::Base
attr_accessible :name, :description, :homework_common_id, :user_id, :final_score, :teacher_score, :student_score, :teaching_asistant_score, :project_id attr_accessible :name, :description, :homework_common_id, :user_id, :final_score, :teacher_score, :student_score, :teaching_asistant_score, :project_id, :is_test
belongs_to :homework_common belongs_to :homework_common
belongs_to :user belongs_to :user
@ -10,10 +10,32 @@ class StudentWork < ActiveRecord::Base
has_many :student_work_tests, order: 'id desc' has_many :student_work_tests, order: 'id desc'
before_destroy :delete_praise before_destroy :delete_praise
before_save :set_program_score, :set_src
acts_as_attachable acts_as_attachable
def delete_praise def delete_praise
PraiseTread.where("praise_tread_object_id = #{self.id} AND praise_tread_object_type = 'StudentWork'").destroy_all PraiseTread.where("praise_tread_object_id = #{self.id} AND praise_tread_object_type = 'StudentWork'").destroy_all
end end
def last_test
student_work_tests.order('id desc').first
end
private
def set_program_score
if homework_common.is_program_homework? #编程作业,学生提交作品后计算系统得分
#根据最后一次测试计算得分
unless last_test
self.system_score = 0
else
self.system_score = last_test.test_score
end
end
end
def set_src
self.description = last_test.src if last_test
end
end end

@ -34,10 +34,19 @@ class StudentWorkTest < ActiveRecord::Base
def test_score def test_score
if self.status.to_i == 0 if self.status.to_i == 0
format("%.1f",100.0 / self.student_work.homework_common.homework_tests.count) 100
else elsif self.results.empty?
0 0
else
get_success_count * 100 / self.results.count
end end
end end
private
def get_success_count
self.results.inject(0) do |sum, result|
sum += (result["status"].to_i == 0 ? 1 : 0)
end || 0
end
end end

@ -3,5 +3,5 @@ class SystemMessage < ActiveRecord::Base
belongs_to :user belongs_to :user
validates :content, presence: true validates :content, presence: true
validates_length_of :content, maximum:255 validates_length_of :content, maximum: 255
end end

@ -54,7 +54,7 @@
<%=@count %> <%=@count %>
</td> </td>
<td align="center"> <td align="center">
<%=format_date(user.last_login_on) %> <%=format_time(user.last_login_on) %>
</td> </td>
<td align="center"> <td align="center">
<%=user.id %> <%=user.id %>
@ -70,18 +70,20 @@
<%=link_to(user.login, user_path(user)) %> <%=link_to(user.login, user_path(user)) %>
</td> </td>
<td align="center"> <td align="center">
<% case user.user_extensions.identity %> <%if user.user_extensions%>
<% when 0 %> <% case user.user_extensions.identity %>
<%='老师' %> <% when 0 %>
<% when 1 %> <%='老师' %>
<%='学生' %> <% when 1 %>
<% when 2 %> <%='学生' %>
<%='企业' %> <% when 2 %>
<% when 3 %> <%='企业' %>
<%='开发者' %> <% when 3 %>
<% else %> <%='开发者' %>
<%='未知身份' %> <% else %>
<% end %> <%='未知身份' %>
<% end %>
<% end%>
</td> </td>
</tr> </tr>
<% end %> <% end %>

@ -1,4 +1,5 @@
<%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg' %> <%= javascript_include_tag "/assets/kindeditor/kindeditor",'prettify','/assets/kindeditor/pasteimg' %>
<%= stylesheet_link_tag 'prettify'%>
<%= labelled_form_for @bid,:html => { :multipart => true } do |f| %> <%= labelled_form_for @bid,:html => { :multipart => true } do |f| %>
<%= render :partial => 'new_homework_form', :locals => { :bid => @bid, :bid_id => "edit_bid_#{@bid.id}",:f=>f,:edit_mode => true} %> <%= render :partial => 'new_homework_form', :locals => { :bid => @bid, :bid_id => "edit_bid_#{@bid.id}",:f=>f,:edit_mode => true} %>
<% end %> <% end %>

@ -82,13 +82,19 @@ function nh_init_board(params){
var editor = params.kindutil.create(params.textarea, { var editor = params.kindutil.create(params.textarea, {
// allowPreviewEmoticons : false, // allowPreviewEmoticons : false,
// allowImageUpload : false, // allowImageUpload : false,
autoHeightMode : true,
resizeType : 1,minWidth:"1px",width:"560px",height:"150px", resizeType : 1,minWidth:"1px",width:"560px",height:"150px",
allowFileManager:true,uploadJson:"/kindeditor/upload", allowFileManager:true,uploadJson:"/kindeditor/upload",
fileManagerJson:"/kindeditor/filemanager", fileManagerJson:"/kindeditor/filemanager",
afterChange:function(){//按键事件 afterChange:function(){//按键事件
nh_check_field({content:this,contentmsg:params.contentmsg,textarea:params.textarea}); nh_check_field({content:this,contentmsg:params.contentmsg,textarea:params.textarea});
// var edit = this.edit;
// var body = edit.doc.body;
// edit.iframe.height(minHeight);
// this.resize(null, Math.max((params.kindutil.IE ? body.scrollHeight : body.offsetHeight) + 30, minHeight));
}, },
afterCreate:function(){ afterCreate:function(){
this.loadPlugin("autoheight");
var userAgent = navigator.userAgent.toLowerCase(); var userAgent = navigator.userAgent.toLowerCase();
if(/trident/.test(userAgent)){ if(/trident/.test(userAgent)){
$("div.talk_new .ke-container").css({'margin-left':'0px'}); $("div.talk_new .ke-container").css({'margin-left':'0px'});

@ -10,11 +10,11 @@
div.respond-form .reply_btn{margin-left:565px;margin-top:5px;} div.respond-form .reply_btn{margin-left:565px;margin-top:5px;}
div.recall_con{width:570px;} div.recall_con{width:570px;}
div.recall_con .reply_btn{margin-left:525px;margin-top:5px;} div.recall_con .reply_btn{margin-left:525px;margin-top:5px;}
.ke-container{height: 80px !important;} /*.ke-container{height: 80px !important;}*/
</style> </style>
<%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg',"init_KindEditor" %> <%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg',"init_KindEditor" %>
<script > <script >
init_KindEditor_data(''); init_KindEditor_data('',80);
</script> </script>
<div class="msg_box fl mb10" id='leave-message'> <div class="msg_box fl mb10" id='leave-message'>
<h4><%= l(:label_leave_message) %></h4> <h4><%= l(:label_leave_message) %></h4>
@ -62,6 +62,7 @@
params.contentmsg = $("p[nhname='contentmsg']",params.div_form); params.contentmsg = $("p[nhname='contentmsg']",params.div_form);
params.toolbar_container = $("div[nhname='toolbar_container']",params.div_form); params.toolbar_container = $("div[nhname='toolbar_container']",params.div_form);
params.cancel_btn = $("input[nhname='cancel_btn']",params.div_form); params.cancel_btn = $("input[nhname='cancel_btn']",params.div_form);
params.height = 55;
if(params.textarea.data('init') == undefined){ if(params.textarea.data('init') == undefined){
params.editor = init_editor(params); params.editor = init_editor(params);
init_form(params); init_form(params);

@ -1,24 +1,23 @@
<%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg' %> <script type="text/javascript">
<%= error_messages_for 'homework_common' %> function reset_homework(){
$("#homework_name").val("");
<div class="project_r_h"> $("#homework_end_time").val("");
<h2 class="project_h2"> $("#course_id").val($("#option_select").val());
<%= l(:label_course_homework_edit)%> $("#homework_attachments").html("<%= escape_javascript(render :partial => 'users/user_homework_attachment', :locals => { :container => HomeworkCommon.new })%>");
</h2> homework_description_editor.html("");
$("#homework_editor").toggle();
}
</script>
<div class="homepageRightBanner mb10">
<div class="NewsBannerName">编辑作业</div>
</div> </div>
<div class="hwork_new">
<%if @homework.homework_type == 2%>
<%= form_for @homework do |f| %>
<%= render :partial => 'homework_common/homework_detail_programing_form', :locals => { :homework => @homework,:f => f,:edit_mode => true } %>
<a href="javascript:void(0)" class="blue_btn fl mr10" onClick="submit_homework('edit_homework_common_<%= @homework.id%>');" >提交</a>
<%= link_to '取消',homework_common_index_path(:course => @course.id),:class => 'grey_btn fl'%>
<% end%>
<% else %>
<%= form_for @homework do |f| %>
<%= render :partial => 'homework_common/homework_detail_manual_form', :locals => { :homework => @homework,:f => f,:edit_mode => true } %>
<a href="javascript:void(0)" class="blue_btn fl mr10" onClick="submit_homework('edit_homework_common_<%= @homework.id%>');" >提交</a>
<%= link_to '取消',homework_common_index_path(:course => @course.id),:class => 'grey_btn fl'%>
<% end%>
<% end%>
</div><!--hwork_new end-->
<div class="cl"></div> <div class="cl"></div>
<!-- 老师身份才可以发布作业 -->
<div class="HomeWork mb10">
<%= form_for @homework do |f| %>
<div id="HomeWorkCon">
<%= render :partial => 'users/user_homework_form', :locals => { :homework => @homework,:f => f,:edit_mode => true } %>
</div>
<% end%>
</div><!----HomeWork end-->

@ -98,17 +98,17 @@
<div class="cl"></div> <div class="cl"></div>
<% end%> <% end%>
<div class="mt5"> <!--div class="mt5">
<span class="tit_fb" style="width: auto;"> 扣分标准:</span> <span class="tit_fb" style="width: auto;"> 扣分标准:</span>
<div class="fl mb5 c_red"> <div class="fl mb5 c_red">
<% if homework.homework_type == 1%> <%# if homework.homework_type == 1%>
<%= scoring_rules homework.late_penalty,homework.id,@is_teacher,homework.homework_detail_manual.absence_penalty%> <%#= scoring_rules homework.late_penalty,homework.id,@is_teacher,homework.homework_detail_manual.absence_penalty%>
<% else%> <%# else%>
<%= scoring_rules homework.late_penalty,homework.id,@is_teacher%> <%#= scoring_rules homework.late_penalty,homework.id,@is_teacher%>
<% end%> <%# end%>
</div> </div>
</div> </div>
<div class="cl"></div> <div class="cl"></div-->
<span class="fl"><%= l(:label_end_time)%><%= homework.end_time%></span> <span class="fl"><%= l(:label_end_time)%><%= homework.end_time%></span>
<% if betweentime(homework.end_time) < 0 %> <% if betweentime(homework.end_time) < 0 %>

@ -78,11 +78,11 @@
</div> </div>
</div> </div>
<div class="navHomepageProfile"> <div class="navHomepageProfile" id="navHomepageProfile">
<ul> <ul>
<li class="homepageProfileMenuIcon"> <li class="homepageProfileMenuIcon" id="homepageProfileMenuIcon">
<%= link_to "<div class='mt5 mb8'>#{image_tag(url_to_avatar(User.current),:width =>"40",:height => "40",:class => "portraitRadius",:alt=>"头像", :id => "nh_user_logo")}</div>".html_safe,user_activities_path(User.current.id)%> <%= link_to "<div class='mt5 mb8' id='user_avatar'>#{image_tag(url_to_avatar(User.current),:width =>"40",:height => "40",:class => "portraitRadius",:alt=>"头像", :id => "nh_user_logo")}</div>".html_safe,user_activities_path(User.current.id)%>
<ul class="topnav_login_list"> <ul class="topnav_login_list none" id="topnav_login_list">
<li> <li>
<%= link_to "修改资料", my_account_path, :class => "menuGrey"%> <%= link_to "修改资料", my_account_path, :class => "menuGrey"%>
</li> </li>
@ -110,6 +110,15 @@
$("#navHomepageSearchType").hide(); $("#navHomepageSearchType").hide();
}); });
$("#user_avatar img").mouseenter(function(){
$("#homepageProfileMenuIcon").addClass("homepageProfileMenuIconhover");
$("#topnav_login_list").show();
});
$("#navHomepageProfile").mouseleave(function(){
$("#homepageProfileMenuIcon").removeClass("homepageProfileMenuIconhover");
$("#topnav_login_list").hide();
});
function signout(){ function signout(){
$.post( $.post(
'<%= signout_path%>', '<%= signout_path%>',

@ -8,11 +8,11 @@
<meta name="keywords" content="issue,bug,tracker" /> <meta name="keywords" content="issue,bug,tracker" />
<%= csrf_meta_tag %> <%= csrf_meta_tag %>
<%= favicon %> <%= favicon %>
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2', 'application', 'nyan', :media => 'all' %> <%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2', 'application','prettify', 'nyan', :media => 'all' %>
<%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %> <%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %>
<%= javascript_heads %> <%= javascript_heads %>
<%= javascript_include_tag "jquery.leanModal.min" %> <%= javascript_include_tag "jquery.leanModal.min" %>
<%= javascript_include_tag 'seems_rateable/jRating', 'seems_rateable/rateable'%> <%= javascript_include_tag 'seems_rateable/jRating','prettify', 'seems_rateable/rateable'%>
<%= heads_for_theme %> <%= heads_for_theme %>
<%= call_hook :view_layouts_base_html_head %> <%= call_hook :view_layouts_base_html_head %>
<!-- page specific tags --> <!-- page specific tags -->

@ -17,8 +17,8 @@
<%= javascript_heads %> <%= javascript_heads %>
<%= heads_for_theme %> <%= heads_for_theme %>
<%= call_hook :view_layouts_base_html_head %> <%= call_hook :view_layouts_base_html_head %>
<%= stylesheet_link_tag 'public', 'leftside', 'jquery/jquery-ui-1.9.2', 'courses','header'%> <%= stylesheet_link_tag 'public', 'leftside', 'jquery/jquery-ui-1.9.2','prettify', 'courses','header'%>
<%= javascript_include_tag "course","header","attachments" %> <%= javascript_include_tag "course","header","attachments",'prettify' %>
<!-- page specific tags --> <!-- page specific tags -->
<%= yield :header_tags -%> <%= yield :header_tags -%>
</head> </head>

@ -7,10 +7,10 @@
<meta name="keywords" content="issue,bug,tracker" /> <meta name="keywords" content="issue,bug,tracker" />
<%= csrf_meta_tag %> <%= csrf_meta_tag %>
<%= favicon %> <%= favicon %>
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2', 'application', 'nyan', :media => 'all' %> <%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2', 'application','prettify', 'nyan', :media => 'all' %>
<%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %> <%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %>
<%= javascript_heads %> <%= javascript_heads %>
<%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg' %> <%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg' ,'prettify' %>
<%= heads_for_theme %> <%= heads_for_theme %>
<%= call_hook :view_layouts_base_html_head %> <%= call_hook :view_layouts_base_html_head %>

@ -7,12 +7,12 @@
<meta name="keywords" content="issue,bug,tracker" /> <meta name="keywords" content="issue,bug,tracker" />
<%= csrf_meta_tag %> <%= csrf_meta_tag %>
<%= favicon %> <%= favicon %>
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2', 'application', 'nyan', :media => 'all' %> <%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2', 'application','prettify', 'nyan', :media => 'all' %>
<%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %> <%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %>
<%= javascript_heads %> <%= javascript_heads %>
<%= heads_for_theme %> <%= heads_for_theme %>
<%= call_hook :view_layouts_base_html_head %> <%= call_hook :view_layouts_base_html_head %>
<%= javascript_include_tag "ckeditor/ckeditor.js" %> <%= javascript_include_tag "ckeditor/ckeditor.js",'prettify' %>
<!-- page specific tags --> <!-- page specific tags -->
<%= yield :header_tags -%> <%= yield :header_tags -%>
<%= stylesheet_link_tag 'base','header', :media => 'all'%> <%= stylesheet_link_tag 'base','header', :media => 'all'%>

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

Loading…
Cancel
Save