Merge branch 'develop' into rep_quality
Conflicts: app/models/applied_message.rb db/schema.rb
This commit is contained in:
commit
847cae6d41
|
@ -1 +0,0 @@
|
|||
{"access_token":"b_Pc60Dd5eyg_ut3cHbsjQO9EJJdj2Qj5F99o9LH9ltKSme7_FZ3Of22lWLL-K2V0siWzv-bd9PO0Dn-L1PBvIy9LhXa0qPVaFl6vTtZHR2kA8qjo1ps2ancya0t7KmzURGbAFAAXM","expires_in":7200,"got_token_at":1467976842}
|
|
@ -36,3 +36,4 @@ public/javascripts/wechat/node_modules/
|
|||
.ruby-version
|
||||
.access_token
|
||||
tmux*.log
|
||||
config/wechat.yml
|
||||
|
|
2
Gemfile
2
Gemfile
|
@ -49,6 +49,8 @@ gem 'kaminari'
|
|||
gem 'elasticsearch-model'
|
||||
gem 'elasticsearch-rails'
|
||||
|
||||
#rails 3.2.22.2 bug
|
||||
gem "test-unit", "~>3.0"
|
||||
|
||||
### profile
|
||||
# gem 'oneapm_rpm'
|
||||
|
|
|
@ -20,13 +20,14 @@ module Mobile
|
|||
require_relative 'apis/praise'
|
||||
require_relative 'apis/resources'
|
||||
require_relative 'apis/syllabuses'
|
||||
require_relative 'apis/projects'
|
||||
|
||||
class API < Grape::API
|
||||
version 'v1', using: :path
|
||||
format :json
|
||||
content_type :json, "application/json;charset=UTF-8"
|
||||
use ActionDispatch::Session::CookieStore
|
||||
use Mobile::Middleware::ErrorHandler
|
||||
use Middleware::ErrorHandler
|
||||
|
||||
helpers do
|
||||
def logger
|
||||
|
@ -42,9 +43,9 @@ module Mobile
|
|||
end
|
||||
|
||||
def current_user
|
||||
openid = params[:openid]
|
||||
openid = session[:wechat_openid]
|
||||
if openid
|
||||
uw = UserWechat.find_by_openid(params[:openid])
|
||||
uw = UserWechat.find_by_openid(openid)
|
||||
return uw.user if uw
|
||||
end
|
||||
|
||||
|
@ -75,6 +76,7 @@ module Mobile
|
|||
mount Apis::Praise
|
||||
mount Apis::Resources
|
||||
mount Apis::Syllabuses
|
||||
mount Apis::Projects
|
||||
|
||||
add_swagger_documentation ({api_version: 'v1', base_path: '/api'}) if Rails.env.development?
|
||||
|
||||
|
|
|
@ -419,6 +419,53 @@ module Mobile
|
|||
|
||||
end
|
||||
|
||||
desc "获取班级某成员角色信息"
|
||||
params do
|
||||
requires :id, type: Integer
|
||||
requires :token, type: String
|
||||
requires :user_id, type: Integer
|
||||
end
|
||||
post 'get_member_info' do
|
||||
authenticate!
|
||||
|
||||
c = Course.find("#{params[:id]}")
|
||||
|
||||
my_member = c.member_principals.where("users.id=#{params[:user_id]}").first
|
||||
|
||||
if my_member && my_member.roles[0]
|
||||
present :course_id,params[:id]
|
||||
present :user_id,params[:user_id]
|
||||
present :member_info,my_member, with: Mobile::Entities::ProjectMember
|
||||
present :status, 0
|
||||
else
|
||||
present :status, -1
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
desc "修改班级某成员角色信息"
|
||||
params do
|
||||
requires :id, type: Integer
|
||||
requires :token, type: String
|
||||
requires :user_id, type: Integer
|
||||
requires :role_id, type: Integer
|
||||
end
|
||||
post 'edit_member_role' do
|
||||
authenticate!
|
||||
|
||||
c = Course.find("#{params[:id]}")
|
||||
|
||||
#7教辅 9教师 10学生
|
||||
if c.tea_id == params[:user_id] || c.tea_id != current_user.id || !(params[:role_id] == 7 || params[:role_id] == 9 || params[:role_id] == 10)
|
||||
present :status, -1
|
||||
else
|
||||
|
||||
cs = CoursesService.new
|
||||
status = cs.modify_user_course_role params
|
||||
present :status, status
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -0,0 +1,181 @@
|
|||
#coding=utf-8
|
||||
|
||||
module Mobile
|
||||
module Apis
|
||||
class Projects < Grape::API
|
||||
|
||||
resources :projects do
|
||||
desc "获取项目列表"
|
||||
params do
|
||||
requires :token, type: String
|
||||
end
|
||||
get do
|
||||
authenticate!
|
||||
|
||||
ps = ProjectsService.new
|
||||
projects = ps.user_projects(current_user)
|
||||
present :data, projects, with: Mobile::Entities::Project,user: current_user
|
||||
present :status, 0
|
||||
end
|
||||
|
||||
desc "返回单个项目"
|
||||
params do
|
||||
requires :id, type: Integer
|
||||
requires :token,type:String
|
||||
end
|
||||
route_param :id do
|
||||
get do
|
||||
# course = Course.find(params[:id])
|
||||
ps = ProjectsService.new
|
||||
project = ps.show_project(params,current_user)
|
||||
|
||||
if project[:status] == 9
|
||||
{status:-1, message: '该项目不存在或已被删除啦' }
|
||||
else
|
||||
present :data, project, with: Mobile::Entities::Project,user: current_user
|
||||
present :status, 0
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
desc "获取项目动态"
|
||||
params do
|
||||
requires :id, type: Integer
|
||||
requires :token, type: String
|
||||
end
|
||||
post 'activities' do
|
||||
authenticate!
|
||||
|
||||
user = current_user
|
||||
|
||||
project_types = "('Message','Issue','Project')"
|
||||
activities = UserActivity.where("(container_type = 'Project' and container_id = #{params[:id]} and act_type in #{project_types})").order('updated_at desc')
|
||||
|
||||
page = params[:page] ? params[:page] : 0
|
||||
all_count = activities.count
|
||||
activities = activities.limit(10).offset(page * 10)
|
||||
count = activities.count
|
||||
present :data, activities, with: Mobile::Entities::Activity,user: user
|
||||
present :all_count, all_count
|
||||
present :count, count
|
||||
present :page, page
|
||||
present :status, 0
|
||||
end
|
||||
|
||||
desc "获取项目成员"
|
||||
params do
|
||||
requires :id, type: Integer
|
||||
requires :token, type: String
|
||||
end
|
||||
post 'members' do
|
||||
authenticate!
|
||||
|
||||
project = Project.find("#{params[:id]}")
|
||||
members = project.member_principals
|
||||
|
||||
master_members = project.member_principals.includes(:roles, :principal).where("member_roles.role_id=3").all.sort
|
||||
|
||||
master_members.each do |m|
|
||||
if m.user_id == project.user_id
|
||||
master_members.delete(m)
|
||||
master_members.insert(0,m)
|
||||
break
|
||||
end
|
||||
end
|
||||
|
||||
develop_members = project.member_principals.includes(:roles, :principal).where("member_roles.role_id=4").all.sort
|
||||
report_members = project.member_principals.includes(:roles, :principal).where("member_roles.role_id=5").all.sort
|
||||
|
||||
present :master_members,master_members, with: Mobile::Entities::ProjectMember
|
||||
present :develop_members,develop_members, with: Mobile::Entities::ProjectMember
|
||||
present :report_members,report_members, with: Mobile::Entities::ProjectMember
|
||||
present :status, 0
|
||||
end
|
||||
|
||||
desc "获取项目某成员角色信息"
|
||||
params do
|
||||
requires :id, type: Integer
|
||||
requires :token, type: String
|
||||
requires :user_id, type: Integer
|
||||
end
|
||||
post 'get_member_info' do
|
||||
authenticate!
|
||||
|
||||
project = Project.find("#{params[:id]}")
|
||||
|
||||
my_member = project.member_principals.where("users.id=#{params[:user_id]}").first
|
||||
|
||||
if my_member && my_member.roles[0]
|
||||
present :project_id,params[:id]
|
||||
present :user_id,params[:user_id]
|
||||
present :member_info,my_member, with: Mobile::Entities::ProjectMember
|
||||
present :status, 0
|
||||
else
|
||||
present :status, -1
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
desc "修改项目某成员角色信息"
|
||||
params do
|
||||
requires :id, type: Integer
|
||||
requires :token, type: String
|
||||
requires :user_id, type: Integer
|
||||
requires :role_id, type: Integer
|
||||
end
|
||||
post 'edit_member_role' do
|
||||
authenticate!
|
||||
|
||||
project = Project.find("#{params[:id]}")
|
||||
|
||||
my_member = project.member_principals.where("users.id=#{current_user.id}").first
|
||||
|
||||
#3管理 4开发 5报告
|
||||
if !(my_member && my_member.roles[0] && my_member.roles[0].id == 3 ) || project.user_id == params[:user_id] || !(params[:role_id] == 3 || params[:role_id] == 4 || params[:role_id] == 5)
|
||||
present :status, -1
|
||||
else
|
||||
ps = ProjectsService.new
|
||||
|
||||
status = ps.modify_user_project_role params
|
||||
|
||||
present :status, status
|
||||
end
|
||||
end
|
||||
|
||||
desc "新建项目"
|
||||
params do
|
||||
requires :token, type: String
|
||||
requires :name, type: String, desc: '项目名称'
|
||||
end
|
||||
post 'create' do
|
||||
authenticate!
|
||||
|
||||
ps = ProjectsService.new
|
||||
|
||||
status = ps.createNewProject params,current_user
|
||||
|
||||
|
||||
present :status, 0
|
||||
|
||||
end
|
||||
|
||||
desc "加入项目"
|
||||
params do
|
||||
requires :token, type: String
|
||||
requires :invite_code, type: String, desc: '邀请码'
|
||||
end
|
||||
post "join" do
|
||||
authenticate!
|
||||
|
||||
# ps = ProjectsService.new
|
||||
# status = ps.join_project({role: "5", openid: params[:openid], invite_code: params[:invite_code]}, current_user)
|
||||
#
|
||||
# present :status, status
|
||||
|
||||
{status:-1, message: '该功能将在近日开放,敬请期待!' }
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -42,7 +42,7 @@ module Mobile
|
|||
user: user
|
||||
)
|
||||
ws = WechatService.new
|
||||
ws.binding_succ_notice(user.id, "您已成功绑定Trustie平台", user.login, Time.now.strftime("%Y-%m-%d"))
|
||||
ws.binding_succ_notice(user.id, "您已成功绑定Trustie平台。", user.login, Time.now.strftime("%Y-%m-%d"))
|
||||
present status: 0, message: '您已成功绑定Trustie平台'
|
||||
end
|
||||
|
||||
|
@ -68,7 +68,7 @@ module Mobile
|
|||
user: user
|
||||
)
|
||||
ws = WechatService.new
|
||||
ws.binding_succ_notice(user.id, "您已成功绑定Trustie平台", user.login, Time.now.strftime("%Y-%m-%d"))
|
||||
ws.binding_succ_notice(user.id, "您已成功绑定Trustie平台。", user.login, Time.now.strftime("%Y-%m-%d"))
|
||||
present :data, user, with: Mobile::Entities::User
|
||||
present :status, 0
|
||||
end
|
||||
|
|
|
@ -13,8 +13,14 @@ module Mobile
|
|||
#0一级回复的更多 1 二级回复的更多
|
||||
type = params[:type] || 0
|
||||
page = params[:page] || 0
|
||||
homework = HomeworkCommon.find params[:id]
|
||||
present :data, homework, with: Mobile::Entities::Whomework,user: user,type: type,page: page
|
||||
|
||||
if type == 0
|
||||
homework = HomeworkCommon.find params[:id]
|
||||
present :data, homework, with: Mobile::Entities::Whomework,user: user,type: type,page: page,comment_type: "homework"
|
||||
else
|
||||
jour = JournalsForMessage.find params[:id]
|
||||
present :data, jour, with: Mobile::Entities::Jours,user: user,type: type,page: page,comment_type: "homework"
|
||||
end
|
||||
present :type, type
|
||||
present :page, page
|
||||
present :status, 0
|
||||
|
|
|
@ -51,9 +51,8 @@ module Mobile
|
|||
blog_comment_expose :id
|
||||
blog_comment_expose :locked
|
||||
blog_comment_expose :praise_count
|
||||
expose :blog_comment_children, using:Mobile::Entities::BlogComment do |c,opt|
|
||||
expose :all_children, using:Mobile::Entities::BlogComment do |c,opt|
|
||||
if c.is_a? (::BlogComment)
|
||||
##自己的父回复为空 才有子回复
|
||||
if !opt[:children]
|
||||
if c.parent.nil? && opt[:type] == 0
|
||||
opt[:children] = true
|
||||
|
@ -86,7 +85,7 @@ module Mobile
|
|||
#取二级回复的底楼层
|
||||
parents_reply = []
|
||||
parents_reply = get_reply_parents_no_root(parents_reply, c)
|
||||
if parents_reply.count > 0 && !opt[:bottom]
|
||||
if parents_reply.count > 0 && parents_reply.count != 2 && !opt[:bottom]
|
||||
if opt[:type] == 1
|
||||
# opt[:bottom] = true
|
||||
# parents_reply[opt[:page]..opt[:page]]
|
||||
|
@ -105,7 +104,7 @@ module Mobile
|
|||
#取二级回复的顶楼层
|
||||
parents_reply = []
|
||||
parents_reply = get_reply_parents_no_root(parents_reply, c)
|
||||
if parents_reply.count > 0 && !opt[:top]
|
||||
if parents_reply.count >= 2 && !opt[:top]
|
||||
if opt[:type] == 1
|
||||
opt[:bottom] = true
|
||||
tStart = (opt[:page]-1)*5+2
|
||||
|
|
|
@ -86,6 +86,15 @@ module Mobile
|
|||
expose :my_homework,using: Mobile::Entities::Homework do |f, opt|
|
||||
f[:my_homework] if f.is_a?(Hash) && f.key?(:my_homework)
|
||||
end
|
||||
expose :is_creator, if: lambda { |instance, options| options[:user] } do |instance, options|
|
||||
if instance[:course]
|
||||
course = instance[:course]
|
||||
else
|
||||
course = instance
|
||||
end
|
||||
current_user = options[:user]
|
||||
course.tea_id == current_user.id
|
||||
end
|
||||
course_expose :current_user_is_member
|
||||
course_expose :current_user_is_teacher
|
||||
course_expose :work_unit
|
||||
|
|
|
@ -22,10 +22,10 @@ module Mobile
|
|||
(get_user(issue.assigned_to_id)).login
|
||||
when :issue_status
|
||||
IssueStatus.find(issue.status_id).name
|
||||
when :journals_count
|
||||
# issue.journals.where("notes is not null and notes != ''").count
|
||||
all_comments = []
|
||||
get_all_children(all_comments, f).count
|
||||
when :comment_count
|
||||
issue.journals.where("notes is not null and notes != ''").count
|
||||
# all_comments = []
|
||||
# get_all_children(all_comments, f).count
|
||||
when :project_name
|
||||
issue.project.name
|
||||
when :praise_count
|
||||
|
@ -49,7 +49,7 @@ module Mobile
|
|||
issue_expose :issue_priority
|
||||
issue_expose :issue_assigned_to
|
||||
issue_expose :issue_status
|
||||
issue_expose :journals_count
|
||||
issue_expose :comment_count
|
||||
issue_expose :project_name
|
||||
issue_expose :praise_count
|
||||
expose :issue_journals, using: Mobile::Entities::Journal do |f, opt|
|
||||
|
|
|
@ -17,7 +17,7 @@ module Mobile
|
|||
case field
|
||||
when :lasted_comment
|
||||
time_from_now f.created_on
|
||||
when :reply_count
|
||||
when :comment_count
|
||||
# f.children.count
|
||||
all_comments = []
|
||||
get_all_children(all_comments, f).count
|
||||
|
@ -27,6 +27,8 @@ module Mobile
|
|||
'JournalsForMessage'
|
||||
when :act_id
|
||||
f.id
|
||||
when :content
|
||||
f.notes
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -42,10 +44,10 @@ module Mobile
|
|||
end
|
||||
jours_expose :created_on
|
||||
jours_expose :lasted_comment
|
||||
jours_expose :notes
|
||||
jours_expose :content
|
||||
jours_expose :m_reply_id
|
||||
jours_expose :m_parent_id
|
||||
jours_expose :reply_count
|
||||
jours_expose :comment_count
|
||||
jours_expose :praise_count
|
||||
expose :course,using:Mobile::Entities::Course do |f,opt|
|
||||
if f.is_a?(::JournalsForMessage) && f[:jour_type] == "Course"
|
||||
|
@ -55,9 +57,20 @@ module Mobile
|
|||
expose :reply_user,using: Mobile::Entities::User do |f, opt|
|
||||
f.at_user
|
||||
end
|
||||
expose :child_reply,using: Mobile::Entities::Jours do |f, opt|
|
||||
expose :all_children,using: Mobile::Entities::Jours do |f, opt|
|
||||
if f.is_a?(::JournalsForMessage)
|
||||
f.children.reverse
|
||||
# f.children.reverse
|
||||
if !opt[:children] && opt[:comment_type].nil?
|
||||
if f.parent.nil? && opt[:type] == 0
|
||||
opt[:children] = true
|
||||
all_comments = []
|
||||
tStart = opt[:page]*5
|
||||
tEnd = (opt[:page]+1)*5 - 1
|
||||
|
||||
all_comments = get_all_children(all_comments, f)[tStart..tEnd]
|
||||
all_comments
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
expose :has_praise , if: lambda { |instance, options| options[:user] } do |instance, options|
|
||||
|
@ -67,6 +80,78 @@ module Mobile
|
|||
has_praise = obj.empty? ? false : true
|
||||
has_praise
|
||||
end
|
||||
|
||||
expose :parents_count, if: lambda { |instance, options| options[:user] } do |instance, options|
|
||||
parents_reply = []
|
||||
|
||||
if options[:comment_type].nil?
|
||||
parents_reply = get_reply_parents_no_root(parents_reply, instance)
|
||||
elsif options[:comment_type] == "homework"
|
||||
parents_reply = get_reply_parents(parents_reply, instance)
|
||||
end
|
||||
parents_reply.count
|
||||
end
|
||||
|
||||
expose :parents_reply_bottom, using:Mobile::Entities::Jours do |f,opt|
|
||||
if f.is_a? (::JournalsForMessage)
|
||||
#取二级回复的底楼层
|
||||
parents_reply = []
|
||||
if opt[:comment_type].nil?
|
||||
parents_reply = get_reply_parents_no_root(parents_reply, f)
|
||||
elsif opt[:comment_type] == "homework"
|
||||
parents_reply = get_reply_parents(parents_reply, f)
|
||||
end
|
||||
if parents_reply.count > 0 && parents_reply.count != 2 && !opt[:bottom]
|
||||
if opt[:type] == 1
|
||||
# opt[:bottom] = true
|
||||
# parents_reply[opt[:page]..opt[:page]]
|
||||
else
|
||||
opt[:bottom] = true
|
||||
parents_reply[0..0]
|
||||
end
|
||||
else
|
||||
[]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
expose :parents_reply_top, using:Mobile::Entities::Jours do |f,opt|
|
||||
if f.is_a? (::JournalsForMessage)
|
||||
#取二级回复的顶楼层
|
||||
parents_reply = []
|
||||
|
||||
if opt[:comment_type].nil?
|
||||
parents_reply = get_reply_parents_no_root(parents_reply, f)
|
||||
elsif opt[:comment_type] == "homework"
|
||||
parents_reply = get_reply_parents(parents_reply, f)
|
||||
end
|
||||
if parents_reply.count >= 2 && !opt[:top]
|
||||
if opt[:type] == 1
|
||||
opt[:bottom] = true
|
||||
tStart = (opt[:page]-1)*5+2
|
||||
tEnd = (opt[:page])*5+2 - 1
|
||||
|
||||
if tEnd >= parents_reply.count - 1
|
||||
tEnd = parents_reply.count - 2
|
||||
end
|
||||
|
||||
if tStart <= parents_reply.count - 2
|
||||
parents_reply = parents_reply.reverse[tStart..tEnd]
|
||||
parents_reply.reverse
|
||||
else
|
||||
[]
|
||||
end
|
||||
else
|
||||
opt[:top] = true
|
||||
parents_reply = parents_reply.reverse[0..1]
|
||||
parents_reply.reverse
|
||||
end
|
||||
else
|
||||
[]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -30,7 +30,7 @@ module Mobile
|
|||
'Message'
|
||||
when :act_id
|
||||
u.id
|
||||
when :replies_count
|
||||
when :comment_count
|
||||
all_comments = []
|
||||
get_all_children(all_comments, u).count
|
||||
end
|
||||
|
@ -51,15 +51,26 @@ module Mobile
|
|||
message_expose :board_id
|
||||
message_expose :subject
|
||||
message_expose :content
|
||||
message_expose :replies_count
|
||||
message_expose :comment_count
|
||||
message_expose :praise_count
|
||||
message_expose :created_on
|
||||
message_expose :locked
|
||||
message_expose :id
|
||||
message_expose :lasted_comment
|
||||
expose :message_children,using:Mobile::Entities::Message do |c,opt|
|
||||
expose :all_children,using:Mobile::Entities::Message do |c,opt|
|
||||
if c.is_a? (::Message)
|
||||
c.children.reverse
|
||||
# c.children.reverse
|
||||
if !opt[:children]
|
||||
if c.parent.nil? && opt[:type] == 0
|
||||
opt[:children] = true
|
||||
all_comments = []
|
||||
tStart = opt[:page]*5
|
||||
tEnd = (opt[:page]+1)*5 - 1
|
||||
|
||||
all_comments = get_all_children(all_comments, c)[tStart..tEnd]
|
||||
all_comments
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
expose :has_praise , if: lambda { |instance, options| options[:user] } do |instance, options|
|
||||
|
@ -69,6 +80,63 @@ module Mobile
|
|||
has_praise = obj.empty? ? false : true
|
||||
has_praise
|
||||
end
|
||||
|
||||
expose :parents_count, if: lambda { |instance, options| options[:user] } do |instance, options|
|
||||
parents_reply = []
|
||||
parents_reply = get_reply_parents_no_root(parents_reply, instance)
|
||||
parents_reply.count
|
||||
end
|
||||
|
||||
expose :parents_reply_bottom, using:Mobile::Entities::Message do |c,opt|
|
||||
if c.is_a? (::Message)
|
||||
#取二级回复的底楼层
|
||||
parents_reply = []
|
||||
parents_reply = get_reply_parents_no_root(parents_reply, c)
|
||||
if parents_reply.count > 0 && parents_reply.count != 2 && !opt[:bottom]
|
||||
if opt[:type] == 1
|
||||
# opt[:bottom] = true
|
||||
# parents_reply[opt[:page]..opt[:page]]
|
||||
else
|
||||
opt[:bottom] = true
|
||||
parents_reply[0..0]
|
||||
end
|
||||
else
|
||||
[]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
expose :parents_reply_top, using:Mobile::Entities::Message do |c,opt|
|
||||
if c.is_a? (::Message)
|
||||
#取二级回复的顶楼层
|
||||
parents_reply = []
|
||||
parents_reply = get_reply_parents_no_root(parents_reply, c)
|
||||
if parents_reply.count >= 2 && !opt[:top]
|
||||
if opt[:type] == 1
|
||||
opt[:bottom] = true
|
||||
tStart = (opt[:page]-1)*5+2
|
||||
tEnd = (opt[:page])*5+2 - 1
|
||||
|
||||
if tEnd >= parents_reply.count - 1
|
||||
tEnd = parents_reply.count - 2
|
||||
end
|
||||
|
||||
if tStart <= parents_reply.count - 2
|
||||
parents_reply = parents_reply.reverse[tStart..tEnd]
|
||||
parents_reply.reverse
|
||||
else
|
||||
[]
|
||||
end
|
||||
else
|
||||
opt[:top] = true
|
||||
parents_reply = parents_reply.reverse[0..1]
|
||||
parents_reply.reverse
|
||||
end
|
||||
else
|
||||
[]
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -24,9 +24,8 @@ module Mobile
|
|||
'News'
|
||||
when :act_id
|
||||
f.id
|
||||
when :comments_count
|
||||
all_comments = []
|
||||
get_all_children(all_comments, f).count
|
||||
when :comment_count
|
||||
f.comments.count
|
||||
end
|
||||
end
|
||||
elsif f.is_a?(Hash) && !f.key?(field)
|
||||
|
@ -70,7 +69,7 @@ module Mobile
|
|||
#发布时间
|
||||
news_expose :created_on
|
||||
#评论数量
|
||||
news_expose :comments_count
|
||||
news_expose :comment_count
|
||||
news_expose :praise_count
|
||||
#课程名字
|
||||
news_expose :course_name
|
||||
|
|
|
@ -0,0 +1,32 @@
|
|||
module Mobile
|
||||
module Entities
|
||||
class Project < Grape::Entity
|
||||
expose :name
|
||||
expose :id
|
||||
expose :user_id
|
||||
# expose :invite_code
|
||||
# expose :qrcode
|
||||
expose :can_setting, if: lambda { |instance, options| options[:user] } do |instance, options|
|
||||
current_user = options[:user]
|
||||
|
||||
my_member = instance.member_principals.where("users.id=#{current_user.id}").first
|
||||
can_setting = false
|
||||
if my_member && my_member.roles[0] && my_member.roles[0].id == 3
|
||||
can_setting = true
|
||||
end
|
||||
can_setting
|
||||
end
|
||||
|
||||
expose :is_creator, if: lambda { |instance, options| options[:user] } do |instance, options|
|
||||
current_user = options[:user]
|
||||
|
||||
current_user.id == instance.user_id
|
||||
end
|
||||
|
||||
|
||||
expose :member_count, if: lambda { |instance, options| options[:user] } do |instance, options|
|
||||
instance.members.count
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -0,0 +1,35 @@
|
|||
module Mobile
|
||||
module Entities
|
||||
class ProjectMember < Grape::Entity
|
||||
include Redmine::I18n
|
||||
include ApplicationHelper
|
||||
include ApiHelper
|
||||
def self.member_expose(f)
|
||||
expose f do |u,opt|
|
||||
if u.is_a?(Hash) && u.key?(f)
|
||||
u[f]
|
||||
elsif u.is_a?(::Member)
|
||||
if u.respond_to?(f)
|
||||
u.send(f)
|
||||
else
|
||||
case f
|
||||
when :roles_id
|
||||
u.roles[0].id
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
expose :user, using: Mobile::Entities::User do |c, opt|
|
||||
if c.is_a?(::Member)
|
||||
c.user
|
||||
end
|
||||
end
|
||||
|
||||
member_expose :roles_id
|
||||
|
||||
end
|
||||
end
|
||||
end
|
|
@ -24,10 +24,12 @@ module Mobile
|
|||
u.nil? || u.user_extensions.nil? ? "" : u.user_extensions.brief_introduction
|
||||
when :student_num
|
||||
u.nil? || u.user_extensions.nil? ? "" : u.user_extensions.student_id
|
||||
when :realname
|
||||
u.nil? ? "" : get_user_realname(u)
|
||||
when :real_name
|
||||
u.nil? ? "" : get_user_realname(u).gsub(/\s*/,"");
|
||||
when :name
|
||||
u.nil? ? "" : u.show_name
|
||||
when :roles_id
|
||||
u[:roles_id].nil? ? nil : u.roles_id
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -37,11 +39,13 @@ module Mobile
|
|||
|
||||
expose :id
|
||||
#头像
|
||||
user_expose :img_url
|
||||
#昵称
|
||||
expose :nickname
|
||||
#真名
|
||||
user_expose :realname
|
||||
user_expose :img_url
|
||||
#昵称
|
||||
expose :realname
|
||||
#昵称
|
||||
user_expose :real_name
|
||||
#性别
|
||||
user_expose :gender
|
||||
#我的二维码
|
||||
|
@ -62,6 +66,8 @@ module Mobile
|
|||
|
||||
user_expose :role_name
|
||||
|
||||
user_expose :roles_id
|
||||
|
||||
user_expose :name
|
||||
|
||||
end
|
||||
|
|
|
@ -26,7 +26,7 @@ module Mobile
|
|||
wh.nil? || wh.homework_detail_manual.nil? ? nil : convert_to_time(wh.homework_detail_manual.evaluation_end, 1)
|
||||
when :praise_count
|
||||
get_activity_praise_num(wh)
|
||||
when :whomework_journal_count
|
||||
when :comment_count
|
||||
wh.journals_for_messages.count
|
||||
when :course_name
|
||||
wh.course.name
|
||||
|
@ -58,6 +58,7 @@ module Mobile
|
|||
expose :anonymous_comment
|
||||
expose :quotes
|
||||
expose :is_open
|
||||
expose :id
|
||||
whomework_expose :act_type
|
||||
whomework_expose :act_id
|
||||
whomework_expose :course_name
|
||||
|
@ -66,11 +67,19 @@ module Mobile
|
|||
whomework_expose :evaluation_start
|
||||
whomework_expose :evaluation_end
|
||||
whomework_expose :praise_count
|
||||
whomework_expose :whomework_journal_count
|
||||
expose :journals_for_messages, using: Mobile::Entities::Jours do |f, opt|
|
||||
whomework_expose :comment_count
|
||||
expose :all_children, using: Mobile::Entities::Jours do |f, opt|
|
||||
#f[:journals_for_messages] if f.is_a?(Hash) && f.key?(:journals_for_messages)
|
||||
if f.is_a?(::HomeworkCommon)
|
||||
f.journals_for_messages.reverse
|
||||
# f.journals_for_messages.reverse
|
||||
if !opt[:children] && opt[:type] == 0
|
||||
opt[:children] = true
|
||||
tStart = opt[:page]*5
|
||||
tEnd = (opt[:page]+1)*5 - 1
|
||||
|
||||
all_comments = f.journals_for_messages.reorder("created_on desc")
|
||||
all_comments[tStart..tEnd]
|
||||
end
|
||||
end
|
||||
end
|
||||
expose :has_praise , if: lambda { |instance, options| options[:user] } do |instance, options|
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
#coding=utf-8
|
||||
#
|
||||
module Mobile
|
||||
module Exceptions
|
||||
class AuthException < StandardError
|
||||
attr_reader :err_code, :msg
|
||||
def initialize(code, msg)
|
||||
@err_code = code
|
||||
@msg = msg
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,3 +1,6 @@
|
|||
#coding=utf-8
|
||||
|
||||
|
||||
module Mobile
|
||||
module Middleware
|
||||
class ErrorHandler < Grape::Middleware::Base
|
||||
|
@ -6,7 +9,10 @@ module Mobile
|
|||
begin
|
||||
@app.call(@env)
|
||||
rescue =>e
|
||||
message = {status: 1, message: e.message }.to_json
|
||||
code = 1
|
||||
|
||||
message = {status: code, message: e.message }.to_json
|
||||
|
||||
Rails.logger.error e.inspect
|
||||
Rails.logger.error e.backtrace.join("\n")
|
||||
status = 200
|
||||
|
|
|
@ -617,7 +617,7 @@ class AdminController < ApplicationController
|
|||
|
||||
def has_applied_schools
|
||||
@name = params[:name]
|
||||
@has_apply_status = ApplyAddSchools.where(:status => 1).order('created_at desc')
|
||||
@has_apply_status = ApplyAddSchools.where("status = 1 or status = 2").order('created_at desc')
|
||||
@has_apply_count = @has_apply_status.count
|
||||
|
||||
@has_apply_pages = Paginator.new @has_apply_count, 30, params['page'] || 1
|
||||
|
@ -631,11 +631,14 @@ class AdminController < ApplicationController
|
|||
|
||||
# 批准未审批的高校
|
||||
# 消息发送,发送对象为申请人
|
||||
# status: 0表示未批准; status:1表示已批准; status: 2表示已拒绝
|
||||
# status: 0表示未批准; status:1表示已批准; status: 2表示已更改; status: 3表示已拒绝
|
||||
def approve_applied_schools
|
||||
applied_school = ApplyAddSchools.find params[:id]
|
||||
applied_school.update_column('status', 1) unless applied_school.nil?
|
||||
AppliedMessage.create(:user_id => applied_school.user_id, :status => true, :applied_id => applied_school.id, :applied_type => "ApplyAddSchools")
|
||||
school = applied_school.school
|
||||
school.update_attribute("province", applied_school.province)
|
||||
AppliedMessage.create(:user_id => applied_school.user_id, :status => 1, :viewed => true, :applied_id => applied_school.id, :applied_type => "ApplyAddSchools", :name => applied_school.name )
|
||||
# School.create(:user_id => applied_school.user_id, :status => 1, :viewed => true, :applied_id => applied_school.id, :applied_type => "ApplyAddSchools", :name => applied_school.name )
|
||||
respond_to do |format|
|
||||
format.html{ redirect_to unapplied_schools_url }
|
||||
end
|
||||
|
@ -645,8 +648,43 @@ class AdminController < ApplicationController
|
|||
# REDO: 修改该字段
|
||||
# REDO: 同步修改使用了改名称的用户单位
|
||||
def edit_applied_schools
|
||||
@applied_schools = ApplyAddSchools.find params[:id]
|
||||
@applied_schools.update_column('name', params[:name])
|
||||
aas = ApplyAddSchools.find(params[:applied_id])
|
||||
# aas.update_attribute(:name, params[:name])
|
||||
#applied_add_school = ApplyAddSchools.where(:name => aas.name)
|
||||
school = School.find params[:school_id]
|
||||
begin
|
||||
aas.update_attribute(:status, 2)
|
||||
AppliedMessage.create(:user_id => aas.user_id, :status => 2, :viewed => true, :applied_id => aas.id, :applied_type => "ApplyAddSchools", :name => school[0].name )
|
||||
users = UserExtensions.where("school_id = #{aas.school_id}")
|
||||
users.each do |user|
|
||||
user.update_column("school_id", school[0].id)
|
||||
end
|
||||
aas.school.destroy
|
||||
aas.update_attribute(:school_id, school[0].id)
|
||||
rescue Exception => e
|
||||
puts e
|
||||
end
|
||||
# applied_schools = ApplyAddSchools.find params[:applied_id]
|
||||
# applied_schools.update_column('name', params[:name])
|
||||
redirect_to unapplied_schools_url
|
||||
end
|
||||
|
||||
def all_schools
|
||||
apply_schools = ApplyAddSchools.where("status != 1")
|
||||
apply_school_ids = apply_schools.empty? ? "(-1)" : "(" + apply_schools.map{|sc| sc.school_id}.join(',') + ")"
|
||||
if !params[:search].nil?
|
||||
search = "%#{params[:search].to_s.strip.downcase}%"
|
||||
@schools = School.where("id not in #{apply_school_ids} and #{School.table_name}.name like :p",:p=>search)
|
||||
#@schools = School.all
|
||||
else
|
||||
#@course = @user.courses.where("is_delete = 0 and #{Course.table_name}.id != #{homework.course_id}").select { |course| @user.allowed_to?(:as_teacher,course)}
|
||||
@schools = School.where("id not in #{apply_school_ids}")
|
||||
end
|
||||
@edit_id = params[:school_id]
|
||||
@search = params[:search]
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
# 删除申请的高校
|
||||
|
@ -654,8 +692,17 @@ class AdminController < ApplicationController
|
|||
# REDO: 删除确认提示,是否删除
|
||||
# REDO: 给申请人发送消息
|
||||
def delete_applied_schools
|
||||
@applied_schools = ApplyAddSchools.find params[:id]
|
||||
@applied_schools.destroy
|
||||
applied_school = ApplyAddSchools.find(params[:id])
|
||||
applied_school.update_attribute(:status, 3)
|
||||
AppliedMessage.create(:user_id => applied_school.user_id, :status => 3, :viewed => true, :applied_id => applied_school.id, :applied_type => "ApplyAddSchools", :name => applied_school.name )
|
||||
users = UserExtensions.where("school_id = #{applied_school.school_id}")
|
||||
users.each do |user|
|
||||
user.update_column("school_id", nil)
|
||||
end
|
||||
applied_school.school.destroy
|
||||
respond_to do |format|
|
||||
format.html{ redirect_to unapplied_schools_url }
|
||||
end
|
||||
end
|
||||
|
||||
#移动端版本管理
|
||||
|
|
|
@ -10,7 +10,7 @@ class AtController < ApplicationController
|
|||
@users = users.uniq { |u| u.id }.delete_if { |u| u.id == User.current.id }.sort{|x,y| to_pinyin(x.show_name) <=> to_pinyin(y.show_name)} if users
|
||||
|
||||
#加上all
|
||||
if @users.size > 0
|
||||
if @user && @users.size > 0
|
||||
allUser = Struct.new(:id, :name).new
|
||||
allUser.id = @users.map{|u| u.id}.join(",")
|
||||
allUser.name = "all"
|
||||
|
|
|
@ -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
|
||||
|
@ -636,8 +652,11 @@ class CoursesController < ApplicationController
|
|||
end
|
||||
if @course
|
||||
#发送微信消息
|
||||
ss = SyllabusesService.new
|
||||
ss.send_wechat_create_class_notice User.current,@course
|
||||
count = ShieldWechatMessage.where("container_type='User' and container_id=#{User.current.id} and shield_type='Course' and shield_id=#{@course.id}").count
|
||||
if count == 0
|
||||
ss = SyllabusesService.new
|
||||
ss.send_wechat_create_class_notice User.current,@course
|
||||
end
|
||||
respond_to do |format|
|
||||
flash[:notice] = l(:notice_successful_create)
|
||||
format.html {redirect_to course_url(@course)}
|
||||
|
@ -1133,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
|
||||
|
|
|
@ -440,7 +440,7 @@ class IssuesController < ApplicationController
|
|||
jour.save
|
||||
update_user_activity(@issue.class,@issue.id)
|
||||
update_forge_activity(@issue.class,@issue.id)
|
||||
|
||||
@allowed_statuses = @issue.new_statuses_allowed_to(User.current)
|
||||
@user_activity_id = params[:user_activity_id]
|
||||
if params[:issue_id]
|
||||
@issue_id = params[:issue_id]
|
||||
|
@ -483,12 +483,21 @@ class IssuesController < ApplicationController
|
|||
if User.current.logged?
|
||||
jour = Journal.find(params[:journal_id])
|
||||
@issue = Issue.find params[:id]
|
||||
new_jour = @issue.journals.build(:user_id => User.current.id, :reply_id => params[:journal_id], :notes => params[:content], :parent_id => jour.id)
|
||||
@project = @issue.project
|
||||
@allowed_statuses = @issue.new_statuses_allowed_to(User.current)
|
||||
@priorities = IssuePriority.active
|
||||
new_jour = Journal.new
|
||||
new_jour.user_id = User.current.id
|
||||
new_jour.reply_id = params[:journal_id]
|
||||
new_jour.parent_id = jour.id
|
||||
new_jour.notes = params[:content]
|
||||
new_jour.journalized = @issue
|
||||
new_jour.save_attachments(params[:attachments])
|
||||
# new_jour = @issue.journals.build(:user_id => User.current.id, :reply_id => params[:journal_id], :notes => params[:content], :parent_id => jour.id)
|
||||
@user_activity_id = params[:user_activity_id]
|
||||
if new_jour.save
|
||||
update_user_activity(@issue.class,@issue.id)
|
||||
update_forge_activity(@issue.class,@issue.id)
|
||||
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
|
@ -496,13 +505,28 @@ class IssuesController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
#
|
||||
# 需要刷新详情页面,代码同步一致
|
||||
# 获取project和issue状态是为了刷新页面
|
||||
# 值所以用delete是因为issue和journal在act_as_attachment中是同一个类型
|
||||
# 非动态页面直接刷新,动态页面手动刷新
|
||||
def delete_journal
|
||||
@issue = Issue.find(params[:id])
|
||||
Journal.destroy(params[:journal_id])
|
||||
begin
|
||||
forge_acts = ForgeMessage.where(:forge_message_type => "Journal", :forge_message_id => params[:journal_id]).first
|
||||
forge_acts.destroy unless forge_acts.nil?
|
||||
at_message = AtMessage.where(:at_message_type => "Journal", :at_message_id => params[:journal_id]).first
|
||||
at_message.destroy unless at_message.nil?
|
||||
Journal.delete(params[:journal_id])
|
||||
rescue Exception => e
|
||||
puts e
|
||||
end
|
||||
@user_activity_id = params[:user_activity_id]
|
||||
respond_to do |format|
|
||||
format.js
|
||||
if @user_activity_id
|
||||
format.js
|
||||
else
|
||||
format.html{ redirect_to issue_url(@issue)}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -211,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
|
||||
|
||||
|
@ -309,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)
|
||||
|
|
|
@ -238,6 +238,10 @@ class ProjectsController < ApplicationController
|
|||
#end
|
||||
@project.members << m
|
||||
@project.project_infos << project_info
|
||||
|
||||
p = Project.find("#{@project.id}")
|
||||
ps = ProjectsService.new
|
||||
ps.send_wechat_create_project_notice User.current,p
|
||||
#end
|
||||
respond_to do |format|
|
||||
format.html {
|
||||
|
|
|
@ -169,6 +169,7 @@ class SchoolController < ApplicationController
|
|||
school = School.new
|
||||
school.name = params[:name].strip
|
||||
school.pinyin = Pinyin.t(params[:name].strip, splitter: '')
|
||||
school.province = params[:province]
|
||||
|
||||
#status 0未处理 1通过 2拒绝
|
||||
applyschool = ApplyAddSchools.new
|
||||
|
@ -203,6 +204,7 @@ class SchoolController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
|
||||
render :json =>status
|
||||
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'
|
||||
|
|
|
@ -8,10 +8,12 @@ class WechatsController < ActionController::Base
|
|||
# default text responder when no other match
|
||||
on :text do |request, content|
|
||||
#邀请码
|
||||
if join_request(request)
|
||||
if join_class_request(request)
|
||||
sendBindClass(request, {invite_code: content})
|
||||
# elsif join_project_request(request)
|
||||
# sendBindProject(request, {invite_code: content})
|
||||
else
|
||||
request.reply.text '您的意见已收到,感谢您的反馈!'
|
||||
request.reply.text "您的意见已收到,非常感谢~ \n更多问题可以通过以下方式联系我们:\n官方QQ群:173184401\n我们会认真聆听您的意见和建议。"
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -143,11 +145,17 @@ class WechatsController < ActionController::Base
|
|||
end
|
||||
|
||||
on :click, with: 'PROJECT' do |request, key|
|
||||
request.reply.text "此功能正在开发中,很快就会上线,谢谢!"
|
||||
request.reply.text "该功能将在近日开放,敬请期待!"
|
||||
end
|
||||
|
||||
on :click, with: 'JOIN_PROJECT' do |request, key|
|
||||
request.reply.text "此功能正在开发中,很快就会上线,谢谢!"
|
||||
request.reply.text "该功能将在近日开放,敬请期待!"
|
||||
# uw = user_binded?(request[:FromUserName])
|
||||
# unless uw
|
||||
# sendBind(request)
|
||||
# else
|
||||
# request.reply.text "请直接回复6位项目邀请码\n(不区分大小写):"
|
||||
# end
|
||||
end
|
||||
|
||||
on :click, with: 'JOIN_CLASS' do |request, key|
|
||||
|
@ -159,12 +167,18 @@ class WechatsController < ActionController::Base
|
|||
end
|
||||
end
|
||||
|
||||
def join_request(request)
|
||||
def join_class_request(request)
|
||||
openid = request[:FromUserName]
|
||||
wl = WechatLog.where("openid = '#{openid}' and request_raw like '%\"Event\":\"click\"%'").order('id desc').first
|
||||
wl && JSON(wl.request_raw)["EventKey"] == 'JOIN_CLASS'
|
||||
end
|
||||
|
||||
def join_project_request(request)
|
||||
openid = request[:FromUserName]
|
||||
wl = WechatLog.where("openid = '#{openid}' and request_raw like '%\"Event\":\"click\"%'").order('id desc').first
|
||||
wl && JSON(wl.request_raw)["EventKey"] == 'JOIN_PROJECT'
|
||||
end
|
||||
|
||||
def sendBindClass(request, params)
|
||||
begin
|
||||
uw = user_binded?(request[:FromUserName])
|
||||
|
@ -180,6 +194,21 @@ class WechatsController < ActionController::Base
|
|||
end
|
||||
end
|
||||
|
||||
def sendBindProject(request, params)
|
||||
begin
|
||||
uw = user_binded?(request[:FromUserName])
|
||||
if !uw
|
||||
return sendBind(request)
|
||||
else
|
||||
return join_project(params, uw.user, request)
|
||||
end
|
||||
rescue => e
|
||||
logger.error e.inspect
|
||||
logger.error e.backtrace.join("\n")
|
||||
return request.reply.text e
|
||||
end
|
||||
end
|
||||
|
||||
def default_msg(request)
|
||||
uw = user_binded?(request[:FromUserName])
|
||||
if uw && uw.user
|
||||
|
@ -234,6 +263,36 @@ class WechatsController < ActionController::Base
|
|||
|
||||
end
|
||||
|
||||
def join_project(params, user, request)
|
||||
project = nil
|
||||
project = Project.where(qrcode: params[:ticket]).first if params[:ticket]
|
||||
project = Project.where(invite_code: params[:invite_code]).first if params[:invite_code]
|
||||
raise "项目不存在,请确认您的邀请码是否输入正确,谢谢!" unless project
|
||||
|
||||
#取出用户角色类型
|
||||
role = 5
|
||||
|
||||
ps = ProjectsService.new
|
||||
status = ps.join_project({invite_code: project.invite_code}, user)
|
||||
if status[:state] != 0
|
||||
raise ProjectService::JoinProjectError.message(status)
|
||||
end
|
||||
|
||||
creator = User.find(project.user_id)
|
||||
|
||||
news = (1..1).each_with_object([]) { |n, memo| memo << { title: '恭喜您成功加入项目,开始研发吧!',
|
||||
content: "项目名称:#{project.name}\n发起人:#{creator.name}\n进入项目,和小伙伴轻松的研发吧!"} }
|
||||
return request.reply.news(news) do |article, n, index| # article is return object
|
||||
url = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=#{Wechat.config.appid}&redirect_uri=#{ROOT_URL+'/wechat/user_activities#/project?id='+project.id.to_s}&response_type=code&scope=snsapi_base&state=myproject#wechat_redirect"
|
||||
pic_url = "#{ROOT_URL}/images/wechat/class.jpg"
|
||||
article.item title: "#{n[:title]}",
|
||||
description: n[:content],
|
||||
pic_url: pic_url,
|
||||
url: url
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
### controller method
|
||||
module Controllers
|
||||
def get_bind
|
||||
|
@ -288,8 +347,7 @@ class WechatsController < ActionController::Base
|
|||
session[:wechat_code] = params[:code] if params[:code]
|
||||
openid = get_openid_from_code(params[:code])
|
||||
@wechat_user = user_binded?(openid)
|
||||
|
||||
render 'wechats/login', layout: 'base_wechat'
|
||||
render 'wechats/user_activities', layout: nil
|
||||
end
|
||||
|
||||
def user_activities
|
||||
|
@ -299,13 +357,20 @@ class WechatsController < ActionController::Base
|
|||
unless open_id
|
||||
render 'wechats/open_wechat', layout: nil and return
|
||||
end
|
||||
if params[:state] == 'myclass'
|
||||
@course_id = params[:id];
|
||||
end
|
||||
|
||||
unless user_binded?(open_id)
|
||||
@path = '/login'
|
||||
else
|
||||
if params[:state] == 'myclass'
|
||||
@course_id = params[:id];
|
||||
elsif params[:state] == 'myproject'
|
||||
@project_id = params[:id];
|
||||
end
|
||||
|
||||
session[:wechat_openid] = open_id
|
||||
if params[:code]
|
||||
redirect_to "/wechat/user_activities##{@path}?id=#{params[:id]}" and return
|
||||
session[:wechat_openid] = open_id
|
||||
if params[:code]
|
||||
redirect_to "/wechat/user_activities##{@path}?id=#{params[:id]}" and return
|
||||
end
|
||||
end
|
||||
render 'wechats/user_activities', layout: nil
|
||||
end
|
||||
|
|
|
@ -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)
|
||||
|
@ -595,7 +600,7 @@ module CoursesHelper
|
|||
def get_acts_list_type type
|
||||
case type
|
||||
when "homework"
|
||||
l(:label_homework_acts)
|
||||
l(:label_homework_acts)
|
||||
when "news"
|
||||
l(:label_news_acts)
|
||||
when "attachment"
|
||||
|
@ -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
|
||||
|
||||
|
|
|
@ -728,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
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
class ApplyAddSchools < ActiveRecord::Base
|
||||
# status:0 未审批 ; 1 已批阅
|
||||
attr_accessible :address, :city, :name, :province, :remarks, :school_id, :status
|
||||
has_many :applied_messages, :class_name =>'AppliedMessage', :as => :applied, :dependent => :destroy
|
||||
has_many :applied_messages, :class_name =>'AppliedMessage', :as => :applied
|
||||
belongs_to :school
|
||||
|
||||
after_create :send_massage
|
||||
|
|
|
@ -55,7 +55,7 @@ class Journal < ActiveRecord::Base
|
|||
before_create :split_private_notes, :add_journals_count
|
||||
|
||||
# fq
|
||||
after_save :act_as_activity,:be_user_score, :act_as_forge_message, act_as_at_message(:notes, :user_id)
|
||||
after_save :be_user_score, :act_as_forge_message, act_as_at_message(:notes, :user_id)
|
||||
# end
|
||||
#after_destroy :down_user_score
|
||||
#before_save :be_user_score
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -165,6 +165,7 @@ class Project < ActiveRecord::Base
|
|||
scope :has_module, lambda {|mod|
|
||||
where("#{Project.table_name}.id IN (SELECT em.project_id FROM #{EnabledModule.table_name} em WHERE em.name=?)", mod.to_s)
|
||||
}
|
||||
scope :not_deleted, lambda{where("status<>9")}
|
||||
scope :active, lambda { where(:status => STATUS_ACTIVE) }
|
||||
scope :status, lambda {|arg| where(arg.blank? ? nil : {:status => arg.to_i}) }
|
||||
scope :all_public, lambda { where(:is_public => true) }
|
||||
|
|
|
@ -824,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
|
||||
|
@ -919,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:
|
||||
|
|
|
@ -89,7 +89,8 @@ class CoursesService
|
|||
@members = searchTeacherAndAssistant(c)
|
||||
when '2'
|
||||
#@subPage_title = l :label_student_list
|
||||
@members = searchStudent(c)
|
||||
# @members = searchStudent(c)
|
||||
@members = searchmember_by_name(student_homework_score(0,c.id, 0,"desc"),"")
|
||||
else
|
||||
#@subPage_title = ''
|
||||
@members = c.member_principals.includes(:roles, :principal).all.sort
|
||||
|
@ -104,6 +105,7 @@ class CoursesService
|
|||
:work_unit => work_unit, :mail => m.user.mail, :location => location,
|
||||
role_name: m.roles.first.name,
|
||||
name: m.user.show_name,
|
||||
roles_id: m.roles[0].id,
|
||||
:brief_introduction => m.user.user_extensions.brief_introduction,:realname=>m.user.realname}
|
||||
end
|
||||
users
|
||||
|
@ -389,6 +391,101 @@ 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
|
||||
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
|
||||
|
@ -954,5 +1051,49 @@ class CoursesService
|
|||
# student_works[index + 1 .. index + n]
|
||||
# end
|
||||
|
||||
#修改班级成员角色
|
||||
def modify_user_course_role params
|
||||
status = -1
|
||||
|
||||
c = Course.find("#{params[:id]}")
|
||||
|
||||
member = c.member_principals.includes(:roles, :principal).where("user_id=?",params[:user_id]).first
|
||||
|
||||
if member
|
||||
role = Role.find(params[:role_id])
|
||||
|
||||
member.member_roles[0].role_id = params[:role_id]
|
||||
|
||||
# 这里的判断只能通过角色名,可以弄成常量
|
||||
if params[:role_id] == 10
|
||||
StudentsForCourse.create(:student_id => params[:user_id], :course_id =>params[:id])
|
||||
else
|
||||
joined = StudentsForCourse.where('student_id = ? and course_id = ?', params[:user_id],params[:id])
|
||||
joined.each do |join|
|
||||
join.delete
|
||||
end
|
||||
member.course_group_id = 0
|
||||
end
|
||||
if role.allowed_to?(:is_manager)
|
||||
courseInfo = CourseInfos.new(:user_id => params[:user_id], :course_id => params[:id])
|
||||
courseInfo.save
|
||||
else
|
||||
user_admin = CourseInfos.where("user_id = ? and course_id = ?", params[:user_id], params[:id])
|
||||
if user_admin.size > 0
|
||||
user_admin.each do |user|
|
||||
user.destroy
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Role.givable.all[3..5]
|
||||
|
||||
if member.member_roles[0].save
|
||||
status = 0
|
||||
end
|
||||
end
|
||||
status
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
|
|
@ -0,0 +1,145 @@
|
|||
#coding=utf-8
|
||||
|
||||
class ProjectsService
|
||||
|
||||
include ApplicationHelper
|
||||
|
||||
#获取指定用户的项目列表
|
||||
def user_projects(user)
|
||||
projects = user.projects.not_deleted.select("projects.*,(SELECT MAX(updated_at) FROM `forge_activities` WHERE forge_activities.project_id = projects.id) AS updated_at ").order("updated_at desc")
|
||||
projects
|
||||
end
|
||||
|
||||
#显示项目
|
||||
def show_project(params,current_user)
|
||||
project = Project.find(params[:id])
|
||||
# project.generate_invite_code
|
||||
# project.generate_qrcode
|
||||
|
||||
project
|
||||
end
|
||||
|
||||
def send_wechat_create_project_notice user,project
|
||||
count = ShieldWechatMessage.where("container_type='User' and container_id=#{user.id} and shield_type='Project' and shield_id=#{project.id}").count
|
||||
Rails.logger.info "!!!!!!!!!!!!!!!!!!!!!!#{project}"
|
||||
if count == 0
|
||||
ws = WechatService.new
|
||||
title = "恭喜您创建项目成功。"
|
||||
ws.create_project_notice user.id, "create_project_notice", project.id,title, project.name, format_time(project.created_on),"点击查看项目详情。"
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def createNewProject params,user
|
||||
status = -1
|
||||
issue_custom_fields = IssueCustomField.sorted.all
|
||||
trackers = Tracker.sorted.all
|
||||
project = Project.new
|
||||
|
||||
project[:name] = params[:name]
|
||||
project[:description] = ''
|
||||
project[:is_public] = '0' #公开
|
||||
project[:project_type] = 0
|
||||
project[:project_new_type] = 1
|
||||
project[:identifier] = Project.next_identifier if Setting.sequential_project_identifiers?
|
||||
|
||||
project.organization_id = params[:organization_id]
|
||||
project.user_id = user.id
|
||||
|
||||
# if validate_parent_id && @project.save
|
||||
if project.save
|
||||
p = Project.find("#{project.id}")
|
||||
send_wechat_create_project_notice user,p
|
||||
r = Role.givable.find_by_id(Setting.new_project_user_role_id.to_i) || Role.givable.first
|
||||
m = Member.new(:user => user, :roles => [r])
|
||||
# project's score
|
||||
if ProjectScore.where("project_id=?", project.id).first.nil?
|
||||
ProjectScore.create(:project_id => project.id, :score => false)
|
||||
end
|
||||
# end
|
||||
project_info = ProjectInfo.new(:user_id => user.id, :project_id => project.id)
|
||||
user_grades = UserGrade.create(:user_id => user.id, :project_id => project.id)
|
||||
project_status = ProjectStatus.create(:project_id => project.id, :watchers_count => 0, :changesets_count => 0, :project_type => project.project_type,:grade => 0)
|
||||
project.members << m
|
||||
project.project_infos << project_info
|
||||
status = 0
|
||||
end
|
||||
status
|
||||
end
|
||||
|
||||
#修改项目成员角色
|
||||
def modify_user_project_role params
|
||||
status = -1
|
||||
|
||||
project = Project.find("#{params[:id]}")
|
||||
|
||||
member = project.member_principals.includes(:roles, :principal).where("user_id=?",params[:user_id]).first
|
||||
|
||||
if member
|
||||
member.member_roles[0].role_id = params[:role_id]
|
||||
|
||||
|
||||
role = Role.find(params[:role_id])
|
||||
if role.allowed_to?(:is_manager)
|
||||
projectInfo = ProjectInfo.new(:user_id => member.user_id, :project_id => project.id)
|
||||
projectInfo.save
|
||||
else
|
||||
user_admin = ProjectInfo.where("user_id = ? and project_id = ?", member.user_id, project.id)
|
||||
if user_admin.size > 0
|
||||
user_admin.each do |user|
|
||||
user.destroy
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if member.member_roles[0].save
|
||||
status = 0
|
||||
end
|
||||
end
|
||||
status
|
||||
end
|
||||
|
||||
class JoinProjectError < Errors
|
||||
define_error [
|
||||
0, '加入成功',
|
||||
1, '您的邀请码不正确',
|
||||
2, '您还未登录',
|
||||
3, '您已经是该项目的管理人员',
|
||||
4, '您已经是该项目的开发人员',
|
||||
5, '您已经是该项目的报告人员',
|
||||
6, '该项目不存在或已被删除啦',
|
||||
'未知错误,请稍后再试'
|
||||
]
|
||||
end
|
||||
|
||||
def join_project params,current_user
|
||||
status = -1
|
||||
project = project.find_by_invite_code(params[:invite_code]) if params[:invite_code]
|
||||
|
||||
if project
|
||||
if project[:is_delete] == 1
|
||||
status = 6
|
||||
else
|
||||
if current_user.member_of?(project) #如果已经是成员
|
||||
member = project.member_principals.includes(:roles, :principal).where("user_id=?",current_user.id).first
|
||||
status = member.member_roles[0].role_id
|
||||
else
|
||||
if params[:invite_code].present?
|
||||
members = []
|
||||
members << Member.new(:role_ids => [5], :user_id => current_user.id)
|
||||
project.members << members
|
||||
projectInfo = ProjectInfo.new(:user_id => current_user.id, :project_id => project.id)
|
||||
projectInfo.save
|
||||
status = 0
|
||||
else
|
||||
status = 4
|
||||
end
|
||||
end
|
||||
end
|
||||
else
|
||||
status = 4
|
||||
end
|
||||
status
|
||||
end
|
||||
|
||||
end
|
|
@ -323,4 +323,41 @@ class WechatService
|
|||
end
|
||||
end
|
||||
|
||||
def create_project_notice(user_id, type, id, first, key1, key2,remark="")
|
||||
uw = UserWechat.where(user_id: user_id).first
|
||||
unless uw.nil?
|
||||
data = {
|
||||
touser:uw.openid,
|
||||
template_id:Wechat.config.create_project_notice,
|
||||
url:"#{Setting.protocol}://#{Setting.host_name}/wechat/user_activities#/project?id="+id.to_s,
|
||||
topcolor:"#FF0000",
|
||||
data:{
|
||||
first: {
|
||||
value:first,
|
||||
color:"#707070"
|
||||
},
|
||||
keyword1:{
|
||||
value:key1,
|
||||
color:"#707070"
|
||||
},
|
||||
keyword2:{
|
||||
value:key2,
|
||||
color:"#707070"
|
||||
},
|
||||
remark:{
|
||||
value:remark,
|
||||
color:"#707070"
|
||||
}
|
||||
}
|
||||
}
|
||||
#data = three_keys_template uw.openid,Wechat.config.create_class_notice, type, id, first, key1, key2, key3, remark
|
||||
begin
|
||||
req = Wechat.api.template_message_send Wechat::Message.to(uw.openid).template(data)
|
||||
rescue Exception => e
|
||||
Rails.logger.error "[wechat_create_project_notice] ===> #{e}"
|
||||
end
|
||||
Rails.logger.info "send over. #{req}"
|
||||
end
|
||||
end
|
||||
|
||||
end
|
|
@ -0,0 +1,56 @@
|
|||
<%= 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>
|
||||
<!--<div class="resourcePopupClose"> <a href="javascript:void(0);" class="resourceClose" onclick="closeModal();"></a></div>-->
|
||||
<div>
|
||||
<!--<input type="text" name="search" placeholder="输入班级ID或者名称搜索" class="subjectSearch fr" />-->
|
||||
<input type="text" id="search_course_input" value="<%= @search %>" name="search" placeholder="输入名称搜索" class="mt10 mb10 course-search" />
|
||||
</div>
|
||||
<div id="schools_list">
|
||||
<%= render :partial => "admin/update_school_form", :locals => {:schools => schools, :edit_id => edit_id} %>
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
function school_submit() {
|
||||
var checkboxs = $("input[name='school_id[]']:checked");
|
||||
if(checkboxs.length == 0) {
|
||||
$("#choose_courses_notice").text("请先选择班级");
|
||||
} else{
|
||||
$("#choose_courses_notice").text("");
|
||||
$("#schools_list_form").submit();
|
||||
hideModal();
|
||||
}
|
||||
}
|
||||
var lastSearchCondition = '';
|
||||
var count = 0;
|
||||
function search_courses(e){
|
||||
if($(e.target).val().trim() == lastSearchCondition && lastSearchCondition != '')
|
||||
{
|
||||
return;
|
||||
}
|
||||
lastSearchCondition = $(e.target).val().trim();
|
||||
$.ajax({
|
||||
url: '<%= url_for(:controller => 'admin', :action => 'all_schools') %>'+'?search='+ e.target.value+'&school_id=<%=edit_id %>',
|
||||
type:'get',
|
||||
data: {is_observe:true},
|
||||
success: function(data){ },
|
||||
beforeSend: function(){ $(this).addClass('ajax-loading'); },
|
||||
complete: function(){ $(this).removeClass('ajax-loading'); }
|
||||
});
|
||||
}
|
||||
|
||||
function throttle(method,context,e){
|
||||
clearTimeout(method.tId);
|
||||
method.tId=setTimeout(function(){
|
||||
method.call(context,e);
|
||||
},500);
|
||||
}
|
||||
|
||||
//查询项目
|
||||
$("input[name='search']").on('input', function (e) {
|
||||
throttle(search_courses,window,e);
|
||||
});
|
||||
|
||||
</script>
|
|
@ -0,0 +1,27 @@
|
|||
<%= form_tag admin_edit_applied_schools_path(:applied_id =>edit_id), :id => 'schools_list_form' %>
|
||||
<div>
|
||||
<%#= hidden_field_tag(:send_id, edit_id) %>
|
||||
<div class="courseReferContainer">
|
||||
<% if !schools.empty? %>
|
||||
<% schools.each do |school| %>
|
||||
<ul class="courseSend">
|
||||
<li class="" style="display:inline-block">
|
||||
<input name="school_id[]" type="radio" value="<%= school.id %>" class="courseSendCheckbox"/>
|
||||
</li>
|
||||
<li class="sendCourseName"><%= truncate(school.name, :lendght => 25)%></li>
|
||||
</ul>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<span id="choose_courses_notice" class="c_red"></span>
|
||||
<div>
|
||||
<div class="courseSendSubmit">
|
||||
<a href="javascript:void(0);" onfocus='this.blur();' onclick="school_submit();" class="sendSourceText">确定</a>
|
||||
</div>
|
||||
<div class="courseSendCancel">
|
||||
<a href="javascript:void(0);" class="sendSourceText" onclick="hideModal();">取消</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
|
@ -0,0 +1,11 @@
|
|||
<% if params[:search].nil? %>
|
||||
$("#ajax-modal").html('<%= escape_javascript( render :partial => 'admin/all_schools', :locals => {:schools => @schools, :edit_id => @edit_id}) %>');
|
||||
showModal('ajax-modal', '452px');
|
||||
$('#ajax-modal').siblings().remove();
|
||||
$('#ajax-modal').before("<a href='javascript:void(0)' onclick='hideModal();' style='margin-left: 435px;' class='resourceClose'></a>");
|
||||
$('#ajax-modal').parent().css("top","50%").css("left","50%");
|
||||
$('#ajax-modal').parent().addClass("popbox").addClass("resourceUploadPopup");
|
||||
$('#ajax-modal').css("padding-left","16px").css("padding-bottom","16px");
|
||||
<% else %>
|
||||
$("#schools_list").html("<%= escape_javascript(render :partial => 'admin/update_school_form', :locals => {:schools => @schools, :edit_id => @edit_id}) %>");
|
||||
<% end %>
|
|
@ -16,7 +16,7 @@
|
|||
<% end %>
|
||||
|
||||
|
||||
<div class="autoscroll">
|
||||
<div class="autoscroll" id = "applied_school">
|
||||
<table class="list" style="width: 100%;table-layout: fixed">
|
||||
<thead>
|
||||
<tr>
|
||||
|
@ -32,7 +32,7 @@
|
|||
<th style="width: 75px;">
|
||||
详细地址
|
||||
</th>
|
||||
<th style="width: 20px;">
|
||||
<th style="width: 30px;">
|
||||
用户
|
||||
</th>
|
||||
<th style="width: 60px;">
|
||||
|
@ -46,11 +46,11 @@
|
|||
<tbody>
|
||||
<% @apply_status.each do |apply| %>
|
||||
<% if apply.status == 0 %>
|
||||
<tr class="odd">
|
||||
<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="schools_title_<%= apply.id %>">
|
||||
<td style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" class="name" title='<%=apply.name%>' id="apply_title_<%= apply.id %>">
|
||||
<%= apply.name %>
|
||||
</td>
|
||||
<td class="center">
|
||||
|
@ -60,17 +60,29 @@
|
|||
<%= apply.address %>
|
||||
</td>
|
||||
<td class="center">
|
||||
<%= apply.user_id %>
|
||||
<% 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(: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 }, :class => 'icon-del') %>
|
||||
<%= link_to( l(:button_change), { :controller => 'admin', :action => 'edit_applied_schools', :id => apply.id, :name => apply.name }, :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 %>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<% unless apply.remarks.empty? %>
|
||||
<tr class="odd">
|
||||
<td>
|
||||
|
||||
</td>
|
||||
<td style="text-align: left;" colspan="6">
|
||||
<%= apply.remarks %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</tbody>
|
||||
|
|
|
@ -32,8 +32,8 @@
|
|||
<th style="width: 75px;">
|
||||
详细地址
|
||||
</th>
|
||||
<th style="width: 20px;">
|
||||
用户
|
||||
<th style="width: 85px;">
|
||||
原名
|
||||
</th>
|
||||
<th style="width: 60px;">
|
||||
创建时间
|
||||
|
@ -45,31 +45,40 @@
|
|||
</thead>
|
||||
<tbody>
|
||||
<% @has_apply_status.each do |apply| %>
|
||||
<% if apply.status == 1 %>
|
||||
<tr class="odd">
|
||||
<% if apply.status == 1 || apply.status == 2%>
|
||||
<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="schools_title_<%= apply.id %>">
|
||||
<%= apply.name %>
|
||||
<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>
|
||||
<td class="center">
|
||||
<%= apply.province + apply.city %>
|
||||
<%= (School.find apply.school_id).province %>
|
||||
</td>
|
||||
<td align="left" style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;">
|
||||
<%= apply.address %>
|
||||
</td>
|
||||
<td class="center">
|
||||
<%= apply.user_id %>
|
||||
<%= apply.name %>
|
||||
</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 }, :class => 'icon-del') %>
|
||||
<%= link_to( l(:button_change), { :controller => 'admin', :action => 'edit_applied_schools', :id => apply.id, :name => apply.name }, :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') %>
|
||||
</td>
|
||||
</tr>
|
||||
<% unless apply.remarks.empty? %>
|
||||
<tr class="odd">
|
||||
<td>
|
||||
|
||||
</td>
|
||||
<td style="text-align: left;" colspan="6">
|
||||
<%= apply.remarks %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</tbody>
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -40,7 +40,6 @@
|
|||
l(:button_delete),
|
||||
{:controller => 'issues',:action => 'delete_journal', :id => issue.id,:journal_id=>comment.id},
|
||||
:method => :get,
|
||||
:remote=>true,
|
||||
:class => 'fr mr20',
|
||||
:data => {:confirm => l(:text_are_you_sure)},
|
||||
:title => l(:button_delete)
|
||||
|
@ -73,7 +72,7 @@
|
|||
<div class="mt5 fl">
|
||||
<%= render :partial => 'attachments/issue_reply', :locals => {:container => @issue} %>
|
||||
</div>
|
||||
<span nhname='contentmsg_<%= @issue.id %>' class="fl"></span>
|
||||
<span nhname='contentmsg_<%= @issue.id %>' class="fl mt5"></span>
|
||||
<a id="new_message_submit_btn_<%= @issue.id %>" href="javascript:void(0)" onclick="this.style.display='none'" class="blue_n_btn fr mt5" style="display:none;">发送</a>
|
||||
<div class="cl"></div>
|
||||
<% end %>
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
$("#reply_div_<%= @issue.id %>").html("<%= escape_javascript(render :partial => 'issues/issue_replies', :locals => {:issue => @issue}) %>");
|
||||
$("#issue_detail_show").html('<%= escape_javascript(render :partial => 'issues/detail') %>')
|
||||
$("#issue_edit_show").html('<%= escape_javascript(render :partial => 'issues/edit') %>')
|
||||
$("#div_issue_attachment_<%=@issue.id %>").html("<%= escape_javascript(render :partial => 'issues/issue_attachments', :locals => {:issue => @issue}) %>");
|
||||
sd_create_editor_from_data(<%= @issue.id %>, null, "100%", "<%= @issue.class.name %>");
|
||||
issue_desc_editor = KindEditor.create('#issue_description',
|
||||
{"width":"85%",
|
||||
"resizeType":0,
|
||||
"no_label":true,
|
||||
"at_id":<%= @issue.project_id%>,
|
||||
"at_type":"Project",
|
||||
"autoHeightMode":true,
|
||||
"afterCreate":"eval(function(){ if(typeof enablePasteImg ==='function'){enablePasteImg(self);};if(typeof enableAt ==='function'){enableAt(self, \"<%=@issue.project_id %>\", 'Project');}; this.loadPlugin('autoheight')})",
|
||||
"emotionsBasePath":'<%= Setting.host_name%>',
|
||||
"height":300,
|
||||
"allowFileManager":true,
|
||||
"uploadJson":"/kindeditor/upload",
|
||||
"fileManagerJson":"/kindeditor/filemanager"});
|
||||
// $("#issue_test_<%#= @issue.id %>").html("<%#= escape_javascript(render :partial => 'issues/edit', :locals => {:issue => Issue.find( @issue_id)}) %>");
|
||||
$(".homepagePostReplyBannerCount").html('回复(<%= @issue.journals.count %>)');
|
||||
sd_create_editor_from_data(<%= @issue.id%>, null, "100%","<%= @issue.class.name %>");
|
|
@ -1,25 +1,5 @@
|
|||
<% if @issue_id %> //issue详情中回复
|
||||
$("#reply_div_<%= @issue_id %>").html("<%= escape_javascript(render :partial => 'issues/issue_replies', :locals => {:issue => Issue.find( @issue_id),:replies_all_i=>0}) %>");
|
||||
$("#div_issue_attachment_<%=@issue.id %>").html("<%= escape_javascript(render :partial => 'issues/issue_attachments', :locals => {:issue => Issue.find( @issue_id)}) %>");
|
||||
$("#issue_detail_show").html('<%= escape_javascript(render :partial => 'issues/detail') %>')
|
||||
$("#issue_edit_show").html('<%= escape_javascript(render :partial => 'issues/edit') %>')
|
||||
sd_create_editor_from_data(<%= @issue.id %>, null, "100%", "<%= @issue.class.name %>");
|
||||
issue_desc_editor = KindEditor.create('#issue_description',
|
||||
{"width":"85%",
|
||||
"resizeType":0,
|
||||
"no_label":true,
|
||||
"at_id":<%= @issue.project_id%>,
|
||||
"at_type":"Project",
|
||||
"autoHeightMode":true,
|
||||
"afterCreate":"eval(function(){ if(typeof enablePasteImg ==='function'){enablePasteImg(self);};if(typeof enableAt ==='function'){enableAt(self, \"<%=@issue.project_id %>\", 'Project');}; this.loadPlugin('autoheight')})",
|
||||
"emotionsBasePath":'<%= Setting.host_name%>',
|
||||
"height":300,
|
||||
"allowFileManager":true,
|
||||
"uploadJson":"/kindeditor/upload",
|
||||
"fileManagerJson":"/kindeditor/filemanager"});
|
||||
// $("#issue_test_<%#= @issue.id %>").html("<%#= escape_javascript(render :partial => 'issues/edit', :locals => {:issue => Issue.find( @issue_id)}) %>");
|
||||
$(".homepagePostReplyBannerCount").html('回复(<%= Issue.find( @issue_id).journals.count %>)')
|
||||
sd_create_editor_from_data(<%= @issue.id %>, null, "100%","<%=@issue.class.name%>");
|
||||
<%= render "jounal_refresh" %>
|
||||
<%else%>
|
||||
$("#div_user_issue_reply_<%=@user_activity_id %>").html("<%= escape_javascript(render :partial => 'users/project_issue_reply', :locals => {:activity => @issue, :user_activity_id => @user_activity_id}) %>");
|
||||
sd_create_editor_from_data(<%= @user_activity_id %>, null, "100%", "UserActivity");
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
<% if @user_activity_id %>
|
||||
<%# 动态中 %>
|
||||
$("#div_user_issue_reply_<%=@user_activity_id%>").html("<%= escape_javascript(render :partial => 'users/project_issue_reply', :locals => {:activity => @issue, :user_activity_id => @user_activity_id}) %>");
|
||||
sd_create_editor_from_data(<%= @user_activity_id%>, null, "100%","<%=@issue.class.name%>");
|
||||
<% else %>
|
||||
$("#reply_div_<%= @issue.id %>").html("<%= escape_javascript(render :partial => 'issues/issue_replies', :locals => {:issue => @issue}) %>");
|
||||
$(".homepagePostReplyBannerCount").html('回复(<%= @issue.journals.count %>)');
|
||||
sd_create_editor_from_data(<%= @issue.id%>, null, "100%","<%=@issue.class.name%>");
|
||||
<%# issue详情 %>
|
||||
<%= render "jounal_refresh" %>
|
||||
<% end %>
|
|
@ -2,7 +2,5 @@
|
|||
$("#div_user_issue_reply_<%=@user_activity_id%>").html("<%= escape_javascript(render :partial => 'users/project_issue_reply', :locals => {:activity => @issue, :user_activity_id => @user_activity_id}) %>");
|
||||
sd_create_editor_from_data(<%= @user_activity_id%>, null, "100%","<%=@issue.class.name%>");
|
||||
<% else %>
|
||||
$("#reply_div_<%= @issue.id %>").html("<%= escape_javascript(render :partial => 'issues/issue_replies', :locals => {:issue => @issue,:replies_all_i=>0}) %>");
|
||||
$(".homepagePostReplyBannerCount").html('回复(<%= @issue.journals.count %>)')
|
||||
sd_create_editor_from_data(<%= @issue.id%>, null, "100%","<%=@issue.class.name%>");
|
||||
<%= render "jounal_refresh" %>
|
||||
<% 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>
|
|
@ -9,14 +9,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>
|
||||
<li><%= link_to "进入课程", syllabus_path(@course.syllabus), :class => "postOptionLink", :target => "_blank" %></li>
|
||||
<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>
|
||||
|
@ -28,12 +27,20 @@
|
|||
<%= image_tag(url_to_avatar(@course), :width => "110", :height => "110", :alt => "班级logo") %>
|
||||
</div>
|
||||
<div class="sy_class_id fl">
|
||||
<p>邀请码<br /><span class="sy_corange"><%=@course.generate_invite_code %></span></p>
|
||||
<p>邀 请 码<br />
|
||||
<span class="sy_corange">
|
||||
<% if User.current.admin? || User.current.member_of_course?(@course) %>
|
||||
<%=@course.generate_invite_code %>
|
||||
<% else %>
|
||||
<span class="f12">请询问老师</span>
|
||||
<% end %>
|
||||
</span>
|
||||
</p>
|
||||
</div>
|
||||
<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>
|
||||
|
@ -47,8 +54,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" %>
|
||||
<% 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" %>
|
||||
<% end %>
|
||||
<% unless (is_teacher || is_TA || is_TE) %>
|
||||
<div id="join_in_course_header"><%= join_in_course_header(@course, User.current) %></div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
|
|
@ -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) %>
|
||||
|
|
|
@ -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 %>
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
|
||||
<li >
|
||||
<span class="tit_fb ">编程代码:</span>
|
||||
<div class="showHworkP break_word"><pre id="work-src_<%= work.id%>" style="display: none;"><%= work.description ? work.description : "该作品尚未提交相关内容。"%></pre><div class="fontGrey2 font_cus" id="work-code_<%= work.id%>">
|
||||
<div class="showHworkP break_word"><pre id="work-src_<%= work.id%>" style="display: none;"><%= work.description if work.description%></pre><div class="fontGrey2 font_cus" id="work-code_<%= work.id%>">
|
||||
</div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
|
|
|
@ -59,14 +59,9 @@
|
|||
|
||||
<li >
|
||||
<span class="tit_fb ">内容:</span>
|
||||
<% com_contents = work.work_status %>
|
||||
<% if com_contents != 0 && work.description %>
|
||||
<div class="showHworkP break_word upload_img" id="student_work_img_<%= work.id %>">
|
||||
<%= work.description.html_safe %>
|
||||
</div>
|
||||
<% else %>
|
||||
<span style="color: #999999">该作品未在线下完成提交</span>
|
||||
<% end %>
|
||||
<div class="showHworkP break_word upload_img" id="student_work_img_<%=work.id %>">
|
||||
<%= work.description.html_safe if work.description%>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</li>
|
||||
<li >
|
||||
|
|
|
@ -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.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,7 +18,7 @@
|
|||
<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.include?('9') ? "教师" : "教辅"%></p>
|
||||
</div>
|
||||
<li class="<%=(ma.status == 0 || ma.status.nil?) ? 'homepageHomeworkContentWarn2' : 'homepageHomeworkContentWarn' %> fl">
|
||||
<span id="deal_info_<%=ma.id%>">
|
||||
|
|
|
@ -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>
|
|
@ -6,13 +6,29 @@
|
|||
<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>
|
||||
</li>
|
||||
<li class="homepageNewsPubType fl">
|
||||
<% if ma.status == 1 %>
|
||||
<%=link_to ma.user, user_path(ma.user), :class => "newsBlue homepageNewsPublisher", :target => '_blank' %>
|
||||
<span class="<%= ma.viewed == 0 ? "homepageNewsTypeNotRead fl" : "homepageNewsType fl" %>">批准你加入项目:</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>
|
||||
</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="<%= 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>
|
||||
</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="<%= ma.viewed == 0 ? "homepageNewsTypeNotRead fl" : "homepageNewsType fl" %>">您添加新的高校(单位):</span>
|
||||
<li class="homepageNewsContent fl">
|
||||
<%= link_to ma.name + "的申请,因名称不合法,已被拒绝,请重新编辑您的基本资料", { :controller=> "my",:action => "account" } %>
|
||||
</li>
|
||||
<li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li>
|
||||
<% end %>
|
||||
</li>
|
||||
<li class="homepageNewsContent fl">
|
||||
<a class ="#{ma.viewed == 0 ? 'newsBlack' : 'newsGrey'}" target = '_blank'><%= ma.applied.name %></a>
|
||||
</li>
|
||||
<li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li>
|
||||
</ul>
|
||||
<% elsif ma && ma.applied_type == "AppliedProject" %>
|
||||
<ul class="homepageNewsList fl">
|
||||
|
|
|
@ -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>
|
|
@ -18,6 +18,8 @@
|
|||
window.g_redirect_path = '<%= @path %>';
|
||||
<% if @course_id %>
|
||||
window.g_courseid = <%= @course_id %>;
|
||||
<% elsif @project_id %>
|
||||
window.g_projectid = <%= @project_id %>;
|
||||
<% end %>
|
||||
</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'}) %>");
|
|
@ -37,7 +37,7 @@ zh:
|
|||
label_message_acts: 论坛动态
|
||||
label_journalsForMessage_acts: 留言动态
|
||||
label_poll_acts: 问卷动态
|
||||
label_all_cats: 全部动态
|
||||
label_all_cats: 班级动态
|
||||
|
||||
#
|
||||
# 课程托管平台主页
|
||||
|
|
|
@ -2141,21 +2141,21 @@ zh:
|
|||
label_resource_belongs_project: 所属项目
|
||||
|
||||
#微信模板消息
|
||||
label_new_homework_template: 您有新作业了
|
||||
label_update_homework_template: 您的作业已被修改
|
||||
label_course_topic_template: 课程问答区有新帖子发布了
|
||||
label_topic_comment_template: 您的帖子有新回复了
|
||||
label_project_topic_template: 项目讨论区有新帖子发布了
|
||||
label_issue_comment_template: 您的缺陷有新回复了
|
||||
label_notice_comment_template: 您的课程通知有新回复了
|
||||
label_news_comment_template: 您的项目新闻有新回复了
|
||||
label_homework_comment_template: 您的作业有新回复了
|
||||
label_new_second_comment_template: 您有新回复了
|
||||
label_new_journals_template: 您有新留言了
|
||||
label_journals_comment_template: 您的留言有新回复了
|
||||
label_blog_comment_template: 您的博客有新回复了
|
||||
label_new_blog_template: 有新博客了
|
||||
label_new_issue_template: 有新的问题动态了
|
||||
label_new_notice_template: 您的课程有新通知了
|
||||
label_new_homework_template: 您有新作业了。
|
||||
label_update_homework_template: 您的作业已被修改。
|
||||
label_course_topic_template: 课程问答区有新帖子发布了。
|
||||
label_topic_comment_template: 您的帖子有新回复了。
|
||||
label_project_topic_template: 项目讨论区有新帖子发布了。
|
||||
label_issue_comment_template: 您的缺陷有新回复了。
|
||||
label_notice_comment_template: 您的课程通知有新回复了。
|
||||
label_news_comment_template: 您的项目新闻有新回复了。
|
||||
label_homework_comment_template: 您的作业有新回复了。
|
||||
label_new_second_comment_template: 您有新回复了。
|
||||
label_new_journals_template: 您有新留言了。
|
||||
label_journals_comment_template: 您的留言有新回复了。
|
||||
label_blog_comment_template: 您的博客有新回复了。
|
||||
label_new_blog_template: 有新博客了。
|
||||
label_new_issue_template: 有新的问题动态了。
|
||||
label_new_notice_template: 您的课程有新通知了。
|
||||
#edit yk
|
||||
label_code_work_tests: 代码测试列表
|
||||
|
|
|
@ -11,9 +11,9 @@ button:
|
|||
name: "我的课程"
|
||||
url: "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx8e1ab05163a28e37&redirect_uri=https://www.trustie.net/wechat/user_activities&response_type=code&scope=snsapi_base&state=class_list#wechat_redirect"
|
||||
-
|
||||
type: "click"
|
||||
type: "view"
|
||||
name: "我的项目"
|
||||
key: "PROJECT"
|
||||
url: "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx8e1ab05163a28e37&redirect_uri=https://www.trustie.net/wechat/user_activities&response_type=code&scope=snsapi_base&state=project_list#wechat_redirect"
|
||||
-
|
||||
type: "view"
|
||||
name: "我的宝库"
|
||||
|
@ -30,11 +30,11 @@ button:
|
|||
type: "click"
|
||||
name: "加入项目"
|
||||
key: "JOIN_PROJECT"
|
||||
-
|
||||
type: "click"
|
||||
name: "反馈"
|
||||
key: "FEEDBACK"
|
||||
-
|
||||
type: "view"
|
||||
name: "历史推文"
|
||||
url: "http://mp.weixin.qq.com/mp/getmasssendmsg?__biz=MzIwOTM2NDkxMA==#wechat_webview_type=1&wechat_redirect"
|
||||
-
|
||||
type: "click"
|
||||
name: "联系我们"
|
||||
key: "FEEDBACK"
|
||||
|
|
|
@ -2,18 +2,22 @@ button:
|
|||
-
|
||||
type: "view"
|
||||
name: "我的动态"
|
||||
url: "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx8e1ab05163a28e37&redirect_uri=http://www.trustie.net/wechat/user_activities&response_type=code&scope=snsapi_base&state=activities#wechat_redirect"
|
||||
url: "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx8e1ab05163a28e37&redirect_uri=https://www.trustie.net/wechat/user_activities&response_type=code&scope=snsapi_base&state=activities#wechat_redirect"
|
||||
-
|
||||
name: "我的课程"
|
||||
name: "我的群组"
|
||||
sub_button:
|
||||
-
|
||||
type: "view"
|
||||
name: "课程"
|
||||
url: "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx8e1ab05163a28e37&redirect_uri=http://www.trustie.net/wechat/user_activities&response_type=code&scope=snsapi_base&state=class_list#wechat_redirect"
|
||||
name: "我的课程"
|
||||
url: "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx8e1ab05163a28e37&redirect_uri=https://www.trustie.net/wechat/user_activities&response_type=code&scope=snsapi_base&state=class_list#wechat_redirect"
|
||||
-
|
||||
type: "view"
|
||||
name: "资源"
|
||||
url: "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx8e1ab05163a28e37&redirect_uri=http://www.trustie.net/wechat/user_activities&response_type=code&scope=snsapi_base&state=myresource#wechat_redirect"
|
||||
name: "我的项目"
|
||||
url: "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx8e1ab05163a28e37&redirect_uri=https://www.trustie.net/wechat/user_activities&response_type=code&scope=snsapi_base&state=project_list#wechat_redirect"
|
||||
-
|
||||
type: "view"
|
||||
name: "我的宝库"
|
||||
url: "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx8e1ab05163a28e37&redirect_uri=https://www.trustie.net/wechat/user_activities&response_type=code&scope=snsapi_base&state=myresource#wechat_redirect"
|
||||
|
||||
-
|
||||
name: "更多"
|
||||
|
@ -24,9 +28,13 @@ button:
|
|||
key: "JOIN_CLASS"
|
||||
-
|
||||
type: "click"
|
||||
name: "反馈"
|
||||
key: "FEEDBACK"
|
||||
name: "加入项目"
|
||||
key: "JOIN_PROJECT"
|
||||
-
|
||||
type: "view"
|
||||
name: "历史推文"
|
||||
url: "http://mp.weixin.qq.com/mp/getmasssendmsg?__biz=MzIwOTM2NDkxMA==#wechat_webview_type=1&wechat_redirect"
|
||||
-
|
||||
type: "click"
|
||||
name: "联系我们"
|
||||
key: "FEEDBACK"
|
||||
|
|
|
@ -2,22 +2,22 @@ button:
|
|||
-
|
||||
type: "view"
|
||||
name: "我的动态"
|
||||
url: "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxc09454f171153c2d&redirect_uri=https://test.forge.trustie.net/wechat/user_activities&response_type=code&scope=snsapi_base&state=activities#wechat_redirect"
|
||||
url: "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxc09454f171153c2d&redirect_uri=https://test.forge.trustie.net/wechat/user_activities&response_type=code&scope=snsapi_base&state=activities#wechat_redirect"
|
||||
-
|
||||
name: "我的群组"
|
||||
sub_button:
|
||||
-
|
||||
type: "view"
|
||||
name: "我的课程"
|
||||
url: "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxc09454f171153c2d&redirect_uri=https://test.forge.trustie.net/wechat/user_activities&response_type=code&scope=snsapi_base&state=class_list#wechat_redirect"
|
||||
url: "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxc09454f171153c2d&redirect_uri=https://test.forge.trustie.net/wechat/user_activities&response_type=code&scope=snsapi_base&state=class_list#wechat_redirect"
|
||||
-
|
||||
type: "click"
|
||||
type: "view"
|
||||
name: "我的项目"
|
||||
key: "PROJECT"
|
||||
url: "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxc09454f171153c2d&redirect_uri=https://test.forge.trustie.net/wechat/user_activities&response_type=code&scope=snsapi_base&state=project_list#wechat_redirect"
|
||||
-
|
||||
type: "view"
|
||||
name: "我的宝库"
|
||||
url: "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxc09454f171153c2d&redirect_uri=https://test.forge.trustie.net/wechat/user_activities&response_type=code&scope=snsapi_base&state=myresource#wechat_redirect"
|
||||
url: "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxc09454f171153c2d&redirect_uri=https://test.forge.trustie.net/wechat/user_activities&response_type=code&scope=snsapi_base&state=myresource#wechat_redirect"
|
||||
|
||||
-
|
||||
name: "更多"
|
||||
|
@ -30,11 +30,11 @@ button:
|
|||
type: "click"
|
||||
name: "加入项目"
|
||||
key: "JOIN_PROJECT"
|
||||
-
|
||||
type: "click"
|
||||
name: "反馈"
|
||||
key: "FEEDBACK"
|
||||
-
|
||||
type: "view"
|
||||
name: "历史推文"
|
||||
url: "http://mp.weixin.qq.com/mp/getmasssendmsg?__biz=MzIwOTM2NDkxMA==#wechat_webview_type=1&wechat_redirect"
|
||||
-
|
||||
type: "click"
|
||||
name: "联系我们"
|
||||
key: "FEEDBACK"
|
||||
|
|
|
@ -563,6 +563,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 +620,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"
|
||||
|
@ -1075,6 +1078,9 @@ RedmineApp::Application.routes.draw do
|
|||
get 'admin/applied_schools', as: :unapplied_schools
|
||||
get 'admin/has_applied_schools', as: :applied_schools
|
||||
get 'admin/approve_applied_schools'
|
||||
post 'admin/edit_applied_schools'
|
||||
get 'admin/all_schools'
|
||||
delete 'admin/delete_applied_schools'
|
||||
|
||||
get 'admin/leave_messages'
|
||||
match 'admin/messages_list', as: :messages_list
|
||||
|
@ -1155,9 +1161,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 +1248,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'
|
||||
|
|
|
@ -2,19 +2,11 @@ default: &default
|
|||
# corpid: "corpid"
|
||||
# corpsecret: "corpsecret"
|
||||
# agentid: 1
|
||||
#
|
||||
#- # guange test
|
||||
#appid: "wxf694495398c7d470"
|
||||
#secret: "743e038392f1d89540e95f8f7645849a"
|
||||
|
||||
#production
|
||||
appid: "wx8e1ab05163a28e37"
|
||||
secret: "beb4d3bc4b32b3557811680835357841"
|
||||
|
||||
#test
|
||||
# appid: "wxc09454f171153c2d"
|
||||
# secret: "dff5b606e34dcafe24163ec82c2715f8"
|
||||
|
||||
token: "123456"
|
||||
access_token: "1234567"
|
||||
encrypt_mode: false # if true must fill encoding_aes_key
|
||||
|
@ -22,24 +14,14 @@ default: &default
|
|||
#production
|
||||
encoding_aes_key: "QGfP13YP4BbQGkkrlYuxpn4ZIDXpBJww4fxl8CObvNw"
|
||||
jsapi_ticket: "C:/Users/[user_name]/wechat_jsapi_ticket"
|
||||
#
|
||||
# #template
|
||||
|
||||
#template
|
||||
binding_succ_notice: "jjpDrgFErnmkrE9tf2M3o0t31ZrJ7mr0YtuE_wyLaMc"
|
||||
journal_notice: "uC1zAw4F2q6HTA3Pcj8VUO6wKKKiYFwnPJB4iXxpdoM"
|
||||
homework_message_notice: "tCf7teCVqc2vl2LZ_hppIdWmpg8yLcrI8XifxYePjps"
|
||||
class_notice: "MQ_mFupbXP-9jWbeHT3C5xqNBvPo8EIlNv4ULakSpJA"
|
||||
create_class_notice: "2GtJJGzzNlNy2i0UrsjEDlvfSVIUXQfSo47stpcQAVw"
|
||||
|
||||
#test
|
||||
# encoding_aes_key: "QyocNOkRmrT5HzBpCG54EVPUQjk86nJapXNVDQm6Yy6"
|
||||
# jsapi_ticket: "C:/Users/[user_name]/wechat_jsapi_ticket"
|
||||
#
|
||||
# #template
|
||||
# binding_succ_notice: "n4KLwcWNrIMYkKxWL2hUwzunm5RTT54EbWem2MIUapU"
|
||||
# journal_notice: "XpHHYkqSGkwuF9vHthRdmPQLvCFRQ4_NbRBP12T7ciE"
|
||||
# homework_message_notice: "Kom0TsYYKsNKCS6luweYVRo9z-mH0wRPr24b1clGCPQ"
|
||||
# class_notice: "8LVu33l6bP-56SDomVgHn-yJc57YpCwwJ81rAJgRONk"
|
||||
# create_class_notice: "9CDIvHIKiGwPEQWRw_-wieec1o50tMXQPPZIfECKu0I"
|
||||
create_project_notice: "jYu0iimbDpgWYZaTLXioZe2lvqoWTdKnUPyphTJ1mxs"
|
||||
|
||||
production:
|
||||
<<: *default
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue