Merge branch 'develop' into daiao_dev
Conflicts: app/views/layouts/_syllabus_base_info.html.erb
This commit is contained in:
commit
9ff728f080
|
@ -6,10 +6,17 @@ module Mobile
|
|||
resources :blog_comments do
|
||||
|
||||
desc "get special topic"
|
||||
get ':id' do
|
||||
post ':id' do
|
||||
user = current_user
|
||||
|
||||
#0一级回复的更多 1 二级回复的更多
|
||||
type = params[:type] || 0
|
||||
page = params[:page] || 0
|
||||
|
||||
blog = BlogComment.find params[:id]
|
||||
present :data, blog, with: Mobile::Entities::BlogComment,user: user
|
||||
present :data, blog, with: Mobile::Entities::BlogComment,user: user,type: type,page: page
|
||||
present :type, type
|
||||
present :page, page
|
||||
present :status, 0
|
||||
end
|
||||
end
|
||||
|
|
|
@ -200,8 +200,13 @@ module Mobile
|
|||
# course = Course.find(params[:id])
|
||||
cs = CoursesService.new
|
||||
course = cs.show_course(params,current_user)
|
||||
present :data, course, with: Mobile::Entities::Course,user: current_user
|
||||
{ status: 0}
|
||||
|
||||
if course[:course][:is_delete] == 1
|
||||
{status:-1, message: '该班级不存在或已被删除啦' }
|
||||
else
|
||||
present :data, course, with: Mobile::Entities::Course,user: current_user
|
||||
present :status, 0
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -212,7 +217,7 @@ module Mobile
|
|||
get "homeworks/:id" do
|
||||
cs = CoursesService.new
|
||||
homeworks = cs.homework_list params,current_user
|
||||
present :data, homeworks, with: Mobile::Entities::Homework
|
||||
present :data, homeworks, with: Mobile::Entities::Homework,user: current_user
|
||||
present :status, 0
|
||||
end
|
||||
|
||||
|
@ -259,7 +264,7 @@ module Mobile
|
|||
post ":course_id/attachments" do
|
||||
cs = CoursesService.new
|
||||
count = cs.course_attachments params
|
||||
present :data, count, with: Mobile::Entities::Attachment
|
||||
present :data, count, with: Mobile::Entities::Attachment,user: current_user
|
||||
present :status, 0
|
||||
end
|
||||
|
||||
|
@ -392,8 +397,8 @@ module Mobile
|
|||
authenticate!
|
||||
|
||||
course = Course.find(params[:course_id])
|
||||
exercises = course.exercises.where("exercise_status <> 1").order("created_at desc")
|
||||
present :data,exercises,with:Mobile::Entities::Exercise
|
||||
exercises = course.exercises.where("exercise_status <> 1").reorder("created_at desc")
|
||||
present :data,exercises,with:Mobile::Entities::Exercise,user: current_user
|
||||
present :status,0
|
||||
end
|
||||
|
||||
|
|
|
@ -7,11 +7,17 @@ module Mobile
|
|||
include IssuesHelper
|
||||
|
||||
desc "get special issuse"
|
||||
get ':id' do
|
||||
post ':id' do
|
||||
authenticate!
|
||||
user = current_user
|
||||
|
||||
#0一级回复的更多 1 二级回复的更多
|
||||
type = params[:type] || 0
|
||||
page = params[:page] || 0
|
||||
issue = Issue.find params[:id]
|
||||
present :data, issue, with: Mobile::Entities::Issue,user: user
|
||||
present :data, issue, with: Mobile::Entities::Issue,user: user,type: type,page: page
|
||||
present :type, type
|
||||
present :page, page
|
||||
present :status, 0
|
||||
end
|
||||
end
|
||||
|
|
|
@ -6,11 +6,18 @@ module Mobile
|
|||
resources :journal_for_messages do
|
||||
|
||||
desc "get special journal"
|
||||
get ':id' do
|
||||
post ':id' do
|
||||
authenticate!
|
||||
user = current_user
|
||||
|
||||
#0一级回复的更多 1 二级回复的更多
|
||||
type = params[:type] || 0
|
||||
page = params[:page] || 0
|
||||
|
||||
jour = JournalsForMessage.find params[:id]
|
||||
present :data, jour, with: Mobile::Entities::Jours,user: user
|
||||
present :data, jour, with: Mobile::Entities::Jours,user: user,type: type,page: page
|
||||
present :type, type
|
||||
present :page, page
|
||||
present :status, 0
|
||||
end
|
||||
end
|
||||
|
|
|
@ -6,11 +6,17 @@ module Mobile
|
|||
resources :messages do
|
||||
|
||||
desc "get special topic"
|
||||
get ':id' do
|
||||
post ':id' do
|
||||
authenticate!
|
||||
user = current_user
|
||||
|
||||
#0一级回复的更多 1 二级回复的更多
|
||||
type = params[:type] || 0
|
||||
page = params[:page] || 0
|
||||
message = Message.find params[:id]
|
||||
present :data, message, with: Mobile::Entities::Message,user: user
|
||||
present :data, message, with: Mobile::Entities::Message,user: user,type: type,page: page
|
||||
present :type, type
|
||||
present :page, page
|
||||
present :status, 0
|
||||
end
|
||||
end
|
||||
|
|
|
@ -6,11 +6,17 @@ module Mobile
|
|||
resources :newss do
|
||||
|
||||
desc "get special news"
|
||||
get ':id' do
|
||||
post ':id' do
|
||||
authenticate!
|
||||
user = current_user
|
||||
|
||||
#0一级回复的更多 1 二级回复的更多
|
||||
type = params[:type] || 0
|
||||
page = params[:page] || 0
|
||||
news = News.find params[:id]
|
||||
present :data, news, with: Mobile::Entities::News,user: user
|
||||
present :data, news, with: Mobile::Entities::News,user: user,type: type,page: page
|
||||
present :type, type
|
||||
present :page, page
|
||||
present :status, 0
|
||||
end
|
||||
end
|
||||
|
|
|
@ -85,12 +85,26 @@ module Mobile
|
|||
requires :token, type: String
|
||||
requires :course_ids, type: Array[Integer]
|
||||
requires :send_id, type: Integer
|
||||
requires :send_type, type: Integer
|
||||
end
|
||||
post 'send' do
|
||||
authenticate!
|
||||
|
||||
rs = ResourcesService.new
|
||||
ori, flag, save_message = rs.send_resource_to_course(current_user,params)
|
||||
|
||||
ori = nil
|
||||
flag = false
|
||||
save_message = nil
|
||||
|
||||
case params[:send_type]
|
||||
when 1
|
||||
ori, flag, save_message = rs.send_resource_to_course(current_user,params)
|
||||
when 2
|
||||
ori, flag, save_message = rs.send_homework_to_course(current_user,params)
|
||||
when 3
|
||||
ori, flag, save_message = rs.send_exercise_to_course(current_user,params)
|
||||
end
|
||||
|
||||
if flag
|
||||
present :status, 0
|
||||
else
|
||||
|
|
|
@ -6,11 +6,17 @@ module Mobile
|
|||
resources :whomeworks do
|
||||
|
||||
desc "get one homework"
|
||||
get ':id' do
|
||||
post ':id' do
|
||||
authenticate!
|
||||
user = current_user
|
||||
|
||||
#0一级回复的更多 1 二级回复的更多
|
||||
type = params[:type] || 0
|
||||
page = params[:page] || 0
|
||||
homework = HomeworkCommon.find params[:id]
|
||||
present :data, homework, with: Mobile::Entities::Whomework,user: user
|
||||
present :data, homework, with: Mobile::Entities::Whomework,user: user,type: type,page: page
|
||||
present :type, type
|
||||
present :page, page
|
||||
present :status, 0
|
||||
end
|
||||
end
|
||||
|
|
|
@ -25,10 +25,12 @@ module Mobile
|
|||
elsif ac.act_type == "News"
|
||||
ac.nil? || ac.act.nil? ? 0 : ac.act.comments.count
|
||||
elsif ac.act_type == "Message" || ac.act_type == "BlogComment" || ac.act_type == "JournalsForMessage"
|
||||
ac.nil? || ac.act.nil? ? 0 : ac.act.children.count
|
||||
all_comments = []
|
||||
ac.nil? || ac.act.nil? ? 0 : get_all_children(all_comments, ac.act).count
|
||||
elsif ac.act_type == "Issue"
|
||||
ac.nil? || ac.act.nil? ? 0 : ac.act.journals.where("notes is not null and notes != ''").count
|
||||
end
|
||||
|
||||
when :subject
|
||||
if ac.act_type == "HomeworkCommon"
|
||||
ac.act.name unless ac.nil? || ac.act.nil?
|
||||
|
|
|
@ -3,6 +3,7 @@ module Mobile
|
|||
class Attachment < Grape::Entity
|
||||
include Redmine::I18n
|
||||
include ActionView::Helpers::NumberHelper
|
||||
include ApplicationHelper
|
||||
def self.attachment_expose(field)
|
||||
expose field do |f,opt|
|
||||
if f.is_a?(Hash) && f.key?(field)
|
||||
|
@ -22,6 +23,7 @@ module Mobile
|
|||
(number_to_human_size(f.filesize)).gsub("ytes", "").to_s
|
||||
when :coursename
|
||||
f.course.nil? ? "" : f.course.name
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -36,6 +38,12 @@ module Mobile
|
|||
attachment_expose :file_dir
|
||||
attachment_expose :attafile_size
|
||||
attachment_expose :coursename #所属班级名
|
||||
expose :current_user_is_teacher, if: lambda { |instance, options| options[:user] } do |instance, options|
|
||||
current_user = options[:user]
|
||||
current_user_is_teacher = false
|
||||
current_user_is_teacher = is_course_teacher(current_user,instance.course)
|
||||
current_user_is_teacher
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -25,7 +25,9 @@ module Mobile
|
|||
when :act_id
|
||||
u.id
|
||||
when :comment_count
|
||||
u.children.count
|
||||
# u.children.count
|
||||
all_comments = []
|
||||
get_all_children(all_comments, u).count
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -51,7 +53,18 @@ module Mobile
|
|||
blog_comment_expose :praise_count
|
||||
expose :blog_comment_children, using:Mobile::Entities::BlogComment do |c,opt|
|
||||
if c.is_a? (::BlogComment)
|
||||
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|
|
||||
|
@ -61,6 +74,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::BlogComment do |c,opt|
|
||||
if c.is_a? (::BlogComment)
|
||||
#取二级回复的底楼层
|
||||
parents_reply = []
|
||||
parents_reply = get_reply_parents_no_root(parents_reply, c)
|
||||
if parents_reply.count > 0 && !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::BlogComment do |c,opt|
|
||||
if c.is_a? (::BlogComment)
|
||||
#取二级回复的顶楼层
|
||||
parents_reply = []
|
||||
parents_reply = get_reply_parents_no_root(parents_reply, c)
|
||||
if parents_reply.count > 0 && !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
|
|
@ -27,6 +27,14 @@ module Mobile
|
|||
expose :exercise_name
|
||||
expose :exercise_description
|
||||
exercise_expose :coursename #所属班级名
|
||||
|
||||
expose :current_user_is_teacher, if: lambda { |instance, options| options[:user] } do |instance, options|
|
||||
current_user = options[:user]
|
||||
current_user_is_teacher = false
|
||||
current_user_is_teacher = is_course_teacher(current_user,instance.course)
|
||||
current_user_is_teacher
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -98,6 +98,14 @@ module Mobile
|
|||
|
||||
homework_expose :coursename #所属班级名
|
||||
|
||||
expose :current_user_is_teacher, if: lambda { |instance, options| options[:user] } do |instance, options|
|
||||
if instance[:current_user_is_teacher].nil?
|
||||
current_user = options[:user]
|
||||
current_user_is_teacher = false
|
||||
current_user_is_teacher = is_course_teacher(current_user,instance.course)
|
||||
current_user_is_teacher
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -23,7 +23,9 @@ module Mobile
|
|||
when :issue_status
|
||||
IssueStatus.find(issue.status_id).name
|
||||
when :journals_count
|
||||
issue.journals.where("notes is not null and notes != ''").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
|
||||
|
|
|
@ -18,7 +18,9 @@ module Mobile
|
|||
when :lasted_comment
|
||||
time_from_now f.created_on
|
||||
when :reply_count
|
||||
f.children.count
|
||||
# f.children.count
|
||||
all_comments = []
|
||||
get_all_children(all_comments, f).count
|
||||
when :praise_count
|
||||
get_activity_praise_num(f)
|
||||
when :act_type
|
||||
|
|
|
@ -30,6 +30,9 @@ module Mobile
|
|||
'Message'
|
||||
when :act_id
|
||||
u.id
|
||||
when :replies_count
|
||||
all_comments = []
|
||||
get_all_children(all_comments, u).count
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -24,6 +24,9 @@ module Mobile
|
|||
'News'
|
||||
when :act_id
|
||||
f.id
|
||||
when :comments_count
|
||||
all_comments = []
|
||||
get_all_children(all_comments, f).count
|
||||
end
|
||||
end
|
||||
elsif f.is_a?(Hash) && !f.key?(field)
|
||||
|
|
|
@ -507,7 +507,8 @@ class ApplicationController < ActionController::Base
|
|||
# render_404
|
||||
# end
|
||||
|
||||
def self.model_object(model)
|
||||
def self.
|
||||
model_object(model)
|
||||
self.model_object = model
|
||||
end
|
||||
|
||||
|
|
|
@ -144,7 +144,7 @@ class BlogCommentsController < ApplicationController
|
|||
if params[:parent_id]
|
||||
@blogComment.content = params[:blog_comment][:content]
|
||||
parent = BlogComment.find params[:parent_id]
|
||||
@blogComment.reply_id = params[:reply_id]
|
||||
@blogComment.reply_id = params[:id]
|
||||
parent.children << @blogComment
|
||||
else
|
||||
@quote = params[:quote][:quote] || ""
|
||||
|
|
|
@ -161,6 +161,7 @@ class BoardsController < ApplicationController
|
|||
if @project
|
||||
render :action => 'show', :layout => 'base_projects'
|
||||
elsif @course
|
||||
@left_nav_type = 2
|
||||
@params=params
|
||||
render :action => 'show', :layout => 'base_courses'
|
||||
end
|
||||
|
@ -185,6 +186,7 @@ class BoardsController < ApplicationController
|
|||
@board = @project.boards.build
|
||||
@board.safe_attributes = params[:board]
|
||||
if @project.project_type == 1
|
||||
@left_nav_type = 2
|
||||
render :layout => 'base_courses'
|
||||
end
|
||||
end
|
||||
|
@ -206,6 +208,7 @@ class BoardsController < ApplicationController
|
|||
|
||||
def edit
|
||||
if @project.project_type == 1
|
||||
@left_nav_type = 2
|
||||
render :layout => 'base_courses'
|
||||
end
|
||||
end
|
||||
|
|
|
@ -19,8 +19,8 @@ class CommentsController < ApplicationController
|
|||
default_search_scope :news
|
||||
include ApplicationHelper
|
||||
model_object News
|
||||
before_filter :find_model_object
|
||||
before_filter :find_project_from_association
|
||||
before_filter :find_model_object, :except => [:reply, :quote]
|
||||
before_filter :find_project_from_association, :except => [:reply, :quote]
|
||||
before_filter :authorize
|
||||
|
||||
def create
|
||||
|
@ -73,7 +73,46 @@ class CommentsController < ApplicationController
|
|||
|
||||
def destroy
|
||||
@news.comments.find(params[:comment_id]).destroy
|
||||
redirect_to news_url(@news)
|
||||
if params[:user_activity_id]
|
||||
@user_activity_id = params[:user_activity_id]
|
||||
respond_to do |format|
|
||||
format.js
|
||||
return
|
||||
end
|
||||
else
|
||||
redirect_to news_url(@news)
|
||||
end
|
||||
end
|
||||
|
||||
def quote
|
||||
@comment = Comment.find(params[:id])
|
||||
respond_to do | format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
def reply
|
||||
comment = Comment.find(params[:id])
|
||||
@news = News.find comment.commented_id
|
||||
new_comment = @news.comments.build(:author_id => User.current.id, :reply_id => params[:id], :comments => params[:content], :parent_id => comment.id)
|
||||
@user_activity_id = params[:user_activity_id]
|
||||
if new_comment.save
|
||||
update_course_activity(@news.class,@news.id)
|
||||
update_user_activity(@news.class,@news.id)
|
||||
update_org_activity(@news.class,@news.id)
|
||||
if @user_activity_id
|
||||
respond_to do |format|
|
||||
format.js
|
||||
return
|
||||
end
|
||||
else
|
||||
respond_to do |format|
|
||||
format.html {
|
||||
redirect_to news_path(@news)
|
||||
}
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
@ -87,5 +126,4 @@ class CommentsController < ApplicationController
|
|||
@news
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
|
|
@ -301,7 +301,6 @@ class CoursesController < ApplicationController
|
|||
def member
|
||||
## 有角色参数的才是课程,没有的就是项目
|
||||
if (User.current.admin? || @course.is_public == 1 || (@course.is_public == 0 && User.current.member_of_course?(@course)))
|
||||
|
||||
@render_file = 'new_member_list'
|
||||
@score_sort_by = "desc"
|
||||
@sort_type = params[:sort_type] ? params[:sort_type] : "score"
|
||||
|
@ -414,6 +413,9 @@ class CoursesController < ApplicationController
|
|||
end
|
||||
|
||||
def settings
|
||||
#添加成员消息状态
|
||||
join_course_messages = CourseMessage.where("user_id =? and course_message_type =? and course_id =? and status = ? and viewed =?", User.current.id, 'JoinCourse', @course.id, 1, 0)
|
||||
join_course_messages.update_all(:viewed => true)
|
||||
if User.current.allowed_to?(:as_teacher,@course)
|
||||
@select_tab = params[:tab]
|
||||
@issue_custom_fields = IssueCustomField.sorted.all
|
||||
|
@ -886,25 +888,28 @@ class CoursesController < ApplicationController
|
|||
if params[:type].present?
|
||||
case params[:type]
|
||||
when "homework"
|
||||
@course_activities = course_activities.where("course_act_type = 'HomeworkCommon'").order('updated_at desc').limit(10).offset(@page * 10)
|
||||
@course_activities = course_activities.where("course_act_type = 'HomeworkCommon'").order('updated_at desc')
|
||||
when "news"
|
||||
@course_activities = course_activities.where("course_act_type = 'News'").order('updated_at desc').limit(10).offset(@page * 10)
|
||||
@course_activities = course_activities.where("course_act_type = 'News'").order('updated_at desc')
|
||||
when "message"
|
||||
@course_activities = course_activities.where("course_act_type = 'Message'").order('updated_at desc').limit(10).offset(@page * 10)
|
||||
@course_activities = course_activities.where("course_act_type = 'Message'").order('updated_at desc')
|
||||
when "poll"
|
||||
@course_activities = course_activities.where("course_act_type = 'Poll'").order('updated_at desc').limit(10).offset(@page * 10)
|
||||
@course_activities = course_activities.where("course_act_type = 'Poll'").order('updated_at desc')
|
||||
when "attachment"
|
||||
@course_activities = course_activities.where("course_act_type = 'Attachment'").order('updated_at desc').limit(10).offset(@page * 10)
|
||||
@course_activities = course_activities.where("course_act_type = 'Attachment'").order('updated_at desc')
|
||||
when "journalsForMessage"
|
||||
@course_activities = course_activities.where("course_act_type = 'JournalsForMessage'").order('updated_at desc').limit(10).offset(@page * 10)
|
||||
@course_activities = course_activities.where("course_act_type = 'JournalsForMessage'").order('updated_at desc')
|
||||
else
|
||||
@course_activities = course_activities.order('updated_at desc').limit(10).offset(@page * 10)
|
||||
@course_activities = course_activities.order('updated_at desc')
|
||||
end
|
||||
else
|
||||
@course_activities = course_activities.order('updated_at desc').limit(10).offset(@page * 10)
|
||||
@course_activities = course_activities.order('updated_at desc')
|
||||
end
|
||||
@course_activities_count = @course_activities.count
|
||||
@course_activities = @course_activities.limit(10).offset(@page * 10)
|
||||
@type = params[:type]
|
||||
|
||||
@left_nav_type = 1
|
||||
respond_to do |format|
|
||||
format.js
|
||||
format.html{render :layout => 'base_courses'}
|
||||
|
@ -936,6 +941,7 @@ class CoursesController < ApplicationController
|
|||
end
|
||||
@jour = paginateHelper @jours,10
|
||||
@state = false
|
||||
@left_nav_type = 6
|
||||
respond_to do |format|
|
||||
format.html{render :layout => 'base_courses'}
|
||||
format.api
|
||||
|
@ -1119,6 +1125,14 @@ class CoursesController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
#统计
|
||||
def statistics_course
|
||||
@left_nav_type = 9
|
||||
respond_to do |format|
|
||||
format.html {render :layout => 'base_courses'}
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
def update_quotes attachment
|
||||
if attachment.copy_from
|
||||
|
|
|
@ -29,6 +29,7 @@ class ExerciseController < ApplicationController
|
|||
exercises = @course.exercises.where("exercise_status <> 1").order("created_at asc")
|
||||
end
|
||||
@exercises = paginateHelper exercises,20 #分页
|
||||
@left_nav_type = 8
|
||||
respond_to do |format|
|
||||
format.html
|
||||
end
|
||||
|
@ -72,6 +73,7 @@ class ExerciseController < ApplicationController
|
|||
end
|
||||
# @percent = get_percent(@exercise,User.current)
|
||||
@exercise_questions = @exercise.exercise_questions
|
||||
@left_nav_type = 8
|
||||
respond_to do |format|
|
||||
format.html {render :layout => 'base_courses'}
|
||||
end
|
||||
|
@ -118,6 +120,7 @@ class ExerciseController < ApplicationController
|
|||
end
|
||||
|
||||
def edit
|
||||
@left_nav_type = 8
|
||||
respond_to do |format|
|
||||
format.html{render :layout => 'base_courses'}
|
||||
end
|
||||
|
@ -159,6 +162,7 @@ class ExerciseController < ApplicationController
|
|||
@exercise = Exercise.find(params[:id])
|
||||
exercise_questions = @exercise.exercise_questions
|
||||
@exercise_questions = paginateHelper exercise_questions, 5
|
||||
@left_nav_type = 8
|
||||
respond_to do |format|
|
||||
format.html{render :layout => 'base_courses'}
|
||||
end
|
||||
|
@ -379,6 +383,7 @@ class ExerciseController < ApplicationController
|
|||
else
|
||||
@exercise_users_list = []
|
||||
end
|
||||
@left_nav_type = 8
|
||||
respond_to do |format|
|
||||
format.html
|
||||
format.xls {
|
||||
|
@ -566,6 +571,7 @@ class ExerciseController < ApplicationController
|
|||
eu = get_exercise_user(@exercise.id, @user.id)
|
||||
eu.update_attributes(:score => score)
|
||||
@exercise_user = ExerciseUser.where("user_id =? and exercise_id=?", @user.id, @exercise.id).first
|
||||
@left_nav_type = 8
|
||||
respond_to do |format|
|
||||
format.html {render :layout => 'base_courses'}
|
||||
end
|
||||
|
|
|
@ -366,6 +366,7 @@ class FilesController < ApplicationController
|
|||
|
||||
@tag_list = attachment_tag_list @all_attachments
|
||||
|
||||
@left_nav_type = 5
|
||||
render :layout => 'base_courses'
|
||||
elsif params[:org_subfield_id]
|
||||
if params[:sort]
|
||||
|
@ -445,6 +446,7 @@ class FilesController < ApplicationController
|
|||
@versions = @project.versions.sort
|
||||
@course_tag = @project.project_type
|
||||
if @project.project_type == 1
|
||||
@left_nav_type = 5
|
||||
render :layout => 'base_courses'
|
||||
end
|
||||
end
|
||||
|
@ -812,6 +814,7 @@ class FilesController < ApplicationController
|
|||
@attachtype = params[:type].to_i
|
||||
@contenttype = params[:contentType].to_s
|
||||
# render layout: 'base_courses'
|
||||
@left_nav_type = 5
|
||||
respond_to do |format|
|
||||
format.js
|
||||
format.html {
|
||||
|
|
|
@ -39,6 +39,7 @@ class HomeworkCommonController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
@left_nav_type = 3
|
||||
respond_to do |format|
|
||||
format.js
|
||||
format.html
|
||||
|
@ -60,6 +61,7 @@ class HomeworkCommonController < ApplicationController
|
|||
@is_in_course = params[:is_in_course].to_i
|
||||
@course_activity = params[:course_activity].to_i
|
||||
if @is_in_course == 1 || @course_activity == 1
|
||||
@left_nav_type = 3
|
||||
respond_to do |format|
|
||||
format.html{render :layout => 'base_courses'}
|
||||
end
|
||||
|
|
|
@ -432,15 +432,14 @@ class IssuesController < ApplicationController
|
|||
|
||||
def add_journal
|
||||
if User.current.logged?
|
||||
@jour = Journal.new
|
||||
@jour.user_id = User.current.id
|
||||
@jour.notes = params[:notes]
|
||||
@jour.journalized = @issue
|
||||
@jour.save_attachments(params[:attachments])
|
||||
@jour.save
|
||||
jour = Journal.new
|
||||
jour.user_id = User.current.id
|
||||
jour.notes = params[:notes]
|
||||
jour.journalized = @issue
|
||||
jour.save_attachments(params[:attachments])
|
||||
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]
|
||||
|
@ -474,7 +473,6 @@ class IssuesController < ApplicationController
|
|||
def reply
|
||||
@issue = Issue.find(params[:id])
|
||||
@jour = Journal.find(params[:journal_id])
|
||||
@tempContent = "<blockquote>#{ll(Setting.default_language, :text_user_wrote, @jour.user.realname.blank? ? @jour.user.login: @jour.user.realname)} <br/>#{@jour.notes.html_safe}</blockquote>".html_safe
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
|
@ -483,17 +481,17 @@ class IssuesController < ApplicationController
|
|||
#给issue添加journ。回复内容包含 对某个被回复的journ的内容
|
||||
def add_reply
|
||||
if User.current.logged?
|
||||
jour = Journal.new
|
||||
jour.user_id = User.current.id
|
||||
jour.notes = params[:quote]+params[:notes]
|
||||
jour = Journal.find(params[:journal_id])
|
||||
@issue = Issue.find params[:id]
|
||||
jour.journalized = @issue
|
||||
jour.save
|
||||
update_user_activity(@issue.class,@issue.id)
|
||||
update_forge_activity(@issue.class,@issue.id)
|
||||
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.html{redirect_to issue_url(@issue)}
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -502,8 +500,9 @@ class IssuesController < ApplicationController
|
|||
def delete_journal
|
||||
@issue = Issue.find(params[:id])
|
||||
Journal.destroy(params[:journal_id])
|
||||
respond_to do |format|
|
||||
format.html{redirect_to issue_url(@issue)}
|
||||
@user_activity_id = params[:user_activity_id]
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -56,6 +56,7 @@ class MessagesController < ApplicationController
|
|||
all
|
||||
@replies = paginateHelper messages_replies,10
|
||||
@reply = Message.new(:subject => "RE: #{@message.subject}")
|
||||
@left_nav_type = 2
|
||||
render :action => "show", :layout => "base_courses"#by young
|
||||
elsif @project
|
||||
@reply_pages = Paginator.new @reply_count, REPLIES_PER_PAGE, page
|
||||
|
@ -124,6 +125,7 @@ class MessagesController < ApplicationController
|
|||
|
||||
end
|
||||
else
|
||||
@left_nav_type = 2
|
||||
respond_to do |format|
|
||||
format.html {
|
||||
layout_file = @project ? 'base_projects' : 'base_courses'
|
||||
|
@ -140,15 +142,15 @@ class MessagesController < ApplicationController
|
|||
def reply
|
||||
if params[:parent_id]
|
||||
parent = Message.find params[:parent_id]
|
||||
@topic = params[:activity_id].nil? ? parent : Message.find(params[:activity_id].to_i)
|
||||
@reply = Message.new
|
||||
@reply.author = User.current
|
||||
@reply.board = parent.board
|
||||
@reply.content = params[:content]
|
||||
@reply.subject = "RE: #{parent.subject}"
|
||||
@reply.reply_id = params[:reply_id]
|
||||
@reply.subject = "RE: #{@topic.subject}"
|
||||
@reply.reply_id = params[:id]
|
||||
# @reply.reply_id = params[:id]
|
||||
parent.children << @reply
|
||||
@topic = params[:activity_id].nil? ? parent : Message.find(params[:activity_id].to_i)
|
||||
@user_activity_id = params[:user_activity_id] if params[:user_activity_id]
|
||||
@is_course = params[:is_course] if params[:is_course]
|
||||
@is_board = params[:is_board] if params[:is_board]
|
||||
|
@ -241,6 +243,7 @@ class MessagesController < ApplicationController
|
|||
if @project
|
||||
layout_file = 'base_projects'
|
||||
elsif @course
|
||||
@left_nav_type = 2
|
||||
layout_file = 'base_courses'
|
||||
elsif @org_subfield
|
||||
@organization = @org_subfield.organization
|
||||
|
|
|
@ -56,7 +56,7 @@ class NewsController < ApplicationController
|
|||
:order => "#{News.table_name}.created_on DESC",
|
||||
:offset => @page * 10,
|
||||
:limit => 10)
|
||||
|
||||
@left_nav_type = 4
|
||||
respond_to do |format|
|
||||
format.html {
|
||||
@news = News.new # for adding news inline
|
||||
|
@ -136,6 +136,7 @@ class NewsController < ApplicationController
|
|||
@newss = paginateHelper @newss,@limit
|
||||
|
||||
#@newss = paginateHelper scope_order,10
|
||||
@left_nav_type = 4
|
||||
respond_to do |format|
|
||||
format.html {
|
||||
@news = News.new
|
||||
|
@ -176,6 +177,7 @@ class NewsController < ApplicationController
|
|||
if @news.course_id
|
||||
@course = Course.find(@news.course_id)
|
||||
if @course
|
||||
@left_nav_type = 4
|
||||
render :layout => 'base_courses'
|
||||
end
|
||||
elsif @news.org_subfield_id
|
||||
|
@ -279,6 +281,7 @@ class NewsController < ApplicationController
|
|||
@organization = @org_subfield.organization
|
||||
end
|
||||
if @course
|
||||
@left_nav_type = 4
|
||||
render :layout => "base_courses"
|
||||
elsif @org_subfield
|
||||
render :layout => 'base_org'
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
class OrgDocumentCommentsController < ApplicationController
|
||||
before_filter :find_organization, :only => [:new, :create, :show, :index]
|
||||
before_filter :authorize_allowed, :only => [:create, :add_reply]
|
||||
before_filter :authorize_allowed, :only => [:create, :add_reply, :add_reply_in_doc]
|
||||
helper :attachments,:organizations
|
||||
layout 'base_org'
|
||||
|
||||
|
|
|
@ -15,6 +15,7 @@ class PollController < ApplicationController
|
|||
polls = Poll.where("polls_type = 'Course' and polls_group_id = #{@course.id} and polls_status = 2")
|
||||
end
|
||||
@polls = paginateHelper polls,20 #分页
|
||||
@left_nav_type = 7
|
||||
respond_to do |format|
|
||||
format.html{render :layout => 'base_courses'}
|
||||
end
|
||||
|
@ -25,7 +26,7 @@ class PollController < ApplicationController
|
|||
|
||||
def show
|
||||
@poll = Poll.find params[:id]
|
||||
if @poll.polls_status != 2 && (!User.current.allowed_to?(:as_teacher,@course) || User.current.admin?)
|
||||
if @poll.polls_status != 2 && !(User.current.allowed_to?(:as_teacher,@course) || User.current.admin?)
|
||||
render_403
|
||||
return
|
||||
end
|
||||
|
@ -44,6 +45,7 @@ class PollController < ApplicationController
|
|||
@percent = get_percent(@poll,User.current)
|
||||
poll_questions = @poll.poll_questions
|
||||
@poll_questions = paginateHelper poll_questions,5 #分页
|
||||
@left_nav_type = 7
|
||||
respond_to do |format|
|
||||
format.html {render :layout => 'base_courses'}
|
||||
end
|
||||
|
@ -78,6 +80,7 @@ class PollController < ApplicationController
|
|||
|
||||
def edit
|
||||
respond_to do |format|
|
||||
@left_nav_type = 7
|
||||
format.html{render :layout => 'base_courses'}
|
||||
end
|
||||
end
|
||||
|
@ -112,6 +115,7 @@ class PollController < ApplicationController
|
|||
@poll = Poll.find(params[:id])
|
||||
poll_questions = @poll.poll_questions
|
||||
@poll_questions = paginateHelper poll_questions, 5
|
||||
@left_nav_type = 7
|
||||
respond_to do |format|
|
||||
format.html{render :layout => 'base_courses'}
|
||||
end
|
||||
|
@ -393,6 +397,7 @@ class PollController < ApplicationController
|
|||
#显示某个学生某份问卷的填写结果
|
||||
def poll_result
|
||||
@poll_questions = paginateHelper @poll.poll_questions,5
|
||||
@left_nav_type = 7
|
||||
respond_to do |format|
|
||||
format.html{render :layout => 'base_courses'}
|
||||
end
|
||||
|
|
|
@ -300,15 +300,13 @@ class ProjectsController < ApplicationController
|
|||
return
|
||||
end
|
||||
|
||||
logger.debug "111111111"*100
|
||||
# over
|
||||
@author = params[:user_id].blank? ? nil : User.active.find(params[:user_id])
|
||||
@page = params[:page] ? params[:page].to_i + 1 : 0
|
||||
# 根据私密性,取出符合条件的所有数据
|
||||
if User.current.member_of?(@project) || User.current.admin?
|
||||
case params[:type]
|
||||
when nil
|
||||
@events_pages = ForgeActivity.where("project_id = ? and forge_act_type in ('Issue', 'Message','News', 'Project', 'Attachment')", @project).includes(:forge_act).order("updated_at desc").limit(10).offset(@page * 10)
|
||||
@events_pages = ForgeActivity.where("project_id = ? and forge_act_type in ('Issue', 'Message','News', 'Project', 'Attachment','Commit')", @project).includes(:forge_act).order("updated_at desc").limit(10).offset(@page * 10)
|
||||
when 'issue'
|
||||
@events_pages = ForgeActivity.where("project_id = ? and forge_act_type = 'Issue'", @project).includes(:forge_act).order("updated_at desc").limit(10).offset(@page * 10)
|
||||
when 'news'
|
||||
|
@ -321,8 +319,8 @@ class ProjectsController < ApplicationController
|
|||
else
|
||||
@events_pages = ForgeActivity.includes(:project).where("forge_activities.project_id = ? and projects.is_public = ? and forge_act_type != ? ",@project,1, "Document").order("created_at desc").page(params['page'|| 1]).per(10);
|
||||
end
|
||||
logger.debug "2"*100
|
||||
# g = Gitlab.client
|
||||
|
||||
# 版本库统计图
|
||||
unless @project.gpid.nil? || @project.project_score.changeset_num == 0
|
||||
# rep_statics_commit = @project.rep_statics.order("commits_num desc")
|
||||
rep_statics_commit = RepStatics.find_by_sql("SELECT * FROM `rep_statics` where project_id = #{@project.id} order by commits_num desc limit 10")
|
||||
|
@ -335,20 +333,14 @@ class ProjectsController < ApplicationController
|
|||
@a_commits_del = rep_statics_code.map {|s| s.del.to_i }
|
||||
@a_commits_changeset = rep_statics_code.map {|s| s.changeset.to_i }
|
||||
g = Gitlab.client
|
||||
logger.debug "3"*100
|
||||
begin
|
||||
gid = @project.gpid
|
||||
logger.debug "31"*100
|
||||
g_branch = g.project(gid)
|
||||
logger.debug "4"*100
|
||||
g_branch = g_branch.default_branch.to_s
|
||||
logger.debug "5"*100
|
||||
g_project = g.project(gid)
|
||||
g_branch = g_project.default_branch.to_s
|
||||
rescue =>e
|
||||
logger.error("get gitlab project failed: " + e)
|
||||
logger.error("get default branch failed: " + e)
|
||||
end
|
||||
logger.debug "6"*100
|
||||
@rev = g_branch.nil? ? "master" : g_branch
|
||||
logger.debug "7"*100
|
||||
end
|
||||
# 根据对应的请求,返回对应的数据
|
||||
respond_to do |format|
|
||||
|
|
|
@ -165,7 +165,7 @@ class QualityAnalysisController < ApplicationController
|
|||
logger.info("result: delete job ###################==>#{d_job}")
|
||||
qa.delete
|
||||
respond_to do |format|
|
||||
format.html{redirect_to project_quality_analysis_path(:project_id => @project.id)}
|
||||
format.html{redirect_to :controller => 'repositories', :action => 'show', :id => @project, :repository_id => gitlab_repository(@project).identifier}
|
||||
end
|
||||
rescue Exception => e
|
||||
puts e
|
||||
|
@ -199,9 +199,6 @@ class QualityAnalysisController < ApplicationController
|
|||
|
||||
# update成功则返回 ‘200’
|
||||
jenkins_job = @client.job.update("#{job_name}", @doc.to_xml)
|
||||
get_current_build_status = @client.job.get_current_build_status("Hjqreturn-1280")
|
||||
logger.error("Failed to update job: ==> #{jenkins_job}") unless jenkins_job == '200'
|
||||
|
||||
# 数据更新到Trustie数据
|
||||
if jenkins_job == '200'
|
||||
logger.info("quality_ananlysis will be updated: ==> #{jenkins_job}")
|
||||
|
|
|
@ -48,7 +48,7 @@ class RepositoriesController < ApplicationController
|
|||
include RepositoriesHelper
|
||||
helper :project_score
|
||||
#@root_path = RepositoriesHelper::ROOT_PATH
|
||||
require 'net/ssh'
|
||||
# require 'net/ssh'
|
||||
|
||||
rescue_from Redmine::Scm::Adapters::CommandFailed, :with => :show_error_command_failed
|
||||
def new
|
||||
|
|
|
@ -536,6 +536,7 @@ class StudentWorkController < ApplicationController
|
|||
@is_focus = params[:is_focus] ? params[:is_focus].to_i : 0
|
||||
# 消息传过来的ID
|
||||
@message_student_work_id = params[:student_work_id]
|
||||
@left_nav_type = 3
|
||||
respond_to do |format|
|
||||
format.js
|
||||
format.html
|
||||
|
@ -928,6 +929,7 @@ class StudentWorkController < ApplicationController
|
|||
ORDER BY absence #{order}")
|
||||
end
|
||||
@order = order == "desc" ? "asc" : "desc"
|
||||
@left_nav_type = 3
|
||||
respond_to do |format|
|
||||
format.html
|
||||
end
|
||||
|
|
|
@ -13,7 +13,6 @@ class SyllabusesController < ApplicationController
|
|||
end
|
||||
|
||||
def show
|
||||
#@courses = @syllabus.courses
|
||||
respond_to do |format|
|
||||
format.js
|
||||
format.html{render :layout => 'base_syllabus'}
|
||||
|
@ -109,11 +108,7 @@ class SyllabusesController < ApplicationController
|
|||
sort_name = "updated_on"
|
||||
sort_type = @c_sort == 1 ? "asc" : "desc"
|
||||
|
||||
if User.current == @syllabus.user || User.current.admin?
|
||||
@courses = @syllabus.courses.where("is_delete = 0").select("courses.*,(SELECT MAX(updated_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS #{sort_name}").order("#{sort_name} #{sort_type}")
|
||||
else
|
||||
@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 #{sort_name}").order("#{sort_name} #{sort_type}")
|
||||
end
|
||||
@courses = @syllabus.courses.where("is_delete = ?", 0).select("courses.*,(SELECT MAX(updated_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS #{sort_name}").order("#{sort_name} #{sort_type}")
|
||||
|
||||
#根据 作业+资源数排序
|
||||
if @order.to_i == 2
|
||||
|
|
|
@ -94,6 +94,12 @@ class UsersController < ApplicationController
|
|||
@comment = Message.find params[:comment].to_i
|
||||
when 'BlogComment'
|
||||
@comment = BlogComment.find params[:comment].to_i
|
||||
when 'OrgDocumentComment'
|
||||
@comment = OrgDocumentComment.find params[:comment].to_i
|
||||
when 'Comment'
|
||||
@comment = Comment.find params[:comment].to_i
|
||||
when 'Journal'
|
||||
@comment = Journal.find params[:comment].to_i
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -133,6 +139,16 @@ class UsersController < ApplicationController
|
|||
@user_activity_id = params[:user_activity_id]
|
||||
@activity_id = params[:activity_id]
|
||||
@type = 'OrgDocumentComment'
|
||||
when 'News'
|
||||
@reply = Comment.find params[:reply_id]
|
||||
@user_activity_id = params[:user_activity_id]
|
||||
@activity_id = params[:activity_id]
|
||||
@type = 'News'
|
||||
when 'Issue'
|
||||
@reply = Journal.find params[:reply_id]
|
||||
@user_activity_id = params[:user_activity_id]
|
||||
@activity_id = params[:activity_id]
|
||||
@type = 'Issue'
|
||||
end
|
||||
respond_to do |format|
|
||||
format.js
|
||||
|
@ -709,9 +725,9 @@ class UsersController < ApplicationController
|
|||
@user = User.current
|
||||
@select_course = params[:select_course] ? 1 : 0
|
||||
#@user_homeworks = HomeworkCommon.where(:user_id => @user.id).order("created_at desc")
|
||||
visible_course = Course.where("is_public = 1 && is_delete = 0")
|
||||
visible_course_ids = visible_course.empty? ? "(-1)" : "(" + visible_course.map{|course| course.id}.join(",") + ")"
|
||||
@homeworks = HomeworkCommon.where("course_id in #{visible_course_ids} and publish_time <= '#{Date.today}'").order("created_at desc")
|
||||
courses = @user.courses.where("is_delete = 1")
|
||||
course_ids = courses.empty? ? "(-1)" : "(" + courses.map{|course| course.id}.join(",") + ")"
|
||||
@homeworks = HomeworkCommon.where("user_id = #{@user.id} and publish_time <= '#{Date.today}' and course_id not in #{course_ids}").order("#{@order} #{@b_sort}")
|
||||
@type = params[:type]
|
||||
@limit = 15
|
||||
@is_remote = true
|
||||
|
@ -933,6 +949,7 @@ class UsersController < ApplicationController
|
|||
@student_work = StudentWork.new
|
||||
end
|
||||
@course = @homework.course
|
||||
@left_nav_type = 3
|
||||
respond_to do |format|
|
||||
format.js
|
||||
format.html {render :layout => 'base_courses'}
|
||||
|
@ -1549,7 +1566,11 @@ class UsersController < ApplicationController
|
|||
when "current_user"
|
||||
@user_activities = UserActivity.where("user_id = #{@user.id} and ((container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types}) or (container_type = 'Course' and container_id in #{user_course_ids} and act_type in #{course_types}))").order('updated_at desc').limit(10).offset(@page * 10)
|
||||
else
|
||||
blog_ids = "("+@user.blog.id.to_s+","+((User.watched_by(@user.id).count == 0 )? '0' :User.watched_by(@user.id).map{|u| u.blog.id}.join(','))+")"
|
||||
if @user == User.current
|
||||
blog_ids = "("+@user.blog.id.to_s+","+((User.watched_by(@user.id).count == 0 )? '0' :User.watched_by(@user.id).map{|u| u.blog.id}.join(','))+")"
|
||||
else
|
||||
blog_ids = "("+@user.blog.id.to_s+")"
|
||||
end
|
||||
@user_activities = UserActivity.where("(container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types})" +
|
||||
"or (container_type = 'Course' and container_id in #{user_course_ids} and act_type in #{course_types}) "+
|
||||
"or (container_type = 'Principal' and act_type= '#{principal_types}' and container_id = #{@user.id}) " +
|
||||
|
@ -1559,8 +1580,12 @@ class UsersController < ApplicationController
|
|||
# @user_activities = UserActivity.where("(container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types}) or (container_type = 'Course' and container_id in #{user_course_ids} and act_type in #{course_types})or (container_type = 'Principal' and act_type= '#{principal_types}' and container_id = #{@user.id})").order('updated_at desc').limit(10).offset(@page * 10)
|
||||
# blog_ids = "("+@user.blog.id.to_s+","+((User.watched_by(@user.id).count == 0 )? '0' :User.watched_by(@user.id).map{|u| u.blog.id}.join(','))+")"
|
||||
# 减少数据库交互
|
||||
watched_user_ids = User.watched_by(@user.id).count == 0 ? " " : ("," + User.watched_by(@user.id).map{|u| u.id.to_s }.join(','))
|
||||
user_ids = "(" + @user.id.to_s + watched_user_ids + ")"
|
||||
if @user == User.current
|
||||
watched_user_ids = User.watched_by(@user.id).count == 0 ? " " : ("," + User.watched_by(@user.id).map{|u| u.id.to_s }.join(','))
|
||||
user_ids = "(" + @user.id.to_s + watched_user_ids + ")"
|
||||
else
|
||||
user_ids = "(" + @user.id.to_s + ")"
|
||||
end
|
||||
watched_user_blog_ids = Blog.select("id").where("author_id in #{user_ids}")
|
||||
blog_ids = watched_user_blog_ids.empty? ? "(-1)" : "(" + watched_user_blog_ids.map { |blog| blog.id}.join(",") + ")"
|
||||
|
||||
|
@ -3312,19 +3337,22 @@ class UsersController < ApplicationController
|
|||
when 'News'
|
||||
obj = News.where('id = ?', params[:id].to_i).first
|
||||
@journals = obj.comments.reorder("created_on desc")
|
||||
@type = 'News'
|
||||
@user_activity_id = params[:div_id].to_i if params[:div_id]
|
||||
when 'Syllabus'
|
||||
obj = Syllabus.where('id = ?', params[:id].to_i).first
|
||||
@journals = obj.comments.reorder("created_on desc")
|
||||
@journals = obj.journals_for_messages.reorder("created_on desc")
|
||||
when 'JournalsForMessage'
|
||||
obj = JournalsForMessage.where('id = ?', params[:id].to_i).first
|
||||
journals = []
|
||||
@journals = get_all_children(journals, obj)
|
||||
@type = 'JournalsForMessage'
|
||||
@user_activity_id = params[:div_id].to_i if params[:div_id]
|
||||
@allow_delete = params[:allow_delete]
|
||||
when 'Issue'
|
||||
obj = Issue.where('id = ?', params[:id].to_i).first
|
||||
@journals = obj.journals.reorder("created_on desc")
|
||||
@type = 'Issue'
|
||||
@user_activity_id = params[:div_id].to_i if params[:div_id]
|
||||
when 'BlogComment'
|
||||
obj = BlogComment.where('id = ?', params[:id].to_i).first
|
||||
@user_activity_id = params[:div_id].to_i if params[:div_id]
|
||||
|
@ -3334,6 +3362,7 @@ class UsersController < ApplicationController
|
|||
@journals = get_all_children(comments, obj)
|
||||
when 'HomeworkCommon'
|
||||
obj = HomeworkCommon.where('id = ?', params[:id].to_i).first
|
||||
@type = 'HomeworkCommon'
|
||||
@journals = obj.journals_for_messages.reorder("created_on desc")
|
||||
@is_in_course = params[:is_in_course].to_i if params[:is_in_course]
|
||||
@course_activity = params[:course_activity].to_i if params[:course_activity]
|
||||
|
|
|
@ -78,12 +78,7 @@ class WechatsController < ActionController::Base
|
|||
end
|
||||
# When user view URL in the menu button
|
||||
on :view, with: 'http://wechat.somewhere.com/view_url' do |request, view|
|
||||
uw = user_binded?(request[:FromUserName])
|
||||
unless uw
|
||||
sendBind(request)
|
||||
else
|
||||
request.reply.text "#{request[:FromUserName]} view #{view}"
|
||||
end
|
||||
request.reply.text "#{request[:FromUserName]} view #{view}"
|
||||
end
|
||||
|
||||
# When user sent the imsage
|
||||
|
@ -147,6 +142,14 @@ class WechatsController < ActionController::Base
|
|||
default_msg(request)
|
||||
end
|
||||
|
||||
on :click, with: 'PROJECT' do |request, key|
|
||||
request.reply.text "此功能正在开发中,很快就会上线,谢谢!"
|
||||
end
|
||||
|
||||
on :click, with: 'JOIN_PROJECT' do |request, key|
|
||||
request.reply.text "此功能正在开发中,很快就会上线,谢谢!"
|
||||
end
|
||||
|
||||
on :click, with: 'JOIN_CLASS' do |request, key|
|
||||
uw = user_binded?(request[:FromUserName])
|
||||
unless uw
|
||||
|
@ -218,8 +221,8 @@ class WechatsController < ActionController::Base
|
|||
raise CoursesService::JoinCourseError.message(status[:state])
|
||||
end
|
||||
|
||||
news = (1..1).each_with_object([]) { |n, memo| memo << { title: '恭喜您成功加入班级,开始学习吧!',
|
||||
content: "课程名称: #{course.name}\n班级名称: #{course.name}\n任课老师: #{course.teacher.show_name}\n进入班级,和小伙伴愉快的学习吧!"} }
|
||||
news = (1..1).each_with_object([]) { |n, memo| memo << { title: '恭喜您成功加入班级,开始学习吧!',
|
||||
content: "课程名称:#{course.name}\n班级名称:#{course.name}\n任课老师:#{course.teacher.show_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#/class?id='+course.id.to_s}&response_type=code&scope=snsapi_base&state=myclass#wechat_redirect"
|
||||
pic_url = "#{ROOT_URL}/images/wechat/class.jpg"
|
||||
|
@ -274,7 +277,7 @@ class WechatsController < ActionController::Base
|
|||
user: user
|
||||
)
|
||||
ws = WechatService.new
|
||||
ws.binding_succ_notice(user.id, "您已成功绑定Trustie平台", user.login, format_time(Time.now))
|
||||
ws.binding_succ_notice(user.id, "您已成功绑定Trustie平台!", user.login, format_time(Time.now))
|
||||
render :json => {status:0, msg: "绑定成功"}
|
||||
rescue Exception=>e
|
||||
render :json => {status: -1, msg: e.message}
|
||||
|
|
|
@ -38,6 +38,24 @@ module ApplicationHelper
|
|||
# super
|
||||
# end
|
||||
|
||||
# 通过系统外部邮箱查找用户,如果用户不存在则用邮箱替换
|
||||
def get_user_by_mail mail
|
||||
user = User.find_by_mail(mail)
|
||||
user.nil? ? User.find(2) : user
|
||||
end
|
||||
|
||||
# 历史数据(老版本库数据)处理完则可以修改该放放
|
||||
def get_rep_identifier_by_project project
|
||||
identifier = Repository.where(:project_id => project.id, :type => "Repository::Gitlab").first.try(:identifier)
|
||||
result = identifier.nil? ? Repository.where(:project_id => project.id).first.try(:identifier) : identifier
|
||||
result
|
||||
end
|
||||
|
||||
# 获取用户单位
|
||||
# 优先获取高校信息,如果改信息不存在则获取occupation
|
||||
def get_occupation_from_user user
|
||||
School.where("id=?",user.user_extensions.school_id).first.try(:name).nil? ? user.user_extensions.try(:occupation) : School.where("id=?",user.user_extensions.school_id).first.try(:name)
|
||||
end
|
||||
|
||||
def update_visiti_count container
|
||||
container.update_column(:visits, container.visits + 1)
|
||||
|
|
|
@ -35,7 +35,7 @@ module CoursesHelper
|
|||
and (c.is_excellent =1 or c.excellent_option =1) and c.is_public = 1 and c.id != #{current_course.id} order by cs.updated_at desc;"
|
||||
default_ids = Course.find_by_sql(sql).flatten.map { |c| c.id }
|
||||
excellent_ids << default_ids.flatten
|
||||
arr_result = excellent_ids.flatten.uniq.first(5)
|
||||
arr_result = excellent_ids.flatten.uniq.first(3)
|
||||
excellent_courses = Course.find(arr_result)
|
||||
return excellent_courses
|
||||
end
|
||||
|
@ -78,18 +78,18 @@ module CoursesHelper
|
|||
#生成课程老师成员链接
|
||||
def course_teacher_link teacher_num
|
||||
if User.current.member_of_course?(@course) || User.current.admin?
|
||||
link_to "#{teacher_num}", course_member_path(@course, :role => 1), :class => 'info_foot_num c_blue', :id => 'teacher_number'
|
||||
link_to "#{teacher_num}", course_member_path(@course, :role => 1), :class => 'sy_cblue', :id => 'teacher_number'
|
||||
else
|
||||
content_tag 'span',teacher_num, :class => 'info_foot_num c_blue'
|
||||
content_tag 'span',teacher_num, :class => 'sy_cblue'
|
||||
end
|
||||
end
|
||||
|
||||
#生成课程学生列表连接
|
||||
def course_student_link student_num
|
||||
if (User.current.logged? && @course.open_student == 1) || (User.current.member_of_course?(@course)) || User.current.admin?
|
||||
link_to "#{student_num}", course_member_path(@course, :role => 2), :class => 'info_foot_num c_blue', :id => "student_number"
|
||||
link_to "#{student_num}", course_member_path(@course, :role => 2), :class => 'sy_cblue', :id => "student_number"
|
||||
else
|
||||
content_tag 'span',student_num, :class => 'info_foot_num c_blue'
|
||||
content_tag 'span',student_num, :class => 'sy_cblue'
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -792,12 +792,12 @@ module CoursesHelper
|
|||
url = joined ? join_path(:object_id => course.id) : try_join_path(:object_id => course.id)
|
||||
method = joined ? 'delete' : 'post'
|
||||
if joined
|
||||
link = link_to(text, url, :remote => true, :method => method, :class => "Blue-btn", :style => "margin_left: 0px;", :id => "#{course.id}", :confirm => l(:text_are_you_sure_out))
|
||||
link = link_to(text, url, :remote => true, :method => method, :class => "sy_btn_grey fl", :id => "#{course.id}", :confirm => l(:text_are_you_sure_out))
|
||||
else
|
||||
link = link_to(text, url, :remote => true, :method => method, :id => "#{course.id}", :class => "Blue-btn", :style => "margin_left: 0px;")
|
||||
link = link_to(text, url, :remote => true, :method => method, :id => "#{course.id}", :class => "sy_btn_grey fl")
|
||||
end
|
||||
else
|
||||
link = "<span class='pr_join_span mr5' >#{l(:label_course_join_student)}</span>"
|
||||
link = "<a href='javascript:void(0)' class='sy_btn_grey fl ml10' >#{l(:label_course_join_student)}</a>"
|
||||
end
|
||||
link.html_safe
|
||||
end
|
||||
|
@ -892,7 +892,7 @@ module CoursesHelper
|
|||
desc.html_safe
|
||||
end
|
||||
|
||||
# 学生按作业总分排序,取前8个
|
||||
# 学生按作业总分排序,取前3个
|
||||
def hero_homework_score(course, score_sort_by)
|
||||
sql_select = "SELECT members.*,(
|
||||
SELECT SUM(work_score)
|
||||
|
@ -904,14 +904,14 @@ module CoursesHelper
|
|||
FROM members
|
||||
JOIN students_for_courses
|
||||
ON students_for_courses.student_id = members.user_id AND students_for_courses.course_id = members.course_id
|
||||
WHERE members.course_id = #{course.id} ORDER BY score #{score_sort_by} limit 9"
|
||||
WHERE members.course_id = #{course.id} ORDER BY score #{score_sort_by} limit 3"
|
||||
homework_scores = Member.find_by_sql(sql_select)
|
||||
end
|
||||
|
||||
def contributor_course_scor(course_id)
|
||||
ccs = CourseContributorScore.find_by_sql("SELECT * FROM `course_contributor_scores` where course_id = #{course_id} order by
|
||||
(message_num*2 + message_reply_num + news_reply_num + news_num +
|
||||
resource_num*5 + journal_num + homework_journal_num ) desc limit 9;")
|
||||
resource_num*5 + journal_num + homework_journal_num ) desc limit 3;")
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
#coding=utf-8
|
||||
#
|
||||
|
||||
module WechatsHelper
|
||||
def include_wechat_jsfile
|
||||
if Rails.env.production?
|
||||
javascript_include_tag '/javascripts/wechat/build/app.min.js'
|
||||
else
|
||||
wechat_path = File.join(Rails.root, "public", "javascripts", "wechat")
|
||||
srcs = Rails.application.config.wechat_srcs
|
||||
paths = []
|
||||
srcs.each do |src|
|
||||
Dir.glob(wechat_path+ "/#{src}" ) do |path|
|
||||
paths << path[File.join(Rails.root, "public").to_s.size, path.size]
|
||||
end
|
||||
end
|
||||
javascript_include_tag *paths
|
||||
end
|
||||
end
|
||||
end
|
|
@ -22,9 +22,7 @@ class Changeset < ActiveRecord::Base
|
|||
#after_save :be_user_score # user_score
|
||||
|
||||
has_many :filechanges, :class_name => 'Change', :dependent => :delete_all
|
||||
# fq
|
||||
has_many :acts, :class_name => 'Activity', :as => :act, :dependent => :destroy
|
||||
# end
|
||||
has_many :forge_acts, :class_name => 'ForgeActivity',:as =>:forge_act ,:dependent => :destroy
|
||||
|
||||
#Added by nie
|
||||
has_one :project_status, :dependent => :destroy
|
||||
|
@ -59,7 +57,6 @@ class Changeset < ActiveRecord::Base
|
|||
validates :committed_on, presence: true
|
||||
validates :commit_date, presence: true
|
||||
validates :scmid, uniqueness: {scope: :repository_id, allow_nil: true}
|
||||
|
||||
scope :visible, lambda {|*args|
|
||||
includes(:repository => :project).where(Project.allowed_to_condition(args.shift || User.current, :view_changesets, *args))
|
||||
}
|
||||
|
@ -68,7 +65,7 @@ class Changeset < ActiveRecord::Base
|
|||
# after_update :be_user_score
|
||||
after_destroy :down_user_score
|
||||
# before_create :before_create_cs
|
||||
after_create :act_as_forge_activity
|
||||
# after_create :act_as_forge_activity
|
||||
|
||||
|
||||
def revision=(r)
|
||||
|
@ -118,7 +115,7 @@ class Changeset < ActiveRecord::Base
|
|||
# 项目中提交动态,类型Changeset
|
||||
# type:0 为老版本即Trsutie数据 1为gitlab中获取的动态
|
||||
def act_as_forge_activity
|
||||
self.acts << ForgeActivity.new(:user_id => self.user_id, :project_id => self.project_id, :type => true)
|
||||
self.forge_acts << ForgeActivity.new(:user_id => self.user_id, :project_id => self.project_id, :type => true)
|
||||
end
|
||||
|
||||
def scan_for_issues
|
||||
|
|
|
@ -33,10 +33,11 @@ class Comment < ActiveRecord::Base
|
|||
:title=>Proc.new {|o| "RE: #{o.commented.title}" },
|
||||
:url => Proc.new {|o| {:controller => 'news', :action => 'show', :id => o.commented.id} }
|
||||
|
||||
acts_as_tree :counter_cache => :comments_count, :order => "#{Comment.table_name}.created_on ASC"
|
||||
belongs_to :commented, :polymorphic => true, :counter_cache => true,:touch => true
|
||||
belongs_to :author, :class_name => 'User', :foreign_key => 'author_id'
|
||||
validates_presence_of :commented, :author, :comments
|
||||
safe_attributes 'comments'
|
||||
safe_attributes 'comments','parent_id','reply_id','comments_count'
|
||||
after_create :send_mail, :act_as_system_message, :act_as_student_score
|
||||
after_destroy :down_course_score
|
||||
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
class Commit < ActiveRecord::Base
|
||||
attr_accessible :comments, :committed_on, :committer, :project_id, :repository_id, :version
|
||||
validates :repository_id, presence: true
|
||||
validates :version, presence: true, uniqueness: {scope: :repository_id}
|
||||
validates :committed_on, presence: true
|
||||
has_many :forge_acts, :class_name => 'ForgeActivity',:as =>:forge_act ,:dependent => :destroy
|
||||
after_create :act_as_forge_activity
|
||||
|
||||
# 项目中提交动态
|
||||
def act_as_forge_activity
|
||||
self.forge_acts << ForgeActivity.new(:user_id => 2, :project_id => self.project_id)
|
||||
end
|
||||
end
|
|
@ -25,8 +25,11 @@ class ForgeActivity < ActiveRecord::Base
|
|||
|
||||
# 在个人动态里面增加当前动态
|
||||
# 版本库提交动态不显示在用户动态中
|
||||
# Commit为版本库提交类型,因为是从gitlab获取,不能实时更新
|
||||
def add_user_activity
|
||||
if self.forge_act_type != "Changeset"
|
||||
if self.forge_act_type == "Commit"
|
||||
self.update_column(:updated_at, self.forge_act.committed_on)
|
||||
else
|
||||
user_activity = UserActivity.where("act_type = '#{self.forge_act_type.to_s}' and act_id = '#{self.forge_act_id}'").first
|
||||
if user_activity
|
||||
user_activity.save
|
||||
|
@ -50,7 +53,9 @@ class ForgeActivity < ActiveRecord::Base
|
|||
|
||||
# 项目提交动态不显示在组织动态中
|
||||
def add_org_activity
|
||||
if self.forge_act_type != "Changeset"
|
||||
if self.forge_act_type == "Commit"
|
||||
self.update_column(:updated_at, self.forge_act.committed_on)
|
||||
else
|
||||
org_activity = OrgActivity.where("org_act_type = '#{self.forge_act_type.to_s}' and org_act_id = #{self.forge_act_id}").first
|
||||
if org_activity
|
||||
org_activity.updated_at = self.updated_at
|
||||
|
|
|
@ -37,6 +37,7 @@ class Journal < ActiveRecord::Base
|
|||
has_many :at_messages, as: :at_message, dependent: :destroy
|
||||
acts_as_attachable
|
||||
attr_accessor :indice
|
||||
acts_as_tree :counter_cache => :comments_count, :order => "#{Journal.table_name}.created_on ASC"
|
||||
|
||||
acts_as_event :title =>Proc.new {|o| status = ((s = o.new_status) ? " (#{s})" : nil); "#{o.issue.tracker} ##{o.issue.project_index}#{status}: #{o.issue.subject}" },
|
||||
:description =>:notes,
|
||||
|
|
|
@ -162,7 +162,7 @@ class CoursesService
|
|||
raise '403'
|
||||
end
|
||||
end
|
||||
@comments = @news.comments
|
||||
@comments = @news.comments.reorder("created_on desc")
|
||||
@comments.reverse! if current_user.wants_comments_in_reverse_order?
|
||||
{:news => @news,:comments => @comments}
|
||||
|
||||
|
@ -335,6 +335,7 @@ class CoursesService
|
|||
8, '您已经是该班级的教师了',
|
||||
9, '您已经是该班级的教辅了',
|
||||
10, '您已经是该班级的管理员了',
|
||||
11, '该班级不存在或已被删除啦',
|
||||
'未知错误,请稍后再试'
|
||||
]
|
||||
end
|
||||
|
@ -348,6 +349,8 @@ class CoursesService
|
|||
if course
|
||||
if course_endTime_timeout? course
|
||||
@state = 2
|
||||
elsif course[:is_delete] == 1
|
||||
@state = 11
|
||||
else
|
||||
if current_user.member_of_course?(course) #如果已经是成员
|
||||
member = course.members.where("user_id=#{current_user.id} and course_id=#{course.id}")[0]
|
||||
|
@ -392,7 +395,7 @@ class CoursesService
|
|||
def homework_list params,current_user
|
||||
course = Course.find(params[:id])
|
||||
if course.is_public != 0 || current_user.member_of_course?(course)
|
||||
bids = course.homework_commons.where("publish_time <= ?",Time.now.strftime("%Y-%m-%d")).page(params[:page] || 1).per(20).order('created_at DESC')
|
||||
bids = course.homework_commons.where("publish_time <= ?",Time.now.strftime("%Y-%m-%d")).page(params[:page] || 1).per(20).reorder('created_at DESC')
|
||||
bids = bids.like(params[:name]) if params[:name].present?
|
||||
homeworks = []
|
||||
bids.each do |bid|
|
||||
|
@ -495,7 +498,7 @@ class CoursesService
|
|||
def course_attachments params
|
||||
result = []
|
||||
course = Course.find(params[:course_id])
|
||||
attachments = course.attachments.where("is_publish = 1").order("created_on desc")
|
||||
attachments = course.attachments.where("is_publish = 1").reorder("created_on desc")
|
||||
if !params[:name].nil? && params[:name] != ""
|
||||
attachments.each do |atta|
|
||||
result << atta if atta.filename.include?(params[:name])
|
||||
|
@ -632,7 +635,7 @@ class CoursesService
|
|||
:homework_submit_num => bid.student_works.count,
|
||||
:homework_status_student => get_homework_status( bid),:homework_status_teacher => homework_status_desc( bid),
|
||||
:student_evaluation_part => get_evaluation_part( bid ,3),
|
||||
:ta_evaluation_part => get_evaluation_part( bid ,2),:homework_anony_type => bid.homework_type == 1 && !bid.homework_detail_manual.nil?}
|
||||
:ta_evaluation_part => get_evaluation_part( bid ,2),:homework_anony_type => bid.homework_type == 1 && !bid.homework_detail_manual.nil?,:current_user_is_teacher => is_course_teacher}
|
||||
|
||||
end
|
||||
|
||||
|
|
|
@ -49,6 +49,125 @@ class ResourcesService
|
|||
[@ori, @flag, @save_message]
|
||||
end
|
||||
|
||||
def send_homework_to_course user,params
|
||||
homework = HomeworkCommon.find params[:send_id].to_i
|
||||
@ori = homework
|
||||
course_ids = params[:course_ids]
|
||||
@flag = false
|
||||
unless course_ids.nil?
|
||||
course_ids.each do |course_id|
|
||||
course = Course.find course_id.to_i
|
||||
new_homework = HomeworkCommon.new
|
||||
new_homework.name = homework.name
|
||||
new_homework.user_id = user.id
|
||||
new_homework.description = homework.description
|
||||
new_homework.homework_type = homework.homework_type
|
||||
new_homework.late_penalty = homework.late_penalty
|
||||
new_homework.course_id = course.id
|
||||
new_homework.teacher_priority = homework.teacher_priority
|
||||
new_homework.anonymous_comment = homework.anonymous_comment
|
||||
new_homework.quotes = 0
|
||||
new_homework.is_open = homework.is_open
|
||||
homework.attachments.each do |attachment|
|
||||
att = attachment.copy
|
||||
att.container_id = nil
|
||||
att.container_type = nil
|
||||
att.copy_from = attachment.id
|
||||
att.save
|
||||
new_homework.attachments << att
|
||||
end
|
||||
homework_detail_manual = homework.homework_detail_manual
|
||||
homework_detail_programing = homework.homework_detail_programing
|
||||
homework_detail_group = homework.homework_detail_group
|
||||
if homework_detail_manual
|
||||
new_homework.homework_detail_manual = HomeworkDetailManual.new
|
||||
new_homework_detail_manual = new_homework.homework_detail_manual
|
||||
new_homework_detail_manual.ta_proportion = homework_detail_manual.ta_proportion
|
||||
new_homework_detail_manual.comment_status = 0
|
||||
new_homework_detail_manual.evaluation_num = homework_detail_manual.evaluation_num
|
||||
new_homework_detail_manual.absence_penalty = homework_detail_manual.absence_penalty
|
||||
end
|
||||
if homework_detail_programing
|
||||
new_homework.homework_detail_programing = HomeworkDetailPrograming.new
|
||||
new_homework.homework_detail_programing.ta_proportion = homework_detail_programing.ta_proportion
|
||||
new_homework.homework_detail_programing.language = homework_detail_programing.language
|
||||
homework.homework_tests.each_with_index do |homework_test|
|
||||
new_homework.homework_tests << HomeworkTest.new(
|
||||
input: homework_test.input,
|
||||
output: homework_test.output
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
if homework_detail_group
|
||||
new_homework.homework_detail_group = HomeworkDetailGroup.new
|
||||
new_homework.homework_detail_group.min_num = homework_detail_group.min_num
|
||||
new_homework.homework_detail_group.max_num = homework_detail_group.max_num
|
||||
new_homework.homework_detail_group.base_on_project = homework_detail_group.base_on_project
|
||||
end
|
||||
if new_homework.save
|
||||
new_homework_detail_manual.save if new_homework_detail_manual
|
||||
new_homework.homework_detail_programing.save if new_homework.homework_detail_programing
|
||||
new_homework.homework_detail_group.save if new_homework.homework_detail_group
|
||||
@flag = true
|
||||
else
|
||||
@flag = false
|
||||
@save_message = new_homework.errors.full_messages
|
||||
break
|
||||
end
|
||||
homework.update_column(:quotes, homework.quotes+1)
|
||||
end
|
||||
end
|
||||
[@ori, @flag, @save_message]
|
||||
end
|
||||
|
||||
def send_exercise_to_course user,params
|
||||
# send_id = params[:send_id]
|
||||
# @ori = Attachment.find_by_id(send_id)
|
||||
# course_ids = params[:course_ids]
|
||||
# @flag = false
|
||||
# unless course_ids.nil?
|
||||
# course_ids.each do |id|
|
||||
# next if @ori.blank?
|
||||
# @exist = false
|
||||
# Course.find(id).attachments.each do |att| #如果课程中包含该资源
|
||||
# if att.id == @ori.id || (!att.copy_from.nil? && !@ori.copy_from.nil? && att.copy_from == @ori.copy_from) || att.copy_from == @ori.id || att.id == @ori.copy_from
|
||||
# att.created_on = Time.now
|
||||
# att.save
|
||||
# @exist = true
|
||||
# @flag = true
|
||||
# break
|
||||
# end
|
||||
# end
|
||||
# next if @exist
|
||||
# attach_copied_obj = @ori.copy
|
||||
# attach_copied_obj.tag_list.add(@ori.tag_list) # tag关联
|
||||
# attach_copied_obj.container = Course.find(id)
|
||||
# attach_copied_obj.created_on = Time.now
|
||||
# attach_copied_obj.author_id = user.id
|
||||
# attach_copied_obj.is_public = 0
|
||||
# attach_copied_obj.copy_from = @ori.copy_from.nil? ? @ori.id : @ori.copy_from #发送要添加copy_from
|
||||
# if attach_copied_obj.attachtype == nil
|
||||
# attach_copied_obj.attachtype = 4
|
||||
# end
|
||||
# if attach_copied_obj.save
|
||||
# # 更新引用次数
|
||||
# quotes = @ori.quotes.to_i + 1
|
||||
# @ori.update_attribute(:quotes, quotes) unless @ori.nil?
|
||||
# @ori.forwards << Forward.new(:to_type => attach_copied_obj.class.name, :to_id => attach_copied_obj.id,:created_at => Time.now)
|
||||
# @flag = true
|
||||
# else
|
||||
# @flag = false
|
||||
# @save_message = attach_copied_obj.errors.full_messages
|
||||
# break
|
||||
# end
|
||||
#
|
||||
# end
|
||||
# end
|
||||
|
||||
[@ori, @flag, @save_message]
|
||||
end
|
||||
|
||||
# 我的资源-课件 已发布的
|
||||
def all_course_attachments user
|
||||
|
||||
|
|
|
@ -71,8 +71,8 @@ class SyllabusesService
|
|||
count = ShieldWechatMessage.where("container_type='User' and container_id=#{user.id} and shield_type='Course' and shield_id=#{course.id}").count
|
||||
if count == 0
|
||||
ws = WechatService.new
|
||||
title = "恭喜您创建班级成功"
|
||||
ws.create_class_notice user.id, "create_course_notice", course.id,title, course.name, user.show_name, 0, "点击查看班级详情"
|
||||
title = "恭喜您创建班级成功。"
|
||||
ws.create_class_notice user.id, "create_course_notice", course.id,title, course.name, user.show_name, 0, "点击查看班级详情。"
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -229,7 +229,7 @@ class WechatService
|
|||
color:"#707070"
|
||||
},
|
||||
remark:{
|
||||
value:"绑定成功后可使用微信查看Trustie平台最新动态",
|
||||
value:"绑定成功后可使用微信查看Trustie平台最新动态。",
|
||||
color:"#707070"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -56,8 +56,7 @@
|
|||
<td style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" align="center" align="center"><%= checked_image user.admin? %></td>
|
||||
<td style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" class="created_on" align="center" title='<%=format_time(user.created_on)%>'><%= format_time(user.created_on) %></td>
|
||||
<td style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" class="last_login_on" align="center" title='<%= format_time(user.last_login_on)%>'><%= format_time(user.last_login_on) unless user.last_login_on.nil? %></td>
|
||||
<% occupation = user.user_extensions.identity == 0 ? School.where("id=?",user.user_extensions.school_id).first.try(:name) : user.user_extensions.occupation %>
|
||||
<td style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" align="center" align="center" title="<%= occupation %>"> <%= truncate( occupation, :length => 12 ) %></td>
|
||||
<td style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" align="center" align="center" title="<%= get_occupation_from_user(user) %>"> <%= truncate(get_occupation_from_user(user), :length => 12 ) %></td>
|
||||
<td style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" class="buttons" align="center" title='<%=user.id %>'> <%= change_status_link(user) %></td>
|
||||
<td style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" class="buttons" align="center" title='<%=user.id %>'> <%= delete_link user_path(user, :back_url => admin_users_path(params)) unless User.current == user %></td>
|
||||
|
||||
|
|
|
@ -39,6 +39,8 @@
|
|||
%>
|
||||
<div class="cl"></div>
|
||||
<p id="message_content_span"></p>
|
||||
<p id="e_tip" class="c_grey"></p>
|
||||
<p id="e_tips" class="c_grey"></p>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<div class="mt10">
|
||||
|
@ -56,4 +58,11 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
$(function(){
|
||||
setTimeout(function(){
|
||||
elocalStorage(message_content_editor,'blog_<%=User.current.id %>');
|
||||
}, 10000);
|
||||
});
|
||||
</script>
|
|
@ -36,6 +36,8 @@
|
|||
:maxlength => 5000 }%>
|
||||
<div class="cl"></div>
|
||||
<p id="message_content_span"></p>
|
||||
<p id="e_tip" class="c_grey"></p>
|
||||
<p id="e_tips" class="c_grey"></p>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<div class="mt10">
|
||||
|
@ -62,4 +64,4 @@
|
|||
<div class="cl"></div>
|
||||
</li>-->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -135,13 +135,8 @@
|
|||
<%= 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_on) %>
|
||||
</div>
|
||||
<% if !comment.parent.nil? && !comment.parent.parent.nil? %>
|
||||
<%= render :partial => 'users/message_contents', :locals => {:comment => comment}%>
|
||||
<% end %>
|
||||
<%= render :partial => 'users/message_contents', :locals => {:comment => comment}%>
|
||||
|
||||
<% if !comment.content_detail.blank? %>
|
||||
<div class="homepagePostReplyContent break_word list_style upload_img table_maxWidth" id="reply_content_<%= comment.id %>">
|
||||
<%= comment.content_detail.html_safe %>
|
||||
|
|
|
@ -51,13 +51,13 @@
|
|||
<% all_comments = []%>
|
||||
<% count=get_all_children(all_comments, activity).count %>
|
||||
<div class="homepagePostReply">
|
||||
<%= render :partial => 'users/blog_comment_reply_banner', :locals => {:count => count, :activity => activity, :user_activity_id => user_activity_id, :homepage => 1} %>
|
||||
<%= render :partial => 'users/reply_banner', :locals => {:count => count, :activity => activity, :user_activity_id => user_activity_id, :homepage => 1} %>
|
||||
|
||||
<% all_comments = []%>
|
||||
<% comments = get_all_children(all_comments, activity)[0..2] %>
|
||||
<% if count > 0 %>
|
||||
<div class="" id="reply_div_<%= user_activity_id %>">
|
||||
<%= render :partial => 'users/blog_comments_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}%>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
|
|
|
@ -184,3 +184,10 @@ function nh_init_board(params){
|
|||
|
||||
|
||||
</script>
|
||||
<script type="text/javascript">
|
||||
$(function(){
|
||||
setTimeout(function(){
|
||||
elocalStorage(message_content_editor,'blog_<%=User.current.id %>');
|
||||
}, 10000);
|
||||
});
|
||||
</script>
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
<div class="ReplyToMessageContainer borderBottomNone"id="reply_to_message_<%= reply.id%>">
|
||||
<div class="homepagePostReplyPortrait mr15 imageFuzzy" id="reply_image_<%= reply.id%>"><%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(User.current), :alt => "用户头像" %></div>
|
||||
<div class="ReplyToMessageInputContainer mb10">
|
||||
<% if User.current.logged? %>
|
||||
<div nhname='new_message_<%= reply.id%>'>
|
||||
<%= form_for @comment, :as => :reply, :url => {:controller => 'comments',:action => 'reply', :id => @comment.id}, :method => 'post', :html => {:multipart => true, :id => 'new_form'} do |f| %>
|
||||
<div nhname='toolbar_container_<%= reply.id%>'></div>
|
||||
<textarea placeholder="有问题或有建议,请直接给我留言吧!" style="display: none" nhname='new_message_textarea_<%= reply.id%>' name="content"></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:2px;">发送</a>
|
||||
<div class="cl"></div>
|
||||
<p nhname='contentmsg_<%= reply.id%>'></p>
|
||||
<% end%>
|
||||
</div>
|
||||
<% else %>
|
||||
<%= render :partial => "users/show_unlogged" %>
|
||||
<% end %>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
|
@ -0,0 +1,10 @@
|
|||
<% if @user_activity_id %>
|
||||
<% if @news.project_id && @news.project_id != -1 %>
|
||||
$("#user_activity_<%= @user_activity_id %>").replaceWith("<%= escape_javascript(render :partial => 'projects/project_news', :locals => {:activity => @news,:user_activity_id =>@user_activity_id}) %>");
|
||||
<% elsif @news.course_id %>
|
||||
$("#user_activity_<%= @user_activity_id %>").replaceWith("<%= escape_javascript(render :partial => 'users/course_news', :locals => {:activity => @news,:user_activity_id =>@user_activity_id}) %>");
|
||||
<% elsif @news.org_subfield_id %>
|
||||
$("#user_activity_<%= @user_activity_id %>").replaceWith("<%= escape_javascript(render :partial => 'organizations/org_subfield_news', :locals => {:activity => @news,:user_activity_id =>@user_activity_id}) %>");
|
||||
<% end %>
|
||||
<% end %>
|
||||
sd_create_editor_from_data(<%= @user_activity_id %>,"","100%", "<%=@news.class.to_s%>");
|
|
@ -0,0 +1,8 @@
|
|||
if($("#reply_message_<%= @comment.id%>").length > 0) {
|
||||
$("#reply_message_<%= @comment.id%>").replaceWith("<%= escape_javascript(render :partial => 'comments/simple_ke_reply_form', :locals => {:reply => @comment}) %>");
|
||||
$(function(){
|
||||
sd_create_editor_from_data(<%= @comment.id%>,null,"100%", "<%=@comment.class.to_s%>");
|
||||
});
|
||||
}else if($("#reply_to_message_<%= @comment.id %>").length >0) {
|
||||
$("#reply_to_message_<%= @comment.id%>").replaceWith("<p id='reply_message_<%= @comment.id %>'></p>");
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
<% if @user_activity_id %>
|
||||
<% if @news.project_id && @news.project_id != -1 %>
|
||||
$("#user_activity_<%= @user_activity_id %>").replaceWith("<%= escape_javascript(render :partial => 'projects/project_news', :locals => {:activity => @news,:user_activity_id =>@user_activity_id}) %>");
|
||||
<% elsif @news.course_id %>
|
||||
$("#user_activity_<%= @user_activity_id %>").replaceWith("<%= escape_javascript(render :partial => 'users/course_news', :locals => {:activity => @news,:user_activity_id =>@user_activity_id}) %>");
|
||||
<% elsif @news.org_subfield_id %>
|
||||
$("#user_activity_<%= @user_activity_id %>").replaceWith("<%= escape_javascript(render :partial => 'organizations/org_subfield_news', :locals => {:activity => @news,:user_activity_id =>@user_activity_id}) %>");
|
||||
<% end %>
|
||||
<% end %>
|
||||
sd_create_editor_from_data(<%= @user_activity_id %>,"","100%", "<%=@news.class.to_s%>");
|
|
@ -78,7 +78,7 @@
|
|||
<% end %>
|
||||
<% end %>
|
||||
|
||||
<% if course_activities.count == 10 %>
|
||||
<% if course_activities.count + page * 10 < @course_activities_count %>
|
||||
<!--<div id="show_more_course_activities" class="loadMore mt10 f_grey">点击展开更多<%#= link_to "", course_activity_path(@course.id, :type => type, :page => page), :id => "more_course_activities_link", :remote => "true", :class => "none" %></div>-->
|
||||
<%= link_to "点击展开更多",course_activity_path(@course.id, :type => type, :page => page),:id => "show_more_course_activities",:remote => "true",:class => "loadMore mt10 f_grey"%>
|
||||
<% end %>
|
||||
|
|
|
@ -1,13 +1,15 @@
|
|||
<% unless contributor_course_scor(course.id).count == 0 %>
|
||||
<ul class="rankList">
|
||||
<h4>
|
||||
<div>
|
||||
<ul class="rankList">
|
||||
<h3 style="font-size: 14px; font-weight: normal;">
|
||||
<% if (User.current.logged? && course.open_student == 1) || (User.current.member_of_course?(course)) || User.current.admin? %>
|
||||
<%= link_to "班级活跃度", course_member_path(course, :role => 2, :sort_type => 'act_score'), :class => '' %>
|
||||
<%= link_to "班级活跃度", course_member_path(course, :role => 2, :sort_type => 'act_score'), :class => 'sy_cblack' %>
|
||||
<% else %>
|
||||
班级活跃度
|
||||
<% end %>
|
||||
<a class="contributor_course" onmouseover ="message_titile_show2($(this),event)" onmouseout ="message_titile_hide2($(this))" style="cursor: pointer; position:relative;">积分规则</a>
|
||||
</h4>
|
||||
<a class="sy_cmore fr" onmouseover ="message_titile_show2($(this),event)" onmouseout ="message_titile_hide2($(this))" style="cursor: pointer; position:relative;">积分规则</a>
|
||||
<div class="cl"></div>
|
||||
</h3>
|
||||
<div class="numIntro undis" style="cursor:pointer;">
|
||||
<div class="active-degree-rule">
|
||||
积分规则<br/>
|
||||
|
@ -26,10 +28,11 @@
|
|||
+ contributor_score.homework_journal_num.to_i * 1 + contributor_score.news_reply_num.to_i * 1 +
|
||||
contributor_score.news_num.to_i * 1 %>
|
||||
<% unless total_score ==0 %>
|
||||
<li><%=link_to image_tag(url_to_avatar(contributor_score.user), :width => "35", :height => "35", :class=> "rankPortrait"),user_path(contributor_score.user) %>
|
||||
<li>
|
||||
<%=link_to image_tag(url_to_avatar(contributor_score.user), :width => "50", :height => "50", :class=> "rankPortrait"),user_path(contributor_score.user) %>
|
||||
<p><%=link_to contributor_score.user.show_name, user_path(contributor_score.user.id), :title => contributor_score.user.show_name %></p>
|
||||
<p><span class="c_green" style="cursor:pointer">
|
||||
<a onmouseover ="message_titile_show($(this),event)" onmouseout ="message_titile_hide($(this))" class="c_green">
|
||||
<p><span class="sy_corange" style="cursor:pointer">
|
||||
<a onmouseover ="message_titile_show($(this),event)" onmouseout ="message_titile_hide($(this))" class="sy_corange">
|
||||
<%=total_score %></a></span></p>
|
||||
<div style="display: none" class="numIntro">
|
||||
<div class="contributor-course-calculate">积分计算</div>
|
||||
|
@ -60,5 +63,6 @@
|
|||
<% end %>
|
||||
<% end %>
|
||||
<div class="cl"></div>
|
||||
</ul>
|
||||
</ul>
|
||||
</div>
|
||||
<% end %>
|
|
@ -1,9 +1,9 @@
|
|||
<% hero_homework_scores = hero_homework_score(course, "desc") %>
|
||||
<% unless hero_homework_scores.map(&:score).detect{|s| s.to_i != 0}.nil? %>
|
||||
<ul class="rankList">
|
||||
<h4>
|
||||
<h4 style="font-size: 14px; font-weight: normal;">
|
||||
<% if (User.current.logged? && course.open_student == 1) || (User.current.member_of_course?(course)) || User.current.admin? %>
|
||||
<%= link_to "班级英雄榜", course_member_path(course, :role => 2), :class => '' %>
|
||||
<%= link_to "班级英雄榜", course_member_path(course, :role => 2), :class => 'sy_cblack' %>
|
||||
<% else %>
|
||||
<span>班级英雄榜</span>
|
||||
<% end %>
|
||||
|
|
|
@ -1,25 +1,22 @@
|
|||
<% exc_course = excellent_course_recommend(course) %>
|
||||
<% unless exc_course.length == 0 %>
|
||||
<ul class="courseR mb10">
|
||||
<h4 class="mb5" ><%= l(:label_homework_recommendation) %>:</h4>
|
||||
<% exc_course.each do |e_course| %>
|
||||
<li class="mt15"> <%= image_tag(url_to_avatar(e_course), :width => "40", :height => "40", :class => "fl mr10 rankPortrait", :alt => "logo") %>
|
||||
<div class="fl">
|
||||
<p class="f12 mb5"><%=link_to e_course.name, course_path(e_course.id), :class => "hidden fl w170" %><div class="cl"></div> </p>
|
||||
<p class="f12">
|
||||
<% if visable_attachemnts_incourse(e_course).count > 0 %>
|
||||
<span class="fl mr15 fontGrey4"><%= l(:project_module_attachments) %>(<%= link_to visable_attachemnts_incourse(e_course).count, course_files_path(e_course), :class => "linkBlue2" %>)</span>
|
||||
<% end %>
|
||||
<% if e_course.homework_commons.where("publish_time <= '#{Date.today}'").count > 0 %>
|
||||
<span class="fl fontGrey4"><%= l(:label_homework_commont) %>(<%= link_to e_course.homework_commons.where("publish_time <= '#{Date.today}'").count, homework_common_index_path(:course=>e_course.id), :class => "linkBlue2" %>)</span>
|
||||
<% end %>
|
||||
<div class="cl"></div>
|
||||
</p>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<ul class="sy_class_lclass">
|
||||
<% exc_course.each_with_index do |e_course, i| %>
|
||||
<li>
|
||||
<span class="sy_sq_orange fl mr5 mt5"><%= i+1 %></span>
|
||||
<%=link_to e_course.name, course_path(e_course.id), :class => "sy_class_ltitle fl mb10" %>
|
||||
<p class="sy_cgrey ml20">
|
||||
<% homework_count = e_course.homework_commons.where("publish_time <= '#{Date.today}'").count %>
|
||||
<% if homework_count > 0 %>
|
||||
作业<span class="sy_cir_grey ml5 mr5"><%=homework_count %></span>
|
||||
<% end %>
|
||||
<% file_count = visable_attachemnts_incourse(e_course).count %>
|
||||
<% if file_count > 0 %>
|
||||
资源<span class="sy_cir_grey ml5 mr5"><%=file_count %></span>
|
||||
<% end %>
|
||||
</p>
|
||||
</li>
|
||||
<% end %>
|
||||
<div class="cl"></div>
|
||||
</ul>
|
||||
<% end %>
|
||||
|
||||
|
|
|
@ -1,47 +1,53 @@
|
|||
<% course_file_num = visable_attachemnts_incourse(@course).count%>
|
||||
<% is_teacher = User.current.logged? && (User.current.admin? || User.current.allowed_to?(:as_teacher,@course)) %>
|
||||
<% if show_nav?(@course.boards.first ? @course.boards.first.topics.count : 0) %>
|
||||
<li>
|
||||
<a href="<%=course_boards_path(@course) %>">问答区</a>
|
||||
<%= link_to( "",course_boards_path(@course, :flag => true, :is_new => 1), :class => 'sy_class_add', :title =>"#{l(:label_message_new)}") %>
|
||||
</li>
|
||||
<% end %>
|
||||
<% if show_nav?(@course.homework_commons.count) %>
|
||||
<div class="subNav">
|
||||
<%= link_to l(:label_homework), homework_common_index_path(:course => @course.id), :class => "f12 c_blue02 ml10 fn"%>
|
||||
<%= link_to( "", homework_common_index_path(:course => @course.id,:is_new => 1), :class => 'courseMenuSetting', :title =>"#{l(:label_course_homework_new)}") if is_teacher %>
|
||||
</div>
|
||||
<li>
|
||||
<a href="<%= homework_common_index_path(:course => @course.id) %>">作业</a>
|
||||
<%= link_to( "",homework_common_index_path(:course => @course.id,:is_new => 1), :class => 'sy_class_add', :title =>"#{l(:label_course_homework_new)}") if is_teacher %>
|
||||
</li>
|
||||
<% end %>
|
||||
<% if show_nav?(@course.news.count) %>
|
||||
<div class="subNav">
|
||||
<%= link_to "通知", course_news_index_path(@course), :class => "f12 c_blue02 ml10 fn" %>
|
||||
<%= link_to( "", new_course_news_path(@course), :class => 'courseMenuSetting', :title =>"#{l(:label_course_news_new)}") if is_teacher %>
|
||||
</div>
|
||||
<li>
|
||||
<a href="<%=course_news_index_path(@course) %>">通知</a>
|
||||
<%= link_to( "",new_course_news_path(@course,:is_new=>1), :class => 'sy_class_add', :title =>"#{l(:label_course_news_new)}") if is_teacher %>
|
||||
</li>
|
||||
<% end %>
|
||||
<% if show_nav?(course_file_num) %>
|
||||
<div class="subNav">
|
||||
<%= link_to l(:label_course_file), course_files_path(@course), :class => "f12 c_blue02 ml10 fn" %>
|
||||
<li>
|
||||
<a href="<%=course_files_path(@course) %>">资源库</a>
|
||||
<% 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>
|
||||
<a class="sy_class_add" title="上传资源" href="javascript:void(0);" onclick="course_files_upload();"> </a>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
<% if 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 => "f12 c_blue02 ml10 fn" %>
|
||||
<%= link_to( "",course_boards_path(@course, :flag => true, :is_new => 1), :class => 'courseMenuSetting', :title =>"#{l(:label_message_new)}") %>
|
||||
</div>
|
||||
</li>
|
||||
<% end %>
|
||||
<% if show_nav?(course_feedback_count) %>
|
||||
<div class="subNav">
|
||||
<%= link_to l(:label_course_feedback), course_feedback_path(@course), :class => "f12 c_blue02 ml10 fn" %>
|
||||
<%= link_to "", course_feedback_path(@course), :class => 'courseMenuSetting', :title =>"#{l(:label_course_feedback)}", :id => "course_jour_count"%>
|
||||
</div>
|
||||
<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"%>
|
||||
</li>
|
||||
<% end %>
|
||||
<% if 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 => " f12 c_blue02 ml10 fn"%>
|
||||
<%= link_to( "", new_poll_path(:polls_type => "Course",:polls_group_id => @course.id), :class => 'courseMenuSetting', :title =>"#{l(:label_new_poll)}") if is_teacher %>
|
||||
</div>
|
||||
<li>
|
||||
<a href="<%=poll_index_path(:polls_type => "Course", :polls_group_id => @course.id) %>">问卷调查</a>
|
||||
<%= link_to( "", new_poll_path(:polls_type => "Course",:polls_group_id => @course.id), :class => 'sy_class_add', :title =>"#{l(:label_new_poll)}") if is_teacher %>
|
||||
</li>
|
||||
<% end %>
|
||||
<% if show_nav?(User.current.allowed_to?(:as_teacher,@course)? @course.exercises.count : @course.exercises.where("exercise_status=2").count) %>
|
||||
<div class="subNav">
|
||||
<%= link_to "在线测验", exercise_index_path(:course_id => @course.id), :class => " f12 c_blue02 ml10 fn"%>
|
||||
<%= link_to( "", new_exercise_path(:course_id => @course.id), :class => 'courseMenuSetting', :title =>"新建试卷") if is_teacher %>
|
||||
</div>
|
||||
<% count = User.current.allowed_to?(:as_teacher,@course)? @course.exercises.count : @course.exercises.where("exercise_status <> 1").count %>
|
||||
<% if show_nav?(count) %>
|
||||
<li>
|
||||
<a href="<%=exercise_index_path(:course_id => @course.id) %>">在线测验</a>
|
||||
<%= link_to( "", new_exercise_path(:course_id => @course.id), :class => 'sy_class_add', :title =>"新建试卷") if is_teacher %>
|
||||
</li>
|
||||
<% end %>
|
||||
<% if show_nav?(0) %>
|
||||
<li>
|
||||
<a href="<%=statistics_course_course_path(@course) %>">统计</a>
|
||||
<!--<a href="javascript:void(0);" class="sy_class_add"></a>-->
|
||||
</li>
|
||||
<% end %>
|
|
@ -1,5 +1,7 @@
|
|||
<% reply_allow = JournalsForMessage.create_by_user? User.current %>
|
||||
<!-- <#%= stylesheet_link_tag 'css', :media => 'all' %> -->
|
||||
<div class="courseRSide fl">
|
||||
|
||||
<div class="project_r_h">
|
||||
<h2 class="project_h2"><%= l(:label_contest_userresponse) %></h2>
|
||||
</div>
|
||||
|
@ -9,4 +11,5 @@
|
|||
:locals => { :contest => @contest, :journals => @jour, :state => false}
|
||||
%>
|
||||
|
||||
<% html_title(l(:label_course_feedback)) -%>
|
||||
<% html_title(l(:label_course_feedback)) -%>
|
||||
</div>
|
|
@ -1,3 +1,4 @@
|
|||
<div class="courseRSide fl" id="homework_page_right">
|
||||
<div class="project_r_h">
|
||||
<h2 class="project_h2 fl"><%= @subPage_title%></h2>
|
||||
<% if User.current.allowed_to?(:as_teacher,@course) %>
|
||||
|
@ -11,5 +12,6 @@
|
|||
<% else%>
|
||||
<%= render :partial => 'course_teacher', :locals => {:members => @members} %>
|
||||
<% end%>
|
||||
</div>
|
||||
|
||||
|
||||
|
|
|
@ -8,11 +8,11 @@
|
|||
<label><span class="c_red">*</span> <%= l(:label_tags_syllabus_name)%> :</label>
|
||||
<% if @syllabus.nil? %>
|
||||
<%= select_tag :syllabus_id,options_for_select(course_syllabus_option,@course.syllabus_id), {:id=>"new_syllabus_id", :class=>"syllabus_input"} %>
|
||||
<span class="c_red" id="new_syllabus_notice">如果列表中没有对应的课程,请您先<%=link_to '创建课程', new_syllabus_path(),:target => '_blank', :class => 'ml5 green_btn_share c_white'%></span>
|
||||
<% else %>
|
||||
<span><%=@syllabus.title %></span>
|
||||
<input style="display: none;" name="syllabus_id" value="<%=@syllabus.id %>" />
|
||||
<% end %>
|
||||
<span class="c_red" id="new_syllabus_notice">如果列表中没有对应的课程,请您先<%=link_to '创建课程', new_syllabus_path(),:target => '_blank', :class => 'ml5 green_btn_share c_white'%></span>
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
<li class="ml45">
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<% if params[:user_page].nil? %>
|
||||
$("#project_info_<%=@course.id %>").html('<%=escape_javascript(render :partial=>'layouts/project_info') %>');
|
||||
$("#project_info_<%=@course.id %>").html('<%=escape_javascript(render :partial=>'layouts/course_base_info') %>');
|
||||
if(document.getElementById("course_is_public")) {
|
||||
<% if @course.is_public == 0%>
|
||||
$("#course_is_public").attr("checked",false);
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
<div class="courseRSide fl" id="homework_page_right">
|
||||
<div class="project_r_h">
|
||||
<h2 class="project_h2"><%= l(:label_course_modify_settings)%></h2>
|
||||
</div>
|
||||
|
@ -6,6 +7,7 @@
|
|||
<% if @select_tab == 'member'%>
|
||||
$("#tb_2").click();
|
||||
<% end %>
|
||||
$("#homework_page_right").css("min-height",$("#courseLSide").height()+45);
|
||||
})
|
||||
</script>
|
||||
<div class="hwork_new">
|
||||
|
@ -144,3 +146,4 @@
|
|||
//$("#time").click(select);
|
||||
//$("#term").click(select);
|
||||
</script>
|
||||
</div>
|
|
@ -0,0 +1,5 @@
|
|||
<div class="sy_class_r ml10">
|
||||
<div class="icons_tishi"><img src="../../images/sy/icons_smile.png" width="110" height="110" alt="" ></div>
|
||||
<p class="sy_tab_con_p">统计功能即将上线,届时我们一起享受教育大数据的红利吧!</p>
|
||||
<div style="height:400px;"></div>
|
||||
</div><!--sy_class_r end-->
|
|
@ -2,7 +2,7 @@
|
|||
<script type="text/javascript">
|
||||
$(function(){
|
||||
$("#RSide").removeAttr("id");
|
||||
$("#homework_page_right").css("min-height",$("#LSide").height()-30);
|
||||
$("#homework_page_right").css("min-height",$("#courseLSide").height()-33);
|
||||
$("#Container").css("width","1000px");
|
||||
});
|
||||
//编辑问卷描述之后
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<script type="text/javascript">
|
||||
$(function(){
|
||||
$("#RSide").removeAttr("id");
|
||||
$("#homework_page_right").css("min-height",$("#LSide").height()-30);
|
||||
$("#homework_page_right").css("min-height",$("#courseLSide").height()-33);
|
||||
$("#Container").css("width","1000px");
|
||||
var end_time = <%=exercise.end_time.to_i%>;
|
||||
getTime(end_time);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<script type="text/javascript">
|
||||
$(function(){
|
||||
$("#RSide").removeAttr("id");
|
||||
$("#homework_page_right").css("min-height",$("#LSide").height()-30);
|
||||
$("#homework_page_right").css("min-height",$("#courseLSide").height()-33);
|
||||
$("#Container").css("width","1000px");
|
||||
});
|
||||
</script>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<script type="text/javascript">
|
||||
$(function(){
|
||||
$("#RSide").removeAttr("id");
|
||||
$("#homework_page_right").css("min-height",$("#LSide").height()-30);
|
||||
$("#homework_page_right").css("min-height",$("#courseLSide").height()-33);
|
||||
$("#Container").css("width","1000px");
|
||||
});
|
||||
</script>
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
<%= stylesheet_link_tag 'polls', :media => 'all' %>
|
||||
<script type="text/javascript">
|
||||
$(function(){
|
||||
$("#RSide").css("width","730px");
|
||||
$("#homework_page_right").css("min-height",$("#LSide").height()-30);
|
||||
$("#Container").css("width","1000px");
|
||||
$("#homework_page_right").css("min-height",$("#courseLSide").height()-33);
|
||||
});
|
||||
function republish_exercise(exercise_id,index)
|
||||
{
|
||||
|
@ -63,6 +61,8 @@
|
|||
}
|
||||
|
||||
</script>
|
||||
<div class="courseRSide fl" id="homework_page_right">
|
||||
<div class="polls_content02" id="exercise" style="width: 730px;">
|
||||
<%= render :partial => 'exercises_list'%>
|
||||
</div><!--问卷内容end-->
|
||||
</div><!--问卷内容end-->
|
||||
</div>
|
|
@ -1,7 +1,7 @@
|
|||
<script type="text/javascript">
|
||||
$(function(){
|
||||
$("#RSide").removeAttr("id");
|
||||
$("#homework_page_right").css("min-height",$("#LSide").height()-30);
|
||||
$("#homework_page_right").css("min-height",$("#courseLSide").height()-47);
|
||||
$("#Container").css("width","1000px");
|
||||
});
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
<div class="cl"></div>
|
||||
|
||||
<!-- 老师身份才可以发布作业 -->
|
||||
<div class="HomeWork mb10" nhname='homework_common_form'>
|
||||
<div class="HomeWork mb10 ml10" nhname='homework_common_form'>
|
||||
<%= form_for @homework do |f| %>
|
||||
<input type="text" name="is_in_course" class="none" value="<%= @is_in_course%>"/>
|
||||
<input type="text" name="course_activity" class="none" value="<%= @course_activity%>"/>
|
||||
|
|
|
@ -1,54 +1,55 @@
|
|||
<ul>
|
||||
<% issue.journals.reorder("created_on desc").each do |reply| %>
|
||||
<% issue.journals.reorder("created_on desc").each do |comment| %>
|
||||
<script type="text/javascript">
|
||||
$(function(){
|
||||
showNormalImage('reply_content_<%= reply.id %>');
|
||||
autoUrl('reply_content_<%= reply.id %>');
|
||||
showNormalImage('reply_content_<%= comment.id %>');
|
||||
autoUrl('reply_content_<%= comment.id %>');
|
||||
});
|
||||
</script>
|
||||
<% replies_all_i=replies_all_i + 1 %>
|
||||
<li class="homepagePostReplyContainer" nhname="reply_rec" onmouseover="$('#reply_edit_menu_<%= reply.id%>').show();" onmouseout="$('#reply_edit_menu_<%= reply.id%>').hide();" >
|
||||
<li class="homepagePostReplyContainer" nhname="reply_rec">
|
||||
<div class="homepagePostReplyPortrait" >
|
||||
<%= link_to image_tag(url_to_avatar(reply.user), :width => "33", :height => "33"), user_path(reply.user_id), :alt => "用户头像" %>
|
||||
<%= link_to image_tag(url_to_avatar(comment.user), :width => "33", :height => "33"), user_path(comment.user_id), :alt => "用户头像" %>
|
||||
</div>
|
||||
<div class="homepagePostReplyDes">
|
||||
<div class="homepagePostReplyPublisher">
|
||||
<% if reply.try(:user).try(:realname) == ' ' %>
|
||||
<%= link_to reply.try(:user), user_path(reply.user_id), :class => "newsBlue mr10 f14" %>
|
||||
<% else %>
|
||||
<%= link_to reply.try(:user).try(:realname), user_path(reply.user_id), :class => "newsBlue mr10 f14" %>
|
||||
<% end %>
|
||||
<%#= format_time(reply.created_on) %>
|
||||
</div>
|
||||
<div class="homepagePostReplyContent break_word list_style upload_img table_maxWidth" id="reply_content_<%= reply.id %>">
|
||||
<% if reply.details.any? %>
|
||||
<% details_to_strings(reply.details).each do |string| %>
|
||||
<%= render :partial => 'users/news_contents', :locals => {:comment => comment}%>
|
||||
|
||||
<div class="homepagePostReplyContent break_word list_style upload_img table_maxWidth" id="reply_content_<%= comment.id %>">
|
||||
<% if comment.details.any? %>
|
||||
<% details_to_strings(comment.details).each do |string| %>
|
||||
<p><%= string %></p>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<P><%= reply.notes.html_safe %></P>
|
||||
<P><%= comment.notes.html_safe %></P>
|
||||
</div>
|
||||
<div style="margin-top: 7px">
|
||||
<%= format_time(reply.created_on) %>
|
||||
<div class="fr" id="reply_edit_menu_<%= reply.id%>" style="display: none">
|
||||
<%= link_to(
|
||||
l(:button_reply),
|
||||
{:controller => 'issues', :action => 'reply', :user_id => reply.user_id, :id => issue.id, :journal_id => reply.id},
|
||||
:remote => true,
|
||||
:method => 'get',
|
||||
:class => 'fr newsBlue',
|
||||
:title => l(:button_reply)) if User.current.logged? %>
|
||||
<%= link_to(
|
||||
l(:button_delete),
|
||||
{:controller => 'issues',:action => 'delete_journal', :id => issue.id,:journal_id=>reply.id},
|
||||
:method => :get,
|
||||
:class => 'fr newsGrey mr10',
|
||||
:data => {:confirm => l(:text_are_you_sure)},
|
||||
:title => l(:button_delete)
|
||||
) if reply.user_id == User.current.id %>
|
||||
<div class="orig_reply mb10 mt-10">
|
||||
<div class="reply">
|
||||
<span class="reply-right">
|
||||
<span id="reply_praise_count_<%= comment.id %>">
|
||||
<%= render :partial => "praise_tread/praise", :locals => {:activity => comment, :user_activity_id => comment.id, :type => "reply"} %>
|
||||
</span>
|
||||
<span style="position: relative" class="fr mr20">
|
||||
<%= link_to(
|
||||
l(:button_reply),
|
||||
{:controller => 'issues', :action => 'reply', :user_id => comment.user_id, :id => issue.id, :journal_id => comment.id},
|
||||
:remote => true,
|
||||
:method => 'get',
|
||||
:title => l(:button_reply)) %>
|
||||
<span id="reply_iconup_<%= comment.id %>" class="reply_iconup02" style="display: none"> ︿</span>
|
||||
</span>
|
||||
<%= link_to(
|
||||
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)
|
||||
) if comment.user_id == User.current.id %>
|
||||
</span>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
</div>
|
||||
<p id="reply_message_<%= reply.id%>"></p>
|
||||
<p id="reply_message_<%= comment.id%>"></p>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</li>
|
||||
|
@ -64,17 +65,15 @@
|
|||
<% if User.current.logged? %>
|
||||
<div nhname='new_message_<%= @issue.id %>' style="display:none;">
|
||||
<%= form_for('new_form',:url => add_journal_issue_path(@issue.id),:method => "post", :remote => true) do |f| %>
|
||||
<%#= kindeditor_tag :notes,"",:height=>"33",:minHeight=>"33",:editor_id=>"issues_reply_editor"%>
|
||||
<!--<div class="cl"></div>-->
|
||||
<input type="hidden" name="issue_id" value="<%=@issue.id%>"/>
|
||||
<div nhname='toolbar_container_<%= @issue.id %>' ></div>
|
||||
<div class="cl"></div>
|
||||
<textarea placeholder="有问题或有建议,请直接给我留言吧!" style="display: none" nhname='new_message_textarea_<%= @issue.id %>' name="notes"></textarea>
|
||||
<div class="cl"></div>
|
||||
<div class="mt5 fl">
|
||||
<%= render :partial => 'attachments/issue_reply', :locals => {:container => @jour.nil? ? @issue : @jour} %>
|
||||
<%= render :partial => 'attachments/issue_reply', :locals => {:container => @issue} %>
|
||||
</div>
|
||||
<span nhname='contentmsg_<%= @issue.id %>' class="fl mt8"></span>
|
||||
<span nhname='contentmsg_<%= @issue.id %>' class="fl"></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 %>
|
||||
|
@ -82,7 +81,6 @@
|
|||
<% else %>
|
||||
<%= render :partial => "users/show_unlogged" %>
|
||||
<% end %>
|
||||
<!--<a href="javascript:void(0);" onclick="issues_reply_editor.sync();$(this).parent().submit();" class="homepagePostReplySubmit postReplySubmit fl mt5">发送</a>-->
|
||||
<div class="cl"></div>
|
||||
|
||||
</div>
|
||||
|
|
|
@ -1,30 +1,26 @@
|
|||
<div class="ReplyToMessageContainer borderBottomNone " id="reply_to_message_<%= @issue.id%>">
|
||||
<div class="ReplyToMessageContainer borderBottomNone " id="reply_to_message_<%= @jour.id%>">
|
||||
|
||||
<div class="homepagePostReplyPortrait mr15 imageFuzzy" id="reply_image_<%= @issue.id%>">
|
||||
<div class="homepagePostReplyPortrait mr15 imageFuzzy" id="reply_image_<%= @jour.id%>">
|
||||
<%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(@issue.author_id), :alt => "用户头像" %>
|
||||
</div>
|
||||
|
||||
<div class="ReplyToMessageInputContainer mb10">
|
||||
<% if User.current.logged? %>
|
||||
<div nhname='new_message_<%= @issue.id%>' style="display:none;">
|
||||
<%= form_for('new_form',:url => add_reply_issue_path(@issue.id),:method => "post") do |f|%>
|
||||
<%#= kindeditor_tag :notes,"",:height=>"33",:minHeight=>"33",:editor_id=>"issues_reply_editor"%>
|
||||
<!--<div class="cl"></div>-->
|
||||
<input type="hidden" name="quote" value=""/>
|
||||
<input type="hidden" name="issue_id" value="<%=@issue.id%>"/>
|
||||
<div nhname='toolbar_container_<%= @issue.id%>' ></div>
|
||||
<div nhname='new_message_<%= @jour.id%>' style="display:none;">
|
||||
<%= form_for('new_form',:url => add_reply_issue_path(@issue.id),:method => "post", :remote => true) do |f|%>
|
||||
<input type="hidden" name="journal_id" value="<%=@jour.id%>"/>
|
||||
<div nhname='toolbar_container_<%= @jour.id%>' ></div>
|
||||
<div class="cl"></div>
|
||||
<textarea placeholder="有问题或有建议,请直接给我留言吧!" style="display: none" nhname='new_message_textarea_<%= @issue.id%>' name="notes"></textarea>
|
||||
<textarea placeholder="有问题或有建议,请直接给我留言吧!" style="display: none" nhname='new_message_textarea_<%= @jour.id%>' name="content"></textarea>
|
||||
<div class="cl"></div>
|
||||
<span nhname='contentmsg_<%= @issue.id%>' class="fl"></span>
|
||||
<a id="new_message_submit_btn_<%= @issue.id%>" href="javascript:void(0)" onclick="this.style.display='none'" class="blue_n_btn fr" style="display:none;margin-top:6px;">发送</a>
|
||||
<span nhname='contentmsg_<%= @jour.id%>' class="fl"></span>
|
||||
<a id="new_message_submit_btn_<%= @jour.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>
|
||||
<% end %>
|
||||
</div>
|
||||
<% else %>
|
||||
<%= render :partial => "users/show_unlogged" %>
|
||||
<% end %>
|
||||
<!--<a href="javascript:void(0);" onclick="issues_reply_editor.sync();$(this).parent().submit();" class="homepagePostReplySubmit postReplySubmit fl mt5">发送</a>-->
|
||||
<div class="cl"></div>
|
||||
|
||||
</div>
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
$("#reply_div_<%= @issue.id %>").html("<%= escape_javascript(render :partial => 'issues/issue_replies', :locals => {:issue => @issue,:replies_all_i=>0}) %>");
|
||||
$(".homepagePostReplyBannerCount").html('回复(<%= Issue.find( @issue).journals.count %>)')
|
||||
sd_create_editor_from_data(<%= @issue.id%>, null, "100%","<%=@issue.class.name%>");
|
||||
<% 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%>");
|
||||
<% end %>
|
|
@ -1,3 +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,:replies_all_i=>0}) %>");
|
||||
$(".homepagePostReplyBannerCount").html('回复(<%= @issue.journals.count %>)')
|
||||
sd_create_editor_from_data(<%= @issue.id%>, null, "100%","<%=@issue.class.name%>");
|
||||
sd_create_editor_from_data(<%= @issue.id%>, null, "100%","<%=@issue.class.name%>");
|
||||
<% end %>
|
|
@ -1,9 +1,8 @@
|
|||
if($("#reply_message_<%= @jour.id%>").length > 0) {
|
||||
$("#reply_message_<%= @jour.id%>").replaceWith("<%= escape_javascript(render :partial => 'issues/issue_reply_ke_form') %>");
|
||||
$(function(){
|
||||
$('input[name=quote]').val("<%= raw escape_javascript(@tempContent.html_safe) %>");
|
||||
sd_create_editor_from_data(<%= @issue.id%>, null, "100%", "<%= @issue.class.name %>");
|
||||
sd_create_editor_from_data(<%= @jour.id%>, null, "100%", "<%= @jour.class.name %>");
|
||||
});
|
||||
}else if($("#reply_to_message_<%= @issue.id%>").length >0) {
|
||||
$("#reply_to_message_<%= @issue.id%>").replaceWith("<p id='reply_message_<%= @jour.id%>'></p>");
|
||||
}else if($("#reply_to_message_<%= @jour.id%>").length >0) {
|
||||
$("#reply_to_message_<%= @jour.id%>").replaceWith("<p id='reply_message_<%= @jour.id%>'></p>");
|
||||
}
|
|
@ -0,0 +1,278 @@
|
|||
<%# 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>
|
|
@ -0,0 +1,151 @@
|
|||
<!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>
|
|
@ -0,0 +1,55 @@
|
|||
<% is_teacher = User.current.logged? && (User.current.admin? || User.current.allowed_to?(:as_teacher,@course)) %>
|
||||
<% teacher_num = TeacherAndAssistantCount(@course) %>
|
||||
<% student_num = studentCount(@course) %>
|
||||
<% course_file_num = visable_attachemnts_incourse(@course).count %>
|
||||
<p class="sy_cgrey mb10">
|
||||
<%=link_to @course.syllabus.title, syllabus_path(@course.syllabus_id), :class => 'sy_cgrey' %>
|
||||
>
|
||||
<%=link_to @course.name, course_path(@course), :class => 'sy_cgrey' %>
|
||||
</p>
|
||||
|
||||
<% if is_teacher %>
|
||||
<div class="homepagePostSetting" >
|
||||
<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>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<div class="cl"></div>
|
||||
<div class="sy_class_logo fl">
|
||||
<%= 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>
|
||||
</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>
|
||||
<p class="sy_cgrey fl mt3">
|
||||
<span class=" mr15">教师:<%= course_teacher_link teacher_num %></span>
|
||||
<span class=" mr15">学生:<%= course_student_link student_num %></span>
|
||||
<span class=" mr15">资源:<%= link_to course_file_num, course_files_path(@course), :class => 'sy_cblue',:id=>'courses_files_count_info' %></span>
|
||||
</p>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<p class="sy_cgrey mb10">
|
||||
<span class=" mr15">主讲老师:<%= link_to(@course.teacher.show_name, user_path(@course.teacher), :class => 'sy_cblue') %></span>
|
||||
<span class=" mr15">学时:<span class="sy_cblack"><%= @course.class_period %>学时</span></span>
|
||||
<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 %>
|
||||
<div id="join_in_course_header"><%= join_in_course_header(@course, User.current) %></div>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="cl"></div>
|
|
@ -1,56 +1,60 @@
|
|||
<ul class="syllabus_leftinfo" id="all_syllabus_attr">
|
||||
<li class="fl"><label >创建教师:</label><span><%=syllabus.user.show_name %></span></li>
|
||||
<h3 class="sy_right_title">课程信息
|
||||
<% if User.current.logged? && (User.current == syllabus.user || User.current.admin?) %>
|
||||
<%= link_to image_tag("../images/signature_edit.png",width:"12px", height: "12px"), "javascript:void(0);", :id => 'syllabus_attr_edit', :class => 'undis fr', :onclick => "show_edit_base_info();"%>
|
||||
<%= link_to "完善信息", "javascript:void(0);", :id => 'syllabus_attr_edit', :class => 'sy_cmore fr mr10', :onclick => "show_edit_base_info();"%>
|
||||
<% end %>
|
||||
<div class="cl"></div>
|
||||
</h3>
|
||||
<ul class="sy_info mt15" id="all_syllabus_attr">
|
||||
<li><label >创建教师</label><span class="fl ml10 sy_cgrey"><%=syllabus.user.show_name %></span></li>
|
||||
<% unless syllabus.syllabus_type.nil? || syllabus.syllabus_type == 0 || syllabus.syllabus_type == '' %>
|
||||
<li><label>课程性质:</label><%=syllabus.syllabus_type_str %></li>
|
||||
<li><label>课程性质</label><span class="fl ml10 sy_cgrey"><%=syllabus.syllabus_type_str %></span></li>
|
||||
<% end %>
|
||||
<% unless syllabus.credit.nil? || syllabus.credit == '' %>
|
||||
<li><label>学分:</label><%= syllabus.credit %></li>
|
||||
<li><label>学分</label><span class="fl ml10 sy_cgrey"><%=syllabus.credit %>学分</span></li>
|
||||
<% end %>
|
||||
<% unless syllabus.hours.nil? || syllabus.hours == '' %>
|
||||
<li><label>总学时:</label><%= syllabus.theory_hours + syllabus.practice_hours %></li>
|
||||
<li><label>总学时</label><span class="fl ml10 sy_cgrey"><%=syllabus.hours %>学时</span></li>
|
||||
<% end %>
|
||||
<% unless syllabus.theory_hours.nil? || syllabus.theory_hours == '' %>
|
||||
<li><label>理论学时:</label><%= syllabus.theory_hours %></li>
|
||||
<li><label>理论学时</label><span class="fl ml10 sy_cgrey"><%=syllabus.theory_hours %>学时</span></li>
|
||||
<% end %>
|
||||
<% unless syllabus.practice_hours.nil? || syllabus.practice_hours == '' %>
|
||||
<li><label>实践学时:</label><%= syllabus.practice_hours %></li>
|
||||
<li><label>实践学时</label><span class="fl ml10 sy_cgrey"><%=syllabus.practice_hours %>学时</span></li>
|
||||
<% end %>
|
||||
<% unless syllabus.applicable_major.nil? || syllabus.applicable_major == '' %>
|
||||
<li><label>适用专业:</label><%=syllabus.applicable_major %></li>
|
||||
<li><label>适用专业</label><span class="fl ml10 sy_cgrey"><%=syllabus.applicable_major %></span></li>
|
||||
<% end %>
|
||||
<% unless syllabus.pre_course.nil? || syllabus.pre_course == '' %>
|
||||
<li><label>先修课程:</label><%=syllabus.pre_course %></li>
|
||||
<li><label>先修课程</label><span class="fl ml10 sy_cgrey"><%=syllabus.pre_course %></span></li>
|
||||
<% end %>
|
||||
|
||||
<% if syllabus.syllabus_type.nil? || syllabus.syllabus_type == 0 || syllabus.syllabus_type == '' %>
|
||||
<li class="none none_attr"><label>课程性质:</label><span class="fontGrey3">空</span></li>
|
||||
<li class="none none_attr"><label>课程性质</label><span class="fl ml10 sy_cgrey">空</span></li>
|
||||
<% end %>
|
||||
<% if syllabus.credit.nil? || syllabus.credit == '' %>
|
||||
<li class="none none_attr"><label>学分:</label><span class="fontGrey3">空</span></li>
|
||||
<li class="none none_attr"><label>学分</label><span class="fl ml10 sy_cgrey">空</span></li>
|
||||
<% end %>
|
||||
<% if syllabus.hours.nil? || syllabus.hours == '' %>
|
||||
<li class="none none_attr"><label>总学时:</label><span class="fontGrey3">空</span></li>
|
||||
<li class="none none_attr"><label>总学时</label><span class="fl ml10 sy_cgrey">空</span></li>
|
||||
<% end %>
|
||||
<% if syllabus.theory_hours.nil? || syllabus.theory_hours == '' %>
|
||||
<li class="none none_attr"><label>理论学时:</label><span class="fontGrey3">空</span></li>
|
||||
<li class="none none_attr"><label>理论学时</label><span class="fl ml10 sy_cgrey">空</span></li>
|
||||
<% end %>
|
||||
<% if syllabus.practice_hours.nil? || syllabus.practice_hours == '' %>
|
||||
<li class="none none_attr"><label>实践学时:</label><span class="fontGrey3">空</span></li>
|
||||
<li class="none none_attr"><label>实践学时</label><span class="fl ml10 sy_cgrey">空</span></li>
|
||||
<% end %>
|
||||
<% if syllabus.applicable_major.nil? || syllabus.applicable_major == '' %>
|
||||
<li class="none none_attr"><label>适用专业:</label><span class="fontGrey3">空</span></li>
|
||||
<li class="none none_attr"><label>适用专业</label><span class="fl ml10 sy_cgrey">空</span></li>
|
||||
<% end %>
|
||||
<% if syllabus.pre_course.nil? || syllabus.pre_course == '' %>
|
||||
<li class="none none_attr"><label>先修课程:</label><span class="fontGrey3">空</span></li>
|
||||
<li class="none none_attr"><label>先修课程</label><span class="fl ml10 sy_cgrey">空</span></li>
|
||||
<% end %>
|
||||
<div class="cl"></div>
|
||||
</ul>
|
||||
<% if User.current.logged? && (User.current == syllabus.user || User.current.admin?)&&(syllabus.syllabus_type.nil? || syllabus.syllabus_type == 0 || syllabus.syllabus_type == ''||syllabus.credit.nil? || syllabus.credit == ''||syllabus.hours.nil? || syllabus.hours == ''||syllabus.theory_hours.nil? || syllabus.theory_hours == ''||syllabus.practice_hours.nil? || syllabus.practice_hours == ''||syllabus.applicable_major.nil? || syllabus.applicable_major == ''||syllabus.pre_course.nil? || syllabus.pre_course == '')%>
|
||||
<span class="homepageLeftMenuMore"><a href="javascript:void(0);" data-init="0" onclick="toggle_all_syllabus_attr();" class="homepageLeftMenuMoreIcon" id="show_all_syllabus_attr"></a></span>
|
||||
<% end %>
|
||||
|
||||
<%# if User.current.logged? && (User.current == syllabus.user || User.current.admin?)&&(syllabus.syllabus_type.nil? || syllabus.syllabus_type == 0 || syllabus.syllabus_type == ''||syllabus.credit.nil? || syllabus.credit == ''||syllabus.hours.nil? || syllabus.hours == ''||syllabus.theory_hours.nil? || syllabus.theory_hours == ''||syllabus.practice_hours.nil? || syllabus.practice_hours == ''||syllabus.applicable_major.nil? || syllabus.applicable_major == ''||syllabus.pre_course.nil? || syllabus.pre_course == '')%>
|
||||
<!--<span class="homepageLeftMenuMore"><a href="javascript:void(0);" data-init="0" onclick="toggle_all_syllabus_attr();" class="homepageLeftMenuMoreIcon2" id="show_all_syllabus_attr"></a></span>-->
|
||||
<%# end %>
|
||||
<script>
|
||||
function show_edit_base_info() {
|
||||
$("#syllabus_base_info").html("<%=escape_javascript(render :partial => 'layouts/syllabus_edit_info', :locals => {:syllabus => @syllabus}) %>");
|
||||
|
|
|
@ -1,27 +1,40 @@
|
|||
<ul class="syllabus_leftinfo" id="all_syllabus_attr">
|
||||
<%= form_for('syllabus',:url => update_base_info_syllabus_path(syllabus.id),:remote => true) do |f|%>
|
||||
<li class="fl"><label >创建教师:</label><span><%=syllabus.user.show_name %></span></li>
|
||||
<a href="javascript:void(0);" onclick="update_syllabus_info();" id="submit_edit_info" class="fr">保存</a>
|
||||
<!--<a href="javascript:void(0);" onclick="reset_syllabus_info();" id="submit_reset_info" class="fr mr10">取消</a>-->
|
||||
<%= form_for('syllabus',:url => update_base_info_syllabus_path(syllabus.id),:remote => true) do |f|%>
|
||||
<h3 class="sy_right_title">课程信息
|
||||
<a href="javascript:void(0);" onclick="update_syllabus_info();" id="submit_edit_info" class="sy_cmore fr mr10">保存</a>
|
||||
<div class="cl"></div>
|
||||
<li><label>课程性质:</label>
|
||||
<%= select_tag :syllabus_type,options_for_select(syllabus_type,syllabus.syllabus_type), {:id=>"syllabus_type_input", :class=>"syllabus_select"} %>
|
||||
</h3>
|
||||
<ul class="sy_info mt15" id="all_syllabus_attr">
|
||||
<li><label >创建教师</label><span class="fl ml10 sy_cgrey"><%=syllabus.user.show_name %></span></li>
|
||||
<li><label>课程性质</label>
|
||||
<%= select_tag :syllabus_type,options_for_select(syllabus_type,syllabus.syllabus_type), {:id=>"syllabus_type_input", :class=>"sy_info_select fl"} %>
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
<li><label >学分</label>
|
||||
<input id="syllabus_credit_input" style="width: 30px;" class="fl" name="credit" placeholder="5" value="<%=syllabus.credit %>"> 学分
|
||||
<span class="none c_red ml5" id="syllabus_credit_notice">正整数</span>
|
||||
</li>
|
||||
<li><label >学分:</label>
|
||||
<input id="syllabus_credit_input" class="syllabus_input_min fl" name="credit" placeholder="5" value="<%=syllabus.credit %>"> 学分
|
||||
<span class="none c_red ml5" id="syllabus_credit_notice">请输入正整数</span><div class="cl"></div>
|
||||
<div class="cl"></div>
|
||||
<li><label>总学时</label>
|
||||
<input id="syllabus_hours_input" style="width: 30px;" class="fl" name="hours" placeholder="50" value="<%=syllabus.hours %>"> 学时
|
||||
<span class="none c_red ml5" id="syllabus_hours_notice">正整数</span>
|
||||
</li>
|
||||
<li><label>总学时:</label><input id="syllabus_hours_input" class="syllabus_input_min fl" name="hours" placeholder="50" value="<%=syllabus.hours %>"> 学时
|
||||
<span class="none c_red ml5" id="syllabus_hours_notice">请输入正整数</span><div class="cl"></div>
|
||||
<div class="cl"></div>
|
||||
<li><label>理论学时</label>
|
||||
<input id="syllabus_theory_hours_input" style="width: 30px;" class="fl" name="theory_hours" placeholder="10" value="<%=syllabus.theory_hours %>"> 学时
|
||||
<span class="none c_red ml5" id="syllabus_theory_hours_notice">正整数</span>
|
||||
</li>
|
||||
<li><label>理论学时:</label><input id="syllabus_theory_hours_input" class="syllabus_input_min fl" name="theory_hours" placeholder="10" value="<%=syllabus.theory_hours %>"> 学时
|
||||
<span class="none c_red ml5" id="syllabus_theory_hours_notice">请输入正整数</span><div class="cl"></div>
|
||||
<div class="cl"></div>
|
||||
<li><label>实践学时</label>
|
||||
<input id="syllabus_practice_hours_input" style="width: 30px;" class="fl" name="practice_hours" placeholder="5" value="<%=syllabus.practice_hours %>"> 学时
|
||||
<span class="none c_red ml5" id="syllabus_practice_hours_notice">正整数</span>
|
||||
</li>
|
||||
<li><label>实践学时:</label><input id="syllabus_practice_hours_input" class="syllabus_input_min fl" name="practice_hours" placeholder="5" value="<%=syllabus.practice_hours %>"> 学时
|
||||
<span class="none c_red ml5" id="syllabus_practice_hours_notice">请输入正整数</span><div class="cl"></div>
|
||||
<div class="cl"></div>
|
||||
<li><label>适用专业</label>
|
||||
<input id="syllabus_applicable_major_input" class="fl" name="applicable_major" placeholder="UI设计" value="<%=syllabus.applicable_major %>">
|
||||
</li>
|
||||
<li><label>适用专业:</label><input id="syllabus_applicable_major_input" class="syllabus_input fl" name="applicable_major" placeholder="UI设计" value="<%=syllabus.applicable_major %>"><div class="cl"></div></li>
|
||||
<li><label>选修课程:</label><input id="syllabus_pre_course_input" class="syllabus_input fl" name="pre_course" placeholder="工业设计史" value="<%=syllabus.pre_course %>"><div class="cl"></div></li>
|
||||
<% end %>
|
||||
</ul>
|
||||
<li><label>选修课程</label>
|
||||
<input id="syllabus_pre_course_input" class="fl" name="pre_course" placeholder="工业设计史" value="<%=syllabus.pre_course %>">
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
</ul>
|
||||
<% end %>
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
<% if syllabus.eng_name && !syllabus.eng_name.empty? %>
|
||||
<span><%= syllabus.eng_name %></span>
|
||||
<p style="position:relative; display:inline;"><% if syllabus.eng_name && !syllabus.eng_name.empty? %>
|
||||
<span><%=syllabus.eng_name %></span>
|
||||
<% else%>
|
||||
<span class="fontGrey">课程英文名称</span>
|
||||
<span style="color: #888">课程英文名称</span>
|
||||
<% end %>
|
||||
<% if User.current == syllabus.user || User.current.admin? %>
|
||||
<%= link_to image_tag("../images/signature_edit.png",width:"12px", height: "12px"), "javascript:void(0);",:id => "syllabus_edit_ng_name_png", :class => "none", :onclick => "show_edit_eng_name();"%>
|
||||
<% end %>
|
||||
<%= link_to image_tag("../images/signature_edit.png",width:"12px", height: "12px"), "javascript:void(0);",:id => "syllabus_edit_ng_name_png", :style => "width:15px; position:absolute; right: -20px; top: 5px;", :class => "none", :onclick => "show_edit_eng_name('#{syllabus.eng_name}');"%>
|
||||
<% end %>
|
||||
</p>
|
|
@ -1,25 +1,9 @@
|
|||
<%# teachers_num = teacher_count @syllabus%>
|
||||
<%# students_num = student_count @syllabus%>
|
||||
<%# files_num = file_count @syllabus%>
|
||||
<div class="pr_info_logo fl mb5 mr10">
|
||||
<%= image_tag("../images/syllabus.jpg",width:"60px", height: "60px") %>
|
||||
</div>
|
||||
<div class="fl">
|
||||
<div id="syllabus_title_show" class="homepageSyllabusName mb5">
|
||||
<%= render :partial => 'layouts/syllabus_title', :locals => {:syllabus => @syllabus}%>
|
||||
</div>
|
||||
<textarea class="syllabusTitleTextarea none" placeholder="请编辑课程名称" id="syllabus_title_edit"></textarea>
|
||||
<div id="syllabus_title_show">
|
||||
<%= render :partial => 'layouts/syllabus_title', :locals => {:syllabus => @syllabus}%>
|
||||
</div>
|
||||
<input type="text" class="none" style="width:300px;" placeholder="请编辑课程名称" id="syllabus_title_edit"/>
|
||||
<div class="cl"></div>
|
||||
<div>
|
||||
<div class="mb5" id="syllabus_eng_name_show" style="word-break:normal;word-wrap:normal;">
|
||||
<%= render :partial => 'layouts/syllabus_eng_name', :locals => {:syllabus => @syllabus}%>
|
||||
</div>
|
||||
<textarea class="homepageSignatureTextarea none" placeholder="请编辑英文名称" id="syllabus_eng_name_edit"></textarea>
|
||||
<div id="syllabus_eng_name_show">
|
||||
<%= render :partial => 'layouts/syllabus_eng_name', :locals => {:syllabus => @syllabus}%>
|
||||
</div>
|
||||
<!--
|
||||
<div class="pr_info_foot ">
|
||||
教师(<a class="info_foot_num c_blue" href="javascript:void(0);" target="_blank" style="cursor: default" title="课程下全部班级的教师数"><%#=teachers_num %></a>)<span>|</span>
|
||||
学生(<a class="info_foot_num c_blue" href="javascript:void(0);" target="_blank" style="cursor: default" title="课程下全部班级的学生数"><%#=students_num %></a>)<span>|</span>
|
||||
资源(<a class="info_foot_num c_blue" href="javascript:void(0);" target="_blank" style="cursor: default" title="课程下全部班级的资源数"><%#=files_num %></a>)</div>
|
||||
<div class="cl"></div>-->
|
||||
<input type="text" class="none" style="width:300px;" placeholder="请编辑英文名称" id="syllabus_eng_name_edit"/>
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
<h3 class="sy_right_title">教师团队
|
||||
<a href="javascript:void(0);" class="sy_cmore fr mr10 none" >增加教师</a>
|
||||
<div class="cl"></div>
|
||||
</h3>
|
||||
<ul class="sy_teachers_list">
|
||||
<% teacher = syllabus.user %>
|
||||
<%# teachers.each do |teacher| %>
|
||||
<li >
|
||||
<%= link_to image_tag(url_to_avatar(teacher), :width => "60", :height => "60", :class => "sy_teachers_img fl mr15"), user_path(teacher), :target => "_blank", :alt => "用户头像" %>
|
||||
<div class="sy_teachers_txt fl">
|
||||
<%= link_to teacher.show_name, user_path(teacher), :class => "sy_teachers_name", :target => "_blank" %>
|
||||
<span class="sy_teachers_span">
|
||||
<% if teacher.user_extensions && teacher.user_extensions.identity %>
|
||||
<%= get_user_roll teacher %>
|
||||
<% end%>
|
||||
</span>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</li>
|
||||
<%# end %>
|
||||
</ul>
|
|
@ -1,5 +1,5 @@
|
|||
<span style="word-break: normal; word-wrap: break-word;"><%=@syllabus.title %></span>
|
||||
|
||||
<% if User.current == syllabus.user || User.current.admin? %>
|
||||
<%= link_to image_tag("../images/signature_edit.png",width:"12px", height: "12px"), "javascript:void(0);",:id => "syllabus_edit_title_png", :class => "none", :onclick => "show_edit_title('#{@syllabus.title}');"%>
|
||||
<% end %>
|
||||
<h2 style="position:relative; display:inline;">课程名称:<%=syllabus.title %>
|
||||
<% if User.current == syllabus.user || User.current.admin? %>
|
||||
<%= link_to image_tag("../images/signature_edit.png",width:"12px", height: "12px"), "javascript:void(0);",:id => "syllabus_edit_title_png", :class => "none", :style => "width:15px; position:absolute; right: -20px; top: 15px;", :onclick => "show_edit_title('#{syllabus.title}');"%>
|
||||
<% end %>
|
||||
</h2>
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
<%= 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'%>
|
||||
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2','css/common','css/public', 'css/structure','prettify', 'css/courses','css/popup','sy_public','syllabus'%>
|
||||
<%= javascript_include_tag "course","header","attachments",'prettify' %>
|
||||
<!-- page specific tags -->
|
||||
<%= yield :header_tags -%>
|
||||
|
@ -40,7 +40,7 @@
|
|||
</head>
|
||||
<!--add by huang-->
|
||||
<body onload="prettyPrint();">
|
||||
<div class="navContainer mb10">
|
||||
<div class="navContainer">
|
||||
<% if User.current.logged? %>
|
||||
<%= render :partial => 'layouts/logined_header' %>
|
||||
<% else%>
|
||||
|
@ -48,146 +48,103 @@
|
|||
<% 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="">
|
||||
<div class="sy_class_infobox" id="project_info_<%=@course.id %>">
|
||||
<%=render :partial => 'layouts/course_base_info' %>
|
||||
</div>
|
||||
|
||||
<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>
|
||||
<div class="sy_content">
|
||||
<div class="sy_class_l fl" id="courseLSide">
|
||||
<div class="sy_class_leftnav mb12">
|
||||
<ul class="accordion">
|
||||
<% unless show_nav?(@course.course_activities.count) %>
|
||||
<li id="sy_01" class="sy_icons_index">
|
||||
<a href="<%=course_path(@course) %>" >动态<span><%=@course.course_activities.count %></span></a>
|
||||
</li>
|
||||
<% 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-->
|
||||
<% unless show_nav?(@course.boards.first ? @course.boards.first.topics.count : 0) %>
|
||||
<li id="sy_02" class="sy_icons_boards">
|
||||
<% count = @course.boards.first ? (@course.boards.first.topics.count + Message.where("board_id =? and parent_id is not ?", @course.boards.first.id, nil).count) : 0 %>
|
||||
<a href="<%=course_boards_path(@course) %>">问答区<span><%=count %></span></a>
|
||||
<%= link_to( "",course_boards_path(@course, :flag => true, :is_new => 1), :class => 'sy_class_add', :title =>"#{l(:label_message_new)}") %>
|
||||
</li>
|
||||
<% end %>
|
||||
<% unless show_nav?(@course.homework_commons.count) %>
|
||||
<li id="sy_03" class="sy_icons_hwork">
|
||||
<a href="<%= homework_common_index_path(:course => @course.id) %>">作业<span><%=homework_num %></span></a>
|
||||
<%= link_to( "",homework_common_index_path(:course => @course.id,:is_new => 1), :class => 'sy_class_add', :title =>"#{l(:label_course_homework_new)}") if is_teacher %>
|
||||
</li>
|
||||
<% end %>
|
||||
<% unless show_nav?(@course.news.count) %>
|
||||
<li id="sy_04" class="sy_icons_news">
|
||||
<a href="<%=course_news_index_path(@course) %>">通知<span><%=@course.news.count %></span></a>
|
||||
<%= link_to( "",new_course_news_path(@course,:is_new=>1), :class => 'sy_class_add', :title =>"#{l(:label_course_news_new)}") if is_teacher %>
|
||||
</li>
|
||||
<% end %>
|
||||
<% unless show_nav?(course_file_num) %>
|
||||
<li id="sy_05" class="sy_icons_files">
|
||||
<a href="<%=course_files_path(@course) %>">资源库<span><%=course_file_num %></span></a>
|
||||
<% if is_teacher || (@course.publish_resource == 1 && User.current.member_of_course?(@course)) %>
|
||||
<a class="sy_class_add" title="上传资源" href="javascript:void(0);" onclick="course_files_upload();"> </a>
|
||||
<% end %>
|
||||
</li>
|
||||
<% 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"%>
|
||||
</li>
|
||||
<% end %>
|
||||
<% unless show_nav?(course_poll_count) %>
|
||||
<li id="sy_07" class="sy_icons_poll">
|
||||
<a href="<%=poll_index_path(:polls_type => "Course", :polls_group_id => @course.id) %>">问卷调查<span><%=course_poll_count %></span></a>
|
||||
<%= link_to( "", new_poll_path(:polls_type => "Course",:polls_group_id => @course.id), :class => 'sy_class_add', :title =>"#{l(:label_new_poll)}") if is_teacher %>
|
||||
</li>
|
||||
<% end %>
|
||||
<% count = User.current.allowed_to?(:as_teacher,@course)? @course.exercises.count : @course.exercises.where("exercise_status <> 1").count %>
|
||||
<% unless show_nav?(count) %>
|
||||
<li id="sy_08" class="sy_icons_exercise">
|
||||
<a href="<%=exercise_index_path(:course_id => @course.id) %>">在线测验<span><%=count %></span></a>
|
||||
<%= link_to( "", new_exercise_path(:course_id => @course.id), :class => 'sy_class_add', :title =>"新建试卷") if is_teacher %>
|
||||
</li>
|
||||
<% end %>
|
||||
<% statistics_count = 0 %>
|
||||
<% unless show_nav?(statistics_count) %>
|
||||
<li id="sy_09" class="sy_icons_st">
|
||||
<a href="<%=statistics_course_course_path(@course) %>">统计<span></span></a>
|
||||
<!--<a href="javascript:void(0);" class="sy_class_add"></a>-->
|
||||
</li>
|
||||
<% 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 || statistics_count == 0%>
|
||||
<li id="expand_tools_expand" class="sy_icons_more"><a href="javascript:void(0)"> 更多</a>
|
||||
</li>
|
||||
<ul class="sub-menu undis" id="navContentCourse">
|
||||
<%= render :partial => 'courses/tool_expand' %>
|
||||
</ul>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div><!--sy_class_leftnav 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">
|
||||
<div class="sy_class_leftbox mb15" >
|
||||
<h3>班级推荐</h3>
|
||||
<%= render :partial => 'courses/recommendation', :locals => {:course => @course} %>
|
||||
</div>
|
||||
</div><!--sy_class_l end-->
|
||||
<div class="fl">
|
||||
<%= yield %>
|
||||
<%#= render_flash_messages %>
|
||||
<%#= call_hook :view_layouts_base_content %>
|
||||
</div>
|
||||
|
||||
</div><!--sy_class_r end-->
|
||||
<div class="cl"></div>
|
||||
</div><!--sy_content end-->
|
||||
</div>
|
||||
|
||||
</div><!--Content end-->
|
||||
</div><!--Container end-->
|
||||
|
||||
<div class="cl"></div>
|
||||
<%= render :partial => 'layouts/footer' %>
|
||||
<div class="cl"></div>
|
||||
<div class="cl"></div>
|
||||
<%= render :partial => 'layouts/footer' %>
|
||||
<div class="cl"></div>
|
||||
|
||||
<%= render :partial => 'layouts/new_feedback' %>
|
||||
<div id="ajax-indicator" style="display:none;">
|
||||
|
@ -199,9 +156,15 @@
|
|||
<script>
|
||||
var blog_artile_list_html = '';
|
||||
$(function(){
|
||||
if($("#sy_0<%=@left_nav_type %>").length > 0){
|
||||
$("#sy_0<%=@left_nav_type %> a").addClass('active');
|
||||
} else {
|
||||
$("#expand_tools_expand a").addClass('active');
|
||||
$("#navContentCourse").toggle();
|
||||
}
|
||||
$(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(){
|
||||
|
@ -239,7 +202,7 @@
|
|||
})
|
||||
}
|
||||
|
||||
})
|
||||
});
|
||||
//资源库上传附件
|
||||
function course_files_upload(){
|
||||
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'files/upload_course_files',:locals => {:course => @course,:course_attachment_type => 1}) %>');
|
||||
|
@ -271,6 +234,9 @@
|
|||
}
|
||||
|
||||
$("#expand_tools_expand").click(function(){
|
||||
var accordion_head = $('.accordion > li > a');
|
||||
accordion_head.removeClass('active');
|
||||
$("#expand_tools_expand a").addClass('active');
|
||||
$("#navContentCourse").toggle();
|
||||
});
|
||||
</script>
|
||||
|
|
|
@ -7,16 +7,15 @@
|
|||
<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 'jquery/jquery-ui-1.9.2','css/common','css/public','css/structure','css/courses','css/popup','prettify','syllabus','sy_public',:media => 'all'%>
|
||||
<%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %>
|
||||
<%= javascript_heads %>
|
||||
<%= javascript_include_tag "bootstrap","avatars","course",'attachments','prettify','syllabus'%>
|
||||
<%= javascript_include_tag "bootstrap","avatars","course",'attachments','prettify','syllabus','cookie'%>
|
||||
<%= 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 type="text/javascript" src="/javascripts/MathJax/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
|
||||
</script>
|
||||
<!-- 配置 : 在生成的公式图片上去掉Math定义的右键菜单,$$ $$ \( \) \[ \] 中的公式给予显示-->
|
||||
<script type="text/x-mathjax-config">
|
||||
|
@ -39,79 +38,30 @@
|
|||
<% 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();">
|
||||
|
||||
<div class="sy_contanier">
|
||||
<div class="sy_top">
|
||||
<div class="sy_top_con" onmouseover="$('#syllabus_edit_title_png').show();$('#syllabus_edit_ng_name_png').show();" onmouseout="$('#syllabus_edit_title_png').hide();$('#syllabus_edit_ng_name_png').hide();"> <!-- 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>
|
||||
|
||||
<div class="homepageLeftMenuContainer" id="syllabus_base_info" onmouseover="$('#syllabus_attr_edit').show();" onmouseout="$('#syllabus_attr_edit').hide();">
|
||||
<div class="sy_content ">
|
||||
<div class="sy_con_l fl mb15">
|
||||
<%= yield %>
|
||||
</div><!--sy_con_l end-->
|
||||
<div class="sy_con_r fr ">
|
||||
<div class="sy_right_box" id="syllabus_base_info">
|
||||
<%= 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 class="sy_right_box">
|
||||
<%= render :partial => 'layouts/syllabus_teacher_list', :locals => {:syllabus => @syllabus} %>
|
||||
</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><!--sy_con_r end-->
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<div class="fontGrey2 mt10 ml20">访问计数 <%=@syllabus.visits %> (自2016年7月)</div>
|
||||
</div><!--sy_content end-->
|
||||
|
||||
</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>
|
||||
|
@ -136,6 +86,22 @@
|
|||
$("#courseMenu").mouseleave(function () {
|
||||
$("#topnav_course_menu").hide();
|
||||
});
|
||||
// Store variables
|
||||
var accordion_head = $('.accordion > li > a'),
|
||||
accordion_body = $('.accordion li > .sub-menu');
|
||||
|
||||
// Click function
|
||||
accordion_head.on('click', function(event) {
|
||||
// Disable header links
|
||||
event.preventDefault();
|
||||
// Show and hide the tabs on click
|
||||
if ($(this).attr('class') != 'active'){
|
||||
accordion_body.slideUp('normal');
|
||||
$(this).next().stop(true,true).slideToggle('normal');
|
||||
accordion_head.removeClass('active');
|
||||
$(this).addClass('active');
|
||||
}
|
||||
});
|
||||
});
|
||||
function leftCourseslistChange(){
|
||||
$('#homepageLeftMenuCourses').slideToggle();
|
||||
|
@ -146,6 +112,37 @@
|
|||
function show_edit_base_info() {
|
||||
$("#syllabus_base_info").html("<%=escape_javascript(render :partial => 'layouts/syllabus_edit_info', :locals => {:syllabus => @syllabus}) %>");
|
||||
}
|
||||
function g(o){return document.getElementById(o);}
|
||||
function HoverLi(n){
|
||||
for(var i=1;i<=2;i++){
|
||||
//g('sy_tab_nav_'+i).className='sy_tab_nomal';
|
||||
//g('sy_tab_con_'+i).className='undis';
|
||||
}
|
||||
//g('sy_tab_con_'+n).className='dis';
|
||||
//g('sy_tab_nav_'+n).className='sy_tab_hover';
|
||||
if(n == 1) {
|
||||
window.location.href = '<%=syllabus_path(@syllabus) %>';
|
||||
} else {
|
||||
window.location.href = '<%=syllabus_courselist_syllabus_path(@syllabus) %>';
|
||||
}
|
||||
}
|
||||
//侧导航栏配置设置
|
||||
$(".homepageLeftMenuCoursesLine").mouseover(function(){
|
||||
$(this).children(".shild").css("background","url(/images/hwork_icon.png) -82px -399px no-repeat");
|
||||
$(this).children().css("color","#ffffff");
|
||||
});
|
||||
$(".homepageLeftMenuCoursesLine").mouseout(function(){
|
||||
$(this).children(".shild").css("background","url(/images/hwork_icon.png) -6px -354px no-repeat");
|
||||
$(this).children().css("color","#808080");
|
||||
});
|
||||
$(".subNavRow").mouseover(function(){
|
||||
$(this).css("background-color","#269ac9");
|
||||
$(this).children().css("color","#ffffff");
|
||||
});
|
||||
$(".subNavRow").mouseout(function(){
|
||||
$(this).css("background-color","#ffffff");
|
||||
$(this).children().css("color","#888888");
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -110,13 +110,8 @@
|
|||
<%= link_to image_tag(url_to_avatar(reply.author), :width => 33,:height => 33), user_path(reply.author) %>
|
||||
</div>
|
||||
<div class="homepagePostReplyDes">
|
||||
<div class="homepagePostReplyPublisher">
|
||||
<%= link_to reply.creator_user.show_name, user_url_in_org(reply.creator_user.id), :class => "newsBlue mr10 f14" %>
|
||||
<%= time_from_now(reply.created_on) %>
|
||||
</div>
|
||||
<% if !reply.parent.nil? && !reply.parent.parent.nil? %>
|
||||
<%= render :partial => 'users/message_contents', :locals => {:comment => reply}%>
|
||||
<% end %>
|
||||
<%= render :partial => 'users/message_contents', :locals => {:comment => reply}%>
|
||||
|
||||
<div class="homepagePostReplyContent upload_img break_word table_maxWidth" id="reply_message_description_<%= reply.id %>">
|
||||
<%= reply.content.html_safe%>
|
||||
</div>
|
||||
|
|
|
@ -142,13 +142,8 @@
|
|||
<%= link_to image_tag(url_to_avatar(reply.author), :width => 33, :height => 33), user_path(reply.author) %>
|
||||
</div>
|
||||
<div class="homepagePostReplyDes">
|
||||
<div class="homepagePostReplyPublisher">
|
||||
<%= link_to reply.creator_user.show_name, user_url_in_org(reply.creator_user.id), :class => "newsBlue mr10 f14" %>
|
||||
<%= time_from_now(reply.created_on) %>
|
||||
</div>
|
||||
<% if !reply.parent.nil? && !reply.parent.parent.nil? %>
|
||||
<%= render :partial => 'users/message_contents', :locals => {:comment => reply} %>
|
||||
<% end %>
|
||||
<%= render :partial => 'users/message_contents', :locals => {:comment => reply} %>
|
||||
|
||||
<div class="homepagePostReplyContent upload_img break_word table_maxWidth" id="reply_message_description_<%= reply.id %>">
|
||||
<%= reply.content.html_safe %>
|
||||
</div>
|
||||
|
|
|
@ -171,13 +171,8 @@
|
|||
<%= link_to image_tag(url_to_avatar(reply.author), :width => 33,:height => 33), user_path(reply.author) %>
|
||||
</div>
|
||||
<div class="homepagePostReplyDes">
|
||||
<div class="homepagePostReplyPublisher">
|
||||
<%= link_to reply.creator_user.show_name, user_url_in_org(reply.creator_user.id), :class => "newsBlue mr10 f14" %>
|
||||
<%= time_from_now(reply.created_on) %>
|
||||
</div>
|
||||
<% if !reply.parent.nil? && !reply.parent.parent.nil? %>
|
||||
<%= render :partial => 'users/message_contents', :locals => {:comment => reply}%>
|
||||
<% end %>
|
||||
<%= render :partial => 'users/message_contents', :locals => {:comment => reply}%>
|
||||
|
||||
<div class="homepagePostReplyContent upload_img break_word table_maxWidth" id="reply_message_description_<%= reply.id %>">
|
||||
<%= reply.content.html_safe%>
|
||||
</div>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<%= content_for(:header_tags) do %>
|
||||
<%= import_ke(enable_at: false, prettify: false, init_activity: false) %>
|
||||
<%= import_ke(enable_at: false, prettify: false, init_activity: true) %>
|
||||
<% end %>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
@ -9,23 +9,8 @@
|
|||
});
|
||||
</script>
|
||||
<script>
|
||||
function expand_reply(container,btnid){
|
||||
var target = $(container).children();
|
||||
var btn = $(btnid);
|
||||
if(btn.data('init')=='0'){
|
||||
btn.data('init',1);
|
||||
btn.html('收起回复');
|
||||
target.show();
|
||||
}else{
|
||||
btn.data('init',0);
|
||||
btn.html('展开更多');
|
||||
target.hide();
|
||||
target.eq(0).show();
|
||||
target.eq(1).show();
|
||||
target.eq(2).show();
|
||||
}
|
||||
}
|
||||
$(function() {
|
||||
sd_create_editor_from_data(<%= @news.id%>,null,"100%", "<%=@news.class.to_s%>");
|
||||
showNormalImage('message_description_<%= @news.id %>');
|
||||
});
|
||||
</script>
|
||||
|
@ -97,97 +82,7 @@
|
|||
</div>
|
||||
<div class="cl"></div>
|
||||
<div class="homepagePostReply">
|
||||
<div class="homepagePostReplyBanner">
|
||||
<div class="homepagePostReplyBannerCount">回复
|
||||
<sapn class="mr15"><%= @comments.count>0 ? "(#{@comments.count})" : "" %></sapn><span style="color: #cecece;">▪</span>
|
||||
<span id="praise_count_<%=@news.id %>">
|
||||
<%=render :partial=> "praise_tread/praise", :locals => {:activity=>@news, :user_activity_id=>@news.id,:type=>"activity"}%>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<% unless @comments.empty? %>
|
||||
<div class="" id="reply_div_<%=@news.id %>">
|
||||
<% @comments.each_with_index do |reply,i| %>
|
||||
<script type="text/javascript">
|
||||
$(function(){
|
||||
showNormalImage('reply_message_description_<%= reply.id %>');
|
||||
autoUrl('reply_message_description_<%= reply.id %>');
|
||||
});
|
||||
</script>
|
||||
<div class="homepagePostReplyContainer" onmouseover="$('#reply_edit_menu_<%= reply.id%>').show();" onmouseout="$('#reply_edit_menu_<%= reply.id%>').hide();">
|
||||
<div class="homepagePostReplyPortrait">
|
||||
<%= link_to image_tag(url_to_avatar(reply.author), :width => 33,:height => 33), user_path(reply.author) %>
|
||||
</div>
|
||||
<div class="homepagePostReplyDes">
|
||||
<div class="homepagePostReplyPublisher">
|
||||
<% if reply.try(:author).try(:realname) == ' ' %>
|
||||
<%= link_to reply.try(:author), user_path(reply.author_id,:host=>Setting.host_user), :class => "newsBlue mr10 f14" %>
|
||||
<% else %>
|
||||
<%= link_to reply.try(:author).try(:realname), user_path(reply.author_id,:host=>Setting.host_user), :class => "newsBlue mr10 f14" %>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="homepagePostReplyContent upload_img break_word table_maxWidth" id="reply_message_description_<%= reply.id %>">
|
||||
<%= reply.comments.html_safe%>
|
||||
</div>
|
||||
<div style="margin-top: -7px; margin-bottom: 5px">
|
||||
<%= format_time(reply.created_on) %>
|
||||
<div class="fr" id="reply_edit_menu_<%= reply.id%>" style="display: none">
|
||||
<span id="reply_praise_count_<%=reply.id %>">
|
||||
<%=render :partial=> "praise_tread/praise", :locals => {:activity=>reply, :user_activity_id=>reply.id,:type=>"reply"}%>
|
||||
</span>
|
||||
<%= link_to_if_authorized_course(
|
||||
l(:button_delete),
|
||||
{:controller => 'comments',
|
||||
:action => 'destroy', :id => @news,
|
||||
:comment_id => reply},
|
||||
:method => :delete,
|
||||
:class => 'fr newsGrey mr10',
|
||||
:data => {:confirm => l(:text_are_you_sure)},
|
||||
:title => l(:button_delete)
|
||||
) %>
|
||||
</div>
|
||||
</div>
|
||||
<p id="reply_message_<%= reply.id%>"></p>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<% end %>
|
||||
<div class="cl"></div>
|
||||
<% if @news.commentable? %>
|
||||
<div class="talkWrapMsg" nhname="about_talk_reply">
|
||||
<em class="talkWrapArrow"></em>
|
||||
<div class="cl"></div>
|
||||
<div class="talkConIpt ml5 mb10" id="reply<%= @news.id %>">
|
||||
<%= form_for @comment, :url=>{:controller => 'comments', :action => 'create', :id => @news}, :html => {:multipart => true, :id => 'add_comment_form'} do |f| %>
|
||||
<div class="box" id="news_comment">
|
||||
<%= hidden_field_tag :asset_id,params[:asset_id],:required => false,:style => 'display:none' %>
|
||||
<%= f.kindeditor :comments, :editor_id => 'comment_editor',
|
||||
:owner_id => @comment.nil? ? 0: @comment.id,
|
||||
:owner_type => OwnerTypeHelper::COMMENT,
|
||||
:width => '99%',
|
||||
:height => 100,
|
||||
:minHeight=>100,
|
||||
:input_html => { :id => 'comment_content',
|
||||
:class => 'talk_text fl',
|
||||
:maxlength => 5000 }%>
|
||||
</div>
|
||||
<p id="add_reply_news"></p>
|
||||
<p class="mt10">
|
||||
<a href="javascript:void(0)" class="grey_btn fr ml10 mr5" onclick="KindEditor.instances[0].html('');">
|
||||
<%= l(:label_cancel_with_space) %>
|
||||
</a>
|
||||
<a href="javascript:void(0)" class="blue_btn fr" id="news_submit_comment">
|
||||
<%= l(:label_comment_with_space) %>
|
||||
</a>
|
||||
</p>
|
||||
<% end %>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<%= render :partial => 'news/news_all_replies' %>
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
|
|
|
@ -0,0 +1,99 @@
|
|||
<div class="homepagePostReplyBanner">
|
||||
<div class="homepagePostReplyBannerCount">回复
|
||||
<sapn class="mr15"><%= @comments.count>0 ? "(#{@comments.count})" : "" %></sapn><span style="color: #cecece;">▪</span>
|
||||
<span id="praise_count_<%=@news.id %>">
|
||||
<%=render :partial=> "praise_tread/praise", :locals => {:activity=>@news, :user_activity_id=>@news.id,:type=>"activity"}%>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<% unless @comments.empty? %>
|
||||
<div class="" id="reply_div_<%=@news.id %>">
|
||||
<% @comments.each_with_index do |comment,i| %>
|
||||
<script type="text/javascript">
|
||||
$(function(){
|
||||
showNormalImage('reply_message_description_<%= comment.id %>');
|
||||
autoUrl('reply_message_description_<%= 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">
|
||||
<%= render :partial => 'users/news_contents', :locals => {:comment => comment}%>
|
||||
|
||||
<% if !comment.content_detail.blank? %>
|
||||
<div class="homepagePostReplyContent break_word list_style upload_img table_maxWidth" id="reply_content_<%= comment.id %>">
|
||||
<%= comment.content_detail.html_safe %>
|
||||
</div>
|
||||
<div class="orig_reply mb10 mt-10">
|
||||
<div class="reply">
|
||||
<span class="reply-right">
|
||||
<span id="reply_praise_count_<%=comment.id %>">
|
||||
<%=render :partial=> "praise_tread/praise", :locals => {:activity=>comment, :user_activity_id=>comment.id,:type=>"reply"}%>
|
||||
</span>
|
||||
<span style="position: relative" class="fr mr20">
|
||||
<%= link_to(
|
||||
l(:button_reply),
|
||||
{:controller => 'comments',:action => 'quote', :id => comment},
|
||||
:remote => true,
|
||||
:method => 'get',
|
||||
:title => l(:button_reply))%>
|
||||
<span id="reply_iconup_<%= comment.id %>" class="reply_iconup02" style="display: none"> ︿</span>
|
||||
</span>
|
||||
<%= link_to(
|
||||
l(:button_delete),
|
||||
{:controller => 'comments',
|
||||
:action => 'destroy', :id => @news,
|
||||
:comment_id => comment},
|
||||
:method => :delete,
|
||||
:class => 'fr mr20',
|
||||
:data => {:confirm => l(:text_are_you_sure)},
|
||||
:title => l(:button_delete)
|
||||
) if @news.author == User.current %>
|
||||
</span>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
</div>
|
||||
<p id="reply_message_<%= comment.id%>"></p>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</li>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<% end %>
|
||||
<div class="cl"></div>
|
||||
<% if @news.commentable? %>
|
||||
<div class="talkWrapMsg" nhname="about_talk_reply">
|
||||
<em class="talkWrapArrow"></em>
|
||||
<div class="cl"></div>
|
||||
<div class="talkConIpt ml5 mb10" id="reply<%= @news.id %>">
|
||||
<%= form_for @comment, :url=>{:controller => 'comments', :action => 'create', :id => @news}, :html => {:multipart => true, :id => 'add_comment_form'} do |f| %>
|
||||
<div class="box" id="news_comment">
|
||||
<%= hidden_field_tag :asset_id,params[:asset_id],:required => false,:style => 'display:none' %>
|
||||
<%= f.kindeditor :comments, :editor_id => 'comment_editor',
|
||||
:owner_id => @comment.nil? ? 0: @comment.id,
|
||||
:owner_type => OwnerTypeHelper::COMMENT,
|
||||
:width => '99%',
|
||||
:height => 100,
|
||||
:minHeight=>100,
|
||||
:input_html => { :id => 'comment_content',
|
||||
:class => 'talk_text fl',
|
||||
:maxlength => 5000 }%>
|
||||
</div>
|
||||
<p id="add_reply_news"></p>
|
||||
<p class="mt10">
|
||||
<a href="javascript:void(0)" class="grey_btn fr ml10 mr5" onclick="KindEditor.instances[0].html('');">
|
||||
<%= l(:label_cancel_with_space) %>
|
||||
</a>
|
||||
<a href="javascript:void(0)" class="blue_btn fr" id="news_submit_comment">
|
||||
<%= l(:label_comment_with_space) %>
|
||||
</a>
|
||||
</p>
|
||||
<% end %>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
|
@ -1,5 +1,5 @@
|
|||
<%= content_for(:header_tags) do %>
|
||||
<%= import_ke(enable_at: false, prettify: false, init_activity: false) %>
|
||||
<%= import_ke(enable_at: false, prettify: false, init_activity: true) %>
|
||||
<% end %>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
@ -9,23 +9,8 @@
|
|||
});
|
||||
</script>
|
||||
<script>
|
||||
function expand_reply(container,btnid){
|
||||
var target = $(container).children();
|
||||
var btn = $(btnid);
|
||||
if(btn.data('init')=='0'){
|
||||
btn.data('init',1);
|
||||
btn.html('收起回复');
|
||||
target.show();
|
||||
}else{
|
||||
btn.data('init',0);
|
||||
btn.html('展开更多');
|
||||
target.hide();
|
||||
target.eq(0).show();
|
||||
target.eq(1).show();
|
||||
target.eq(2).show();
|
||||
}
|
||||
}
|
||||
$(function() {
|
||||
sd_create_editor_from_data(<%= @news.id%>,null,"100%", "<%=@news.class.to_s%>");
|
||||
showNormalImage('message_description_<%= @news.id %>');
|
||||
});
|
||||
</script>
|
||||
|
@ -87,90 +72,7 @@
|
|||
</div>
|
||||
<div class="cl"></div>
|
||||
<div class="homepagePostReply">
|
||||
<% unless @comments.empty? %>
|
||||
<div class="homepagePostReplyBanner">
|
||||
<div class="homepagePostReplyBannerCount">回复(<%=@comments.count %>)</div>
|
||||
<div class="homepagePostReplyBannerTime"></div>
|
||||
</div>
|
||||
<div class="" id="reply_div_<%=@news.id %>">
|
||||
<% @comments.each_with_index do |reply,i| %>
|
||||
<script type="text/javascript">
|
||||
$(function(){
|
||||
showNormalImage('reply_message_description_<%= reply.id %>');
|
||||
autoUrl('reply_message_description_<%= reply.id %>');
|
||||
});
|
||||
</script>
|
||||
<div class="homepagePostReplyContainer" onmouseover="$('#reply_edit_menu_<%= reply.id%>').show();" onmouseout="$('#reply_edit_menu_<%= reply.id%>').hide();">
|
||||
<div class="homepagePostReplyPortrait">
|
||||
<%= link_to image_tag(url_to_avatar(reply.author), :width => 33,:height => 33), user_path(reply.author) %>
|
||||
</div>
|
||||
<div class="homepagePostReplyDes">
|
||||
<div class="homepagePostReplyPublisher">
|
||||
<% if reply.try(:author).try(:realname) == ' ' %>
|
||||
<%= link_to reply.try(:author), user_path(reply.author_id,:host=>Setting.host_user), :class => "newsBlue mr10 f14" %>
|
||||
<% else %>
|
||||
<%= link_to reply.try(:author).try(:realname), user_path(reply.author_id,:host=>Setting.host_user), :class => "newsBlue mr10 f14" %>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="homepagePostReplyContent upload_img break_word table_maxWidth" id="reply_message_description_<%= reply.id %>">
|
||||
<%= reply.comments.html_safe%>
|
||||
</div>
|
||||
<div style="margin-top: -7px; margin-bottom: 5px">
|
||||
<%= format_time(reply.created_on) %>
|
||||
<div class="fr" id="reply_edit_menu_<%= reply.id%>" style="display: none">
|
||||
<%= link_to_if_authorized_course(
|
||||
l(:button_delete),
|
||||
{:controller => 'comments',
|
||||
:action => 'destroy', :id => @news,
|
||||
:comment_id => reply},
|
||||
:method => :delete,
|
||||
:class => 'fr newsGrey',
|
||||
:data => {:confirm => l(:text_are_you_sure)},
|
||||
:title => l(:button_delete)
|
||||
) %>
|
||||
</div>
|
||||
</div>
|
||||
<p id="reply_message_<%= reply.id%>"></p>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<% end %>
|
||||
<div class="cl"></div>
|
||||
<% if @news.commentable? %>
|
||||
<div class="talkWrapMsg" nhname="about_talk_reply">
|
||||
<em class="talkWrapArrow"></em>
|
||||
<div class="cl"></div>
|
||||
<div class="talkConIpt ml5 mb10" id="reply<%= @news.id %>">
|
||||
<%= form_for @comment, :url=>{:controller => 'comments', :action => 'create', :id => @news}, :html => {:multipart => true, :id => 'add_comment_form'} do |f| %>
|
||||
<div class="box" id="news_comment">
|
||||
<%= hidden_field_tag :asset_id,params[:asset_id],:required => false,:style => 'display:none' %>
|
||||
<%= f.kindeditor :comments, :editor_id => 'comment_editor',
|
||||
:owner_id => @comment.nil? ? 0: @comment.id,
|
||||
:owner_type => OwnerTypeHelper::COMMENT,
|
||||
:width => '99%',
|
||||
:height => 100,
|
||||
:minHeight=>100,
|
||||
:input_html => { :id => 'comment_content',
|
||||
:class => 'talk_text fl',
|
||||
:maxlength => 5000 }%>
|
||||
</div>
|
||||
<p id="add_reply_news"></p>
|
||||
<p class="mt10">
|
||||
<a href="javascript:void(0)" class="grey_btn fr ml10 mr5" onclick="KindEditor.instances[0].html('');">
|
||||
<%= l(:label_cancel_with_space) %>
|
||||
</a>
|
||||
<a href="javascript:void(0)" class="blue_btn fr" id="news_submit_comment">
|
||||
<%= l(:label_comment_with_space) %>
|
||||
</a>
|
||||
</p>
|
||||
<% end %>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<%= render :partial => 'news/news_all_replies' %>
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<%= content_for(:header_tags) do %>
|
||||
<%= import_ke(enable_at: false, prettify: false, init_activity: false) %>
|
||||
<%= import_ke(enable_at: false, prettify: false, init_activity: true) %>
|
||||
<% end %>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
@ -9,23 +9,8 @@
|
|||
});
|
||||
</script>
|
||||
<script>
|
||||
function expand_reply(container,btnid){
|
||||
var target = $(container).children();
|
||||
var btn = $(btnid);
|
||||
if(btn.data('init')=='0'){
|
||||
btn.data('init',1);
|
||||
btn.html('收起回复');
|
||||
target.show();
|
||||
}else{
|
||||
btn.data('init',0);
|
||||
btn.html('展开更多');
|
||||
target.hide();
|
||||
target.eq(0).show();
|
||||
target.eq(1).show();
|
||||
target.eq(2).show();
|
||||
}
|
||||
}
|
||||
$(function() {
|
||||
sd_create_editor_from_data(<%= @news.id%>,null,"100%", "<%=@news.class.to_s%>");
|
||||
showNormalImage('message_description_<%= @news.id %>');
|
||||
});
|
||||
</script>
|
||||
|
@ -97,90 +82,7 @@
|
|||
</div>
|
||||
<div class="cl"></div>
|
||||
<div class="homepagePostReply">
|
||||
<% unless @comments.empty? %>
|
||||
<div class="homepagePostReplyBanner">
|
||||
<div class="homepagePostReplyBannerCount">回复(<%=@comments.count %>)</div>
|
||||
<div class="homepagePostReplyBannerTime"></div>
|
||||
</div>
|
||||
<div class="" id="reply_div_<%=@news.id %>">
|
||||
<% @comments.each_with_index do |reply,i| %>
|
||||
<script type="text/javascript">
|
||||
$(function(){
|
||||
showNormalImage('reply_message_description_<%= reply.id %>');
|
||||
autoUrl('reply_message_description_<%= reply.id %>');
|
||||
});
|
||||
</script>
|
||||
<div class="homepagePostReplyContainer" onmouseover="$('#reply_edit_menu_<%= reply.id%>').show();" onmouseout="$('#reply_edit_menu_<%= reply.id%>').hide();">
|
||||
<div class="homepagePostReplyPortrait">
|
||||
<%= link_to image_tag(url_to_avatar(reply.author), :width => 33,:height => 33), user_path(reply.author) %>
|
||||
</div>
|
||||
<div class="homepagePostReplyDes">
|
||||
<div class="homepagePostReplyPublisher">
|
||||
<% if reply.try(:author).try(:realname) == ' ' %>
|
||||
<%= link_to reply.try(:author), user_path(reply.author_id,:host=>Setting.host_user), :class => "newsBlue mr10 f14" %>
|
||||
<% else %>
|
||||
<%= link_to reply.try(:author).try(:realname), user_path(reply.author_id,:host=>Setting.host_user), :class => "newsBlue mr10 f14" %>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="homepagePostReplyContent upload_img break_word table_maxWidth" id="reply_message_description_<%= reply.id %>">
|
||||
<%= reply.comments.html_safe%>
|
||||
</div>
|
||||
<div style="margin-top: -7px; margin-bottom: 5px">
|
||||
<%= format_time(reply.created_on) %>
|
||||
<div class="fr" id="reply_edit_menu_<%= reply.id%>" style="display: none">
|
||||
<%= link_to(
|
||||
l(:button_delete),
|
||||
{:controller => 'comments',
|
||||
:action => 'destroy', :id => @news,
|
||||
:comment_id => reply},
|
||||
:method => :delete,
|
||||
:class => 'fr newsGrey',
|
||||
:data => {:confirm => l(:text_are_you_sure)},
|
||||
:title => l(:button_delete)
|
||||
) if @news.author == User.current %>
|
||||
</div>
|
||||
</div>
|
||||
<p id="reply_message_<%= reply.id%>"></p>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<% end %>
|
||||
<div class="cl"></div>
|
||||
<% if @news.commentable? %>
|
||||
<div class="talkWrapMsg" nhname="about_talk_reply">
|
||||
<em class="talkWrapArrow"></em>
|
||||
<div class="cl"></div>
|
||||
<div class="talkConIpt ml5 mb10" id="reply<%= @news.id %>">
|
||||
<%= form_for @comment, :url=>{:controller => 'comments', :action => 'create', :id => @news}, :html => {:multipart => true, :id => 'add_comment_form'} do |f| %>
|
||||
<div class="box" id="news_comment">
|
||||
<%= hidden_field_tag :asset_id,params[:asset_id],:required => false,:style => 'display:none' %>
|
||||
<%= f.kindeditor :comments, :editor_id => 'comment_editor',
|
||||
:owner_id => @comment.nil? ? 0: @comment.id,
|
||||
:owner_type => OwnerTypeHelper::COMMENT,
|
||||
:width => '99%',
|
||||
:height => 100,
|
||||
:minHeight=>100,
|
||||
:input_html => { :id => 'comment_content',
|
||||
:class => 'talk_text fl',
|
||||
:maxlength => 5000 }%>
|
||||
</div>
|
||||
<p id="add_reply_news"></p>
|
||||
<p class="mt10">
|
||||
<a href="javascript:void(0)" class="grey_btn fr ml10 mr5" onclick="KindEditor.instances[0].html('');">
|
||||
<%= l(:label_cancel_with_space) %>
|
||||
</a>
|
||||
<a href="javascript:void(0)" class="blue_btn fr" id="news_submit_comment">
|
||||
<%= l(:label_comment_with_space) %>
|
||||
</a>
|
||||
</p>
|
||||
<% end %>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<%= render :partial => 'news/news_all_replies' %>
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue