Merge branch 'szzh' into develop

This commit is contained in:
sw 2014-12-05 16:46:35 +08:00
commit 99d5bca033
77 changed files with 1248 additions and 1415 deletions

View File

@ -101,33 +101,12 @@ class AccountController < ApplicationController
# User self-registration
def register
# @root_path="/home/pdl/redmine-2.3.2-0/apache2/"
#
#@cache_identityy = params[:identity]||"" #身份
@cache_no = params[:no]||"" #学号
@cache_technical_title = params[:technical_title]||"" #教师职称
@cache_province = params[:province]||"" #省份
@cache_city = params[:city]||"" #城市
@cache_enterprise_name = params[:enterprise_name]||"" #企业
firstname_code = ""
lastname_code = ""
(redirect_to(home_url); return) unless Setting.self_registration? || session[:auth_source_registration]
if request.get?
session[:auth_source_registration] = nil
@user = User.new(:language => current_language.to_s)
else
user_params = params[:user] || {}
@user = User.new
@user.safe_attributes = user_params
if params[:identity] == "2" # 2 企业
firstname_code = @user.firstname
lastname_code = @user.lastname
@user.firstname = params[:enterprise_name]
@user.lastname = l(:field_enterprise)
end
@user.admin = false
@user.register
if session[:auth_source_registration]
@user.activate
@user.login = session[:auth_source_registration][:login]
@ -139,36 +118,7 @@ class AccountController < ApplicationController
redirect_to my_account_path
end
else
@user.login = params[:user][:login]
unless user_params[:identity_url].present? && user_params[:password].blank? && user_params[:password_confirmation].blank?
@user.password, @user.password_confirmation = user_params[:password], user_params[:password_confirmation]
end
case Setting.self_registration
when '1'
register_by_email_activation(@user)
when '3'
register_automatically(@user)
else
register_manually_by_administrator(@user)
end
#added by bai
if @user.id != nil
ue = @user.user_extensions ||= UserExtensions.new
#ue = UserExtensions.create(:identity => params[:identity].to_i,:technical_title => params[:technical_title], :gender => params[:gender].to_i, :user_id => @user.id, :student_id => )
ue.identity = params[:identity].to_i
ue.technical_title = params[:technical_title]
ue.gender = params[:gender].to_i
ue.user_id = @user.id
ue.student_id = params[:no]
ue.location = params[:province] if params[:province] != nil
ue.location_city = params[:city] if params[:city] != nil
ue.save
end
create_and_save_user params[:user][:login],user_params[:password],user_params[:mail],user_params[:password_confirmation],true
end
end
if params[:identity] == "2"
@ -177,6 +127,36 @@ class AccountController < ApplicationController
end
end
#should_confirmation_password是否验证密码
def create_and_save_user login,password,email,password_confirmation,should_confirmation_password
@user = User.new
@user.admin = false
@user.register
@user.login = login
@user.mail = email
if should_confirmation_password && !password.blank? && !password_confirmation.blank?
@user.password,@user.password_confirmation = password,password_confirmation
elsif !should_confirmation_password && !password.blank?
@user.password = password
else
@user.password = ""
end
case Setting.self_registration
when '1'
register_by_email_activation(@user)
when '3'
register_automatically(@user)
else
register_manually_by_administrator(@user)
end
if @user.id != nil
ue = @user.user_extensions ||= UserExtensions.new
ue.user_id = @user.id
ue.save
end
@user
end
# Token based account activation
def activate
(redirect_to(home_url); return) unless Setting.self_registration? && params[:token].present?

View File

@ -203,12 +203,7 @@ class AttachmentsController < ApplicationController
if @attachment.container.respond_to?(:init_journal)
@attachment.container.init_journal(User.current)
end
if @attachment.container
# Make sure association callbacks are called
@attachment.container.attachments.delete(@attachment)
else
@attachment.destroy
end
@attachment.destroy
respond_to do |format|
if !@attachment.container.nil? &&
@ -371,6 +366,7 @@ class AttachmentsController < ApplicationController
@obj = c
@save_flag = attach_copied_obj.save
@save_message = attach_copied_obj.errors.full_messages
update_quotes attach_copied_obj
end
respond_to do |format|
format.js
@ -383,6 +379,20 @@ class AttachmentsController < ApplicationController
end
end
def update_quotes attachment
if attachment.copy_from
attachments = Attachment.find_by_sql("select * from attachments where copy_from = #{attachment.copy_from} or id = #{attachment.copy_from}")
else
attachments = Attachment.find_by_sql("select * from attachments where copy_from = #{attachment.id} or id = #{attachment.copy_from}")
end
attachment.quotes = get_qute_number attachment
attachment.save
attachments.each do |att|
att.quotes = attachment.quotes
att.save
end
end
private
def find_project
@attachment = Attachment.find(params[:id])

View File

