新建题目
This commit is contained in:
parent
5a27b84e97
commit
544702e11f
|
@ -1,17 +1,60 @@
|
|||
#encoding=utf-8
|
||||
class ContestsController < ApplicationController
|
||||
|
||||
before_filter :find_contest, :only => [:show, :settings, :update]
|
||||
include ContestsHelper
|
||||
|
||||
before_filter :find_contest, :only => [:show, :settings, :update, :contest_activities]
|
||||
before_filter :is_logged, :only => [:index, :new, :create]
|
||||
layout "base_contests"
|
||||
|
||||
def show
|
||||
@left_nav_type = 1
|
||||
|
||||
respond_to do |format|
|
||||
format.js
|
||||
format.html
|
||||
end
|
||||
end
|
||||
|
||||
def contest_activities
|
||||
#更新创建课程消息状态
|
||||
contest_request_messages = ContestMessage.where(:user_id => User.current.id, :contest_id => @contest.id, :contest_message_type => "ContestRequestDealResult", :viewed => false)
|
||||
contest_request_messages.update_all(:viewed => true)
|
||||
|
||||
contest_activities = @contest.contest_activities
|
||||
@page = params[:page] ? params[:page].to_i + 1 : 0
|
||||
if params[:type].present?
|
||||
case params[:type]
|
||||
when "work"
|
||||
@contest_activities = contest_activities.where("contest_act_type = 'Work'").order('updated_at desc')
|
||||
when "news"
|
||||
@contest_activities = contest_activities.where("contest_act_type = 'News'").order('updated_at desc')
|
||||
when "message"
|
||||
@contest_activities = contest_activities.where("contest_act_type = 'Message'").order('updated_at desc')
|
||||
when "poll"
|
||||
@contest_activities = contest_activities.where("contest_act_type = 'Poll'").order('updated_at desc')
|
||||
when "attachment"
|
||||
@contest_activities = contest_activities.where("contest_act_type = 'Attachment'").order('updated_at desc')
|
||||
when "journalsForMessage"
|
||||
@contest_activities = contest_activities.where("contest_act_type = 'JournalsForMessage'").order('updated_at desc')
|
||||
else
|
||||
@contest_activities = contest_activities.order('updated_at desc')
|
||||
end
|
||||
else
|
||||
@contest_activities = contest_activities.order('updated_at desc')
|
||||
end
|
||||
@contest_activities_count = @contest_activities.count
|
||||
@contest_activities = @contest_activities.limit(10).offset(@page * 10)
|
||||
@type = params[:type]
|
||||
|
||||
@left_nav_type = 2
|
||||
respond_to do |format|
|
||||
format.js
|
||||
format.html
|
||||
format.api
|
||||
end
|
||||
end
|
||||
|
||||
def new
|
||||
if User.current.login?
|
||||
@contest = Contest.new
|
||||
|
@ -45,10 +88,11 @@ class ContestsController < ApplicationController
|
|||
@contest.description = params[:contest][:description]
|
||||
# @project.organization_id = params[:organization_id]
|
||||
params[:contest][:is_public] == "on" ? @contest.is_public = 1 : @contest.is_public = 0
|
||||
@contest.save_attachments(params[:attachments])
|
||||
begin
|
||||
if @contest.save
|
||||
respond_to do |format|
|
||||
format.html{redirect_to settings_contest_url(@contest)}
|
||||
format.html{redirect_to contest_path(@contest)}
|
||||
end
|
||||
end
|
||||
rescue Exception => e
|
||||
|
|
|
@ -73,7 +73,7 @@ class HomeworkCommonController < ApplicationController
|
|||
end
|
||||
else
|
||||
respond_to do |format|
|
||||
format.html{render :layout => 'new_base_user'}
|
||||
format.html{render :layout => 'base_course_community'}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -133,6 +133,8 @@ class PraiseTreadController < ApplicationController
|
|||
@obj = Contest.find_by_id(id)
|
||||
when 'Syllabus'
|
||||
@obj = Syllabus.find_by_id(id)
|
||||
when 'Work'
|
||||
@obj = Work.find_by_id(id)
|
||||
else
|
||||
@obj = nil
|
||||
end
|
||||
|
|
|
@ -177,9 +177,9 @@ class UsersController < ApplicationController
|
|||
@is_project = params[:is_project]
|
||||
|
||||
case params[:type]
|
||||
when 'HomeworkCommon'
|
||||
when 'HomeworkCommon', 'Work'
|
||||
@reply = JournalsForMessage.find params[:reply_id]
|
||||
@type = 'HomeworkCommon'
|
||||
@type = params[:type]
|
||||
if params[:user_activity_id]
|
||||
@user_activity_id = params[:user_activity_id]
|
||||
else
|
||||
|
|
|
@ -7,7 +7,37 @@ class WorksController < ApplicationController
|
|||
before_filter :member_of_contest, :only => [:index]
|
||||
|
||||
def index
|
||||
search = "%#{params[:search].to_s.strip.downcase}%"
|
||||
@new_homework = Work.new
|
||||
@new_homework.contest = @contest
|
||||
@page = params[:page] ? params[:page].to_i + 1 : 0
|
||||
@is_teacher = User.current.logged? && (User.current.admin? || User.current.admin_of_contest?(@contest))
|
||||
if @is_teacher
|
||||
@homework_commons = @contest.works.where("name like '%#{search}%'").order("created_at desc")
|
||||
else
|
||||
@homework_commons = @contest.works.where("name like '%#{search}%' and publish_time <= '#{Date.today}'").order("created_at desc")
|
||||
end
|
||||
@is_new = params[:is_new]
|
||||
|
||||
@homeworks = paginateHelper @homework_commons,10
|
||||
#设置at已读
|
||||
ids = @homeworks.inject([]) do |ids, homework|
|
||||
jids = homework.journals_for_messages.map(&:id)
|
||||
jids ? ids + jids : ids
|
||||
|
||||
# homework.delay.set_jour_viewed
|
||||
end
|
||||
unless ids.empty?
|
||||
User.current.at_messages.where(viewed: false,
|
||||
at_message_type: 'JournalsForMessage',
|
||||
at_message_id: ids).update_all(viewed: true)
|
||||
end
|
||||
|
||||
@left_nav_type = 3
|
||||
respond_to do |format|
|
||||
format.js
|
||||
format.html
|
||||
end
|
||||
end
|
||||
|
||||
def show
|
||||
|
@ -19,19 +49,149 @@ class WorksController < ApplicationController
|
|||
end
|
||||
|
||||
def create
|
||||
if User.current.logged?
|
||||
if params[:homework_common]
|
||||
homework = Work.new
|
||||
homework.name = params[:homework_common][:name]
|
||||
homework.description = params[:homework_common][:description]
|
||||
homework.end_time = params[:homework_common][:end_time] || Date.today
|
||||
if params[:homework_common][:publish_time] == ""
|
||||
homework.publish_time = Date.today
|
||||
else
|
||||
homework.publish_time = params[:homework_common][:publish_time]
|
||||
end
|
||||
homework.work_type = params[:homework_type].to_i || 1
|
||||
#homework.late_penalty = 0
|
||||
#homework.teacher_priority = 1
|
||||
homework.user_id = User.current.id
|
||||
homework.contest_id = @contest.id
|
||||
|
||||
homework.save_attachments(params[:attachments])
|
||||
render_attachment_warning_if_needed(homework)
|
||||
|
||||
homework.work_status = homework.publish_time > Date.today ? 0 : 1
|
||||
|
||||
#分组作业
|
||||
if homework.work_type == 3
|
||||
homework_detail_group = WorkDetailGroup.new
|
||||
homework.work_detail_group = 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_group.save if homework_detail_group
|
||||
redirect_to works_path(:contest => @contest.id)
|
||||
end
|
||||
end
|
||||
else
|
||||
render_403
|
||||
end
|
||||
end
|
||||
|
||||
def update
|
||||
if params[:homework_common]
|
||||
@contestwork.name = params[:homework_common][:name]
|
||||
@contestwork.description = params[:homework_common][:description]
|
||||
if params[:homework_common][:publish_time] == ""
|
||||
@contestwork.publish_time = Date.today
|
||||
else
|
||||
@contestwork.publish_time = params[:homework_common][:publish_time]
|
||||
end
|
||||
param_end_time = Time.parse(params[:homework_common][:end_time]).strftime("%Y-%m-%d")
|
||||
homework_end_time = Time.parse(@contestwork.end_time.to_s).strftime("%Y-%m-%d")
|
||||
if homework_end_time != param_end_time
|
||||
if homework_end_time > param_end_time
|
||||
@contestwork.contestant_works.each do |st|
|
||||
if param_end_time < Time.parse(st.commit_time.to_s).strftime("%Y-%m-%d")
|
||||
st.work_status = 2
|
||||
st.save
|
||||
end
|
||||
end
|
||||
else
|
||||
@contestwork.contestant_works.where("work_status = 2").each do |st|
|
||||
if param_end_time >= Time.parse(st.commit_time.to_s).strftime("%Y-%m-%d")
|
||||
st.work_status = 1
|
||||
st.save
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@contestwork.end_time = params[:homework_common][:end_time] || Time.now
|
||||
if params[:homework_type] && params[:homework_type].to_i != @contestwork.work_type
|
||||
if @contestwork.work_type == 3
|
||||
@contestwork.work_detail_group.destroy if @contestwork.work_detail_group
|
||||
end
|
||||
end
|
||||
@contestwork.work_type = params[:homework_type].to_i || @contestwork.work_type
|
||||
|
||||
#status = false
|
||||
if @contestwork.publish_time <= Date.today && @contestwork.work_status == 0
|
||||
@contestwork.work_status = 1
|
||||
#status = true
|
||||
end
|
||||
|
||||
@contestwork.save_attachments(params[:attachments])
|
||||
render_attachment_warning_if_needed(@contestwork)
|
||||
|
||||
#分组作业
|
||||
if @contestwork.work_type == 3
|
||||
@contestwork.work_detail_group ||= WorkDetailGroup.new
|
||||
@homework_detail_group = @contestwork.work_detail_group
|
||||
@homework_detail_group.min_num = params[:min_num].to_i if params[:min_num]
|
||||
@homework_detail_group.max_num = params[:max_num].to_i if params[:max_num]
|
||||
@homework_detail_group.base_on_project = params[:base_on_project] ? 1 : 0
|
||||
end
|
||||
|
||||
if @contestwork.save
|
||||
@homework_detail_group.save if @homework_detail_group
|
||||
|
||||
@hw_status = params[:hw_status].to_i
|
||||
if @hw_status == 1
|
||||
redirect_to user_contest_community_path(User.current.id)
|
||||
elsif @hw_status == 2
|
||||
redirect_to contest_path(@contest.id)
|
||||
elsif @hw_status == 5
|
||||
redirect_to contestant_works_path(:work => @contestwork.id)
|
||||
else
|
||||
redirect_to works_path(:contest => @contest.id)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def edit
|
||||
|
||||
@user = User.current
|
||||
@hw_status = params[:hw_status].to_i
|
||||
@homework = @contestwork
|
||||
if @hw_status != 1
|
||||
@left_nav_type = 3
|
||||
respond_to do |format|
|
||||
format.html{render :layout => 'base_contests'}
|
||||
end
|
||||
else
|
||||
respond_to do |format|
|
||||
format.html{render :layout => 'base_contest_community'}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def destroy
|
||||
|
||||
if @contestwork.destroy
|
||||
respond_to do |format|
|
||||
format.html {
|
||||
@hw_status = params[:hw_status].to_i
|
||||
if @hw_status == 1
|
||||
redirect_to user_contest_community_path(User.current.id)
|
||||
elsif @hw_status == 2
|
||||
redirect_to contest_path(@contest.id)
|
||||
else
|
||||
redirect_to works_path(:contest => @contest.id)
|
||||
end
|
||||
}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
|
|
@ -3032,10 +3032,10 @@ module ApplicationHelper
|
|||
end
|
||||
|
||||
#根据传入作业确定显示为编辑作品还是新建作品,或者显示作品数量
|
||||
def user_for_contest_work homework,is_teacher,work
|
||||
def user_for_contest_work homework,is_contestant,work
|
||||
count = homework.contestant_works.count
|
||||
if User.current.member_of_contest?(homework.contest)
|
||||
if is_teacher #老师显示作品数量
|
||||
if !is_contestant #老师显示作品数量
|
||||
link_to "作品(#{count})", contestant_work_index_url_in_org(homework.id, 2), :class => "c_blue"
|
||||
else #学生显示提交作品、修改作品等按钮
|
||||
work = cur_user_works_for_work homework
|
||||
|
@ -3044,13 +3044,13 @@ module ApplicationHelper
|
|||
if homework.work_type ==3 && project.nil? && homework.work_detail_group.base_on_project
|
||||
link_to "提交作品(#{count})","javascript:void(0)", :class => 'c_grey',:style=>"cursor:not-allowed",:title => '请先关联项目再提交作品'
|
||||
else
|
||||
link_to "提交作品(#{count})", new_contestant_works_index_path(:work => homework.id),:class => 'c_blue'
|
||||
link_to "提交作品(#{count})", new_contestant_work_path(:work => homework.id),:class => 'c_blue'
|
||||
end
|
||||
elsif work.nil? && Time.parse(homework.end_time.to_s).strftime("%Y-%m-%d") < Time.now.strftime("%Y-%m-%d")
|
||||
if homework.work_type ==3 && project.nil? && homework.work_detail_group.base_on_project
|
||||
link_to "补交作品(#{count})","javascript:void(0)", :class => 'c_grey',:style=>"cursor:not-allowed",:title => '请先关联项目再补交作品'
|
||||
else
|
||||
link_to "补交作品(#{count})", new_contestant_works_index_path(:work => homework.id),:class => 'c_red'
|
||||
link_to "补交作品(#{count})", new_contestant_work_path(:work => homework.id),:class => 'c_red'
|
||||
end
|
||||
else
|
||||
if Time.parse(homework.end_time.to_s).strftime("%Y-%m-%d") >= Time.now.strftime("%Y-%m-%d") && work.user_id == User.current.id
|
||||
|
@ -3150,10 +3150,10 @@ module ApplicationHelper
|
|||
end
|
||||
|
||||
#获取当前用户在指定题目下提交的作业的集合
|
||||
def cur_user_works_for_work work
|
||||
work = work.contestant_works.where("user_id = ? && work_status != 0",User.current).first
|
||||
if work.work_type == 3
|
||||
pro = work.contestant_work_projects.where("user_id = #{User.current.id}").first
|
||||
def cur_user_works_for_work homework
|
||||
work = homework.contestant_works.where("user_id = ? && work_status != 0",User.current).first
|
||||
if homework.work_type == 3
|
||||
pro = homework.contestant_work_projects.where("user_id = #{User.current.id}").first
|
||||
if pro.nil? || pro.contestant_work_id == "" || pro.contestant_work_id.nil?
|
||||
work = nil
|
||||
else
|
||||
|
@ -3889,6 +3889,23 @@ def get_hw_status homework_common
|
|||
str
|
||||
end
|
||||
|
||||
def get_cw_status contest_work
|
||||
str = ""
|
||||
if contest_work.work_status == 0 && contest_work.publish_time.nil?
|
||||
str += '<span class="grey_homework_btn_cir ml5">挂起</span>'
|
||||
elsif contest_work.work_status == 0
|
||||
str += '<span class="grey_homework_btn_cir ml5">未发布</span>'
|
||||
elsif contest_work.work_status == 1
|
||||
if Time.parse(contest_work.end_time.to_s).strftime("%Y-%m-%d") >= Time.now.strftime("%Y-%m-%d")
|
||||
str += '<span class="green_homework_btn_cir ml5">作品提交中</span>'
|
||||
else
|
||||
str += '<span class="red_homework_btn_cir ml5">作品补交中</span>'
|
||||
end
|
||||
end
|
||||
str
|
||||
end
|
||||
|
||||
|
||||
def get_group_member_names work
|
||||
result = ""
|
||||
unless work.nil?
|
||||
|
@ -3973,6 +3990,38 @@ def homework_type_option
|
|||
type
|
||||
end
|
||||
|
||||
# 竞赛题目类型
|
||||
def work_type_option
|
||||
type = []
|
||||
option0 = []
|
||||
option0 << "请选择竞赛类型"
|
||||
option0 << 0
|
||||
option1 = []
|
||||
option1 << "普通竞赛"
|
||||
option1 << 1
|
||||
# option2 = []
|
||||
# option2 << "编程作业"
|
||||
# option2 << 2
|
||||
option3 = []
|
||||
option3 << "团队竞赛"
|
||||
option3 << 3
|
||||
type << option0
|
||||
type << option1
|
||||
#type << option2
|
||||
type << option3
|
||||
type
|
||||
end
|
||||
|
||||
# 当前用户可见的某竞赛下的作品数
|
||||
def visable_contest_work contest
|
||||
if User.current.admin? || User.current.admin_of_contest?(contest)
|
||||
work_num = contest.works.count
|
||||
else
|
||||
work_num = contest.works.where("publish_time <= '#{Date.today}'").count
|
||||
end
|
||||
work_num
|
||||
end
|
||||
|
||||
def add_reply_adapter obj, options
|
||||
#modify by nwb
|
||||
#添加对课程留言的支持
|
||||
|
|
|
@ -1,5 +1,25 @@
|
|||
module ContestsHelper
|
||||
|
||||
# 获取动态列表名称
|
||||
def get_acts_list_type type
|
||||
case type
|
||||
when "work"
|
||||
l(:label_homework_acts)
|
||||
when "news"
|
||||
l(:label_news_acts)
|
||||
when "attachment"
|
||||
l(:label_attachment_acts)
|
||||
when "message"
|
||||
l(:label_message_acts)
|
||||
when "journalsForMessage"
|
||||
l(:label_journalsForMessage_acts)
|
||||
when "poll"
|
||||
l(:label_poll_acts)
|
||||
else
|
||||
l(:label_all_cats)
|
||||
end
|
||||
end
|
||||
|
||||
# 判断当前用户是否为竞赛管理员
|
||||
def is_contest_manager?(user_id, contest_id)
|
||||
@result = false
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
class Contest < ActiveRecord::Base
|
||||
attr_accessible :description, :invite_code, :invite_code_halt, :is_delete, :is_public, :name, :user_id, :visits
|
||||
|
||||
include ContestsHelper
|
||||
|
||||
belongs_to :user
|
||||
has_many :contest_members, :include => [:principal, :roles], :conditions => "#{Principal.table_name}.type='User' AND #{Principal.table_name}.status=#{Principal::STATUS_ACTIVE}"
|
||||
has_many :memberships, :class_name => 'ContestMember'
|
||||
|
@ -10,11 +12,13 @@ class Contest < ActiveRecord::Base
|
|||
has_many :principals, :through => :member_principals, :source => :principal
|
||||
has_many :users, :through => :members
|
||||
has_many :contestants, :class_name => 'ContestantForContest', :source => :user
|
||||
has_many :works
|
||||
|
||||
has_many :contest_acts, :class_name => 'ContestActivity',:as =>:contest_act ,:dependent => :destroy
|
||||
has_many :contest_activities
|
||||
has_many :contest_messages, :class_name =>'ContestMessage', :as => :contest_message, :dependent => :destroy
|
||||
|
||||
acts_as_attachable
|
||||
validates_format_of :name,:with =>/^[^ ]+[a-zA-Z0-9_\u4e00-\u9fa5\s\S]*$/
|
||||
|
||||
before_destroy :delete_all_members
|
||||
|
|
|
@ -35,7 +35,7 @@ class Principal < ActiveRecord::Base
|
|||
has_many :issue_categories, :foreign_key => 'assigned_to_id', :dependent => :nullify
|
||||
|
||||
has_many :contest_members, :foreign_key => 'user_id', :dependent => :destroy
|
||||
has_many :contestmemberships, :class_name => 'ContestMember', :foreign_key => 'user_id', :include => [:contest, :roles], :conditions => "#{Contest.table_name}.is_delete != 0", :order => "#{Contest.table_name}.name"
|
||||
has_many :contestmemberships, :class_name => 'ContestMember', :foreign_key => 'user_id', :include => [:contest, :roles], :order => "#{Contest.table_name}.name"
|
||||
has_many :contests, :through => :contestmemberships
|
||||
|
||||
# Groups and active users
|
||||
|
|
|
@ -882,7 +882,8 @@ class User < Principal
|
|||
end
|
||||
|
||||
def member_of_contest?(contest)
|
||||
contests.to_a.include?(contest)
|
||||
contest.contest_members.where(:user_id => self.id).count > 0
|
||||
#contests.to_a.include?(contest)
|
||||
end
|
||||
|
||||
def member_of_org?(org)
|
||||
|
@ -922,9 +923,9 @@ class User < Principal
|
|||
if ContestMember.where("user_id =? and contest_id =?", self.id, contest.id).count == 0
|
||||
return false
|
||||
end
|
||||
role = ContestMember.where("user_id =? and contest_id =?", self.id, contest.id)[0].roles[0]
|
||||
unless role.nil?
|
||||
role.name == 'ContestManager' ? true : false
|
||||
member_role = ContestMember.where("user_id =? and contest_id =?", self.id, contest.id)[0].contest_member_roles.where(:is_current => true)[0]
|
||||
unless member_role.nil?
|
||||
member_role.role.name == 'ContestManager' ? true : false
|
||||
else
|
||||
false
|
||||
end
|
||||
|
@ -935,22 +936,22 @@ class User < Principal
|
|||
if ContestMember.where("user_id =? and contest_id =?", self.id, contest.id).count == 0
|
||||
return false
|
||||
end
|
||||
role = ContestMember.where("user_id =? and contest_id =?", self.id, contest.id)[0].roles[0]
|
||||
unless role.nil?
|
||||
role.name == 'Judge' ? true : false
|
||||
member_role = ContestMember.where("user_id =? and contest_id =?", self.id, contest.id)[0].contest_member_roles.where(:is_current => true)[0]
|
||||
unless member_role.nil?
|
||||
member_role.role.name == 'Judge' ? true : false
|
||||
else
|
||||
false
|
||||
end
|
||||
end
|
||||
|
||||
# 判断是否是竞赛的参赛者
|
||||
def judge_of_contest?(contest)
|
||||
def contestant_of_contest?(contest)
|
||||
if ContestMember.where("user_id =? and contest_id =?", self.id, contest.id).count == 0
|
||||
return false
|
||||
end
|
||||
role = ContestMember.where("user_id =? and contest_id =?", self.id, contest.id)[0].roles[0]
|
||||
unless role.nil?
|
||||
role.name == 'Contestant' ? true : false
|
||||
member_role = ContestMember.where("user_id =? and contest_id =?", self.id, contest.id)[0].contest_member_roles.where(:is_current => true)[0]
|
||||
unless member_role.nil?
|
||||
member_role.role.name == 'Contestant' ? true : false
|
||||
else
|
||||
false
|
||||
end
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
class Work < ActiveRecord::Base
|
||||
belongs_to :user
|
||||
belongs_to :contest
|
||||
attr_accessible :description, :end_time, :is_delete, :is_open, :name, :publish_time, :score_open, :work_status, :work_type
|
||||
attr_accessible :description, :end_time, :is_delete, :is_open, :name, :publish_time, :score_open, :work_status, :work_type, :contest_id, :user_id
|
||||
include ApplicationHelper
|
||||
|
||||
has_one :work_detail_group, :dependent => :destroy
|
||||
has_many :contestant_work_projects, :dependent => :destroy
|
||||
|
@ -20,6 +21,10 @@ class Work < ActiveRecord::Base
|
|||
after_save :act_as_contest_activity
|
||||
#after_destroy :delete_kindeditor_assets
|
||||
|
||||
def is_group_work?
|
||||
self.work_type == 3 && self.work_detail_group
|
||||
end
|
||||
|
||||
###添加回复
|
||||
def self.add_work_jour(user, notes, id, root_id, options = {})
|
||||
homework = Work.find(id)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class WorkDetailGroup < ActiveRecord::Base
|
||||
belongs_to :work
|
||||
attr_accessible :base_on_project, :max_num, :min_num
|
||||
attr_accessible :base_on_project, :max_num, :min_num, :work_id
|
||||
end
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<div class="cl"></div>
|
||||
</div>
|
||||
<div class="muban_popup_con clear ml30 mr30 mt10">
|
||||
<%= form_for('new_form',:url =>{:controller => 'contestant_work',:action => 'student_work_project',:work => @contestantwork.id,:user_activity_id=>@user_activity_id,:hw_status =>@hw_status},:method => "post", :remote => true) do |f|%>
|
||||
<%= form_for('new_form',:url =>{:controller => 'contestant_works',:action => 'student_work_project',:work => @contestwork.id,:user_activity_id=>@user_activity_id,:hw_status =>@hw_status},:method => "post", :remote => true) do |f|%>
|
||||
<input type="text" name="project" placeholder="输入项目名称进行搜索" class="searchResourcePopup mb10" />
|
||||
<div class="cl"></div>
|
||||
<p id="no_search_result" class="c_red f14" style="width:320px;display: none">您当前尚未创建任何项目,请先创建项目再关联。</p>
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
<% if @hw_status == 5 %>
|
||||
$("#homework_post_brief").html("<%= escape_javascript(render :partial => 'student_work/homework_post_brief', :locals => {:homework => @homework, :is_teacher => @is_teacher}) %>");
|
||||
$("#homework_post_brief").html("<%= escape_javascript(render :partial => 'contestant_works/work_post_brief', :locals => {:homework => @contestwork, :is_teacher => @is_teacher}) %>");
|
||||
<% else %>
|
||||
$("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/course_homework', :locals => {:activity => @homework,:user_activity_id =>@user_activity_id,:hw_status=>@hw_status}) %>");
|
||||
$("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/contest_work', :locals => {:activity => @contestwork,:user_activity_id =>@user_activity_id,:hw_status=>@hw_status}) %>");
|
||||
<% end %>
|
||||
<% if @user_activity_id != @homework.id %>
|
||||
<% if @user_activity_id != @contestwork.id %>
|
||||
sd_create_editor_from_data(<%= @user_activity_id%>,"","100%", "UserActivity");
|
||||
<% else %>
|
||||
sd_create_editor_from_data(<%= @homework.id%>,"","100%", "<%=@homework.class.to_s%>");
|
||||
sd_create_editor_from_data(<%= @contestwork.id%>,"","100%", "<%=@contestwork.class.to_s%>");
|
||||
<% end %>
|
|
@ -1,2 +1,2 @@
|
|||
var htmlvalue = "<%= escape_javascript(render :partial => 'student_work/relate_project') %>";
|
||||
var htmlvalue = "<%= escape_javascript(render :partial => 'relate_project') %>";
|
||||
pop_box_new(htmlvalue, 400, 285);
|
|
@ -1,11 +1,11 @@
|
|||
hideModal("#popbox02");
|
||||
<% if @hw_status == 5 %>
|
||||
$("#homework_post_brief").html("<%= escape_javascript(render :partial => 'student_work/homework_post_brief', :locals => {:homework => @homework, :is_teacher => @is_teacher}) %>");
|
||||
$("#homework_post_brief").html("<%= escape_javascript(render :partial => 'contestant_works/work_post_brief', :locals => {:homework => @contestwork, :is_teacher => @is_teacher}) %>");
|
||||
<% else %>
|
||||
$("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/course_homework', :locals => {:activity => @homework,:user_activity_id =>@user_activity_id,:hw_status=>@hw_status}) %>");
|
||||
$("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/contest_homework', :locals => {:activity => @contestwork,:user_activity_id =>@user_activity_id,:hw_status=>@hw_status}) %>");
|
||||
<% end %>
|
||||
<% if @user_activity_id != @homework.id %>
|
||||
<% if @user_activity_id != @contestwork.id %>
|
||||
sd_create_editor_from_data(<%= @user_activity_id%>,"","100%", "UserActivity");
|
||||
<% else %>
|
||||
sd_create_editor_from_data(<%= @homework.id%>,"","100%", "<%=@homework.class.to_s%>");
|
||||
sd_create_editor_from_data(<%= @contestwork.id%>,"","100%", "<%=@contestwork.class.to_s%>");
|
||||
<% end %>
|
|
@ -0,0 +1,63 @@
|
|||
<%= content_for(:header_tags) do %>
|
||||
<%= import_ke(enable_at: true, prettify: false, init_activity: true) %>
|
||||
<% end %>
|
||||
<script>
|
||||
var onUserCard = false;
|
||||
var onImage = false;
|
||||
$(document).ready(function(){
|
||||
$("#relateProject,.relatePInfo").mouseover(function(){
|
||||
$(".relatePInfo").css("display","block");
|
||||
})
|
||||
$("#relateProject,.relatePInfo").mouseout(function(){
|
||||
$(".relatePInfo").css("display","none");
|
||||
})
|
||||
$(".coursesLineGrey").mouseover(function(){
|
||||
$(this).css("color","#ffffff");
|
||||
})
|
||||
$(".coursesLineGrey").mouseout(function(){
|
||||
$(this).css("color","#808080");
|
||||
})
|
||||
$(".homepagePostSetting,.coursesLineGrey").mouseover(function(){
|
||||
$(this).prev().css("color","#ffffff");
|
||||
$(this).css("z-index", "9999");
|
||||
})
|
||||
$(".homepagePostSetting").mouseout(function(){
|
||||
$(this).prev().css("color","#808080");
|
||||
$(this).css("z-index", "1");
|
||||
})
|
||||
})
|
||||
</script>
|
||||
<style type="text/css">
|
||||
</style>
|
||||
<% contest_activities.includes(:contest_act).each do |activity| if contest_activities %>
|
||||
<script>
|
||||
$(function () {
|
||||
sd_create_editor_from_data(<%= activity.id%>, null, "100%", "<%= activity.class.to_s %>");
|
||||
});
|
||||
</script>
|
||||
<% if activity && activity.contest_act %>
|
||||
<% act = activity.contest_act %>
|
||||
<% case activity.contest_act_type.to_s %>
|
||||
<% when 'Work' %>
|
||||
<%= render :partial => 'users/contest_work', :locals => {:activity => act, :user_activity_id => activity.id, :hw_status => 2} %>
|
||||
<% when 'News' %>
|
||||
<%#= render :partial => 'users/contest_news', :locals => {:activity => act, :user_activity_id => activity.id, :is_course => 1} %>
|
||||
<% when 'Message' %>
|
||||
<%#= render :partial => 'users/contest_message', :locals => {:activity => act, :user_activity_id => activity.id,:is_course=>1,:is_board=>0} %>
|
||||
<% when 'Poll' %>
|
||||
<%#= render :partial => 'users/contest_poll', :locals => {:activity => act, :user_activity_id => activity.id, :is_course => 1} %>
|
||||
<% when 'JournalsForMessage' %>
|
||||
<%#= render :partial => 'users/contest_journalsformessage', :locals => {:activity => act, :user_activity_id => activity.id, :is_course => 1} %>
|
||||
<% when 'Attachment' %>
|
||||
<%#= render :partial => 'users/contest_attachment', :locals => {:activity => act, :user_activity_id => activity.id} %>
|
||||
<% when 'Contest' %>
|
||||
<%= render :partial => 'users/contest_create', :locals => {:activity => act, :user_activity_id => activity.id, :is_course => 1} %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
<% if contest_activities.count + page * 10 < @contest_activities_count %>
|
||||
<!--<div id="show_more_course_activities" class="loadMore mt10 f_grey">点击展开更多<%#= link_to "", course_activity_path(@course.id, :type => type, :page => page), :id => "more_course_activities_link", :remote => "true", :class => "none" %></div>-->
|
||||
<%= link_to "点击展开更多",contest_activities_contest_path(@contest.id, :type => type, :page => page),:id => "show_more_course_activities",:remote => "true",:class => "loadMore mt10 f_grey"%>
|
||||
<% end %>
|
|
@ -7,7 +7,7 @@
|
|||
<ul class="pro_newsetting_con mb15">
|
||||
<li class="mb10">
|
||||
<label class="label"><span class="c_red f12">*</span> 竞赛名称 : </label>
|
||||
<input type="text" name="contest[name]" id="contest_name" class="w623" onkeyup="regex_contest_name();" value="<%= @contest.name %>">
|
||||
<input type="text" name="contest[name]" id="contest_name" class="w621" onkeyup="regex_contest_name();" value="<%= @contest.name %>">
|
||||
<span class="c_red ml5 w690" id="contest_name_notice" style="padding-left:100px;display: none;">竞赛名称不能为空!</span>
|
||||
</li>
|
||||
<li class="clear mb10">
|
||||
|
@ -23,6 +23,12 @@
|
|||
:class => 'courses_text fl',
|
||||
:maxlength => 5000 }
|
||||
%>
|
||||
<div class="cl"></div>
|
||||
<div class="mt5 ml100">
|
||||
<div class="fl" id="syllabus_attachments">
|
||||
<%= render :partial => 'attachments/form_course', :locals => {:container => @contest, :isReply => false} %>
|
||||
</div>
|
||||
</div>
|
||||
<!--<textarea class=" fl ml5 w625" style="height:192px; padding-top:5px; background:#fff;" placeholder="参赛要求,参与方法,赛事日程(最多6000个字符)" ></textarea>-->
|
||||
</li>
|
||||
<li class="clear">
|
||||
|
@ -34,6 +40,7 @@
|
|||
<!--<a href="javascript:void(0);" class="sy_btn_grey mr5 fl ml40 "> 删除</a>-->
|
||||
<!--<p class="fl c_grey">(友情提示:删除该竞赛后如果您想恢复,请联系系统管理员!)</p>-->
|
||||
<a href="javascript:void(0);" class="sy_btn_blue mr15 fr" onclick="submit_edit_contest(<%= @contest.id %>);"> 保存</a>
|
||||
<a href="<%=contest_path(@contest) %>" class="sy_btn_grey mr15 fr" onclick="submit_edit_contest(<%= @contest.id %>);"> 取消</a>
|
||||
</li>
|
||||
</ul>
|
||||
<% end %>
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<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>
|
||||
<li><%= link_to "配置", {:controller => 'contests', :action => 'settings', :id => @contest}, :class => "sy_class_option" %></li>
|
||||
<li><a href="javascript:void(0);" class="postOptionLink">删除</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
<div class="homepageRight mt0 ml10">
|
||||
<div class="homepageRightBanner">
|
||||
<div class="NewsBannerName">
|
||||
<%= get_acts_list_type @type %></div>
|
||||
<ul class="resourcesSelect">
|
||||
<li class="resourcesSelected"><a href="javascript:void(0);" class="resourcesIcon"></a>
|
||||
<ul class="homepagePostType" style="width:90px; left:-80px;">
|
||||
<li>
|
||||
<ul class="homepagePostTypeHomework fl">
|
||||
<li><%= link_to "全部动态", contest_activities_contest_path(@contest), :class =>"homepagePostTypeAll postTypeGrey"%></li>
|
||||
<li><%= link_to "作品动态", contest_activities_contest_path(@contest, :type => 'work'), :class => "homepagePostTypeAssignment postTypeGrey"%></li>
|
||||
<!--<li><%#= link_to "通知动态", {:controller => "courses", :action => "show", :type => "news"}, :class => "homepagePostTypeNotice postTypeGrey"%></li>-->
|
||||
<!--<li><%#= link_to "资源库动态", {:controller => "courses", :action => "show", :type => "attachment"}, :class => "homepagePostTypeResource resourcesGrey"%></li>-->
|
||||
<!--<li><%#= link_to "论坛动态", {:controller => "courses", :action => "show", :type => "message"}, :class => "homepagePostTypeForum postTypeGrey"%></li>-->
|
||||
<!--<li><%#= link_to "留言动态", {:controller => "courses", :action => "show", :type => "journalsForMessage"}, :class => "homepagePostTypeMessage postTypeGrey"%></li>-->
|
||||
<!--<li><%#= link_to "问卷动态", {:controller => "courses", :action => "show", :type => "poll"}, :class => "homepagePostTypeQuiz postTypeGrey"%></li>-->
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<%= render :partial => 'contests/contest_activity', :locals => {:contest_activities => @contest_activities,:page => 0,:type => @type} %>
|
||||
</div>
|
|
@ -0,0 +1 @@
|
|||
$("#show_more_course_activities").replaceWith("<%= escape_javascript( render :partial => 'contests/contest_activity',:locals => {:contest_activities => @contest_activities, :page => @page,:type => @type} )%>");
|
|
@ -43,22 +43,22 @@
|
|||
g('game-setting-tab-nav-'+n).className='game-setting-nav-hover';
|
||||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
// Store variables
|
||||
var accordion_head = $('.accordion > li > a'),
|
||||
accordion_body = $('.accordion li > .sub-menu');
|
||||
|
||||
// Click function
|
||||
accordion_head.on('click', function(event) {
|
||||
// Disable header links
|
||||
event.preventDefault();
|
||||
// Show and hide the tabs on click
|
||||
if ($(this).attr('class') != 'active'){
|
||||
accordion_body.slideUp('normal');
|
||||
$(this).next().stop(true,true).slideToggle('normal');
|
||||
accordion_head.removeClass('active');
|
||||
$(this).addClass('active');
|
||||
}
|
||||
});
|
||||
});
|
||||
// $(document).ready(function() {
|
||||
// // Store variables
|
||||
// var accordion_head = $('.accordion > li > a'),
|
||||
// accordion_body = $('.accordion li > .sub-menu');
|
||||
//
|
||||
// // Click function
|
||||
// accordion_head.on('click', function(event) {
|
||||
// // Disable header links
|
||||
// event.preventDefault();
|
||||
// // Show and hide the tabs on click
|
||||
// if ($(this).attr('class') != 'active'){
|
||||
// accordion_body.slideUp('normal');
|
||||
// $(this).next().stop(true,true).slideToggle('normal');
|
||||
// accordion_head.removeClass('active');
|
||||
// $(this).addClass('active');
|
||||
// }
|
||||
// });
|
||||
// });
|
||||
</script>
|
|
@ -0,0 +1,30 @@
|
|||
<div class="homepageRight mt0 ml10" onmouseover="$('#edit_link').show(); " onmouseout="$('#edit_link').hide();" style="background-color: #fff;">
|
||||
<div class="contestRightBanner border-bottom">
|
||||
<div class="NewsBannerName">
|
||||
竞赛介绍
|
||||
</div>
|
||||
<% if User.current.admin_of_contest?(@contest) %>
|
||||
<%= link_to "编辑", {:controller => 'contests', :action => 'settings', :id => @contest}, :class => "link-blue fr mt5 none", :id => "edit_link" %>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
|
||||
<div>
|
||||
<% if @contest.description.nil? && User.current.admin_of_contest?(@contest) %>
|
||||
<div class="icons_tishi"><img src="../images/sy/icons_tan.png" width="110" height="110" alt="" ></div>
|
||||
<p class="sy_tab_con_p">请尽快补充竞赛说明,赢得更多参赛</p>
|
||||
<% elsif @contest.description.nil? %>
|
||||
<div class="icons_tishi"><img src="../images/sy/icons_tan.png" width="110" height="110" alt="" ></div>
|
||||
<p class="sy_tab_con_p">尚未发布竞赛说明,敬请期待~</p>
|
||||
<% else %>
|
||||
<div class="description_div">
|
||||
<div class="syllabuscon upload_img ke-block" id="syllabus_description_<%= @contest.id %>">
|
||||
<%= @contest.description.html_safe %>
|
||||
</div>
|
||||
<div class="mt10" style="font-weight:normal; font-size: 12px;">
|
||||
<%= render :partial=>"attachments/activity_attach", :locals=>{:activity => @contest} %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
|
@ -1,3 +1,5 @@
|
|||
<% work_num = visable_contest_work @contest %>
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
|
@ -25,10 +27,11 @@
|
|||
<div class="sy_contanier">
|
||||
<div class="sy_class_infobox">
|
||||
<p class="sy_cgrey mb10">
|
||||
<%= link_to @contest.user.try(:show_name), user_path(@contest.user), :class => "sy_cgrey" %> >
|
||||
<%= link_to @contest.user.try(:show_name), user_path(@contest.user), :class => "sy_cgrey" %>
|
||||
<span class="sy_cgrey"> > </span>
|
||||
<%= link_to @contest.name, contest_path(@contest), :class => "sy_cgrey" %>
|
||||
</p>
|
||||
<% if is_contest_manager?(User.current.id, @contest.id) %>
|
||||
<% if User.current.admin_of_contest?(@contest) %>
|
||||
<%= render :partial => "contests/mamager_setting" %>
|
||||
<% end %>
|
||||
|
||||
|
@ -43,7 +46,7 @@
|
|||
<div class="cl"></div>
|
||||
</div>
|
||||
<p class="sy_cgrey ">
|
||||
<span class=" mr15"> 管理员:<a class="sy_cblue"><%= contest_managers(@contest).count %></a></span>
|
||||
<span class=" mr15">管理员:<a class="sy_cblue"><%= contest_managers(@contest).count %></a></span>
|
||||
<span class=" mr15">评委:<a class="sy_cblue"><%= contest_judges(@contest).count %></a></span>
|
||||
<span class=" mr15">参赛者:<a class="sy_cblue"><%= contest_contestants(@contest).count %></a></span>
|
||||
</p>
|
||||
|
@ -56,18 +59,28 @@
|
|||
<div class="sy_class_l fl">
|
||||
<div class="sy_class_leftnav mb12" >
|
||||
<ul class="accordion">
|
||||
<li id="sy_01" class="sy_icons_game"> <a href="#sy_01" >竞赛首页</a></li>
|
||||
<li id="sy_01" class="sy_icons_index"> <a href="#sy_01" >动态<span>1</span></a></li>
|
||||
<li id="sy_02" class="sy_icons_boards"> <a href="#sy_02">讨论区<span>26</span></a> <a href="javascript:void(0);" class="sy_class_add"></a></li>
|
||||
<li id="sy_03" class="sy_icons_hwork"> <a href="#sy_03">作品<span>26</span></a> <a href="javascript:void(0);" class="sy_class_add"></a></li>
|
||||
<li id="sy_04" class="sy_icons_news"> <a href="#sy_04">通知<span>26</span></a><a href="javascript:void(0);" class="sy_class_add"></a></li>
|
||||
<li id="sy_06" class="sy_icons_feedback"> <a href="#sy_06">留言<span>26</span></a> <a href="javascript:void(0);" class="sy_class_add"></a></li>
|
||||
<li id="sy_01" class="sy_icons_game">
|
||||
<%= link_to '竞赛首页', contest_path(@contest) %>
|
||||
</li>
|
||||
<li id="sy_02" class="sy_icons_index">
|
||||
<%= link_to '动态', contest_activities_contest_path(@contest) %>
|
||||
</li>
|
||||
<!--<li id="sy_03" class="sy_icons_boards"> <a href="">讨论区<span>26</span></a> <a href="javascript:void(0);" class="sy_class_add"></a></li>-->
|
||||
<li id="sy_03" class="sy_icons_hwork">
|
||||
<a href="<%= works_path(:contest => @contest) %>">作品<span><%= work_num%></span></a>
|
||||
<a href="<%= works_path(:contest => @contest.id,:is_new => 1) %>" class="sy_class_add"></a>
|
||||
</li>
|
||||
<!--<li id="sy_05" class="sy_icons_news"> <a href="">通知<span>26</span></a><a href="javascript:void(0);" class="sy_class_add"></a></li>-->
|
||||
<!--<li id="sy_06" class="sy_icons_feedback"> <a href="">留言<span>26</span></a> <a href="javascript:void(0);" class="sy_class_add"></a></li>-->
|
||||
</ul>
|
||||
</div><!--sy_class_leftnav end-->
|
||||
</div><!--sy_class_l end-->
|
||||
|
||||
<%= render_flash_messages %>
|
||||
<%= yield %>
|
||||
<div class="fl">
|
||||
<%= yield %>
|
||||
</div><!--sy_class_r end-->
|
||||
<div class="cl"></div>
|
||||
<%= call_hook :view_layouts_base_content %>
|
||||
<div style="clear:both;"></div>
|
||||
<div class="cl"></div>
|
||||
|
@ -101,5 +114,22 @@
|
|||
});
|
||||
</script>
|
||||
<%= javascript_include_tag 'cookie','project',"avatars", 'header','prettify','select_list_move','attachments' %>
|
||||
<script>
|
||||
var blog_artile_list_html = '';
|
||||
$(function(){
|
||||
if($("#sy_0<%=@left_nav_type %>").length > 0){
|
||||
$("#sy_0<%=@left_nav_type %> a").addClass('active');
|
||||
} else {
|
||||
$("#expand_tools_expand a").addClass('active');
|
||||
$("#navContentCourse").toggle();
|
||||
}
|
||||
<% unless @board.nil? %>
|
||||
if($("#board_children_<%=@board.id %>").length > 0){
|
||||
$("#board_children_<%=@board.id %> a").addClass('active');
|
||||
$(".accordion>li>a").removeClass('active');
|
||||
}
|
||||
<% end %>
|
||||
});
|
||||
</script>
|
||||
</html>
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<% is_teacher = User.current.admin_of_contest?(:as_teacher,activity.course) %>
|
||||
<% is_teacher = User.current.admin_of_contest?(activity.contest) %>
|
||||
<div class="resources mt10" id="user_activity_<%= user_activity_id%>">
|
||||
<div class="homepagePostBrief">
|
||||
<div class="homepagePostPortrait">
|
||||
|
@ -10,20 +10,20 @@
|
|||
<%= link_to activity.user.show_name, user_path(activity.user,:host=>Setting.host_user), :class => "newsBlue mr15" %>
|
||||
TO
|
||||
<% if hw_status == 3 || hw_status == 2 %>
|
||||
<%= link_to "竞赛作品", works_index_path(:contest => activity.contest.id), :class => "newsBlue ml15"%>
|
||||
<%= link_to "作品", works_path(:contest => activity.contest.id), :class => "newsBlue ml15"%>
|
||||
<% else %>
|
||||
<%= link_to activity.contest.name.to_s+" | 竞赛作品", works_index_path(:contest => activity.contest.id), :class => "newsBlue ml15"%>
|
||||
<%= link_to activity.contest.name.to_s+" | 竞赛作品", works_path(:contest => activity.contest.id), :class => "newsBlue ml15"%>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="homepagePostTitle hidden fl m_w505"> <!--+"(作业名称)"-->
|
||||
<% if hw_status == 3 || hw_status == 5 %>
|
||||
<% index = get_work_index(activity, is_teacher) %>
|
||||
<%= link_to "<span class='fontBlue2'>作品#{index+1}:</span>".html_safe+activity.name,contestant_work_index_path(:work => activity.id),:class => "postGrey"%>
|
||||
<%= link_to "<span class='fontBlue2'>作品#{index+1}:</span>".html_safe+activity.name,contestant_works_path(:work => activity.id),:class => "postGrey"%>
|
||||
<% else %>
|
||||
<%= link_to activity.name.to_s, contestant_work_index_path(:work => activity.id), :class => "postGrey"%>
|
||||
<%= link_to activity.name.to_s, contestant_works_path(:work => activity.id), :class => "postGrey"%>
|
||||
<% end %>
|
||||
</div>
|
||||
<%#=get_hw_status(activity).html_safe %>
|
||||
<%=get_cw_status(activity).html_safe %>
|
||||
|
||||
<div class="cl"></div>
|
||||
<% if activity.work_type == 3 && activity.work_detail_group.base_on_project %>
|
||||
|
@ -36,7 +36,7 @@
|
|||
<% if !activity.end_time.nil? %>
|
||||
<div class="homepagePostDeadline">提交截止时间:<%= activity.end_time.to_s %> 23:59</div>
|
||||
<% end %>
|
||||
<% if activity.homework_detail_manual.comment_status == 0 && !activity.publish_time.nil? %>
|
||||
<% if activity.work_status == 0 && !activity.publish_time.nil? %>
|
||||
<div class="homepagePostDeadline ml15">
|
||||
<%= l(:label_publish_time)%>:<%= activity.publish_time%> 00:00
|
||||
</div>
|
||||
|
@ -57,5 +57,5 @@
|
|||
<div class="cl"></div>
|
||||
</div>
|
||||
|
||||
<%= render :partial => 'users/homework_post_reply', :locals => {:activity => activity, :user_activity_id => user_activity_id, :is_teacher => is_teacher} %>
|
||||
<%= render :partial => 'users/contest_work_post_reply', :locals => {:activity => activity, :user_activity_id => user_activity_id, :is_teacher => is_teacher} %>
|
||||
</div>
|
||||
|
|
|
@ -46,10 +46,10 @@
|
|||
<li class="homepagePostSettingIcon">
|
||||
<ul class="whomepagePostSettiongText">
|
||||
<li>
|
||||
<%= link_to l(:button_edit),edit_work_path(activity, :hw_status => hw_status), :class => "wpostOptionLink"%>
|
||||
<%= link_to "编 辑",edit_work_path(activity, :hw_status => hw_status), :class => "wpostOptionLink"%>
|
||||
</li>
|
||||
<li>
|
||||
<%= link_to(l(:label_bid_respond_delete), works_path(activity, :hw_status => hw_status),:method => 'delete', :confirm => l(:text_are_you_sure), :class => "wpostOptionLink") %>
|
||||
<%= link_to "删 除",work_path(activity, :hw_status => hw_status),:method => 'delete', :confirm => l(:text_are_you_sure), :class => "wpostOptionLink" %>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
<% if count > 0 %>
|
||||
<div class="" id="reply_div_<%= user_activity_id %>">
|
||||
<%=render :partial => 'users/news_replies', :locals => {:comments => no_children_comments[:no_children_comments], :type => 'HomeworkCommon', :is_teacher => is_teacher, :user_activity_id => user_activity_id, :activity_id => activity.id} %>
|
||||
<%=render :partial => 'users/news_replies', :locals => {:comments => no_children_comments[:no_children_comments], :type => 'Work', :is_teacher => is_teacher, :user_activity_id => user_activity_id, :activity_id => activity.id} %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
|
|
|
@ -32,11 +32,11 @@
|
|||
<span class="reply_praise_count_<%= comment.id %>">
|
||||
<%= render :partial => "praise_tread/praise", :locals => {:activity => comment, :user_activity_id => comment.id, :type => "reply"} %>
|
||||
</span>
|
||||
<% if type == 'HomeworkCommon' %>
|
||||
<% if type == 'HomeworkCommon' || type == 'Work' %>
|
||||
<span style="position: relative" class="fr mr20">
|
||||
<%= link_to(
|
||||
l(:button_reply),
|
||||
{:controller => 'users' ,:action => 'reply_to', :reply_id => comment.id, :type => 'HomeworkCommon', :user_activity_id => user_activity_id},
|
||||
{:controller => 'users' ,:action => 'reply_to', :reply_id => comment.id, :type => type, :user_activity_id => user_activity_id},
|
||||
:remote => true,
|
||||
:method => 'get',
|
||||
:title => l(:button_reply)) %>
|
||||
|
|
|
@ -13,6 +13,16 @@
|
|||
<div class="cl"></div>
|
||||
<p nhname='contentmsg_<%= reply.id%>'></p>
|
||||
<% end%>
|
||||
<% elsif @type == 'Work' %>
|
||||
<%= form_for('new_form',:url => {:controller => 'words', :action => 'reply_to_contest_work', :id => reply.id},:method => "post", :remote => true) do |f| %>
|
||||
<input type="hidden" name="user_activity_id" value=<%=@user_activity_id %>>
|
||||
<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_message"></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%>
|
||||
<% elsif @type == 'JournalsForMessage' %>
|
||||
<%= form_for('new_form',:url => {:controller => 'words', :action => 'create_reply', :id => reply.id}, :method => "post", :remote => true) do |f|%>
|
||||
<%= hidden_field_tag 'reference_id', params[:reference_id], :value => reply.id %>
|
||||
|
|
|
@ -1,20 +1,20 @@
|
|||
<% work = cur_user_works_for_work activity %>
|
||||
<% if activity.work_type == 3 && !is_teacher && activity.work_detail_group.base_on_project && User.current.member_of_contest?(activity.contest)%>
|
||||
<% if activity.work_type == 3 && User.current.contestant_of_contest?(activity.contest) && activity.work_detail_group.base_on_project %>
|
||||
<% projects = cur_user_projects_for_work activity %>
|
||||
<% if work.nil? && projects.nil? %>
|
||||
<div class="homepagePostSubmit">
|
||||
<%=link_to "关联项目",new_student_work_project_contestant_works_index_path(:homework => activity.id,:hw_status=>hw_status,:user_activity_id=>user_activity_id),remote: true,:class=> 'c_blue', :title=> '请各组长关联作业项目' %>
|
||||
<%=link_to "关联项目",new_student_work_project_contestant_works_path(:work => activity.id,:hw_status=>hw_status,:user_activity_id=>user_activity_id),remote: true,:class=> 'c_blue', :title=> '请各组长关联作业项目' %>
|
||||
</div>
|
||||
<% elsif work.nil? %>
|
||||
<div class="homepagePostSubmit">
|
||||
<%=link_to "取消关联",cancel_relate_project_contestant_works_index_path(:homework => activity.id,:hw_status=>hw_status,:user_activity_id=>user_activity_id), :confirm => "您确定要取消关联吗?", remote: true,:class => "c_blue", :title=> '取消关联项目' %>
|
||||
<%=link_to "取消关联",cancel_relate_project_contestant_works_path(:work => activity.id,:hw_status=>hw_status,:user_activity_id=>user_activity_id), :confirm => "您确定要取消关联吗?", remote: true,:class => "c_blue", :title=> '取消关联项目' %>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<div class="homepagePostSubmit">
|
||||
<%= user_for_contest_work activity,is_teacher,work %>
|
||||
<%= user_for_contest_work activity,User.current.contestant_of_contest?(activity.contest),work %>
|
||||
</div>
|
||||
<% if !is_teacher && !work.nil? && work.user == User.current && activity.end_time < Date.today %>
|
||||
<% if User.current.contestant_of_contest?(activity.contest) && !work.nil? && work.user == User.current && activity.end_time < Date.today %>
|
||||
<div class="homepagePostSubmit">
|
||||
<%=link_to "追加附件", contestant_work_index_url_in_org(activity.id, 2, 1), :class => 'c_blue', :title => "可追加作品修订附件" %>
|
||||
</div>
|
||||
|
@ -29,12 +29,7 @@
|
|||
<!--</div>-->
|
||||
<%# end %>
|
||||
<%# end %>
|
||||
<% if activity.homework_type == 2%>
|
||||
<div class="homepagePostDeadline mr15">
|
||||
语言:
|
||||
<%= activity.language_name%>
|
||||
</div>
|
||||
<% elsif activity.work_type == 3 && activity.work_detail_group%>
|
||||
<% if activity.work_type == 3 && activity.work_detail_group%>
|
||||
<% if activity.work_detail_group.base_on_project %>
|
||||
<div class="homepagePostSubmit mr15">
|
||||
<%=link_to "项目(#{activity.contestant_work_projects.where(:is_leader => true).count})",contestant_work_index_url_in_org(activity.id, 3),:class => "c_blue" %>
|
||||
|
|
|
@ -11,9 +11,9 @@
|
|||
<li><%= link_to "全部动态", {:controller => "users", :action => "contest_community", :type => "all"}, :class => "homepagePostTypeAll postTypeGrey" %></li>
|
||||
<li><%= link_to @user == User.current ? "我的动态" : "他的动态", {:controller => "users", :action => "contest_community", :type => "current_user"}, :class => "homepagePostTypeMine postTypeGrey" %></li>
|
||||
<li><%= link_to "作品动态", {:controller => "users", :action => "contest_community", :type => "contest_work"}, :class => "homepagePostTypeAssignment postTypeGrey" %></li>
|
||||
<li><%= link_to "通知动态", {:controller => "users", :action => "contest_community", :type => "contest_news"}, :class => "homepagePostTypeNotice postTypeGrey" %></li>
|
||||
<li><%= link_to "论坛动态", {:controller => "users", :action => "contest_community", :type => "contest_message"}, :class => "homepagePostTypeForum postTypeGrey" %></li>
|
||||
<li><%= link_to "竞赛留言", {:controller => "users", :action => "contest_community", :type => "contest_journals"}, :class => "homepagePostTypeMessage postTypeGrey" %></li>
|
||||
<!--<li><%#= link_to "通知动态", {:controller => "users", :action => "contest_community", :type => "contest_news"}, :class => "homepagePostTypeNotice postTypeGrey" %></li>-->
|
||||
<!--<li><%#= link_to "论坛动态", {:controller => "users", :action => "contest_community", :type => "contest_message"}, :class => "homepagePostTypeForum postTypeGrey" %></li>-->
|
||||
<!--<li><%#= link_to "竞赛留言", {:controller => "users", :action => "contest_community", :type => "contest_journals"}, :class => "homepagePostTypeMessage postTypeGrey" %></li>-->
|
||||
<% end %>
|
||||
</ul>
|
||||
</li>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
$("#homework_post_reply_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/homework_post_reply', :locals => {:activity => @homework_common, :user_activity_id => @user_activity_id, :is_teacher => @is_teacher}) %>");
|
||||
<% if @user_activity_id != @homework_common.id %>
|
||||
$("#homework_post_reply_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/contest_work_post_reply', :locals => {:activity => @contestwork, :user_activity_id => @user_activity_id, :is_teacher => @is_teacher}) %>");
|
||||
<% if @user_activity_id != @contestwork.id %>
|
||||
sd_create_editor_from_data(<%= @user_activity_id%>,"","100%", "UserActivity");
|
||||
<% else %>
|
||||
sd_create_editor_from_data(<%= @homework_common.id%>,"","100%", "<%=@homework_common.class.to_s%>");
|
||||
sd_create_editor_from_data(<%= @contestwork.id%>,"","100%", "<%=@contestwork.class.to_s%>");
|
||||
<% end %>
|
|
@ -1,6 +1,6 @@
|
|||
$("#homework_post_reply_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/homework_post_reply', :locals => {:activity => @homework_common, :user_activity_id => @user_activity_id, :is_teacher => @is_teacher}) %>");
|
||||
<% if @user_activity_id != @homework_common.id %>
|
||||
$("#homework_post_reply_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/contest_work_post_reply', :locals => {:activity => @contestwork, :user_activity_id => @user_activity_id, :is_teacher => @is_teacher}) %>");
|
||||
<% if @user_activity_id != @contestwork.id %>
|
||||
sd_create_editor_from_data(<%= @user_activity_id%>,"","100%", "UserActivity");
|
||||
<% else %>
|
||||
sd_create_editor_from_data(<%= @homework_common.id%>,"","100%", "<%=@homework_common.class.to_s%>");
|
||||
sd_create_editor_from_data(<%= @contestwork.id%>,"","100%", "<%=@contestwork.class.to_s%>");
|
||||
<% end %>
|
|
@ -0,0 +1,261 @@
|
|||
<% not_allow_select = edit_mode && homework.contestant_works.count != 0 %>
|
||||
<% content_for :header_tags do %>
|
||||
<%= import_ke(enable_at: true, prettify: false, init_activity: false) %>
|
||||
|
||||
<%= javascript_include_tag 'homework','baiduTemplate' %>
|
||||
<script type="text/javascript">
|
||||
function homework_name_focus(){
|
||||
$('#homework_editor').show();
|
||||
var type = $("#homework_type_option").children('option:selected').val();
|
||||
if(type == "0"){
|
||||
$('#select_type_nitice').show();
|
||||
}
|
||||
}
|
||||
var first_click = true;
|
||||
$(function(){
|
||||
$("#homework_type_option").on("change",function(){
|
||||
//$('#homework_editor').show();
|
||||
var type = $(this).children('option:selected').val();
|
||||
if(type == "0"){
|
||||
$('#select_type_nitice').show();
|
||||
}else{
|
||||
$('#select_type_nitice').hide();
|
||||
if(type == "1"){
|
||||
$("#homeworkSetting").addClass("undis");
|
||||
$("#homeworkSetting").html("");
|
||||
}else if(type == "3"){
|
||||
$("#homeworkSetting").removeClass("undis");
|
||||
$("#homeworkSetting").html("<%=escape_javascript(render :partial => 'work_group_attr', :locals => {:edit_mode => edit_mode, :homework=>homework, :not_allow_select => not_allow_select}) %>");
|
||||
}
|
||||
}
|
||||
});
|
||||
<% if edit_mode && homework.work_type == 3 %>
|
||||
$("#homeworkSetting").removeClass("undis");
|
||||
$("#homeworkSetting").html("<%=escape_javascript(render :partial => 'work_group_attr', :locals => {:edit_mode => edit_mode, :homework=>homework, :not_allow_select => not_allow_select}) %>");
|
||||
<% end %>
|
||||
<% if edit_mode && homework.is_group_work? %>
|
||||
$("#GroupPopupBox a.group_save_btn").click();
|
||||
<% end %>
|
||||
});
|
||||
|
||||
function nh_reset_homework_form(params){
|
||||
if(params.textarea.html() != "") {
|
||||
cancel_edit();
|
||||
} else {
|
||||
params.form[0].reset();
|
||||
params.textarea.empty();
|
||||
if(params.editor != undefined){
|
||||
params.editor.html(params.textarea.html());
|
||||
}
|
||||
}
|
||||
}
|
||||
function init_homework_form(params){
|
||||
params.form.submit(function(){
|
||||
var flag = false;
|
||||
if(params.form.attr('data-remote') != undefined ){
|
||||
flag = true
|
||||
}
|
||||
var is_checked = false;
|
||||
if($("#homework_type_option").children('option:selected').val() == '0'){
|
||||
$("#select_type_nitice").show();
|
||||
}
|
||||
else if(!regex_homework_name()){
|
||||
$("#homework_name").focus();
|
||||
}
|
||||
else if(!regex_homework_end_time()){
|
||||
$("#homework_end_time").focus();
|
||||
}
|
||||
else if(!regex_homework_end_publish_time()){
|
||||
$("#homework_end_time").focus();
|
||||
}
|
||||
else if(!regex_course_id()){
|
||||
$("#course_id").focus();
|
||||
}
|
||||
else if($("#homework_type_option").val() == 3 && !regex_group_attr()) {
|
||||
}
|
||||
else{
|
||||
params.textarea.html(params.editor.html());
|
||||
params.editor.sync();
|
||||
is_checked = true;
|
||||
}
|
||||
/*var is_checked = nh_check_field({
|
||||
issubmit:true,
|
||||
content:params.editor,
|
||||
contentmsg:params.contentmsg,
|
||||
textarea:params.textarea
|
||||
});*/
|
||||
if(first_click && is_checked){
|
||||
if(flag){
|
||||
first_click = false;
|
||||
return true;
|
||||
}else{
|
||||
first_click = false;
|
||||
$(this)[0].submit();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
});
|
||||
}
|
||||
function init_homework_editor(params){
|
||||
params.textarea.removeAttr('placeholder');
|
||||
var editor = params.kindutil.create(params.textarea, {
|
||||
resizeType : 1,minWidth:"1px",width:"100%",minHeight:"30px",height:"30px",
|
||||
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;
|
||||
//paramsHeight = params.kindutil.removeUnit(this.height);
|
||||
edit.iframe.height(150);
|
||||
this.resize(null, Math.max((params.kindutil.IE ? body.scrollHeight : body.offsetHeight) + 33, 150));
|
||||
},
|
||||
afterCreate:function(){
|
||||
//init
|
||||
var edit = this.edit;
|
||||
var body = edit.doc.body;
|
||||
edit.iframe[0].scroll = 'no';
|
||||
body.style.overflowY = 'hidden';
|
||||
//reset height
|
||||
var edit = this.edit;
|
||||
var body = edit.doc.body;
|
||||
edit.html(params.textarea.innerHTML);
|
||||
//paramsHeight = params.kindutil.removeUnit(this.height);
|
||||
edit.iframe.height(150);
|
||||
this.resize(null, Math.max((params.kindutil.IE ? body.scrollHeight : body.offsetHeight) , 150));
|
||||
elocalStorage(work_description_editor,'homework_<%=User.current.id %>');
|
||||
}
|
||||
}).loadPlugin('paste');
|
||||
return editor;
|
||||
}
|
||||
KindEditor.ready(function(K){
|
||||
$("div[nhname='homework_common_form']").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='homework_textarea']",params.div_form);
|
||||
params.cancel_btn = $("#new_message_cancel_btn");
|
||||
params.submit_btn = $("#new_message_submit_btn");
|
||||
if(params.textarea.data('init') == undefined) {
|
||||
params.editor = init_homework_editor(params);
|
||||
work_description_editor = params.editor;
|
||||
init_homework_form(params);
|
||||
params.submit_btn.click(function () {
|
||||
params.form.submit();
|
||||
});
|
||||
params.cancel_btn.click(function () {
|
||||
reset_homework();
|
||||
nh_reset_homework_form(params);
|
||||
});
|
||||
params.textarea.data('init', 1);
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<% end %>
|
||||
|
||||
<div class="HomeWorkCon">
|
||||
<a id="submit_homework"></a>
|
||||
<div>
|
||||
<%= hidden_field_tag :contest, params[:contest], :value =>@contest.id %>
|
||||
|
||||
<% group_pro = homework.work_type == 3 && homework.contestant_work_projects.count != 0 %>
|
||||
<select class="homework-type-option fl mr10" name="homework_type" <%=(not_allow_select || group_pro) ? 'disabled' : '' %> id="homework_type_option">
|
||||
<%= options_for_select(work_type_option,edit_mode ? homework.work_type : 0) %>
|
||||
</select>
|
||||
<% if not_allow_select || group_pro %>
|
||||
<input type="text" style="display: none" name="homework_type" value="<%=homework.work_type %>"/>
|
||||
<% end %>
|
||||
<span class="c_red fl ml10 mt5 none" id="select_type_nitice">发布题目,请先选择竞赛类型</span>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<div class="mt10">
|
||||
<input type="text" name="homework_common[name]" id="homework_name" class="InputBox w701" maxlength="255" onfocus="homework_name_focus();" onkeyup="regex_homework_name();" placeholder="发布题目,请先输入标题" value="<%= homework.name%>" >
|
||||
<div class="cl"></div>
|
||||
<p id="homework_name_span" class="c_red mt5"></p>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
|
||||
<div id="homework_editor" style="display: <%= edit_mode ? 'block':'none'%>">
|
||||
<div class="mt10">
|
||||
<label class="fl c_grey f14 mt5">截止日期:</label>
|
||||
<div class="calendar_div fl mr70">
|
||||
<input type="text" name="homework_common[end_time]" id="homework_end_time" class="InputBox fl W120 calendar_input" readonly="readonly" value="<%= homework.end_time%>" >
|
||||
<%= calendar_for('homework_end_time')%>
|
||||
</div>
|
||||
<label class="fl c_grey f14 mt5" style="margin-top: 4px;">发布日期(可选):</label>
|
||||
<div class="calendar_div fl">
|
||||
<% allow_edit = homework.contestant_works.count == 0 && homework.contestant_work_projects.count ==0 %>
|
||||
<input title="<%=allow_edit ? '' : '已有参赛者提交作品或关联项目,发布日期不可再编辑' %>" type="text" name="homework_common[publish_time]" id="homework_publish_time" class="InputBox fl W120 calendar_input" readonly="readonly" value="<%= homework.publish_time%>" >
|
||||
<% if allow_edit %>
|
||||
<%= calendar_for('homework_publish_time')%>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<p id="homework_end_time_span" class="c_red mt5"></p>
|
||||
<div class="cl"></div>
|
||||
<div class="mt10">
|
||||
<% if edit_mode %>
|
||||
<textarea placeholder="有问题或有建议,请直接给我留言吧!" style="display: none" nhname='homework_textarea' name="homework_common[description]"><%=homework.description %></textarea>
|
||||
<%#= f.kindeditor :description, :editor_id => 'work_description_editor', :height => "150px", :owner_id => homework.id, :owner_type => OwnerTypeHelper::HOMEWORKCOMMON, at_id: homework.id, at_type: homework.class.to_s %>
|
||||
<% else %>
|
||||
<%= hidden_field_tag :asset_id, params[:asset_id], :required => false, :style => 'display:none' %>
|
||||
<textarea placeholder="有问题或有建议,请直接给我留言吧!" style="display: none" nhname='homework_textarea' name="homework_common[description]"></textarea>
|
||||
<%#= f.kindeditor :description, :editor_id => 'work_description_editor', :height => "150px",at_id: homework.id, at_type: homework.class.to_s %>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
|
||||
<p id="e_tip" class="c_grey"></p>
|
||||
<p id="e_tips" class="c_grey"></p>
|
||||
<div class="cl"></div>
|
||||
|
||||
<div class="mt10 b_grey undis" style="padding:10px;" id="homeworkSetting">
|
||||
|
||||
</div>
|
||||
|
||||
<div id="homework_attachments">
|
||||
<%= render :partial => 'attachments/form_course', :locals => {:container => homework, :isReply => false} %>
|
||||
</div>
|
||||
|
||||
<div class="mt5">
|
||||
<% if edit_mode %>
|
||||
<a href="javascript:void(0);" id="new_message_submit_btn" class="BlueCirBtnMini fr">确定</a>
|
||||
<span class="fr mr10 mt3">或</span>
|
||||
<%#= link_to "取消",user_homeworks_user_path(User.current.id),:class => "fr mr10 mt3"%>
|
||||
<a href="javascript:void(0);" id="new_message_cancel_btn" class="fr mr10 mt3">取消</a>
|
||||
<% else %>
|
||||
<a href="javascript:void(0);" id="new_message_submit_btn" class="BlueCirBtnMini fr">发送</a>
|
||||
<span class="fr mr10 mt3">或</span>
|
||||
<a href="javascript:void(0);" id="new_message_cancel_btn" class="fr mr10 mt3">取消</a>
|
||||
<% end %>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
|
||||
<!--<script id="t:test-answer-list" type="text/html">-->
|
||||
<!--<div class="mt10" style="margin-left:63px;">-->
|
||||
<!--<label class="fl fontGrey2 mr10 mt5" name="inputs_label"> </label>-->
|
||||
<!--<textarea class="InputBox w265 fl mr10" placeholder="测试输入" name="program[input][]"></textarea>-->
|
||||
<!--<textarea class="InputBox w265 fl mr5" placeholder="测试输出" name="program[output][]"></textarea>-->
|
||||
<!--<a href="javascript:void(0);" class=" fl icon_add" title="增加测试组"></a>-->
|
||||
<!--<a href="javascript:void(0);" class=" fl icon_remove" title="删除测试组"></a>-->
|
||||
<!--<div class="cl"></div>-->
|
||||
<!--</div>-->
|
||||
<!--</script>-->
|
||||
|
||||
<% unless edit_mode %>
|
||||
<div class="BluePopupBox" style="display:none;" id="NoticePopupBox">
|
||||
<%= render :partial => 'users/homework_type_notice', :locals => {:edit_mode => edit_mode, :homework=>homework}%>
|
||||
</div>
|
||||
<% end %>
|
|
@ -0,0 +1,49 @@
|
|||
<div id="groupHomework">
|
||||
<div> <span class="f14 mt5 fl fontGrey3 mr10">分组设置:</span>
|
||||
<div class="mr50 fl"> <span class="f14 fontGrey3 mr5">每组最小人数:</span>
|
||||
<input id="min_num" type="text" name="min_num" class="markInput" value="<%=(edit_mode && homework.is_group_work?) ? homework.work_detail_group.min_num : 2 %>" <%=(not_allow_select && homework.is_group_work?) ? "onchange = regex_scope(#{homework.work_detail_group.min_num}, 1)" : '' %>/>人
|
||||
</div>
|
||||
<div class="fl"> <span class="f14 fontGrey3 mr5">每组最大人数:</span>
|
||||
<input id="max_num" type="text" name="max_num" class="markInput" value="<%=(edit_mode && homework.is_group_work?) ? homework.work_detail_group.max_num : 10 %>" <%=(not_allow_select && homework.is_group_work?) ? "onchange = regex_scope(#{homework.work_detail_group.max_num}, 2)" : '' %>/>人
|
||||
</div>
|
||||
<span class="c_red undis ml20 mt7 fl" id="min_max_num_notice"></span>
|
||||
<div class="cl"></div>
|
||||
<div class="ml80">
|
||||
<label>
|
||||
<input type="checkbox" class="mr5" name="base_on_project" value="<%=(edit_mode && homework.is_group_work?) ? (homework.work_detail_group.base_on_project ? 1 : 0) : 1 %>" id="base_on_project" <%=not_allow_select ? 'disabled' : '' %>/>
|
||||
<span class="f14 fontGrey3 mr10">基于项目实施</span>
|
||||
</label>
|
||||
<p class="c_red">提醒:勾选后各小组必须在Trustie平台创建项目,主办人和评委可随时观察平台对各小组最新进展的实时统计</p>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
|
||||
<script>
|
||||
$(function () {
|
||||
if($.trim($("#base_on_project").val()) == 1) {
|
||||
$("#base_on_project").attr('checked','checked');
|
||||
}
|
||||
<% if not_allow_select && homework.is_group_work? %>
|
||||
$("#min_num").on('change', function() {
|
||||
var min_num = <%=homework.work_detail_group.min_num %>;
|
||||
if(parseInt($(this).val()) > min_num) {
|
||||
$(this).val(min_num);
|
||||
$("#min_max_num_notice").html('分组范围不可缩小').show();
|
||||
} else {
|
||||
$("#min_max_num_notice").html('').hide();
|
||||
}
|
||||
});
|
||||
$("#max_num").on('change', function() {
|
||||
var max_num = <%=homework.work_detail_group.max_num %>;
|
||||
if(parseInt($(this).val()) < max_num) {
|
||||
$(this).val(max_num);
|
||||
$("#min_max_num_notice").html('分组范围不可缩小').show();
|
||||
} else {
|
||||
$("#min_max_num_notice").html('').hide();
|
||||
}
|
||||
});
|
||||
<% end %>
|
||||
});
|
||||
</script>
|
|
@ -0,0 +1,40 @@
|
|||
<%= content_for(:header_tags) do %>
|
||||
<%= import_ke(enable_at: true, prettify: false, init_activity: true) %>
|
||||
<% end %>
|
||||
|
||||
<div id="user_homework_list">
|
||||
<% homework_commons.each do |homework_common|%>
|
||||
<script type="text/javascript">
|
||||
$(function() {
|
||||
sd_create_editor_from_data(<%= homework_common.id%>, null, "100%", "<%=homework_common.class.to_s%>");
|
||||
});
|
||||
|
||||
function expand_reply(container,btnid){
|
||||
var target = $(container);
|
||||
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();
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<%= render :partial => 'users/contest_work', :locals => {:activity => homework_common, :user_activity_id =>homework_common.id, :hw_status => 3} %>
|
||||
<% end%>
|
||||
</div>
|
||||
|
||||
<div style="text-align:center;">
|
||||
<div class="pages" style="width:auto; display:inline-block;">
|
||||
<ul id="homework_pository_ref_pages">
|
||||
<%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true, :is_new => true%>
|
||||
</ul>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
</div>
|
|
@ -0,0 +1,6 @@
|
|||
<%= form_tag(works_path(:contest => contest.id),
|
||||
:remote=>true ,:method => 'get',:class=>'resourcesSearchloadBox',:id=>'resource_search_form') do %>
|
||||
<input type="text" name="search" placeholder="输入题目名称进行搜索" class="searchResource" />
|
||||
<%= submit_tag '',:class=>'homepageSearchIcon',:onfocus=>'this.blur();',:style=>'border-style:none' %>
|
||||
<!--<a href="javascript:void(0);" onclick='this.parent.submit();return false;' class="searchIcon"></a>-->
|
||||
<% end %>
|
|
@ -0,0 +1,50 @@
|
|||
<script type="text/javascript">
|
||||
function reset_homework(){
|
||||
$("#homework_name").val("");
|
||||
$("#homework_publish_time").val("");
|
||||
$("#homework_end_time").val("");
|
||||
$("#course_id").val($("#option_select").val());
|
||||
$("#homework_attachments").html("<%= escape_javascript(render :partial => 'attachments/form_course', :locals => {:container => @homework, :isReply => false})%>");
|
||||
//homework_description_editor.html("");
|
||||
$("#homework_name_span").text("");
|
||||
$("#homework_end_time_span").text("");
|
||||
$("#homework_end_time_span").text("");
|
||||
$("#homework_course_id_span").text("");
|
||||
$("#homework_editor").toggle();
|
||||
}
|
||||
function cancel_edit(){
|
||||
<% if @hw_status == 3 %>
|
||||
window.location.href='<%= works_path(:contest => @contest.id) %>';
|
||||
<% elsif @hw_status == 1 %>
|
||||
window.location.href='<%= user_contest_community_path(User.current.id) %>';
|
||||
<% elsif @hw_status == 2 %>
|
||||
window.location.href='<%= contest_path(@contest.id) %>';
|
||||
<% end %>
|
||||
}
|
||||
</script>
|
||||
<div class="homepageRightBanner mb10 <%= (@hw_status == 2 || @hw_status == 3 || @hw_status == 5) ? 'ml10' : '' %>">
|
||||
<div class="NewsBannerName">编辑题目</div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
|
||||
<!-- 老师身份才可以发布作业 -->
|
||||
<div class="HomeWork mb10 ml10" nhname='homework_common_form'>
|
||||
<% committed_work_count = @homework.contestant_works.count %>
|
||||
<% stu_pro_count = @homework.contestant_work_projects.count %>
|
||||
<% if committed_work_count != 0 %>
|
||||
<% if @homework.work_type == 1 %>
|
||||
<p class="c_red mb5">已有<%=committed_work_count %>个学生提交作品,不允许再修改作业类型。</p>
|
||||
<% elsif @homework.work_type == 3 %>
|
||||
<p class="c_red mb5">已有<%=committed_work_count %>个学生提交作品,不允许再修改作业类型和分组设置(可扩大分组范围)。</p>
|
||||
<% end %>
|
||||
<% elsif stu_pro_count != 0 && @homework.work_type == 3 %>
|
||||
<p class="c_red mb5">已有<%=stu_pro_count %>个学生关联项目,不允许再修改作业类型。</p>
|
||||
<% end %>
|
||||
|
||||
<%= form_for @homework do |f| %>
|
||||
<input type="text" name="hw_status" class="none" value="<%= @hw_status%>"/>
|
||||
<div id="HomeWorkCon">
|
||||
<%= render :partial => 'contest_work_form', :locals => { :homework => @homework,:f => f,:edit_mode => true } %>
|
||||
</div>
|
||||
<% end%>
|
||||
</div><!----HomeWork end-->
|
|
@ -0,0 +1,84 @@
|
|||
<script type="text/javascript">
|
||||
function reset_homework(){
|
||||
$("#homework_name").val("");
|
||||
$("#homework_publish_time").val("");
|
||||
$("#homework_end_time").val("");
|
||||
$("#course_id").val($("#option_select").val());
|
||||
$("#homeworkSetting").addClass("undis");
|
||||
$("#homeworkSetting").html("");
|
||||
$("#homework_attachments").html("<%= escape_javascript(render :partial => 'attachments/form_course', :locals => {:container => @new_homework, :isReply => false})%>");
|
||||
//work_description_editor.html("");
|
||||
$("#homework_name_span").text("");
|
||||
$("#homework_end_time_span").text("");
|
||||
$("#homework_course_id_span").text("");
|
||||
$("#homework_editor").toggle();
|
||||
//$("#select_type_nitice").show();
|
||||
document.getElementById("homework_type_option").options[0].selected = true;
|
||||
}
|
||||
|
||||
$(function(){
|
||||
$("#RSide").removeAttr("id");
|
||||
$("#Container").css("width","1000px");
|
||||
});
|
||||
|
||||
<% if @is_new%>
|
||||
$(function(){
|
||||
$("#homework_name").focus();
|
||||
});
|
||||
<%end%>
|
||||
</script>
|
||||
<style>
|
||||
/*日历选择图*/
|
||||
img.ui-datepicker-trigger {display:block;background:url(../images/public_icon.png) -31px 0 no-repeat;cursor: pointer;vertical-align: middle;width:16px;height:15px;float:left;margin: 7px;}
|
||||
.description{display: none !important;}
|
||||
.ispublic-label{display: none !important;}
|
||||
.is_public_checkbox{display: none !important;}
|
||||
.is_public{display: none !important;}
|
||||
.link_file{ background:url(../images/pic_file.png) 0 5px no-repeat !important;}
|
||||
#attachments_fields input.filename{ background:url(../images/pic_file.png) 0 5px no-repeat !important;padding-left:20px !important; color:#64bdd9 !important;}
|
||||
.link_file_a{background:url(../images/pic_file.png) 0 5px no-repeat !important;padding-left:20px !important; color:#64bdd9 !important;}
|
||||
</style>
|
||||
|
||||
<div class="homepageRight mt0 ml10">
|
||||
<div class="homepageRightBanner">
|
||||
<div id="menu_r" class="NewsBannerName" style="margin-bottom: -10px;">
|
||||
<ul class="menu_r b_w" style="padding-left: 0px; margin-top: -5px;">
|
||||
<li>
|
||||
<a href="javascript:void(0);" class="menu_arrow" style="font-size:16px; color:#4b4b4b; font-weight: normal; padding-left: 0px;">题目</a>
|
||||
<ul style="max-height:240px; overflow-y:auto; overflow-x:hidden;">
|
||||
<% if @homework_commons.empty? %>
|
||||
<li class="pr10" style="font-weight: normal; color: #888888; width: 120px; padding-left: 15px; padding-bottom: 5px;">目前尚未发布题目</li>
|
||||
<% else %>
|
||||
<% @homework_commons.each_with_index do |homework_common,index|%>
|
||||
<li class="pr10">
|
||||
<%= link_to "题目#{@homework_commons.count - index}:#{homework_common.name}",contestant_works_path(:work => homework_common.id),:target=>"_blank"%>
|
||||
</li>
|
||||
<% end%>
|
||||
<% end %>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div id="search_div" class="fr mr10">
|
||||
<%= render :partial => 'work_search_form',:locals => {:contest=>@contest} %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
|
||||
<% if @is_teacher%>
|
||||
<!-- 老师身份才可以发布作业 -->
|
||||
<div class="HomeWork mt10" nhname='homework_common_form'>
|
||||
<%= labelled_form_for @new_homework,:method => "post" do |f| %>
|
||||
<div id="HomeWorkCon">
|
||||
<%= render :partial => 'contest_work_form', :locals => { :homework => @new_homework,:f => f,:edit_mode => false,:select_course => false } %>
|
||||
<input type="hidden" name="is_in_course" value="1"/>
|
||||
</div>
|
||||
<% end%>
|
||||
</div><!----HomeWork end-->
|
||||
<% end%>
|
||||
<div id="homework_index_list">
|
||||
<%= render :partial => 'work_index_list', :locals => {:homework_commons => @homeworks,:contest_id => @contest.id} %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
|
|
@ -0,0 +1 @@
|
|||
$("#homework_index_list").html("<%=escape_javascript(render :partial => 'work_index_list', :locals => {:homework_commons => @homeworks,:contest_id => @contest.id}) %>");
|
|
@ -618,6 +618,7 @@ RedmineApp::Application.routes.draw do
|
|||
member do
|
||||
match 'settings' , :via => [:get, :post]
|
||||
get 'dealwith_apply_request'
|
||||
get 'contest_activities'
|
||||
end
|
||||
|
||||
resources :boards
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
.pro_new_setting_leftnav ul li a{ display: block; height: 40px; line-height: 40px; border-bottom:3px solid #fff; text-align: center; width:162px;}
|
||||
.pro_new_setting_leftnav ul li a:hover,.pro_new_setting_leftnav .active{ color: #3b94d6; background: #f3faff; }
|
||||
.pro_new_setting_conbox{ background: #fff; width: 818px; border:1px solid #ddd; padding-top: 15px;}
|
||||
.pro_new_setting_conbox input,.pro_new_setting_conbox select{ border:1px solid #c8c8c8; height: 28px; color: #888; background: #fff;}
|
||||
.pro_new_setting_conbox input,.pro_new_setting_conbox select{ border:1px solid #c8c8c8; height: 28px; color: #888;}
|
||||
.pro_new_setting_conbox label{width: 100px; text-align: right; display: inline-block;}
|
||||
.w690{width: 690px; }
|
||||
.pro_new_upimg{ width: 60px; height: 58px; border:1px solid #ddd; padding:1px;}
|
||||
|
@ -35,6 +35,8 @@ p.pro_new_grey{ line-height: 1.9; }
|
|||
.game-setting-h3{ width: 100%; height: 40px; line-height: 40px; font-size: 14px; color: #666; font-weight: normal; background: #fff; border-bottom: 10px solid #eaebec;}
|
||||
.w695{width: 695px; }
|
||||
.w625{width: 625px; }
|
||||
.w623{width: 623px; }
|
||||
.w621{width: 623px; }
|
||||
.description_div{width: 720px; padding: 15px;}
|
||||
.contestRightBanner {width:718px; margin:0px auto; float:right; background-color: #ffffff; padding:10px 15px;}
|
||||
|
||||
.sy_new_table tbody tr th{ height:40px; line-height:40px; border-bottom:1px solid #e5e5e5; color:#888;}
|
||||
|
|
Loading…
Reference in New Issue