Merge branch 'develop' into weixin_guange
Conflicts: public/assets/wechat/app.html public/assets/wechat/new_project.html public/javascripts/wechat/directives/ellipsis.js public/stylesheets/weui/weixin.css
This commit is contained in:
commit
f3ae53dc97
|
@ -154,6 +154,19 @@ class AdminController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
# 单位名称列表下的已审批按照名字排序
|
||||
def apply_shcool_sort
|
||||
@order = ""
|
||||
@sort = ""
|
||||
if params[:sort] && (params[:order] == 'name')
|
||||
# courses = School.find_by_sql("SELECT c.*,count(c.id) FROM courses c,course_activities ca WHERE c.id = ca.course_id AND c.name like '%#{name}%' GROUP BY c.id ORDER BY count(c.id) #{params[:sort]}, c.id desc")
|
||||
school = School.find_by_sql(" SELECT aas.name FROM apply_add_schools aas where aas.status = '0' ORDER BY CONVERT(aas.name USING gbk) #{params[:sort]}, aas.id asc ")
|
||||
@order = params[:order]
|
||||
@sort = params[:sort]
|
||||
end
|
||||
redirect_to unapplied_schools_url
|
||||
end
|
||||
|
||||
#精品课程下的全部课程
|
||||
def excellent_all_courses
|
||||
name = params[:name]
|
||||
|
@ -602,8 +615,10 @@ class AdminController < ApplicationController
|
|||
# 获取申请的高校列表
|
||||
# status: 0 未审批; 1 已批阅;
|
||||
def applied_schools
|
||||
@name = params[:name]
|
||||
@apply_status = ApplyAddSchools.where(:status => 0).order('created_at desc')
|
||||
@name = params[:name] || ""
|
||||
condition = "#{@name.strip}".gsub(" ","")
|
||||
|
||||
@apply_status = ApplyAddSchools.where("status = 0 and name like '%#{condition}%'").order('created_at desc')
|
||||
@apply_count = @apply_status.count
|
||||
|
||||
@apply_pages = Paginator.new @apply_count, 30, params['page'] || 1
|
||||
|
@ -616,8 +631,10 @@ class AdminController < ApplicationController
|
|||
end
|
||||
|
||||
def has_applied_schools
|
||||
@name = params[:name]
|
||||
@has_apply_status = ApplyAddSchools.where("status = 1 or status = 2").order('created_at desc')
|
||||
@name = params[:name] || ""
|
||||
condition = "#{@name.strip}".gsub(" ","")
|
||||
|
||||
@has_apply_status = ApplyAddSchools.where("(status = 1 or status = 2) and name like '%#{condition}%'").order('created_at desc')
|
||||
@has_apply_count = @has_apply_status.count
|
||||
|
||||
@has_apply_pages = Paginator.new @has_apply_count, 30, params['page'] || 1
|
||||
|
@ -700,8 +717,10 @@ class AdminController < ApplicationController
|
|||
user.update_column("school_id", nil)
|
||||
end
|
||||
applied_school.school.destroy
|
||||
respond_to do |format|
|
||||
format.html{ redirect_to unapplied_schools_url }
|
||||
if params[:tip] == "unapplied"
|
||||
redirect_to unapplied_schools_url
|
||||
elsif params[:tip] == "applied"
|
||||
redirect_to applied_schools_url
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -1,44 +1,70 @@
|
|||
class AppliedProjectController < ApplicationController
|
||||
|
||||
helper :watchers
|
||||
#申请加入项目
|
||||
def applied_join_project
|
||||
@user_id = params[:user_id]
|
||||
@project = Project.find_by_id(params[:project_id])
|
||||
if params[:project_join]
|
||||
if @project
|
||||
user = User.find @user_id
|
||||
if user.member_of?(@project)
|
||||
@status = 3
|
||||
else
|
||||
@applieds = AppliedProject.where("user_id = ? and project_id = ?", params[:user_id],params[:project_id])
|
||||
if @applieds.count == 0
|
||||
appliedproject = AppliedProject.create(:user_id => params[:user_id], :project_id => params[:project_id])
|
||||
Mailer.run.applied_project(appliedproject)
|
||||
@status = 2
|
||||
else
|
||||
@status = 1
|
||||
end
|
||||
end
|
||||
else
|
||||
@status = 0
|
||||
end
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
return
|
||||
if params[:object_id]
|
||||
@project = Project.find_by_id(params[:object_id])
|
||||
end
|
||||
# @user_id = params[:user_id]
|
||||
# if params[:project_join]
|
||||
# if @project
|
||||
# user = User.find @user_id
|
||||
# if user.member_of?(@project)
|
||||
# @status = 3
|
||||
# else
|
||||
# @applieds = AppliedProject.where("user_id = ? and project_id = ?", params[:user_id],params[:project_id])
|
||||
# if @applieds.count == 0
|
||||
# appliedproject = AppliedProject.create(:user_id => params[:user_id], :project_id => params[:project_id])
|
||||
# Mailer.run.applied_project(appliedproject)
|
||||
# @status = 2
|
||||
# else
|
||||
# @status = 1
|
||||
# end
|
||||
# end
|
||||
# else
|
||||
# @status = 0
|
||||
# end
|
||||
# respond_to do |format|
|
||||
# format.js
|
||||
# end
|
||||
# return
|
||||
# end
|
||||
#
|
||||
# @applieds = AppliedProject.where("user_id = ? and project_id = ?", params[:user_id],params[:project_id])
|
||||
# if @applieds.count == 0
|
||||
# appliedproject = AppliedProject.create(:user_id => params[:user_id], :project_id => params[:project_id])
|
||||
# Mailer.run.applied_project(appliedproject)
|
||||
# end
|
||||
#
|
||||
# #redirect_to project_path(params[:project_id])
|
||||
# #redirect_to_referer_or {render :text => ( 'applied success.'), :layout => true}
|
||||
# respond_to do |format|
|
||||
# format.html { redirect_to_referer_or {render :text => (watching ? 'Watcher added.' : 'Watcher removed.'), :layout => true}}
|
||||
# format.js { render :partial => 'set_applied'}
|
||||
# end
|
||||
end
|
||||
|
||||
@applieds = AppliedProject.where("user_id = ? and project_id = ?", params[:user_id],params[:project_id])
|
||||
if @applieds.count == 0
|
||||
appliedproject = AppliedProject.create(:user_id => params[:user_id], :project_id => params[:project_id])
|
||||
Mailer.run.applied_project(appliedproject)
|
||||
# @flage:提示语标志(1:邀请码错误;2:已经是项目成员; 3:角色没有选择; 4:申请成功)
|
||||
# role:成员角色 => 0(4:管理人员;5:开发人员;6:报告人员)
|
||||
# 申请成功则发送消息
|
||||
def applied_project_info
|
||||
if params[:project_id].nil?
|
||||
@project = Project.where(:invite_code => params[:invite_code]).first
|
||||
else
|
||||
@project = Project.find(params[:project_id])
|
||||
end
|
||||
|
||||
#redirect_to project_path(params[:project_id])
|
||||
#redirect_to_referer_or {render :text => ( 'applied success.'), :layout => true}
|
||||
respond_to do |format|
|
||||
format.html { redirect_to_referer_or {render :text => (watching ? 'Watcher added.' : 'Watcher removed.'), :layout => true}}
|
||||
format.js { render :partial => 'set_applied'}
|
||||
if !@project || params[:invite_code].to_s != @project.invite_code
|
||||
@flag = 1
|
||||
elsif User.current.member_of?(@project)
|
||||
@flag = 2
|
||||
elsif params[:member].nil?
|
||||
@flag = 3
|
||||
else
|
||||
@flag = 4
|
||||
role = params[:member] == "member_manager" ? 3 : (params[:member] == "member_developer" ? 4 :5)
|
||||
applied_project = AppliedProject.create(:user_id => User.current.id, :project_id => @project.id, :role => role)
|
||||
# 申请成功则给项目管理员发送邮件及发送消息
|
||||
# Mailer.run.applied_project(applied_project)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ class CoursesController < ApplicationController
|
|||
|
||||
before_filter :can_show_course, :except => []
|
||||
before_filter :logged_user_by_apptoken,:only => [:show,:feedback]
|
||||
before_filter :find_course, :except => [ :index, :search, :new,:join,:unjoin, :create, :new_join, :course,:join_private_courses]
|
||||
before_filter :find_course, :except => [ :index, :search, :new,:join,:unjoin, :create, :new_join, :course,:join_private_courses, :join_course_multi_role]
|
||||
before_filter :authorize_course, :only => [:show, :settings, :update, :course]
|
||||
before_filter :authorize_course_global, :only => [:new,:create]
|
||||
before_filter :toggleCourse, :only => [:finishcourse, :restartcourse]
|
||||
|
@ -81,6 +81,22 @@ class CoursesController < ApplicationController
|
|||
|
||||
end
|
||||
|
||||
def join_course_multi_role
|
||||
if User.current.logged?
|
||||
cs = CoursesService.new
|
||||
@user = User.current
|
||||
join = cs.join_course_roles params,@user
|
||||
@state = join[:state]
|
||||
@course = join[:course]
|
||||
else
|
||||
@state = 5 #未登录
|
||||
end
|
||||
@object_id = @course.id if @course
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
def unjoin
|
||||
if User.current.logged?
|
||||
cs = CoursesService.new
|
||||
|
@ -1136,6 +1152,21 @@ class CoursesController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
#切换身份
|
||||
def switch_role
|
||||
members = @course.members.where("user_id = #{params[:user_id]}")
|
||||
unless members.blank?
|
||||
#role = MemberRole.where("member_id = #{members.first.id} and role_id = #{params[:role]}").first
|
||||
curr_role = MemberRole.find_by_member_id_and_role_id(members.first.id, params[:curr_role])
|
||||
tar_role = MemberRole.find_by_member_id_and_role_id(members.first.id, params[:tar_role])
|
||||
unless (curr_role.nil? || tar_role.nil?)
|
||||
curr_role.update_column('is_current', 0)
|
||||
tar_role.update_column('is_current', 1)
|
||||
end
|
||||
end
|
||||
redirect_to course_path(@course)
|
||||
end
|
||||
|
||||
private
|
||||
def update_quotes attachment
|
||||
if attachment.copy_from
|
||||
|
|
|
@ -17,10 +17,11 @@
|
|||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
class MembersController < ApplicationController
|
||||
helper :users
|
||||
model_object Member
|
||||
before_filter :find_model_object, :except => [:index, :create, :autocomplete]
|
||||
before_filter :find_model_object, :except => [:index, :create, :autocomplete, :allow_to_join_project, :refused_allow_to_join_project]
|
||||
#before_filter :find_model_object_contest, :except => [:index, :create, :autocomplete]
|
||||
before_filter :find_project_from_association, :except => [:index, :create, :autocomplete]
|
||||
before_filter :find_project_from_association, :except => [:index, :create, :autocomplete, :allow_to_join_project, :refused_allow_to_join_project]
|
||||
before_filter :find_project_by_project_id, :only => [:index, :create, :autocomplete]
|
||||
before_filter :authorize
|
||||
accept_api_auth :index, :show, :create, :update, :destroy
|
||||
|
@ -49,6 +50,62 @@ class MembersController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
# 同意消息中申请加入项目
|
||||
# 之所以role不在参数中传送是考虑到安全问题
|
||||
# status(1:申请的消息;2:已操作过该消息(包括同意或者拒绝,消息状态更新);3:决绝消息;4:被拒人收到消息;5:拒绝者收到消息;6:同意后申请人收到消息;7:同意后批准人收到消息)
|
||||
def allow_to_join_project
|
||||
@applied_message = AppliedMessage.find(params[:applied_message_id])
|
||||
applied_project = @applied_message.applied
|
||||
user = User.find(@applied_message.applied_user_id)
|
||||
project = Project.find(applied_project.project_id)
|
||||
if user.member_of?(project)
|
||||
@flash_message = "您已经是项目成员了"
|
||||
@applied_message.update_attribute(:status, 2)
|
||||
else
|
||||
ap_role = applied_project.try(:role)
|
||||
if ap_role
|
||||
begin
|
||||
members = []
|
||||
user_grades = []
|
||||
project_info = []
|
||||
members << Member.new(:role_ids => ["#{ap_role}"], :user_id => @applied_message.applied_user_id)
|
||||
user_grades << UserGrade.new(:user_id => @applied_message.applied_user_id, :project_id => project.id)
|
||||
role = Role.find(ap_role)
|
||||
project_info << ProjectInfo.new(:project_id => project.id, :user_id => @applied_message.applied_user_id) if role.allowed_to?(:is_manager)
|
||||
project.members << members
|
||||
project.project_infos << project_info
|
||||
project.user_grades << user_grades unless user_grades.first.user_id.nil?
|
||||
@applied_message.update_attribute(:status, 2)
|
||||
# 添加成功后,申请人收到消息
|
||||
AppliedMessage.create(:user_id => @applied_message.applied_user_id, :applied_type => "AppliedProject", :applied_id => applied_project.id ,
|
||||
:status => 6, :viewed => true, :applied_user_id => @applied_message.user_id, :role => applied_project.role, :project_id => applied_project.project_id)
|
||||
# 添加成功后,批准人收到消息
|
||||
AppliedMessage.create(:user_id => @applied_message.user_id, :applied_type => "AppliedProject", :applied_id => applied_project.id ,
|
||||
:status => 7, :viewed => true, :applied_user_id => @applied_message.applied_user_id, :role => applied_project.role, :project_id => applied_project.project_id)
|
||||
rescue Exception => e
|
||||
puts e
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# 同意消息中拒绝加入项目
|
||||
# params[:user_id]为申请者ID
|
||||
# params[:send_id]为拒绝人ID
|
||||
# status(1:申请的消息;2:已操作过该消息(包括同意或者拒绝,消息状态更新);3:拒绝消息;4:被拒人收到消息;5:拒绝者收到消息;6:同意后申请人收到消息;7:同意后批准人收到消息)
|
||||
def refused_allow_to_join_project
|
||||
@applied_message = AppliedMessage.find(params[:applied_message_id])
|
||||
@applied_message.update_attribute(:status, 3)
|
||||
applied_project = @applied_message.applied
|
||||
# 发送消息给被拒者,user_id对应的收到信息的用户
|
||||
AppliedMessage.create(:user_id => @applied_message.applied_user_id, :applied_type => "AppliedProject", :applied_id => applied_project.id ,:status => 4,
|
||||
:viewed => true, :applied_user_id => @applied_message.user_id, :role => applied_project.role, :project_id => applied_project.project_id)
|
||||
# 发送消息给拒绝者
|
||||
AppliedMessage.create(:user_id => @applied_message.user_id, :applied_type => "AppliedProject", :applied_id => applied_project.id ,:status => 5,
|
||||
:viewed => true, :applied_user_id => @applied_message.applied_user_id, :role => applied_project.role, :project_id => applied_project.project_id)
|
||||
applied_project.delete
|
||||
end
|
||||
|
||||
def create
|
||||
if params[:refusal_button]
|
||||
members = []
|
||||
|
@ -154,9 +211,11 @@ class MembersController < ApplicationController
|
|||
user_ids = attrs.delete(:user_ids)
|
||||
user_ids.each do |user_id|
|
||||
member = Member.new(:role_ids => params[:membership][:role_ids], :user_id => user_id)
|
||||
role = Role.find_by_id(params[:membership][:role_ids])
|
||||
|
||||
role_ids = attrs.delete(:role_ids)
|
||||
#role = Role.find(params[:membership][:role_ids])
|
||||
# 这里的判断只能通过角色名,可以弄成常量
|
||||
if role && (role.name == "学生" || role.name == "Student")
|
||||
if role_ids && role_ids.include?("10")
|
||||
StudentsForCourse.create(:student_id => user_id, :course_id =>@course.id)
|
||||
end
|
||||
|
||||
|
@ -252,7 +311,10 @@ class MembersController < ApplicationController
|
|||
if (params[:membership][:role_ids])
|
||||
role = Role.find(params[:membership][:role_ids][0])
|
||||
# 这里的判断只能通过角色名,可以弄成常量
|
||||
if role.name == "学生" || role.name == "Student"
|
||||
attrs = params[:membership].dup
|
||||
role_ids = attrs.delete(:role_ids)
|
||||
|
||||
if role_ids && role_ids.include?("10")
|
||||
StudentsForCourse.create(:student_id => @member.user_id, :course_id =>@course.id)
|
||||
else
|
||||
joined = StudentsForCourse.where('student_id = ? and course_id = ?', @member.user_id,@course.id)
|
||||
|
@ -313,6 +375,11 @@ class MembersController < ApplicationController
|
|||
grade.destroy
|
||||
end
|
||||
end
|
||||
# 移出的时候删除申请消息,不需要删除消息,所以不必要关联删除
|
||||
applied_projects = AppliedProject.where(:project_id => @project.id, :user_id => @member.user_id).first
|
||||
unless applied_projects.nil?
|
||||
applied_projects.delete
|
||||
end
|
||||
#移出项目发送消息
|
||||
ForgeMessage.create(:user_id => @member.user_id, :project_id => @project.id, :forge_message_type => "RemoveFromProject", :viewed => false, :forge_message_id => User.current.id)
|
||||
end
|
||||
|
|
|
@ -792,6 +792,11 @@ class ProjectsController < ApplicationController
|
|||
members = Member.where(:user_id => User.current.id, :project_id=>params[:id]).first
|
||||
if members != nil && members.roles.first.to_s != "Manager"
|
||||
members.destroy
|
||||
# 移出的时候删除申请消息,不需要删除消息,所以不必要关联删除
|
||||
applied_projects = AppliedProject.where(:project_id => @project.id, :user_id => members.user_id).first
|
||||
unless applied_projects.nil?
|
||||
applied_projects.delete
|
||||
end
|
||||
end
|
||||
respond_to do |format|
|
||||
format.js
|
||||
|
|
|
@ -37,7 +37,7 @@ class QualityAnalysisController < ApplicationController
|
|||
quality_an.delete unless quality_an.blank?
|
||||
end
|
||||
# Checks if the given job exists in Jenkins.
|
||||
unless @client.job.exists?(job_name)
|
||||
# unless @client.job.exists?(job_name)
|
||||
@g = Gitlab.client
|
||||
branch = params[:branch]
|
||||
language = swith_language_type(params[:language])
|
||||
|
@ -111,7 +111,7 @@ class QualityAnalysisController < ApplicationController
|
|||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
# end
|
||||
rescue => e
|
||||
@message = e.message
|
||||
end
|
||||
|
|
|
@ -184,6 +184,15 @@ class SchoolController < ApplicationController
|
|||
applyschool.user_id = User.current.id
|
||||
if applyschool.save
|
||||
data[:school_id] = school.id
|
||||
user_extention= User.current.extensions
|
||||
user_extention.school_id = school.id
|
||||
user_extention.save!
|
||||
|
||||
# status=4 向管理员发送信息
|
||||
users = User.where(:admin => 1)
|
||||
users.each do |user|
|
||||
AppliedMessage.create(:user_id => user.id, :status => 4, :applied_user_id => User.current.id, :viewed => true, :applied_id => school.id, :applied_type => "ApplyAddSchools", :name => school.name )
|
||||
end
|
||||
else
|
||||
data[:result] = 3
|
||||
end
|
||||
|
@ -207,4 +216,69 @@ class SchoolController < ApplicationController
|
|||
|
||||
render :json =>status
|
||||
end
|
||||
|
||||
def edit_apply_name
|
||||
name = params[:name] || ""
|
||||
status = -1
|
||||
|
||||
if name != ""
|
||||
applyschool = ApplyAddSchools.where("id=?",params[:id]).first
|
||||
|
||||
applyschool.name = name.strip
|
||||
|
||||
if applyschool.school
|
||||
applyschool.school.name = name
|
||||
applyschool.school.pinyin = Pinyin.t(name.strip, splitter: '')
|
||||
applyschool.school.save!
|
||||
end
|
||||
applyschool.save!
|
||||
status = 0
|
||||
end
|
||||
|
||||
render :json=>{:status=>status,:id=>params[:id],:name=>name}
|
||||
end
|
||||
|
||||
def edit_apply_address
|
||||
address = params[:address] || ""
|
||||
|
||||
status = -1
|
||||
|
||||
if address != ""
|
||||
applyschool = ApplyAddSchools.where("id=?",params[:id]).first
|
||||
applyschool.address = address
|
||||
applyschool.save!
|
||||
status = 0
|
||||
end
|
||||
|
||||
render :json=>{:status=>status,:id=>params[:id],:address=>address}
|
||||
end
|
||||
|
||||
def edit_apply_province
|
||||
province = params[:province] || ""
|
||||
city = params[:city] || ""
|
||||
status = -1
|
||||
|
||||
if(province != "") &&(city != "")
|
||||
applyschool = ApplyAddSchools.where("id=?",params[:id]).first
|
||||
applyschool.province = province
|
||||
applyschool.city = city
|
||||
|
||||
if applyschool.school
|
||||
applyschool.school.province = province
|
||||
applyschool.school.save!
|
||||
end
|
||||
applyschool.save!
|
||||
|
||||
if applyschool.user_id && applyschool.user_id != 0
|
||||
user = User.find(applyschool.user_id)
|
||||
user_extention= user.extensions
|
||||
user_extention.location = province
|
||||
user_extention.location_city = city
|
||||
user_extention.save!
|
||||
end
|
||||
status = 0
|
||||
end
|
||||
|
||||
render :json=>{:status=>status,:id=>params[:id],:province=>province,:city=>city}
|
||||
end
|
||||
end
|
||||
|
|
|
@ -41,7 +41,7 @@ class UsersController < ApplicationController
|
|||
:activity_score_index, :influence_score_index, :score_index,:show_new_score, :topic_new_score_index, :project_new_score_index,
|
||||
:activity_new_score_index, :influence_new_score_index, :score_new_index,:user_projects_index,:user_resource,
|
||||
:user_courses4show,:user_projects4show,:user_course_activities,:user_project_activities,:user_feedback4show,:user_visitorlist,:user_messages,:edit_brief_introduction,
|
||||
:user_import_homeworks,:user_search_homeworks,:user_import_resource, :user_system_messages,:choose_user_course,:user_courselist,:user_projectlist]
|
||||
:user_import_homeworks,:user_search_homeworks,:user_import_resource, :user_system_messages,:choose_user_course,:user_courselist,:user_projectlist,:sort_syllabus_list]
|
||||
before_filter :auth_user_extension, only: :show
|
||||
#before_filter :rest_user_score, only: :show
|
||||
#before_filter :select_entry, only: :user_projects
|
||||
|
@ -133,6 +133,7 @@ class UsersController < ApplicationController
|
|||
@user_activity_id = params[:user_activity_id]
|
||||
@activity_id = params[:activity_id]
|
||||
@homepage = params[:homepage]
|
||||
@user_id = params[:user_id]
|
||||
@type = 'BlogComment'
|
||||
when 'OrgDocumentComment'
|
||||
@reply = OrgDocumentComment.find params[:reply_id]
|
||||
|
@ -149,6 +150,9 @@ class UsersController < ApplicationController
|
|||
@user_activity_id = params[:user_activity_id]
|
||||
@activity_id = params[:activity_id]
|
||||
@type = 'Issue'
|
||||
when 'Syllabus'
|
||||
@reply = JournalsForMessage.find params[:reply_id]
|
||||
@type = 'Syllabus'
|
||||
end
|
||||
respond_to do |format|
|
||||
format.js
|
||||
|
@ -351,15 +355,21 @@ class UsersController < ApplicationController
|
|||
case params[:agree]
|
||||
when 'Y'
|
||||
apply_user = User.find(@msg.course_message_id)
|
||||
|
||||
ids = @msg.content.split(",") # [@msg.content] msg content保存的是申请的职位角色
|
||||
integer_ids = []
|
||||
ids.each do |role_id|
|
||||
integer_ids << role_id.to_i
|
||||
end
|
||||
if apply_user.member_of_course?(Course.find(@msg.course_id))
|
||||
#将角色改为老师或者教辅
|
||||
member = Course.find(@msg.course_id).members.where(:user_id=>apply_user.id).all[0]
|
||||
member.role_ids = [@msg.content] # msg content保存的是申请的职位角色
|
||||
#删除为学生的记录
|
||||
joined = StudentsForCourse.where('student_id = ? and course_id = ?', member.user_id,@msg.course_id)
|
||||
joined.each do |join|
|
||||
join.delete
|
||||
member.role_ids = integer_ids
|
||||
#删除为学生的记录
|
||||
unless member.role_ids.include?(10)
|
||||
joined = StudentsForCourse.where('student_id = ? and course_id = ?', member.user_id,@msg.course_id)
|
||||
joined.each do |join|
|
||||
join.delete
|
||||
end
|
||||
end
|
||||
|
||||
member.course_group_id = 0
|
||||
|
@ -368,7 +378,7 @@ class UsersController < ApplicationController
|
|||
@msg.update_attributes(:status=>1,:viewed=>1)
|
||||
else
|
||||
members = []
|
||||
members << Member.new(:role_ids => [@msg.content.to_i], :user_id => @msg.course_message_id)
|
||||
members << Member.new(:role_ids => integer_ids, :user_id => @msg.course_message_id)
|
||||
Course.find(@msg.course_id).members << members
|
||||
CourseMessage.create(:user_id => @msg.course_message_id, :course_id => @msg.course_id, :viewed => false,:content=> @msg.content,:course_message_id=>User.current.id,:content=>@msg.content,:course_message_type=>'CourseRequestDealResult',:status=>1)
|
||||
@msg.update_attributes(:status=>1,:viewed=>1)
|
||||
|
@ -3225,7 +3235,35 @@ class UsersController < ApplicationController
|
|||
end
|
||||
|
||||
def user_courselist
|
||||
@order, @c_sort,@type = params[:order] || 1, params[:sort] || 1, params[:type] || 1
|
||||
@order, @c_sort, @type, @list_type = 1, 2, 1, 1
|
||||
|
||||
@my_syllabuses = @user.syllabuses
|
||||
|
||||
sy_courses = @user.courses.visible.where("is_delete =? and tea_id != ?", 0, @user.id)
|
||||
syllabus_ids = sy_courses.empty? ? '(-1)' : "(" + sy_courses.map{|course| !course.syllabus_id.nil? && course.syllabus_id}.join(",") + ")"
|
||||
@join_syllabuses = Syllabus.where("id in #{syllabus_ids} and user_id != #{@user.id}")
|
||||
|
||||
@my_syllabuses = syllabus_course_list_sort @my_syllabuses
|
||||
@join_syllabuses = syllabus_course_list_sort @join_syllabuses
|
||||
@my_syllabuses = @my_syllabuses.sort{|x,y| y[:last_update] <=> x[:last_update]}
|
||||
@join_syllabuses = @join_syllabuses.sort{|x,y| y[:last_update] <=> x[:last_update]}
|
||||
|
||||
#分页
|
||||
# @limit = 10
|
||||
# @is_remote = true
|
||||
# @atta_count = @syllabus.count
|
||||
# @atta_pages = Paginator.new @atta_count, @limit, params['page'] || 1
|
||||
# @offset ||= @atta_pages.offset
|
||||
# @syllabus = paginateHelper @syllabus,@limit
|
||||
|
||||
respond_to do |format|
|
||||
format.html {render :layout => 'new_base_user'}
|
||||
end
|
||||
end
|
||||
|
||||
#课程列表的排序
|
||||
def sort_syllabus_list
|
||||
@order, @c_sort, @type, @list_type = params[:order] || 1, params[:sort] || 1, params[:type] || 1, params[:list_type] || 1
|
||||
|
||||
#确定 sort_type
|
||||
if @order.to_i == @type.to_i
|
||||
|
@ -3235,40 +3273,48 @@ class UsersController < ApplicationController
|
|||
end
|
||||
|
||||
sort_name = "updated_at"
|
||||
sort_type = @c_sort == 1 ? "asc" : "desc"
|
||||
|
||||
@courses = @user.courses.visible.where("is_delete =?", 0)
|
||||
syllabus_ids = @courses.empty? ? '(-1)' : "(" + @courses.map{|course| !course.syllabus_id.nil? && course.syllabus_id}.join(",") + ")"
|
||||
@syllabus = Syllabus.where("id in #{syllabus_ids} or user_id = #{User.current.id}").order("#{sort_name} #{sort_type}")
|
||||
if @list_type.to_i == 1
|
||||
@syllabuses = @user.syllabuses.order("updated_at desc")
|
||||
else
|
||||
sy_courses = @user.courses.visible.where("is_delete =? and tea_id != ?", 0, @user.id)
|
||||
syllabus_ids = sy_courses.empty? ? '(-1)' : "(" + sy_courses.map{|course| !course.syllabus_id.nil? && course.syllabus_id}.join(",") + ")"
|
||||
@syllabuses = Syllabus.where("id in #{syllabus_ids} and user_id != #{@user.id}").order("updated_at desc")
|
||||
end
|
||||
|
||||
#根据 作业+资源数排序
|
||||
if @order.to_i == 2
|
||||
if @order.to_i == 1 #根据 班级更新时间排序
|
||||
@syllabuses = syllabus_course_list_sort @syllabuses
|
||||
@c_sort == 1 ? (@syllabuses = @syllabuses.sort{|x,y| x[:last_update] <=> y[:last_update] }) : (@syllabuses = @syllabuses.sort{|x,y| y[:last_update] <=> x[:last_update]})
|
||||
@type = 1
|
||||
elsif @order.to_i == 2 #根据 作业+资源数排序
|
||||
@type = 2
|
||||
@syllabus.each do |syllabus|
|
||||
@syllabuses.each do |syllabus|
|
||||
count = 0
|
||||
courses = @courses.where("syllabus_id = #{syllabus.id}")
|
||||
courses = syllabus.courses.not_deleted
|
||||
courses.each do |c|
|
||||
count += (User.current.admin? || User.current.allowed_to?(:as_teacher,c)) ? (c.homework_commons.count + visable_attachemnts_incourse(c).count) : (c.homework_commons.where("publish_time <= '#{Date.today}'").count + visable_attachemnts_incourse(c).count)
|
||||
end
|
||||
syllabus[:infocount] = count
|
||||
end
|
||||
@c_sort == 1 ? (@syllabus = @syllabus.sort{|x,y| x[:infocount] <=> y[:infocount] }) : (@syllabus = @syllabus.sort{|x,y| y[:infocount] <=> x[:infocount]})
|
||||
@syllabus = sortby_time_countcommon_nosticky @syllabus,sort_name
|
||||
@c_sort == 1 ? (@syllabuses = @syllabuses.sort{|x,y| x[:infocount] <=> y[:infocount] }) : (@syllabuses = @syllabuses.sort{|x,y| y[:infocount] <=> x[:infocount]})
|
||||
@syllabuses = sortby_time_countcommon_nosticky @syllabuses,sort_name
|
||||
else
|
||||
@type = 1
|
||||
end
|
||||
|
||||
#分页
|
||||
@limit = 10
|
||||
@is_remote = true
|
||||
@atta_count = @syllabus.count
|
||||
@atta_pages = Paginator.new @atta_count, @limit, params['page'] || 1
|
||||
@offset ||= @atta_pages.offset
|
||||
@syllabus = paginateHelper @syllabus,@limit
|
||||
|
||||
respond_to do |format|
|
||||
format.js
|
||||
format.html {render :layout => 'new_base_user'}
|
||||
end
|
||||
end
|
||||
|
||||
#展开课程下的班级
|
||||
def expand_courses
|
||||
@syllabus = Syllabus.where("id = #{params[:syllabus_id]}").first
|
||||
unless @syllabus.nil?
|
||||
@courses = @syllabus.courses.not_deleted.select("courses.*,(SELECT MAX(updated_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS updatetime").order("updatetime desc")
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -3342,6 +3388,8 @@ class UsersController < ApplicationController
|
|||
when 'Syllabus'
|
||||
obj = Syllabus.where('id = ?', params[:id].to_i).first
|
||||
@journals = obj.journals_for_messages.reorder("created_on desc")
|
||||
@type = 'Syllabus'
|
||||
@user_activity_id = params[:div_id].to_i if params[:div_id]
|
||||
when 'JournalsForMessage'
|
||||
obj = JournalsForMessage.where('id = ?', params[:id].to_i).first
|
||||
journals = []
|
||||
|
@ -3358,6 +3406,7 @@ class UsersController < ApplicationController
|
|||
@user_activity_id = params[:div_id].to_i if params[:div_id]
|
||||
@homepage = params[:homepage].to_i
|
||||
@type = 'BlogComment'
|
||||
@user_id = obj.author_id
|
||||
comments = []
|
||||
@journals = get_all_children(comments, obj)
|
||||
when 'HomeworkCommon'
|
||||
|
|
|
@ -112,6 +112,10 @@ class WordsController < ApplicationController
|
|||
end
|
||||
@is_in_course = params[:is_in_course].to_i
|
||||
@course_activity = params[:course_activity].to_i
|
||||
elsif @journal_destroyed.jour_type == 'Syllabus'
|
||||
@syllabus = Syllabus.find @journal_destroyed.jour_id
|
||||
@count = @syllabus.journals_for_messages.count
|
||||
@comments = @syllabus.journals_for_messages.reorder("created_on desc").limit(3)
|
||||
end
|
||||
respond_to do |format|
|
||||
format.js
|
||||
|
@ -352,6 +356,35 @@ class WordsController < ApplicationController
|
|||
render_403
|
||||
end
|
||||
end
|
||||
|
||||
#课程大纲的二级回复
|
||||
def reply_to_syllabus
|
||||
if User.current.logged?
|
||||
@user = User.current
|
||||
reply = JournalsForMessage.find params[:id].to_i
|
||||
@syllabus = Syllabus.find reply.jour_id
|
||||
if params[:reply_message].size>0 && User.current.logged? && @user
|
||||
options = {:notes => params[:reply_message], :reply_id => reply.user_id,:user_id => @user.id,:m_parent_id => params[:id].to_i,:m_reply_id => params[:id].to_i}
|
||||
feedback = Syllabus.add_syllabus_jour(@user, params[:reply_message], reply.jour_id, options)
|
||||
if (feedback.errors.empty?)
|
||||
if params[:asset_id]
|
||||
ids = params[:asset_id].split(',')
|
||||
update_kindeditor_assets_owner ids,feedback[:id],OwnerTypeHelper::JOURNALSFORMESSAGE
|
||||
end
|
||||
@syllabus.update_column('updated_at', Time.now)
|
||||
@count = @syllabus.journals_for_messages.count
|
||||
@comments = @syllabus.journals_for_messages.reorder("created_on desc").limit(3)
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
else
|
||||
flash[:error] = feedback.errors.full_messages[0]
|
||||
end
|
||||
end
|
||||
else
|
||||
render_403
|
||||
end
|
||||
end
|
||||
|
||||
def add_brief_introdution
|
||||
user = User.current
|
||||
|
|
|
@ -274,14 +274,19 @@ module CoursesHelper
|
|||
#searchPeopleByRoles(project, TeacherRoles)
|
||||
members = []
|
||||
project.members.includes(:user).each do |m|
|
||||
members << m if m && m.user && m.user.allowed_to?(:as_teacher,project)
|
||||
#members << m if m && m.user && m.user.allowed_to?(:as_teacher,project)
|
||||
members << m if m && m.user && m.user.has_teacher_role(project)
|
||||
end
|
||||
members
|
||||
end
|
||||
|
||||
def TeacherAndAssistantCount course
|
||||
students_count = course.student.count
|
||||
number = course.members.count - students_count
|
||||
#students_count = course.student.count
|
||||
#number = course.members.count - students_count
|
||||
member_ids = course.members.includes(:user).blank? ? "(-1)" : "(" + course.members.includes(:user).map { |mem| mem.id}.join(",") + ")"
|
||||
role_ids = "(3, 7, 9)"
|
||||
number = MemberRole.where("member_id in #{member_ids} and role_id in #{role_ids}").count
|
||||
#number = (searchTeacherAndAssistant course).count
|
||||
end
|
||||
|
||||
def search_student_in_group(project, course_group_id)
|
||||
|
@ -789,7 +794,7 @@ module CoursesHelper
|
|||
if user.logged?
|
||||
joined = course.members.includes(:user).map{|member| member.user_id}.include? user.id
|
||||
text = joined ? l(:label_course_exit_student) : l(:label_course_join_student)
|
||||
url = joined ? join_path(:object_id => course.id) : try_join_path(:object_id => course.id)
|
||||
url = joined ? join_path(:object_id => course.id) : join_private_courses_courses_path()
|
||||
method = joined ? 'delete' : 'post'
|
||||
if joined
|
||||
link = link_to(text, url, :remote => true, :method => method, :class => "sy_btn_grey fl", :id => "#{course.id}", :confirm => l(:text_are_you_sure_out))
|
||||
|
@ -831,6 +836,10 @@ module CoursesHelper
|
|||
result = l(:label_student)
|
||||
elsif role == "Manager"
|
||||
result = l(:field_admin)
|
||||
elsif role.include?("TeachingAsistant") && role.include?("Student")
|
||||
result = l(:label_TA) + " " + l(:label_student)
|
||||
elsif role.include?("Teacher") && role.include?("Student")
|
||||
result = l(:label_teacher) + " " + l(:label_student)
|
||||
end
|
||||
result
|
||||
end
|
||||
|
@ -914,5 +923,15 @@ module CoursesHelper
|
|||
resource_num*5 + journal_num + homework_journal_num ) desc limit 3;")
|
||||
end
|
||||
|
||||
#用户在该课程是否具有某个角色
|
||||
def get_user_member_roles_course course, user, role
|
||||
members = course.members.where("user_id = #{user.id}")
|
||||
result = false
|
||||
unless members.blank?
|
||||
m_roles = MemberRole.where("member_id = #{members.first.id} and role_id = #{role}")
|
||||
end
|
||||
result = !m_roles.blank?
|
||||
result
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -54,6 +54,44 @@ module UsersHelper
|
|||
end
|
||||
end
|
||||
|
||||
# 获取消息角色
|
||||
def applied_project_message_type role
|
||||
case role
|
||||
when 3
|
||||
"管理员"
|
||||
when 4
|
||||
"开发人员"
|
||||
when 5
|
||||
"报告人员"
|
||||
end
|
||||
end
|
||||
|
||||
# 判断当前用户能否对消息进行操作
|
||||
def allow_to_show applied_message
|
||||
(User.current.id == applied_message.user_id && applied_message.status == 1) ? true : false
|
||||
end
|
||||
|
||||
# 项目申请消息通过状态判断用户
|
||||
# status(1:申请的消息;2:已操作过该消息(包括同意或者拒绝,消息状态更新);3:拒绝消息;4:被拒人收到消息;5:拒绝者收到消息;6:同意后申请人收到消息;7:同意后批准人收到消息)
|
||||
def applied_project_users applied_message
|
||||
# case applied_message.status
|
||||
# when 3,2,1,5,4,7,6
|
||||
user = User.find(applied_message.applied_user_id)
|
||||
# end
|
||||
end
|
||||
|
||||
# 项目申请消息通过状态判断tip描述
|
||||
def applied_project_tip applied_message
|
||||
case applied_message.status
|
||||
when 4
|
||||
"拒绝申请加入项目:"
|
||||
when 5,3,2,1,7
|
||||
"申请加入项目:"
|
||||
when 6
|
||||
"同意申请加入项目"
|
||||
end
|
||||
end
|
||||
|
||||
def get_resource_origin attach
|
||||
type = attach.container_type
|
||||
content = attach.container
|
||||
|
@ -690,4 +728,18 @@ module UsersHelper
|
|||
end
|
||||
result_ids
|
||||
end
|
||||
|
||||
#课程的班级列表最近更新时间
|
||||
def syllabus_course_list_sort syllabuses
|
||||
syllabuses.each do |sy|
|
||||
updated_at = sy.updated_at
|
||||
courses = sy.courses.not_deleted
|
||||
unless courses.empty?
|
||||
course_ids = "(" + courses.map { |course| course.id}.join(",") + ")"
|
||||
updated_at = CourseActivity.where("course_id in #{course_ids}").order("updated_at desc").first.updated_at
|
||||
end
|
||||
sy[:last_update] = updated_at
|
||||
end
|
||||
syllabuses
|
||||
end
|
||||
end
|
||||
|
|
|
@ -364,22 +364,29 @@ module WatchersHelper
|
|||
:class => "pr_join_a" ,:id=>id
|
||||
end
|
||||
|
||||
#申请加入项目
|
||||
# 申请加入项目
|
||||
def join_in_project_link(project, user, options=[])
|
||||
return '' unless user && user.logged?
|
||||
applied = project.applied_projects.find_by_user_id(user.id)
|
||||
text = applied ? l(:label_unapply_project) : l(:label_apply_project)
|
||||
@applied_flag = project.instance_of?(Project)
|
||||
url = applied_join_project_path(:object_id => project.id)
|
||||
method = 'post'
|
||||
@applied_flag = project.instance_of?(Project)
|
||||
if applied
|
||||
appliedid = applied.id
|
||||
link = "<a class ='pr_join_a'>#{text}</a>"
|
||||
else
|
||||
link = link_to(text, url, :remote => true, :method => method, :id => "#{project.id}", :class => "pr_join_a")
|
||||
end
|
||||
id = applied_css(project)
|
||||
url = appliedproject_path(
|
||||
:id=>appliedid,
|
||||
:user_id => user.id,
|
||||
:project_id => project.id)
|
||||
method = applied ? 'delete' : 'post'
|
||||
link_to text, url, :remote => true, :method => method , :class => "pr_join_a",:id => id
|
||||
link.html_safe
|
||||
# if applied
|
||||
# appliedid = applied.id
|
||||
# end
|
||||
# id = applied_css(project)
|
||||
# url = appliedproject_path(
|
||||
# :id=>appliedid,
|
||||
# :user_id => user.id,
|
||||
# :project_id => project.id)
|
||||
# method = applied ? 'delete' : 'post'
|
||||
# link_to text, url, :remote => true, :method => method , :class => "pr_join_a",:id => id
|
||||
end
|
||||
|
||||
def paginateHelper obj, pre_size=20
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
class AppliedMessage < ActiveRecord::Base
|
||||
# status: 0表示未批准; status:1表示已批准; status: 2表示已拒绝
|
||||
attr_accessible :applied_id, :applied_type, :status, :user_id, :viewed, :name
|
||||
|
||||
attr_accessible :applied_id, :applied_type, :status, :user_id, :viewed, :applied_user_id, :role, :project_id, :name
|
||||
belongs_to :applied ,:polymorphic => true
|
||||
belongs_to :apply_add_schools
|
||||
belongs_to :user
|
||||
|
|
|
@ -1,18 +1,16 @@
|
|||
class AppliedProject < ActiveRecord::Base
|
||||
attr_accessible :project_id, :user_id
|
||||
attr_accessible :project_id, :user_id, :role
|
||||
|
||||
belongs_to :user
|
||||
belongs_to :project
|
||||
has_many :forge_messages, :class_name => 'ForgeMessage', :as => :forge_message, :dependent => :destroy
|
||||
has_many :applied_messages, :class_name => 'AppliedMessage', :as => :applied, :dependent => :destroy
|
||||
|
||||
after_create :send_appliled_message
|
||||
|
||||
# 仅仅给项目管理人员发送消息
|
||||
def send_appliled_message
|
||||
# if MessageAll.where("message_type = '#{self.class.to_s}' and message_id = '#{self.id}'").first.nil?
|
||||
self.project.members.each do |m|
|
||||
if m.roles.first.to_s.include?("Manager")
|
||||
self.forge_messages << ForgeMessage.new(:user_id => m.user_id, :project_id => self.project_id, :viewed => false)
|
||||
end
|
||||
self.project.managers.each do |member|
|
||||
self.applied_messages << AppliedMessage.new(:user_id => member.user_id, :status => true, :viewed => false, :applied_user_id => self.user_id, :role => self.role, :project_id => self.project_id)
|
||||
end
|
||||
# end
|
||||
end
|
||||
|
|
|
@ -53,7 +53,15 @@ class Member < ActiveRecord::Base
|
|||
|
||||
new_role_ids = ids - role_ids
|
||||
# Add new roles
|
||||
new_role_ids.each {|id| member_roles << MemberRole.new(:role_id => id) }
|
||||
if new_role_ids.include?(7) && new_role_ids.include?(10)
|
||||
member_roles << MemberRole.new(:role_id => 7)
|
||||
member_roles << MemberRole.new(:role_id => 10, :is_current => 0)
|
||||
elsif new_role_ids.include?(9) && new_role_ids.include?(10)
|
||||
member_roles << MemberRole.new(:role_id => 9)
|
||||
member_roles << MemberRole.new(:role_id => 10, :is_current => 0)
|
||||
else
|
||||
new_role_ids.each {|id| member_roles << MemberRole.new(:role_id => id) }
|
||||
end
|
||||
# Remove roles (Rails' #role_ids= will not trigger MemberRole#on_destroy)
|
||||
member_roles_to_destroy = member_roles.select {|mr| !ids.include?(mr.role_id)}
|
||||
if member_roles_to_destroy.any?
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
class MemberRole < ActiveRecord::Base
|
||||
# multi_role 课程中的多重角色 0:单角色/学生,1:管理员&学生,2:教师&学生,3:教辅&学生
|
||||
belongs_to :member
|
||||
belongs_to :role
|
||||
|
||||
|
|
|
@ -269,6 +269,11 @@ class Project < ActiveRecord::Base
|
|||
notified.collect(&:mail)
|
||||
end
|
||||
|
||||
# 返回为member类型数组
|
||||
def managers
|
||||
self.members.includes(:roles).select{|member| member.roles[0].try(:name) == "Manager"}
|
||||
end
|
||||
|
||||
def initialize(attributes=nil, *args)
|
||||
super
|
||||
|
||||
|
@ -905,6 +910,24 @@ class Project < ActiveRecord::Base
|
|||
User.find(self.user_id)
|
||||
end
|
||||
|
||||
# 延迟生成邀请码
|
||||
def invite_code
|
||||
return generate_invite_code
|
||||
end
|
||||
|
||||
# 生成邀请码
|
||||
# 如果已有改邀请码,则重新生成
|
||||
CODES = %W(2 3 4 5 6 7 8 9 A B C D E F G H J K L N M O P Q R S T U V W X Y Z)
|
||||
def generate_invite_code
|
||||
code = read_attribute(:invite_code)
|
||||
if !code || code.size <6
|
||||
code = CODES.sample(6).join
|
||||
return generate_invite_code if Project.where(invite_code: code).present?
|
||||
update_attribute(:invite_code, code)
|
||||
end
|
||||
code
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def after_parent_changed(parent_was)
|
||||
|
|
|
@ -42,12 +42,12 @@ class User < Principal
|
|||
# Different ways of displaying/sorting users
|
||||
USER_FORMATS = {
|
||||
:firstname_lastname => {
|
||||
:string => '#{firstname} #{lastname}',
|
||||
:string => '#{firstname}#{lastname}',
|
||||
:order => %w(firstname lastname id),
|
||||
:setting_order => 1
|
||||
},
|
||||
:firstname_lastinitial => {
|
||||
:string => '#{firstname} #{lastname.to_s.chars.first}.',
|
||||
:string => '#{firstname}#{lastname.to_s.chars.first}.',
|
||||
:order => %w(firstname lastname id),
|
||||
:setting_order => 2
|
||||
},
|
||||
|
@ -57,7 +57,7 @@ class User < Principal
|
|||
:setting_order => 3
|
||||
},
|
||||
:lastname_firstname => {
|
||||
:string => '#{lastname} #{firstname}',
|
||||
:string => '#{lastname}#{firstname}',
|
||||
:order => %w(lastname firstname id),
|
||||
:setting_order => 4
|
||||
},
|
||||
|
@ -369,7 +369,8 @@ class User < Principal
|
|||
system_messages_count = SystemMessage.where("created_at >?", onclick_time).count
|
||||
at_count = AtMessage.where("user_id =? and viewed =? and created_at >?", user.id, 0, onclick_time).count
|
||||
org_count = OrgMessage.where("user_id=? and viewed =? and created_at >?", user.id,0, onclick_time).count
|
||||
messages_count = course_count + forge_count + user_feedback_count + user_memo_count + system_messages_count + at_count + org_count
|
||||
applied_count = AppliedMessage.where("user_id=? and viewed =? and created_at >?", user.id, 0, onclick_time).count
|
||||
messages_count = course_count + forge_count + user_feedback_count + user_memo_count + system_messages_count + at_count + org_count + applied_count
|
||||
end
|
||||
|
||||
# 查询指派给我的缺陷记录
|
||||
|
@ -823,7 +824,7 @@ class User < Principal
|
|||
# Find course membership
|
||||
membership = coursemembership(course)
|
||||
if membership
|
||||
roles = membership.roles
|
||||
roles = membership.roles.where("is_current = 1")
|
||||
else
|
||||
@role_non_member ||= Role.non_member
|
||||
roles << @role_non_member
|
||||
|
@ -918,6 +919,12 @@ class User < Principal
|
|||
end
|
||||
end
|
||||
|
||||
#是否具有老师角色
|
||||
def has_teacher_role(course)
|
||||
member = course.members.where("user_id = #{self.id}").first
|
||||
role = MemberRole.where("member_id = #{member.id} and role_id in (3, 7, 9)")
|
||||
!role.blank?
|
||||
end
|
||||
|
||||
# Return true if the user is allowed to do the specified action on a specific context
|
||||
# Action can be:
|
||||
|
|
|
@ -391,6 +391,103 @@ class CoursesService
|
|||
{:state => @state,:course => course}
|
||||
end
|
||||
|
||||
#多个角色加入课程
|
||||
def join_course_roles params,current_user
|
||||
course = Course.find_by_invite_code(params[:invite_code]) if params[:invite_code]
|
||||
|
||||
@state = 10
|
||||
if course
|
||||
if course_endTime_timeout? course
|
||||
@state = 2
|
||||
elsif course[:is_delete] == 1
|
||||
@state = 11
|
||||
else
|
||||
if current_user.member_of_course?(course) #如果已经是成员
|
||||
@state = 3
|
||||
# member = course.members.where("user_id=#{current_user.id} and course_id=#{course.id}")[0]
|
||||
# role_ids = params[:role]
|
||||
# #roleName = member.roles[0].name if member
|
||||
# #roleName = member.roles.map{|role| role.name}.join(",") if member
|
||||
# if params[:invite_code].present?
|
||||
# #如果加入角色为学生 并且当前是学生
|
||||
# if role_ids == "10" && roleName.include?("Student") && !roleName.include?("Teacher") && !roleName.include?("TeachingAsistant")&& !roleName.include?("Manager")
|
||||
# @state = 3
|
||||
# #如果加入的角色为老师,并且当前已经是老师
|
||||
# elsif role_ids == "9" && roleName.include?("Teacher") && !roleName.include?("Student")
|
||||
# @state = 8
|
||||
# #如果加入的角色教辅并且当前为教辅
|
||||
# elsif role_ids == "7" && roleName.include?("TeachingAsistant") && !roleName.include?("Student")
|
||||
# @state = 9
|
||||
# elsif roleName.include?("Manager")
|
||||
# @state = 10
|
||||
# #如果加入角色为教师或者教辅,并且当前是学生,或者是要成为教辅,当前不是教辅,或者要成为教师,当前不是教师。那么要发送请求
|
||||
# elsif (params[:role] != "10" && roleName == "Student") || (params[:role] == "7" && roleName != "TeachingAsistant" ) || (params[:role] == "9" && roleName != "Teacher" )
|
||||
# #如果已经发送过消息了,那么就要给个提示
|
||||
# if CourseMessage.where("course_message_type = 'JoinCourseRequest' and user_id = #{course.tea_id} and content = #{params[:role]} and course_message_id = #{User.current.id} and course_id = #{course.id} and status = 0 ").count != 0
|
||||
# @state = 7
|
||||
# else
|
||||
# Mailer.run.join_course_request(course, User.current, params[:role])
|
||||
# CourseMessage.create(:user_id => course.tea_id, :course_id => course.id, :viewed => false,:content=> params[:role],:course_message_id=>User.current.id,:course_message_type=>'JoinCourseRequest',:status=>0)
|
||||
# @state = 6
|
||||
# end
|
||||
# #如果加入角色是学生,但是是当前课程的教师或者教辅
|
||||
# elsif params[:role] == "10" && roleName != "Student"
|
||||
# member.role_ids = [params[:role]]
|
||||
# member.save
|
||||
# StudentsForCourse.create(:student_id => current_user.id, :course_id => course.id)
|
||||
# @state = 0
|
||||
# end
|
||||
# else
|
||||
# @state = 1
|
||||
# end
|
||||
else
|
||||
if params[:invite_code].present?
|
||||
role_ids = params[:role]
|
||||
role_str = role_ids.join(",")
|
||||
if role_ids.include?("10") && !role_ids.include?("7") && !role_ids.include?("9")
|
||||
members = []
|
||||
members << Member.new(:role_ids => [10], :user_id => current_user.id)
|
||||
course.members << members
|
||||
StudentsForCourse.create(:student_id => current_user.id, :course_id => course.id)
|
||||
@state = 0
|
||||
else
|
||||
is_stu = false
|
||||
if role_ids.include?("10")
|
||||
members = []
|
||||
members << Member.new(:role_ids => [10], :user_id => current_user.id)
|
||||
course.members << members
|
||||
StudentsForCourse.create(:student_id => current_user.id, :course_id =>course.id)
|
||||
is_stu = true
|
||||
end
|
||||
#如果已经发送过消息了,那么就要给个提示
|
||||
if CourseMessage.where("course_message_type = 'JoinCourseRequest' and user_id = #{course.tea_id} and content = '#{role_str}' and course_message_id = #{User.current.id} and course_id = #{course.id} and status = 0").count != 0
|
||||
if is_stu
|
||||
@state = 12
|
||||
else
|
||||
@state = 7
|
||||
end
|
||||
else
|
||||
Mailer.run.join_course_request(course, User.current, params[:role])
|
||||
CourseMessage.create(:user_id => course.tea_id, :course_id => course.id, :viewed => false,:content=> role_str,:course_message_id=>User.current.id,:course_message_type=>'JoinCourseRequest',:status=>0)
|
||||
if is_stu
|
||||
@state = 13
|
||||
else
|
||||
@state = 6
|
||||
end
|
||||
end
|
||||
end
|
||||
else
|
||||
@state = 1
|
||||
end
|
||||
end
|
||||
end
|
||||
else
|
||||
@state = 4
|
||||
end
|
||||
{:state => @state,:course => course}
|
||||
end
|
||||
|
||||
|
||||
#作业列表
|
||||
#已提交的作业数量获取 bid.homeworks.count
|
||||
#学生提问数量获取 bid.commit.nil? ? 0 : bid.commit
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
<%= stylesheet_link_tag 'css/common','css/popup' %>
|
||||
|
||||
<div class="boxContainer" style="height: auto;">
|
||||
<div class="sendText fl mr10" style="width: auto">更改为</div>
|
||||
<div class="cl"></div>
|
||||
|
@ -16,7 +15,7 @@
|
|||
function school_submit() {
|
||||
var checkboxs = $("input[name='school_id[]']:checked");
|
||||
if(checkboxs.length == 0) {
|
||||
$("#choose_courses_notice").text("请先选择班级");
|
||||
$("#choose_courses_notice").text("请选择单位");
|
||||
} else{
|
||||
$("#choose_courses_notice").text("");
|
||||
$("#schools_list_form").submit();
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
</span>
|
||||
</td>
|
||||
<td align="center">
|
||||
<%= link_to(course.teacher.show_name.truncate(6, omission: '...'), user_path(course.teacher)) %>
|
||||
<%= link_to(course.teacher.show_name, user_path(course.teacher)) %>
|
||||
</td>
|
||||
<td align="center">
|
||||
<%= course.class_period %>
|
||||
|
|
|
@ -23,8 +23,11 @@
|
|||
<th style="width: 20px;">
|
||||
序号
|
||||
</th>
|
||||
<th style="width: 85px;">
|
||||
单位名称
|
||||
<th style="width: 85px;" class = "<%= @order == 'name' ? (@sort == 'desc' ? 'st_up' : (@sort == 'asc' ? 'st_down' : '')) : '' %>">
|
||||
<%= link_to '单位名称', apply_shcool_sort_path(:sort=> @sort == "desc" ? 'asc' : 'desc', :order => 'name', :tip=>'unapplied') %>
|
||||
</th>
|
||||
<th style="width: 30px;">
|
||||
申请者
|
||||
</th>
|
||||
<th style="width: 75px;">
|
||||
地区
|
||||
|
@ -46,18 +49,66 @@
|
|||
<tbody>
|
||||
<% @apply_status.each do |apply| %>
|
||||
<% if apply.status == 0 %>
|
||||
<tr class="<%= cycle("odd", "even") %>">
|
||||
<tr class="<%= cycle("odd", "even") %>">
|
||||
<td style="text-align: center;">
|
||||
<%= apply.id %>
|
||||
</td>
|
||||
<td style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" class="name" title='<%=apply.name%>' id="apply_title_<%= apply.id %>">
|
||||
<%= apply.name %>
|
||||
<td class="name" title='<%=apply.name%>' >
|
||||
<span id="apply_title_<%= apply.id %>"><%= apply.name %></span>
|
||||
<textarea style="display: none; width:100px; height:16px; border:1px solid #ddd; outline:none; padding:0 0 0 5px; resize:none; overflow:hidden;" placeholder="请编辑单位名称" id="school_name_edit_<%=apply.id%>" onblur="edit_school_name('<%= edit_apply_name_school_path(apply.id)%>','<%= apply.id %>');"><%= apply.name %></textarea>
|
||||
</td>
|
||||
<td class="center">
|
||||
<%= apply.province + apply.city %>
|
||||
<% user = User.where("id=?", apply.user_id).first %>
|
||||
<% unless user.nil? %>
|
||||
<%=link_to user.show_name, user_path(user),:target => '_blank' %>
|
||||
<% end %>
|
||||
</td>
|
||||
<td align="left" style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;">
|
||||
<%= apply.address %>
|
||||
<td class="center">
|
||||
<span ondblclick = "show_edit_school_province('<%= apply.id %>');" id="apply_province_<%= apply.id %>">
|
||||
<%= (apply.province.nil? ? "" : apply.province) + (apply.city.nil? ? "" : apply.city) %>
|
||||
</span>
|
||||
<select onchange="showcity(this.value, document.getElementById('schoolCity_<%=apply.id%>'));edit_school_province('<%= edit_apply_province_school_path(apply.id)%>','<%= apply.id %>');" name="province" id="school_province_edit_<%=apply.id%>" class="fl" style="width:50px; height:18px; display: none">
|
||||
<option value="北京">北京</option>
|
||||
<option value="上海">上海</option>
|
||||
<option value="广东">广东</option>
|
||||
<option value="江苏">江苏</option>
|
||||
<option value="浙江">浙江</option>
|
||||
<option value="重庆">重庆</option>
|
||||
<option value="安徽">安徽</option>
|
||||
<option value="福建">福建</option>
|
||||
<option value="甘肃">甘肃</option>
|
||||
<option value="广西">广西</option>
|
||||
<option value="贵州">贵州</option>
|
||||
<option value="海南">海南</option>
|
||||
<option value="河北">河北</option>
|
||||
<option value="黑龙江">黑龙江</option>
|
||||
<option value="河南">河南</option>
|
||||
<option value="湖北">湖北</option>
|
||||
<option value="湖南">湖南</option>
|
||||
<option value="江西">江西</option>
|
||||
<option value="吉林">吉林</option>
|
||||
<option value="辽宁">辽宁</option>
|
||||
<option value="内蒙古">内蒙古</option>
|
||||
<option value="宁夏">宁夏</option>
|
||||
<option value="青海">青海</option>
|
||||
<option value="山东">山东</option>
|
||||
<option value="山西">山西</option>
|
||||
<option value="陕西">陕西</option>
|
||||
<option value="四川">四川</option>
|
||||
<option value="天津">天津</option>
|
||||
<option value="新疆">新疆</option>
|
||||
<option value="西藏">西藏</option>
|
||||
<option value="云南">云南</option>
|
||||
<option value="香港">香港特别行政区</option>
|
||||
<option value="澳门">澳门特别行政区</option>
|
||||
<option value="台湾">台湾</option>
|
||||
<option value="海外">海外</option>
|
||||
</select>
|
||||
<select onchange="edit_school_province('<%= edit_apply_province_school_path(apply.id)%>','<%= apply.id %>');" name="city" id="schoolCity_<%=apply.id%>" class="fl ml5" style="width:50px; height:18px; display: none"></select>
|
||||
</td>
|
||||
<td class="center">
|
||||
<span title="双击可编辑" ondblclick = "show_edit_school_address('<%= apply.id %>');" id="apply_address_<%= apply.id %>"><%= apply.address %></span>
|
||||
<textarea style="display: none; width:100px; height:16px; border:1px solid #ddd; outline:none; padding:0 0 0 5px; resize:none; overflow:hidden;" placeholder="请编辑单位地址" id="school_address_edit_<%=apply.id%>" onblur="edit_school_address('<%= edit_apply_address_school_path(apply.id)%>','<%= apply.id %>');"><%= apply.address %></textarea>
|
||||
</td>
|
||||
<td class="center">
|
||||
<% count = UserExtensions.where("school_id = #{apply.school_id}").count %>
|
||||
|
@ -67,13 +118,16 @@
|
|||
<%= format_date(apply.created_at) %>
|
||||
</td>
|
||||
<td class="center">
|
||||
<%= link_to( l(:label_approve), { :controller => 'admin', :action => 'approve_applied_schools', :id => apply.id }, :class => 'icon-del') %>
|
||||
<%= link_to( l(:button_delete), { :controller => 'admin', :action => 'delete_applied_schools', :id => apply.id },:method => :delete, :confirm => l(:text_are_you_sure), :class => 'icon-del') %>
|
||||
<%=link_to '更改', admin_all_schools_path(:school_id =>apply.id), :remote => true %>
|
||||
<%= link_to( l(:label_approve), { :controller => 'admin', :action => 'approve_applied_schools', :id => apply.id }, :class => "application-default-link" ) %>
|
||||
<%= link_to( l(:button_delete), { :controller => 'admin', :action => 'delete_applied_schools', :id => apply.id, :tip => 'unapplied' },:method => :delete, :confirm => l(:text_are_you_sure), :class => "application-default-link") %>
|
||||
<%=link_to '更改', admin_all_schools_path(:school_id =>apply.id), :remote => true, :class => "application-default-link" %>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<% unless apply.remarks.empty? %>
|
||||
<script>
|
||||
init_province_and_city(document.getElementById('school_province_edit_<%=apply.id%>'), '<%=apply.province%>', document.getElementById('schoolCity_<%=apply.id%>'), '<%=apply.city%>');
|
||||
</script>
|
||||
<% unless apply.remarks.blank? %>
|
||||
<tr class="odd">
|
||||
<td>
|
||||
|
||||
|
@ -87,4 +141,7 @@
|
|||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<ul class="wlist" id="pages" style="float: right;margin-top: 10px;">
|
||||
<%= pagination_links_full @apply_pages, @apply_count ,:per_page_links => true, :remote => false, :flag => true %>
|
||||
</ul>
|
|
@ -23,10 +23,13 @@
|
|||
<th style="width: 20px;">
|
||||
序号
|
||||
</th>
|
||||
<th style="width: 85px;">
|
||||
<th style="width: 80px;">
|
||||
单位名称
|
||||
</th>
|
||||
<th style="width: 75px;">
|
||||
<th style="width: 30px;">
|
||||
申请者
|
||||
</th>
|
||||
<th style="width: 95px;">
|
||||
地区
|
||||
</th>
|
||||
<th style="width: 75px;">
|
||||
|
@ -35,7 +38,10 @@
|
|||
<th style="width: 85px;">
|
||||
原名
|
||||
</th>
|
||||
<th style="width: 60px;">
|
||||
<th style="width: 30px;">
|
||||
用户
|
||||
</th>
|
||||
<th style="width: 65px;">
|
||||
创建时间
|
||||
</th>
|
||||
<th style="width: 75px;">
|
||||
|
@ -50,37 +56,88 @@
|
|||
<td style="text-align: center;">
|
||||
<%= apply.id %>
|
||||
</td>
|
||||
<td style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" class="name" title='<%=apply.name%>' id="apply_title_<%= apply.id %>">
|
||||
<%= (School.find apply.school_id).name %>
|
||||
<td class="name" title='<%=apply.name%>' >
|
||||
<% unless apply.school_id.nil? %>
|
||||
<% school_name = School.where("id=?", apply.school_id).first %>
|
||||
<span title="双击可编辑" ondblclick = "show_edit_school_name('<%= apply.id %>');" id="apply_title_<%= apply.id %>"><%= school_name %></span>
|
||||
<textarea style="display: none; width:100px; height:16px; border:1px solid #ddd; outline:none; padding:0 0 0 5px; resize:none; overflow:hidden;" placeholder="请编辑单位名称" id="school_name_edit_<%=apply.id%>" onblur="edit_school_name('<%= edit_apply_name_school_path(apply.id)%>','<%= apply.id %>');"><%= school_name %></textarea>
|
||||
<% end %>
|
||||
</td>
|
||||
<td class="center">
|
||||
<%= (School.find apply.school_id).province %>
|
||||
<% user = User.where("id=?", apply.user_id).first%>
|
||||
<% unless user.nil? %>
|
||||
<%=link_to user.show_name, user_path(user), :target => '_blank'%>
|
||||
<% end %>
|
||||
</td>
|
||||
<td align="left" style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;">
|
||||
<%= apply.address %>
|
||||
<td class="center">
|
||||
<span ondblclick = "show_edit_school_province('<%= apply.id %>');" id="apply_province_<%= apply.id %>">
|
||||
<%= (apply.province.nil? ? "" : apply.province) + (apply.city.nil? ? "" : apply.city) %>
|
||||
</span>
|
||||
<select onchange="showcity(this.value, document.getElementById('schoolCity_<%=apply.id%>'));edit_school_province('<%= edit_apply_province_school_path(apply.id)%>','<%= apply.id %>');" name="province" id="school_province_edit_<%=apply.id%>" class="fl" style="width:50px; height:18px; display: none">
|
||||
<option value="北京">北京</option>
|
||||
<option value="上海">上海</option>
|
||||
<option value="广东">广东</option>
|
||||
<option value="江苏">江苏</option>
|
||||
<option value="浙江">浙江</option>
|
||||
<option value="重庆">重庆</option>
|
||||
<option value="安徽">安徽</option>
|
||||
<option value="福建">福建</option>
|
||||
<option value="甘肃">甘肃</option>
|
||||
<option value="广西">广西</option>
|
||||
<option value="贵州">贵州</option>
|
||||
<option value="海南">海南</option>
|
||||
<option value="河北">河北</option>
|
||||
<option value="黑龙江">黑龙江</option>
|
||||
<option value="河南">河南</option>
|
||||
<option value="湖北">湖北</option>
|
||||
<option value="湖南">湖南</option>
|
||||
<option value="江西">江西</option>
|
||||
<option value="吉林">吉林</option>
|
||||
<option value="辽宁">辽宁</option>
|
||||
<option value="内蒙古">内蒙古</option>
|
||||
<option value="宁夏">宁夏</option>
|
||||
<option value="青海">青海</option>
|
||||
<option value="山东">山东</option>
|
||||
<option value="山西">山西</option>
|
||||
<option value="陕西">陕西</option>
|
||||
<option value="四川">四川</option>
|
||||
<option value="天津">天津</option>
|
||||
<option value="新疆">新疆</option>
|
||||
<option value="西藏">西藏</option>
|
||||
<option value="云南">云南</option>
|
||||
<option value="香港">香港特别行政区</option>
|
||||
<option value="澳门">澳门特别行政区</option>
|
||||
<option value="台湾">台湾</option>
|
||||
<option value="海外">海外</option>
|
||||
</select>
|
||||
<select onchange="edit_school_province('<%= edit_apply_province_school_path(apply.id)%>','<%= apply.id %>');" name="city" id="schoolCity_<%=apply.id%>" class="fl ml5" style="width:50px; height:18px; display: none"></select>
|
||||
</td>
|
||||
<td class="center">
|
||||
<span title="双击可编辑" ondblclick = "show_edit_school_address('<%= apply.id %>');" id="apply_address_<%= apply.id %>"><%= apply.address %></span>
|
||||
<textarea style="display: none; width:100px; height:16px; border:1px solid #ddd; outline:none; padding:0 0 0 5px; resize:none; overflow:hidden;" placeholder="请编辑单位地址" id="school_address_edit_<%=apply.id%>" onblur="edit_school_address('<%= edit_apply_address_school_path(apply.id)%>','<%= apply.id %>');"><%= apply.address %></textarea>
|
||||
</td>
|
||||
<td class="center">
|
||||
<%= apply.name %>
|
||||
</td>
|
||||
<td class="center">
|
||||
<% count = UserExtensions.where("school_id = #{apply.school_id}").count %>
|
||||
<%= count %>
|
||||
</td>
|
||||
<td class="center">
|
||||
<%= format_date(apply.created_at) %>
|
||||
</td>
|
||||
<td class="center">
|
||||
<%= link_to( l(:button_delete), { :controller => 'admin', :action => 'delete_applied_schools', :id => apply.id },:method => :delete, :confirm => l(:text_are_you_sure), :class => 'icon-del') %>
|
||||
<%= link_to( l(:button_delete), { :controller => 'admin', :action => 'delete_applied_schools', :id => apply.id, :tip => 'applied' },:method => :delete, :confirm => l(:text_are_you_sure) ) %>
|
||||
</td>
|
||||
</tr>
|
||||
<% unless apply.remarks.empty? %>
|
||||
<tr class="odd">
|
||||
<td>
|
||||
|
||||
</td>
|
||||
<td style="text-align: left;" colspan="6">
|
||||
<%= apply.remarks %>
|
||||
</td>
|
||||
</tr>
|
||||
<script>
|
||||
init_province_and_city(document.getElementById('school_province_edit_<%=apply.id%>'), '<%=apply.province%>', document.getElementById('schoolCity_<%=apply.id%>'), '<%=apply.city%>');
|
||||
</script>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<ul class="wlist" id="pages" style="float: right;margin-top: 10px;">
|
||||
<%= pagination_links_full @has_apply_pages, @has_apply_count ,:per_page_links => true, :remote => false, :flag => true %>
|
||||
</ul>
|
|
@ -72,7 +72,7 @@
|
|||
</span>
|
||||
</td>
|
||||
<td align="center">
|
||||
<%= link_to(course.teacher.show_name.truncate(6, omission: '...'), user_path(course.teacher)) %>
|
||||
<%= link_to(course.teacher.show_name, user_path(course.teacher)) %>
|
||||
</td>
|
||||
<td align="center">
|
||||
<%= course.class_period %>
|
||||
|
|
|
@ -52,7 +52,7 @@
|
|||
<td class="center">
|
||||
</td>
|
||||
<td align="center">
|
||||
<%= link_to(syllabus.try(:user).try(:realname).truncate(6, omission: '...'), user_path(syllabus.user)) %>
|
||||
<%= link_to syllabus.user.show_name, user_path(syllabus.user) %>
|
||||
</td>
|
||||
<td class="center">
|
||||
<%= format_date(syllabus.created_at) %>
|
||||
|
@ -70,7 +70,7 @@
|
|||
<%= render :partial => 'admin/rename_course_name', :locals => {:course => course} %>
|
||||
</td>
|
||||
<td align="center">
|
||||
<%= link_to(course.try(:teacher).try(:realname).truncate(6, omission: '...'), user_path(course.teacher)) %>
|
||||
<%= link_to(course.teacher.show_name, user_path(course.teacher)) %>
|
||||
</td>
|
||||
<td class="center">
|
||||
<%= format_date(course.created_at) %>
|
||||
|
|
|
@ -0,0 +1,29 @@
|
|||
<div class="sy_popup_top">
|
||||
<h3 class="fl">欢迎加入项目</h3>
|
||||
<a href="javascript:void(0);" class="sy_icons_close fr" onclick="hideModal()"></a>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<div class="sy_popup_con" style="width:370px;">
|
||||
<%= form_tag( url_for(:controller => 'applied_project', :action => 'applied_project_info', :project_id => (@project.nil? ? nil : @project.id)), :remote => true, :id => 'project_applied_form') do %>
|
||||
<ul class="sy_popup_add ">
|
||||
<li>
|
||||
<label >项目邀请码:</label>
|
||||
<input name="invite_code" class=" sy_input_txt fl" placeholder="请输入六位项目邀请码" style="width:250px"/>
|
||||
<div class="cl"></div>
|
||||
</li>
|
||||
<li>
|
||||
<label >身份:</label>
|
||||
<input name="member" value="member_manager" type="radio" class="ml5 mr5 " /><span class="mr10">管理人员</span>
|
||||
<input name="member" value="member_developer" type="radio" class="ml5 mr5 " /><span class="mr10">开发人员</span>
|
||||
<input name="member" value="member_reporter" type="radio" class="ml5 mr5 " /><span class="mr10">报告人员</span>
|
||||
<div class="cl"></div>
|
||||
</li>
|
||||
<li>
|
||||
<label class="mr27"> </label>
|
||||
<a href="javascript:void(0);" class="sy_btn_blue fl" onclick="$('#project_applied_form').submit();hideModal()">确 定</a>
|
||||
<a href="javascript:void(0);" class="sy_btn_grey fl ml20" onclick="hideModal()">取 消</a>
|
||||
<div class="cl"></div>
|
||||
</li>
|
||||
</ul>
|
||||
<% end %>
|
||||
</div>
|
|
@ -0,0 +1,25 @@
|
|||
<div id="sy_popup_box" style="width:380px;">
|
||||
<div class="sy_popup_top sy_popup_top_tishi">
|
||||
<h3 class="fl">提示</h3>
|
||||
<a href="javascript:void(0);" class="sy_icons_close02 fr" onclick="hideModal()"></a>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<div class="sy_popup_con02" >
|
||||
<ul class="sy_popup_tishi ">
|
||||
<li>
|
||||
<% if @flag == 1 %>
|
||||
<p>您输入的邀请码错误</p>
|
||||
<% elsif @flag == 2 %>
|
||||
<p>您已经是该项目成员</p>
|
||||
<% elsif @flag == 3 %>
|
||||
<p>请选择一个角色</p>
|
||||
<% elsif @flag == 4 %>
|
||||
<p>您的申请已提交,请等待项目管理员审批</p>
|
||||
<% end %>
|
||||
</li>
|
||||
<li>
|
||||
<a href="javascript:void(0);" class="sy_btn_blue " onclick="hideModal()">知道了</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
|
@ -1,14 +1,3 @@
|
|||
// @status: 0 该项目不存在;1 不重复加入;2 成功加入; 3 已是项目成员;其它 加入失败
|
||||
<% if @status == 0%>
|
||||
alert("<%= l('project.join.tips.notexist') %>");
|
||||
<% elsif @status == 1%>
|
||||
alert("<%= l('project.join.tips.repeat') %>");
|
||||
<% elsif @status == 2%>
|
||||
alert("<%= l('project.join.tips.success') %>");
|
||||
hideModal($("#popbox"));
|
||||
$("#applied_project_link_<%= @project.id%>").replaceWith("<%=escape_javascript(link_to '取消申请',appliedproject_applied_path(:project_id => @project.id,:user_id => User.current.id),:class => "blue_n_btn fr mt20", :remote => "true",:method => "delete",:id => "applied_project_link_#{@project.id}")%>");
|
||||
<% elsif @status == 3%>
|
||||
alert("<%= l('project.join.tips.has') %>");
|
||||
<%else%>
|
||||
alert("<%= l('project.join.tips.fail') %>");
|
||||
<%end%>
|
||||
var htmlvalue = "<%= escape_javascript(render :partial => 'applied_join_project', locals: {:project_id => (@project.nil? ? nil : @project.id)}) %>";
|
||||
pop_box_new(htmlvalue,460,40,50);
|
||||
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
<% if @project %>
|
||||
$("#join_in_project_applied").html('<%= escape_javascript( render :partial => 'projects/applied_status') %>');
|
||||
<% end %>
|
||||
var htmlvalue = "<%= escape_javascript(render :partial => 'applied_project/applied_project_tip') %>";
|
||||
pop_box_new(htmlvalue,380,40,50);
|
|
@ -92,7 +92,7 @@
|
|||
<% end %>
|
||||
<% if options[:author] %>
|
||||
<span class="author" title="<%= attachment.author%>">
|
||||
<%= link_to h(truncate(attachment.author.name, length: 10, omission: '...')),user_path(attachment.author),:class => "c_orange" %>,
|
||||
<%= link_to h(truncate(attachment.author.name, length: 10, omission: '...')),user_path(attachment.author),:class => "link-blue" %>,
|
||||
<%= format_time(attachment.created_on) %>
|
||||
</span>
|
||||
<% end %>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<% if @in_user_homepage %>
|
||||
<% homepage = BlogComment.find(User.current.blog.homepage_id) %>
|
||||
<% homepage = BlogComment.find(@user.blog.homepage_id) %>
|
||||
$("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'blogs/homepage', :locals => {:activity => @blog_comment, :user_activity_id => homepage.id}) %>");
|
||||
<% else%>
|
||||
$("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/user_blog', :locals => {:activity => @blog_comment,:user_activity_id =>@user_activity_id}) %>");
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
<div class="resources mt10" id="user_activity_<%= user_activity_id%>" >
|
||||
<div class="homepagePostBrief" onmouseover="$('#homepage_message_setting_<%=activity.id%>').show();" onmouseout="$('#homepage_message_setting_<%= activity.id%>').hide();">
|
||||
<div class="homepagePostDes">
|
||||
<% if activity.author.id == User.current.id%>
|
||||
<div class="homepagePostSetting" id="homepage_message_setting_<%= activity.id%>" style="display: none">
|
||||
<ul>
|
||||
|
@ -35,7 +34,6 @@
|
|||
</ul>
|
||||
</div>
|
||||
<%end%>
|
||||
<div class="cl"></div>
|
||||
<div class="homepagePostTitle hidden m_w530">
|
||||
<%= link_to activity.title.to_s.html_safe, user_blog_blog_comment_path(:user_id=>activity.author_id,
|
||||
:blog_id=>activity.blog.id,:id=>activity), :class=> "postGrey", :style => 'text-align:center;' %>
|
||||
|
@ -45,7 +43,6 @@
|
|||
<div class="cl"></div>
|
||||
<div id="intro_content_show_<%= user_activity_id%>" class="fr" style="display:none;"><a href="javascript:void(0);" class="linkBlue">[展开]</a></div>
|
||||
<div id="intro_content_hide_<%= user_activity_id%>" class="fr" style="display:none;"><a href="javascript:void(0);" class="linkBlue">[收起]</a></div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<% all_comments = []%>
|
||||
|
@ -57,7 +54,7 @@
|
|||
<% comments = get_all_children(all_comments, activity)[0..2] %>
|
||||
<% if count > 0 %>
|
||||
<div class="" id="reply_div_<%= user_activity_id %>">
|
||||
<%= render :partial => 'users/message_replies', :locals => {:comments => comments, :user_activity_id => user_activity_id, :type => 'BlogComment', :activity_id =>activity.id, :homepage => 1}%>
|
||||
<%= render :partial => 'users/message_replies', :locals => {:comments => comments, :user_activity_id => user_activity_id, :type => 'BlogComment', :activity_id =>activity.id, :homepage => 1, :user_id => activity.author_id}%>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
|
|
|
@ -114,7 +114,7 @@
|
|||
<label class="fl">
|
||||
<input name="course_content_type[]" type="checkbox" value="1" class="resourceCopy"/>
|
||||
资源</label>
|
||||
<span class="c_red ml5 fl mb10">复制到新班级的资源将在1个月后发布,请您调整资源的发布时间,否则学生可能看不到资源。</span>
|
||||
<span class="c_red ml5 fl mb10">复制到新班级的资源将在1个月后发布,请您调整资源的发布时间,否则学生将看不到资源。</span>
|
||||
</li>
|
||||
</ul>
|
||||
<!--<ul class="fl" id="copyResource2">
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
</li>
|
||||
<% @roles.each do |role| %>
|
||||
<li>
|
||||
<%= radio_button_tag 'membership[role_ids][]', role.id, role.name == "学生" || role.name == "Student" %>
|
||||
<%= check_box_tag 'membership[role_ids][]', role.id, role.name == "学生" || role.name == "Student", :id => "add_member_checkbox_#{role.id}" %>
|
||||
<label ><%= zh_course_role(h role) %></label>
|
||||
</li>
|
||||
<% end %>
|
||||
|
@ -47,4 +47,23 @@
|
|||
</a>
|
||||
</div>
|
||||
<% end%>
|
||||
</div><!-- 右边 end-->
|
||||
</div><!-- 右边 end-->
|
||||
|
||||
<script>
|
||||
$(function() {
|
||||
$("#add_member_checkbox_7").on('click', function(){
|
||||
if($("#add_member_checkbox_7").is(":checked")) {
|
||||
$("#add_member_checkbox_9").attr('disabled', 'disabled');
|
||||
} else {
|
||||
$("#add_member_checkbox_9").removeAttr('disabled');
|
||||
}
|
||||
});
|
||||
$("#add_member_checkbox_9").on('click', function(){
|
||||
if($("#add_member_checkbox_9").is(":checked")) {
|
||||
$("#add_member_checkbox_7").attr('disabled', 'disabled');
|
||||
} else {
|
||||
$("#add_member_checkbox_7").removeAttr('disabled');
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
|
@ -1,100 +1,52 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<title>快速进入班级通道</title>
|
||||
<style>
|
||||
#popbox{ font-size:12px; font-family:"微软雅黑","宋体"; line-height:1.9; background:#fff; font-style:normal;}
|
||||
#popbox div,html,img,ul,li,p,body,h1,h2,h3,h4,p,a,table,tr,td,fieldset,input,span{ margin:0; padding:0;}
|
||||
#popbox div,img,tr,td{ border:0;}
|
||||
#popbox table,tr,td{border:0; cellspacing:0; cellpadding:0;}
|
||||
#popbox ul,li{ list-style-type:none}
|
||||
#popbox .cl{ clear:both; overflow:hidden; }
|
||||
#popbox a{ text-decoration:none; }
|
||||
#popbox a:hover{}
|
||||
<div id="sy_popup_box">
|
||||
<div class="sy_popup_top">
|
||||
<h3 class="fl">欢迎加入班级</h3>
|
||||
<a href="javascript:void(0);" class="sy_icons_close fr" onclick="hideModal()"></a>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<div class="sy_popup_con">
|
||||
<%= form_tag({:controller => 'courses', :action => 'join_course_multi_role'}, :remote => true, :method => :post, :id => 'new-watcher-form') do %>
|
||||
<ul class="sy_popup_add ">
|
||||
<li>
|
||||
<label>班级邀请码:</label>
|
||||
<input class=" sy_input_txt fl" name="invite_code" placeholder="请输入五位班级邀请码">
|
||||
|
||||
.alert_box {width:488px;height:550px;position:fixed;z-index:1002;left:50%;top:40%;margin:-215px 0 0 -300px; background:#fff; -moz-border-radius:5px; -webkit-border-radius:5px; border-radius:5px; box-shadow:0px 0px 8px #194a81; padding:5px; overflow:auto; }
|
||||
#popbox{width:488px;height:368px;}
|
||||
.alert .C{width:476px;height:296px;position:absolute;left:5px;top:5px; }
|
||||
#popbox .C_top{ margin-top:20px; width:368px; height:100px; background:#e9e9e9; padding:0px 60px; }
|
||||
#popbox .C_top h2{ color:#1c1d1d; font-size:24px; font-style:normal; font-weight:normal;}
|
||||
#popbox .C_top p{ color:#a9aaaa; line-height:22px;}
|
||||
#popbox .C_form{ margin:20px 0 0 60px;}
|
||||
#popbox .C_form ul li{ font-size:14px; color:#3f3a39; line-height:30px; }
|
||||
#popbox .C_form ul li input{ margin-left:20px; border:0px; border:1px solid #e1e1e1; color:#898989; padding-left:5px; -moz-border-radius:5px; -webkit-border-radius:5px; border-radius:5px; padding: 0 !important; }
|
||||
#popbox .C_form ul li.mB5{ color:#898989; font-size:12px; padding-left:97px;}
|
||||
#popbox .width190{ width:190px; height:26px; border-color:#e1e1e1;}
|
||||
#popbox .C_form a{ font-size:12px; color:#15bccf; float:left; display:block; height:40px; width:200px; margin-top:25px;}
|
||||
#popbox .C_form a:hover{ text-decoration:underline;}
|
||||
#popbox .C_form a.btn_join{ display:block; width:100px; height:36px; padding-top:4px; text-align: center; background:#269ac9; color:#fff; font-size:14px; margin:20px 20px 0 95px;}
|
||||
#popbox .C_form a.btn_join:hover{ background:#297fb8; text-decoration: none;}
|
||||
#popbox .C_form a.btn_cancel{ display:block; width:100px; height:36px; padding-top:4px; text-align: center; background:#c1c1c1; color:#fff; font-size:14px; margin:20px 20px 0 95px;}
|
||||
#popbox .C_form a.btn_cancel:hover{ background:#717171; text-decoration: none;}
|
||||
#popbox .IDType {border:1px solid #e1e1e1; outline: none; width: 65px; height: 25px;}
|
||||
</style>
|
||||
<script type="text/javascript">
|
||||
function submit_form(obj)
|
||||
{
|
||||
$("#new-watcher-form").submit();
|
||||
}
|
||||
<div class="cl"></div>
|
||||
</li>
|
||||
<li>
|
||||
<label>身份:</label>
|
||||
<input type="checkbox" name="role[]" value="9" id="join_course_role_9" class="ml5 mr5 "/><span class="mr10">教师</span>
|
||||
<input type="checkbox" name="role[]" value="7" id="join_course_role_7" class="ml5 mr5"/><span class="mr10">助教</span>
|
||||
<input type="checkbox" name="role[]" value="10" id="join_course_role_10" class="ml5 mr5"/><span class="mr10">学生</span>
|
||||
|
||||
function hidden_join_course_form()
|
||||
{
|
||||
hideModal($("#popbox"));
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<div class="cl"></div>
|
||||
</li>
|
||||
<li>
|
||||
<label> </label>
|
||||
<a href="javascript:void(0);" class="sy_btn_blue fl" onclick="$('#new-watcher-form').submit();hideModal()">确 定</a>
|
||||
<a href="javascript:void(0);" class="sy_btn_grey fl ml20" onclick="hideModal()">取 消</a>
|
||||
|
||||
<body>
|
||||
<div id="popbox">
|
||||
<div class="C" >
|
||||
<div class="C_top">
|
||||
<h2>快速加入班级通道</h2>
|
||||
<p>只要持有班级邀请码,就可以快速加入所在班级。班级页面搜索不到的私有班级只能从此通道进入哦!</p>
|
||||
</div>
|
||||
<div class="C_form">
|
||||
<%= form_tag({:controller => 'courses',
|
||||
:action => 'join'},
|
||||
:remote => true,
|
||||
:method => :post,
|
||||
:id => 'new-watcher-form') do %>
|
||||
<ul>
|
||||
<li>
|
||||
<input type="text" style="display: none"/> <!--阻止表单自动填充 -->
|
||||
<input type="password" style="display: none"/> <!--阻止表单自动填充 -->
|
||||
<span class="tips" style="width: 90px; display: inline-block;">班级邀请码:</span>
|
||||
<input class="width190" style="margin-left: 0px;" name="invite_code" id="object_id" type="text" value="" >
|
||||
<input type="text" style="display: none"/>
|
||||
</li>
|
||||
<li class="mB5">班级邀请码是所在班级页面中显示的邀请码</li>
|
||||
<li style="margin-top: 15px;">
|
||||
<span style="margin-right: 5px;"><span style="margin-right:43px;">身</span><span>份</span>:</span>
|
||||
<% if User.current.logged? && User.current.extensions && User.current.extensions.identity == 0%>
|
||||
<select name="role" class="IDType">
|
||||
<option value="9">教师</option>
|
||||
<option value="7">教辅</option>
|
||||
<option value="10">学生</option>
|
||||
</select>
|
||||
<%else%>
|
||||
<select name="role" class="IDType">
|
||||
<option value="10">学生</option>
|
||||
<option value="7">教辅</option>
|
||||
</select>
|
||||
<%end%>
|
||||
</li>
|
||||
<li>
|
||||
<a href="javascript:" class="btn_join" style="margin-left: 50px;" onclick="submit_form(this);">
|
||||
<%= l(:label_new_join) %>
|
||||
</a>
|
||||
<a href="javascript:" class="btn_cancel" style="margin-left: 20px;" onclick="hideModal(this);">
|
||||
<%= l(:button_cancel)%>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
<% end%>
|
||||
</div>
|
||||
</div><!---- C end---->
|
||||
<div class="cl"></div>
|
||||
</li>
|
||||
</ul>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
<script>
|
||||
$(function() {
|
||||
$("#join_course_role_7").on('click', function(){
|
||||
if($("#join_course_role_7").is(":checked")) {
|
||||
$("#join_course_role_9").attr('disabled', 'disabled');
|
||||
} else {
|
||||
$("#join_course_role_9").removeAttr('disabled');
|
||||
}
|
||||
});
|
||||
$("#join_course_role_9").on('click', function(){
|
||||
if($("#join_course_role_9").is(":checked")) {
|
||||
$("#join_course_role_7").attr('disabled', 'disabled');
|
||||
} else {
|
||||
$("#join_course_role_7").removeAttr('disabled');
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
|
@ -10,7 +10,7 @@
|
|||
) do |f| %>
|
||||
<% @roles.each do |role| %>
|
||||
<ul style="text-align: left;" class="ml45">
|
||||
<%= radio_button_tag 'membership[role_ids][]', role.id, member.roles.include?(role),
|
||||
<%= check_box_tag 'membership[role_ids][]', role.id, member.roles.include?(role), :id => "edit_member_role_#{member.id}_#{role.id}",
|
||||
:disabled => member.member_roles.detect { |mr| mr.role_id == role.id && !mr.inherited_from.nil? } %>
|
||||
<label ><%= zh_course_role(h role) %></label>
|
||||
</ul>
|
||||
|
@ -35,4 +35,25 @@
|
|||
:data => (!User.current.admin? && member.include?(User.current) ? {:confirm => l(:text_own_membership_delete_confirmation)} : {confirm: l(:label_delete_confirm)}) if member.deletable? %>
|
||||
<% end%>
|
||||
</li>
|
||||
<% end%>
|
||||
|
||||
<script>
|
||||
$(function() {
|
||||
$("#edit_member_role_<%=member.id %>_7").on('click', function(){
|
||||
if($("#edit_member_role_<%=member.id %>_7").is(":checked")) {
|
||||
$("#edit_member_role_<%=member.id %>_9").attr("checked",false);
|
||||
$("#edit_member_role_<%=member.id %>_9").attr('disabled', 'disabled');
|
||||
} else {
|
||||
$("#edit_member_role_<%=member.id %>_9").removeAttr('disabled');
|
||||
}
|
||||
});
|
||||
$("#edit_member_role_<%=member.id %>_9").on('click', function(){
|
||||
if($("#edit_member_role_<%=member.id %>_9").is(":checked")) {
|
||||
$("#edit_member_role_<%=member.id %>_7").attr('disabled', 'disabled');
|
||||
$("#edit_member_role_<%=member.id %>_7").attr("checked",false);
|
||||
} else {
|
||||
$("#edit_member_role_<%=member.id %>_7").removeAttr('disabled');
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<% end%>
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
<% if show_nav?(course_feedback_count) %>
|
||||
<li>
|
||||
<a href="<%=course_feedback_path(@course) %>">留言</a>
|
||||
<%= link_to "", course_feedback_path(@course), :class => 'sy_class_add', :title =>"#{l(:label_course_feedback)}", :id => "course_jour_count"%>
|
||||
<%= link_to "", course_feedback_path(@course), :class => 'sy_class_add', :title =>"#{l(:label_course_feedback)}"%>
|
||||
</li>
|
||||
<% end %>
|
||||
<% if show_nav?(course_poll_count) %>
|
||||
|
|
|
@ -36,6 +36,10 @@ window.location.href= "<%= Setting.protocol%>://"+"<%= Setting.host_name%>"+"/co
|
|||
alert("您已经是该班级的管理员了");
|
||||
hidden_join_course_form();
|
||||
window.location.href= "<%= Setting.protocol%>://"+"<%= Setting.host_name%>"+"/courses/" + "<%= @course.id%>"
|
||||
<% elsif @state == 11%>
|
||||
alert("该班级已被删除");
|
||||
hidden_join_course_form();
|
||||
window.location.href= "<%= Setting.protocol%>://"+"<%= Setting.host_name%>"+"/courses/" + "<%= @course.id%>"
|
||||
<% else %>
|
||||
alert("未知错误,请稍后再试");
|
||||
<% end %>
|
||||
|
|
|
@ -0,0 +1,52 @@
|
|||
<% if @object_id && @state != 6 && @state !=4 %>
|
||||
$("#join_in_course_header").html("<%= escape_javascript(join_in_course_header(@course, @user)) %>");
|
||||
<% end %>
|
||||
<% if @state %>
|
||||
<% if @state == 0 %>
|
||||
alert("加入成功");
|
||||
hideModal();
|
||||
$("#try_join_course_link").replaceWith("<a href='<%=url_for(:controller => 'homework_common', :action => 'index',:course=>@course.id, :host=>Setting.host_course)%>' target='_blank' class='blue_n_btn fr mt20'>提交作品</a>");
|
||||
window.location.href= "<%= Setting.protocol%>://"+"<%= Setting.host_name%>"+"/courses/" + "<%= @course.id%>"
|
||||
<% elsif @state == 1 %>
|
||||
alert("密码错误");
|
||||
<% elsif @state == 2 %>
|
||||
alert("班级已过期\n请联系班级管理员重启班级。(在配置班级处)");
|
||||
<% elsif @state == 3 %>
|
||||
alert("您已经加入了班级");
|
||||
window.location.href= "<%= Setting.protocol%>://"+"<%= Setting.host_name%>"+"/courses/" + "<%= @course.id%>"
|
||||
<% elsif @state == 4 %>
|
||||
alert("您加入的班级不存在");
|
||||
<% elsif @state == 5 %>
|
||||
alert("您还未登录");
|
||||
<% elsif @state == 6 %>
|
||||
alert("申请成功,请等待审核");
|
||||
hidden_join_course_form();
|
||||
<% elsif @state == 7%>
|
||||
alert("您已经发送过申请了,请耐心等待");
|
||||
hidden_join_course_form();
|
||||
<% elsif @state == 8%>
|
||||
alert("您已经是该班级的教师了");
|
||||
hidden_join_course_form();
|
||||
window.location.href= "<%= Setting.protocol%>://"+"<%= Setting.host_name%>"+"/courses/" + "<%= @course.id%>"
|
||||
<% elsif @state == 9%>
|
||||
alert("您已经是该班级的教辅了");
|
||||
hidden_join_course_form();
|
||||
window.location.href= "<%= Setting.protocol%>://"+"<%= Setting.host_name%>"+"/courses/" + "<%= @course.id%>"
|
||||
<% elsif @state == 10%>
|
||||
alert("您已经是该班级的管理员了");
|
||||
hidden_join_course_form();
|
||||
window.location.href= "<%= Setting.protocol%>://"+"<%= Setting.host_name%>"+"/courses/" + "<%= @course.id%>"
|
||||
<% elsif @state == 11%>
|
||||
alert("该班级已被删除");
|
||||
hidden_join_course_form();
|
||||
window.location.href= "<%= Setting.protocol%>://"+"<%= Setting.host_name%>"+"/courses/" + "<%= @course.id%>"
|
||||
<% elsif @state == 12 %>
|
||||
alert("您已经发送过申请了,请耐心等待");
|
||||
window.location.href= "<%= Setting.protocol%>://"+"<%= Setting.host_name%>"+"/courses/" + "<%= @course.id%>"
|
||||
<% elsif @state == 13 %>
|
||||
alert("申请成功,请等待审核");
|
||||
window.location.href= "<%= Setting.protocol%>://"+"<%= Setting.host_name%>"+"/courses/" + "<%= @course.id%>"
|
||||
<% else %>
|
||||
alert("未知错误,请稍后再试");
|
||||
<% end %>
|
||||
<% end %>
|
|
@ -1,11 +1,2 @@
|
|||
$('#topnav_course_menu').hide();
|
||||
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'join_private_course') %>');
|
||||
showModal('ajax-modal', '540px');
|
||||
$('#ajax-modal').css('height','390px');
|
||||
//$('#ajax-modal').siblings().remove();
|
||||
$('#ajax-modal').siblings().hide();
|
||||
$('#ajax-modal').before("<span style='float: right;cursor:pointer;padding-left: 513px;'>" +
|
||||
"<a href='javascript:' onclick='hidden_join_course_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","").css("border","3px solid #269ac9");
|
||||
$('#ajax-modal').parent().addClass("alert_box");
|
||||
var htmlvalue = "<%= escape_javascript(render :partial => 'join_private_course') %>";
|
||||
pop_box_new(htmlvalue,460,40,50);
|
||||
|
|
|
@ -17,13 +17,13 @@
|
|||
<div class="cl"></div>
|
||||
<li class="ml45">
|
||||
<label><span class="c_red">*</span> <%= l(:label_tags_course_name)%> :</label>
|
||||
<input type="text" name="course[name]" id="new_course_name" class="courses_input" maxlength="100" onkeyup="regex_course_name('new');">
|
||||
<input type="text" name="course[name]" id="new_course_name" class="courses_input" maxlength="100" placeholder="例如:计算机系A班" onkeyup="regex_course_name('new');">
|
||||
<span class="c_red" id="new_course_name_notice" style="display: none;">班级名称不能为空且至少有两个字符</span>
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
<li class="ml45">
|
||||
<label><span class="c_red">*</span> <%= l(:label_class_period)%> :</label>
|
||||
<input type="text" name="class_period" id="new_class_period" class="hwork_input02" onkeyup="regex_course_class_period('new');" maxlength="6">
|
||||
<input type="text" name="class_period" id="new_class_period" class="hwork_input02" onkeyup="regex_course_class_period('new');" placeholder="例如:54" maxlength="6">
|
||||
<span class="c_red" id="new_course_class_period_notice" style="display: none;"></span>
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
<span class='<%= "#{get_issue_priority(@issue.priority_id)[0]} " %>'><%= get_issue_priority(@issue.priority_id)[1] %></span></p>
|
||||
<br>
|
||||
<div class="cl"></div>
|
||||
由<a href="javascript:void(0)" class="problem_name"><%= @issue.author %></a>添加于 <%= format_time(@issue.created_on).html_safe %>
|
||||
由<%=link_to @issue.author, user_path(@issue.author), :class => "link-blue" %>添加于 <%= format_time(@issue.created_on).html_safe %>
|
||||
</div>
|
||||
|
||||
<!--talk_txt end-->
|
||||
|
|
|
@ -1,278 +0,0 @@
|
|||
<%# course_model %>
|
||||
<% course_file_num = visable_attachemnts_incourse(@course).count%>
|
||||
<% is_teacher = User.current.logged? && (User.current.admin? || User.current.allowed_to?(:as_teacher,@course)) %>
|
||||
<% homework_num = visable_course_homework @course %>
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html lang="en" xmlns="http://www.w3.org/1999/html">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>
|
||||
<%= h html_title %>
|
||||
</title>
|
||||
<meta name="description" content="<%= Redmine::Info.app_name %>"/>
|
||||
<meta name="keywords" content="issue,bug,tracker"/>
|
||||
<%= csrf_meta_tag %>
|
||||
<%= favicon %>
|
||||
<%= javascript_heads %>
|
||||
<%= heads_for_theme %>
|
||||
<%= call_hook :view_layouts_base_html_head %>
|
||||
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2','css/common','css/public', 'css/structure','prettify', 'css/courses','css/popup'%>
|
||||
<%= javascript_include_tag "course","sy_public", "syllabus","header","attachments",'prettify' %>
|
||||
<!-- page specific tags -->
|
||||
<%= yield :header_tags -%>
|
||||
<!-- MathJax的配置 -->
|
||||
<script type="text/javascript"
|
||||
src="/javascripts/MathJax/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
|
||||
</script>
|
||||
<!--<script type="text/javascript"-->
|
||||
<!--src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML">-->
|
||||
<!--</script>-->
|
||||
<!-- 配置 : 在生成的公式图片上去掉Math定义的右键菜单,$$ $$ \( \) \[ \] 中的公式给予显示-->
|
||||
<script type="text/x-mathjax-config">
|
||||
MathJax.Hub.Config({
|
||||
|
||||
showMathMenu: false,
|
||||
showMathMenuMSIE: false,
|
||||
tex2jax: {inlineMath: [['$','$'], ['\\(','\\)']]}
|
||||
});
|
||||
</script>
|
||||
</head>
|
||||
<!--add by huang-->
|
||||
<body onload="prettyPrint();">
|
||||
<div class="navContainer mb10">
|
||||
<% if User.current.logged? %>
|
||||
<%= render :partial => 'layouts/logined_header' %>
|
||||
<% else%>
|
||||
<%= render :partial => 'layouts/unlogin_header' %>
|
||||
<% end%>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<div id="Container">
|
||||
<div id="content">
|
||||
<div id="LSide" class="fl">
|
||||
<div class="project_info" style="position: relative" id="project_info_<%=@course.id %>">
|
||||
<%=render :partial=>'layouts/project_info' %>
|
||||
</div><!--课程信息 end-->
|
||||
|
||||
<div class="info_box">
|
||||
<ul>
|
||||
<li><%= l(:label_main_teacher)%> : <%= link_to(@course.teacher.lastname+@course.teacher.firstname, user_path(@course.teacher), :class => 'c_dblue') %></li>
|
||||
<li><%= l(:label_class_period)%> : <span ><%= @course.class_period %> <%= l(:label_class_hour) %></span></li>
|
||||
<li><%= l(:label_main_term)%> : <span><%= current_time_and_term @course %></span></li>
|
||||
<% if @course.school%>
|
||||
<li><%= l(:label_course_organizers)%> : <%= @course.school%></li>
|
||||
<% end%>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<%# 更新访问数,刷新的时候更新访问次数 %>
|
||||
<% update_visiti_count @course %>
|
||||
<%# over %>
|
||||
|
||||
<div class="subNavBox">
|
||||
<% unless show_nav?(@course.course_activities.count) %>
|
||||
<div class="subNav">
|
||||
<%= link_to l(:label_activity), course_path(@course), :class => "f14 c_blue02" %>
|
||||
<!--暂时不显示课程动态数,优化后在显示-->
|
||||
<%= link_to "(#{@course.course_activities.count})", course_path(@course), :class => "subnav_num c_orange"%>
|
||||
</div>
|
||||
<% end %>
|
||||
<% unless show_nav?(@course.homework_commons.count) %>
|
||||
<div class="subNav">
|
||||
<%= link_to l(:label_homework), homework_common_index_path(:course => @course.id), :class => "f14 c_blue02"%>
|
||||
<%= link_to "(#{homework_num})", homework_common_index_path(:course => @course.id), :class => "subnav_num c_orange"%>
|
||||
<%= link_to( "", homework_common_index_path(:course => @course.id,:is_new => 1), :class => 'courseMenuSetting', :title =>"#{l(:label_course_homework_new)}") if is_teacher %>
|
||||
</div>
|
||||
<% end %>
|
||||
<% unless show_nav?(@course.news.count) %>
|
||||
<div class="subNav">
|
||||
<%= link_to "通知", course_news_index_path(@course), :class => "f14 c_blue02" %>
|
||||
<%= link_to "(#{@course.news.count})", course_news_index_path(@course), :class => "subnav_num c_orange"%>
|
||||
<%= link_to( "", new_course_news_path(@course,:is_new=>1), :class => 'courseMenuSetting', :title =>"#{l(:label_course_news_new)}") if is_teacher %>
|
||||
</div>
|
||||
<% end %>
|
||||
<% unless show_nav?(course_file_num) %>
|
||||
<div class="subNav">
|
||||
<%= link_to l(:label_course_file), course_files_path(@course), :class => "f14 c_blue02" %>
|
||||
<%= link_to "(#{course_file_num})", course_files_path(@course), :class => "subnav_num c_orange",:id=>'courses_files_count_nav' %>
|
||||
<% if is_teacher || (@course.publish_resource == 1 && User.current.member_of_course?(@course)) %>
|
||||
<!--link_to( "+#{l(:label_upload_files)}", course_files_path(@course), :class => 'subnav_green ml95 c_white')-->
|
||||
<a class="courseMenuSetting" title="上传资源" href="javascript:void(0);" onclick="course_files_upload();"> </a>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
<% unless show_nav?(@course.boards.first ? @course.boards.first.topics.count : 0) %>
|
||||
<div class="subNav">
|
||||
<%= link_to l(:label_course_board), course_boards_path(@course), :class => "f14 c_blue02" %>
|
||||
<%= link_to "(#{@course.boards.first ? (@course.boards.first.topics.count + Message.where("board_id =? and parent_id is not ?", @course.boards.first.id, nil).count) : 0})", course_boards_path(@course), :class => "subnav_num c_orange" %>
|
||||
<%= link_to( "",course_boards_path(@course, :flag => true, :is_new => 1), :class => 'courseMenuSetting', :title =>"#{l(:label_message_new)}") %>
|
||||
</div>
|
||||
<% end %>
|
||||
<% unless show_nav?(course_feedback_count) %>
|
||||
<div class="subNav">
|
||||
<%= link_to l(:label_course_feedback), course_feedback_path(@course), :class => "f14 c_blue02" %>
|
||||
<%= link_to "(#{course_feedback_count})", course_feedback_path(@course), :class => "subnav_num c_orange", :id => "course_jour_count"%>
|
||||
<%= link_to "", course_feedback_path(@course), :class => 'courseMenuSetting', :title =>"#{l(:label_course_feedback)}", :id => "course_jour_count"%>
|
||||
</div>
|
||||
<% end %>
|
||||
<% unless show_nav?(course_poll_count) %>
|
||||
<div class="subNav">
|
||||
<%= link_to l(:label_poll), poll_index_path(:polls_type => "Course", :polls_group_id => @course.id), :class => " f14 c_blue02"%>
|
||||
<%= link_to "(#{course_poll_count})", poll_index_path(:polls_type => "Course", :polls_group_id => @course.id), :class => "subnav_num c_orange" %>
|
||||
<%= link_to( "", new_poll_path(:polls_type => "Course",:polls_group_id => @course.id), :class => 'courseMenuSetting', :title =>"#{l(:label_new_poll)}") if is_teacher %>
|
||||
</div>
|
||||
<% end %>
|
||||
<% unless show_nav?(User.current.allowed_to?(:as_teacher,@course)? @course.exercises.count : @course.exercises.where("exercise_status <> 1").count) %>
|
||||
<div class="subNav">
|
||||
<%= link_to "在线测验", exercise_index_path(:course_id => @course.id), :class => " f14 c_blue02"%>
|
||||
<%= link_to "(#{User.current.allowed_to?(:as_teacher,@course)? @course.exercises.count : @course.exercises.where("exercise_status <> 1").count})", exercise_index_path(:course_id => @course.id), :class => "subnav_num c_orange" %>
|
||||
<%= link_to( "", new_exercise_path(:course_id => @course.id), :class => 'courseMenuSetting', :title =>"新建试卷") if is_teacher %>
|
||||
</div>
|
||||
<% end %>
|
||||
<%# 工具栏展开 %>
|
||||
<% if @course.homework_commons.count == 0 || @course.news.count == 0 || course_file_num == 0 || course_poll_count == 0 || @course.exercises.count == 0 ||
|
||||
course_feedback_count == 0 || @course.exercises.count == 0 || (@course.boards.first ? @course.boards.first.topics.count : 0) == 0 %>
|
||||
|
||||
<div class="subNav subNav_jiantou" id="expand_tools_expand"><%= l(:label_project_more) %></div>
|
||||
<ul class="navContent" id="navContentCourse">
|
||||
<%= render 'courses/tool_expand', :locals => {:is_teacher => is_teacher, :course_file_num => course_file_num} %>
|
||||
</ul>
|
||||
<% end %>
|
||||
</div><!--项目侧导航 end-->
|
||||
<%# 课程活跃度 %>
|
||||
<div class="cl"></div>
|
||||
<%= render :partial => 'courses/course_activity_users', :locals => {:course => @course} %>
|
||||
<%# 课程英雄榜 %>
|
||||
<%= render :partial => 'courses/course_heroes', :locals => {:course => @course} %>
|
||||
|
||||
<% if @course.description && !@course.description.blank? %>
|
||||
<div class="project_intro">
|
||||
<div id="course_description" class="course_description">
|
||||
<h4 ><%= l(:label_course_brief_introduction)%>:</h4>
|
||||
<div id="course_description_content">
|
||||
<%= textilizable(@course.description) if @course.description && !@course.description.blank? %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="lg-foot" id="lg-foot" onclick="show_more_msg();">
|
||||
<label id="expend_more_information" value="show_more"><%= l(:label_expend_information)%></label>
|
||||
<span class="g-arr-down">
|
||||
<img id="arrow" src="/images/jiantou.jpg" width="12" height="6" />
|
||||
</span>
|
||||
</div>
|
||||
</div><!--项目简介 end-->
|
||||
<% end %>
|
||||
<div class="project_Label">
|
||||
<h4 class="mb5" ><%= l(:label_tag)%>:</h4>
|
||||
<div class="tag_h" >
|
||||
<%= render :partial => 'tags/new_tag', :locals => {:obj => @course, :object_flag => "9"} %>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div><!--项目标签 end-->
|
||||
<!--课程推荐-->
|
||||
<%= render :partial => 'courses/recommendation', :locals => {:course => @course} %>
|
||||
<div class="fontGrey5 mt10 ml10 mb10">访问计数 <%= @course.visits.to_i %> (自2016年5月)</div>
|
||||
</div><!--LSide end-->
|
||||
|
||||
<div id="RSide" class="fl">
|
||||
<%= yield %>
|
||||
<%#= render_flash_messages %>
|
||||
<%#= call_hook :view_layouts_base_content %>
|
||||
</div>
|
||||
|
||||
<div class="cl"></div>
|
||||
|
||||
</div><!--Content end-->
|
||||
</div><!--Container end-->
|
||||
|
||||
<div class="cl"></div>
|
||||
<%= render :partial => 'layouts/footer' %>
|
||||
<div class="cl"></div>
|
||||
|
||||
<%= render :partial => 'layouts/new_feedback' %>
|
||||
<div id="ajax-indicator" style="display:none;">
|
||||
<span><%= l(:label_loading) %></span>
|
||||
</div>
|
||||
<div id="ajax-modal" style="display:none;"></div>
|
||||
<%= call_hook :view_layouts_base_body_bottom %>
|
||||
</body>
|
||||
<script>
|
||||
var blog_artile_list_html = '';
|
||||
$(function(){
|
||||
$(document).on('input','input[name="course_outline_search"]',function(e){
|
||||
throttle(course_outline_search,window,e);
|
||||
})
|
||||
function throttle(method,context,e){
|
||||
clearTimeout(method.tId);
|
||||
method.tId=setTimeout(function(){
|
||||
method.call(context,e);
|
||||
},500);
|
||||
}
|
||||
function course_outline_search(e){
|
||||
// if($(e.target).val().trim() == ''){
|
||||
// return;
|
||||
// }
|
||||
$("#course_outline_hint").hide();
|
||||
$.ajax({
|
||||
url:'<%=search_course_outline_course_path(@course) %>'+"?&title="+ e.target.value,
|
||||
type:'post',
|
||||
success:function(data){
|
||||
|
||||
if(data.length != 0 ){
|
||||
$("#course_outline_list").html('');
|
||||
for(var i =0;i<data.length;i++){
|
||||
var html = ' <ul class="blogRow"> '+
|
||||
' <li class="fl"> '+
|
||||
'<input name="outline_id" type="radio" value="'+data[i].blog_comment.id+'" class="courseSendCheckbox"/>'+
|
||||
'</li>'+
|
||||
'<li class="blogTitle fl">'+data[i].blog_comment.title+'</li>'+
|
||||
'</ul>'+
|
||||
'<div class="homeworkPublishTime">发布时间:'+data[i].blog_comment.created_at.match(/(\S*)T/)[1]+'</div>';
|
||||
$("#course_outline_list").append(html)
|
||||
}
|
||||
|
||||
}else{
|
||||
$("#course_outline_list").html('');
|
||||
$("#course_outline_hint").show();
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
})
|
||||
//资源库上传附件
|
||||
function course_files_upload(){
|
||||
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'files/upload_course_files',:locals => {:course => @course,:course_attachment_type => 1}) %>');
|
||||
showModal('ajax-modal', '513px');
|
||||
$('#ajax-modal').siblings().remove();
|
||||
$('#ajax-modal').before("<a href='javascript:void(0)' onclick='hideModal()' style='margin-left: 480px;'><img src='/images/bid/close.png' width='26px' height='26px' /></a>");
|
||||
$('#ajax-modal').parent().css("top","").css("left","").css("border","3px solid #269ac9");
|
||||
$('#ajax-modal').parent().addClass("popbox_polls");
|
||||
}
|
||||
// 鼠标经过的时候显示内容
|
||||
function message_titile_show(obj,e)
|
||||
{
|
||||
obj.parent().parent().next("div").show();
|
||||
obj.parent().next("div").css("top",e.pageY).css("left",e.pageX).css("position","absolute");
|
||||
}
|
||||
function message_titile_hide(obj)
|
||||
{
|
||||
obj.parent().parent().next("div").hide();
|
||||
}
|
||||
|
||||
function message_titile_show2(obj,e)
|
||||
{
|
||||
obj.parent().next("div").show();
|
||||
obj.parent().next("div").css("top",e.pageY).css("left",e.pageX).css("position","absolute");
|
||||
}
|
||||
function message_titile_hide2(obj)
|
||||
{
|
||||
obj.parent().next("div").hide();
|
||||
}
|
||||
|
||||
$("#expand_tools_expand").click(function(){
|
||||
$("#navContentCourse").toggle();
|
||||
});
|
||||
</script>
|
||||
|
||||
</html>
|
|
@ -1,151 +0,0 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title><%= h html_title %></title>
|
||||
<meta name="description" content="<%= Redmine::Info.app_name %>" />
|
||||
<meta name="keywords" content="issue,bug,tracker" />
|
||||
<%= csrf_meta_tag %>
|
||||
<%= favicon %>
|
||||
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2', 'syllabus','css/common','css/public','css/structure','css/courses','css/popup','prettify',:media => 'all' %>
|
||||
<%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %>
|
||||
<%= javascript_heads %>
|
||||
<%= javascript_include_tag "bootstrap","avatars","course",'attachments','prettify','syllabus'%>
|
||||
<%= heads_for_theme %>
|
||||
<%= call_hook :view_layouts_base_html_head %>
|
||||
<%= yield :header_tags -%>
|
||||
<!-- MathJax的配置 -->
|
||||
<script type="text/javascript"
|
||||
src="/javascripts/MathJax/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
|
||||
</script>
|
||||
<!-- 配置 : 在生成的公式图片上去掉Math定义的右键菜单,$$ $$ \( \) \[ \] 中的公式给予显示-->
|
||||
<script type="text/x-mathjax-config">
|
||||
MathJax.Hub.Config({
|
||||
|
||||
showMathMenu: false,
|
||||
showMathMenuMSIE: false,
|
||||
tex2jax: {inlineMath: [['$','$'], ['\\(','\\)']]}
|
||||
});
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body onload="prettyPrint();">
|
||||
<% is_current_user = User.current.logged?%>
|
||||
<div class="navContainer">
|
||||
<% if User.current.logged? %>
|
||||
<%= render :partial => 'layouts/logined_header' %>
|
||||
<% else%>
|
||||
<%= render :partial => 'layouts/unlogin_header' %>
|
||||
<% end%>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<div class="homepageContentContainer">
|
||||
<div class="homepageContent">
|
||||
<div class="homepageLeft">
|
||||
<div class="homepagePortraitContainer mt15" onmouseover="$('#syllabus_edit_title_png').show();$('#syllabus_edit_ng_name_png').show();" onmouseout="$('#syllabus_edit_title_png').hide();$('#syllabus_edit_ng_name_png').hide();">
|
||||
<%=render :partial => 'layouts/syllabus_info' %>
|
||||
</div>
|
||||
<% update_visiti_count @syllabus %>
|
||||
|
||||
<div class="homepageLeftMenuContainer" id="syllabus_base_info" onmouseover="$('#syllabus_attr_edit').show();" onmouseout="$('#syllabus_attr_edit').hide();">
|
||||
<%= render :partial => 'layouts/syllabus_base_info', :locals => {:syllabus => @syllabus} %>
|
||||
</div>
|
||||
|
||||
<div class="homepageLeftMenuContainer">
|
||||
<div class="homepageLeftMenuBlock">
|
||||
<%=link_to '班级', {:controller => "syllabuses", :action => "syllabus_courselist", :id => @syllabus.id}, :class => 'homepageMenuText' %>
|
||||
<% if is_current_user%>
|
||||
<% if User.current == @syllabus.user && User.current.user_extensions && User.current.user_extensions.identity == 0 && User.current.allowed_to?(:add_course, nil, :global => true)%>
|
||||
<div class="courseMenu" id="courseMenu">
|
||||
<ul>
|
||||
<li class="courseMenuIcon fr" style="margin-right:10px;" id="courseMenuIcon">
|
||||
<ul class="topnav_course_menu" id="topnav_course_menu">
|
||||
<li>
|
||||
<%= link_to "新建班级", new_course_path(:host=> Setting.host_course, :syllabus_id => @syllabus.id), :class => "menuGrey", :target => '_blank'%>
|
||||
</li>
|
||||
<li>
|
||||
<%= link_to "加入班级",join_private_courses_courses_path,:remote => true,:class => "menuGrey",:method => "post"%>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<% else%>
|
||||
<%=link_to "", join_private_courses_courses_path, :class => "homepageMenuSetting fr",:style => "margin-right:10px;", :remote => true, :title => "加入班级"%>
|
||||
<% end%>
|
||||
<% end%>
|
||||
</div>
|
||||
<% if User.current == @syllabus.user || User.current.admin?
|
||||
all_courses = @syllabus.courses.where("is_delete = 0").select("courses.*,(SELECT MAX(updated_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS a").order("a desc")
|
||||
else
|
||||
all_courses = User.current.courses.visible.where("is_delete =? and syllabus_id =?", 0, @syllabus.id).select("courses.*,(SELECT MAX(updated_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS a").order("a desc")
|
||||
end %>
|
||||
<% courses = all_courses.limit(5) %>
|
||||
<% all_count = all_courses.count%>
|
||||
<div class="homepageLeftMenuCourses <%= courses.empty? ? 'none' : ''%>">
|
||||
<div class = "leftCoursesList" id="homepageLeftMenuCourses">
|
||||
<ul>
|
||||
<%= render :partial => 'layouts/user_courses', :locals => {:courses => courses,:user => User.current,:all_count => all_count,:type =>'Syllabus',:page => 0} %>
|
||||
</ul>
|
||||
</div>
|
||||
<% if !courses.empty? %>
|
||||
<div class="homepageLeftMenuMore" id="user_hide_course">
|
||||
<a href="javascript:void(0);" class="homepageLeftMenuHideIcon" id="hide_show_courseicon" onclick="leftCourseslistChange();"></a>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="project_Label">
|
||||
<h4 class="mb5" >标签:</h4>
|
||||
<div class="tag_h">
|
||||
<%= render :partial => 'tags/syllabus_tag', :locals => {:obj => @syllabus,:object_flag => "11"}%>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<div class="fontGrey2 mt10 ml20">访问计数 <%=@syllabus.visits %> (自2016年7月)</div>
|
||||
|
||||
</div><!--left end -->
|
||||
<div class="homepageRight">
|
||||
<%= yield %>
|
||||
</div>
|
||||
</div>
|
||||
<%= render :partial => 'layouts/new_feedback' %>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<%= render :partial => 'layouts/footer' %>
|
||||
<div class="cl"></div>
|
||||
|
||||
<div id="ajax-modal" style="display:none;"></div>
|
||||
<div id="ajax-indicator" style="display:none;">
|
||||
<span><%= l(:label_loading) %></span>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
$(function() {
|
||||
$('#user_hide_course').hide();
|
||||
$("#syllabus_title_edit").live("blur", function () {
|
||||
edit_syllabus_title('<%= edit_syllabus_title_syllabus_path(@syllabus.id)%>');
|
||||
});
|
||||
$("#syllabus_eng_name_edit").live("blur", function () {
|
||||
edit_syllabus_eng_name('<%= edit_syllabus_eng_name_syllabus_path(@syllabus.id)%>');
|
||||
});
|
||||
|
||||
$("#courseMenu").mouseenter(function () {
|
||||
$("#topnav_course_menu").show();
|
||||
});
|
||||
$("#courseMenu").mouseleave(function () {
|
||||
$("#topnav_course_menu").hide();
|
||||
});
|
||||
});
|
||||
function leftCourseslistChange(){
|
||||
$('#homepageLeftMenuCourses').slideToggle();
|
||||
$('#hide_show_courseicon').toggleClass("homepageLeftMenuHideIcon");
|
||||
$('#hide_show_courseicon').toggleClass("homepageLeftMenuMoreIcon");
|
||||
|
||||
}
|
||||
function show_edit_base_info() {
|
||||
$("#syllabus_base_info").html("<%=escape_javascript(render :partial => 'layouts/syllabus_edit_info', :locals => {:syllabus => @syllabus}) %>");
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -11,16 +11,13 @@
|
|||
</p>
|
||||
|
||||
<% if is_teacher %>
|
||||
<div class="homepagePostSetting" >
|
||||
<div class="sy_class_setting" >
|
||||
<ul>
|
||||
<li class="homepagePostSettingIcon">
|
||||
<ul class="homepagePostSettiongText">
|
||||
<li><%= link_to "班级配置", {:controller => 'courses', :action => 'settings', :id => @course}, :class => "postOptionLink" %></li>
|
||||
<li><%= link_to @course.is_public == 0 ? "设为公开" : "设为私有", {:controller => 'courses', :action => 'private_or_public', :id => @course},:remote=>true,:confirm=>"您确定要设置为"+(@course.is_public == 0 ? "公开" : "私有")+"吗", :class => "postOptionLink" %></li>
|
||||
<li><%= link_to "复制学期", copy_course_course_path(@course.id),:remote=>true, :class => "postOptionLink" %></li>
|
||||
<% if @course.syllabus %>
|
||||
<li><%= link_to "进入课程", syllabus_path(@course.syllabus), :class => "postOptionLink", :target => "_blank" %></li>
|
||||
<% end %>
|
||||
<li class="sy_class_setting_icon">
|
||||
<ul class="sy_class_setting_text">
|
||||
<li><%= link_to @course.is_public == 0 ? "设为公开" : "设为私有", {:controller => 'courses', :action => 'private_or_public', :id => @course},:remote=>true,:confirm=>"您确定要设置为"+(@course.is_public == 0 ? "公开" : "私有")+"吗", :class => "sy_class_option" %></li>
|
||||
<li><%= link_to "复制班级", copy_course_course_path(@course.id),:remote=>true, :class => "sy_class_option" %></li>
|
||||
<li><%= link_to "进入课程", syllabus_path(@course.syllabus), :class => "sy_class_option", :target => "_blank" %></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
@ -45,7 +42,7 @@
|
|||
<div class="sy_class_info fl ml15">
|
||||
<div class="sy_class_titbox">
|
||||
<h3 class="fl sy_class_title"><%=@course.name %></h3>
|
||||
<span class="icon_si fl mr20"><%=@course.is_public == 0 ? '私有' : '公开' %></span>
|
||||
<span class="<%= @course.is_public == 0 ? 'hw_icon_private' : 'hw_icon_open' %> fl mr20 mt3"></span>
|
||||
<p class="sy_cgrey fl mt3">
|
||||
<span class=" mr15">教师:<%= course_teacher_link teacher_num %></span>
|
||||
<span class=" mr15">学生:<%= course_student_link student_num %></span>
|
||||
|
@ -59,8 +56,18 @@
|
|||
<span class=" mr15">学期:<span class="sy_cblack"><%= current_time_and_term @course %></span></span>
|
||||
<span class=" mr15">单位:<span class="sy_cblack"><%= get_occupation_from_user(@course.teacher).blank? ? '无' : get_occupation_from_user(@course.teacher) %></span></span>
|
||||
</p>
|
||||
<!--<a href="javascript:void(0);" class="sy_btn_orange mr10" > 教师身份</a>-->
|
||||
<% unless is_teacher %>
|
||||
<% if is_teacher %>
|
||||
<%= link_to "班级设置", {:controller => 'courses', :action => 'settings', :id => @course}, :class => "sy_btn_grey mr10 fl" %>
|
||||
<% end %>
|
||||
<% is_TA = get_user_member_roles_course @course, User.current, 7 %>
|
||||
<% is_TE = get_user_member_roles_course @course, User.current, 9 %>
|
||||
<% is_ST = get_user_member_roles_course @course, User.current, 10 %>
|
||||
<% if !is_teacher && (is_TA || is_TE) %>
|
||||
<%= link_to '教师身份', switch_role_course_path(@course, :user_id => User.current.id, :curr_role => 10, :tar_role => (is_TA ? 7 : 9)), :class => "sy_btn_orange mr10 fl", :title => "由学生身份切换至教师身份" %>
|
||||
<% elsif is_teacher && is_ST %>
|
||||
<%= link_to '学生身份', switch_role_course_path(@course, :user_id => User.current.id, :curr_role => (is_TA ? 7 : 9), :tar_role => 10), :class => "sy_btn_orange mr10 fl", :title => "由教师身份切换至学生身份" %>
|
||||
<% end %>
|
||||
<% unless (is_teacher || is_TA || is_TE) %>
|
||||
<div id="join_in_course_header"><%= join_in_course_header(@course, User.current) %></div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
|
|
@ -1,12 +1,8 @@
|
|||
<div class="pr_info_join fl">
|
||||
<!--关注:非项目成员-->
|
||||
<% if !User.current.member_of?(@project) && User.current.login? && !User.current.admin %>
|
||||
<span><%= watcher_link_for_project(@project, User.current) %></span>
|
||||
<% end %>
|
||||
<!--加入项目 -->
|
||||
<% if !User.current.member_of?(@project) && User.current.login? && !User.current.admin %>
|
||||
<%= join_in_project_link(@project, User.current) %>
|
||||
<% end %>
|
||||
<div id="join_in_project_applied">
|
||||
<%= render :partial => "projects/applied_status" %>
|
||||
</div>
|
||||
<!--配置项目-->
|
||||
<% if User.current.admin? || User.current.allowed_to?({:controller => 'projects', :action => 'settings'}, @project) %>
|
||||
<%= link_to "<span class='pr_setting'></span>#{l(:button_configure)}".html_safe, settings_project_path(@project), :class => "pr_join_a" %>
|
||||
|
|
|
@ -62,3 +62,10 @@
|
|||
<%= call_hook :view_layouts_base_body_bottom %>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
<script>
|
||||
$("#sidebar ul").css({"marginLeft":"40px","marginTop":"1em","padding":"0"});
|
||||
$("#sidebar a").css({"color":"#169","fontSize":"12px","lineHeight":"1.5"});
|
||||
$("#sidebar a").mouseover(function(){$(this).css({"color":"#fff","backgroundColor":"#169"});});
|
||||
$("#sidebar a").mouseout(function(){$(this).css({"color":"#169","backgroundColor":"#fff"});});
|
||||
</script>
|
||||
|
|
|
@ -91,8 +91,8 @@
|
|||
<% end %>
|
||||
<% unless show_nav?(course_feedback_count) %>
|
||||
<li id="sy_06" class="sy_icons_feedback">
|
||||
<a href="<%=course_feedback_path(@course) %>">留言<span><%=course_feedback_count %></span></a>
|
||||
<%= link_to "", course_feedback_path(@course), :class => 'sy_class_add', :title =>"#{l(:label_course_feedback)}", :id => "course_jour_count"%>
|
||||
<a href="<%=course_feedback_path(@course) %>">留言<span id="course_jour_count"><%=course_feedback_count %></span></a>
|
||||
<%= link_to "", course_feedback_path(@course), :class => 'sy_class_add', :title =>"#{l(:label_course_feedback)}"%>
|
||||
</li>
|
||||
<% end %>
|
||||
<% unless show_nav?(course_poll_count) %>
|
||||
|
|
|
@ -53,7 +53,8 @@
|
|||
<%= image_tag(url_to_avatar(@project), :width => "60", :height => "60") %>
|
||||
</div>
|
||||
<div class="pr_info_id fl mb5 f14">
|
||||
<%= l(:label_project_id)%><%= @project.id %>
|
||||
<%= l(:label_project_ivite_code)%>
|
||||
<%= (User.current.member_of?(@project) || User.current.admin?) ? @project.invite_code : "******" %>
|
||||
</div>
|
||||
<!--关注、申请加入/退出项目-->
|
||||
<div id="join_exit_project_div">
|
||||
|
|
|
@ -192,7 +192,7 @@
|
|||
<%= link_to '课程',{:controller => "users", :action => "user_courselist", :id => @user.id}, :class => "homepageMenuText" %>
|
||||
|
||||
<% if is_current_user%>
|
||||
<% if User.current.user_extensions && User.current.user_extensions.identity == 0 && User.current.allowed_to?(:add_course, nil, :global => true)%>
|
||||
<%# if User.current.user_extensions && User.current.user_extensions.identity == 0 && User.current.allowed_to?(:add_course, nil, :global => true)%>
|
||||
<div class="courseMenu" id="courseMenu">
|
||||
<ul>
|
||||
<li class="courseMenuIcon fr" style="margin-right:10px;" id="courseMenuIcon">
|
||||
|
@ -211,9 +211,9 @@
|
|||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<% else%>
|
||||
<%=link_to "", join_private_courses_courses_path, :class => "homepageMenuSetting fr",:style => "margin-right:10px;", :remote => true, :title => "加入班级"%>
|
||||
<% end%>
|
||||
<%# else%>
|
||||
<%#=link_to "", join_private_courses_courses_path, :class => "homepageMenuSetting fr",:style => "margin-right:10px;", :remote => true, :title => "加入班级"%>
|
||||
<%# end%>
|
||||
<% end%>
|
||||
</div>
|
||||
<% end %>
|
||||
|
@ -245,8 +245,21 @@
|
|||
</div>
|
||||
<div class="homepageLeftMenuBlock">
|
||||
<%= link_to '项目',{:controller => "users", :action => "user_projectlist", :id => @user.id}, :class => "homepageMenuText" %>
|
||||
<% if is_current_user%>
|
||||
<%=link_to "", new_project_path(:host=> Setting.host_name), :class => "homepageMenuSetting fr", :style => "margin-right:10px;", :title => "新建项目"%>
|
||||
<% if is_current_user %>
|
||||
<div class="courseMenu" id="projectMenu">
|
||||
<ul>
|
||||
<li class="courseMenuIcon fr" style="margin-right:10px;" id="courseMenuIcon">
|
||||
<ul class="topnav_course_menu" id="topnav_project_menu">
|
||||
<li>
|
||||
<%= link_to "新建项目", new_project_path(:host=> Setting.host_name), :class => "menuGrey"%>
|
||||
</li>
|
||||
<li>
|
||||
<%= link_to "加入项目", applied_join_project_path,:remote => true,:class => "menuGrey",:method => "post"%>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<% end%>
|
||||
</div>
|
||||
<%# if @user.projects.visible.count > 0
|
||||
|
@ -362,6 +375,12 @@
|
|||
$("#courseMenu").mouseleave(function(){
|
||||
$("#topnav_course_menu").hide();
|
||||
});
|
||||
$("#projectMenu").mouseenter(function(){
|
||||
$("#topnav_project_menu").show();
|
||||
});
|
||||
$("#projectMenu").mouseleave(function(){
|
||||
$("#topnav_project_menu").hide();
|
||||
});
|
||||
function leftCourseslistChange(){
|
||||
$('#homepageLeftMenuCourses').slideToggle();
|
||||
$('#hide_show_courseicon').toggleClass("homepageLeftMenuHideIcon");
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
<% if @flash_message %>
|
||||
alert("<%= @flash_message %>");
|
||||
<% else%>
|
||||
$("#applied_project_<%= @applied_message.id %>").html('<%= render :partial => "users/user_message_applide_action", :locals =>{:ma => @applied_message} %>');
|
||||
<% end%>
|
|
@ -0,0 +1 @@
|
|||
$("#applied_project_<%= @applied_message.id %>").html('<%= render :partial => "users/user_message_applide_action", :locals =>{:ma => @applied_message} %>');
|
|
@ -369,7 +369,7 @@
|
|||
function apply_add_school(){
|
||||
var htmlvalue = "<%= escape_javascript( render :partial => 'my/apply_add_school' )%>";
|
||||
pop_up_box(htmlvalue,580,20,48);
|
||||
|
||||
$("#schoolname").val($("input[name='province']").val());
|
||||
}
|
||||
function add_school(name){
|
||||
$.ajax({
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
<% if !User.current.member_of?(@project) && User.current.login? && !User.current.admin %>
|
||||
<span><%= watcher_link_for_project(@project, User.current) %></span>
|
||||
<!--加入项目 -->
|
||||
<% if AppliedProject.where(:user_id => User.current, :project_id => @project_id).first.nil? %>
|
||||
<%= join_in_project_link(@project, User.current) %>
|
||||
<% else %>
|
||||
等待审批
|
||||
<% end %>
|
||||
<% end %>
|
|
@ -55,12 +55,6 @@
|
|||
<%= link_to "+"+l(:project_gitlab_create_repository), url_for(:controller => 'projects', :action => 'settings', :id => @project.id, :tab=>'repositories') , :class => "subnav_green" %>
|
||||
<% end %>
|
||||
</div>
|
||||
<!--quality_analysis-->
|
||||
<% unless QualityAnalysis.where(:project_id => @project.id).first.nil? %>
|
||||
<div class="subNav">
|
||||
<%= link_to "代码分析结果", project_quality_analysis_path(:project_id => @project.id), :class => "f14 c_blue02" %>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<!-- more -->
|
||||
<div class="subNav subNav_jiantou" id="expand_tools_expand"><%= l(:label_project_more) %></div>
|
||||
|
|
|
@ -92,32 +92,6 @@
|
|||
<% if roles.any? %>
|
||||
<div class="members_right">
|
||||
<!-- applied -->
|
||||
<% if @project.applied_projects.any? %>
|
||||
<div class="members_jion">
|
||||
<p class="c_blue mb10 fb"><%= l(:label_apply_project) %></p>
|
||||
<%= form_for(@applied_members, {:as => :membership, :url => project_memberships_path(@project), :remote => true, :method => :post}) do |f| %>
|
||||
<div id="principals_for_applied_member">
|
||||
<%= render_principals_for_applied_members_new(@project) %>
|
||||
</div>
|
||||
<ul class="mb10">
|
||||
<li><%= l(:label_role_plural) %>:</li>
|
||||
<% roles.each do |role| %>
|
||||
<li>
|
||||
<%= check_box_tag 'membership[role_ids][]', role.id %>
|
||||
<label ><%= h role %></label >
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
<a remote="true" href="javascript:void(0)" class="blue_btn fl" onclick="$('#new_membership').submit();">
|
||||
<%= l(:label_approve) %>
|
||||
</a>
|
||||
<a remote="true" href="javascript:void(0)" class="grey_btn fl ml10" onclick="refusal_applied_member();">
|
||||
<%= l(:label_refusal) %>
|
||||
</a>
|
||||
<% end %>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<% end %><!--members_jion end-->
|
||||
<div class="cl"></div>
|
||||
<!-- add members -->
|
||||
<p class="c_blue fb mt10 mb5"><%= l(:label_member_new) %></p>
|
||||
|
|
|
@ -7,6 +7,10 @@
|
|||
<%= link_to "质量分析", quality_analysis_path(:id => @project.id, :repository_id => @repository.identifier, :rev => @rev, :default_branch => @g_default_branch ), :remote => true, :class => "btn_zipdown fr" %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<!--quality_analysis-->
|
||||
<% unless QualityAnalysis.where(:project_id => @project.id).first.nil? %>
|
||||
<%= link_to "代码分析结果", project_quality_analysis_path(:project_id => @project.id), :class => "btn_zipdown fr" %>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="repository_con" style="line-height:1.9;">
|
||||
<% if @entries.nil? %>
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
<%= link_to course.name+"("+current_time_and_term_short(course)+")", course_path(course.id,:host=>Setting.host_course), :class => "sy_classlist_title fl",
|
||||
:style => 'color:#000',:id => "show_course_#{course.id}", :target => '_blank', :title => (course.is_public? ? "公开班级:":"私有班级:")+course.name+"("+current_time_and_term(course)+")"%>
|
||||
<% end %>
|
||||
<span class="icon_si fl mr20"><%=course.is_public? ? '公开' : '私有' %></span>
|
||||
<span class="<%= course.is_public == 0 ? 'hw_icon_private' : 'hw_icon_open' %> fl mr20 mt3"></span>
|
||||
<div class="cl"></div>
|
||||
<p class="sy_cgrey">
|
||||
<span class=" mr15">主讲老师:<%=link_to course.teacher.show_name, user_path(course.teacher), :class => 'sy_cblue' %></span>
|
||||
|
|
|
@ -6,13 +6,13 @@
|
|||
<%= labelled_form_for @syllabus do |f| %>
|
||||
<li class="ml45">
|
||||
<label><span class="c_red">*</span> 课程名称 :</label>
|
||||
<input type="text" name="title" id="new_syllabus_name" class="name_input" placeholder="例如:设计管理" maxlength="100" onkeyup="regex_syllabus_name();">
|
||||
<input type="text" name="title" id="new_syllabus_name" class="name_input" placeholder="例如:软件工程" maxlength="100" onkeyup="regex_syllabus_name();">
|
||||
<span class="c_red" id="new_syllabus_name_notice" style="display: none;">课程名称不能为空且至少有两个字符</span>
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
<li class="ml45">
|
||||
<label><span class="c_white">*</span> <%= l(:label_tags_course_eng_name)%> :</label>
|
||||
<input type="text" name="eng_name" id="new_syllabus_eng_name" placeholder="例如:Management of design" class="name_input" maxlength="100">
|
||||
<input type="text" name="eng_name" id="new_syllabus_eng_name" placeholder="例如:Software Engineering" class="name_input" maxlength="100">
|
||||
<!--<span class="c_red" id="new_course_class_period_notice" style="display: none;"></span>-->
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
|
|
|
@ -53,7 +53,7 @@
|
|||
<% comments = @syllabus.journals_for_messages.reorder("created_on desc").limit(3) %>
|
||||
<% if count > 0 %>
|
||||
<div class="" id="reply_div_<%= @syllabus.id %>">
|
||||
<%= render :partial => 'users/all_replies', :locals => {:comments => comments}%>
|
||||
<%=render :partial => 'users/news_replies', :locals => {:comments => comments, :type => 'Syllabus', :activity_id => @syllabus.id} %>
|
||||
</div>
|
||||
<% end %>
|
||||
<div class="homepagePostReplyContainer borderBottomNone minHeight48">
|
||||
|
|
|
@ -1,39 +0,0 @@
|
|||
<ul>
|
||||
<% comments.each do |comment| %>
|
||||
<script type="text/javascript">
|
||||
$(function(){
|
||||
showNormalImage('reply_content_<%= comment.id %>');
|
||||
autoUrl('reply_content_<%= comment.id %>');
|
||||
});
|
||||
</script>
|
||||
<li class="homepagePostReplyContainer" nhname="reply_rec">
|
||||
<div class="homepagePostReplyPortrait">
|
||||
<%= link_to image_tag(url_to_avatar(comment.creator_user), :width => 33, :height => 33, :alt => "用户头像"), user_url_in_org(comment.creator_user.id) %>
|
||||
</div>
|
||||
<div class="homepagePostReplyDes">
|
||||
<div class="homepagePostReplyPublisher">
|
||||
<%= link_to comment.creator_user.show_name, user_url_in_org(comment.creator_user.id), :class => "newsBlue mr10 f14" %>
|
||||
<%= time_from_now(comment.created_time) %>
|
||||
<span id="reply_praise_count_<%=comment.id %>">
|
||||
<%=render :partial=> "praise_tread/praise", :locals => {:activity=>comment, :user_activity_id=>comment.id,:type=>"reply"}%>
|
||||
</span>
|
||||
</div>
|
||||
<% if !comment.content_detail.blank? || comment.class == Journal %>
|
||||
<div class="homepagePostReplyContent break_word list_style upload_img table_maxWidth" id="reply_content_<%= comment.id %>">
|
||||
<% if comment.class == Journal %>
|
||||
<% if comment.details.any? %>
|
||||
<% details_to_strings(comment.details).each do |string| %>
|
||||
<p><%= string %></p>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<P><%= comment.notes.html_safe %></P>
|
||||
<% else %>
|
||||
<%= comment.content_detail.html_safe %>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
|
@ -0,0 +1,30 @@
|
|||
<% unless courses.nil? %>
|
||||
<% courses.each_with_index do |course, i| %>
|
||||
<li class="syllabus_class_list <%=i > 2 ? 'none' : '' %>">
|
||||
<% allow_visit = User.current.member_of_course?(course) || User.current.admin? || course.is_public == 1 %>
|
||||
<a href="<%= allow_visit ? course_path(course.id) : "javascript:void(0)" %>" target="_blank" title="<%= allow_visit ? "" : "私有班级不可访问"%>">
|
||||
<span class="icons_sy_cir "></span>
|
||||
<div class="fl">
|
||||
<div class="syllabus_class_w ">
|
||||
<p class="syllabus_class_title fl"><%=course.name %></p>
|
||||
<span class="<%= course.is_public == 0 ? 'hw_icon_private' : 'hw_icon_open' %> fl"></span>
|
||||
<span class="fr sy_p_grey hidden" style="max-width: 120px;">主讲老师:<%=course.teacher.show_name %></span>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<div class="">
|
||||
<p class="fl grayTxt ">更新:<%=format_date Time.at(course.updatetime) %><span class="mr10"></span>学期:<%=current_time_and_term(course) %></p>
|
||||
<p class="list-info fr grayTxt"><span><%=studentCount course %></span><span>学生</span><span>|</span><span><%=visable_course_homework course %></span><span>作业</span><span>|</span><span><%=visable_attachemnts_incourse(course).count %></span><span>资源</span></p>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
</div>
|
||||
<span class="icons_sy_arrow fl mt19 ml10" ></span>
|
||||
<div class="cl"></div>
|
||||
</a>
|
||||
</li>
|
||||
<% end %>
|
||||
<% if courses.count > 3 %>
|
||||
<li class="syllabus_class_list_more" id="syllabus_class_list_more_<%=syllabus.id %>">
|
||||
<a href="javascript:void(0);" id="expand_list_<%=syllabus.id %>" data-init="0" onclick="expand_course_list(<%=syllabus.id %>,'#syllabus_course_ul_<%=syllabus.id %> li','#expand_list_<%=syllabus.id %>',<%=courses.count %>)">共<%=courses.count %>个班级,点击全部展开</a>
|
||||
</li>
|
||||
<% end %>
|
||||
<% end %>
|
|
@ -5,7 +5,7 @@
|
|||
</li>
|
||||
<li class="<%=(ma.status == 0 || ma.status.nil?) ? 'homepageHomeworkContent2' : 'homepageHomeworkContent' %> fl">
|
||||
<a href="javascript:void(0);" class="newsGrey">
|
||||
<%= link_to User.find(ma.course_message_id).name+"申请成为课程\""+"#{Course.find(ma.course_id).name}"+"\"的"+"#{ma.content == '9' ? "教师" : "教辅"}", user_path(User.find(ma.course_message_id), :course_id => ma.course_id),
|
||||
<%= link_to User.find(ma.course_message_id).name+"申请成为课程\""+"#{Course.find(ma.course_id).name}"+"\"的"+"#{ma.content && ma.content.include?('9') ? "教师" : "教辅"}", user_path(User.find(ma.course_message_id), :course_id => ma.course_id),
|
||||
:class => "#{ma.viewed==0 ? "newsBlack" : "newsGrey"}", :target => '_blank' %>
|
||||
<!--:onmouseover => "message_titile_show($(this),event)",-->
|
||||
<!--:onmouseout => "message_titile_hide($(this))" %>-->
|
||||
|
@ -18,14 +18,14 @@
|
|||
<p>真实姓名:<%= User.find(ma.course_message_id).realname %></p>
|
||||
<p>申请课程:<%= Course.find(ma.course_id).name%></p>
|
||||
<div class="fl">课程描述:</div>
|
||||
<div class="ml60"><%= Course.find(ma.course_id).description.html_safe if Course.find(ma.course_id).description %></div> <p>申请职位:<%= ma.content == '9' ? "教师" : "教辅"%></p>
|
||||
<div class="ml60"><%= Course.find(ma.course_id).description.html_safe if Course.find(ma.course_id).description %></div> <p>申请职位:<%=ma.content && ma.content.include?('9') ? "教师" : "教辅"%></p>
|
||||
</div>
|
||||
<li class="<%=(ma.status == 0 || ma.status.nil?) ? 'homepageHomeworkContentWarn2' : 'homepageHomeworkContentWarn' %> fl">
|
||||
<span id="deal_info_<%=ma.id%>">
|
||||
<% if ma.status == 0 || ma.status.nil?%>
|
||||
<%= link_to '同意',dealwith_apply_request_user_path(User.current,:agree=>'Y',:msg_id=>ma.id),:remote=>'true'%>
|
||||
<%= link_to '同意',dealwith_apply_request_user_path(User.current,:agree=>'Y',:msg_id=>ma.id),:remote=>'true',:class=>'linkBlue'%>
|
||||
|
|
||||
<%= link_to '拒绝',dealwith_apply_request_user_path(User.current,:agree=>'N',:msg_id=>ma.id),:remote=>'true'%>
|
||||
<%= link_to '拒绝',dealwith_apply_request_user_path(User.current,:agree=>'N',:msg_id=>ma.id),:remote=>'true',:class=>'linkBlue'%>
|
||||
<% elsif ma.status == 1%> <!-- 同意 -->
|
||||
您已经同意了该申请
|
||||
<% elsif ma.status == 2%> <!-- 拒绝 -->
|
||||
|
|
|
@ -82,7 +82,7 @@
|
|||
<span style="position: relative" class="fr mr20">
|
||||
<%= link_to(
|
||||
l(:button_reply),
|
||||
{:controller => 'users' ,:action => 'reply_to', :reply_id => comment.id, :type => type, :user_activity_id => user_activity_id, :activity_id => activity_id, :homepage => homepage},
|
||||
{:controller => 'users' ,:action => 'reply_to', :reply_id => comment.id, :type => type, :user_activity_id => user_activity_id, :activity_id => activity_id, :homepage => homepage, :user_id => user_id},
|
||||
:remote => true,
|
||||
:method => 'get',
|
||||
:title => l(:button_reply)) if !comment.root.locked? %>
|
||||
|
@ -91,7 +91,7 @@
|
|||
<% if comment.author == User.current %>
|
||||
<%= link_to(
|
||||
l(:button_delete),
|
||||
{:controller => 'blog_comments',:action => 'destroy', :id => comment.id, :user_activity_id => user_activity_id, :homepage => homepage},
|
||||
{:controller => 'blog_comments',:action => 'destroy', :id => comment.id, :user_activity_id => user_activity_id, :homepage => homepage, :user_id => user_id},
|
||||
:method => :delete,
|
||||
:remote => true,
|
||||
:class => 'fr mr20',
|
||||
|
|
|
@ -76,6 +76,20 @@
|
|||
:class => 'fr mr20',
|
||||
:title => l(:button_delete)
|
||||
) if comment.user_id == User.current.id %>
|
||||
<% elsif type == 'Syllabus' %>
|
||||
<span style="position: relative" class="fr mr20">
|
||||
<%= link_to(
|
||||
l(:button_reply),
|
||||
{:controller => 'users', :action => 'reply_to', :reply_id => comment.id, :type => type},
|
||||
:remote => true,
|
||||
:method => 'get',
|
||||
:title => l(:button_reply)) %>
|
||||
<span id="reply_iconup_<%= comment.id %>" class="reply_iconup02" style="display: none"> ︿</span>
|
||||
</span>
|
||||
<% if User.current.admin? || User.current == Syllabus.find(activity_id).user || comment.user == User.current%>
|
||||
<%= link_to('删除', {:controller => 'words', :action => 'destroy', :object_id => comment, :user_id => comment.user},
|
||||
:remote => true, :confirm => l(:text_are_you_sure), :method => 'delete', :class => "fr mr20", :title => l(:button_delete)) %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</span>
|
||||
<div class="cl"></div>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<div class="homepagePostReplyBanner">
|
||||
<div class="homepagePostReplyBanner" id="reply_banner_<%=user_activity_id %>">
|
||||
<div class="homepagePostReplyBannerCount">
|
||||
<span>回复</span>
|
||||
<span class="reply_iconup" > ︿</span>
|
||||
|
|
|
@ -42,7 +42,7 @@
|
|||
<p nhname='contentmsg_<%= reply.id%>'></p>
|
||||
<% end%>
|
||||
<% elsif @type == 'BlogComment' %>
|
||||
<%= form_for('new_form', :url => {:controller => 'blog_comments',:action => 'reply', :id => reply.id, :blog_id => reply.blog.id, :user_id => User.current.id}, :method => "post", :remote => true) do |f| %>
|
||||
<%= form_for('new_form', :url => {:controller => 'blog_comments',:action => 'reply', :id => reply.id, :blog_id => reply.blog.id, :user_id => @user_id}, :method => "post", :remote => true) do |f| %>
|
||||
<input type="hidden" name="blog_comment[title]" value="RE:<%=(BlogComment.find @activity_id).title %>" id="reply_subject">
|
||||
<%= hidden_field_tag 'user_activity_id',params[:user_activity_id],:value =>@user_activity_id %>
|
||||
<%= hidden_field_tag 'parent_id', params[:parent_id], :value => reply.id %>
|
||||
|
@ -82,6 +82,15 @@
|
|||
<div class="cl"></div>
|
||||
<p nhname='contentmsg_<%= reply.id%>' class="fl"></p>
|
||||
<% end %>
|
||||
<% elsif @type == 'Syllabus' %>
|
||||
<%= form_for('new_form',:url => {:controller => 'words', :action => 'reply_to_syllabus', :id => reply.id},:method => "post", :remote => true) do |f| %>
|
||||
<input type="hidden" name="reply[subject]" id="reply_subject">
|
||||
<div nhname='toolbar_container_<%= reply.id%>'></div>
|
||||
<textarea placeholder="有问题或有建议,请直接给我留言吧!" style="display: none" nhname='new_message_textarea_<%= reply.id%>' name="reply_message"></textarea>
|
||||
<a id="new_message_submit_btn_<%= reply.id%>" href="javascript:void(0)" onclick="this.style.display='none'" class="blue_n_btn fr" style="display:none;margin-top:6px;">发送</a>
|
||||
<div class="cl"></div>
|
||||
<p nhname='contentmsg_<%= reply.id%>'></p>
|
||||
<% end%>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
|
|
|
@ -0,0 +1,61 @@
|
|||
<div class="syllabus_category">
|
||||
<% if @type.to_i == 2 %>
|
||||
<%= link_to "", {:controller => 'users', :action => 'sort_syllabus_list', :id =>@user,:list_type => list_type, :type => @type, :sort => @c_sort, :order => 2 }, :class => "#{@c_sort.to_i == 1 ? 'sortupbtn' : 'sortdownbtn'} fr", :style => "margin-right: 5px;", :remote => true %>
|
||||
<% else %>
|
||||
<%= link_to "", {:controller => 'users', :action => 'sort_syllabus_list', :id =>@user,:list_type => list_type, :type => @type, :sort => @c_sort, :order => 2 }, :class => "sortdownbtn sort_no fr", :style => "margin-right: 5px;", :remote => true %>
|
||||
<% end %>
|
||||
<%= link_to "人气", {:controller => 'users', :action => 'sort_syllabus_list', :id =>@user,:list_type => list_type, :type => @type, :sort => @c_sort, :order => 2 }, :class => "sortTxt fr", :remote => true %>
|
||||
<% if @type.to_i == 1 %>
|
||||
<%= link_to "", {:controller => 'users', :action => 'sort_syllabus_list', :id =>@user,:list_type => list_type, :type => @type, :sort => @c_sort, :order => 1 }, :class => "#{@c_sort.to_i == 1 ? 'sortupbtn' : 'sortdownbtn'} fr", :remote => true %>
|
||||
<% else %>
|
||||
<%= link_to "", {:controller => 'users', :action => 'sort_syllabus_list', :id =>@user,:list_type => list_type, :type => @type, :sort => @c_sort, :order => 1 }, :class => "sortdownbtn sort_no fr", :remote => true %>
|
||||
<% end %>
|
||||
<%= link_to "时间", {:controller => 'users', :action => 'sort_syllabus_list', :id =>@user,:list_type => list_type, :type => @type, :sort => @c_sort, :order => 1 }, :class => "sortTxt fr", :remote => true %>
|
||||
<span class="grayTxt fl "><%=@user == User.current ? "我" : "他" %><%= list_type == 1 ? "创建" : "加入"%>的课程</span>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
|
||||
<% if syllabuses.any? %>
|
||||
<% syllabuses.each_with_index do |syllabus, index|%>
|
||||
<div class="syllabus_courses_box">
|
||||
<% course_count = syllabus.courses.not_deleted.count %>
|
||||
<div class="syllabus_courses_list" onclick="expand_courses(<%=syllabus.id %>,<%=course_count %>);" id="syllabus_courses_list_<%= syllabus.id %>">
|
||||
<div class="<%=index == 0 ? 'sy_courses_open' : 'sy_courses_close' %>">
|
||||
<span class="<%=index == 0 && course_count != 0 ? 'icons_sy_open' : 'icons_sy_close' %> fl mr5"></span>
|
||||
<h3 class="syllabus_courses_title fl"><%=syllabus.title %></h3>
|
||||
</div>
|
||||
<p class="fl sy_p_grey">更新时间:<%=format_date syllabus.updated_at %>
|
||||
<span class="mr10"></span>创建老师:<%=syllabus.user.show_name %>
|
||||
<span class="mr10"></span>班级:<%=course_count %>
|
||||
</p>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
|
||||
<div class="syllabus_class_box <%=index == 0 ? '' : 'none' %>">
|
||||
<ul id="syllabus_course_ul_<%=syllabus.id %>">
|
||||
<% if index == 0 %>
|
||||
<% courses = syllabus.courses.not_deleted.select("courses.*,(SELECT MAX(updated_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS updatetime").order("updatetime desc") %>
|
||||
<%= render :partial => 'users/courses_list', :locals => {:courses => courses, :syllabus => syllabus}%>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div><!--syllabus_class_box end-->
|
||||
|
||||
<div class="homepagePostSetting">
|
||||
<ul>
|
||||
<li class="icons_sy_setting">
|
||||
<ul class="homepagePostSettiongText">
|
||||
<li>
|
||||
<%=link_to '查看课程', syllabus_path(syllabus.id), :class => 'postOptionLink',:target =>'_blank', :title => '查看课程' %>
|
||||
</li>
|
||||
<% if User.current == syllabus.user %>
|
||||
<li><%=link_to '删除课程', delete_syllabus_syllabus_path(syllabus), :class => 'postOptionLink', :remote => 'true'%></li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<p class="nodata"><%= l(:label_no_data) %></p>
|
||||
<% end %>
|
|
@ -50,7 +50,7 @@
|
|||
<% comments = get_all_children(all_comments, activity)[0..2] %>
|
||||
<% if count > 0 %>
|
||||
<div class="" id="reply_div_<%= user_activity_id %>">
|
||||
<%= render :partial => 'users/message_replies', :locals => {:comments => comments, :user_activity_id => user_activity_id, :type => 'BlogComment', :activity_id =>activity.id, :homepage => 0}%>
|
||||
<%= render :partial => 'users/message_replies', :locals => {:comments => comments, :user_activity_id => user_activity_id, :type => 'BlogComment', :activity_id =>activity.id, :homepage => 0, :user_id => activity.author_id}%>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
|
|
|
@ -70,7 +70,7 @@
|
|||
<div class="mt5 fl">
|
||||
<!-- , user_import_resource_user_path(User.current.id,:homework_id=>container.id) -->
|
||||
<a href="javascript:void(0);" class="AnnexBtn fl mt3 mr15" onclick="$('#_file').click();" title="请选择文件上传">上传附件</a>
|
||||
<%= link_to "资源库", user_ref_resource_search_user_path(User.current.id, :homework_id => container.id), :class => "FilesBtn fl mt3 mr15", :title => "请从资源库中选择文件作为作品的附件", :remote => true %>
|
||||
<%= link_to "资源库", user_ref_resource_search_user_path(User.current.id, :homework_id => container.id), :class => "FilesBtn fl mt3 mr15", :title => "请从资源库中选择文件作为作业的附件", :remote => true %>
|
||||
<% if defined?(has_program) && has_program %>
|
||||
<div id="program_setting" class="fl">
|
||||
<a href="javascript:void(0);" class="ProBtn fl mt3"title="请设置编程语言和输入测试集">编程</a>
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
<div id="user_join_syllabus_list">
|
||||
<%= render :partial => "users/syllabus_course_list", :locals => {:syllabuses => @join_syllabuses, :list_type => 2} %>
|
||||
</div>
|
|
@ -0,0 +1,12 @@
|
|||
<% if allow_to_show(ma) %>
|
||||
<%= link_to "同意", allow_to_join_project_project_memberships_path(:project_id => ma.project_id, :applied_message_id => ma.id), :remote => true, :method => :post, :class => "link-blue"%> |
|
||||
<%= link_to "拒绝", refused_allow_to_join_project_project_memberships_path(:project_id => ma.project_id, :applied_message_id => ma.id), :remote => true, :method => :get, :class => "link-blue" %>
|
||||
<% elsif ma.status == 4 %>
|
||||
<span class="fontGrey3">被拒绝</span>
|
||||
<% elsif ma.status == 5 %>
|
||||
<span class="fontGrey3">您已拒绝</span>
|
||||
<% elsif ma.status == 6 %>
|
||||
<span class="fontGrey3">已通过</span>
|
||||
<% elsif ma.status == 7 %>
|
||||
<span class="fontGrey3">您已同意</span>
|
||||
<% end %>
|
|
@ -0,0 +1,2 @@
|
|||
<%=link_to applied_project_users(ma), user_path(applied_project_users(ma)), :class => "newsBlue homepageNewsPublisher", :target => '_blank' %>
|
||||
<span class="homepageNewsType fl"><%= applied_project_tip(ma) %></span>
|
|
@ -1,34 +1,71 @@
|
|||
<% if ma.class == AppliedMessage %>
|
||||
<!--申请加入项目-->
|
||||
<% if ma.applied_type == "ApplyAddSchools" %>
|
||||
<% if ma.status == 1 || ma.status == 2 || ma.status == 3 || ma.status == 4 %>
|
||||
<ul class="homepageNewsList fl">
|
||||
<li class="homepageNewsPortrait fl">
|
||||
<a href="javascript:void(0);"><%= link_to image_tag(url_to_avatar(ma.user), :width => "30", :height => "30"), user_path(ma.user), :target => '_blank' %></a>
|
||||
<a href="javascript:void(0);">
|
||||
<% if ma.status == 1 || ma.status == 2 || ma.status == 3 %>
|
||||
<%= image_tag("/images/trustie_logo1.png", width: "30px", height: "30px", class: "mt3") %>
|
||||
<% elsif ma.status == 4 %>
|
||||
<%= link_to image_tag(url_to_avatar(ma.user), :width => "30", :height => "30"), user_path(ma.user), :target => '_blank' %>
|
||||
<% end %>
|
||||
</a>
|
||||
</li>
|
||||
<li class="homepageNewsPubType fl">
|
||||
<% if ma.status == 1 %>
|
||||
<%=link_to ma.user, user_path(ma.user), :class => "newsBlue homepageNewsPublisher", :target => '_blank' %>
|
||||
<span class="newsBlue homepageNewsPublisher">系统提示</span>
|
||||
<span class="<%= ma.viewed == 0 ? "homepageNewsTypeNotRead fl" : "homepageNewsType fl" %>">您添加新的高校(单位):</span>
|
||||
<li class="homepageNewsContent fl">
|
||||
<a class ="#{ma.viewed == 0 ? 'newsBlack' : 'newsGrey'}" target = '_blank'><%= ma.name %>的申请,已通过</a>
|
||||
<a class ="#{ma.viewed == 0 ? 'newsBlack' : 'newsGrey'}" target = '_blank' title="<%= ma.name %>的申请,已通过">“<%= ma.name %>”的申请,已通过</a>
|
||||
</li>
|
||||
<li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li>
|
||||
<% elsif ma.status == 2 %>
|
||||
<%=link_to ma.user, user_path(ma.user), :class => "newsBlue homepageNewsPublisher", :target => '_blank' %>
|
||||
<span class="newsBlue homepageNewsPublisher">系统提示</span>
|
||||
<span class="<%= ma.viewed == 0 ? "homepageNewsTypeNotRead fl" : "homepageNewsType fl" %>">您添加新的高校(单位):</span>
|
||||
<li class="homepageNewsContent fl">
|
||||
<a class ="#{ma.viewed == 0 ? 'newsBlack' : 'newsGrey'}" target = '_blank'><%= ma.applied.name %>的申请,因名称不合法,系统已将其更改为“<%= ma.name %>”</a>
|
||||
<a class ="#{ma.viewed == 0 ? 'newsBlack' : 'newsGrey'}" target = '_blank' title="<%= ma.applied.name %>的申请,因名称不合法,系统已将其更改为“<%= ma.name %>”"><%= ma.applied.name %>的申请,因名称不合法,系统已将其更改为“<%= ma.name %>”</a>
|
||||
</li>
|
||||
<li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li>
|
||||
<% elsif ma.status == 3 %>
|
||||
<%=link_to ma.user, user_path(ma.user), :class => "newsBlue homepageNewsPublisher", :target => '_blank' %>
|
||||
<span class="newsBlue homepageNewsPublisher">系统提示</span>
|
||||
<span class="<%= ma.viewed == 0 ? "homepageNewsTypeNotRead fl" : "homepageNewsType fl" %>">您添加新的高校(单位):</span>
|
||||
<li class="homepageNewsContent fl">
|
||||
<%= link_to ma.name + "的申请,因名称不合法,已被拒绝,请重新编辑您的基本资料", { :controller=> "my",:action => "account" } %>
|
||||
<%= link_to "“"+ma.name+"”" + "的申请,因名称不合法,已被拒绝,请重新编辑您的基本资料", { :controller=> "my",:action => "account" }, :title => "“#{ma.name}”的申请,因名称不合法,已被拒绝,请重新编辑您的基本资料", :target => '_blank'%>
|
||||
</li>
|
||||
<li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li>
|
||||
<% end %>
|
||||
<% elsif ma.status == 4 %>
|
||||
<%=link_to User.where("id=?", ma.applied_user_id).first.show_name, user_path(ma.user), :class => "newsBlue homepageNewsPublisher", :target => '_blank' %>
|
||||
<span class="<%= ma.viewed == 0 ? "homepageNewsTypeNotRead fl" : "homepageNewsType fl" %>"> 申请了单位:</span>
|
||||
<li class="homepageNewsContent fl">
|
||||
<a class ="#{ma.viewed == 0 ? 'newsBlack' : 'newsGrey'}" target = '_blank'>
|
||||
<%= link_to User.where("id=?", ma.applied_user_id).first.show_name + "提交了申请:添加新的单位“#{ma.name}”", unapplied_schools_path(), :title => "#{User.where("id=?", ma.applied_user_id).first.show_name}提交了申请:添加新的单位“#{ma.name}”" %></a>
|
||||
</li>
|
||||
<li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li>
|
||||
<% end %>
|
||||
</li>
|
||||
</ul>
|
||||
<% end %>
|
||||
<% elsif ma && ma.applied_type == "AppliedProject" %>
|
||||
<ul class="homepageNewsList fl">
|
||||
<li class="homepageNewsPortrait fl">
|
||||
<a href="javascript:void(0);"><%=link_to image_tag(url_to_avatar(applied_project_users(ma)), :width => "30", :height => "30"), user_path(applied_project_users(ma)), :target => '_blank' %></a>
|
||||
</li>
|
||||
<li class="homepageNewsPubType fl">
|
||||
<%= render :partial => "users/user_message_applide_users", :locals =>{:ma => ma} %>
|
||||
</li>
|
||||
<li class="homepageNewsContent fl" style="width:283px;"><a href="javascript:void(0);" class="newsGrey">
|
||||
以“<%= applied_project_message_type(ma.role) %>”身份加入
|
||||
<% project = Project.find(ma.project_id) %>
|
||||
<%= link_to project.name, project_path(ma.project_id), :class => "link-blue", :target => '_blank', :title => "#{project.name}" %>
|
||||
</a>
|
||||
</li>
|
||||
<li class="fl" style="width:71px; height:49px;">
|
||||
<span id="applied_project_<%= ma.id %>">
|
||||
<%= render :partial => "users/user_message_applide_action", :locals =>{:ma => ma} %>
|
||||
</span>
|
||||
</li>
|
||||
<li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li>
|
||||
</ul>
|
||||
<% end %>
|
||||
<% end %>
|
|
@ -586,9 +586,9 @@
|
|||
</li>
|
||||
<li class="homepageNewsContent fl"><a href="javascript:void(0);" class="newsGrey">
|
||||
<%= link_to ma.status == 1 ?
|
||||
'您申请成为班级"'+Course.find(ma.course_id).name+'"的'+(ma.content == '9' ? '老师' : '教辅')+'申请已通过'
|
||||
'您申请成为班级"'+Course.find(ma.course_id).name+'"的'+(ma.content.include?('9') ? '教师' : '教辅')+'申请已通过'
|
||||
:
|
||||
'您申请成为班级"'+Course.find(ma.course_id).name+'"的'+(ma.content == '9' ? '老师' : '教辅')+'的申请被拒绝', course_path(Course.find(ma.course_id)),
|
||||
'您申请成为班级"'+Course.find(ma.course_id).name+'"的'+(ma.content.include?('9') ? '教师' : '教辅')+'的申请被拒绝', course_path(Course.find(ma.course_id)),
|
||||
:class => "#{ma.viewed==0 ? "newsBlack" : "newsGrey"}", :target => '_blank' %>
|
||||
<!--:onmouseover => "message_titile_show($(this),event)",-->
|
||||
<!--:onmouseout => "message_titile_hide($(this))" %>-->
|
||||
|
|
|
@ -1,132 +1,3 @@
|
|||
<div class="syllabus_box" id="course-list">
|
||||
<h2 class="syllabus_h2_top"><span class="icon_course fl mt7 mr5"></span>课程列表</h2>
|
||||
<div class="syllabus_category">
|
||||
<span class="grayTxt fl">排序:</span>
|
||||
<%= link_to "时间", {:controller => 'users', :action => 'user_courselist', :id =>@user, :type => @type, :sort => @c_sort, :order => 1 }, :class => "sortTxt fl", :remote => true %>
|
||||
<% if @type.to_i == 1 %>
|
||||
<%= link_to "", {:controller => 'users', :action => 'user_courselist', :id =>@user, :type => @type, :sort => @c_sort, :order => 1 }, :class => "#{@c_sort.to_i == 1 ? 'sortupbtn' : 'sortdownbtn'} fl", :remote => true %>
|
||||
<% else %>
|
||||
<%= link_to "", {:controller => 'users', :action => 'user_courselist', :id =>@user, :type => @type, :sort => @c_sort, :order => 1 }, :class => "sortdownbtn sort_no fl", :remote => true %>
|
||||
<% end %>
|
||||
<%= link_to "人气", {:controller => 'users', :action => 'user_courselist', :id =>@user, :type => @type, :sort => @c_sort, :order => 2 }, :class => "sortTxt fl", :remote => true %>
|
||||
<% if @type.to_i == 2 %>
|
||||
<%= link_to "", {:controller => 'users', :action => 'user_courselist', :id =>@user, :type => @type, :sort => @c_sort, :order => 2 }, :class => "#{@c_sort.to_i == 1 ? 'sortupbtn' : 'sortdownbtn'} fl", :remote => true %>
|
||||
<% else %>
|
||||
<%= link_to "", {:controller => 'users', :action => 'user_courselist', :id =>@user, :type => @type, :sort => @c_sort, :order => 2 }, :class => "sortdownbtn sort_no fl", :remote => true %>
|
||||
<% end %>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
|
||||
<% if @syllabus.any? %>
|
||||
<% @syllabus.each_with_index do |syllabus, index|%>
|
||||
<div class="syllabus_courses_box">
|
||||
<% courses = @courses.where("syllabus_id = #{syllabus.id}").select("courses.*,(SELECT MAX(updated_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS updatetime").order("time desc") %>
|
||||
<div class="syllabus_courses_list">
|
||||
<div class="<%=index == 0 ? 'sy_courses_open' : 'sy_courses_close' %>">
|
||||
<span class="<%=index == 0 && !courses.empty? ? 'icons_sy_open' : 'icons_sy_close' %> fl mr5"></span>
|
||||
<h3 class="syllabus_courses_title fl"><%=syllabus.title %></h3>
|
||||
</div>
|
||||
<p class="fl sy_p_grey">更新时间:<%=format_date syllabus.updated_at %>
|
||||
<span class="mr10"></span>创建老师:<%=syllabus.user.show_name %>
|
||||
<span class="mr10"></span>班级:<%=courses.count %>
|
||||
</p>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
|
||||
<div class="syllabus_class_box <%=index == 0 ? '' : 'none' %>">
|
||||
<ul id="syllabus_course_ul_<%=syllabus.id %>">
|
||||
<% unless courses.nil? %>
|
||||
<% courses.each_with_index do |course, i| %>
|
||||
<li class="syllabus_class_list <%=i > 2 ? 'none' : '' %>">
|
||||
<a href="<%=course_path(course.id) %>" target="_blank">
|
||||
<span class="icons_sy_cir "></span>
|
||||
<div class="fl">
|
||||
<div class="syllabus_class_w ">
|
||||
<p class="syllabus_class_title fl"><%=course.name %></p>
|
||||
<span class="fr sy_p_grey hidden" style="max-width: 120px;">主讲老师:<%=course.teacher.show_name %></span>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<div class="">
|
||||
<p class="fl grayTxt ">更新:<%=format_date Time.at(course.updatetime) %><span class="mr10"></span>学期:<%=current_time_and_term(course) %></p>
|
||||
<p class="list-info fr grayTxt"><span><%=studentCount course %></span><span>学生</span><span>|</span><span><%=visable_course_homework course %></span><span>作业</span><span>|</span><span><%=visable_attachemnts_incourse(@course).count %></span><span>资源</span></p>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
</div>
|
||||
<span class="icons_sy_arrow fl mt19 ml10" ></span>
|
||||
<div class="cl"></div>
|
||||
</a>
|
||||
</li>
|
||||
<% end %>
|
||||
<% if courses.count > 3 %>
|
||||
<li class="syllabus_class_list_more" id="syllabus_class_list_more_<%=syllabus.id %>">
|
||||
<a href="javascript:void(0);" id="expand_list_<%=syllabus.id %>" data-init="0" onclick="expand_course_list(<%=syllabus.id %>,'#syllabus_course_ul_<%=syllabus.id %> li','#expand_list_<%=syllabus.id %>',<%=courses.count %>)">共<%=courses.count %>个班级,点击全部展开</a>
|
||||
</li>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div><!--syllabus_class_box end-->
|
||||
|
||||
<div class="homepagePostSetting">
|
||||
<ul>
|
||||
<li class="icons_sy_setting">
|
||||
<ul class="homepagePostSettiongText">
|
||||
<li>
|
||||
<%=link_to '查看课程', syllabus_path(syllabus.id), :class => 'postOptionLink',:target =>'_blank', :title => '查看课程' %>
|
||||
</li>
|
||||
<% if User.current == syllabus.user %>
|
||||
<li><%=link_to '删除课程', delete_syllabus_syllabus_path(syllabus), :class => 'postOptionLink', :remote => 'true'%></li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<div>
|
||||
<ul class="wlist" id="pages" >
|
||||
<%= pagination_links_full @atta_pages, @atta_count, :per_page_links => false, :remote => @is_remote, :flag => true %>
|
||||
</ul>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<% else %>
|
||||
<p class="nodata"><%= l(:label_no_data) %></p>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
//如果右边的列表比左边的高度低则将右边的高度设为与左边对齐
|
||||
$(function() {
|
||||
var leftHeight = $("#LSide").height() - $(".fontGrey5").height() - 20;
|
||||
var rightHeight = $(".homepageRight").height();
|
||||
if (rightHeight < leftHeight) {
|
||||
var diffHeight = leftHeight - rightHeight;
|
||||
var tmpHeight = $(".syllabus_box").height() + diffHeight;
|
||||
$(".syllabus_box").css("minHeight", tmpHeight);
|
||||
}
|
||||
|
||||
$(".syllabus_courses_list").each(function(){
|
||||
var syStaust = $(this).children(":first-child");
|
||||
var classNum = $(this).next().children().children("li").size();
|
||||
|
||||
if(classNum>0){
|
||||
if (syStaust.hasClass("sy_courses_open")){
|
||||
$(this).toggle(function(){
|
||||
$(this).next().hide();
|
||||
$(this).children(":first-child").children(":first-child").addClass("icons_sy_close").removeClass("icons_sy_open");
|
||||
},function(){
|
||||
$(this).next().show();
|
||||
$(this).children(":first-child").children(":first-child").addClass("icons_sy_open").removeClass("icons_sy_close");
|
||||
});
|
||||
}else{
|
||||
$(this).toggle(function(){
|
||||
$(this).next().show();
|
||||
$(this).children(":first-child").children(":first-child").addClass("icons_sy_open").removeClass("icons_sy_close");
|
||||
},function(){
|
||||
$(this).next().hide();
|
||||
$(this).children(":first-child").children(":first-child").addClass("icons_sy_close").removeClass("icons_sy_open");
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<div id="user_syllabus_list">
|
||||
<%= render :partial => "users/syllabus_course_list", :locals => {:syllabuses => @my_syllabuses, :list_type => 1} %>
|
||||
</div>
|
|
@ -5,11 +5,9 @@ $('#reply_div_<%= @user_activity_id %>').html('<%=escape_javascript(render :part
|
|||
<% elsif params[:type] == 'Message' %>
|
||||
$('#reply_div_<%= params[:div_id].to_i %>').html('<%=escape_javascript(render :partial => 'users/message_replies', :locals => {:comments => @journals,:user_activity_id => @user_activity_id, :type => @type, :activity_id => params[:id].to_i,:is_course => @is_course, :is_board => @is_board}) %>');
|
||||
<% elsif params[:type] == 'BlogComment' %>
|
||||
$('#reply_div_<%= params[:div_id].to_i %>').html('<%=escape_javascript(render :partial => 'users/message_replies', :locals => {:comments => @journals,:user_activity_id => @user_activity_id, :type => @type, :activity_id => params[:id].to_i, :homepage => @homepage}) %>');
|
||||
$('#reply_div_<%= params[:div_id].to_i %>').html('<%=escape_javascript(render :partial => 'users/message_replies', :locals => {:comments => @journals,:user_activity_id => @user_activity_id, :type => @type, :activity_id => params[:id].to_i, :homepage => @homepage, :user_id => @user_id}) %>');
|
||||
<% elsif params[:type] == 'OrgDocumentComment' %>
|
||||
$('#reply_div_<%= params[:div_id].to_i %>').html('<%=escape_javascript(render :partial => 'users/message_replies', :locals => {:comments => @journals, :user_activity_id => @user_activity_id, :type => @type, :activity_id => params[:id].to_i}) %>');
|
||||
<% elsif params[:type] == 'News' || params[:type] == 'Issue' %>
|
||||
<% elsif params[:type] == 'News' || params[:type] == 'Issue' || params[:type] == 'Syllabus' %>
|
||||
$('#reply_div_<%= params[:div_id].to_i %>').html('<%=escape_javascript(render :partial => 'users/news_replies', :locals => {:comments => @journals, :user_activity_id => @user_activity_id, :type => @type, :activity_id => params[:id].to_i}) %>');
|
||||
<% else %>
|
||||
$('#reply_div_<%= params[:div_id].to_i %>').html('<%=escape_javascript(render :partial => 'users/all_replies', :locals => {:comments => @journals}) %>');
|
||||
<% end %>
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
<% unless @courses.empty? %>
|
||||
$("#syllabus_course_ul_<%=@syllabus.id %>").html("<%=escape_javascript(render :partial => 'users/courses_list', :locals => {:courses => @courses, :syllabus => @syllabus}) %>");
|
||||
$("#syllabus_course_ul_<%=@syllabus.id %>").parent().show();
|
||||
$("#syllabus_course_ul_<%=@syllabus.id %>").parent().prev().children(":first-child").children(":first-child").toggleClass("icons_sy_close").toggleClass("icons_sy_open");
|
||||
<% end %>
|
|
@ -0,0 +1,5 @@
|
|||
<% if @list_type.to_i == 1 %>
|
||||
$("#user_syllabus_list").html('<%= escape_javascript(render :partial => "users/syllabus_course_list", :locals => {:syllabuses => @syllabuses, :list_type => 1}) %>');
|
||||
<% else %>
|
||||
$("#user_join_syllabus_list").html('<%= escape_javascript(render :partial => "users/syllabus_course_list", :locals => {:syllabuses => @syllabuses, :list_type => 2}) %>');
|
||||
<% end %>
|
|
@ -1 +1,35 @@
|
|||
<%= render :partial => 'users/user_syllabus_list'%>
|
||||
<div class="syllabus_box" id="course-list">
|
||||
<h2 class="syllabus_h2_top"><span class="icon_course fl mt7 mr5"></span>课程列表</h2>
|
||||
|
||||
<%= render :partial => 'users/user_syllabus_list'%>
|
||||
<div class="" style="height:20px; background:#eaebec;"></div>
|
||||
<%= render :partial => 'users/user_join_syllabus_list'%>
|
||||
</div>
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
//如果右边的列表比左边的高度低则将右边的高度设为与左边对齐
|
||||
$(function() {
|
||||
var leftHeight = $("#LSide").height() - $(".fontGrey5").height() - 20;
|
||||
var rightHeight = $(".homepageRight").height();
|
||||
if (rightHeight < leftHeight) {
|
||||
var diffHeight = leftHeight - rightHeight;
|
||||
var tmpHeight = $(".syllabus_box").height() + diffHeight;
|
||||
$(".syllabus_box").css("minHeight", tmpHeight);
|
||||
}
|
||||
});
|
||||
function expand_courses(id, count){
|
||||
var div = $("#syllabus_courses_list_"+id);
|
||||
var classNum = div.next().children().children("li").size();
|
||||
if(classNum>0){
|
||||
div.next().toggle();
|
||||
div.children(":first-child").children(":first-child").toggleClass("icons_sy_close").toggleClass("icons_sy_open");
|
||||
} else if(count > 0) {
|
||||
var str = div.next().children().eq(0).attr('id');
|
||||
var id = str.substring(19);
|
||||
$.get(
|
||||
'/users/expand_courses?syllabus_id=' + id
|
||||
);
|
||||
}
|
||||
}
|
||||
</script>
|
|
@ -1,6 +1,6 @@
|
|||
<% if @journal_destroyed.nil? %>
|
||||
alert('<%=l(:notice_failed_delete)%>');
|
||||
<% elsif (['Principal','Project','Course', 'Bid', 'Contest', 'Softapplication','HomeworkCommon'].include? @journal_destroyed.jour_type)%>
|
||||
<% elsif (['Principal','Project','Course', 'Bid', 'Contest', 'Softapplication','HomeworkCommon','Syllabus'].include? @journal_destroyed.jour_type)%>
|
||||
<% if @is_user%>
|
||||
<% if @activity %>
|
||||
$("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/user_journalsformessage', :locals => {:activity => @activity,:user_activity_id =>@user_activity_id}) %>");
|
||||
|
@ -18,12 +18,15 @@
|
|||
<% else %>
|
||||
<% if @bid && @jours_count %>
|
||||
$('#jours_count').html("<%= @jours_count %>");
|
||||
<% elsif @syllabus %>
|
||||
$("#reply_banner_<%=@syllabus.id %>").replaceWith("<%=escape_javascript(render :partial => 'users/reply_banner', :locals => {:count => @count, :activity => @syllabus, :user_activity_id => @syllabus.id}) %>");
|
||||
$("#reply_div_<%=@syllabus.id %>").html("<%=escape_javascript(render :partial => 'users/news_replies', :locals => {:comments => @comments, :type => 'Syllabus', :user_activity_id => @syllabus.id, :activity_id => @syllabus.id}) %>");
|
||||
<% elsif @course && @jours_count%>
|
||||
<% if @user_activity_id %>
|
||||
$("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/course_journalsformessage', :locals => {:activity => @activity,:user_activity_id =>@user_activity_id}) %>");
|
||||
sd_create_editor_from_data('<%= @user_activity_id%>', "", "100%", "UserActivity");
|
||||
<% else %>
|
||||
$('#course_jour_count').html("(<%= @jours_count %>)");
|
||||
$('#course_jour_count').html("<%= @jours_count %>");
|
||||
<% end %>
|
||||
<% elsif @user && @jours_count%>
|
||||
$('#jour_count').html("<%= @jours_count %>");
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
$("#reply_banner_<%=@syllabus.id %>").replaceWith("<%=escape_javascript(render :partial => 'users/reply_banner', :locals => {:count => @count, :activity => @syllabus, :user_activity_id => @syllabus.id}) %>");
|
||||
$("#reply_div_<%=@syllabus.id %>").html("<%=escape_javascript(render :partial => 'users/news_replies', :locals => {:comments => @comments, :type => 'Syllabus', :activity_id => @syllabus.id}) %>");
|
|
@ -48,6 +48,7 @@ zh:
|
|||
# 左边栏
|
||||
#
|
||||
label_project_id: "项目ID:"
|
||||
label_project_ivite_code: "邀请码:"
|
||||
|
||||
label_agree_join_project: 同意加入
|
||||
label_apply_project: "+申请加入"
|
||||
|
@ -55,7 +56,7 @@ zh:
|
|||
label_exit_project: 退出项目
|
||||
label_apply_project_waiting: 已处理申请,请等待管理员审核
|
||||
label_member_of_project: 该用户已经是项目成员了!
|
||||
label_unapply_project: 取消申请
|
||||
label_unapply_project: 等待审批
|
||||
lable_sure_exit_project: 是否确认退出该项目
|
||||
label_friend_organization: 圈子模式
|
||||
label_research_group: 研讨模式
|
||||
|
|
|
@ -388,7 +388,7 @@ zh:
|
|||
label_organization_name: 组织名称
|
||||
label_organization_list: 组织列表
|
||||
label_school_plural: 学校列表
|
||||
label_applied_shcools: 单位名称列表
|
||||
label_applied_shcools: 单位审核
|
||||
label_organization_new: 新建组织
|
||||
label_edit_organization: 编辑组织
|
||||
label_organization_edit: 修改组织
|
||||
|
|
|
@ -226,6 +226,9 @@ RedmineApp::Application.routes.draw do
|
|||
member do
|
||||
get 'upload_logo'
|
||||
post 'upload'
|
||||
get 'edit_apply_name'
|
||||
get 'edit_apply_address'
|
||||
get 'edit_apply_province'
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -563,6 +566,7 @@ RedmineApp::Application.routes.draw do
|
|||
post "user_commit_homework"
|
||||
post 'user_select_homework'
|
||||
get 'all_journals'
|
||||
get 'expand_courses'
|
||||
end
|
||||
|
||||
member do
|
||||
|
@ -619,6 +623,8 @@ RedmineApp::Application.routes.draw do
|
|||
match 'user_courselist', :to => 'users#user_courselist', :via => :get, :as => "user_courselist"
|
||||
match 'user_projectlist', :to => 'users#user_projectlist', :via => :get, :as => "user_projectlist"
|
||||
|
||||
match 'sort_syllabus_list', :to => 'users#sort_syllabus_list', :via => :get, :as => "sort_syllabus_list"
|
||||
|
||||
get 'edit_brief_introduction'
|
||||
get "user_resource"
|
||||
get "import_resources"
|
||||
|
@ -721,8 +727,9 @@ RedmineApp::Application.routes.draw do
|
|||
post 'issues/:object_id/watchers', :to => 'watchers#create', :object_type => 'issue'
|
||||
delete 'issues/:object_id/watchers/:user_id' => 'watchers#destroy', :object_type => 'issue'
|
||||
|
||||
post 'appliedproject/applied', :to => 'applied_project#applied_join_project', :as => 'appliedproject'
|
||||
delete 'appliedproject/applied', :to => 'applied_project#unapplied_join_project'
|
||||
post 'applied_project/applied_join', :to => 'applied_project#applied_join_project', :as => 'applied_join_project'
|
||||
post 'applied_project/applied_project_info', :to => 'applied_project#applied_project_info', :as => 'applied_project_info'
|
||||
delete 'applied_project/applied', :to => 'applied_project#unapplied_join_project', :as => 'unapplied_join_project'
|
||||
|
||||
resources :projects do
|
||||
member do
|
||||
|
@ -766,6 +773,8 @@ RedmineApp::Application.routes.draw do
|
|||
collection do
|
||||
get 'autocomplete'
|
||||
get 'appliedproject'
|
||||
post 'allow_to_join_project'
|
||||
get 'refused_allow_to_join_project'
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -1074,6 +1083,7 @@ RedmineApp::Application.routes.draw do
|
|||
get 'admin/approve_applied_schools'
|
||||
post 'admin/edit_applied_schools'
|
||||
get 'admin/all_schools'
|
||||
get 'admin/apply_shcool_sort', as: :apply_shcool_sort
|
||||
delete 'admin/delete_applied_schools'
|
||||
|
||||
get 'admin/leave_messages'
|
||||
|
@ -1155,9 +1165,12 @@ RedmineApp::Application.routes.draw do
|
|||
get "homework_search"
|
||||
get "show_comparecode"
|
||||
get "statistics_course"
|
||||
get "switch_role"
|
||||
end
|
||||
collection do
|
||||
match 'join_private_courses', :via => [:get, :post]
|
||||
post "join_course_multi_role"
|
||||
|
||||
end
|
||||
|
||||
match '/member', :to => 'courses#member', :as => 'member', :via => :get
|
||||
|
@ -1239,6 +1252,7 @@ RedmineApp::Application.routes.draw do
|
|||
post 'words/:id/leave_syllabus_message', :to => 'words#leave_syllabus_message', :as => "leave_syllabus_message"
|
||||
post 'words/:id/leave_homework_message', :to => 'words#leave_homework_message', :as => "leave_homework_message"
|
||||
post 'words/:id/reply_to_homework', :to => 'words#reply_to_homework', :as => "reply_to_homework"
|
||||
post 'words/:id/reply_to_syllabus', :to => 'words#reply_to_syllabus', :as => "reply_to_syllabus"
|
||||
|
||||
post 'join_in/join', :to => 'courses#join', :as => 'join'
|
||||
delete 'join_in/join', :to => 'courses#unjoin'
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
class AddInviteCodeToProject < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :projects, :invite_code, :string
|
||||
end
|
||||
end
|
|
@ -0,0 +1,5 @@
|
|||
class AddColumnToMemberRole < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :member_roles, :is_current, :integer, :default => 1
|
||||
end
|
||||
end
|
|
@ -0,0 +1,5 @@
|
|||
class AddQrcodeToProject < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :projects, :qrcode, :string
|
||||
end
|
||||
end
|
|
@ -0,0 +1,5 @@
|
|||
class AddRoleToAppliedProject < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :applied_projects, :role, :integer, :default => 0
|
||||
end
|
||||
end
|
|
@ -0,0 +1,5 @@
|
|||
class AddAppliedUserIdToAppliedMessage < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :applied_messages, :applied_user_id, :integer
|
||||
end
|
||||
end
|
|
@ -0,0 +1,5 @@
|
|||
class AddRoleToAppliedMessage < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :applied_messages, :role, :integer
|
||||
end
|
||||
end
|
|
@ -0,0 +1,5 @@
|
|||
class AddProjectIdToAppliedMessage < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :applied_messages, :project_id, :integer
|
||||
end
|
||||
end
|
4600
db/schema.rb
4600
db/schema.rb
File diff suppressed because it is too large
Load Diff
|
@ -1,14 +1,14 @@
|
|||
<div class="post-container">
|
||||
<div loading-spinner></div>
|
||||
|
||||
<div class="blue-title">新建课程</div>
|
||||
<form novalidate name="classForm">
|
||||
<div class="course-list-row f13 c-grey3 mt30"><span class="fl ml15 c-grey3">课程名称</span><input class="new-class-input ml25" ng-model="syllabus.title" required placeholder="如:软件工程" /></div>
|
||||
|
||||
<div class="course-list-row f13 c-grey3 mt10" ng-repeat="course in syllabus.courses"><span class="fl ml15 c-grey3">班级名称</span><input required class="new-class-input ml25" ng-model="course.name" placeholder="如:软件工程计算机学院A班" /><a ng-click="deleteClass($index)" ng-show="!$first" class="fr mr10 c-grey6 delete-class-link">删除</a></div>
|
||||
<div class="tac"><a ng-click="addClass()" class="link-blue2 f13 mt15 inline-block add-class-link">+新增班级</a></div>
|
||||
<a ng-click="newClass(classForm, syllabus)" ng-class="['finish-btn', {'btn-disabled':!classForm.$valid} ]" >完成</a>
|
||||
</form>
|
||||
|
||||
<my-alert message="alertService.message" title="alertService.title" visible="alertService.visible" cb="alertService.cb"></my-alert>
|
||||
</div>
|
||||
<div class="post-container">
|
||||
<div loading-spinner></div>
|
||||
|
||||
<div class="blue-title">新建课程</div>
|
||||
<form novalidate name="classForm">
|
||||
<div class="course-list-row f13 c-grey3 mt30"><span class="fl ml15 c-grey3">课程名称</span><input class="new-class-input ml25" ng-model="syllabus.title" required placeholder="如:软件工程" /></div>
|
||||
|
||||
<div class="course-list-row f13 c-grey3 mt10" ng-repeat="course in syllabus.courses"><span class="fl ml15 c-grey3">班级名称</span><input required class="new-class-input ml25" ng-model="course.name" placeholder="如:软件工程计算机学院A班" /><a ng-click="deleteClass($index)" ng-show="!$first" class="fr mr10 c-grey6 delete-class-link">删除</a></div>
|
||||
<div class="tac"><a ng-click="addClass()" class="link-blue2 f13 mt15 inline-block add-class-link">+新增班级</a></div>
|
||||
<a ng-click="newClass(classForm, syllabus)" ng-class="['finish-btn', {'btn-disabled':!classForm.$valid} ]" >完成</a>
|
||||
</form>
|
||||
|
||||
<my-alert message="alertService.message" title="alertService.title" visible="alertService.visible" cb="alertService.cb"></my-alert>
|
||||
</div>
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 25 KiB After Width: | Height: | Size: 27 KiB |
Binary file not shown.
After Width: | Height: | Size: 18 KiB |
Binary file not shown.
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 22 KiB |
|
@ -1492,6 +1492,25 @@ function pop_up_box(value,tWidth,tTop,tLeft){
|
|||
}
|
||||
}
|
||||
|
||||
// 公共弹框样式
|
||||
function pop_box_new(value, Width, Top, Left){
|
||||
$("#ajax-modal").html(value);
|
||||
showModal('ajax-modal', Width + 'px');
|
||||
$('#ajax-modal').siblings().remove();
|
||||
$('#ajax-modal').parent().css({"top": Top+"%","left": Left+"%","transform":"translate(-50%,-50%)","padding":"0","border":"none"});
|
||||
$('#ajax-modal').css({"padding":"0"});
|
||||
|
||||
}
|
||||
|
||||
// 公共提示弹框样式
|
||||
//function pop_box_tip_new(value, Width, Top, Left){
|
||||
// $("#ajax-modal").html(value);
|
||||
// showModal('ajax-modal', Width + 'px');
|
||||
// $('#ajax-modal').siblings().remove();
|
||||
// $('#ajax-modal').parent().css({"top": Top+"%","left": Left+"%","transform":"translate(-50%,-50%)","padding":"0","border":"none"});
|
||||
// $('#ajax-modal').css({"padding":"0"});
|
||||
//}
|
||||
|
||||
//显示的时候根据当前网址是http 还是https 选择视频显示方式直接显示还是弹框
|
||||
function autoMedia(id){
|
||||
var rootPath = getRootPath();
|
||||
|
@ -1880,3 +1899,124 @@ function updateCourseName(){
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
function edit_school_name(url,id){
|
||||
if($("#school_name_edit_"+id).val() == ""){
|
||||
$("#apply_title_"+id).show();
|
||||
$("#school_name_edit_"+id).hide();
|
||||
return;
|
||||
}
|
||||
$.get(
|
||||
url,
|
||||
{id: id ,name: $("#school_name_edit_"+id).val() },
|
||||
function (data) {
|
||||
if(data.status == 0){
|
||||
$("#apply_title_"+data.id).show();
|
||||
$("#school_name_edit_"+data.id).hide();
|
||||
$("#apply_title_"+data.id).text(data.name);
|
||||
}
|
||||
else{
|
||||
$("#apply_title_"+data.id).show();
|
||||
$("#school_name_edit_"+data.id).hide();
|
||||
}
|
||||
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
function show_edit_school_name(id){
|
||||
$("#apply_title_"+id).hide();
|
||||
$("#school_name_edit_"+id).val($("#apply_title_"+id).text());
|
||||
$("#school_name_edit_"+id).show();
|
||||
$("#school_name_edit_"+id).focus();
|
||||
|
||||
|
||||
}
|
||||
|
||||
function edit_school_address(url,id){
|
||||
if($("#school_address_edit_"+id).val() == ""){
|
||||
$("#apply_address_"+id).show();
|
||||
$("#school_address_edit_"+id).hide();
|
||||
return;
|
||||
}
|
||||
$.get(
|
||||
url,
|
||||
{id: id ,address: $("#school_address_edit_"+id).val() },
|
||||
function (data) {
|
||||
if(data.status == 0){
|
||||
$("#apply_address_"+data.id).show();
|
||||
$("#school_address_edit_"+data.id).hide();
|
||||
$("#apply_address_"+data.id).text(data.address);
|
||||
}
|
||||
else{
|
||||
$("#apply_address_"+data.id).show();
|
||||
$("#school_address_edit_"+data.id).hide();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
function show_edit_school_address(id){
|
||||
$("#apply_address_"+id).hide();
|
||||
$("#school_address_edit_"+id).val($("#apply_address_"+id).text());
|
||||
$("#school_address_edit_"+id).show();
|
||||
$("#school_address_edit_"+id).focus();
|
||||
}
|
||||
|
||||
function edit_school_province(url,id){
|
||||
|
||||
var province = $("#school_province_edit_"+id).val();
|
||||
var city = $("#schoolCity_"+id).val();
|
||||
|
||||
if((province == "")||(city == "")){
|
||||
$("#apply_province_"+id).show();
|
||||
$("#school_province_edit_"+id).hide();
|
||||
$("#schoolCity_"+id).hide();
|
||||
return;
|
||||
}
|
||||
|
||||
$.get(
|
||||
url,
|
||||
{id: id ,province: province,city:city },
|
||||
function (data) {
|
||||
if(data.status == 0){
|
||||
$("#apply_province_"+data.id).show();
|
||||
$("#school_province_edit_"+data.id).hide();
|
||||
$("#schoolCity_"+data.id).hide();
|
||||
init_province_and_city(document.getElementById('school_province_edit_'+data.id), data.province, document.getElementById('schoolCity_'+data.id), data.city);
|
||||
$("#apply_province_"+data.id).text(data.province+data.city);
|
||||
|
||||
}
|
||||
else{
|
||||
$("#apply_province_"+data.id).show();
|
||||
$("#school_province_edit_"+data.id).hide();
|
||||
$("#schoolCity_"+data.id).hide();
|
||||
}
|
||||
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
function init_province_and_city(pField, province, cField, city) {
|
||||
for (var i = 0; i < pField.options.length; i++) {
|
||||
if (pField.options[i].value == province) {
|
||||
pField.selectedIndex = i;
|
||||
}
|
||||
}
|
||||
showcity(province, cField);
|
||||
for (var i = 0; i < cField.options.length; i++) {
|
||||
if (cField.options[i].value == city) {
|
||||
cField.selectedIndex = i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function show_edit_school_province(id){
|
||||
$("#apply_province_"+id).hide();
|
||||
$("#school_province_edit_"+id).show();
|
||||
$("#schoolCity_"+id).show();
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -1,18 +1,18 @@
|
|||
/**
|
||||
* Created by guange on 16/6/22.
|
||||
*/
|
||||
|
||||
|
||||
app.controller('InviteCodeController', ['$scope','$http', '$routeParams','config','auth', function($scope, $http, $routeParams, config, auth){
|
||||
var vm = $scope;
|
||||
|
||||
vm.course = {};
|
||||
var courseid = $routeParams.id;
|
||||
$http.get(config.apiUrl+ 'courses/'+courseid+"?token="+auth.token()).then(
|
||||
function(response){
|
||||
console.log(response.data);
|
||||
vm.course = response.data.data;
|
||||
}
|
||||
);
|
||||
|
||||
}]);
|
||||
/**
|
||||
* Created by guange on 16/6/22.
|
||||
*/
|
||||
|
||||
|
||||
app.controller('InviteCodeController', ['$scope','$http', '$routeParams','config','auth', function($scope, $http, $routeParams, config, auth){
|
||||
var vm = $scope;
|
||||
|
||||
vm.course = {};
|
||||
var courseid = $routeParams.id;
|
||||
$http.get(config.apiUrl+ 'courses/'+courseid+"?token="+auth.token()).then(
|
||||
function(response){
|
||||
console.log(response.data);
|
||||
vm.course = response.data.data;
|
||||
}
|
||||
);
|
||||
|
||||
}]);
|
||||
|
|
|
@ -1281,6 +1281,9 @@ a, a:link, a:visited{ color: #169; text-decoration: none; }
|
|||
a:hover, a:active{ color: #c61a1a; text-decoration: underline;}
|
||||
a img{ border: 0; }
|
||||
|
||||
a.application-default-link {color: #169 !important; text-decoration: none;}
|
||||
a.application-default-link:hover {color: #c61a1a !important; text-decoration: underline;}
|
||||
|
||||
a.issue.closed, a.issue.closed:link, a.issue.closed:visited { color: #999; text-decoration: line-through; }
|
||||
a.project.closed, a.project.closed:link, a.project.closed:visited { color: #999; }
|
||||
a.user.locked, a.user.locked:link, a.user.locked:visited {color: #999;}
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue