Merge branch 'weixin_guange' of https://git.trustie.net/jacknudt/trustieforge into weixin_guange

This commit is contained in:
Tim 2016-07-26 17:30:27 +08:00
commit a2acbba34a
189 changed files with 2912 additions and 1659 deletions

1
.gitignore vendored
View File

@ -36,3 +36,4 @@ public/javascripts/wechat/node_modules/
.ruby-version
.access_token
tmux*.log
config/wechat.yml

View File

@ -51,7 +51,7 @@ gem 'elasticsearch-rails'
### profile
gem 'oneapm_rpm'
# gem 'oneapm_rpm'
group :development do
gem 'grape-swagger'

View File

@ -27,7 +27,7 @@ module Mobile
format :json
content_type :json, "application/json;charset=UTF-8"
use ActionDispatch::Session::CookieStore
use Mobile::Middleware::ErrorHandler
use Middleware::ErrorHandler
helpers do
def logger
@ -43,9 +43,9 @@ module Mobile
end
def current_user
openid = params[:openid]
openid = session[:wechat_openid]
if openid
uw = UserWechat.find_by_openid(params[:openid])
uw = UserWechat.find_by_openid(openid)
return uw.user if uw
end

View File

@ -0,0 +1,13 @@
#coding=utf-8
#
module Mobile
module Exceptions
class AuthException < StandardError
attr_reader :err_code, :msg
def initialize(code, msg)
@err_code = code
@msg = msg
end
end
end
end

View File

@ -1,3 +1,6 @@
#coding=utf-8
module Mobile
module Middleware
class ErrorHandler < Grape::Middleware::Base
@ -6,7 +9,10 @@ module Mobile
begin
@app.call(@env)
rescue =>e
message = {status: 1, message: e.message }.to_json
code = 1
message = {status: code, message: e.message }.to_json
Rails.logger.error e.inspect
Rails.logger.error e.backtrace.join("\n")
status = 200

View File

@ -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

View File

@ -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] || ""

View File

@ -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

View File

@ -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

View File

@ -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
@ -889,25 +891,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'}
@ -939,6 +944,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
@ -1122,6 +1128,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

View File

@ -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

View File

@ -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 {

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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'

View File

@ -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'

View File

@ -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

View File

@ -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|

View File

@ -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}")

View File

@ -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

View File

@ -381,14 +381,24 @@ class StudentWorkController < ApplicationController
@is_evaluation = @homework.homework_detail_manual && @homework.homework_detail_manual.comment_status == 2 && !@is_teacher #是不是匿评
@show_all = false
course_group = CourseGroup.find_by_id(@group) if @group
if course_group
group_students = course_group.users
if group_students.empty?
student_in_group = '(0)'
if @group
if @group == "0"
none_group_students = @course.members.select{ |member| member.course_group_id == 0 }
if none_group_students.empty?
student_in_group = '(0)'
else
student_in_group = '(' + none_group_students.map{ |member| member.user_id }.join(',') + ')'
end
else
student_in_group = '(' + group_students.map{|user| user.id}.join(',') + ')'
course_group = CourseGroup.find_by_id(@group)
group_students = course_group.users
if group_students.empty?
student_in_group = '(0)'
else
student_in_group = '(' + group_students.map{ |user| user.id }.join(',') + ')'
end
end
#开放作品 || 老师 || 超级管理员 || 禁用匿评&&作业截止&&已提交作品 显示所有列表
if (@homework.is_open == 1 && @course.is_public == 1) || (@homework.is_open == 1 && @course.is_public == 0 && User.current.member_of_course?(@course)) || @is_teacher || User.current.admin? || (User.current.member_of_course?(@course) && @homework.anonymous_comment == 1 && Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") < Time.now.strftime("%Y-%m-%d") && !@homework.student_works.has_committed.where(:user_id => User.current.id).empty?)
if @order == 'lastname'
@ -526,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
@ -918,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

View File

@ -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

View File

@ -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]

View File

@ -288,8 +288,7 @@ class WechatsController < ActionController::Base
session[:wechat_code] = params[:code] if params[:code]
openid = get_openid_from_code(params[:code])
@wechat_user = user_binded?(openid)
render 'wechats/login', layout: 'base_wechat'
render 'wechats/user_activities', layout: nil
end
def user_activities
@ -299,13 +298,18 @@ class WechatsController < ActionController::Base
unless open_id
render 'wechats/open_wechat', layout: nil and return
end
if params[:state] == 'myclass'
@course_id = params[:id];
end
unless user_binded?(open_id)
@path = '/login'
else
if params[:state] == 'myclass'
@course_id = params[:id];
end
session[:wechat_openid] = open_id
if params[:code]
redirect_to "/wechat/user_activities##{@path}?id=#{params[:id]}" and return
session[:wechat_openid] = open_id
if params[:code]
redirect_to "/wechat/user_activities##{@path}?id=#{params[:id]}" and return
end
end
render 'wechats/user_activities', layout: nil
end

View File

@ -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)

View File

@ -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
@ -591,6 +591,26 @@ module CoursesHelper
Course.tagged_with(tag_name).order('updated_at desc')
end
# 获取动态列表名称
def get_acts_list_type type
case type
when "homework"
">" + l(:label_homework_acts)
when "news"
">" + l(:label_news_acts)
when "attachment"
">" + l(:label_attachment_acts)
when "message"
">" + l(:label_message_acts)
when "journalsForMessage"
">" + l(:label_journalsForMessage_acts)
when "poll"
">" + l(:label_poll_acts)
else
">" + l(:label_all_cats)
end
end
#分班下拉框
def course_group_option course
type = []
@ -772,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
@ -872,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)
@ -884,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

View File

@ -101,6 +101,10 @@ module StudentWorkHelper
if course.course_groups && !course.course_groups.empty?
base = []
base << l(:label_chose_group)
base << -1
result << base
base = []
base << l(:label_no_group)
base << 0
result << base
course.course_groups.each do |group|

View File

@ -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
# type0 为老版本即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

View File

@ -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

13
app/models/commit.rb Normal file
View File

@ -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

View File

@ -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

View File

@ -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,

View File

@ -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}

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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 %>

View File

@ -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 %>

View File

@ -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>

View File

@ -130,11 +130,13 @@
<p id="subjectmsg"></p>
</div>
<div id="topic_editor" style="display: none;">
<%if User.current.member_of_course?(course)%>
<%if User.current.member_of_course?(course) %>
<div class="mt10">
<%= f.check_box :sticky, :value => topic.sticky%>
<%= label_tag 'message_sticky', l(:label_board_sticky) %>
<%= f.check_box :locked, :value => topic.locked%>
<% if User.current.admin? %>
<%= f.check_box :sticky, :value => topic.sticky %>
<%= label_tag 'message_sticky', l(:label_board_sticky) %>
<% end %>
<%= f.check_box :locked, :value => topic.locked %>
<%= label_tag 'message_locked', l(:label_board_locked) %>
<div class="cl"></div>
</div>

View File

@ -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>

View File

@ -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%>");

View File

@ -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>");
}

View File

@ -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%>");

View File

@ -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 %>

View File

@ -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 %>

View File

@ -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 %>

View File

@ -1,7 +1,7 @@
<% @members.each do |member| %>
<li >
<%#= link_to_user_header member.principal,true,:class => "w150 c_orange fl" %>
<%= link_to "#{member.principal}#{member.principal.show_name}", user_path(member.principal), :class => "w150 linkBlue fl" %>
<%= link_to "#{member.principal}#{member.principal.show_name}", user_path(member.principal), :class => "w150 linkBlue fl", :style=>"white-space: nowrap;overflow: hidden;text-overflow: ellipsis;", :title => "#{member.principal}#{member.principal.show_name}" %>
<span class="w150 fl">
<%= zh_course_role(h member.roles.sort.collect(&:to_s).join(', ')) %>
<%= form_for(member, {:as => :membership, :remote => true, :url => membership_path(member),

View File

@ -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 %>

View File

@ -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 %>

View File

@ -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>

View File

@ -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>

View File

@ -8,11 +8,11 @@
<label><span class="c_red">*</span>&nbsp;<%= l(:label_tags_syllabus_name)%>&nbsp;&nbsp;</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">

View File

@ -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);

View File

@ -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>

View File

@ -9,7 +9,8 @@
<input type="hidden" value="<%= @type%>" name="type" id="user_activities_type">
<div class="homepageRight mt0 ml10">
<div class="homepageRightBanner">
<div class="NewsBannerName">班级动态</div>
<div class="NewsBannerName">班级动态
<%= get_acts_list_type @type %></div>
<ul class="resourcesSelect">
<li class="resourcesSelected"><a href="javascript:void(0);" class="resourcesIcon"></a>
<ul class="homepagePostType" style="width:90px; left:-80px;">

View File

@ -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-->

View File

@ -8,7 +8,7 @@
$("#poll_question_standard_answer_<%=exercise_question.id %>").val("<%= convert_to_char(exercise_question.exercise_standard_answers.first.exercise_choice_id.to_s)%>")
$("#poll_answers_<%=exercise_question.id%>").html("<% exercise_question.exercise_choices.reorder("choice_position").each_with_index do |exercise_choice,index| %>" +
"<li class='ur_item'>" +
"<label name='select_items' class='w56'>选项<%=convert_to_char (index+1).to_s %><span class='ur_index'></span>&nbsp;&nbsp;&nbsp;</label>" +
"<label name='select_items' class='w60'>选项<%=convert_to_char (index+1).to_s %><span class='ur_index'></span>&nbsp;&nbsp;&nbsp;</label>" +
"<input maxlength='200' type='text' name='question_answer[<%=exercise_choice.id %>]' placeholder='输入选项内容' value='<%=exercise_choice.choice_text %>'/>" +
"<a class='icon_add' title='向下插入选项' onclick='add_single_answer($(this));'></a>" +
"<a class='icon_remove' title='删除' onclick='remove_single_answer($(this))'></a>" +

View File

@ -8,7 +8,7 @@
$("#poll_question_standard_answer_<%=exercise_question.id %>").val("<%= convert_to_char(exercise_question.exercise_standard_answers.first.exercise_choice_id.to_s)%>")
$("#poll_answers_<%=exercise_question.id%>").html("<% exercise_question.exercise_choices.reorder("choice_position").each_with_index do |exercise_choice,index| %>" +
"<li class='ur_item'>" +
"<label name='select_items' class='w56'>选项<%=convert_to_char (index+1).to_s %><span class='ur_index'></span>&nbsp;&nbsp;&nbsp;</label>" +
"<label name='select_items' class='w60'>选项<%=convert_to_char (index+1).to_s %><span class='ur_index'></span>&nbsp;&nbsp;&nbsp;</label>" +
"<input maxlength='200' type='text' name='question_answer[<%= exercise_choice.id %>]' placeholder='输入选项内容' value='<%=exercise_choice.choice_text %>'/>" +
"<a class='icon_add' title='向下插入选项' onclick='add_single_answer($(this));'></a>" +
"<a class='icon_remove' title='删除' onclick='remove_single_answer($(this))'></a>" +
@ -34,7 +34,7 @@
<div id="poll_answers_<%=exercise_question.id%>">
<% exercise_question.exercise_choices.reorder("choice_position").each_with_index do |exercise_choice,index| %>
<li class="ur_item">
<label name='select_items' class='w56'>选项<%=convert_to_char (index+1).to_s %><span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>
<label name='select_items' class='w60'>选项<%=convert_to_char (index+1).to_s %><span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>
<input maxlength="200" type='text' name='question_answer[<%= exercise_choice.id %>]' placeholder='输入选项内容' value="<%=exercise_choice.choice_text %>">
<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>
<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>

View File

@ -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");
});
//编辑问卷描述之后
@ -171,7 +171,7 @@
//单选题
function add_single_answer(doc)
{
var li = doc.parent().after("<li class='ur_item'><label name='select_items' class='w56'>选项&nbsp;<span class='ur_index'></span>&nbsp;&nbsp;&nbsp;</label><input maxlength='200' type='text' name='question_answer["+new Date().getTime()+"]' placeholder='输入选项内容'/>" +
var li = doc.parent().after("<li class='ur_item'><label name='select_items' class='w60'>选项&nbsp;<span class='ur_index'></span>&nbsp;&nbsp;&nbsp;</label><input maxlength='200' type='text' name='question_answer["+new Date().getTime()+"]' placeholder='输入选项内容'/>" +
"<a class='icon_add' title='向下插入选项' onclick='add_single_answer($(this));'></a><a class='icon_remove' title='删除' onclick='remove_single_answer($(this))'></a>"+
"</li><div class='cl'></div>");
var select_items =$("label[name='select_items']",li.parent());

View File

@ -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);

View File

@ -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>

View File

@ -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>

View File

@ -18,28 +18,28 @@
<div class="cl"></div>
<div>
<li class="ur_item">
<label name='select_items' class='w56'>选项A<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>
<label name='select_items' class='w60'>选项A<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>
<input maxlength="200" type='text' name='question_answer[0]' placeholder='输入选项内容'>
<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>
<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>
</li>
<div class="cl"></div>
<li class="ur_item">
<label name='select_items' class='w56'>选项B<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>
<label name='select_items' class='w60'>选项B<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>
<input maxlength="200" type='text' name='question_answer[1]' placeholder='输入选项内容'>
<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>
<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>
</li>
<div class="cl"></div>
<li class="ur_item">
<label name='select_items' class='w56'>选项C<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>
<label name='select_items' class='w60'>选项C<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>
<input maxlength="200" type='text' name='question_answer[2]' placeholder='输入选项内容'>
<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>
<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>
</li>
<div class="cl"></div>
<li class="ur_item">
<label name='select_items' class='w56'>选项D<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>
<label name='select_items' class='w60'>选项D<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>
<input maxlength="200" type='text' name='question_answer[3]' placeholder='输入选项内容'>
<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>
<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>

View File

@ -54,28 +54,28 @@
'<input value="<%= score %>" id="question_score" type="text" name="question_score" style="width:40px; text-align:center; padding-left:0px;"/>分'+
'</li><div>'+
'<li class="ur_item">'+
'<label name="select_items" class="w56">选项A<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>'+
'<label name="select_items" class="w60">选项A<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>'+
'<input maxlength="200" type="text" name="question_answer[0]" placeholder="输入选项内容"/>'+
'<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>'+
'<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>'+
'</li>'+
'<div class="cl"></div>'+
'<li class="ur_item">'+
'<label name="select_items" class="w56">选项B<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>'+
'<label name="select_items" class="w60">选项B<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>'+
'<input maxlength="200" type="text" name="question_answer[1]" placeholder="输入选项内容"/>'+
'<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>'+
'<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>'+
'</li>'+
'<div class="cl"></div>'+
'<li class="ur_item">'+
'<label name="select_items" class="w56">选项C<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>'+
'<label name="select_items" class="w60">选项C<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>'+
'<input maxlength="200" type="text" name="question_answer[2]" placeholder="输入选项内容"/>'+
'<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>'+
'<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>'+
'</li>'+
'<div class="cl"></div>'+
'<li class="ur_item">'+
'<label name="select_items" class="w56">选项D<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>'+
'<label name="select_items" class="w60">选项D<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>'+
'<input maxlength="200" type="text" name="question_answer[3]" placeholder="输入选项内容"/>'+
'<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>'+
'<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>'+

View File

@ -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>

View File

@ -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");
});

View File

@ -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%>"/>

View File

@ -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>

View File

@ -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>

View File

@ -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 %>

View File

@ -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 %>

View File

@ -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>");
}

View File

@ -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)%> :&nbsp;&nbsp;<%= link_to(@course.teacher.lastname+@course.teacher.firstname, user_path(@course.teacher), :class => 'c_dblue') %></li>
<li><%= l(:label_class_period)%> :&nbsp;&nbsp;<span ><%= @course.class_period %> <%= l(:label_class_hour) %></span></li>
<li><%= l(:label_main_term)%> :&nbsp;&nbsp;<span><%= current_time_and_term @course %></span></li>
<% if @course.school%>
<li><%= l(:label_course_organizers)%> :&nbsp;&nbsp;<%= @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>

View File

@ -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>

View File

@ -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' %>
&nbsp;&gt;&nbsp;
<%=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>

View File

@ -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.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}) %>");

View File

@ -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 %>">&nbsp;学分
<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 %>">&nbsp;学时
<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 %>">&nbsp;学时
<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 %>">&nbsp;学时
<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 %>

View File

@ -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>

View File

@ -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"/>

View File

@ -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>

View File

@ -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>

View File

@ -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)%> :&nbsp;&nbsp;<%= link_to(@course.teacher.lastname+@course.teacher.firstname, user_path(@course.teacher), :class => 'c_dblue') %></li>
<li><%= l(:label_class_period)%> :&nbsp;&nbsp;<span ><%= @course.class_period %> <%= l(:label_class_hour) %></span></li>
<li><%= l(:label_main_term)%> :&nbsp;&nbsp;<span><%= current_time_and_term @course %></span></li>
<% if @course.school%>
<li><%= l(:label_course_organizers)%> :&nbsp;&nbsp;<%= @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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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">

View File

@ -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 %>

View File

@ -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">

View File

@ -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">

View File

@ -11,7 +11,7 @@
<div class="homepageRight mt0 ml10">
<div class="homepageRightBanner">
<div class="NewsBannerName">
编辑<%= @news.project_id != -1 ? '新闻':'通知' %>
编辑<%= (@news.project_id != -1 && !@news.project_id.nil?) ? '新闻':'通知' %>
</div>
</div>
<%= labelled_form_for :news, @news, :url => news_path(@news),

View File

@ -103,13 +103,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_at) %>
</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 %>

View File

@ -38,7 +38,7 @@
<%= render :partial => 'users/show_detail_info', :locals => {:user => User.find(act.user_id)} %>
</div>
<div class="homepagePostDes">
<div class="homepagePostTo"><%= link_to User.find(act.user_id), user_url_in_org(act.user_id) %>&nbsp;&nbsp;创建了 <a href="<%= organization_path(@organization)%>" class="newsBlue ml10"><%= Organization.find(act.org_act_id).name %>
<div class="homepagePostTo"><%= link_to User.find(act.user_id), user_url_in_org(act.user_id),:class => "newsBlue mr15" %>&nbsp;&nbsp;创建了 <a href="<%= organization_path(@organization)%>" class="newsBlue ml10"><%= Organization.find(act.org_act_id).name %>
| 组织</a></div>
<div class="homepagePostDate"> 创建时间:<%= format_activity_day(act.created_at) %> <%= format_time(act.created_at, false) %> </div>
</div>
@ -46,7 +46,7 @@
</div>
</div>
<% end %>
<% if act.org_act_type == 'OrgDocumentComment' && act.org_act.organization.home_id != act.org_act.id %>
<% if act.org_act_type == 'OrgDocumentComment' && act.org_act && act.org_act.organization.home_id != act.org_act.id %>
<%= render :partial => 'show_org_document', :locals => {:document => act.org_act, :act => act, :flag => 2, :org_subfield_id => params[:org_subfield_id]} %>
<% end %>
<% end %>

View File

@ -72,7 +72,7 @@
<% all_comments = []%>
<% count=get_all_children(all_comments, activity).count %>
<div class="homepagePostReply">
<%= render :partial => 'users/message_reply_banner', :locals => {:count => count, :activity => activity, :user_activity_id => user_activity_id,:is_course => 0,:is_board =>0} %>
<%= render :partial => 'users/reply_banner', :locals => {:count => count, :activity => activity, :user_activity_id => user_activity_id,:is_course => 0,:is_board =>0} %>
<% all_comments = []%>
<% comments = get_all_children(all_comments, activity)[0..2] %>
@ -87,7 +87,7 @@
<div class="homepagePostReplyInputContainer mb10">
<% if User.current.logged? %>
<div nhname='new_message_<%= user_activity_id%>' style="display:none;">
<%= form_for('new_form',:url => {:controller=>'messages',:action => 'reply', :id => activity.id, :board_id => activity.board_id, :is_board => 'true'},:method => "post", :remote => true) do |f|%>
<%= form_for('new_form',:url => {:controller=>'messages',:action => 'reply', :id => activity.id, :board_id => activity.board_id,:is_course => 0, :is_board => 0},:method => "post", :remote => true) do |f|%>
<input type="hidden" name="quote[quote]" value="">
<input type="hidden" name="user_activity_id" value="<%=user_activity_id%>">
<div nhname='toolbar_container_<%= user_activity_id%>'></div>

View File

@ -62,7 +62,7 @@
<% comments = activity.comments.reorder("created_on desc").limit(3) %>
<% if count > 0 %>
<div class="" id="reply_div_<%= user_activity_id %>">
<%= render :partial => 'users/all_replies', :locals => {:comments => comments}%>
<%= render :partial => 'users/news_replies', :locals => {:comments => comments, :user_activity_id => user_activity_id, :type => 'News', :activity_id => activity.id} %>
</div>
<% end %>

View File

@ -77,7 +77,7 @@
<% comments = get_all_children(all_comments, document)[0..2] %>
<% if count > 0 %>
<div class="" id="reply_div_<%= act.id %>">
<%= render :partial => 'users/org_document_replies', :locals => {:comments => comments, :user_activity_id => act.id, :type => 'OrgDocumentComment', :activity_id =>document.id}%>
<%= render :partial => 'users/message_replies', :locals => {:comments => comments, :user_activity_id => act.id, :type => 'OrgDocumentComment', :activity_id =>document.id}%>
</div>
<% end %>

View File

@ -363,6 +363,7 @@ function insert_MCQ(quest_type,quest_num,quest_id){
}
}
</script>
<div class="courseRSide fl">
<div class=" polls_content polls_edit" id="polls">
<!-- 头部 -->
@ -431,3 +432,4 @@ function insert_MCQ(quest_type,quest_num,quest_id){
</select>
</div>
</div><!--编辑end-->
</div>

View File

@ -86,6 +86,8 @@
hideModal($("#popbox_upload"));
}
</script>
<div class="courseRSide fl">
<div class="polls_content02" id="polls">
<%= render :partial => 'poll_list'%>
</div><!--问卷内容end-->
</div><!--问卷内容end-->
</div>

Some files were not shown because too many files have changed in this diff Show More