@ -842,7 +842,7 @@ class BidsController < ApplicationController
# 编辑作业
def edit
@bid = Bid.find(params[:bid_id])
if (User.current.admin?||User.current.id==@bid.author_id)
if (User.current.admin?||User.current.allowed_to?(:as_teacher,@bid.courses.first))
@course_id = params[:course_id]
respond_to do |format|
format.html {
@ -868,7 +868,7 @@ class BidsController < ApplicationController
@bid.reward_type = 3
@bid.deadline = params[:bid][:deadline]
@bid.budget = 0
@bid.author_id = User.current.id
#@bid.author_id = User.current.id
@bid.commit = 0
@bid.homework_type = 1
@bid.save_attachments(params[:attachments] || (params[:bid] && params[:bid][:uploads]))
@ -884,6 +884,7 @@ class BidsController < ApplicationController
def new_submit_homework
#render html to prepare create submit homework
find_bid
find_bid
render :layout => 'base_homework'
end

View File

@ -39,13 +39,18 @@ class BoardsController < ApplicationController
end
render :layout => false if request.xhr?
elsif @course
@boards = @course.boards.includes(:last_message => :author).all
@boards = [] << @boards[0] if @boards.any?
if @boards.size == 1
@board = @boards.first
show and return
if (User.current.admin? || @course.is_public == 1 || (@course.is_public == 0 && User.current.member_of_course?(@course)))
@boards = @course.boards.includes(:last_message => :author).all
@boards = [] << @boards[0] if @boards.any?
if @boards.size == 1
@board = @boards.first
show and return
end
render :layout => 'base_courses'
else
render_403
end
render :layout => 'base_courses'
end
end

View File

@ -79,6 +79,8 @@ class CoursesController < ApplicationController
end
end
def join_private_courses
respond_to do |format|
format.js
@ -196,24 +198,118 @@ class CoursesController < ApplicationController
end
end
def searchmembers
@render_file = 'member_list'
@canShowCode = isCourseTeacher(User.current.id,@course) && params[:role] != '1'
@is_remote = true
q = "#{params[:name].strip}"
#(redirect_to stores_url, :notice => l(:label_sumbit_empty);return) if params[:name].blank?
@results = searchStudent_by_name(@course, q)
@result_count = @results.count
@results = paginateHelper @results
end
def addgroups
if params[:group_name]
group = CourseGroup.new
group.name = params[:group_name]
group.course_id = @course.id
group.save
end
@canShowCode = isCourseTeacher(User.current.id,@course) && params[:role] != '1'
@is_remote = true
@members = searchStudent(@course)
@membercount = @members.count
@course_groups = @course.course_groups
end
def updategroupname
if params[:group_name]
group = CourseGroup.find(params[:group_id])
group.name = params[:group_name]
group.save
end
@canShowCode = isCourseTeacher(User.current.id,@course) && params[:role] != '1'
@is_remote = true
@members = searchStudent(@course)
@membercount = @members.count
@course_groups = @course.course_groups
end
def join_group
group = CourseGroup.find(params[:object_id])
member = Member.where(:course_id => @course.id, :user_id => User.current.id).first
member.course_group_id = group.id
member.save
@group = group
@members = searchStudent(@course)
@course_groups = @course.course_groups
@membercount = @members.count
search_group_members group
end
def unjoin_group
group = CourseGroup.find(params[:object_id])
member = Member.where(:course_id => @course.id, :user_id => User.current.id).first
member.course_group_id = 0
member.save
@group = group
@course_groups = @course.course_groups
@members = searchStudent(@course)
@membercount = @members.count
search_group_members group
end
def searchgroupmembers
@render_file = 'member_list'
@canShowCode = isCourseTeacher(User.current.id,@course) && params[:role] != '1'
@is_remote = true
if params[:group_id] && params[:group_id] != "0"
@group = CourseGroup.find(params[:group_id])
@results = searchStudent_by_group(@group, @course)
else
@results = searchStudent(@course)
end
@members = searchStudent(@course)
@membercount = @members.count
@results = paginateHelper @results
end
def search_group_members group
@render_file = 'member_list'
@canShowCode = isCourseTeacher(User.current.id,@course) && params[:role] != '1'
@is_remote = true
@members = searchStudent(@course)
@membercount = @members.count
@results = searchStudent_by_group(group, @course)
@results = paginateHelper @results
end
def member
## 有角色参数的才是课程,没有的就是项目
@render_file = 'member_list'
@teachers= searchTeacherAndAssistant(@course)
@canShowCode = isCourseTeacher(User.current.id,@course) && params[:role] != '1'
case params[:role]
when '1'
@subPage_title = l :label_teacher_list
@members = searchTeacherAndAssistant(@course)
when '2'
@subPage_title = l :label_student_list
@members = searchStudent(@course)
else
@subPage_title = ''
@members = @course.member_principals.includes(:roles, :principal).all.sort
if (User.current.admin? || @course.is_public == 1 || (@course.is_public == 0 && User.current.member_of_course?(@course)))
@render_file = 'member_list'
@teachers= searchTeacherAndAssistant(@course)
@canShowCode = isCourseTeacher(User.current.id,@course) && params[:role] != '1'
@role = params[:role]
@course_groups = @course.course_groups if @course.course_groups
@course_group_id = params[:@course_group_id] unless params[:@course_group_id].nil?
case params[:role]
when '1'
@subPage_title = l :label_teacher_list
@members = searchTeacherAndAssistant(@course)
when '2'
@subPage_title = l :label_student_list
@members = searchStudent(@course)
@membercount = @members.count
else
@subPage_title = ''
@members = @course.member_principals.includes(:roles, :principal).all.sort
end
@members = paginateHelper @members
render :layout => 'base_courses'
else
render_403
end
@members = paginateHelper @members
render :layout => 'base_courses'
end
#判断指定用户是否为课程教师
@ -663,24 +759,29 @@ class CoursesController < ApplicationController
end
def feedback
page = params[:page]
# Find the page of the requested reply
@jours = @course.journals_for_messages.where('m_parent_id IS NULL').order('created_on DESC')
@limit = 10
if params[:r] && page.nil?
offset = @jours.count(:conditions => ["#{JournalsForMessage.table_name}.id > ?", params[:r].to_i])
page = 1 + offset / @limit
if (User.current.admin? || @course.is_public == 1 || (@course.is_public == 0 && User.current.member_of_course?(@course)))
page = params[:page]
# Find the page of the requested reply
@jours = @course.journals_for_messages.where('m_parent_id IS NULL').order('created_on DESC')
@limit = 10
if params[:r] && page.nil?
offset = @jours.count(:conditions => ["#{JournalsForMessage.table_name}.id > ?", params[:r].to_i])
page = 1 + offset / @limit
end
#@feedback_count = @jours.count
#@feedback_pages = Paginator.new @feedback_count, @limit, page
#@offset ||= @feedback_pages.offset
@jour = paginateHelper @jours,10
@state = false
respond_to do |format|
format.html{render :layout => 'base_courses'}
format.api
end
else
render_403
end
#@feedback_count = @jours.count
#@feedback_pages = Paginator.new @feedback_count, @limit, page
#@offset ||= @feedback_pages.offset
@jour = paginateHelper @jours,10
@state = false
respond_to do |format|
format.html{render :layout => 'base_courses'}
format.api
end
end

View File

@ -45,16 +45,28 @@ class FilesController < ApplicationController
end
def search
sort = ""
@sort = ""
@order = ""
@is_remote = true
if params[:sort]
order_by = params[:sort].split(":")
@sort = order_by[0]
if order_by.count > 1
@order = order_by[1]
end
sort = "#{@sort} #{@order}"
end
begin
@is_remote = true
q = "%#{params[:name].strip}%"
#(redirect_to stores_url, :notice => l(:label_sumbit_empty);return) if params[:name].blank?
if params[:insite]
@result = find_public_attache q
@result = visable_attachemnts @result
@result = find_public_attache q,sort
@result = visable_attachemnts_insite @result,@course
@searched_attach = paginateHelper @result,10
else
@result = find_course_attache q,@course
@result = find_course_attache q,@course,sort
@result = visable_attachemnts @result
@searched_attach = paginateHelper @result,10
end
@ -65,17 +77,24 @@ class FilesController < ApplicationController
end
end
def find_course_attache keywords,course
def find_course_attache keywords,course,sort = ""
if sort == ""
sort = "created_on DESC"
end
resultSet = Attachment.where("attachments.container_type = 'Course' And attachments.container_id = '#{course.id}' AND filename LIKE :like ", like: "%#{keywords}%").
reorder("created_on DESC")
reorder(sort)
#resultSet = Attachment.find_by_sql("SELECT `attachments`.* FROM `attachments` LEFT OUTER JOIN `homework_attaches` ON `attachments`.container_type = 'HomeworkAttach' AND `attachments`.container_id = `homework_attaches`.id LEFT OUTER JOIN `homework_for_courses` ON `homework_attaches`.bid_id = `homework_for_courses`.bid_id LEFT OUTER JOIN `homework_for_courses` AS H_C ON `attachments`.container_type = 'Bid' AND `attachments`.container_id = H_C.bid_id WHERE (`homework_for_courses`.course_id = 117 OR H_C.course_id = 117 OR (`attachments`.container_type = 'Course' AND `attachments`.container_id = 117)) AND `attachments`.filename LIKE '%#{keywords}%'").reorder("created_on DESC")
end
def find_public_attache keywords
def find_public_attache keywords,sort = ""
# StoresController#search 将每条文件都查出来,再次进行判断过滤。---> resultSet.to_a.map
# 此时内容不多速度还可但文件增长每条判断多则进行3-4次表连接。
# 现在还木有思路 药丸
resultSet = Attachment.where("attachments.container_type IS NOT NULL AND filename LIKE :like ", like: "%#{keywords}%").
reorder("created_on DESC")
if sort == ""
sort = "created_on DESC"
end
resultSet = Attachment.where("attachments.container_type IS NOT NULL AND attachments.copy_from IS NULL AND filename LIKE :like ", like: "%#{keywords}%").
reorder(sort)
end
def index
@ -114,9 +133,9 @@ class FilesController < ApplicationController
end
if order_by.count == 1
sort += "#{Attachment.table_name}.#{attribute} asc "
sort += "#{Attachment.table_name}.#{attribute} asc " if attribute
elsif order_by.count == 2
sort += "#{Attachment.table_name}.#{attribute} #{order_by[1]} "
sort += "#{Attachment.table_name}.#{attribute} #{order_by[1]} " if attribute && order_by[1]
end
if sort_type != params[:sort].split(",").last
sort += ","
@ -152,16 +171,21 @@ class FilesController < ApplicationController
attribute = "downloads"
when "created_on"
attribute = "created_on"
when "quotes"
attribute = "quotes"
end
@sort = order_by[0]
@order = order_by[1]
if order_by.count == 1
if order_by.count == 1 && attribute
sort += "#{Attachment.table_name}.#{attribute} asc "
elsif order_by.count == 2
if sort_type != params[:sort].split(",").last
sort += ","
end
elsif order_by.count == 2 && order_by[1]
sort += "#{Attachment.table_name}.#{attribute} #{order_by[1]} "
end
if sort_type != params[:sort].split(",").last
sort += ","
if sort_type != params[:sort].split(",").last
sort += ","
end
end
end
end
@ -372,14 +396,14 @@ class FilesController < ApplicationController
end
end
# show_attachments @containers
# @attachtype = params[:type].to_i
# @contenttype = params[:contentType].to_s
#
# respond_to do |format|
# format.js
# format.html
# end
show_attachments @containers
@attachtype = params[:type].to_i
@contenttype = params[:contentType].to_s
respond_to do |format|
format.js
format.html
end
end
end

View File

@ -22,23 +22,10 @@ class HomeworkAttachController < ApplicationController
#获取未批作业列表
def get_not_batch_homework
sort, direction = params[:sort] || "s_socre", params[:direction] || "desc"
if sort == 't_socre'
order_by = "t_score #{direction}"
elsif sort == 's_socre'
order_by = "s_score #{direction}"
elsif sort == 'time'
order_by = "created_at #{direction}"
end
teachers = find_course_teachers @course
all_homework_list = HomeworkAttach.eager_load(:attachments,:user,:rate_averages).find_by_sql("SELECT * FROM (SELECT homework_attaches.*,
(SELECT AVG(stars) FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND rater_id IN #{teachers}) AS t_score,
(SELECT AVG(stars) FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND rater_id NOT IN #{teachers}) AS s_score
FROM homework_attaches WHERE bid_id = #{@bid.id}
ORDER BY #{order_by}) AS table1
WHERE table1.t_score IS NULL")
get_not_batch_homework_list sort,direction,teachers, @bid.id
@cur_page = params[:page] || 1
@cur_type = 1
@homework_list = paginateHelper all_homework_list,10
@direction = direction == 'asc'? 'desc' : 'asc'
respond_to do |format|
format.js
@ -57,8 +44,8 @@ class HomeworkAttachController < ApplicationController
end
teachers = find_course_teachers @course
all_homework_list = HomeworkAttach.eager_load(:attachments,:user,:rate_averages).find_by_sql("SELECT * FROM (SELECT homework_attaches.*,
(SELECT AVG(stars) FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND rater_id IN #{teachers} and stars IS NOT NULL) AS t_score,
(SELECT AVG(stars) FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND rater_id NOT IN #{teachers}) AS s_score
(SELECT AVG(stars) FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND rater_id IN (#{teachers}) and stars IS NOT NULL) AS t_score,
(SELECT AVG(stars) FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND rater_id NOT IN (#{teachers})) AS s_score
FROM homework_attaches WHERE bid_id = #{@bid.id}
ORDER BY #{order_by}) AS table1
WHERE table1.t_score IS NOT NULL")
@ -83,8 +70,8 @@ class HomeworkAttachController < ApplicationController
end
teachers = find_course_teachers @course
all_homework_list = HomeworkAttach.eager_load(:attachments,:user,:rate_averages).find_by_sql("SELECT homework_attaches.*,
(SELECT AVG(stars) FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND rater_id in #{teachers}) AS t_score,
(SELECT AVG(stars) FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND rater_id not in #{teachers}) AS s_score
(SELECT AVG(stars) FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND rater_id in (#{teachers})) AS t_score,
(SELECT AVG(stars) FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND rater_id not in (#{teachers})) AS s_score
FROM homework_attaches WHERE bid_id = #{@bid.id}
ORDER BY #{order_by}")
@cur_page = params[:page] || 1
@ -101,8 +88,8 @@ class HomeworkAttachController < ApplicationController
@is_student_batch_homework = true
teachers = find_course_teachers @course
all_homework_list = HomeworkAttach.eager_load(:attachments,:user,:rate_averages).find_by_sql("SELECT homework_attaches.*,
(SELECT AVG(stars) FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND rater_id IN #{teachers}) AS t_score,
(SELECT AVG(stars) FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND rater_id NOT IN #{teachers}) AS s_score,
(SELECT AVG(stars) FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND rater_id IN (#{teachers})) AS t_score,
(SELECT AVG(stars) FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND rater_id NOT IN (#{teachers})) AS s_score,
(SELECT stars FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND rater_id = #{User.current.id}) AS m_score
FROM homework_attaches
INNER JOIN homework_evaluations ON homework_evaluations.homework_attach_id = homework_attaches.id
@ -120,15 +107,15 @@ class HomeworkAttachController < ApplicationController
@is_my_homework = true
teachers = find_course_teachers @course
all_homework_list = HomeworkAttach.find_by_sql("SELECT homework_attaches.*,
(SELECT AVG(stars) FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND rater_id IN #{teachers}) AS t_score,
(SELECT AVG(stars) FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND rater_id NOT IN #{teachers}) AS s_score
(SELECT AVG(stars) FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND rater_id IN (#{teachers})) AS t_score,
(SELECT AVG(stars) FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND rater_id NOT IN (#{teachers})) AS s_score
FROM homework_attaches
WHERE homework_attaches.bid_id = #{@bid.id} AND homework_attaches.user_id = #{User.current.id}")
#如果我没有创建过作业,就检索我是否参与了某个作业
if all_homework_list.empty?
all_homework_list = HomeworkAttach.find_by_sql("SELECT homework_attaches.*,
(SELECT AVG(stars) FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND rater_id IN #{teachers}) AS t_score,
(SELECT AVG(stars) FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND rater_id NOT IN #{teachers}) AS s_score
(SELECT AVG(stars) FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND rater_id IN (#{teachers})) AS t_score,
(SELECT AVG(stars) FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND rater_id NOT IN (#{teachers})) AS s_score
FROM homework_attaches
INNER JOIN homework_users ON homework_users.homework_attach_id = homework_attaches.id
WHERE homework_attaches.bid_id = #{@bid.id} AND homework_users.user_id = #{User.current.id}")
@ -297,11 +284,6 @@ class HomeworkAttachController < ApplicationController
end
end
#获取指定作业的所有成员
def users_for_homework homework
homework.nil? ? [] : (homework.users + [homework.user])
end
#获取可选成员列表
#homework作业
#users该作业所有成员
@ -318,7 +300,8 @@ class HomeworkAttachController < ApplicationController
end
def edit
if User.current.admin? || User.current.member_of_course?(@homework.bid.courses.first)
bid = @homework.bid
if (bid.comment_status == 0 || bid.open_anonymous_evaluation == 0) && (User.current.admin? || User.current.member_of_course?(bid.courses.first))
get_homework_member @homework
else
render_403 :message => :notice_not_authorized
@ -350,7 +333,8 @@ class HomeworkAttachController < ApplicationController
end
def destroy
if User.current.admin? || User.current == @homework.user
bid = @homework.bid
if (bid.comment_status == 0 || bid.open_anonymous_evaluation == 0) && (User.current.admin? || User.current == @homework.user)
if @homework.destroy
#respond_to do |format|
# format.html { redirect_to course_for_bid_url @homework.bid }
@ -370,48 +354,21 @@ class HomeworkAttachController < ApplicationController
#显示作业信息
def show
if User.current.admin? || User.current.member_of_course?(@homework.bid.courses.first)
# 打分统计
stars_reates = @homework. rates(:quality)
#是否已经进行过评价
temp = HomeworkAttach.find_by_sql("SELECT stars FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = #{@homework.id} AND rater_id = #{User.current.id}").first
@m_score = temp.nil? ? 0:temp.stars
@has_evaluation = stars_reates.where("rater_id = ?",User.current).count > 0
#@jours留言 is null条件用以兼容历史数据
@jours = @homework.journals_for_messages.where("is_comprehensive_evaluation = 3 or is_comprehensive_evaluation is null").order("created_on DESC")
if User.current.admin? || User.current.member_of_course?(@course)
# 作业打分列表
@stars_reates = @homework.rates(:quality)
#我的评分
@has_evaluation = @stars_reates.where("rater_id = #{User.current.id}").first
@m_score = @has_evaluation.nil? ? 0 : @has_evaluation.stars
teachers = find_course_teachers(@course)
@teacher_stars = @stars_reates.where("rater_id in (#{teachers})") #老师评分列表
@student_stars = @stars_reates.where("rater_id not in (#{teachers})") #学生评分列表
@is_teacher = is_course_teacher User.current,@course
@is_anonymous_comments = @bid.comment_status == 1 && !@homework.users.include?(User.current) && @homework.user != User.current && !@is_teacher #判断是不是匿评(开启匿评,当前用户不是作业的创建者或者参与者,不是老师)
jours = @homework.journals_for_messages.where("is_comprehensive_evaluation = 3 or is_comprehensive_evaluation is null").order("created_on DESC")#jours留言 is null条件用以兼容历史数据
@jour = paginateHelper jours,5 #留言
@cur_page = params[:cur_page] || 1
@cur_type = params[:cur_type] || 5
@jour = paginateHelper @jours,5
teachers = searchTeacherAndAssistant @course
@comprehensive_evaluation = []
teachers.each do|teacher|
temp = @homework.journals_for_messages.where("is_comprehensive_evaluation = 1 and user_id = #{teacher.user_id}").order("created_on DESC").first
@comprehensive_evaluation << temp if temp
end
annymous_users = @homework.homework_evaluations.map(&:user)
unless annymous_users.nil? || annymous_users.count == 0
@anonymous_comments = @homework.journals_for_messages.where("is_comprehensive_evaluation = 2 and user_id in #{convert_array(annymous_users)}").order("created_on DESC")
end
@totle_score = score_for_homework @homework
@teaher_score = teacher_score_for_homework @homework
is_student = is_cur_course_student @homework.bid.courses.first
is_teacher = is_course_teacher User.current,@homework.bid.courses.first
@is_anonymous_comments = @homework.bid.comment_status == 1 #是否开启了匿评
if !User.current.member_of_course?(@homework.bid.courses.first)
@is_comprehensive_evaluation = 3 #留言
elsif is_student && @is_anonymous_comments && !@has_evaluation#是学生且开启了匿评且未进行评分
@is_comprehensive_evaluation = 2 #匿评
elsif is_student && @is_anonymous_comments && @has_evaluation #是学生且开启了匿评,但已评分
@is_comprehensive_evaluation = 2 #匿评
elsif is_student && !@is_anonymous_comments #是学生未开启匿评
@is_comprehensive_evaluation = 3 #留言
elsif is_teacher
@is_comprehensive_evaluation = 1 #教师评论
else
@is_comprehensive_evaluation = 3
end
respond_to do |format|
format.html
@ -424,30 +381,40 @@ class HomeworkAttachController < ApplicationController
#删除留言
def destroy_jour
@homework = HomeworkAttach.find(params[:jour_id])
@course=@homework.bid.courses.first
@homework = HomeworkAttach.find(params[:homework_id])
@journal_destroyed = JournalsForMessage.find(params[:object_id])
@is_comprehensive_evaluation = @journal_destroyed.is_comprehensive_evaluation
@journal_destroyed.destroy
if @is_comprehensive_evaluation == 3
@jours = @homework.journals_for_messages.where("is_comprehensive_evaluation = 3 or is_comprehensive_evaluation is null").order("created_on DESC")
@jour = paginateHelper @jours,5
elsif @is_comprehensive_evaluation == 2
annymous_users = @homework.homework_evaluations.map(&:user)
unless annymous_users.nil? || annymous_users.count == 0
@anonymous_comments = @homework.journals_for_messages.where("is_comprehensive_evaluation = 2 and user_id in #{convert_array(annymous_users)}").order("created_on DESC")
end
elsif @is_comprehensive_evaluation == 1
teachers = searchTeacherAndAssistant @course
@comprehensive_evaluation = []
teachers.each do|teacher|
temp = @homework.journals_for_messages.where("is_comprehensive_evaluation = 1 and user_id = #{teacher.user_id}").order("created_on DESC").first
@comprehensive_evaluation << temp if temp
end
if @journal_destroyed.is_comprehensive_evaluation == 3 && @journal_destroyed.destroy
render_403 unless User.current == @journal_destroyed.user || User.current.admin?
teachers = find_course_teachers(@homework.bid.courses.first)
@stars_reates = @homework.rates(:quality)
@teacher_stars = @stars_reates.where("rater_id in (#{teachers})") #老师评分列表
@student_stars = @stars_reates.where("rater_id not in (#{teachers})") #学生评分列表
jours = @homework.journals_for_messages.where("is_comprehensive_evaluation = 3 or is_comprehensive_evaluation is null").order("created_on DESC")#jours留言 is null条件用以兼容历史数据
@jour = paginateHelper jours,5 #留言
else
render_404
end
#@course=@homework.bid.courses.first
#@journal_destroyed = JournalsForMessage.find(params[:object_id])
#@is_comprehensive_evaluation = @journal_destroyed.is_comprehensive_evaluation
#@journal_destroyed.destroy
#if @is_comprehensive_evaluation == 3
# @jours = @homework.journals_for_messages.where("is_comprehensive_evaluation = 3 or is_comprehensive_evaluation is null").order("created_on DESC")
# @jour = paginateHelper @jours,5
#elsif @is_comprehensive_evaluation == 2
# annymous_users = @homework.homework_evaluations.map { |homework_evaluation| homework_evaluation.user.id}.join(',')
# unless annymous_users.nil? || annymous_users.count == ""
# @anonymous_comments = @homework.journals_for_messages.where("is_comprehensive_evaluation = 2 and user_id in (#{annymous_users})").order("created_on DESC")
# end
#elsif @is_comprehensive_evaluation == 1
# teachers = searchTeacherAndAssistant @course
# @comprehensive_evaluation = []
# teachers.each do|teacher|
# temp = @homework.journals_for_messages.where("is_comprehensive_evaluation = 1 and user_id = #{teacher.user_id}").order("created_on DESC").first
# @comprehensive_evaluation << temp if temp
# end
#end
respond_to do |format|
format.js
end
@ -455,55 +422,49 @@ class HomeworkAttachController < ApplicationController
#添加留言
def addjours
@homework = HomeworkAttach.find(params[:jour_id])
@add_jour = @homework.addjours User.current.id, params[:new_form][:user_message],0,params[:is_comprehensive_evaluation]
if @add_jour.is_comprehensive_evaluation == 3
@jours = @homework.journals_for_messages.where("is_comprehensive_evaluation = 3 or is_comprehensive_evaluation is null").order("created_on DESC")
@jour = paginateHelper @jours,5
elsif @add_jour.is_comprehensive_evaluation == 2
annymous_users = @homework.homework_evaluations.map(&:user)
unless annymous_users.nil? || annymous_users.count == 0
@anonymous_comments = @homework.journals_for_messages.where("is_comprehensive_evaluation = 2 and user_id in #{convert_array(annymous_users)}").order("created_on DESC")
end
elsif @add_jour.is_comprehensive_evaluation == 1
teachers = searchTeacherAndAssistant @homework.bid.courses.first
@comprehensive_evaluation = []
teachers.each do|teacher|
temp = @homework.journals_for_messages.where("is_comprehensive_evaluation = 1 and user_id = #{teacher.user_id}").order("created_on DESC").first
@comprehensive_evaluation << temp if temp
end
@is_teacher,@is_anonymous_comments,@m_score = params[:is_teacher]=="true",params[:is_anonymous_comments]=="true",params[:stars_value]
@cur_page,@cur_type = params[:cur_page] || 1,params[:cur_type] || 5
@homework = HomeworkAttach.find(params[:homework_id])
#保存评分
@homework.rate(@m_score,User.current.id,:quality) if @m_score && @m_score != "0"
#保存评论
@is_comprehensive_evaluation = @is_teacher ? 1 : (@is_anonymous_comments ? 2 : 3) #判断当前评论是老师评论?匿评?留言
if params[:new_form] && params[:new_form][:user_message] && params[:new_form][:user_message] != "" #有没有留言
@homework.addjours User.current.id, params[:new_form][:user_message],0,@is_comprehensive_evaluation
end
teachers = find_course_teachers(@homework.bid.courses.first)
@stars_reates = @homework.rates(:quality)
@teacher_stars = @stars_reates.where("rater_id in (#{teachers})") #老师评分列表
@student_stars = @stars_reates.where("rater_id not in (#{teachers})") #学生评分列表
jours = @homework.journals_for_messages.where("is_comprehensive_evaluation = 3 or is_comprehensive_evaluation is null").order("created_on DESC")#jours留言 is null条件用以兼容历史数据
@jour = paginateHelper jours,5 #留言
#@limit = 10
#@feedback_count = @jours.count
#@feedback_pages = Paginator.new @feedback_count, @limit, params['page']
#@offset ||= @feedback_pages.offset
#@jour = @jours[@offset, @limit]
#@comprehensive_evaluation = @homework.journals_for_messages.where("is_comprehensive_evaluation is not null").order("created_on DESC")
if @cur_type == "1" #如果当前是老师未批列表,需要刷新整个作业列表界面
@bid = @homework.bid
get_not_batch_homework_list "s_socre","desc",teachers,@homework.bid_id
elsif @cur_type == "2" #老师已批列表
@result_homework = HomeworkAttach.eager_load(:attachments,:user,:rate_averages).find_by_sql("SELECT homework_attaches.*,
(SELECT AVG(stars) FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND rater_id IN (#{teachers}) and stars IS NOT NULL) AS t_score,
(SELECT AVG(stars) FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND rater_id NOT IN (#{teachers})) AS s_score
FROM homework_attaches WHERE id = #{@homework.id}").first
elsif @cur_type == "3" #全部作业列表
@result_homework = HomeworkAttach.eager_load(:attachments,:user,:rate_averages).find_by_sql("SELECT homework_attaches.*,
(SELECT AVG(stars) FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND rater_id in (#{teachers})) AS t_score,
(SELECT AVG(stars) FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND rater_id not in (#{teachers})) AS s_score
FROM homework_attaches WHERE id = #{@homework.id}").first
elsif @cur_type == "4" #匿评作业列表
@is_student_batch_homework = true
@result_homework = HomeworkAttach.eager_load(:attachments,:user,:rate_averages).find_by_sql("SELECT homework_attaches.*,
(SELECT AVG(stars) FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND rater_id IN (#{teachers})) AS t_score,
(SELECT AVG(stars) FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND rater_id NOT IN (#{teachers})) AS s_score,
(SELECT stars FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND rater_id = #{User.current.id}) AS m_score
FROM homework_attaches
WHERE homework_attaches.id = #{@homework.id}").first
else #其他的不用管
@totle_score = score_for_homework @homework
@teaher_score = teacher_score_for_homework @homework
stars_reates = @homework. rates(:quality)
is_student = is_cur_course_student @homework.bid.courses.first
is_teacher = is_course_teacher User.current,@homework.bid.courses.first
@has_evaluation = stars_reates.where("rater_id = ?",User.current).count > 0
@is_anonymous_comments = @homework.bid.comment_status == 1 #是否开启了匿评
if !User.current.member_of_course?(@homework.bid.courses.first)
@is_comprehensive_evaluation = 3 #留言
elsif is_student && @is_anonymous_comments && !@has_evaluation#是学生且开启了匿评且未进行评分
@is_comprehensive_evaluation = 2 #匿评
elsif is_student && @is_anonymous_comments && @has_evaluation #是学生且开启了匿评,但已评分
@is_comprehensive_evaluation = 3 #留言
elsif is_student && !@is_anonymous_comments #是学生未开启匿评
@is_comprehensive_evaluation = 3 #留言
elsif is_teacher
@is_comprehensive_evaluation = 1 #教师评论
else
@is_comprehensive_evaluation = 3
end
respond_to do |format|
format.js
end
@ -578,16 +539,7 @@ class HomeworkAttachController < ApplicationController
#获取课程的老师列表
def find_course_teachers course
teachers = "("
teacher_members = searchTeacherAndAssistant(course)
teacher_members.each do |member|
if member == teacher_members.last
teachers += member.user_id.to_s + ")"
else
teachers += member.user_id.to_s + ","
end
end
teachers
searchTeacherAndAssistant(course).map{|teacher| teacher.user_id}.join(",")
end
#获取作业教师评分所占比例
@ -599,5 +551,27 @@ class HomeworkAttachController < ApplicationController
end
teacher_proportion
end
def get_not_batch_homework_list sort,direction,teachers,bid_id
if sort == 't_socre'
order_by = "t_score #{direction}"
elsif sort == 's_socre'
order_by = "s_score #{direction}"
elsif sort == 'time'
order_by = "created_at #{direction}"
end
all_homework_list = HomeworkAttach.eager_load(:attachments,:user,:rate_averages).find_by_sql("SELECT * FROM (SELECT homework_attaches.*,
(SELECT AVG(stars) FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND rater_id IN (#{teachers})) AS t_score,
(SELECT AVG(stars) FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND rater_id NOT IN (#{teachers})) AS s_score
FROM homework_attaches WHERE bid_id = #{bid_id}
ORDER BY #{order_by}) AS table1
WHERE table1.t_score IS NULL")
@homework_list = paginateHelper all_homework_list,10
end
#获取指定作业的所有成员
def users_for_homework homework
homework.nil? ? [] : (homework.users + [homework.user])
end
end

View File

@ -65,23 +65,27 @@ class NewsController < ApplicationController
format.atom { render_feed(@newss, :title => (@project ? @project.name : Setting.app_title) + ": #{l(:label_news_plural)}") }
end
elsif @course
scope = @course ? @course.news.course_visible : News.course_visible
if (User.current.admin? || @course.is_public == 1 || (@course.is_public == 0 && User.current.member_of_course?(@course)))
scope = @course ? @course.news.course_visible : News.course_visible
@news_count = scope.count
@news_pages = Paginator.new @news_count, @limit, params['page']
@offset ||= @news_pages.offset
@newss = scope.all(:include => [:author, :course],
:order => "#{News.table_name}.created_on DESC",
:offset => @offset,
:limit => @limit)
@news_count = scope.count
@news_pages = Paginator.new @news_count, @limit, params['page']
@offset ||= @news_pages.offset
@newss = scope.all(:include => [:author, :course],
:order => "#{News.table_name}.created_on DESC",
:offset => @offset,
:limit => @limit)
respond_to do |format|
format.html {
@news = News.new
render :layout => 'base_courses'
}
format.api
format.atom { render_feed(@newss, :title => (@course ? @course.name : Setting.app_title) + ": #{l(:label_news_plural)}") }
respond_to do |format|
format.html {
@news = News.new
render :layout => 'base_courses'
}
format.api
format.atom { render_feed(@newss, :title => (@course ? @course.name : Setting.app_title) + ": #{l(:label_news_plural)}") }
end
else
render_403
end
end
end

View File

@ -26,19 +26,19 @@ class StoresController < ApplicationController
resultSet = Attachment.where("attachments.container_type IS NOT NULL AND filename LIKE :like ", like: "%#{keywords}%").
reorder("created_on DESC")
# result = resultSet.to_a.dup
result = resultSet.to_a.dup
# resultSet.to_a.map { |res|
# if(res.container.nil? ||
# (res.container.class.to_s=="Project" && res.container.is_public == false) ||
# (res.container.has_attribute?(:project) && res.container.project.is_public == false) ||
# (res.container.class.to_s=="HomeworkAttach" && res.container.bid.reward_type == 3) ||
# false
# )
# result.delete(res)
# end
# }
# result
resultSet.to_a.map { |res|
if(res.container.nil? ||
(res.container.class.to_s=="Project" && res.container.is_public == false) ||
(res.container.has_attribute?(:project) && res.container.project.is_public == false) ||
(res.container.class.to_s=="HomeworkAttach" && res.container.bid.reward_type == 3) ||
false
) || (res.container.is_a?(Course) && res.container.is_public == 0)
result.delete(res)
end
}
result
end
LIMIT = 12 unless const_defined?(:LIMIT)

View File

@ -99,9 +99,9 @@ class ZipdownController < ApplicationController
zipfile.add(rename_file, filename)
end
zipfile.get_output_stream('ReadMe') do |os|
os.write 'Homeworks'
end
#zipfile.get_output_stream('ReadMe') do |os|
# os.write 'Homeworks'
#end
end
zipfile_name
rescue Errno => e

View File

@ -76,6 +76,19 @@ module AttachmentsHelper
false
end
def get_qute_number attachment
if attachment.copy_from
result = Attachment.find_by_sql("select count(*) as number from attachments where copy_from = #{attachment.copy_from}")
else
result = Attachment.find_by_sql("select count(*) as number from attachments where copy_from = #{attachment.id}")
end
if result.nil? || result.count <= 0
return 0
else
return result[0].number
end
end
private
def deletable? container, user=User.current

View File

@ -114,28 +114,13 @@ module CoursesHelper
# 学生人数计算
# add by nwb
def studentCount course
count = searchStudent(course).count#course.student.count
if count <= 5
result = count.to_s
elsif count < 10 && count > 5
result = "5+"
else
result = (count-count % 10).to_s + "+"
end
result
searchStudent(course).count.to_s#course.student.count
end
#课程成员数计算
def memberCount course
count = searchStudent(course).count + searchTeacherAndAssistant(course).count
if count <= 5
result = count.to_s
elsif count < 10 && count > 5
result = "5+"
else
result = (count-count % 10).to_s + "+"
end
result
count.to_s
end
def eventToLanguageCourse event_type, course
@ -170,7 +155,7 @@ module CoursesHelper
members
end
def searchStudent project
def search_student_in_group(project, course_group_id)
#searchPeopleByRoles(project, StudentRoles)
members = []
project.members.each do |m|
@ -178,6 +163,35 @@ module CoursesHelper
end
members
end
def searchStudent project
#searchPeopleByRoles(project, StudentRoles)
members = []
project.members.each do |m|
members << m if m && m.user && m.user.allowed_to?(:as_student,project)
end
members
end
def searchStudent_by_name project, name
#searchPeopleByRoles(project, StudentRoles)
members = []
project.members.each do |m|
if m && m.user && m.user.allowed_to?(:as_student,project)
username = m.user[:lastname].to_s + m.user[:firstname].to_s
if(m.user[:login].to_s.include?(name) || m.user.user_extensions[:student_id].to_s.include?(name) || username.include?(name))
members << m
end
end
end
members
end
def searchStudent_by_group group, project
#searchPeopleByRoles(project, StudentRoles)
members = []
group.members.each do |m|
members << m if m && m.user && m.user.allowed_to?(:as_student,project)
end
members
end
# =====================================================================================
#def searchCountByRoles project, roles_id

View File

@ -1,5 +1,6 @@
# encoding: utf-8
module FilesHelper
include AttachmentsHelper
def downloadAll containers
paths = []
@ -54,11 +55,11 @@ module FilesHelper
s.html_safe
end
#判断用户是否拥有课程,需用户在该课程中角色为教师且该课程属于当前学期或下一学期
def has_course? user
#判断用户是否拥有不包含当前资源的课程,需用户在该课程中角色为教师且该课程属于当前学期或下一学期
def has_course? user,file
result = false
user.courses.each do |course|
if is_course_teacher(User.current,course) && course_in_current_or_next_term(course)
if !course_contains_attachment?(course,file) && is_course_teacher(User.current,course) && course_in_current_or_next_term(course)
return true
end
end
@ -86,23 +87,33 @@ module FilesHelper
def visable_attachemnts attachments
result = []
attachments.each do |attachment|
if attachment.is_public? || (attachment.container_type == "Course" && attachment.author.member_of_course?(Course.find(attachment.container_id)))|| attachment.author_id == User.current.id
if attachment.is_public? || (attachment.container_type == "Course" && User.current.member_of_course?(Course.find(attachment.container_id)))|| attachment.author_id == User.current.id
result << attachment
end
end
result
end
def get_qute_number attachment
if attachment.copy_from
result = Attachment.find_by_sql("select count(*) as number from attachments where copy_from = #{attachment.copy_from}")
else
result = Attachment.find_by_sql("select count(*) as number from attachments where copy_from = #{attachment.id}")
end
if result.nil? || result.count <= 0
return 0
else
return result[0].number
def visable_attachemnts_incourse attachments
result = []
attachments.each do |attachment|
if attachment.is_public? || (attachment.author.member_of_course?(Course.find(attachment.container_id)))|| attachment.author_id == User.current.id
result << attachment
end
end
result
end
def visable_attachemnts_insite attachments,course
result = []
attachments.each do |attachment|
if attachment.is_public? || (attachment.container_type == "Course" && attachment.container_id == course.id && User.current.member_of_course?(Course.find(attachment.container_id)))|| attachment.author_id == User.current.id
result << attachment
end
end
result
end
end

View File

@ -87,8 +87,13 @@ module HomeworkAttachHelper
#获取用户对作业的评分
def get_homework_score user, homework
seems_rateable_rate = HomeworkAttach.find_by_sql("SELECT * FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = #{homework.id} AND rater_id = #{user.id}")
seems_rateable_rate.nil? || seems_rateable_rate.count == 0 ? 0:seems_rateable_rate[0].stars
temp = HomeworkAttach.find_by_sql("SELECT stars FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = #{homework.id} AND rater_id = #{user.id}").first
@m_score = temp.nil? ? 0:temp.stars.to_i
end
#获取评分对应的评论
def get_homework_review homework,is_teacher,user
homework.journals_for_messages.where("is_comprehensive_evaluation = #{is_teacher ? 1 : 2} and user_id = #{user.id}").order("created_on DESC").first
end
def convert_array array

View File

@ -100,15 +100,45 @@ module WatchersHelper
return '' if user.id == course.tea_id
joined = user.member_of_course?(course)
text = joined ? l(:label_exit_course) : l(:label_new_join)
url_t = join_path(:object_id => course.id)
url_f = try_join_path(:object_id => course.id)
url = joined ? join_path(:object_id => course.id) : try_join_path(:object_id => course.id)
method = joined ? 'delete' : 'post'
if joined
link_to text, url_t, :remote => true, :method => method, :id => "#{course.id}", :confirm => l(:text_are_you_sure_out), :class => []+options
link_to text, url, :remote => true, :method => method, :id => "#{course.id}", :confirm => l(:text_are_you_sure_out), :class => []+options
else
link_to text, url_f, :remote => true, :method => method, :id => "#{course.id}", :class => []+options
link_to text, url, :remote => true, :method => method, :id => "#{course.id}", :class => []+options
end
end
def join_in_course_group(coursegroups,group, user, options=[])
return '' unless user && user.logged?
@isjoin = false
coursegroups.each do |g|
g.members.each do |mem|
if mem.user_id == user.id
@isjoin = true
end
end
end
url_t = join_group_path(:object_id => group.id)
url_f = join_group_path(:object_id => group.id)
if @isjoin == true
joined = user.member_of_course_group?(group)
text = l(:label_exit_course)
if joined
link_to text, {:controller => "courses", :action => "join_group", :object_id => "#{group.id}"},
:remote => true, :method => 'delete',
:id => "#{group.id}", :style => "padding: 8px 8px 4px;",
:confirm => l(:text_are_you_sure_out_group), :class => 'group_in'
end
else
text = l(:label_new_join)
form_tag({:controller => "courses", :action => "join_group", :object_id => "#{group.id}"}, :remote => true, :method => 'post') do
submit_tag text, class: "group_in", style: "width: 43px;height: 21px;"
end
end
end
# 用户是否允许加入课程判断
# add by nwb
@ -125,7 +155,8 @@ module WatchersHelper
if joined
link_to text, url_t, :remote => true, :method => method, :id => "#{course.id}", :confirm => l(:text_are_you_sure_out), :class => []+options
else
link_to text, url_f, :remote => true, :method => method, :id => "#{course.id}", :class => []+options
link_to text, url_f, :remote => true, :method => method, :id => "#{course.id}", :class => []+options
end
end

View File

@ -7,7 +7,7 @@ class Course < ActiveRecord::Base
STATUS_ARCHIVED = 9
attr_accessible :code, :extra, :name, :state, :tea_id, :time , :location, :state, :term, :password,:is_public,:description,:class_period, :open_student
belongs_to :project, :class_name => 'Course', :foreign_key => :extra, primary_key: :identifier
#belongs_to :project, :class_name => 'Course', :foreign_key => :extra, primary_key: :identifier
belongs_to :teacher, :class_name => 'User', :foreign_key => :tea_id # 定义一个方法teacher该方法通过tea_id来调用User表
belongs_to :school, :class_name => 'School', :foreign_key => :school_id #定义一个方法school该方法通过school_id来调用School表
has_many :bid
@ -29,9 +29,11 @@ class Course < ActiveRecord::Base
has_many :news, :dependent => :destroy, :include => :author
has_one :course_status, :class_name => "CourseStatus", :dependent => :destroy
has_many :course_groups, :dependent => :destroy
acts_as_taggable
acts_as_nested_set :order => 'name', :dependent => :destroy
acts_as_attachable :view_permission => :view_files,
acts_as_attachable :view_permission => :view_course_files,
:delete_permission => :manage_files
validates_presence_of :password, :term,:name,:description

View File

@ -0,0 +1,21 @@
class CourseGroup < ActiveRecord::Base
# attr_accessible :title, :body
belongs_to :course
has_many :members
has_many :memberships, :class_name => 'Member'
has_many :member_principals, :class_name => 'Member',
:include => :principal,
:conditions => "#{Principal.table_name}.type='Group' OR (#{Principal.table_name}.type='User' AND #{Principal.table_name}.status=#{Principal::STATUS_ACTIVE})"
has_many :principals, :through => :member_principals, :source => :principal
has_many :users, :through => :members
before_destroy :set_member_nil
attr_accessible :name
validates :name, :presence => true, :length => {:maximum => 20}, :uniqueness => true
def set_member_nil
if self.members && self.members.count > 0
self.members.update_all("course_group_id = 0")
end
end
end

View File

@ -24,6 +24,7 @@ class Member < ActiveRecord::Base
belongs_to :project
belongs_to :course
belongs_to :course_group
validates_presence_of :principal
validates_uniqueness_of :user_id, :scope => [:project_id,:course_id]
validate :validate_role

View File

@ -26,10 +26,11 @@ class Principal < ActiveRecord::Base
has_many :members, :foreign_key => 'user_id', :dependent => :destroy
has_many :memberships, :class_name => 'Member', :foreign_key => 'user_id', :include => [ :project, :roles ], :conditions => "#{Project.table_name}.status<>#{Project::STATUS_ARCHIVED}", :order => "#{Project.table_name}.name"
has_many :coursememberships, :class_name => 'Member', :foreign_key => 'user_id', :include => [ :course, :roles ], :conditions => "#{Course.table_name}.status<>#{Course::STATUS_ARCHIVED}", :order => "#{Course.table_name}.name"
has_many :coursememberships, :class_name => 'Member', :foreign_key => 'user_id', :include => [ :course, :roles ], :order => "#{Course.table_name}.name"
has_many :projects, :through => :memberships
#add by nwb
has_many :courses, :through => :coursememberships
has_many :course_groups, :through => :coursememberships
has_many :issue_categories, :foreign_key => 'assigned_to_id', :dependent => :nullify
# Groups and active users

View File

@ -690,6 +690,9 @@ class User < Principal
courses.to_a.include?(course)
end
def member_of_course_group?(course_group)
course_groups.to_a.include?(course_group)
end
# Returns a hash of user's projects grouped by roles
def projects_by_role
return @projects_by_role if @projects_by_role

View File

@ -68,7 +68,7 @@
</span>
<% end %>
<% end %>
<% if (User.current.admin?||User.current.id==bid.author_id) %>
<% if (User.current.admin?||User.current.allowed_to?(:as_teacher,@course)) %>
<% if bid.open_anonymous_evaluation == 1 && bid.homeworks.count >= 2%>
<span id="<%=bid.id %>_anonymous_comment" class="span_wping">
<% case bid.comment_status %>

View File

@ -58,53 +58,53 @@
{
hideModal($("#popbox"));
// 评了分的则刷新列表
switch (cur_type)
{
case 1:
$.ajax({
type: "GET",
url: "<%= get_not_batch_homework_homework_attach_index_path(:bid_id => @bid.id)%>&page=" + cur_page,
data: 'text',
success: function (data) {
}
});
break;
case 2:
$.ajax({
type: "GET",
url: "<%= get_batch_homeworks_homework_attach_index_path(:bid_id => @bid.id)%>&page=" + cur_page,
data: 'text',
success: function (data) {
}
});
break;
case 3:
$.ajax({
type: "GET",
url: "<%= get_homeworks_homework_attach_index_path(:bid_id => @bid.id)%>&page=" + cur_page,
data: 'text',
success: function (data) {
}
});
break;
case 4:
$.ajax({
type: "GET",
url: "<%= get_student_batch_homework_homework_attach_index_path(:bid_id => @bid.id)%>&page=" + cur_page,
data: 'text',
success: function (data) {
}
});
break;
case 5:
break;
default :
break;
}
// switch (cur_type)
// {
// case 1:
// $.ajax({
// type: "GET",
// url: "<%#= get_not_batch_homework_homework_attach_index_path(:bid_id => @bid.id)%>&page=" + cur_page,
// data: 'text',
// success: function (data) {
//
// }
// });
// break;
// case 2:
// $.ajax({
// type: "GET",
// url: "<%#= get_batch_homeworks_homework_attach_index_path(:bid_id => @bid.id)%>&page=" + cur_page,
// data: 'text',
// success: function (data) {
//
// }
// });
// break;
// case 3:
// $.ajax({
// type: "GET",
// url: "<%#= get_homeworks_homework_attach_index_path(:bid_id => @bid.id)%>&page=" + cur_page,
// data: 'text',
// success: function (data) {
//
// }
// });
// break;
// case 4:
// $.ajax({
// type: "GET",
// url: "<%#= get_student_batch_homework_homework_attach_index_path(:bid_id => @bid.id)%>&page=" + cur_page,
// data: 'text',
// success: function (data) {
//
// }
// });
// break;
// case 5:
// break;
// default :
// break;
// }
}
</script>
</div>

View File

@ -118,6 +118,9 @@
<div class="box tabular">
<%#= render :partial => 'homework_form', :locals => { :f => f } %>
<%= render :partial => 'homework_form', :locals => { :f => f } %>
<input type="button" onclick="submitHomework(<%= @bid.id%>);" value="<%= l(:button_create)%>" class="enterprise">
<!--<input type="button" onclick="submitHomework(<%#= @bid.id%>);" value="<%#= l(:button_create)%>" class="enterprise">-->
<a href="#" onclick="submitHomework(<%= @bid.id%>);" class="ButtonColor m3p10" >
<%= l(:button_create)%>
</a>
<% end %>
</div>

View File

@ -19,7 +19,7 @@
<%= form_for @message, :url => new_board_message_path(@board), :html => {:multipart => false, :id => 'message-form'} do |f| %>
<%= render :partial => 'messages/form', :locals => {:f => f} %>
<p>
<!--<input type="button" onclick="submitCoursesBoard();" class = "ButtonColor m3p10 h30" value="<%= l(:button_submit)%>">-->
<!--<input type="button" onclick="submitCoursesBoard();" class = "ButtonColor m3p10 h30" value="<%#= l(:button_submit)%>">-->
<a href="#" onclick="submitCoursesBoard();"class="ButtonColor m3p10"><%= l(:button_submit)%></a>
<%= link_to l(:button_cancel), "#", :onclick => '$("#add-message").hide(); return false;' ,:class => 'ButtonColor m3p10' %>
</p>

View File

@ -14,11 +14,13 @@
<div style="width: 80%; margin-left:10%;">
<%= form_for('new_form', :method => :post,
:url => {:controller => 'words', :action => 'leave_course_message'}) do |f|%>
<%= f.text_area 'course_message', :rows => 3, :cols => 65,
<%= f.text_area 'course_message',:id => "leave_meassge", :rows => 3, :cols => 65,
:placeholder => "#{l(:label_welcome_my_respond)}",
:style => "resize: none; width: 98%",
:class => 'noline',:maxlength => 250%>
<%= submit_tag l(:button_leave_meassge), :name => nil , :class => "enterprise" , :style => "display: block; float: right; margin-right: 1%; margin-top: 1px;"%>
<!--<%#= submit_tag l(:button_leave_meassge), :name => nil , :class => "enterprise" , :style => "display: block; float: right; margin-right: 1%; margin-top: 1px;"%>-->
<a href="#" onclick='$("#leave_meassge").parent().submit();' class="ButtonColor m3p10" style ="display: block; float: right; margin-right: 1%; margin-top: 1px;"> <%= l(:button_leave_meassge)%>
</a>
<% end %>
</div>
<% end %>

View File

@ -0,0 +1,84 @@
<script type=" text/javascript" charset="utf-8">
function validate_groupname(value1) {
if(value1.length > 20) {
alert('<%= l(:label_limit_groupname) %>');
}
}
function validate_groupname_null(value1) {
if(value1.length == 0) {
alert('<%= l(:label_limit_groupname_null) %>');
}
}
function validate_update(name) {
value1 = document.getElementById(name).value;
validate_groupname(value1);
}
function validate_add_group() {
value1 = document.getElementById('group_name').value;
validate_groupname(value1);
validate_groupname_null(value1);
}
</script>
<ul>
<li style=" color:#8b8b8b;">分班:</li>
<li class="classbox">
<% course_member_count = l(:label_all) + "(" + @membercount.to_s + "人)" %>
<%= form_tag( searchgroupmembers_course_path(@course, :group_id => 0), method: 'get',:remote=>true) do %>
<%= hidden_field_tag "all", params[:group_id], name: 'all' %>
<%= submit_tag course_member_count, :style => "background: #f8df8c; border:0px; color: black" %>
<% end %>
</li>
<% if course_groups.any? %>
<% course_groups.each do |group| %>
<% group_display = group.name + "(" + group.members.count.to_s + "人)" %>
<li class="classbox" id="group_name_<%= group.id %>">
<%= form_tag(searchgroupmembers_course_path(@course,:group_id => group.id), method: 'get', remote: true) do %>
<%#= text_field_tag "group_id", params[:group_id] %>
<%= submit_tag group_display, :onclick => "$asign_id(#{group.id})",:style => "background: #f8df8c; border:0px; color: black; float:left;"%>
<% if @canShowCode %>
<a href="javascript:void(0)" class="f_l" onclick="$('#add_tag_<%= group.id %>').slideToggle();"><img src="/images/pic_edit.png" width="14" height="15" alt="编辑班级" /></a>
<% end %>
<% end %>
</li>
<li>
<%= form_tag(updategroupname_course_path(@course,:group_id => group.id), method: 'get', remote:true, update: 'group_name') do %>
<span id="add_tag_<%= group.id %>" style="display:none; vertical-align: middle;" class=" f_l">
<%= text_field_tag "group_name#{group.id}", params[:group_name],:name => "group_name", :size=>10, :class=>"isTxt w90 f_l", :style=>"padding: 0px", :max => 20 %>
<!--<input type="button" class="submit f_l" onclick="addTag();" style="width: 43px"/>-->
<%= submit_tag '', class: "submit f_l", :onclick => "validate_update('group_name#{group.id}')", style: "width: 43px;height: 21px;background: url(/images/btn.png) no-repeat 0 0;" %>
</span>
<% end %>
</li>
<% end %>
<% end %>
<% if @canShowCode %>
<li style="margin-left:15px;">
<a href="javascript:void(0)" class="st_add f_l" onclick="$('#add_tag04').slideToggle();">+添加分班</a>
</li>
<li>
<span id="add_tag04" style="display:none; vertical-align: middle;" class="ml10 f_l">
<%= form_tag( addgroups_course_path(@course), method: 'get',:remote=>true) do %>
<%= text_field_tag "group_name", params[:group_name], size: "20", class: "isTxt w90 f_l", style: "padding: 0px", maxlength: "100" %>
<%= submit_tag '', class: "submit f_l",:onclick => "validate_add_group()", style: "width: 43px;height: 21px;background: url(/images/btn.png) no-repeat 0 0;" %>
<%= link_to_function '', "$('#add_tag04').slideToggle();", class: "submit_2", style: "width: 43px"%>
<% end %>
</span>
</li>
<% end %>
</ul>

View File

@ -1,4 +1,17 @@
<div >
<% if User.current.logged? && User.current.member_of_course?(@course) && @group %>
<% if !@canShowCode %>
<%= join_in_course_group(@course.course_groups,@group, User.current) %>
<% end %>&nbsp;&nbsp;&nbsp;
<span style="font-size: 18px"><%= @group.name %><%= @subPage_title %></span>
<% end %>
</div>
<% if members.any? %>
<% if @result_count %>
<p style="font-size: 18px;"><%= l(:label_search_member_count) %><%= @result_count %><%= l(:label_member_people) %></p>
<% end %>
<% members.each do |member| %>
<div class="well">
<% next if member.new_record? %>

View File

@ -1,5 +1,5 @@
<% if object_id%>
$("#<%=object_id%>").replaceWith('<%= escape_javascript join_in_course_for_list(course, user) %>');
$("#<%=object_id%>").replaceWith('<%= escape_javascript join_in_course(course, user) %>');
<% end %>
<% if @state %>
<% if @state == 0 %>

View File

@ -0,0 +1 @@
$("#st_groups").html("<%= escape_javascript( render :partial => 'groups_name', locals: {:course_groups => @course_groups})%>");

View File

@ -0,0 +1,2 @@
$("#st_groups").html("<%= escape_javascript( render :partial => 'groups_name', locals: {:course_groups => @course_groups})%>");
$("#member_content").html("<%= escape_javascript( render :partial => @render_file, :locals => {:members => @results})%>");

View File

@ -1,10 +1,28 @@
<div class="member_header">
<p>
<%= @subPage_title %>
</p>
</div>
<div class="member_content">
<%= error_messages_for 'member' %>
<%= render :partial => @render_file, :locals => {:members => @members} %>
<%= stylesheet_link_tag 'course_group', :media => 'all' %>
<script type="text/javascript" src="javascripts/jquery-1.8.3-ui-1.9.2-ujs-2.0.3.js"></script>
<div class="st_list">
<div class="st_search">
<span class="f_l"><%= @subPage_title %></span>
<% if @subPage_title == l(:label_student_list) %>
<%= form_tag( searchmembers_course_path(@course), method: 'get',:class => "f_l",:remote=>true) do %>
<%= text_field_tag 'name', params[:name], name: "name", :class => 'f_1'%>
<%= submit_tag l(:label_search), :class => "f_2"%>
<%#= link_to l(:label_search),'' , :class => 'f_2' %>
<% end %>
<% end %>
</div>
<div class="cl"></div>
<div class="st_addclass" id = "st_groups">
<%= render :partial => 'groups_name', locals: {:course_groups => @course_groups} %>
</div>
<div class="cl"></div>
<div class="member_content" id = "member_content">
<%= error_messages_for 'member' %>
<%= render :partial => @render_file, :locals => {:members => @members} %>
</div>
</div>

View File

@ -106,7 +106,8 @@
<%= labelled_form_for @homework, :url => {:controller => 'bids', :action => 'create_homework',:course_id => "#{params[:id] || params[:course_id]}"} do |f| %>
<div class="box tabular">
<%= render :partial => 'homework_form', :locals => { :f => f } %>
<input type="button" onclick="submitHomework();" value="<%= l(:button_create)%>" class="enterprise">
<!--<input type="button" onclick="submitHomework();" value="<%#= l(:button_create)%>" class="enterprise">-->
<a href="#" onclick="submitHomework();"class="ButtonColor m3p10"><%= l(:button_create)%></a>
<%= javascript_tag "$('#bid_name').focus();" %>
<% end %>
</div>

View File

@ -0,0 +1,4 @@
/**
* Created by Administrator on 2014/12/3.
*/
$("#member_content").html("<%= escape_javascript( render :partial => @render_file, :locals => {:members => @results})%>");

View File

@ -0,0 +1,4 @@
/**
* Created by Administrator on 2014/12/2.
*/
$("#member_content").html("<%= escape_javascript( render :partial => @render_file, :locals => {:members => @results})%>");

View File

@ -0,0 +1,2 @@
$("#st_groups").html("<%= escape_javascript( render :partial => 'groups_name', locals: {:course_groups => @course_groups})%>");
$("#member_content").html("<%= escape_javascript( render :partial => @render_file, :locals => {:members => @results})%>");

View File

@ -0,0 +1,4 @@
/**
* Created by Administrator on 2014/12/3.
*/
$("#st_groups").html("<%= escape_javascript( render :partial => 'groups_name', locals: {:course_groups => @course_groups})%>");

View File

@ -4,55 +4,60 @@
<%= stylesheet_link_tag 'resource', :media => 'all' %>
<script>
function show_upload()
{
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'upload_show',:locals => {:course => @course}) %>');
showModal('ajax-modal', '513px');
$('#ajax-modal').siblings().remove();
$('#ajax-modal').before("<span style='float: right;cursor:pointer;padding-left: 513px;'><a href='javascript:void(0)' onclick='closeModal()'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>");
$('#ajax-modal').parent().css("top","5").css("left","511");
}
function show_upload()
{
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'upload_show',:locals => {:course => @course}) %>');
showModal('ajax-modal', '513px');
$('#ajax-modal').siblings().remove();
$('#ajax-modal').before("<span style='float: right;cursor:pointer;padding-left: 513px;'><a href='javascript:void(0)' onclick='closeModal()'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>");
$('#ajax-modal').parent().css("top","5").css("left","511");
}
function closeModal()
{
hideModal($("#popbox_upload"));
}
function closeModal()
{
hideModal($("#popbox_upload"));
}
function presscss(id)
{
if(id == "incourse")
{
$('#incourse').attr("class", "re_schbtn b_dblue");
$('#insite').attr("class", "re_schbtn b_lblue");
}
else
{
$('#incourse').attr("class", "re_schbtn b_lblue");
$('#insite').attr("class", "re_schbtn b_dblue");
}
}
function presscss(id)
{
if(id == "incourse")
{
$('#incourse').attr("class", "re_schbtn b_dblue");
$('#insite').attr("class", "re_schbtn b_lblue");
}
else
{
$('#incourse').attr("class", "re_schbtn b_lblue");
$('#insite').attr("class", "re_schbtn b_dblue");
}
}
function buttoncss()
{
$('#incourse').attr("class", "re_schbtn b_lblue");
$('#insite').attr("class", "re_schbtn b_lblue");
}
</script>
<div class="container">
<div class="resource"><!--资源库内容开始--->
<div class="re_top">
<div class="resource"><!--资源库内容开始--->
<div class="re_top">
<%= form_tag( search_course_files_path(@course), method: 'get',:class => "re_search f_l",:remote=>true) do %>
<%= text_field_tag 'name', params[:name], name: "name", :class => 're_schbox',:style=>"padding: 0px"%>
<%= submit_tag "课内搜索", :class => "re_schbtn b_lblue",:name => "incourse",:id => "incourse", :onclick => "presscss('incourse')"%>
<%= submit_tag "全站搜索", :class => "re_schbtn b_lblue",:name => "insite",:id => "insite",:onclick => "presscss('insite')" %>
<%= submit_tag "课内搜索", :class => "re_schbtn b_lblue",:name => "incourse",:id => "incourse", :onmouseover => "presscss('incourse')",:onmouseout =>"buttoncss()" %>
<%= submit_tag "全站搜索", :class => "re_schbtn b_lblue",:name => "insite",:id => "insite",:onmouseover => "presscss('insite')",:onmouseout =>"buttoncss()" %>
<% end %>
<% if is_course_teacher(User.current,@course) %>
<a href="javascript:void(0)" class="re_fabu f_r b_lblue" onclick="show_upload()">上传资源</a>
<% end %>
</div><!---re_top end-->
<div class="cl"></div>
<% if is_course_teacher(User.current,@course) %>
<a href="javascript:void(0)" class="re_fabu f_r b_lblue" onclick="show_upload()">上传资源</a>
<% end %>
</div><!---re_top end-->
<div class="cl"></div>
<div class="re_con" id="course_list">
<%= render :partial => 'course_list',:locals => {course: @course,all_attachments: @all_attachments,sort:@sort,order:@order,curse_attachments:@curse_attachments} %>
</div><!---re_con end-->
<div class="re_con" id="course_list">
<%= render :partial => 'course_list',:locals => {course: @course,all_attachments: @all_attachments,sort:@sort,order:@order,curse_attachments:@curse_attachments} %>
</div><!---re_con end-->
</div>
</div>
</div>
<% html_title(l(:label_attachment_plural)) -%>

View File

@ -2,16 +2,15 @@
<div class="re_con_top">
<p class="f_l c_blue f_b f_14">共有&nbsp;<%= all_attachments.count%>&nbsp;个资源</p>
<p class="f_r" style="color: #808080">
<!--<#% if @order == "asc" %>
按&nbsp;<#%= link_to "时间",course_files_path(course,:sort=>"created_on:desc"),:class => "f_b c_grey" %><#%= render partial: 'arrow_show',locals: { sort: sort,order:order,current:"created_on"} %>&nbsp;/&nbsp;
<#%= link_to "下载次数",course_files_path(course,:sort=>"downloads:desc"),:class => "f_b c_grey" %><#%= render partial: 'arrow_show',locals: { sort: sort,order:order,current:"downloads"} %>&nbsp;/&nbsp;
<a href="#" class="f_b c_grey">引用次数</a>&nbsp;排序
<#%else%>
按&nbsp;<#%= link_to "时间",course_files_path(course,:sort=>"created_on:asc"),:class => "f_b c_grey" %><#%= render partial: 'arrow_show',locals: { sort: sort,order:order,current:"created_on"} %>&nbsp;/&nbsp;
<#%= link_to "下载次数",course_files_path(course,:sort=>"downloads:asc"),:class => "f_b c_grey" %><#%= render partial: 'arrow_show',locals: { sort: sort,order:order,current:"downloads"} %>&nbsp;/&nbsp;
<a href="#" class="f_b c_grey">引用次数</a>&nbsp;排序
<#% end %>-->
资源列表的多样化排序将在下周上线...
<% if order == "asc" %>
按&nbsp;<%= link_to "时间",params.merge(:sort=>"created_on:desc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'arrow_show',locals: { sort: sort,order:order,current:"created_on"} %>&nbsp;/&nbsp;
<%= link_to "下载次数",params.merge(:sort=>"downloads:desc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'arrow_show',locals: { sort: sort,order:order,current:"downloads"} %>&nbsp;/&nbsp;
<%= link_to "引用次数",params.merge(:sort=>"quotes:desc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'arrow_show',locals: { sort: sort,order:order,current:"quotes"} %>&nbsp;排序
<% else %>
按&nbsp;<%= link_to "时间",params.merge(:sort=>"created_on:asc"),:class => "f_b c_grey" ,:remote => @is_remote %><%= render partial: 'arrow_show',locals: { sort: sort,order:order,current:"created_on"} %>&nbsp;/&nbsp;
<%= link_to "下载次数",params.merge(:sort=>"downloads:asc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'arrow_show',locals: { sort: sort,order:order,current:"downloads"} %>&nbsp; /&nbsp;
<%= link_to "引用次数",params.merge(:sort=>"quotes:asc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'arrow_show',locals: { sort: sort,order:order,current:"quotes"} %>&nbsp;排序
<% end %>
</p>
</div>
<div class="cl"></div>
@ -21,7 +20,7 @@
<%= link_to_attachment file, :download => true,:text => truncate(file.filename,length: 35, omission: '...'), :title => file.filename+"\n"+file.description.to_s, :style => "overflow: hidden; white-space: nowrap;text-overflow: ellipsis;",:class => "c_dblue f_14 f_b f_l" %>
<% if User.current.logged? %>
<% if is_course_teacher(User.current,@course) && file.author_id == User.current.id %>
<%= link_to("选入我的其他课程",quote_resource_show_course_file_path(@course,file),:class => "f_l re_select",:remote => true) if has_course?(User.current) %>
<%= link_to("选入我的其他课程",quote_resource_show_course_file_path(@course,file),:class => "f_l re_select",:remote => true) if has_course?(User.current,file) %>
<% if delete_allowed && file.container_id == @course.id && file.container_type == "Course" %>
<span id="is_public_<%= file.id %>">
@ -31,7 +30,7 @@
<!-- <#%= link_to (file.is_public? ? "公开":"私有"),"javascript:void(0)",:class=>"f_l re_open" %> -->
<% end %>
<% else %>
<%= link_to("选入我的课程",quote_resource_show_course_file_path(@course,file),:class => "f_l re_select",:remote => true) if has_course?(User.current) %>
<%= link_to("选入我的课程",quote_resource_show_course_file_path(@course,file),:class => "f_l re_select",:remote => true) if has_course?(User.current,file) %>
<% end %>
<% else %>
<% end %>
@ -41,7 +40,7 @@
<p class="f_l c_grey02 font">文件大小:<%= number_to_human_size(file.filesize) %></p>
<%= link_to( l(:button_delete), attachment_path(file),
:data => {:confirm => l(:text_are_you_sure)}, :method => :delete,:class => "f_r re_de") if delete_allowed && file.container_id == @course.id && file.container_type == "Course"%>
<p class="f_r c_grey02" ><%= time_tag(file.created_on).html_safe %><%= l(:label_bids_published_ago) %>&nbsp;&nbsp;|&nbsp;&nbsp;下载<%= file.downloads %>&nbsp;&nbsp;|&nbsp;&nbsp;引用<%= get_qute_number file %> </p>
<p class="f_r c_grey02" ><%= time_tag(file.created_on).html_safe %><%= l(:label_bids_published_ago) %>&nbsp;&nbsp;|&nbsp;&nbsp;下载<%= file.downloads %>&nbsp;&nbsp;|&nbsp;&nbsp;引用<%= file.quotes.nil? ? 0:file.quotes %> </p>
</div>
<div class="cl"></div>
<div class="tag_h">

View File

@ -1 +1 @@
$("#course_list").html("<%= escape_javascript(render :partial => 'course_list',:locals => {course: @course,all_attachments: @result,sort:"create_on",order:"",curse_attachments:@searched_attach})%>");
$("#course_list").html("<%= escape_javascript(render :partial => 'course_list',:locals => {course: @course,all_attachments: @result,sort:@sort,order:@order,curse_attachments:@searched_attach})%>");

View File

@ -1,35 +1,4 @@
<style>
input[type="submit"].bid_btn {
vertical-align: middle;
width: 60px;/*modified by ming*/
height: 25px;
line-height: 19px;
font-size: 14px;
color: rgb(0, 0, 0);
background: buttonface;/*url("/images/button/bg103.jpg") no-repeat scroll left top transparent;*/
padding: 0px 0px 4px 0px;
border-radius: 2px;
border: 1px solid rgb(148, 148, 148);
box-shadow: none;
text-shadow: none;
margin-top: -10px;
/*margin-right: -4px;*/
}
input[type="button"].bid_btn {
width: 60px;/*modified by ming*/
height: 25px;
line-height: 19px;
font-size: 14px;
color: rgb(0, 0, 0);
background: buttonface;/*url("/images/button/bg103.jpg") no-repeat scroll left top transparent;*/
padding: 0px 0px 4px 0px;
border-radius: 2px;
border: 1px solid rgb(148, 148, 148);
box-shadow: none;
text-shadow: none;
margin-top: -10px;
margin-right: -2px;
}
textarea:focus {
border: #d5dee9 1px solid;
}
@ -50,8 +19,10 @@
}
}
function submit1(button)
function submit1(is_teacher)
{
if($("#stars_value").val() == "0"){alert("您还没有打分");return;}
if(!is_teacher&&$("#new_form_user_message").val() == ""){alert("您还没有填写评语");return;}
$('#jours_submit').parent().submit();
}
</script>
@ -59,23 +30,32 @@
<%= form_for('new_form', :remote => true, :method => :post,
:url => {:controller => 'homework_attach',
:action => 'addjours',
:jour_id => homework_attach.id,
:is_comprehensive_evaluation => is_comprehensive_evaluation,
:sta => sta}) do |f|%>
<div id = 'pre_show'>
<%= render :partial => 'words/pre_show', :locals => {:content => @content} %>
:homework_id => homework_attach.id,
:cur_page => cur_page,
:cur_type => cur_type,
:is_anonymous_comments => @is_anonymous_comments,
:is_teacher => @is_teacher
}) do |f|%>
<!-- 打分 -->
<div class="ping_star" id="star_score">
<% if @is_anonymous_comments || @is_teacher %>
<!-- 学生匿评或者教师评价 -->
<%= l(:label_work_rating) %>
<%= render :partial => 'show_star',:locals => {start_score:m_score} %>
<% end %>
</div>
<div class="cl"></div>
<!-- 打分js结束 -->
<% if User.current.logged? %>
<%= f.text_area 'user_message', :rows => 3, :cols => 65,
:style => "resize: none;", :class => 'noline', :placeholder => l(:text_caracters_maximum,:count=>250),
:maxlength => 250
%>
:maxlength => 250 %>
<%= f.text_field :reference_user_id, :style=>"display:none"%>
<div style="float:right">
<a href="#" class="ping_sub1" id="jours_submit" onclick="submit1();"><%= l(:label_submit_comments) %></a>
<a href="#" class="ping_sub1" id="jours_submit" onclick="submit1(<%= @is_teacher%>);">
<%= l(:label_confirmation) %>
</a>
</div>
<% else %>
<div style="font-size: 14px;margin:10px;text-align: center">

View File

@ -1,25 +1,45 @@
<div class="ping_list">
<div id="ping_tb_" class="ping_tb_">
<ul>
<li id="ping_tb_4" class="ping_normaltab" onclick="i:HoverLi(4);">
<%= l(:label_teacher_comments) %><span class="c_red" id="jour_count_4"><%= @comprehensive_evaluation.nil? ? 0 : @comprehensive_evaluation.count %></span></li>
<li id="ping_tb_5" class="ping_normaltab" onclick="i:HoverLi(5);">
<%= l(:label_anonymous_comments) %><span class="c_red" id="jour_count_5" ><%= @anonymous_comments.nil? ? 0 : @anonymous_comments.count %></span></li>
<li id="ping_tb_3" class="ping_hovertab" onclick="x:HoverLi(3);">
<%= l(:label_responses) %><span class="c_red" id="jour_count_3"><%= @jours.nil? ? 0 : @jours.count %></span></li>
<li id="ping_tb_4" class="ping_normaltab" onclick="HoverLi(4);">
<%= l(:label_teacher_comments) %>
<span class="c_red" id="jour_count_4">
<%= @teacher_stars.count %>
</span>
</li>
<li id="ping_tb_5" class="ping_normaltab" onclick="HoverLi(5);">
<%= l(:label_anonymous_comments) %>
<span class="c_red" id="jour_count_5" >
<%= @student_stars.count %>
</span>
</li>
<li id="ping_tb_3" class="ping_hovertab" onclick="HoverLi(3);">
<%= l(:label_responses) %>
<span class="c_red" id="jour_count_3">
<%= @obj_count %>
</span>
</li>
</ul>
</div>
<div class="cl"></div>
<div class="ping_ctt">
<div class="ping_dis" id="tbc_03">
<%= render :partial => 'homework_attach/jour',:locals => {:jours => @jour,:show_score => false,:show_name => true,:is_jour => true} %>
<!-- 留言列表 -->
<%= render :partial => 'homework_attach/jour',:locals => {:jours => @jour, :obj_pages => @obj_pages, :obj_count => @obj_count, :homework => @homework} %>
</div>
<div class="ping_undis" id="tbc_04">
<%= render :partial => 'homework_attach/jour',:locals => {:jours => @comprehensive_evaluation,:show_score => true,:show_name => true,:is_jour => false} %>
<!-- 老师评价列表 -->
<%= render :partial => 'homework_attach/review',:locals => {:review_list => @teacher_stars,:show_name => true,:show_jour => true} %>
</div>
<div class="ping_undis" id="tbc_05">
<%= render :partial => 'homework_attach/jour',:locals => {:jours => @anonymous_comments,:show_score => true,:show_name => false,:is_jour => false} %>
<!-- 学生匿评列表 -->
<%= render :partial => 'homework_attach/review',:locals => {:review_list => @student_stars,:show_name => false || @is_teacher, :show_jour => false} %>
</div>
</div>
</div><!---ping_list end--->

View File

@ -1,3 +1,4 @@
<% bid = homework.bid%>
<li class="pic_head" style="line-height: 1.2;">
<% if is_student_batch_homework %>
<!-- 学生匿评 不现实姓名、头像,以及相关的连接 -->
@ -46,7 +47,7 @@
<!-- 是老师,所有列表正常显示 -->
<li class="wping">
<%= link_to l(:label_work_rating),homework_attach_path(homework,:cur_page => @cur_page,:cur_type => @cur_type),:remote => true %>
<% if Time.parse(@bid.deadline.to_s).strftime("%Y-%m-%d") < Time.parse(homework.created_at.to_s).strftime("%Y-%m-%d") %>
<% if Time.parse(bid.deadline.to_s).strftime("%Y-%m-%d") < Time.parse(homework.created_at.to_s).strftime("%Y-%m-%d") %>
<span class="c_red">&nbsp;&nbsp;迟交!</span>
<% end %>
</li>
@ -54,7 +55,7 @@
<!-- 是学生 -->
<% if is_my_homework %>
<!-- 我的作品,在未开启匿评和未使用匿评,显示为编辑和删除 -->
<% if @bid.comment_status == 0 || @bid.open_anonymous_evaluation == 0 %>
<% if bid.comment_status == 0 || bid.open_anonymous_evaluation == 0 %>
<li class="wmine">
<%= link_to l(:button_edit), edit_homework_attach_path(homework) %>
<% if homework.user == User.current || User.current.admin? %>
@ -85,21 +86,21 @@
<% end %>
<% elsif is_student_batch_homework%>
<!-- 学生匿评列表 -->
<% if @bid.comment_status == 1 %>
<% if bid.comment_status == 1 %>
<!-- 处于开启匿评阶段,可以正常评分 -->
<li class="wping">
<%= link_to l(:label_anonymous_comments),homework_attach_path(homework,:cur_page => @cur_page,:cur_type => @cur_type),:remote => true %>
<% if Time.parse(@bid.deadline.to_s).strftime("%Y-%m-%d") < Time.parse(homework.created_at.to_s).strftime("%Y-%m-%d") %>
<% if Time.parse(bid.deadline.to_s).strftime("%Y-%m-%d") < Time.parse(homework.created_at.to_s).strftime("%Y-%m-%d") %>
<span class="c_red">&nbsp;&nbsp;迟交!</span>
<% end %>
</li>
<% elsif @bid.comment_status == 2%>
<% elsif bid.comment_status == 2%>
<!-- 处于匿评已关闭阶段,不容许评分 -->
<li class="wping" title="关闭匿评后不可继续评分">
<a style="background:#8e8e8e;">
<%= l(:label_anonymous_comments) %>
</a>
<% if Time.parse(@bid.deadline.to_s).strftime("%Y-%m-%d") < Time.parse(homework.created_at.to_s).strftime("%Y-%m-%d") %>
<% if Time.parse(bid.deadline.to_s).strftime("%Y-%m-%d") < Time.parse(homework.created_at.to_s).strftime("%Y-%m-%d") %>
<span class="c_red">&nbsp;&nbsp;迟交!</span>
<% end %>
</li>

View File

@ -1,61 +1,50 @@
<% jours.nil? || jours.count == 0 || jours.each do |jour| %>
<div class="ping_C">
<div class="ping_dispic">
<% if show_name %>
<%= link_to image_tag(url_to_avatar(jour.user)) , user_path(jour.user), :target =>"_blank" %>
<% else %>
<a><%= image_tag(url_to_avatar(nil))%></a>
<% end %>
</div>
<div class="ping_discon">
<div class="ping_distop">
<span>
<% if show_name %>
<%= link_to jour.user, user_path(jour.user),:style => " font-weight:bold; color:#15bccf; margin-right:30px; background:none;", :target => "_blank"%>
<% else%>
<span style=" font-weight:bold; color:#15bccf; margin-right:30px; background:none;"><%= l(:label_anonymous) %></span>
<% end %>
</span>
<span style="color:#a6a6a6; margin-right:20px; margin-left:10px;"><%= format_time(jour.created_on) %></span>
<span style="font-weight:bold; color:#a6a6a6; ">
<% if show_score %>
<span style="float:left">
<%= l(:label_work_rating) %>
</span>
<%= render :partial => 'homework_attach/show_score', locals: {:stars => get_homework_score(jour.user,@homework ) } %>
<% end %>
</span>
<div class="cl"></div>
<p><%= textilizable jour.notes%></p>
</div>
<div class="ping_disfoot">
<% ids = 'project_respond_form_'+ jour.id.to_s%>
<span>
<% if (jour.user==User.current|| User.current.admin?) && show_name %>
<%= link_to(l(:label_bid_respond_delete), {:controller => 'homework_attach', :action => 'destroy_jour', :object_id => jour, :user_id => jour.user,:jour_id =>@homework.id },
<% unless jours.nil?%>
<% jours.each do |jour| %>
<div class="ping_C">
<div class="ping_dispic">
<%= link_to image_tag(url_to_avatar(jour.user)) , user_path(jour.user), :target =>"_blank" %>
</div>
<div class="ping_discon">
<div class="ping_distop">
<span>
<%= link_to jour.user, user_path(jour.user),:style => " font-weight:bold; color:#15bccf; margin-right:5px; background:none;", :target => "_blank"%>
</span>
<span style="color:#a6a6a6; margin-right:30px; margin-left:10px;">
<%= format_time(jour.created_on) %>
</span>
<div class="cl"></div>
<p><%= textilizable jour.notes%></p>
</div>
<div class="ping_disfoot">
<% ids = 'project_respond_form_'+ jour.id.to_s%>
<span>
<% if jour.user==User.current|| User.current.admin? %>
<%= link_to(l(:label_bid_respond_delete), {:controller => 'homework_attach', :action => 'destroy_jour',
:object_id => jour,
:user_id => jour.user,
:homework_id =>homework.id },
:remote => true, :confirm => l(:text_are_you_sure), :title => l(:button_delete)) %>
<% end %>
<%= link_to l(:label_projects_feedback_respond),'',
{:focus => 'project_respond', :onclick => "toggleAndSettingWordsVal($('##{ids}'), $('##{ids} textarea'), ''); $('##{ids} textarea') ;return false;"} ##{l(:label_reply_plural)} #{jour.user.name}:
%>
<%= link_to l(:label_projects_feedback_respond),'',
{:focus => 'project_respond', :onclick => "toggleAndSettingWordsVal($('##{ids}'), $('##{ids} textarea'), ''); $('##{ids} textarea') ;return false;"}
%>
</span>
</div>
<div id='<%= ids %>' class="respond-form">
<%= render :partial => 'words/new_respond', :locals => {:journal => jour, :m_reply_id => jour,:show_name=> show_name} %>
</div>
<div style="clear: both;"></div>
<div>
<%= render :partial => "words/journal_reply", :locals => {:journal => jour,:show_name=> show_name} %>
</div>
</div>
<div class="cl"></div>
</div>
<div class="cl"></div>
<% end %>
<% if is_jour%>
</div>
<div id='<%= ids %>' class="respond-form">
<%= render :partial => 'words/new_respond', :locals => {:journal => jour, :m_reply_id => jour,:show_name=> true} %>
</div>
<div style="clear: both;"></div>
<div>
<%= render :partial => "words/journal_reply", :locals => {:journal => jour,:show_name=> true} %>
</div>
</div>
<div class="cl"></div>
</div>
<div class="cl"></div>
<% end %>
<div class="dis">
<ul class="wlist"><%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => true, :flag => true%></ul>
<ul class="wlist">
<%= pagination_links_full obj_pages, obj_count, :per_page_links => false, :remote => true, :flag => true%>
</ul>
</div>
<% end %>

View File

@ -0,0 +1,61 @@
<!-- 评论列表,包括老师评论和学生匿评 -->
<% unless review_list.nil?%>
<% review_list.each do |review|%>
<% user = review.rater %>
<% jour = get_homework_review @homework,show_jour,user %>
<div class="ping_C">
<div class="ping_dispic">
<% if show_name %>
<%= link_to image_tag(url_to_avatar(user)) , user_path(user), :target =>"_blank" %>
<% else %>
<a><%= image_tag(url_to_avatar(nil))%></a>
<% end %>
</div>
<div class="ping_discon">
<div class="ping_distop">
<span>
<% if show_name %>
<%= link_to user, user_path(user),:style => " font-weight:bold; color:#15bccf; margin-right:5px; background:none;", :target => "_blank"%>
<% else%>
<span style=" font-weight:bold; color:#15bccf; margin-right:5px; background:none;">
<%= l(:label_anonymous) %>
</span>
<% end %>
</span>
<span style="color:#a6a6a6; margin-right:30px; margin-left:10px;">
<%= format_time(review.created_at) %>
</span>
<span style="font-weight:bold; color:#a6a6a6; float: right;">
<span style="float:left">
<%= l(:label_work_rating) %>
</span>
<div class="ping_star">
<%= render :partial => 'homework_attach/show_static_star', :locals => {:start_score => review.stars } %>
</div>
</span>
<div class="cl"></div>
<p><%= textilizable jour.nil? ? "" : jour.notes%></p>
</div>
<% unless jour.nil? %>
<% ids = 'project_respond_form_'+ jour.id.to_s%>
<div class="ping_disfoot">
<span>
<%= link_to l(:label_projects_feedback_respond),'',
{:focus => 'project_respond', :onclick => "toggleAndSettingWordsVal($('##{ids}'), $('##{ids} textarea'), ''); $('##{ids} textarea') ;return false;"}
%>
</span>
</div>
<div id='<%= ids %>' class="respond-form">
<%= render :partial => 'words/new_respond', :locals => {:journal => jour, :m_reply_id => jour,:show_name=> show_name} %>
</div>
<div style="clear: both;"></div>
<div>
<%= render :partial => "words/journal_reply", :locals => {:journal => jour,:show_name=> show_name} %>
</div>
<% end %>
</div>
<div class="cl"></div>
</div>
<div class="cl"></div>
<% end %>
<% end %>

View File

@ -1,59 +1,24 @@
<% reply_allow = JournalsForMessage.create_by_user? User.current %>
<%# reply_allow = JournalsForMessage.create_by_user? User.current %>
<script type="text/javascript" language="javascript">
var W3CDOM = document.createElement && document.getElementsByTagName;
// window.onload = setMaxLength;
$(document).ready(setMaxLength());
function setMaxLength() {
if (!W3CDOM) return;
var textareas = document.getElementsByTagName('textarea');
for (var i=0;i<textareas.length;i++) {
var textarea = textareas[i];
setMaxLengthItem(textareas[i]);
}
}
function setMaxLengthItem(textarea){
if (textarea.getAttribute('maxlength')) {
var counter = document.createElement('div');
counter.className = 'counter';
var counterClone = counter.cloneNode(true);
counterClone.innerHTML = '<span>0</span>/'+textarea.getAttribute('maxlength');
textarea.parentNode.insertBefore(counterClone,textarea.nextSibling);
textarea.relatedElement = counterClone.getElementsByTagName('span')[0];
textarea.onkeyup = textarea.onchange = checkMaxLength;
textarea.onkeyup();
}
function g(o){return document.getElementById(o);}
function HoverLi(n){
for(var i=3;i<=5;i++){g('ping_tb_'+i).className='ping_normaltab';g('tbc_0'+i).className='ping_undis';}g('tbc_0'+n).className='ping_dis';g('ping_tb_'+n).className='ping_hovertab';
}
function checkMaxLength() {
var maxLength = this.getAttribute('maxlength');
var currentLength = this.value.length;
if (currentLength > maxLength)
this.relatedElement.className = 'toomuch';
else
this.relatedElement.className = '';
this.relatedElement.firstChild.nodeValue = currentLength;
function ChoseStars(num)
{
for (var i = num + 1; i <= 5; i++) {$("#star0" + i).css("background-position","-2px 0");}
for (var i = num; i >= 0; i--) {$("#star0" + i).css("background-position","-24px 0px");}
$("#stars_value").val(num);
}
function test(){alert('test');}
//<!CDATA[
function g(o){return document.getElementById(o);}
function HoverLi(n){
//如果有N个标签,就将i<=N;
for(var i=3;i<=5;i++){g('ping_tb_'+i).className='ping_normaltab';g('tbc_0'+i).className='ping_undis';}g('tbc_0'+n).className='ping_dis';g('ping_tb_'+n).className='ping_hovertab';
}
//如果要做成点击后再转到请将<li>中的onmouseover 改成 onclick;
//]]>
</script>
<%= javascript_include_tag 'seems_rateable/jRating', 'seems_rateable/rateable'%>
<div id="popbox">
<div class="ping_con">
<h2><%= @homework.name %></h2>
<ul>
<li><%= l(:label_create_person) %>
<span class="c_grey">
<% if @is_anonymous_comments && @is_comprehensive_evaluation != 1 %>
<% if @is_anonymous_comments %>
<%= l(:label_anonymous) %>
<% else %>
<%= link_to @homework.user, user_path(@homework.user)%>
@ -72,7 +37,7 @@
<% if @homework.users.count > 0 %>
<div>
<%= l(:label_participation_person) %>
<% if @is_anonymous_comments && @is_comprehensive_evaluation != 1 %>
<% if @is_anonymous_comments %>
<%= l(:label_anonymous) %>
<%else%>
<% @homework.users.each do |homework_user| %>
@ -111,19 +76,16 @@
<% end%>
</span>
</p>
<div class="ping_star" id="star_score">
<%= render :partial => 'show_star',:locals => {:is_comprehensive_evaluation => @is_comprehensive_evaluation,:totle_score => @totle_score,:has_evaluation => @has_evaluation ,
:homework => @homework} %>
</div>
<div class="cl"></div>
<div id="add_jour">
<%= render :partial => 'addjour', :locals => {:homework_attach => @homework, :sta => 0, :is_comprehensive_evaluation => @is_comprehensive_evaluation} %>
<%= render :partial => 'addjour', :locals => {:homework_attach => @homework,
:m_score => @m_score,
:cur_page => @cur_page,
:cur_type => @cur_type,
:is_teacher => @is_teacher} %>
</div>
<div class="cl"></div>
</div><!---ping_con end--->
<%= render :partial => 'histoey_new' %>
</div>
</div>

View File

@ -1,16 +1,6 @@
<% if is_comprehensive_evaluation == 3 || User.current == homework.user%>
<!-- <#%= l(:label_work_rating) %>
<%#= render :partial => 'show_score', locals: {:stars => totle_score} %> -->
<% elsif is_comprehensive_evaluation == 2 %>
<% if has_evaluation %>
<%= l(:label_work_rating) %>
<%= rating_for homework, dimension: :quality,start_score: @m_score, class: 'rateable div_inline' %>
<% else %>
<%= l(:label_work_rating) %>
<%= rating_for homework, dimension: :quality,start_score: 0, class: 'rateable div_inline' %>
<% end %>
<% elsif @is_comprehensive_evaluation == 1%>
<%= l(:label_work_rating) %>
<%= rating_for homework, dimension: :quality,start_score: @m_score, class: 'rateable div_inline' %>
<% end %>
<span><a href="#" id="star05" onclick="ChoseStars(5)" style="background-position:<%= start_score>=5 ? '-24px 0px;':'-2px 0'%>"></a></span>
<span><a href="#" id="star04" onclick="ChoseStars(4)" style="background-position:<%= start_score>=4 ? '-24px 0px;':'-2px 0'%>"></a></span>
<span><a href="#" id="star03" onclick="ChoseStars(3)" style="background-position:<%= start_score>=3 ? '-24px 0px;':'-2px 0'%>"></a></span>
<span><a href="#" id="star02" onclick="ChoseStars(2)" style="background-position:<%= start_score>=2 ? '-24px 0px;':'-2px 0'%>"></a></span>
<span><a href="#" id="star01" onclick="ChoseStars(1)" style="background-position:<%= start_score>=1 ? '-24px 0px;':'-2px 0'%>"></a></span>
<input type="hidden" value="<%= start_score%>" id="stars_value" name="stars_value"/>

View File

@ -0,0 +1,5 @@
<span><a href="#" id="star05" style="background-position:<%= start_score>=1 ? '-24px 0px;':'-2px 0'%>"></a></span>
<span><a href="#" id="star04" style="background-position:<%= start_score>=2 ? '-24px 0px;':'-2px 0'%>"></a></span>
<span><a href="#" id="star03" style="background-position:<%= start_score>=3 ? '-24px 0px;':'-2px 0'%>"></a></span>
<span><a href="#" id="star02" style="background-position:<%= start_score>=4 ? '-24px 0px;':'-2px 0'%>"></a></span>
<span><a href="#" id="star01" style="background-position:<%= start_score>=5 ? '-24px 0px;':'-2px 0'%>"></a></span>

View File

@ -1,19 +1,31 @@
//教师评论
<% if @add_jour.is_comprehensive_evaluation == 1 %>
HoverLi(4);
$('#jour_count_4').html('<%= @comprehensive_evaluation.count %>');
$('#tbc_04').html('<%= escape_javascript(render(:partial => 'homework_attach/jour',:locals => {:jours => @comprehensive_evaluation,:show_score => true,:show_name => true,:is_jour => false})) %>');
<% if @is_teacher %>
HoverLi(4);
$('#jour_count_4').html('<%= @teacher_stars.count %>');
$('#tbc_04').html('<%= escape_javascript(render(:partial => 'homework_attach/review',:locals => {:review_list => @teacher_stars,:show_name => true,:show_jour => true})) %>');
//匿评
<% elsif @add_jour.is_comprehensive_evaluation == 2 %>
$('#add_jour').html('<%= escape_javascript(render(:partial => 'addjour', :locals => {:homework_attach => @homework, :sta => 0, :is_comprehensive_evaluation => @is_comprehensive_evaluation})) %>');
HoverLi(5);
$('#jour_count_5').html('<%= @anonymous_comments.count %>');
$('#tbc_05').html('<%= escape_javascript(render(:partial => 'homework_attach/jour',:locals => {:jours => @anonymous_comments,:show_score => true,:show_name => false,:is_jour => false})) %>');
<% elsif @is_anonymous_comments %>
HoverLi(5);
$('#jour_count_5').html('<%= @student_stars.count %>');
$('#tbc_05').html('<%= escape_javascript(render(:partial => 'homework_attach/review',:locals => {:review_list => @student_stars,:show_name => false || @is_teacher, :show_jour => false})) %>');
//留言
<% else %>
HoverLi(3);
$('#jour_count_3').html('<%= @jours.count %>');
$('#tbc_03').html('<%= escape_javascript(render(:partial => 'homework_attach/jour',:locals => {:jours => @jour,:show_score => false,:show_name => true,:is_jour => true})) %>');
HoverLi(3);
$('#jour_count_3').html('<%= @obj_count %>');
$('#tbc_03').html('<%= escape_javascript(render(:partial => 'homework_attach/jour',:locals => {:jours => @jour, :obj_pages => @obj_pages, :obj_count => @obj_count,:homework => @homework})) %>');
<% end %>
$('#new_form_user_message').val("");
$('#new_form_reference_user_id').val("");
$('#new_form_reference_user_id').val("");
<% if @is_anonymous_comments || @is_teacher %>
<% if @cur_type == "1" %>
$("#tbc_01").html('<%= escape_javascript(render(:partial => 'homework_attach/homeworks_list',:locals => {:homeworks => @homework_list,
:homework_count => @obj_count,
:remote => false,:is_student_batch_homework => false})) %>');
<% elsif @cur_type == "2" || @cur_type == "3" || @cur_type == "4" %>
$("#homework_li_<%= @homework.id%>").html('<%= escape_javascript(render(:partial => 'homework_attach/homework',:locals => {:homework => @result_homework || @homework,
:is_student_batch_homework => @is_student_batch_homework || false,
:is_my_homework => false, :is_teacher => @is_teacher})) %>');
<% end %>
<% end %>

View File

@ -1,19 +1,8 @@
<% if @journal_destroyed.nil? %>
alert('<%=l(:notice_failed_delete)%>');
<% else %>
<% if @is_comprehensive_evaluation == 1 %>
HoverLi(4);
$('#jour_count_4').html('<%= @comprehensive_evaluation.count %>');
$('#tbc_04').html('<%= escape_javascript(render(:partial => "homework_attach/jour",:locals => {:jours => @comprehensive_evaluation,:show_score => true,:show_name => true,:is_jour => false})) %>');
//匿评
<% elsif @is_comprehensive_evaluation == 2 %>
HoverLi(5);
$('#jour_count_5').html('<%= @anonymous_comments.count %>');
$('#tbc_05').html('<%= escape_javascript(render(:partial => "homework_attach/jour",:locals => {:jours => @anonymous_comments,:show_score => true,:show_name => false,:is_jour => false})) %>');
//留言
<% else %>
HoverLi(3);
$('#jour_count_3').html('<%= @jours.count %>');
$('#tbc_03').html('<%= escape_javascript(render(:partial => "homework_attach/jour",:locals => {:jours => @jour,:show_score => false,:show_name => true,:is_jour => true})) %>');
<% end %>
//只有留言才能被删除
HoverLi(3);
$('#jour_count_3').html('<%= @obj_count %>');
$('#tbc_03').html('<%= escape_javascript(render(:partial => "homework_attach/jour",:locals => {:jours => @jour, :obj_pages => @obj_pages, :obj_count => @obj_count, :homework => @homework})) %>');
<% end %>

View File

@ -1,11 +1,10 @@
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'show',:locals => {:comprehensive_evaluation => @comprehensive_evaluation,:homework => @homework, :teaher_score => @teaher_score}) %>');
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'show') %>');
showModal('ajax-modal', '513px');
$('#ajax-modal').css('height','569px');
$('#ajax-modal').siblings().remove();
$('#ajax-modal').before("<span style='float: right;cursor:pointer;padding-left: 513px;'>" +
"<a href='#' onclick='hidden_homework_atert_form("+
<%= @cur_page%> + "," + <%= @cur_type%> +
");'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>");
"<a href='#' onclick='hidden_homework_atert_form();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>");
$('#ajax-modal').parent().removeClass("alert_praise");
$('#ajax-modal').parent().css("top","").css("left","");
$('#ajax-modal').parent().addClass("alert_box");

View File

@ -117,7 +117,7 @@
<div class="inf_user_image">
<table>
<% if (User.current.admin?||User.current.id==@bid.author_id) %>
<% if (User.current.admin?||User.current.allowed_to?(:as_teacher,course)) %>
<tr>
<td valign="top" style="padding-left: 8px; font-size: 15px" colspan="2">
<% if @bid.open_anonymous_evaluation == 1 && @bid.homeworks.count >= 2%>

View File

@ -189,7 +189,7 @@
<div id="introduction" style="display: none">
<%= form_for('new_form', :method => :post,
:url => {:controller => 'words', :action => 'add_brief_introdution'}) do |f|%>
<table border="0" width="100%" align="center" >
<table border="0" width="96%" align="center" id="my_brief_introduction">
<tr>
<td>
<%= f.text_area 'user_introduction', :rows => 3,
@ -203,8 +203,11 @@
<table border="0" width="200px" align="center">
<tr>
<td align="right">
<%= submit_tag l(:button_submit), :name => nil ,
<%#= submit_tag l(:button_submit), :name => nil ,
:class => "bid_btn" %>
<a href="#" onclick='$("#my_brief_introduction").parent().submit();' class="ButtonColor m3p10" >
<%= l(:label_submit)%>
</a>
</td>
</tr>
</table>

View File

@ -69,9 +69,9 @@
:html => { :id => 'news-form', :multipart => true, :method => :put } do |f| %>
<%= render :partial => 'course_form', :locals => { :f => f, :is_new => false } %>
<%#= submit_tag l(:button_save) %>
<%= link_to l(:button_save), "#", :onclick => 'submitNews();',:onmouseover => 'this.focus()',:class => 'whiteButton m3p10' %>
<%= link_to l(:button_save), "#", :onclick => 'submitNews();',:onmouseover => 'this.focus()',:class => 'ButtonColor m3p10' %>
<%#= preview_link preview_news_path(:course_id => @course, :id => @news), 'news-form',target='preview',{:class => 'whiteButton m3p10'} %>
<%= link_to l(:button_cancel), "#", :onclick => '$("#edit-news").hide(); return false;',:class => 'whiteButton m3p10' %>
<%= link_to l(:button_cancel), "#", :onclick => '$("#edit-news").hide(); return false;',:class => 'ButtonColor m3p10' %>
<% end %>
<div id="preview" class="wiki"></div>
</div>

View File

@ -18,8 +18,12 @@
<%= form_tag( users_search_path, :method => :get, :id => 'search_user_form') do %>
<table width="940px">
<tr>
<td class="info_font" style="width: 220px; color: #15bccf" ><%= l(:label_software_user ) %></td>
<td class="location-list"><strong><%= l(:label_user_location) %> :</strong></td>
<td class="info_font" style="width: 220px; color: #15bccf" rowspan="2">
<%= l(:label_software_user ) %>
</td>
<td class="location-list">
<strong><%= l(:label_user_location) %> :</strong>
</td>
<td rowspan="2">
</td>
<td rowspan="2" >
@ -35,8 +39,10 @@
</td>
</tr>
<tr>
<td style="padding-left: 8px"><a><%= link_to request.host()+"/users", :controller => 'users', :action => 'index' %> </a></td>
<td ><%=link_to l(:field_homepage), home_path %> > <%=link_to l(:label_software_user), :controller => 'users', :action => 'index' %></td>
<td >
<%=link_to l(:field_homepage), home_path %> >
<a><%= l(:label_software_user)%></a>
</td>
</tr>
</table>
<% end %>

View File

@ -14,8 +14,12 @@
<%= form_tag( users_search_path, :method => :get, :id => 'search_user_form') do %>
<table width="940px">
<tr>
<td class="info_font" style="width: 220px; color: #15bccf "><%= l(:label_software_user ) %></td>
<td class="location-list"><strong><%= l(:label_user_location) %> :</strong></td>
<td class="info_font" style="width: 220px; color: #15bccf " rowspan="2">
<%= l(:label_software_user ) %>
</td>
<td class="location-list">
<strong><%= l(:label_user_location) %> :</strong>
</td>
<td rowspan="2">
</td>
<td rowspan="2" >
@ -31,8 +35,10 @@
</td>
</tr>
<tr>
<td style="padding-left: 8px"><a><%= link_to request.host()+"/users", :controller => 'users', :action => 'index' %> </a></td>
<td ><%=link_to l(:field_homepage), home_path %> > <%=link_to l(:label_software_user), :controller => 'users', :action => 'index' %></td>
<td >
<%=link_to l(:field_homepage), home_path %> >
<a><%= l(:label_software_user)%></a>
</td>
</tr>
</table>
</div>

View File

@ -1,49 +1,51 @@
<% reply_allow = JournalsForMessage.create_by_user? User.current %>
<% ids_r = 'reply_respond_form_'+ reply.id.to_s %>
<div class="recall" id='word_li_<%=reply.id.to_s%>' onmouseover="$('#<%= ids_r %>').show()" onmouseout="$('#<%= ids_r %>').hide()">
<div class="recall_head">
<% if show_name %>
<%= image_tag url_to_avatar(reply.user) %>
<% else %>
<%= image_tag url_to_avatar(nil) %>
<% end %>
</div>
<div class="recall_con">
<% id = 'project_respond_form_'+ reply.id.to_s %>
<%= link_to reply.user.name, user_path(reply.user) %>
回复
<% parent_jour = JournalsForMessage.find reply.m_reply_id %>
<% if show_name && parent_jour %>
<% parent_jour = JournalsForMessage.where("id = #{reply.m_reply_id}").first %>
<% if parent_jour%>
<% reply_allow = JournalsForMessage.create_by_user? User.current %>
<% ids_r = 'reply_respond_form_'+ reply.id.to_s %>
<div class="recall" id='word_li_<%=reply.id.to_s%>' onmouseover="$('#<%= ids_r %>').show()" onmouseout="$('#<%= ids_r %>').hide()">
<div class="recall_head">
<% if show_name %>
<%= image_tag url_to_avatar(reply.user) %>
<% else %>
<%= image_tag url_to_avatar(nil) %>
<% end %>
</div>
<div class="recall_con">
<% id = 'project_respond_form_'+ reply.id.to_s %>
<%= link_to reply.user.name, user_path(reply.user) %>
回复
<% if show_name %>
<%= link_to parent_jour.user.name, user_path(parent_jour.user) %>
<% else %>
<% else %>
<%= l(:label_anonymous) %>
<% end %>
<% end %>
<p>
<span class="message-notes">
<%= reply.notes %>
</span>
</p>
<p>
</p>
<p>
<span class="time">
<%= format_time reply.created_on %>
</span>
<span class="ping_disfoot" style="display: none; margin-left: 4px;" id='<%=ids_r%>' >
<% if @user == User.current || User.current.admin? || reply.user.id == User.current.id %>
<% if User.current.admin? || reply.user.id == User.current.id%>
<%= link_to(l(:label_newfeedback_delete), {:controller => 'words', :action => 'destroy', :object_id => reply, :user_id => reply.user},
:remote => true, :confirm => l(:text_are_you_sure), :method => 'delete', :class => "delete", :title => l(:button_delete)) %>
:remote => true, :confirm => l(:text_are_you_sure), :method => 'delete', :class => "delete", :title => l(:button_delete)) %>
<% end %>
<% if reply_allow %>
<%= link_to l(:label_projects_feedback_respond),'',
{:focus => 'project_respond', :onclick => "toggleAndSettingWordsVal($('##{id}'), $('##{id} textarea'), ''); return false;"} %>
<% end %> <!-- #{l(:label_reply_plural)} #{m_reply_id.user.name}: -->
</span>
</p>
</div>
<div id='<%=id%>' class="respond-form">
</p>
</div>
<div id='<%=id%>' class="respond-form">
<% if reply_allow %>
<%= render :partial => "words/new_respond", :locals => {:journal => journal, :m_reply_id => m_reply_id,:show_name => show_name} %>
<% end %>
</div>
<div style="clear: both;"></div>
</div>
</div>
<div style="clear: both;"></div>
</div>
<% end %>

View File

@ -569,7 +569,11 @@ zh:
label_role_plural: 角色
label_role_new: 新建角色
label_role_and_permissions: 角色和权限
label_member: 成员
label_member:
label_search_member_count: 共搜索到
label_member_people:
label_limit_groupname: 组别名不能超出20字符
label_limit_groupname_null: 组别名不能为空
label_member_new: 添加成员
label_member_plural: 成员
label_tracker: 跟踪标签
@ -1120,6 +1124,7 @@ zh:
text_workflow_edit: 选择角色和跟踪标签来编辑工作流程
text_are_you_sure: 您确定要删除吗?
text_are_you_sure_out: 你确定要退出该课程吗?
text_are_you_sure_out_group: 你确定要退出该分组吗?
text_journal_changed: "%{label} 从 %{old} 变更为 %{new}"
text_journal_set_to: "%{label} 被设置为 %{value}"
text_journal_deleted: "%{label} 已删除 (%{old})"
@ -1169,7 +1174,7 @@ zh:
text_wiki_page_nullify_children: 将子页面保留为根页面
text_wiki_page_destroy_children: 删除子页面及其所有下级页面
text_wiki_page_reassign_children: 将子页面的上级页面设置为
text_own_membership_delete_confirmation: 你正在删除你现有的某些或全部权限,如果这样做了你可能将会再也无法编辑该项目了。你确定要继续吗?
text_own_membership_delete_confirmation: 你正在删除你现有的某些或全部权限,如果这样做了你可能将会再也无法编辑该课程了。你确定要继续吗?
text_zoom_in: 放大
text_zoom_out: 缩小
text_applied_project: "用户 %{id} 申请加入项目 %{project}"
@ -1723,6 +1728,7 @@ zh:
label_user_create_project: 创建了
label_user_create_project_homework: 创建了作业
#added by bai
label_submit: 提交
label_identity: 身份
label_teacher: 教师
label_teacher_homework: 教师姓名
@ -1898,7 +1904,7 @@ zh:
other: 成员
label_bids_task_list: 作业列表
label_join_course: 加入课程
label_join_course: 加入
label_exit_course: 退出
label_new_join: 加入
label_new_course_password: 课程密码

View File

@ -643,10 +643,16 @@ RedmineApp::Application.routes.draw do
get 'member', :controller => 'courses', :action => 'member', :as => 'member'
post 'finishcourse'
post 'restartcourse'
match "searchmembers", :controller => 'courses', :action => 'searchmembers', :via => [:post,:get]
match "searchgroupmembers", :via => [:post, :get]
match "updategroupname", :via => [:post, :get]
match "addgroups", :via => [:post, :get]
post 'join_in/join_group', :to => 'courses#join_group', :as => 'join_group'
delete 'join_in/join_group', :to => 'courses#unjoin_group'
end
collection do
match 'join_private_courses', :via => [:get, :post]
end
match '/member', :to => 'courses#member', :as => 'member', :via => :get
@ -739,6 +745,8 @@ RedmineApp::Application.routes.draw do
post 'join_in/join', :to => 'courses#join', :as => 'join'
delete 'join_in/join', :to => 'courses#unjoin'
post 'join_in/join_group', :to => 'courses#join_group', :as => 'join_group'
delete 'join_in/join_group', :to => 'courses#unjoin_group'
post 'calls/:id/join_in_contest', :to => 'bids#join_in_contest', :as => 'join_in_contest'
delete 'calls/:id/join_in_contest', :to => 'bids#unjoin_in_contest'
match 'calls/:id/show_participator', :to => 'bids#show_participator' # bai
@ -747,6 +755,7 @@ RedmineApp::Application.routes.draw do
delete 'attachment/:id', :to => 'attachments#delete_homework'
match 'new_join', :to => 'courses#new_join', :as => 'try_join'
match 'new_join_group', :to => 'courses#new_join_group', :as => 'try_join_group'
match 'new_join_in_contest', :to => 'bids#new_join', :as => 'try_join_in_contest'
match 'projects/:id/respond', :to => 'projects#project_respond', :via => :post
match 'calls/:id/manage',:to => 'bids#manage',:via => [:get,:post]

View File

@ -0,0 +1,11 @@
class CreateCourseGroups < ActiveRecord::Migration
def change
create_table :course_groups do |t|
t.string :name
t.integer :course_id
t.timestamps
end
end
end

View File

@ -0,0 +1,5 @@
class AddColumnToMembers < ActiveRecord::Migration
def change
add_column :members, :course_group_id, :integer, default: 0
end
end

View File

@ -0,0 +1,5 @@
class AddQutoesToAttachments < ActiveRecord::Migration
def change
add_column("attachments","quotes",:integer)
end
end

View File

@ -11,7 +11,7 @@
#
# It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20141127072548) do
ActiveRecord::Schema.define(:version => 20141201085218) do
create_table "activities", :force => true do |t|
t.integer "act_id", :null => false
@ -53,6 +53,7 @@ ActiveRecord::Schema.define(:version => 20141127072548) do
t.integer "attachtype", :default => 1
t.integer "is_public", :default => 1
t.integer "copy_from"
t.integer "quotes"
end
add_index "attachments", ["author_id"], :name => "index_attachments_on_author_id"
@ -313,6 +314,13 @@ ActiveRecord::Schema.define(:version => 20141127072548) do
t.integer "container_id", :default => 0
end
create_table "course_groups", :force => true do |t|
t.string "name"
t.integer "course_id"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end
create_table "course_infos", :force => true do |t|
t.integer "course_id"
t.integer "user_id"
@ -651,6 +659,7 @@ ActiveRecord::Schema.define(:version => 20141127072548) do
t.datetime "created_on"
t.boolean "mail_notification", :default => false, :null => false
t.integer "course_id", :default => -1
t.integer "course_group_id", :default => 0
end
add_index "members", ["project_id"], :name => "index_members_on_project_id"

View File

@ -46,6 +46,9 @@ module Redmine
if self.respond_to?(:project)
(respond_to?(:visible?) ? visible?(user) : true) &&
user.allowed_to?(self.class.attachable_options[:view_permission], self.project)
elsif self.is_a?(Course)
(respond_to?(:visible?) ? visible?(user) : true) &&
user.allowed_to?(self.class.attachable_options[:view_permission], self)
else
return true
end

View File

@ -37,9 +37,9 @@ module SeemsRateable
def update_users_rating(stars, user_id, dimension=nil)
obj = rates(dimension).where(:rater_id => user_id).first
current_record = average(dimension)
current_record.avg = (current_record.avg*current_record.cnt - obj.stars + stars) / (current_record.cnt)
current_record.save!
#current_record = average(dimension)
#current_record.avg = (current_record.avg*current_record.cnt - obj.stars + stars) / (current_record.cnt)
#current_record.save!
obj.stars = stars
obj.save!
end

BIN
public/images/bid/star.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

BIN
public/images/btn.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

BIN
public/images/btn1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 769 B

BIN
public/images/close2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

BIN
public/images/inputBg.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 958 B

BIN
public/images/pic_edit.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 629 B

BIN
public/images/pic_up.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 217 B

View File

@ -1,696 +0,0 @@
//= require_directory ./rateable
/* Redmine - project management software
Copyright (C) 2006-2013 Jean-Philippe Lang */
function cleanArray (actual){
var newArray = new Array();
for (var i = 0; i< actual.length; i++){
if (actual[i]){
newArray.push(actual[i]);
}
}
return newArray;
}
function checkAll(id, checked) {
if (checked) {
$('#'+id).find('input[type=checkbox]').attr('checked', true);
} else {
$('#'+id).find('input[type=checkbox]').removeAttr('checked');
}
}
function toggleCheckboxesBySelector(selector) {
var all_checked = true;
$(selector).each(function(index) {
if (!$(this).is(':checked')) { all_checked = false; }
});
$(selector).attr('checked', !all_checked);
}
function showAndScrollTo(id, focus) {
$('#'+id).show();
if (focus !== null) {
$('#'+focus).focus();
}
$('html, body').animate({scrollTop: $('#'+id).offset().top}, 400);
}
function toggleRowGroup(el) {
var tr = $(el).parents('tr').first();
var n = tr.next();
tr.toggleClass('open');
while (n.length && !n.hasClass('group')) {
n.toggle();
n = n.next('tr');
}
}
function collapseAllRowGroups(el) {
var tbody = $(el).parents('tbody').first();
tbody.children('tr').each(function(index) {
if ($(this).hasClass('group')) {
$(this).removeClass('open');
} else {
$(this).hide();
}
});
}
function expandAllRowGroups(el) {
var tbody = $(el).parents('tbody').first();
tbody.children('tr').each(function(index) {
if ($(this).hasClass('group')) {
$(this).addClass('open');
} else {
$(this).show();
}
});
}
function toggleAllRowGroups(el) {
var tr = $(el).parents('tr').first();
if (tr.hasClass('open')) {
collapseAllRowGroups(el);
} else {
expandAllRowGroups(el);
}
}
function toggleFieldset(el) {
var fieldset = $(el).parents('fieldset').first();
fieldset.toggleClass('collapsed');
fieldset.children('div').toggle();
}
function hideFieldset(el) {
var fieldset = $(el).parents('fieldset').first();
fieldset.toggleClass('collapsed');
fieldset.children('div').hide();
}
function initFilters(){
$('#add_filter_select').change(function(){
addFilter($(this).val(), '', []);
});
$('#filters-table td.field input[type=checkbox]').each(function(){
toggleFilter($(this).val());
});
$('#filters-table td.field input[type=checkbox]').live('click',function(){
toggleFilter($(this).val());
});
$('#filters-table .toggle-multiselect').live('click',function(){
toggleMultiSelect($(this).siblings('select'));
});
$('#filters-table input[type=text]').live('keypress', function(e){
if (e.keyCode == 13) submit_query_form("query_form");
});
}
function addFilter(field, operator, values) {
var fieldId = field.replace('.', '_');
var tr = $('#tr_'+fieldId);
if (tr.length > 0) {
tr.show();
} else {
buildFilterRow(field, operator, values);
}
$('#cb_'+fieldId).attr('checked', true);
toggleFilter(field);
$('#add_filter_select').val('').children('option').each(function(){
if ($(this).attr('value') == field) {
$(this).attr('disabled', true);
}
});
}
function buildFilterRow(field, operator, values) {
var fieldId = field.replace('.', '_');
var filterTable = $("#filters-table");
var filterOptions = availableFilters[field];
var operators = operatorByType[filterOptions['type']];
var filterValues = filterOptions['values'];
var i, select;
var tr = $('<tr class="filter">').attr('id', 'tr_'+fieldId).html(
'<td class="field"><input checked="checked" id="cb_'+fieldId+'" name="f[]" value="'+field+'" type="checkbox"><label for="cb_'+fieldId+'"> '+filterOptions['name']+'</label></td>' +
'<td class="operator"><select id="operators_'+fieldId+'" name="op['+field+']"></td>' +
'<td class="values"></td>'
);
filterTable.append(tr);
select = tr.find('td.operator select');
for (i=0;i<operators.length;i++){
var option = $('<option>').val(operators[i]).text(operatorLabels[operators[i]]);
if (operators[i] == operator) { option.attr('selected', true); }
select.append(option);
}
select.change(function(){ toggleOperator(field); });
switch (filterOptions['type']){
case "list":
case "list_optional":
case "list_status":
case "list_subprojects":
tr.find('td.values').append(
'<span style="display:none;"><select class="value" id="values_'+fieldId+'_1" name="v['+field+'][]"></select>' +
' <span class="toggle-multiselect"><a>复选/multi-select</a></span></span>'
);
select = tr.find('td.values select');
if (values.length > 1) { select.attr('multiple', true); }
for (i=0;i<filterValues.length;i++){
var filterValue = filterValues[i];
var option = $('<option>');
if ($.isArray(filterValue)) {
option.val(filterValue[1]).text(filterValue[0]);
if ($.inArray(filterValue[1], values) > -1) {option.attr('selected', true);}
} else {
option.val(filterValue).text(filterValue);
if ($.inArray(filterValue, values) > -1) {option.attr('selected', true);}
}
select.append(option);
}
break;
case "date":
case "date_past":
tr.find('td.values').append(
'<span style="display:none;"><input type="text" name="v['+field+'][]" id="values_'+fieldId+'_1" size="10" class="value date_value" /></span>' +
' <span style="display:none;"><input type="text" name="v['+field+'][]" id="values_'+fieldId+'_2" size="10" class="value date_value" /></span>' +
' <span style="display:none;"><input type="text" name="v['+field+'][]" id="values_'+fieldId+'" size="3" class="value" /> '+labelDayPlural+'</span>'
);
$('#values_'+fieldId+'_1').val(values[0]).datepicker(datepickerOptions);
$('#values_'+fieldId+'_2').val(values[1]).datepicker(datepickerOptions);
$('#values_'+fieldId).val(values[0]);
break;
case "string":
case "text":
tr.find('td.values').append(
'<span style="display:none;"><input type="text" name="v['+field+'][]" id="values_'+fieldId+'" size="30" class="value" /></span>'
);
$('#values_'+fieldId).val(values[0]);
break;
case "relation":
tr.find('td.values').append(
'<span style="display:none;"><input type="text" name="v['+field+'][]" id="values_'+fieldId+'" size="6" class="value" /></span>' +
'<span style="display:none;"><select class="value" name="v['+field+'][]" id="values_'+fieldId+'_1"></select></span>'
);
$('#values_'+fieldId).val(values[0]);
select = tr.find('td.values select');
for (i=0;i<allProjects.length;i++){
var filterValue = allProjects[i];
var option = $('<option>');
option.val(filterValue[1]).text(filterValue[0]);
if (values[0] == filterValue[1]) { option.attr('selected', true); }
select.append(option);
}
case "integer":
case "float":
tr.find('td.values').append(
'<span style="display:none;"><input type="text" name="v['+field+'][]" id="values_'+fieldId+'_1" size="6" class="value" /></span>' +
' <span style="display:none;"><input type="text" name="v['+field+'][]" id="values_'+fieldId+'_2" size="6" class="value" /></span>'
);
$('#values_'+fieldId+'_1').val(values[0]);
$('#values_'+fieldId+'_2').val(values[1]);
break;
}
}
function toggleFilter(field) {
var fieldId = field.replace('.', '_');
if ($('#cb_' + fieldId).is(':checked')) {
$("#operators_" + fieldId).show().removeAttr('disabled');
toggleOperator(field);
} else {
$("#operators_" + fieldId).hide().attr('disabled', true);
enableValues(field, []);
}
}
function enableValues(field, indexes) {
var fieldId = field.replace('.', '_');
$('#tr_'+fieldId+' td.values .value').each(function(index) {
if ($.inArray(index, indexes) >= 0) {
$(this).removeAttr('disabled');
$(this).parents('span').first().show();
} else {
$(this).val('');
$(this).attr('disabled', true);
$(this).parents('span').first().hide();
}
if ($(this).hasClass('group')) {
$(this).addClass('open');
} else {
$(this).show();
}
});
}
function toggleOperator(field) {
var fieldId = field.replace('.', '_');
var operator = $("#operators_" + fieldId);
switch (operator.val()) {
case "!*":
case "*":
case "t":
case "ld":
case "w":
case "lw":
case "l2w":
case "m":
case "lm":
case "y":
case "o":
case "c":
enableValues(field, []);
break;
case "><":
enableValues(field, [0,1]);
break;
case "<t+":
case ">t+":
case "><t+":
case "t+":
case ">t-":
case "<t-":
case "><t-":
case "t-":
enableValues(field, [2]);
break;
case "=p":
case "=!p":
case "!p":
enableValues(field, [1]);
break;
default:
enableValues(field, [0]);
break;
}
}
function toggleMultiSelect(el) {
if (el.attr('multiple')) {
el.removeAttr('multiple');
} else {
el.attr('multiple', true);
}
}
function submit_query_form(id) {
selectAllOptions("selected_columns");
$('#'+id).submit();
}
function showTab(name) {
$('div#content .tab-content').hide();
$('div.tabs a').removeClass('selected');
$('#tab-content-' + name).show();
$('#tab-' + name).addClass('selected');
return false;
}
function moveTabRight(el) {
var lis = $(el).parents('div.tabs').first().find('ul').children();
var tabsWidth = 0;
var i = 0;
lis.each(function(){
if ($(this).is(':visible')) {
tabsWidth += $(this).width() + 6;
}
});
if (tabsWidth < $(el).parents('div.tabs').first().width() - 60) { return; }
while (i<lis.length && !lis.eq(i).is(':visible')) { i++; }
lis.eq(i).hide();
}
function moveTabLeft(el) {
var lis = $(el).parents('div.tabs').first().find('ul').children();
var i = 0;
while (i<lis.length && !lis.eq(i).is(':visible')) { i++; }
if (i>0) {
lis.eq(i-1).show();
}
}
function displayTabsButtons() {
var lis;
var tabsWidth = 0;
var el;
$('div.tabs').each(function() {
el = $(this);
lis = el.find('ul').children();
lis.each(function(){
if ($(this).is(':visible')) {
tabsWidth += $(this).width() + 6;
}
});
if ((tabsWidth < el.width() - 60) && (lis.first().is(':visible'))) {
el.find('div.tabs-buttons').hide();
} else {
el.find('div.tabs-buttons').show();
}
});
}
function setPredecessorFieldsVisibility() {
var relationType = $('#relation_relation_type');
if (relationType.val() == "precedes" || relationType.val() == "follows") {
$('#predecessor_fields').show();
} else {
$('#predecessor_fields').hide();
}
}
function showModal(id, width) {
var el = $('#'+id).first();
if (el.length === 0 || el.is(':visible')) {return;}
var title = el.find('h3.title').text();
el.dialog({
width: width,
modal: true,
resizable: false,
dialogClass: 'modal',
title: title
});
el.find("input[type=text], input[type=submit]").first().focus();
}
function hideModal(el) {
var modal;
if (el) {
modal = $(el).parents('.ui-dialog-content');
} else {
modal = $('#ajax-modal');
}
modal.dialog("close");
}
function submitPreview(url, form, target) {
$.ajax({
url: url,
type: 'post',
beforeSend: function(xhr) {xhr.setRequestHeader('X-CSRF-Token', $('meta[name="csrf-token"]').attr('content'))},
data: $('#'+form).serialize(),
success: function(data){
$('#'+target).html(data);
}
});
}
function collapseScmEntry(id) {
$('.'+id).each(function() {
if ($(this).hasClass('open')) {
collapseScmEntry($(this).attr('id'));
}
$(this).hide();
});
$('#'+id).removeClass('open');
}
function expandScmEntry(id) {
$('.'+id).each(function() {
$(this).show();
if ($(this).hasClass('loaded') && !$(this).hasClass('collapsed')) {
expandScmEntry($(this).attr('id'));
}
});
$('#'+id).addClass('open');
}
function scmEntryClick(id, url) {
el = $('#'+id);
if (el.hasClass('open')) {
collapseScmEntry(id);
el.addClass('collapsed');
return false;
} else if (el.hasClass('loaded')) {
expandScmEntry(id);
el.removeClass('collapsed');
return false;
}
if (el.hasClass('loading')) {
return false;
}
el.addClass('loading');
$.ajax({
url: url,
success: function(data){
el.after(data);
el.addClass('open').addClass('loaded').removeClass('loading');
}
});
return true;
}
function randomKey(size) {
var chars = new Array('0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z');
var key = '';
for (i = 0; i < size; i++) {
key += chars[Math.floor(Math.random() * chars.length)];
}
return key;
}
// Can't use Rails' remote select because we need the form data
function updateIssueFrom(url) {
$.ajax({
url: url,
type: 'post',
data: $('#issue-form').serialize()
});
}
function updateBulkEditFrom(url) {
$.ajax({
url: url,
type: 'post',
data: $('#bulk_edit_form').serialize()
});
}
function clearMessage(id) {
$('#'+id).val("");
}
function observeAutocompleteField(fieldId, url, options) {
$(document).ready(function() {
$('#'+fieldId).autocomplete($.extend({
source: url,
select: function(e,ui){self.location="/issues/"+ui.item.value;},
minLength: 2,
search: function(){$('#'+fieldId).addClass('ajax-loading');},
response: function(){$('#'+fieldId).removeClass('ajax-loading');
}
}, options));
$('#'+fieldId).addClass('autocomplete');
});
}
function observeSearchfield(fieldId, targetId, url) {
$('#'+fieldId).each(function() {
var $this = $(this);
$this.addClass('autocomplete');
$this.attr('data-value-was', $this.val());
var check = function() {
var val = $this.val();
if ($this.attr('data-value-was') != val){
$this.attr('data-value-was', val);
$.ajax({
url: url,
type: 'get',
data: {q: $this.val()},
success: function(data){ if(targetId) $('#'+targetId).html(data); },
beforeSend: function(){ $this.addClass('ajax-loading'); },
complete: function(){ $this.removeClass('ajax-loading'); }
});
}
};
var reset = function() {
if (timer) {
clearInterval(timer);
timer = setInterval(check, 300);
}
};
var timer = setInterval(check, 300);
$this.bind('keyup click mousemove', reset);
});
}
function observeProjectModules() {
var f = function() {
/* Hides trackers and issues custom fields on the new project form when issue_tracking module is disabled */
if ($('#project_enabled_module_names_issue_tracking').attr('checked')) {
$('#project_trackers').show();
}else{
$('#project_trackers').hide();
}
};
$(window).load(f);
$('#project_enabled_module_names_issue_tracking').change(f);
}
function initMyPageSortable(list, url) {
$('#list-'+list).sortable({
connectWith: '.block-receiver',
tolerance: 'pointer',
update: function(){
$.ajax({
url: url,
type: 'post',
data: {'blocks': $.map($('#list-'+list).children(), function(el){return $(el).attr('id');})}
});
}
});
$("#list-top, #list-left, #list-right").disableSelection();
}
var warnLeavingUnsavedMessage;
function warnLeavingUnsaved(message) {
warnLeavingUnsavedMessage = message;
$('form').submit(function(){
$('textarea').removeData('changed');
});
$('textarea').change(function(){
$(this).data('changed', 'changed');
});
window.onbeforeunload = function(){
var warn = false;
$('textarea').blur().each(function(){
if ($(this).data('changed')) {
warn = true;
}
});
if (warn) {return warnLeavingUnsavedMessage;}
};
}
function setupAjaxIndicator() {
$('#ajax-indicator').bind('ajaxSend', function(event, xhr, settings) {
if ($('.ajax-loading').length === 0 && settings.contentType != 'application/octet-stream') {
$('#ajax-indicator').show();
}
});
$('#ajax-indicator').bind('ajaxStop', function() {
$('#ajax-indicator').hide();
});
}
function hideOnLoad() {
$('.hol').hide();
}
function addFormObserversForDoubleSubmit() {
$('form[method=post]').each(function() {
if (!$(this).hasClass('multiple-submit')) {
$(this).submit(function(form_submission) {
if ($(form_submission.target).attr('data-submitted')) {
form_submission.preventDefault();
} else {
$(form_submission.target).attr('data-submitted', true);
}
});
}
});
}
function blockEventPropagation(event) {
event.stopPropagation();
event.preventDefault();
}
function toggleAndSettingWordsVal(parent_widget, text_widget, value){
text_widget.val(value)
parent_widget.slideToggle(400)
}
function transpotUrl (scope) {
$(scope).each(function(){
var tmpContent = $(this).html();
tmpContent = tmpContent.replace(/(^|[^\"\'])(http|ftp|mms|rstp|news|https)(\:\/\/[^<\s\+,]+)/gi,"$1<a href='$2$3' target='_blank'>$2$3<\/a>");
// tmpContent = tmpContent.replace(/(^|[^\/])(www\.[^<\s\+,]+)/gi,"$1<a href='http:\/\/$2' style='color:blue' target='_blank'>$2</a>");
$(this).html(tmpContent);
});
}
$(document).ready(setupAjaxIndicator);
$(document).ready(hideOnLoad);
$(document).ready(addFormObserversForDoubleSubmit);
$(document).ready(function(){
$.ajaxSetup({
headers: {
'X-CSRF-Token': $('meta[name="csrf-token"]').attr('content')
}
});
}
)
function img_thumbnails() {
$('.thumbnails a').colorbox({rel:'nofollow'});
$('.attachments').find('a').each(function(index, element) {
var href_value = $(element).attr('href');
if (/\.(jpg|png|gif|bmp)$/.test(href_value)) {
$(element).colorbox({rel:'nofollow'});
}
});
}
$(document).ready(img_thumbnails);
function TimeClose(dateText, inst) {
if(inst.id=="issue_start_date"){
time=dateText;
}
}
var time=new Date();
function TimeBeforeShow(input){
if(input.id=="issue_due_date"){
//var minDate = $(input).datepicker('option', 'minDate');
var tempdata=$("#issue_start_date").attr("value");
$(input).datepicker('option', 'minDate',new Date(tempdata.replace(/-/g, "/")));
//$('.selector').datepicker('option', 'minDate', '12/25/2012');
}
}
function SetMinValue(){
/// var tempdata=$("#issue_start_date").attr("value");
//$('.selector').datepicker('option', 'minDate', '12/25/2012');
//alert(tempdata);
//$("#issue_due_date").datepicker({
// minDate: new Date(2014,08,23)
//var datepickerOptions=
//{dateFormat: 'yy-mm-dd',minDate: new Date(2014,08,23), showOn: 'button', buttonImageOnly: true, buttonImage: "path_to_image('/images/calendar.png')", showButtonPanel: true, showWeek: true, showOtherMonths: true, selectOtherMonths: true};
//alert( $('.issue_due_date').length);
//$('.selector')[1].datepicker('option', 'minDate', new Date(2014, 0 - 8, 23));
//$("#issue_due_date").datepicker(datepickerOptions);
//$("##{issue_due_date}").datepicker(datepickerOptions);
//$("#issue_due_date").datepicker(
// {dateFormat: 'yy-mm-dd',minDate: new Date(2014,08,23), showOn: 'button', buttonImageOnly: true, buttonImage: "path_to_image('/images/calendar.png')", showButtonPanel: true, showWeek: true, showOtherMonths: true, selectOtherMonths: true}
//)
//});
}
function PrecentChange(obj){
var _v= obj;
if(_v==100)
{
//var select=$("select[id='issue_status_id']");
$("select[id='issue_status_id']").find("option[value='3']").attr("selected","selected");
}
else if(_v==0)
{
//alert(1);
$("select[id='issue_status_id']").find("option[value='1']").attr("selected","selected");
}
else if(_v!=100&&_v!=0)
{
// alert(2);
$("select[id='issue_status_id']").find("option[value='2']").attr("selected","selected");
}
}

View File

@ -2044,7 +2044,7 @@ width:20%;
font-weight:bold;
text-align:center;
padding:0.6em;
z-index:100;
z-index:100000;
opacity: 0.5;
}

View File

@ -0,0 +1,96 @@
body{ font-size:12px; font-family:"微软雅黑","宋体"; line-height:1.9; background:#fff; font-style:normal;}
div,html,img,ul,li,p,body,h1,h2,h3,h4,p,a,table,tr,td,fieldset,input,span,textarea,form{ margin:0; padding:0;}
div,img,tr,td,textarea,form{ border:0;}
table,tr,td{border:0; cellspacing:0; cellpadding:0;}
ul,li{ list-style-type:none}
.cl{ clear:both; overflow:hidden; }
a{ text-decoration:none; }
a:hover{ }
/**** 常用***/
.f_l{ float:left;}
.f_r{ float:right;}
.b_lblue{ background:#64bdd9;}
.b_dblue{ background:#55a1b9; cursor:pointer;}
.f_b{ font-weight: bold;}
.c_blue{ color:#64bdd9;}
.c_grey{ color:#999999;}
.c_grey02{ color:#666666;}
.f_14{ font-size:14px;}
.c_dblue{ color:#3e6d8e;}
.c_red{ color:#ec0016;}
.w90{width:90px;}
.ml10{margin-left:10px;}
.st_search input.f_2 {
width:60px !important;
height:28px !important;
color:#fff !important;
margin-right:5px !important;
border:none !important;
margin-left:0px !important;
box-shadow: none !important;
padding: 0px !important;
border-radius: 0 !important;
text-shadow: none !important;
border:1px solid #1c9ec7;
background:#1c9ec7;
}
.container{ width:940px; margin:0 auto; font-size:12px;}
.st_list{ width:688px; padding-left:5px; height:800px;}
.st_search{ margin:10px 0;}
.st_search span{ font-size:14px; font-weight:bold; color:#606060; margin-right:35px;}
.st_search input{ border:1px solid #1c9ec7; background:#fff; height:20px; color:#c4c4c4; width:200px;}
.st_search a:hover{ background:#048fbb; text-decoration:none;}
/*.st_search input.f_2{ background:#1c9ec7; padding: 3px; margin-left: 3px; color:#fff;border:1px solid #1c9ec7; text-align:center; display:block; width:45px; height:28px; font-size:12px; }*/
.classbox{ border:1px solid #f8df8c; background:#fffce6; color:#0d90c3; padding:0 3px; float:left; margin-left:15px;}
.st_addclass{ margin-top:5px;}
.st_addclass ul li{ margin-bottom:10px;}
.st_addclass ul li,.st_addclass a,.st_addclass img{ float:left;}
.st_addclass img{ margin-top:3px;}
.st_addclass a{ color:#0d90c3;}
.st_box{ margin-top:10px; border-top:1px solid #CCC; padding-top:10px;}
.st_box ul li{ float:left;}
.st_box_top a{ font-weight:bold; color:#7a7a7a; float:left;}
.st_box_top a:hover{ color:#1c9ec7;}
.st_up{ display: block; width:8px; float:left; height:13px; background:url(../images/pic_up.png) 0 0 no-repeat; margin-top:5px; margin-left:3px;}
.st_down{ display: block; width:8px; float:left; height:13px; background:url(../images/pic_up.png) 0 -22px no-repeat; margin-top:5px; margin-left:3px;}
a.st_img { display:block;width:40px; height:40px; border:1px solid #CCC; padding:1px;}
a:hover.st_img { border:1px solid #1c9ec7; }
.st_boxlist{ border-bottom:1px dashed #CCC; height:53px; padding-top:10px; }
.st_boxlist a{ float:left;}
.st_boxlist ul{ float:left; width:200px; margin-left:10px;}
.st_boxlist ul li a{ color:#5d5d5d;}
.st_boxlist ul li a span{ color:#1c9ec7;}
.st_boxlist ul li a:hover span{ color:#ff8e15;}
.ml50{ margin-left:50px;}
.ml358{ margin-left:358px;}
.ml258{ margin-left:254px;}
.ml65{ margin-left:65px;}
a:hover.st_add{ color:#ff8e15;}
/****翻页***/
.wlist{ margin-top:15px; float:right;}
.wlist a{ float:left; border:1px solid #15bccf; padding:0 5px; margin-left:3px; color:#15bccf;}
.wlist a:hover{border:1px solid #15bccf; background-color:#15bccf; color:#fff;}
.wlist_select a { background-color:#64bdd9; color:#fff;}
.submit{height:21px;border:0; cursor:pointer; background:url(../images/btn.png) no-repeat 0 0;width:42px; margin-top:2px; margin-left:3px; }
.submit_2{height:21px;border:0; cursor:pointer; background:url(../images/btn1.png) no-repeat 0 0;width:42px; margin-top:2px; margin-left:3px; }
.isTxt{background:#fbfbfb url(../images/inputBg.png) repeat-x left top;height:22px;line-height:22px;border:1px solid #c1c1c1;padding:0 5px;color:#666666;}
.group_in {
width:60px !important;
height:28px !important;
color:#fff !important;
margin-right:5px !important;
border:none !important;
margin-left:0px !important;
box-shadow: none !important;
border-radius: 0 !important;
text-shadow: none !important;
border:1px solid #1c9ec7;
background:#1c9ec7;
}

View File

@ -80,8 +80,7 @@ a.wzan_visited{background:url(images/pic_zan.png) 0 0 no-repeat;}
.ping_con p{ color:#777777; font-size:12px; border-bottom:1px dashed #CCC; padding-bottom:5px;}
.ping_con p span a{ color:#777777;}
.ping_star{ width:160px; color:#333; font-weight:bold; margin-bottom:5px;}
.ping_star span a{ float:right; width:20px; height:20px; background:url(images/star.png) -2px 0 no-repeat; margin-right:3px;}
.ping_star span a:hover{background:url(images/star.png) -24px 0 no-repeat;}
.ping_star span a{ float:right; width:20px; height:20px; background:url(images/star.png);background-repeat: no-repeat; margin-right:3px;}
.ping_con textarea{ height:76px; border:1px solid #15bccf; margin-bottom:5px; color:#666; font-size:12px;}
a.ping_sub{ float:right; height:22px; width:60px; margin-right:20px; background:#15bccf; color:#fff; text-align:center;}
a.ping_sub1{ float:right; height:22px; width:60px; background:#15bccf; color:#fff; text-align:center;}

11
test/fixtures/course_groups.yml vendored Normal file
View File

@ -0,0 +1,11 @@
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html
# This model initially had no columns defined. If you add columns to the
# model remove the '{}' from the fixture names and add the columns immediately
# below each fixture, per the syntax in the comments below
#
one: {}
# column: value
#
two: {}
# column: value

View File

@ -0,0 +1,7 @@
require 'test_helper'
class CourseGroupTest < ActiveSupport::TestCase
# test "the truth" do
# assert true
# end
end