Merge branch 'develop' into daiao_dev
This commit is contained in:
commit
b7cf7a2468
2
Gemfile
2
Gemfile
|
@ -51,7 +51,7 @@ gem 'elasticsearch-rails'
|
|||
|
||||
|
||||
### profile
|
||||
#gem 'oneapm_rpm'
|
||||
gem 'oneapm_rpm'
|
||||
|
||||
group :development do
|
||||
gem 'grape-swagger'
|
||||
|
|
114
Gemfile~
114
Gemfile~
|
@ -1,114 +0,0 @@
|
|||
source 'https://ruby.taobao.org/'
|
||||
|
||||
unless RUBY_PLATFORM =~ /w32/
|
||||
# unix-like only
|
||||
gem 'iconv'
|
||||
gem "rmagick", ">= 2.0.0"
|
||||
gem 'certified'
|
||||
end
|
||||
|
||||
gem 'net-ssh', '2.9.1'
|
||||
gem 'jenkins_api_client'
|
||||
gem 'nokogiri'
|
||||
|
||||
gem 'wechat',path: 'lib/wechat'
|
||||
gem 'grack', path:'lib/grack'
|
||||
gem 'gitlab', path: 'lib/gitlab-cli'
|
||||
gem 'rest-client'
|
||||
gem "mysql2", "= 0.3.18"
|
||||
gem 'redis-rails'
|
||||
gem 'rubyzip'
|
||||
gem 'delayed_job_active_record'#, :group => :production
|
||||
gem 'daemons'
|
||||
gem 'grape', '~> 0.9.0'
|
||||
gem 'grape-entity'
|
||||
gem 'rack-cors', :require => 'rack/cors'
|
||||
gem 'seems_rateable', '~> 1.0.13'
|
||||
gem 'rails', '~> 3.2'
|
||||
gem "jquery-rails", "~> 2.0.2"
|
||||
gem "i18n", "~> 0.6.0"
|
||||
gem 'coderay', '~> 1.1.0'
|
||||
gem "fastercsv", "~> 1.5.0", :platforms => [:mri_18, :mingw_18, :jruby]
|
||||
gem "builder", "3.0.0"
|
||||
gem 'acts-as-taggable-on', '2.4.1'
|
||||
gem 'spreadsheet'
|
||||
gem 'ruby-ole'
|
||||
gem 'rails_kindeditor',path:'lib/rails_kindeditor'
|
||||
gem 'binding_of_caller'
|
||||
gem 'chinese_pinyin'
|
||||
# gem 'sunspot_rails', '~> 1.3.3'
|
||||
# gem 'sunspot_solr'
|
||||
# gem 'sunspot'
|
||||
# gem 'progress_bar'
|
||||
gem 'ansi'
|
||||
|
||||
gem 'kaminari'
|
||||
gem 'elasticsearch-model'
|
||||
gem 'elasticsearch-rails'
|
||||
|
||||
|
||||
### profile
|
||||
#gem 'oneapm_rpm'
|
||||
|
||||
group :development do
|
||||
gem 'grape-swagger'
|
||||
gem 'better_errors', '~> 1.1.0'
|
||||
# gem "query_reviewer"
|
||||
# gem 'rack-mini-profiler', '~> 0.9.3'
|
||||
if RUBY_PLATFORM =~ /w32/
|
||||
gem 'win32console'
|
||||
end
|
||||
end
|
||||
|
||||
group :development, :test do
|
||||
unless RUBY_PLATFORM =~ /w32/
|
||||
gem 'pry-rails'
|
||||
if RUBY_VERSION >= '2.0.0'
|
||||
gem 'pry-byebug'
|
||||
end
|
||||
gem 'pry-stack_explorer'
|
||||
if RUBY_PLATFORM =~ /darwin/
|
||||
gem 'puma'
|
||||
end
|
||||
end
|
||||
|
||||
gem 'rspec-rails', '~> 3.0'
|
||||
gem 'factory_girl_rails'
|
||||
end
|
||||
|
||||
# Gems used only for assets and not required
|
||||
# in production environments by default.
|
||||
group :assets do
|
||||
gem 'sass-rails', '~> 3.2.3'
|
||||
gem 'coffee-rails', '~> 3.2.1'
|
||||
|
||||
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
|
||||
# gem 'therubyracer', :platforms => :ruby
|
||||
|
||||
gem 'uglifier', '>= 1.0.3'
|
||||
end
|
||||
|
||||
# Optional gem for LDAP authentication
|
||||
group :ldap do
|
||||
gem "net-ldap", "~> 0.3.1"
|
||||
end
|
||||
|
||||
|
||||
# Optional gem for OpenID authentication
|
||||
group :openid do
|
||||
gem "ruby-openid", "~> 2.1.4", :require => "openid"
|
||||
gem "rack-openid"
|
||||
end
|
||||
|
||||
|
||||
database_file = File.join(File.dirname(__FILE__), "config/database.yml")
|
||||
if File.exist?(database_file)
|
||||
else
|
||||
warn("Please configure your config/database.yml first")
|
||||
end
|
||||
|
||||
# Load plugins' Gemfiles
|
||||
Dir.glob File.expand_path("../plugins/*/Gemfile", __FILE__) do |file|
|
||||
puts "Loading #{file} ..." if $DEBUG # `ruby -d` or `bundle -v`
|
||||
instance_eval File.read(file)
|
||||
end
|
|
@ -17,7 +17,7 @@ module Mobile
|
|||
authenticate!
|
||||
cs = CoursesService.new
|
||||
courses = cs.user_courses_list(current_user)
|
||||
present :data, courses, with: Mobile::Entities::Course
|
||||
present :data, courses, with: Mobile::Entities::Course,user: current_user
|
||||
present :status, 0
|
||||
end
|
||||
|
||||
|
@ -56,7 +56,7 @@ module Mobile
|
|||
class_period: params[:class_period]
|
||||
}
|
||||
courses = cs.create_course(cs_params, current_user)
|
||||
present :data, courses, with: Mobile::Entities::Course
|
||||
present :data, courses, with: Mobile::Entities::Course,user: current_user
|
||||
present :status, 0
|
||||
end
|
||||
|
||||
|
@ -90,7 +90,7 @@ module Mobile
|
|||
end
|
||||
cs.edit_course_authorize(current_user,course)
|
||||
course = cs.edit_course(cs_params, course,current_user)
|
||||
present :data, course, with: Mobile::Entities::Course
|
||||
present :data, course, with: Mobile::Entities::Course,user: current_user
|
||||
present :status, 0
|
||||
end
|
||||
post do
|
||||
|
@ -138,7 +138,7 @@ module Mobile
|
|||
get 'search' do
|
||||
cs = CoursesService.new
|
||||
courses = cs.search_course(params,current_user.nil? ? User.find(2):current_user)
|
||||
present :data, courses, with: Mobile::Entities::Course
|
||||
present :data, courses, with: Mobile::Entities::Course,user: current_user
|
||||
present :status, 0
|
||||
end
|
||||
|
||||
|
@ -193,15 +193,14 @@ module Mobile
|
|||
desc "返回单个课程"
|
||||
params do
|
||||
requires :id, type: Integer
|
||||
optional :token, type: String
|
||||
requires :token,type:String
|
||||
end
|
||||
route_param :id do
|
||||
get do
|
||||
authenticate!
|
||||
# course = Course.find(params[:id])
|
||||
cs = CoursesService.new
|
||||
course = cs.show_course(params,(current_user.nil? ? User.find(2):current_user))
|
||||
#course = Course.find(params[:id])
|
||||
present :data, course, with: Mobile::Entities::Course
|
||||
course = cs.show_course(params,current_user)
|
||||
present :data, course, with: Mobile::Entities::Course,user: current_user
|
||||
{ status: 0}
|
||||
end
|
||||
end
|
||||
|
@ -391,7 +390,9 @@ module Mobile
|
|||
end
|
||||
get ':course_id/exercises' do
|
||||
authenticate!
|
||||
exercises = Course.find(params[:course_id]).exercises
|
||||
|
||||
course = Course.find(params[:course_id])
|
||||
exercises = course.exercises.where("exercise_status <> 1").order("created_at desc")
|
||||
present :data,exercises,with:Mobile::Entities::Exercise
|
||||
present :status,0
|
||||
end
|
||||
|
|
|
@ -8,11 +8,23 @@ module Mobile
|
|||
desc '获取所有课件'
|
||||
params do
|
||||
requires :token, type: String
|
||||
requires :page, type: Integer
|
||||
end
|
||||
get do
|
||||
post do
|
||||
authenticate!
|
||||
data = current_user.course_attachments
|
||||
present :data, data, with: Mobile::Entities::Attachment
|
||||
page = params[:page] ? params[:page] : 0
|
||||
|
||||
rs = ResourcesService.new
|
||||
# data = current_user.course_attachments
|
||||
data = rs.all_course_attachments current_user
|
||||
all_count = data.count
|
||||
data = data.limit(10).offset(page * 10)
|
||||
count = data.count
|
||||
|
||||
present :data, data, with: Mobile::Entities::Attachment,user: current_user
|
||||
present :all_count, all_count
|
||||
present :count, count
|
||||
present :page, page
|
||||
present :status, 0
|
||||
|
||||
end
|
||||
|
@ -22,13 +34,24 @@ module Mobile
|
|||
desc '获取所有作业'
|
||||
params do
|
||||
requires :token, type: String
|
||||
requires :page, type: Integer
|
||||
end
|
||||
get 'homeworks' do
|
||||
post 'homeworks' do
|
||||
authenticate!
|
||||
|
||||
homeworks = current_user.homework_commons
|
||||
page = params[:page] ? params[:page] : 0
|
||||
|
||||
present :data, homeworks, with: Mobile::Entities::Homework
|
||||
rs = ResourcesService.new
|
||||
homeworks = rs.all_homework_commons current_user
|
||||
|
||||
all_count = homeworks.count
|
||||
homeworks = homeworks.limit(10).offset(page * 10)
|
||||
count = homeworks.count
|
||||
|
||||
present :data, homeworks, with: Mobile::Entities::Homework,user: current_user
|
||||
present :all_count, all_count
|
||||
present :count, count
|
||||
present :page, page
|
||||
present :status, 0
|
||||
|
||||
end
|
||||
|
@ -36,12 +59,23 @@ module Mobile
|
|||
desc '获取所有测验'
|
||||
params do
|
||||
requires :token, type: String
|
||||
requires :page, type: Integer
|
||||
end
|
||||
get 'exercies' do
|
||||
post 'exercises' do
|
||||
authenticate!
|
||||
|
||||
exercises = current_user.exercises
|
||||
present :data, exercises, with: Mobile::Entities::Exercise
|
||||
page = params[:page] ? params[:page] : 0
|
||||
|
||||
rs = ResourcesService.new
|
||||
exercises = rs.all_exercises current_user
|
||||
all_count = exercises.count
|
||||
exercises = exercises.limit(10).offset(page * 10)
|
||||
count = exercises.count
|
||||
|
||||
present :data, exercises, with: Mobile::Entities::Exercise,user: current_user
|
||||
present :all_count, all_count
|
||||
present :count, count
|
||||
present :page, page
|
||||
present :status, 0
|
||||
end
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ module Mobile
|
|||
|
||||
cs = SyllabusesService.new
|
||||
courses = cs.user_syllabus(current_user)
|
||||
present :data, courses, with: Mobile::Entities::Syllabus
|
||||
present :data, courses, with: Mobile::Entities::Syllabus,user: current_user
|
||||
present :status, 0
|
||||
end
|
||||
|
||||
|
@ -29,9 +29,8 @@ module Mobile
|
|||
|
||||
sy = ::Syllabus.find(params[:id])
|
||||
sy.courses = sy.courses.not_deleted
|
||||
sy = ss.judge_can_setting(sy,current_user)
|
||||
|
||||
present :data, sy, with: Mobile::Entities::Syllabus
|
||||
present :data, sy, with: Mobile::Entities::Syllabus,user: current_user
|
||||
present :status, 0
|
||||
end
|
||||
|
||||
|
@ -68,7 +67,7 @@ module Mobile
|
|||
if sy.new_record?
|
||||
{status:-1, message: '创建大纲失败' }
|
||||
else
|
||||
present :data, sy, with: Mobile::Entities::Syllabus
|
||||
present :data, sy, with: Mobile::Entities::Syllabus,user: current_user
|
||||
present :status, 0
|
||||
end
|
||||
|
||||
|
|
|
@ -41,8 +41,8 @@ module Mobile
|
|||
openid: openid,
|
||||
user: user
|
||||
)
|
||||
# ws = WechatService.new
|
||||
# ws.binding_succ_notice(user.id, "您已成功绑定Trustie平台", user.login, format_time(Time.now))
|
||||
ws = WechatService.new
|
||||
ws.binding_succ_notice(user.id, "您已成功绑定Trustie平台", user.login, Time.now.strftime("%Y-%m-%d"))
|
||||
present status: 0, message: '您已成功绑定Trustie平台'
|
||||
end
|
||||
|
||||
|
@ -67,7 +67,8 @@ module Mobile
|
|||
openid: openid,
|
||||
user: user
|
||||
)
|
||||
|
||||
ws = WechatService.new
|
||||
ws.binding_succ_notice(user.id, "您已成功绑定Trustie平台", user.login, Time.now.strftime("%Y-%m-%d"))
|
||||
present :data, user, with: Mobile::Entities::User
|
||||
present :status, 0
|
||||
end
|
||||
|
|
|
@ -2,6 +2,7 @@ module Mobile
|
|||
module Entities
|
||||
class Attachment < Grape::Entity
|
||||
include Redmine::I18n
|
||||
include ActionView::Helpers::NumberHelper
|
||||
def self.attachment_expose(field)
|
||||
expose field do |f,opt|
|
||||
if f.is_a?(Hash) && f.key?(field)
|
||||
|
@ -17,6 +18,10 @@ module Mobile
|
|||
case field
|
||||
when :file_dir
|
||||
"attachments/download/" << f.send(:id).to_s << '/'
|
||||
when :attafile_size
|
||||
(number_to_human_size(f.filesize)).gsub("ytes", "").to_s
|
||||
when :coursename
|
||||
f.course.nil? ? "" : f.course.name
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -29,6 +34,8 @@ module Mobile
|
|||
attachment_expose :quotes
|
||||
attachment_expose :created_on
|
||||
attachment_expose :file_dir
|
||||
attachment_expose :attafile_size
|
||||
attachment_expose :coursename #所属班级名
|
||||
end
|
||||
end
|
||||
end
|
|
@ -2,6 +2,8 @@ module Mobile
|
|||
module Entities
|
||||
class Course < Grape::Entity
|
||||
include Redmine::I18n
|
||||
include ApplicationHelper
|
||||
include ApiHelper
|
||||
def self.course_expose(field)
|
||||
expose field do |f,opt|
|
||||
c = nil
|
||||
|
@ -52,7 +54,28 @@ module Mobile
|
|||
course_expose :updated_at
|
||||
course_expose :course_student_num
|
||||
course_expose :member_count
|
||||
course_expose :can_setting
|
||||
expose :can_setting, if: lambda { |instance, options| options[:user] } do |instance, options|
|
||||
current_user = options[:user]
|
||||
can_setting = false
|
||||
|
||||
if instance[:course]
|
||||
course = instance[:course]
|
||||
else
|
||||
course = instance
|
||||
end
|
||||
|
||||
member = course.members.where("user_id=#{current_user.id} and course_id=#{course.id}")[0]
|
||||
roleName = member.roles[0].name if member
|
||||
|
||||
if roleName && (roleName == "TeachingAsistant" || roleName == "Teacher" )
|
||||
can_setting = true
|
||||
end
|
||||
|
||||
if course.tea_id == current_user.id
|
||||
can_setting = true
|
||||
end
|
||||
can_setting
|
||||
end
|
||||
expose :teacher, using: Mobile::Entities::User do |c, opt|
|
||||
if c.is_a? ::Course
|
||||
c.teacher
|
||||
|
|
|
@ -1,8 +1,32 @@
|
|||
module Mobile
|
||||
module Entities
|
||||
class Exercise < Grape::Entity
|
||||
include Redmine::I18n
|
||||
include ApplicationHelper
|
||||
include ApiHelper
|
||||
def self.exercise_expose(field)
|
||||
expose field do |f,opt|
|
||||
if f.is_a?(Hash) && f.key?(field)
|
||||
if field == :created_on
|
||||
format_time(f[field])
|
||||
else
|
||||
f[field]
|
||||
end
|
||||
elsif f.is_a?(::Exercise)
|
||||
if f.respond_to?(field)
|
||||
f.send(field)
|
||||
else
|
||||
case field
|
||||
when :coursename
|
||||
f.course.nil? ? "" : f.course.name
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
expose :exercise_name
|
||||
expose :exercise_description
|
||||
exercise_expose :coursename #所属班级名
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -37,6 +37,8 @@ module Mobile
|
|||
when :homework_anony_type
|
||||
val = f.homework_type == 1 && !f.homework_detail_manual.nil?
|
||||
val
|
||||
when :coursename
|
||||
f.course.nil? ? "" : f.course.name
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -94,6 +96,8 @@ module Mobile
|
|||
|
||||
homework_expose :homework_anony_type #是否是匿评作业
|
||||
|
||||
homework_expose :coursename #所属班级名
|
||||
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,12 +1,14 @@
|
|||
module Mobile
|
||||
module Entities
|
||||
class Syllabus < Grape::Entity
|
||||
include ApplicationHelper
|
||||
|
||||
expose :title
|
||||
expose :id
|
||||
expose :can_setting
|
||||
|
||||
expose :can_setting, if: lambda { |instance, options| options[:user] } do |instance, options|
|
||||
current_user = options[:user]
|
||||
can_setting = instance.user_id == current_user.id ? true : false
|
||||
can_setting = false if instance.id.nil?
|
||||
can_setting
|
||||
end
|
||||
expose :courses, using: Mobile::Entities::Course
|
||||
end
|
||||
end
|
||||
|
|
|
@ -61,7 +61,7 @@ class AdminController < ApplicationController
|
|||
if params[:syllabus_id] && params[:course_id]
|
||||
course = Course.where("id = #{params[:course_id].to_i}").first
|
||||
unless course.nil?
|
||||
course.update_attribute('syllabus_id', params[:syllabus_id].to_i)
|
||||
course.update_column('syllabus_id', params[:syllabus_id].to_i)
|
||||
@flag = true
|
||||
end
|
||||
end
|
||||
|
@ -82,7 +82,7 @@ class AdminController < ApplicationController
|
|||
syllabus.update_attributes(:title => params[:title], :eng_name => params[:eng_name], :user_id => @user.id)
|
||||
syllabus.description = Message.where("id = 19412").first.nil? ? nil : Message.where("id = 19412").first.content
|
||||
if syllabus.save
|
||||
course.update_attribute('syllabus_id', syllabus.id)
|
||||
course.update_column('syllabus_id', syllabus.id)
|
||||
@flag = params[:flag].to_i
|
||||
@course = course
|
||||
respond_to do |format|
|
||||
|
@ -96,7 +96,7 @@ class AdminController < ApplicationController
|
|||
def courses
|
||||
@name = params[:name].to_s.strip.downcase
|
||||
if @name && @name != ""
|
||||
@courses = Course.select{ |course| (course.teacher[:lastname].to_s.downcase + course.teacher[:firstname].to_s.downcase).include?(@name) || course.name.include?(@name)}
|
||||
@courses = Course.select{ |course| course.teacher && ((course.teacher.show_name).include?(@name) || course.name.include?(@name))}
|
||||
@courses = @courses.sort{|x, y| y.created_at <=> x.created_at}
|
||||
else
|
||||
@courses = Course.order('created_at desc')
|
||||
|
@ -112,10 +112,10 @@ class AdminController < ApplicationController
|
|||
def non_syllabus_courses
|
||||
@name = params[:name].to_s.strip.downcase
|
||||
if @name && @name != ""
|
||||
@courses = Course.where("syllabus_id is null").select{ |course| (course.teacher[:lastname].to_s.downcase + course.teacher[:firstname].to_s.downcase).include?(@name) || course.name.include?(@name)}
|
||||
@courses = Course.where("syllabus_id is null and is_delete = 0").select{ |course| (course.teacher[:lastname].to_s.downcase + course.teacher[:firstname].to_s.downcase).include?(@name) || course.name.include?(@name)}
|
||||
@courses = @courses.sort{|x, y| y.created_at <=> x.created_at}
|
||||
else
|
||||
@courses = Course.where("syllabus_id is null").order('created_at desc')
|
||||
@courses = Course.where("syllabus_id is null and is_delete = 0").order('created_at desc')
|
||||
end
|
||||
@courses = paginateHelper @courses,30
|
||||
@page = (params['page'] || 1).to_i - 1
|
||||
|
@ -124,11 +124,22 @@ class AdminController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
#修改课程名称
|
||||
#修改班级名称
|
||||
def update_course_name
|
||||
@course = Course.where("id = #{params[:course_id].to_i}").first
|
||||
unless @course.nil?
|
||||
@course.update_attribute("name", params[:name])
|
||||
@course.update_column("name", params[:name])
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
#修改课程名称
|
||||
def update_syllabus_title
|
||||
@syllabus = Syllabus.where("id = #{params[:syllabus_id].to_i}").first
|
||||
unless @syllabus.nil?
|
||||
@syllabus.update_column("title", params[:name])
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
|
|
|
@ -47,6 +47,8 @@ class AtController < ApplicationController
|
|||
find_journals_for_message(id)
|
||||
when 'Principal'
|
||||
find_principal(id)
|
||||
when 'BlogComment'
|
||||
find_blog_comment(id)
|
||||
when 'All'
|
||||
nil
|
||||
else
|
||||
|
@ -166,8 +168,8 @@ class AtController < ApplicationController
|
|||
|
||||
#BlogComment
|
||||
def find_blog_comment(id)
|
||||
blog = BlogComment.find(id).blog
|
||||
blog.users
|
||||
blog = BlogComment.find(id)
|
||||
blog.author.watcher_users
|
||||
end
|
||||
|
||||
end
|
|
@ -18,6 +18,8 @@
|
|||
class AttachmentsController < ApplicationController
|
||||
layout "users_base"
|
||||
|
||||
before_filter :verify_authenticity_token, only: [:uploa]
|
||||
|
||||
before_filter :find_project, :only => [:show, :download, :thumbnail, :destroy, :delete_homework]#, :except => [:upload, :autocomplete]
|
||||
before_filter :file_readable, :read_authorize, :only => [:show, :thumbnail]#Modified by young
|
||||
before_filter :delete_authorize, :only => [:destroy]
|
||||
|
|
|
@ -70,6 +70,10 @@ class BlogCommentsController < ApplicationController
|
|||
@course.outline = 0
|
||||
@course.save
|
||||
redirect_to course_path(:id=>params[:course_id])
|
||||
elsif params[:user_activity_id]
|
||||
@article.children.destroy
|
||||
@article.destroy
|
||||
redirect_to user_path(User.current.id)
|
||||
else
|
||||
@article.children.destroy
|
||||
@article.destroy
|
||||
|
@ -80,6 +84,17 @@ class BlogCommentsController < ApplicationController
|
|||
if params[:course_id] #如果带了course_id过来了,那么这是要跳到课程大纲去的
|
||||
@article.destroy
|
||||
redirect_to syllabus_course_path(:id=>params[:course_id])
|
||||
elsif params[:user_activity_id]
|
||||
if params[:homepage] && params[:homepage] == "1"
|
||||
@in_user_homepage = true
|
||||
end
|
||||
@user_activity_id = params[:user_activity_id]
|
||||
@blog_comment = @article.root
|
||||
@article.destroy
|
||||
respond_to do |format|
|
||||
format.js
|
||||
return
|
||||
end
|
||||
else
|
||||
root = @article.root
|
||||
@article.destroy
|
||||
|
@ -102,13 +117,9 @@ class BlogCommentsController < ApplicationController
|
|||
|
||||
def quote
|
||||
@blogComment = BlogComment.find(params[:id])
|
||||
@subject = @blogComment.title
|
||||
@subject = "RE: #{@subject}" unless @subject.starts_with?('RE:')
|
||||
|
||||
@content = "> #{ll(Setting.default_language, :text_user_wrote, @blogComment.author.realname)}\n> "
|
||||
@temp = BlogComment.new
|
||||
@course_id = params[:course_id]
|
||||
@temp.content = "<blockquote>#{ll(Setting.default_language, :text_user_wrote, @blogComment.author.realname)} <br/>#{@blogComment.content.html_safe}</blockquote>".html_safe
|
||||
respond_to do | format|
|
||||
format.js
|
||||
end
|
||||
|
@ -116,23 +127,30 @@ class BlogCommentsController < ApplicationController
|
|||
|
||||
#回复
|
||||
def reply
|
||||
if params[:homepage]
|
||||
if params[:homepage] && params[:homepage] == "1"
|
||||
@in_user_homepage = true
|
||||
end
|
||||
if params[:in_user_center]
|
||||
@in_user_center = true
|
||||
end
|
||||
@article = BlogComment.find(params[:id]).root
|
||||
@quote = params[:quote][:quote]
|
||||
@blogComment = BlogComment.new
|
||||
@blogComment.author = User.current
|
||||
@blogComment.blog = Blog.find(params[:blog_id])
|
||||
params[:blog_comment][:sticky] = params[:blog_comment][:sticky] || 0
|
||||
params[:blog_comment][:locked] = params[:blog_comment][:locked] || 0
|
||||
@blogComment.safe_attributes = params[:blog_comment]
|
||||
@blogComment.content = @quote + @blogComment.content
|
||||
@blogComment.title = "RE: #{@article.title}" unless params[:blog_comment][:title]
|
||||
@article.children << @blogComment
|
||||
if params[:parent_id]
|
||||
@blogComment.content = params[:blog_comment][:content]
|
||||
parent = BlogComment.find params[:parent_id]
|
||||
@blogComment.reply_id = params[:reply_id]
|
||||
parent.children << @blogComment
|
||||
else
|
||||
@quote = params[:quote][:quote] || ""
|
||||
@blogComment.content = @quote + @blogComment.content
|
||||
@article.children << @blogComment
|
||||
end
|
||||
@article.save
|
||||
# @article.update_attribute(:updated_on, @blogComment.updated_on)
|
||||
@user_activity_id = params[:user_activity_id]
|
||||
|
|
|
@ -633,6 +633,9 @@ class CoursesController < ApplicationController
|
|||
=end
|
||||
end
|
||||
if @course
|
||||
#发送微信消息
|
||||
ss = SyllabusesService.new
|
||||
ss.send_wechat_create_class_notice User.current,@course
|
||||
respond_to do |format|
|
||||
flash[:notice] = l(:notice_successful_create)
|
||||
format.html {redirect_to course_url(@course)}
|
||||
|
@ -968,7 +971,7 @@ class CoursesController < ApplicationController
|
|||
|
||||
@homework = HomeworkCommon.find params[:homework]
|
||||
#order("#{@order} #{@b_sort}"
|
||||
@student_works = search_homework_member @homework.student_works.select("student_works.*,IF(final_score is null,null,IF(final_score = 0, 0, final_score - absence_penalty - late_penalty)) as score").order("simi_value desc"),@name
|
||||
@student_works = search_homework_member @homework.student_works.select("student_works.*,IF(final_score is null,null,IF(final_score = 0, 0, final_score - absence_penalty - late_penalty)) as score").order("simi_value desc").has_committed,@name
|
||||
|
||||
@works_hash = {}
|
||||
|
||||
|
|
|
@ -432,14 +432,15 @@ 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]
|
||||
|
@ -492,7 +493,7 @@ class IssuesController < ApplicationController
|
|||
update_forge_activity(@issue.class,@issue.id)
|
||||
|
||||
respond_to do |format|
|
||||
format.js
|
||||
format.html{redirect_to issue_url(@issue)}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -502,7 +503,7 @@ class IssuesController < ApplicationController
|
|||
@issue = Issue.find(params[:id])
|
||||
Journal.destroy(params[:journal_id])
|
||||
respond_to do |format|
|
||||
format.js
|
||||
format.html{redirect_to issue_url(@issue)}
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -123,10 +123,14 @@ class OrgDocumentCommentsController < ApplicationController
|
|||
def destroy
|
||||
@org_document_comment = OrgDocumentComment.find(params[:id])
|
||||
@org_sub_id = @org_document_comment.org_subfield_id
|
||||
org = @org_document_comment.organization
|
||||
org = @org_document_comment.root.organization
|
||||
if @org_document_comment.id == org.home_id
|
||||
org.update_attributes(:home_id => nil)
|
||||
end
|
||||
if params[:user_activity_id]
|
||||
@act = OrgActivity.find(params[:user_activity_id])
|
||||
@document = @org_document_comment.root
|
||||
end
|
||||
if @org_document_comment.destroy
|
||||
end
|
||||
respond_to do |format|
|
||||
|
@ -145,48 +149,26 @@ class OrgDocumentCommentsController < ApplicationController
|
|||
end
|
||||
def quote
|
||||
@org_comment = OrgDocumentComment.find(params[:id])
|
||||
@subject = @org_comment.content
|
||||
@subject = "RE: #{@subject}" unless @subject.starts_with?('RE:')
|
||||
|
||||
@content = "> #{ll(Setting.default_language, :text_user_wrote, User.find(@org_comment.creator_id).realname)}\n> "
|
||||
@temp = OrgDocumentComment.new
|
||||
#@course_id = params[:course_id]
|
||||
@temp.content = "<blockquote>#{ll(Setting.default_language, :text_user_wrote, User.find(@org_comment.creator_id).realname)} <br/>#{@org_comment.content.html_safe}</blockquote>".html_safe
|
||||
respond_to do | format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
def reply
|
||||
@document = OrgDocumentComment.find(params[:id]).root
|
||||
@quote = params[:quote][:quote]
|
||||
@document = OrgDocumentComment.find(params[:id])
|
||||
@org_document = OrgDocumentComment.new(:creator_id => User.current.id, :reply_id => params[:id])
|
||||
|
||||
# params[:blog_comment][:sticky] = params[:blog_comment][:sticky] || 0
|
||||
# params[:blog_comment][:locked] = params[:blog_comment][:locked] || 0
|
||||
@org_document.title = params[:org_document_comment][:title]
|
||||
@org_document.content = params[:org_document_comment][:content]
|
||||
@org_document.content = @quote + @org_document.content
|
||||
#@org_document.title = "RE: #{@article.title}" unless params[:blog_comment][:title]
|
||||
|
||||
@document.children << @org_document
|
||||
# @user_activity_id = params[:user_activity_id]
|
||||
# user_activity = UserActivity.where("act_type='BlogComment' and act_id =#{@article.id}").first
|
||||
# if user_activity
|
||||
# user_activity.updated_at = Time.now
|
||||
# user_activity.save
|
||||
# end
|
||||
# attachments = Attachment.attach_files(@org_document, params[:attachments])
|
||||
# render_attachment_warning_if_needed(@org_document)
|
||||
#@article.save
|
||||
# redirect_to user_blogs_path(:user_id=>params[:user_id])
|
||||
@document = @document.root
|
||||
@user_activity_id = params[:user_activity_id]
|
||||
@act = OrgActivity.find(@user_activity_id) if @user_activity_id
|
||||
respond_to do |format|
|
||||
format.html {
|
||||
# if params[:course_id] #如果呆了course_id过来了,那么这是要跳到课程大纲去的
|
||||
# redirect_to syllabus_course_path(:id=>params[:course_id])
|
||||
# else
|
||||
redirect_to org_document_comment_path(:id => @document.id, :organization_id => @document.organization_id)
|
||||
# end
|
||||
|
||||
}
|
||||
format.js
|
||||
end
|
||||
|
|
|
@ -2,7 +2,7 @@ class QualityAnalysisController < ApplicationController
|
|||
before_filter :find_project_by_project_id#, :except => [:getattachtype]
|
||||
before_filter :find_quality_analysis, :only => [:edit, :update_jenkins_job]
|
||||
before_filter :authorize
|
||||
before_filter :connect_jenkins, :only => [:create, :edit, :update_jenkins_job, :index]
|
||||
before_filter :connect_jenkins, :only => [:create, :edit, :update_jenkins_job, :index, :delete]
|
||||
layout "base_projects"
|
||||
include ApplicationHelper
|
||||
include QualityAnalysisHelper
|
||||
|
@ -33,7 +33,6 @@ class QualityAnalysisController < ApplicationController
|
|||
arr = JSON.parse(projects_date).map {|m| m["nm"]} # eg: ["Hjqreturn:cc_rep", "Hjqreturn:putong", "Hjqreturn:sonar_rep2", "shitou:sonar_rep"]
|
||||
quality_an = QualityAnalysis.where(:sonar_name => sonar_name).first
|
||||
if @client.job.exists?(job_name) && QualityAnalysis.where(:sonar_name => sonar_name).select{|qa| arr.include?(qa.sonar_name)}.blank?
|
||||
logger.info("88888888888888888888")
|
||||
aa = @client.job.delete("#{job_name}")
|
||||
quality_an.delete unless quality_an.blank?
|
||||
end
|
||||
|
@ -83,8 +82,8 @@ class QualityAnalysisController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
# sonar 缓冲,取数据
|
||||
sleep(5)
|
||||
# sonar 缓冲,sonar生成数据
|
||||
sleep(10)
|
||||
|
||||
# 获取sonar output结果
|
||||
console_build = @client.job.get_console_output("#{job_name}", build_num = 0, start = 0, mode = 'text')["output"]
|
||||
|
@ -114,7 +113,7 @@ class QualityAnalysisController < ApplicationController
|
|||
end
|
||||
end
|
||||
rescue => e
|
||||
puts e
|
||||
@message = e.message
|
||||
end
|
||||
respond_to do |format|
|
||||
if @current_build_status == "success"
|
||||
|
@ -152,11 +151,31 @@ class QualityAnalysisController < ApplicationController
|
|||
@gitlab_default_branch = @g.project(@project.gpid).default_branch
|
||||
end
|
||||
|
||||
# 删除的时候主要删除三方面数据:1/Trustie数据 2/jenkins数据 3/sonar数据
|
||||
# 如果只删除数据1,则新建的时候会有冲突
|
||||
def delete
|
||||
begin
|
||||
qa = QualityAnalysis.find(params[:id])
|
||||
rep_id = Repository.where(:project_id => @project.id, :identifier => qa.rep_identifier).first.try(:id)
|
||||
job_name = "#{qa.author_login}-#{rep_id}"
|
||||
logger.info("result: job_name ###################==>#{job_name}")
|
||||
logger.info("result: @client.job ###################==>#{@client.job}")
|
||||
|
||||
d_job = @client.job.delete(job_name)
|
||||
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)}
|
||||
end
|
||||
rescue Exception => e
|
||||
puts e
|
||||
end
|
||||
end
|
||||
|
||||
# 更新Jenkins job,主要包括相关配置文件参数的更新,Trustie平台数据的更新
|
||||
def update_jenkins_job
|
||||
begin
|
||||
rep_id = Repository.where(:project_id => @project.id).first.try(:id)
|
||||
logger.error("#############################===>666")
|
||||
sonar_name = @quality_analysis.sonar_name
|
||||
job_name = "#{@quality_analysis.author_login}-#{rep_id}"
|
||||
version = @quality_analysis.sonar_version
|
||||
|
@ -223,13 +242,10 @@ class QualityAnalysisController < ApplicationController
|
|||
if key == "sqale_index"
|
||||
value = com["frmt_val"]
|
||||
else
|
||||
value = com["val"].to_i
|
||||
value = com["val"]
|
||||
end
|
||||
@ha.store(key,value)
|
||||
end
|
||||
|
||||
issue_date = open(@sonar_address + "/api/resources/index?resource=#{@resource_id}&depth=0&metrics=blocker_violations,critical_violations,major_violations,minor_violations,info_violations,violations").read
|
||||
@sonar_issues = JSON.parse(issue_date).first
|
||||
end
|
||||
rescue => e
|
||||
puts e
|
||||
|
@ -263,9 +279,11 @@ class QualityAnalysisController < ApplicationController
|
|||
def connect_jenkins
|
||||
@gitlab_address = Redmine::Configuration['gitlab_address']
|
||||
@jenkins_address = Redmine::Configuration['jenkins_address']
|
||||
jenkins_username = Redmine::Configuration['jenkins_username']
|
||||
jenkins_password = Redmine::Configuration['jenkins_password']
|
||||
|
||||
# connect jenkins
|
||||
@client = JenkinsApi::Client.new(:server_url => @jenkins_address, :username => "temp", :password => '123123')
|
||||
@client = JenkinsApi::Client.new(:server_url => @jenkins_address, :username => jenkins_username, :password => jenkins_password)
|
||||
rescue => e
|
||||
logger.error("failed to connect Jenkins ==> #{e}")
|
||||
end
|
||||
|
|
|
@ -38,7 +38,7 @@ class RepositoriesController < ApplicationController
|
|||
before_filter :find_changeset, :only => [:revision, :add_related_issue, :remove_related_issue]
|
||||
before_filter :authorize , :except => [:newrepo,:newcreate,:fork, :to_gitlab, :forked, :commit_diff, :project_archive, :quality_analysis]
|
||||
# 链接gitlab
|
||||
before_filter :connect_gitlab, :only => [:quality_analysis, :show]
|
||||
before_filter :connect_gitlab, :only => [:quality_analysis, :show, :commit_diff, :find_project_repository]
|
||||
# 版本库新增权限
|
||||
before_filter :show_rep, :only => [:show]
|
||||
accept_rss_auth :revisions
|
||||
|
@ -48,7 +48,6 @@ class RepositoriesController < ApplicationController
|
|||
include RepositoriesHelper
|
||||
helper :project_score
|
||||
#@root_path = RepositoriesHelper::ROOT_PATH
|
||||
$g=Gitlab.client
|
||||
require 'net/ssh'
|
||||
|
||||
rescue_from Redmine::Scm::Adapters::CommandFailed, :with => :show_error_command_failed
|
||||
|
@ -548,8 +547,8 @@ update
|
|||
|
||||
# 每次提交对应的文件差异
|
||||
def commit_diff
|
||||
@commit_diff = $g.commit_diff(@project.gpid, params[:changeset])
|
||||
@commit_details = $g.commit(@project.gpid, params[:changeset])
|
||||
@commit_diff = @g.commit_diff(@project.gpid, params[:changeset])
|
||||
@commit_details = @g.commit(@project.gpid, params[:changeset])
|
||||
render :layout => 'base_projects'
|
||||
end
|
||||
|
||||
|
@ -700,7 +699,8 @@ update
|
|||
(render_404; return false) unless @repository
|
||||
@path = params[:path].is_a?(Array) ? params[:path].join('/') : params[:path].to_s
|
||||
# gitlab端获取默认分支
|
||||
gitlab_branchs = $g.project(@project.gpid).default_branch
|
||||
g = Gitlab.client
|
||||
gitlab_branchs = g.project(@project.gpid).default_branch
|
||||
@project.gpid.nil? ? (@rev = params[:rev].blank? ? @repository.default_branch : params[:rev].to_s.strip) : (@rev = params[:rev].blank? ? gitlab_branchs : params[:rev].to_s.strip)
|
||||
@rev_to = params[:rev_to]
|
||||
unless @rev.to_s.match(REV_PARAM_RE) && @rev_to.to_s.match(REV_PARAM_RE)
|
||||
|
|
|
@ -110,9 +110,9 @@ class StudentWorkController < ApplicationController
|
|||
#status 0:答案正确 -5program_test_ex 函数出错 -4judge代码出错 -3http超时 -2:编译错误 -1:答案错误 2:程序运行超时
|
||||
resultObj[:status] = -3
|
||||
CodeTests.create(:homework_id=>@homework.id,:language=>@homework.homework_detail_programing.language,:status=>-3,:wait_time=>tUsedtime,:student_work_id=>student_work.id)
|
||||
rescue
|
||||
rescue => e
|
||||
#-4 judge代码 出错
|
||||
logger.debug "program_test_error 1"
|
||||
logger.debug "program_test_error #{e}"
|
||||
resultObj[:status] = -4
|
||||
tmpstatus = -4
|
||||
CodeTests.create(:homework_id=>@homework.id,:language=>@homework.homework_detail_programing.language,:status=>tmpstatus,:time_used=>0,:wait_time=>0,:student_work_id=>student_work.id)
|
||||
|
@ -197,7 +197,7 @@ class StudentWorkController < ApplicationController
|
|||
resultObj[:status] = 0
|
||||
end
|
||||
student_work.save!
|
||||
resultObj[:time] = student_work_test.created_at.to_s(:db)
|
||||
resultObj[:time] = student_work_test.created_at.strftime(format='%Y-%m-%d %H:%M:%S')
|
||||
resultObj[:index] = student_work.student_work_tests.count
|
||||
end
|
||||
|
||||
|
@ -271,7 +271,7 @@ class StudentWorkController < ApplicationController
|
|||
|
||||
all_studentwork = find_all_student_work_by_homeid()
|
||||
|
||||
@work_count = all_studentwork.count
|
||||
@work_count = all_studentwork.has_committed.count
|
||||
end
|
||||
|
||||
#代码查重 status: 0完成 -2不需要查重 -1查重失败不支持该语言
|
||||
|
@ -282,7 +282,7 @@ class StudentWorkController < ApplicationController
|
|||
|
||||
@homework = HomeworkCommon.find params[:homework]
|
||||
|
||||
all_studentwork = find_all_student_work_by_homeid()
|
||||
all_studentwork = find_all_student_work_by_homeid().has_committed
|
||||
|
||||
if all_studentwork == nil
|
||||
resultObj[:status] = -2
|
||||
|
|
|
@ -109,7 +109,11 @@ class SyllabusesController < ApplicationController
|
|||
sort_name = "updated_on"
|
||||
sort_type = @c_sort == 1 ? "asc" : "desc"
|
||||
|
||||
@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}")
|
||||
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
|
||||
|
||||
#根据 作业+资源数排序
|
||||
if @order.to_i == 2
|
||||
|
|
|
@ -92,6 +92,8 @@ class UsersController < ApplicationController
|
|||
@comment = JournalsForMessage.find params[:comment].to_i
|
||||
when 'Message'
|
||||
@comment = Message.find params[:comment].to_i
|
||||
when 'BlogComment'
|
||||
@comment = BlogComment.find params[:comment].to_i
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -120,6 +122,17 @@ class UsersController < ApplicationController
|
|||
@is_course = params[:is_course]
|
||||
@is_board = params[:is_board]
|
||||
@type = 'Message'
|
||||
when 'BlogComment'
|
||||
@reply = BlogComment.find params[:reply_id]
|
||||
@user_activity_id = params[:user_activity_id]
|
||||
@activity_id = params[:activity_id]
|
||||
@homepage = params[:homepage]
|
||||
@type = 'BlogComment'
|
||||
when 'OrgDocumentComment'
|
||||
@reply = OrgDocumentComment.find params[:reply_id]
|
||||
@user_activity_id = params[:user_activity_id]
|
||||
@activity_id = params[:activity_id]
|
||||
@type = 'OrgDocumentComment'
|
||||
end
|
||||
respond_to do |format|
|
||||
format.js
|
||||
|
@ -556,12 +569,12 @@ class UsersController < ApplicationController
|
|||
@order,@b_sort = params[:order] || "created_at",params[:sort] || "desc"
|
||||
@user = User.current
|
||||
@r_sort = @b_sort == "desc" ? "asc" : "desc"
|
||||
if(params[:type].blank? || params[:type] == "1") #题库
|
||||
if(params[:type].blank? || params[:type] == "1") #我的题库
|
||||
@homeworks = HomeworkCommon.where("user_id = #{@user.id} and publish_time <= '#{Date.today}'").order("#{@order} #{@b_sort}")
|
||||
elsif params[:type] == "2" #题库
|
||||
visible_course = Course.where("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("#{@order} #{@b_sort}")
|
||||
elsif params[:type] == "2" #我的题库
|
||||
@homeworks = HomeworkCommon.where("user_id = #{@user.id} and publish_time <= '#{Date.today}'").order("#{@order} #{@b_sort}")
|
||||
end
|
||||
@type = params[:type]
|
||||
@limit = 25
|
||||
|
@ -715,7 +728,11 @@ class UsersController < ApplicationController
|
|||
@order,@b_sort = params[:order] || "created_at",params[:sort] || "desc"
|
||||
@r_sort = @b_sort == "desc" ? "asc" : "desc"
|
||||
@user = User.current
|
||||
if(params[:type].blank? || params[:type] == "1") #题库
|
||||
if(params[:type].blank? || params[:type] == "1") #我的题库
|
||||
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}")
|
||||
elsif params[:type] == "2" #题库
|
||||
if params[:is_import].to_i == 1
|
||||
visible_course = Course.where("is_public = 1 && is_delete = 0")
|
||||
elsif params[:is_import].to_i == 0
|
||||
|
@ -723,10 +740,6 @@ class UsersController < ApplicationController
|
|||
end
|
||||
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("#{@order} #{@b_sort}")
|
||||
elsif params[:type] == "2" #我的题库
|
||||
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}")
|
||||
elsif params[:type] == "3" #申请题库
|
||||
none_visible_course = Course.where("is_delete = 1")
|
||||
none_visible_course_ids = none_visible_course.empty? ? "(-1)" : "(" + none_visible_course.map{|course| course.id}.join(",") + ")"
|
||||
|
@ -793,7 +806,18 @@ class UsersController < ApplicationController
|
|||
@user = User.current
|
||||
search = params[:name].to_s.strip.downcase
|
||||
type_ids = params[:property]=="" || params[:property].nil? ? "(1, 2, 3)" : "(" + params[:property] + ")"
|
||||
if(params[:type].blank? || params[:type] == "1") #全部
|
||||
if(params[:type].blank? || params[:type] == "1") #我的题库
|
||||
courses = @user.courses.where("is_delete = 1")
|
||||
course_ids = courses.empty? ? "(-1)" : "(" + courses.map{|course| course.id}.join(",") + ")"
|
||||
if @order == "course_name"
|
||||
sql = "SELECT homework_commons.* FROM homework_commons INNER JOIN courses ON homework_commons.course_id = courses.id where homework_commons.course_id not in #{course_ids} and homework_commons.user_id = #{@user.id} and homework_type in #{type_ids} and publish_time <= '#{Date.today}' and (homework_commons.name like '%#{search}%') order by CONVERT (courses.name USING gbk) COLLATE gbk_chinese_ci #{@b_sort}"
|
||||
@homeworks = HomeworkCommon.find_by_sql(sql)
|
||||
elsif @order == "user_name"
|
||||
@homeworks = HomeworkCommon.where("user_id = #{@user.id} and course_id not in #{course_ids} and publish_time <= '#{Date.today}' and (name like '%#{search}%') and homework_type in #{type_ids}").joins(:user).order("CONVERT (lastname USING gbk) COLLATE gbk_chinese_ci #{@b_sort}, CONVERT (firstname USING gbk) COLLATE gbk_chinese_ci #{@b_sort},login #{@b_sort}")
|
||||
else
|
||||
@homeworks = HomeworkCommon.where("user_id = #{@user.id} and course_id not in #{course_ids} and publish_time <= '#{Date.today}' and (name like '%#{search}%') and homework_type in #{type_ids}").order("#{@order} #{@b_sort}")
|
||||
end
|
||||
elsif params[:type] == "2" #题库
|
||||
if params[:is_import].to_i == 1
|
||||
visible_course = Course.where("is_public = 1 && is_delete = 0")
|
||||
elsif params[:is_import].to_i == 0
|
||||
|
@ -812,17 +836,6 @@ class UsersController < ApplicationController
|
|||
else
|
||||
@homeworks = HomeworkCommon.where("course_id in #{visible_course_ids} and publish_time <= '#{Date.today}' and homework_type in #{type_ids} and (name like '%#{search}%' or user_id in #{user_ids})").order("#{@order} #{@b_sort}")
|
||||
end
|
||||
elsif params[:type] == "2" #我的题库
|
||||
courses = @user.courses.where("is_delete = 1")
|
||||
course_ids = courses.empty? ? "(-1)" : "(" + courses.map{|course| course.id}.join(",") + ")"
|
||||
if @order == "course_name"
|
||||
sql = "SELECT homework_commons.* FROM homework_commons INNER JOIN courses ON homework_commons.course_id = courses.id where homework_commons.course_id not in #{course_ids} and homework_commons.user_id = #{@user.id} and homework_type in #{type_ids} and publish_time <= '#{Date.today}' and (homework_commons.name like '%#{search}%') order by CONVERT (courses.name USING gbk) COLLATE gbk_chinese_ci #{@b_sort}"
|
||||
@homeworks = HomeworkCommon.find_by_sql(sql)
|
||||
elsif @order == "user_name"
|
||||
@homeworks = HomeworkCommon.where("user_id = #{@user.id} and course_id not in #{course_ids} and publish_time <= '#{Date.today}' and (name like '%#{search}%') and homework_type in #{type_ids}").joins(:user).order("CONVERT (lastname USING gbk) COLLATE gbk_chinese_ci #{@b_sort}, CONVERT (firstname USING gbk) COLLATE gbk_chinese_ci #{@b_sort},login #{@b_sort}")
|
||||
else
|
||||
@homeworks = HomeworkCommon.where("user_id = #{@user.id} and course_id not in #{course_ids} and publish_time <= '#{Date.today}' and (name like '%#{search}%') and homework_type in #{type_ids}").order("#{@order} #{@b_sort}")
|
||||
end
|
||||
elsif params[:type] == "3" #申请题库
|
||||
apply_homeworks = ApplyHomework.where("user_id = ?",@user.id)
|
||||
homework_ids = apply_homeworks.empty? ? "(-1)" : "(" + apply_homeworks.map{|ah| ah.homework_common_id}.join(",") + ")"
|
||||
|
@ -1410,8 +1423,13 @@ class UsersController < ApplicationController
|
|||
@all_count = @user.courses.visible.where("is_delete =?", 0).count
|
||||
elsif @type == 'Syllabus'
|
||||
@syllabus = Syllabus.where("id = #{params[:syllabus]}").first
|
||||
@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").limit(5).offset(@page * 5)
|
||||
@all_count = User.current.courses.visible.where("is_delete =? and syllabus_id =?", 0, @syllabus.id).count
|
||||
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).offset(@page * 5)
|
||||
@all_count = all_courses.count
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -2023,7 +2041,7 @@ class UsersController < ApplicationController
|
|||
@flag = true
|
||||
if params[:send_id].present?
|
||||
rs = ResourcesService.new
|
||||
@ori, @flag, @save_message = rs.send_resource_to_course(params)
|
||||
@ori, @flag, @save_message = rs.send_resource_to_course(User.current, params)
|
||||
elsif params[:send_ids].present?
|
||||
send_ids = params[:send_ids].split(",")
|
||||
course_ids = params[:course_ids]
|
||||
|
@ -2132,6 +2150,7 @@ class UsersController < ApplicationController
|
|||
# 添加资源到对应的项目
|
||||
def add_exist_file_to_project
|
||||
@flag = true
|
||||
# 发送单个资源
|
||||
if params[:send_id].present?
|
||||
send_id = params[:send_id]
|
||||
project_ids = params[:projects_ids]
|
||||
|
@ -2168,6 +2187,8 @@ class UsersController < ApplicationController
|
|||
quotes = ori.quotes.to_i + 1
|
||||
ori.update_attribute(:quotes, quotes) unless ori.nil?
|
||||
ori.forwards << Forward.new(:to_type => attach_copied_obj.class.name, :to_id => attach_copied_obj.id,:created_at => Time.now)
|
||||
# 项目中添加动态
|
||||
ForgeActivity.create(:user_id => User.current.id, :project_id => project_id, :forge_act_id => attach_copied_obj.id, :forge_act_type => "Attachment" )
|
||||
end
|
||||
unless Project.find(project_id).project_score.nil?
|
||||
Project.find(project_id).project_score.update_attribute(:attach_num,
|
||||
|
@ -2176,6 +2197,7 @@ class UsersController < ApplicationController
|
|||
end
|
||||
@ori = ori
|
||||
end
|
||||
# 发送多个资源
|
||||
elsif params[:send_ids].present?
|
||||
send_ids = params[:send_ids].split(",")
|
||||
project_ids = params[:projects_ids]
|
||||
|
@ -2214,6 +2236,8 @@ class UsersController < ApplicationController
|
|||
quotes = ori.quotes.to_i + 1
|
||||
ori.update_attribute(:quotes, quotes) unless ori.nil?
|
||||
ori.forwards << Forward.new(:to_type => attach_copied_obj.class.name, :to_id => attach_copied_obj.id,:created_at => Time.now)
|
||||
# 项目中添加动态
|
||||
ForgeActivity.create(:user_id => User.current.id, :project_id => project_id, :forge_act_id => attach_copied_obj.id, :forge_act_type => "Attachment" )
|
||||
end
|
||||
unless Project.find(project_id).project_score.nil?
|
||||
Project.find(project_id).project_score.update_attribute(:attach_num, Project.find(project_id).project_score.attach_num + 1)
|
||||
|
@ -3273,7 +3297,10 @@ class UsersController < ApplicationController
|
|||
case params[:type]
|
||||
when 'OrgDocumentComment'
|
||||
obj = OrgDocumentComment.where('id = ?', params[:id].to_i).first
|
||||
@journals = obj.children.reorder("created_at desc")
|
||||
@user_activity_id = params[:div_id].to_i if params[:div_id]
|
||||
@type = 'OrgDocumentComment'
|
||||
comments = []
|
||||
@journals = get_all_children(comments, obj)
|
||||
when 'Message'
|
||||
obj = Message.where('id = ?', params[:id].to_i).first
|
||||
@type = 'Message'
|
||||
|
@ -3300,7 +3327,11 @@ class UsersController < ApplicationController
|
|||
@journals = obj.journals.reorder("created_on desc")
|
||||
when 'BlogComment'
|
||||
obj = BlogComment.where('id = ?', params[:id].to_i).first
|
||||
@journals = obj.children.reorder("created_on desc")
|
||||
@user_activity_id = params[:div_id].to_i if params[:div_id]
|
||||
@homepage = params[:homepage].to_i
|
||||
@type = 'BlogComment'
|
||||
comments = []
|
||||
@journals = get_all_children(comments, obj)
|
||||
when 'HomeworkCommon'
|
||||
obj = HomeworkCommon.where('id = ?', params[:id].to_i).first
|
||||
@journals = obj.journals_for_messages.reorder("created_on desc")
|
||||
|
|
|
@ -69,11 +69,21 @@ class WechatsController < ActionController::Base
|
|||
end
|
||||
|
||||
on :click, with: 'DEV' do |request, key|
|
||||
request.reply.text "此功能正在开发中,很快就会上线,谢谢!"
|
||||
uw = user_binded?(request[:FromUserName])
|
||||
unless uw
|
||||
sendBind(request)
|
||||
else
|
||||
request.reply.text "此功能正在开发中,很快就会上线,谢谢!"
|
||||
end
|
||||
end
|
||||
# When user view URL in the menu button
|
||||
on :view, with: 'http://wechat.somewhere.com/view_url' do |request, view|
|
||||
request.reply.text "#{request[:FromUserName]} view #{view}"
|
||||
uw = user_binded?(request[:FromUserName])
|
||||
unless uw
|
||||
sendBind(request)
|
||||
else
|
||||
request.reply.text "#{request[:FromUserName]} view #{view}"
|
||||
end
|
||||
end
|
||||
|
||||
# When user sent the imsage
|
||||
|
@ -139,8 +149,8 @@ class WechatsController < ActionController::Base
|
|||
|
||||
on :click, with: 'JOIN_CLASS' do |request, key|
|
||||
uw = user_binded?(request[:FromUserName])
|
||||
unless uw
|
||||
sendBind(request)
|
||||
unless uw
|
||||
sendBind(request)
|
||||
else
|
||||
request.reply.text "请直接回复5位班级邀请码\n(不区分大小写):"
|
||||
end
|
||||
|
@ -198,6 +208,9 @@ class WechatsController < ActionController::Base
|
|||
course = Course.where(invite_code: params[:invite_code]).first if params[:invite_code]
|
||||
raise "班级不存在,请确认您的邀请码是否输入正确,谢谢!" unless course
|
||||
|
||||
#取出用户角色类型
|
||||
role = 10
|
||||
|
||||
cs = CoursesService.new
|
||||
status = cs.join_course({invite_code: course.invite_code}, user)
|
||||
logger.info status
|
||||
|
@ -208,7 +221,7 @@ class WechatsController < ActionController::Base
|
|||
news = (1..1).each_with_object([]) { |n, memo| memo << { title: '恭喜您成功加入班级,开始学习吧!',
|
||||
content: "课程名称: #{course.name}\n班级名称: #{course.name}\n任课老师: #{course.teacher.show_name}\n进入班级,和小伙伴愉快的学习吧!"} }
|
||||
return request.reply.news(news) do |article, n, index| # article is return object
|
||||
url = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=#{Wechat.config.appid}&redirect_uri=#{ROOT_URL+'/wechat/user_activities?id='+course.id.to_s}&response_type=code&scope=snsapi_base&state=myclass#wechat_redirect"
|
||||
url = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=#{Wechat.config.appid}&redirect_uri=#{ROOT_URL+'/wechat/user_activities#/class?id='+course.id.to_s}&response_type=code&scope=snsapi_base&state=myclass#wechat_redirect"
|
||||
pic_url = "#{ROOT_URL}/images/wechat/class.jpg"
|
||||
article.item title: "#{n[:title]}",
|
||||
description: n[:content],
|
||||
|
|
|
@ -385,6 +385,7 @@ module ApplicationHelper
|
|||
subject = truncate(subject, :length => 60)
|
||||
end
|
||||
end
|
||||
# status_id:3、已解决 5、已关闭
|
||||
if issue.status_id == 3
|
||||
s = link_to text, issue_path(issue), :class => "text_line_s", :title => title
|
||||
elsif issue.status_id == 5
|
||||
|
@ -1765,20 +1766,21 @@ module ApplicationHelper
|
|||
link_to_function(l(:button_uncheck_all), "checkAll('#{form_name}', false)")
|
||||
end
|
||||
|
||||
# 本次修改,修改为只显示关闭的所占%比
|
||||
def progress_bar(pcts, options={})
|
||||
pcts = [pcts, pcts] unless pcts.is_a?(Array)
|
||||
pcts = [pcts] unless pcts.is_a?(Array)
|
||||
pcts = pcts.collect(&:round)
|
||||
pcts[1] = pcts[1] - pcts[0]
|
||||
pcts << (100 - pcts[1] - pcts[0])
|
||||
# pcts[1] = pcts[1] + pcts[0]
|
||||
pcts << (100 - pcts[0])
|
||||
width = options[:width] || '100px;'
|
||||
legend = options[:legend] || ''
|
||||
content_tag('table',
|
||||
content_tag('tr',
|
||||
(pcts[0] > 0 ? content_tag('td', '', :style => "width: #{pcts[0]}%;", :class => 'closed') : ''.html_safe) +
|
||||
(pcts[1] > 0 ? content_tag('td', '', :style => "width: #{pcts[1]}%;", :class => 'done') : ''.html_safe) +
|
||||
(pcts[2] > 0 ? content_tag('td', '', :style => "width: #{pcts[2]}%;", :class => 'todo') : ''.html_safe)
|
||||
), :class => 'progress', :style => "width: #{width};").html_safe +
|
||||
content_tag('p', legend, :class => 'percent').html_safe
|
||||
(pcts[0] > 0 ? content_tag('td', '', :style => "width: #{pcts[0]}%;", :class => 'closed', :title => "已关闭:#{pcts[0]}%") : ''.html_safe) +
|
||||
# (pcts[1] > 0 ? content_tag('td', '', :style => "width: #{pcts[1]}%;", :class => 'done', :title => "开发中:#{pcts[1]}%") : ''.html_safe) +
|
||||
(pcts[1] > 0 ? content_tag('td', '', :style => "width: #{pcts[1]}%;", :class => 'todo', :title => "未完成:#{pcts[1]}%") : ''.html_safe), :style => "width: #{width}"
|
||||
), :class => 'progress').html_safe
|
||||
# + content_tag('p', legend, :class => 'percent').html_safe
|
||||
end
|
||||
|
||||
def checked_image(checked=true)
|
||||
|
@ -2990,6 +2992,7 @@ int main(int argc, char** argv){
|
|||
unless projects.empty?
|
||||
project_ids = '('+projects.map{|pro|pro.project_id}.join(',')+')'
|
||||
sort_projects = ForgeActivity.find_by_sql("SELECT MAX(updated_at) AS updated_at,user_id, project_id FROM forge_activities WHERE project_id IN #{project_ids} GROUP BY project_id ORDER BY MAX(updated_at) DESC")
|
||||
#sort_projects = sort_projects.sort_by{|sp| (!sp.project.project_score.nil? && !sp.project.project_score.commit_time.nil?) ? '' : sp.project.project_score.commit_time}
|
||||
return sort_projects
|
||||
end
|
||||
end
|
||||
|
@ -3141,13 +3144,18 @@ end
|
|||
|
||||
#获取所有子节点
|
||||
def get_all_children result, jour
|
||||
if (jour.kind_of? JournalsForMessage) || (jour.kind_of? Message)
|
||||
if (jour.kind_of? JournalsForMessage) || (jour.kind_of? Message) || (jour.kind_of? BlogComment) || (jour.kind_of? OrgDocumentComment)
|
||||
jour.children.each do |jour_child|
|
||||
result << jour_child
|
||||
get_all_children result, jour_child
|
||||
end
|
||||
end
|
||||
result.sort! { |a,b| b.created_on <=> a.created_on }
|
||||
if jour.respond_to?(:created_on)
|
||||
result.sort! { |a,b| b.created_on <=> a.created_on }
|
||||
elsif jour.respond_to?(:created_at)
|
||||
result.sort! { |a,b| b.created_at <=> a.created_at }
|
||||
end
|
||||
result
|
||||
end
|
||||
|
||||
#将有置顶属性的提到数组前面
|
||||
|
@ -3284,7 +3292,7 @@ def strip_html(text,len=0,endss="...")
|
|||
ss = ""
|
||||
if !text.nil? && text.length>0
|
||||
ss=text.gsub(/<\/?.*?>/, '').strip
|
||||
ss = ss.gsub(/ /, ' ')
|
||||
ss = ss.gsub(/ */, ' ')
|
||||
|
||||
if len > 0 && ss.length > len
|
||||
ss = ss[0, len] + endss
|
||||
|
@ -3296,6 +3304,15 @@ def strip_html(text,len=0,endss="...")
|
|||
return ss
|
||||
end
|
||||
|
||||
def message_content content
|
||||
content = (strip_html content).strip
|
||||
content = content.gsub(/\s+/, " ")
|
||||
if content.gsub(" ", "") == ""
|
||||
content = "[非文本消息]"
|
||||
end
|
||||
content
|
||||
end
|
||||
|
||||
def get_hw_index(hw,is_teacher)
|
||||
if is_teacher
|
||||
homeworks = hw.course.homework_commons.order("created_at asc")
|
||||
|
|
|
@ -3,16 +3,16 @@ module QualityAnalysisHelper
|
|||
|
||||
def sqale_rating_status val
|
||||
arr = []
|
||||
if val < 5
|
||||
if val <= 5
|
||||
arr << "很好"
|
||||
arr << "b_green2"
|
||||
elsif val. > 5 && val < 10
|
||||
elsif val. > 5 && val <= 10
|
||||
arr << "较好"
|
||||
arr << "b_slow_yellow"
|
||||
elsif val > 10 && val < 20
|
||||
elsif val > 10 && val <= 20
|
||||
arr << "中等"
|
||||
arr << "b_yellow"
|
||||
elsif val > 20 && val < 50
|
||||
elsif val > 20 && val <= 50
|
||||
arr << "较差"
|
||||
arr << "b_slow_red"
|
||||
elsif val > 20
|
||||
|
@ -23,10 +23,10 @@ module QualityAnalysisHelper
|
|||
|
||||
def complexity_status val
|
||||
arr = []
|
||||
if val < 10
|
||||
if val <= 10
|
||||
arr << "良好"
|
||||
arr << "b_green2"
|
||||
elsif val > 10 && val < 15
|
||||
elsif val > 10 && val <= 15
|
||||
arr << "较高"
|
||||
arr << "b_yellow"
|
||||
elsif val > 15
|
||||
|
@ -37,10 +37,10 @@ module QualityAnalysisHelper
|
|||
|
||||
def duplicated_lines_density_status val
|
||||
arr = []
|
||||
if val < 30
|
||||
if val <= 30
|
||||
arr << "良好"
|
||||
arr << "b_green2"
|
||||
elsif val > 30 && val < 50
|
||||
elsif val > 30 && val <= 50
|
||||
arr << "较高"
|
||||
arr << "b_yellow"
|
||||
elsif val > 50
|
||||
|
@ -51,10 +51,10 @@ module QualityAnalysisHelper
|
|||
|
||||
def comment_lines_density_status val
|
||||
arr = []
|
||||
if val < 20
|
||||
if val <= 20
|
||||
arr << "较低"
|
||||
arr << "b_yellow"
|
||||
elsif val > 20 && val < 50
|
||||
elsif val > 20 && val <= 50
|
||||
arr << "正常"
|
||||
arr << "b_green2"
|
||||
elsif val > 50
|
||||
|
@ -64,15 +64,15 @@ module QualityAnalysisHelper
|
|||
end
|
||||
|
||||
def score_sqale_rating val
|
||||
if val > 0 && val < 5
|
||||
if val >= 0 && val <= 5
|
||||
"5"
|
||||
elsif val > 5 && val < 10
|
||||
elsif val > 5 && val <= 10
|
||||
"4"
|
||||
elsif val > 10 && val < 20
|
||||
elsif val > 10 && val <= 20
|
||||
"3"
|
||||
elsif val > 20 && val < 50
|
||||
elsif val > 20 && val <= 50
|
||||
"2"
|
||||
elsif val > 20
|
||||
elsif val > 50
|
||||
"1"
|
||||
end
|
||||
end
|
||||
|
|
|
@ -47,13 +47,11 @@ module RepositoriesHelper
|
|||
end
|
||||
|
||||
# 获取文件目录的最新动态
|
||||
def get_trees_last_changes(project_id, rev, ent_name)
|
||||
g = Gitlab.client
|
||||
def get_trees_last_changes(project_id, rev, ent_name, g)
|
||||
begin
|
||||
tree_changes = g.rep_last_changes(project_id, :rev => rev, :path => ent_name)
|
||||
tree_changes
|
||||
rescue
|
||||
logger.error("faile to get tress activities!")
|
||||
rescue Exception => e
|
||||
puts e
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -65,7 +63,7 @@ module RepositoriesHelper
|
|||
|
||||
# 获取diff内容行号
|
||||
def diff_line_num content
|
||||
content.scan(/@@ -(\d+),\d+ \+\d+,\d+ @@/).first.join("").to_i
|
||||
content.scan(/@@ -(\d+),\d+ \+\d+,\d+ @@/).first.nil? ? "" : content.scan(/@@ -(\d+),\d+ \+\d+,\d+ @@/).first.join("").to_i
|
||||
end
|
||||
|
||||
# 处理内容
|
||||
|
|
|
@ -64,14 +64,12 @@ class Changeset < ActiveRecord::Base
|
|||
includes(:repository => :project).where(Project.allowed_to_condition(args.shift || User.current, :view_changesets, *args))
|
||||
}
|
||||
|
||||
after_create :scan_for_issues,:refresh_changests#:be_user_score # user_score
|
||||
after_update :be_user_score
|
||||
# after_create :scan_for_issues,:refresh_changests#:be_user_score # user_score
|
||||
# after_update :be_user_score
|
||||
after_destroy :down_user_score
|
||||
before_create :before_create_cs
|
||||
|
||||
# fq
|
||||
# after_create :act_as_activity
|
||||
# end
|
||||
# before_create :before_create_cs
|
||||
after_create :act_as_forge_activity
|
||||
|
||||
|
||||
def revision=(r)
|
||||
write_attribute :revision, (r.nil? ? nil : r.to_s)
|
||||
|
@ -117,6 +115,12 @@ class Changeset < ActiveRecord::Base
|
|||
self.user = repository.find_committer_user(self.committer)
|
||||
end
|
||||
|
||||
# 项目中提交动态,类型Changeset
|
||||
# type:0 为老版本即Trsutie数据 1为gitlab中获取的动态
|
||||
def act_as_forge_activity
|
||||
self.acts << ForgeActivity.new(:user_id => self.user_id, :project_id => self.project_id, :type => true)
|
||||
end
|
||||
|
||||
def scan_for_issues
|
||||
scan_comment_for_issue_ids
|
||||
end
|
||||
|
|
|
@ -23,46 +23,52 @@ class ForgeActivity < ActiveRecord::Base
|
|||
after_create :add_user_activity, :add_org_activity
|
||||
before_destroy :destroy_user_activity, :destroy_org_activity
|
||||
|
||||
#在个人动态里面增加当前动态
|
||||
# 在个人动态里面增加当前动态
|
||||
# 版本库提交动态不显示在用户动态中
|
||||
def add_user_activity
|
||||
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
|
||||
else
|
||||
if self.forge_act_type == 'Message' && !self.forge_act.parent_id.nil?
|
||||
user_activity = UserActivity.where("act_type = 'Message' and act_id = #{self.forge_act.parent.id}").first
|
||||
user_activity.created_at = self.created_at
|
||||
if self.forge_act_type != "Changeset"
|
||||
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
|
||||
else
|
||||
user_activity = UserActivity.new
|
||||
user_activity.act_id = self.forge_act_id
|
||||
user_activity.act_type = self.forge_act_type
|
||||
user_activity.container_type = "Project"
|
||||
user_activity.container_id = self.project_id
|
||||
user_activity.user_id = self.user_id
|
||||
user_activity.save
|
||||
if self.forge_act_type == 'Message' && !self.forge_act.parent_id.nil?
|
||||
user_activity = UserActivity.where("act_type = 'Message' and act_id = #{self.forge_act.parent.id}").first
|
||||
user_activity.created_at = self.created_at
|
||||
user_activity.save
|
||||
else
|
||||
user_activity = UserActivity.new
|
||||
user_activity.act_id = self.forge_act_id
|
||||
user_activity.act_type = self.forge_act_type
|
||||
user_activity.container_type = "Project"
|
||||
user_activity.container_id = self.project_id
|
||||
user_activity.user_id = self.user_id
|
||||
user_activity.save
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# 项目提交动态不显示在组织动态中
|
||||
def add_org_activity
|
||||
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
|
||||
org_activity.save
|
||||
else
|
||||
if self.forge_act_type == 'Message' && !self.forge_act.parent_id.nil?
|
||||
org_activity = OrgActivity.where("org_act_type = 'Message' and org_act_id = #{self.forge_act.parent.id}").first
|
||||
org_activity.created_at = self.created_at
|
||||
if self.forge_act_type != "Changeset"
|
||||
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
|
||||
org_activity.save
|
||||
else
|
||||
OrgActivity.create(:user_id => self.user_id,
|
||||
:org_act_id => self.forge_act_id,
|
||||
:org_act_type => self.forge_act_type,
|
||||
:container_id => self.project_id,
|
||||
:container_type => 'Project',
|
||||
:created_at => self.created_at,
|
||||
:updated_at => self.updated_at)
|
||||
if self.forge_act_type == 'Message' && !self.forge_act.parent_id.nil?
|
||||
org_activity = OrgActivity.where("org_act_type = 'Message' and org_act_id = #{self.forge_act.parent.id}").first
|
||||
org_activity.created_at = self.created_at
|
||||
org_activity.save
|
||||
else
|
||||
OrgActivity.create(:user_id => self.user_id,
|
||||
:org_act_id => self.forge_act_id,
|
||||
:org_act_type => self.forge_act_type,
|
||||
:container_id => self.project_id,
|
||||
:container_type => 'Project',
|
||||
:created_at => self.created_at,
|
||||
:updated_at => self.updated_at)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -45,7 +45,7 @@ class StudentWorkTest < ActiveRecord::Base
|
|||
private
|
||||
def get_success_count
|
||||
self.results.inject(0) do |sum, result|
|
||||
sum += (result["status"] && result["status"].to_i == 0 ? 1 : 0)
|
||||
sum += (result["status"] && result["status"].class == ::Fixnum && result["status"].to_i == 0 ? 1 : 0)
|
||||
end || 0
|
||||
end
|
||||
|
||||
|
|
|
@ -1148,17 +1148,17 @@ class User < Principal
|
|||
|
||||
#为新注册用户发送留言
|
||||
def add_new_jour
|
||||
if Message.where("id=19278").any? and Message.where("id=19291").any? and Message.where("id=19292").any?
|
||||
lead_message1 = Message.find(19278)
|
||||
if Message.where("id=19504").any? and Message.where("id=19291").any? and Message.where("id=19292").any?
|
||||
lead_message1 = Message.find(19292)
|
||||
notes1 = lead_message1.content
|
||||
# lead_message2 = Message.find(19292)
|
||||
# notes2 = lead_message2.content
|
||||
# lead_message3 = Message.find(19291)
|
||||
# notes3 = lead_message3.content
|
||||
# # user_id 默认为课程使者创建
|
||||
lead_message2 = Message.find(19291)
|
||||
notes2 = lead_message2.content
|
||||
lead_message3 = Message.find(19504)
|
||||
notes3 = lead_message3.content
|
||||
#user_id 默认为课程使者创建
|
||||
self.journals_for_messages << JournalsForMessage.new(:user_id => 1, :notes => notes1, :reply_id => 0, :status => true, :is_readed => false, :private => 0)
|
||||
# self.journals_for_messages << JournalsForMessage.new(:user_id => 1, :notes => notes2, :reply_id => 0, :status => true, :is_readed => false, :private => 0)
|
||||
# self.journals_for_messages << JournalsForMessage.new(:user_id => 1, :notes => notes3, :reply_id => 0, :status => true, :is_readed => false, :private => 0)
|
||||
self.journals_for_messages << JournalsForMessage.new(:user_id => 1, :notes => notes2, :reply_id => 0, :status => true, :is_readed => false, :private => 0)
|
||||
self.journals_for_messages << JournalsForMessage.new(:user_id => 1, :notes => notes3, :reply_id => 0, :status => true, :is_readed => false, :private => 0)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -187,10 +187,10 @@ class CoursesService
|
|||
else
|
||||
work_unit = get_user_work_unit course.teacher
|
||||
end
|
||||
unless (course.is_public == 1 || current_user.member_of_course?(course) || current_user.admin?)
|
||||
raise '403'
|
||||
end
|
||||
{:course => course,:work_unit => work_unit, :img_url => url_to_avatar(course),:current_user_is_member => current_user.member_of_course?(course),:current_user_is_teacher => is_course_teacher(current_user,course),:course_student_num => course ? course.student.count.to_s : 0}
|
||||
# unless (course.is_public == 1 || current_user.member_of_course?(course) || current_user.admin?)
|
||||
# raise '403'
|
||||
# end
|
||||
{:course => course,:work_unit => work_unit, :img_url => url_to_avatar(course),:current_user_is_member => current_user.nil? ? false : current_user.member_of_course?(course),:current_user_is_teacher => current_user.nil? ? false : is_course_teacher(current_user,course),:course_student_num => course ? course.student.count.to_s : 0}
|
||||
end
|
||||
|
||||
#创建课程
|
||||
|
@ -326,8 +326,8 @@ class CoursesService
|
|||
define_error [
|
||||
0, '加入成功',
|
||||
1, '密码错误',
|
||||
2, '课程已过期 请联系课程管理员重启课程。',
|
||||
3, '您已经加入了课程',
|
||||
2, '班级已过期 请联系班级管理员重启班级。',
|
||||
3, '您已经加入了班级',
|
||||
4, '您的邀请码不正确',
|
||||
5, '您还未登录',
|
||||
6, '申请成功,请等待审核完毕',
|
||||
|
@ -354,54 +354,27 @@ class CoursesService
|
|||
roleName = member.roles[0].name if member
|
||||
if params[:invite_code].present?
|
||||
#如果加入角色为学生 并且当前是学生
|
||||
if params[:role] == "10" && roleName == "Student"
|
||||
if roleName == "Student"
|
||||
@state = 3
|
||||
#如果加入的角色为老师,并且当前已经是老师
|
||||
elsif params[:role] == "9" && roleName == "Teacher"
|
||||
elsif roleName == "Teacher"
|
||||
@state = 8
|
||||
#如果加入的角色教辅并且当前为教辅
|
||||
elsif params[:role] == "7" && roleName == "TeachingAsistant"
|
||||
elsif roleName == "TeachingAsistant"
|
||||
@state = 9
|
||||
elsif roleName == "Manager"
|
||||
@state = 10
|
||||
#如果加入角色为教师或者教辅,并且当前是学生,或者是要成为教辅,当前不是教辅,或者要成为教师,当前不是教师。那么要发送请求
|
||||
elsif (params[:role] != "10" && roleName == "Student") || (params[:role] == "7" && roleName != "TeachingAsistant" ) || (params[:role] == "9" && roleName != "Teacher" )
|
||||
#如果已经发送过消息了,那么就要给个提示
|
||||
if CourseMessage.where("course_message_type = 'JoinCourseRequest' and user_id = #{course.tea_id} and course_message_id = #{User.current.id} and course_id = #{course.id} and status = 0 ").count != 0
|
||||
@state = 7
|
||||
else
|
||||
Mailer.run.join_course_request(course, User.current, params[:role])
|
||||
CourseMessage.create(:user_id => course.tea_id, :course_id => course.id, :viewed => false,:content=> params[:role],:course_message_id=>User.current.id,:course_message_type=>'JoinCourseRequest',:status=>0)
|
||||
@state = 6
|
||||
end
|
||||
#如果加入角色是学生,但是是当前课程的教师或者教辅
|
||||
elsif params[:role] == "10" && roleName != "Student"
|
||||
member.role_ids = [params[:role]]
|
||||
member.save
|
||||
StudentsForCourse.create(:student_id => current_user.id, :course_id => course.id)
|
||||
@state = 0
|
||||
end
|
||||
else
|
||||
@state = 1
|
||||
end
|
||||
else
|
||||
if params[:invite_code].present?
|
||||
if params[:role] == "10" || params[:role] == nil
|
||||
members = []
|
||||
members << Member.new(:role_ids => [10], :user_id => current_user.id)
|
||||
course.members << members
|
||||
StudentsForCourse.create(:student_id => current_user.id, :course_id => course.id)
|
||||
@state = 0
|
||||
else
|
||||
#如果已经发送过消息了,那么就要给个提示
|
||||
if CourseMessage.where("course_message_type = 'JoinCourseRequest' and user_id = #{course.tea_id} and content = #{params[:role]} and course_message_id = #{User.current.id} and course_id = #{course.id} and status = 0").count != 0
|
||||
@state = 7
|
||||
else
|
||||
Mailer.run.join_course_request(course, User.current, params[:role])
|
||||
CourseMessage.create(:user_id => course.tea_id, :course_id => course.id, :viewed => false,:content=> params[:role],:course_message_id=>User.current.id,:course_message_type=>'JoinCourseRequest',:status=>0)
|
||||
@state = 6
|
||||
end
|
||||
end
|
||||
else
|
||||
@state = 1
|
||||
end
|
||||
|
@ -419,7 +392,7 @@ class CoursesService
|
|||
def homework_list params,current_user
|
||||
course = Course.find(params[:id])
|
||||
if course.is_public != 0 || current_user.member_of_course?(course)
|
||||
bids = course.homework_commons.page(params[:page] || 1).per(20).order('created_at DESC')
|
||||
bids = course.homework_commons.where("publish_time <= ?",Time.now.strftime("%Y-%m-%d")).page(params[:page] || 1).per(20).order('created_at DESC')
|
||||
bids = bids.like(params[:name]) if params[:name].present?
|
||||
homeworks = []
|
||||
bids.each do |bid|
|
||||
|
@ -522,7 +495,7 @@ class CoursesService
|
|||
def course_attachments params
|
||||
result = []
|
||||
course = Course.find(params[:course_id])
|
||||
attachments = course.attachments.order("created_on ")
|
||||
attachments = course.attachments.where("is_publish = 1").order("created_on desc")
|
||||
if !params[:name].nil? && params[:name] != ""
|
||||
attachments.each do |atta|
|
||||
result << atta if atta.filename.include?(params[:name])
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
#coding=utf-8
|
||||
|
||||
class ResourcesService
|
||||
|
||||
#发送资源到课程
|
||||
def send_resource_to_course user,params
|
||||
send_id = params[:send_id]
|
||||
|
@ -50,4 +49,56 @@ class ResourcesService
|
|||
[@ori, @flag, @save_message]
|
||||
end
|
||||
|
||||
# 我的资源-课件 已发布的
|
||||
def all_course_attachments user
|
||||
|
||||
courses = user.courses.not_deleted
|
||||
|
||||
courses_ids = courses.empty? ? '(-1)' :"(" + courses.map(&:id).join(",") + ")"
|
||||
|
||||
attchments = Attachment.where("(author_id = #{user.id} and is_publish = 1 and container_id in #{courses_ids} and container_type = 'Course') or (container_type = 'Course' and is_publish = 1 and container_id in #{courses_ids})" ).order("created_on desc")
|
||||
|
||||
# attchments.each do |v|
|
||||
# course = Course.where("id=?",v.container_id).first
|
||||
# v[:coursename] = course.nil? ? "未知" : course.name
|
||||
# v[:attafile_size] = (number_to_human_size(v[:filesize])).gsub("ytes", "").to_s
|
||||
# end
|
||||
|
||||
attchments
|
||||
end
|
||||
|
||||
# 我的资源-作业 已发布的
|
||||
def all_homework_commons user
|
||||
|
||||
courses = user.courses.not_deleted
|
||||
|
||||
courses_ids = courses.empty? ? '(-1)' :"(" + courses.map(&:id).join(",") + ")"
|
||||
|
||||
homeworks = HomeworkCommon.where("course_id in #{courses_ids} and publish_time <= ?",Time.now.strftime("%Y-%m-%d")).order("created_at desc")
|
||||
|
||||
# homeworks.each do |v|
|
||||
# course = Course.where("id=?",v.course_id).first
|
||||
# v[:coursename] = course.nil? ? "未知" : course.name
|
||||
# end
|
||||
|
||||
homeworks
|
||||
end
|
||||
|
||||
# 我的资源-测验 已发布的
|
||||
def all_exercises user
|
||||
|
||||
courses = user.courses.not_deleted
|
||||
|
||||
courses_ids = courses.empty? ? '(-1)' :"(" + courses.map(&:id).join(",") + ")"
|
||||
|
||||
exercises = Exercise.where("exercise_status <> 1 and course_id in #{courses_ids}").order("created_at desc")
|
||||
|
||||
# exercises.each do |v|
|
||||
# course = Course.where("id=?",v.course_id).first
|
||||
# v[:coursename] = course.nil? ? "未知" : course.name
|
||||
# end
|
||||
|
||||
exercises
|
||||
end
|
||||
|
||||
end
|
|
@ -29,19 +29,13 @@ class SyllabusesService
|
|||
end
|
||||
#获取指定用户的课程大纲
|
||||
def user_syllabus(user)
|
||||
courses = CoursesService.new.user_courses_list(user)
|
||||
|
||||
other = Syllabus.new(title: '未命名课程',user_id: user.id)
|
||||
|
||||
courses.each do |c|
|
||||
other.courses << c[:course] unless c[:course].syllabus
|
||||
end
|
||||
|
||||
# user.syllabuses.each do |syllabus|
|
||||
# syllabus.courses = syllabus.courses.not_deleted
|
||||
# end
|
||||
# courses = CoursesService.new.user_courses_list(user)
|
||||
#
|
||||
# user.syllabuses.to_a << other
|
||||
# other = Syllabus.new(title: '未命名课程',user_id: user.id)
|
||||
#
|
||||
# courses.each do |c|
|
||||
# other.courses << c[:course] unless c[:course].syllabus
|
||||
# end
|
||||
|
||||
courses = user.courses.not_deleted
|
||||
syllabus_ids = courses.empty? ? '(-1)' : "(" + courses.map{|course| !course.syllabus_id.nil? && course.syllabus_id}.join(",") + ")"
|
||||
|
@ -51,12 +45,13 @@ class SyllabusesService
|
|||
syllabus.courses = courses.where("syllabus_id = #{syllabus.id}").select("courses.*,(SELECT MAX(updated_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS updatetime").order("time desc")
|
||||
end
|
||||
|
||||
syllabuses.to_a << other
|
||||
# syllabuses.to_a << other
|
||||
|
||||
syllabuses.to_a
|
||||
#管理权限 can_setting
|
||||
syllabuses.each do |s|
|
||||
s = judge_can_setting(s,user)
|
||||
end
|
||||
# syllabuses.each do |s|
|
||||
# s = judge_can_setting(s,user)
|
||||
# end
|
||||
|
||||
syllabuses
|
||||
end
|
||||
|
@ -72,6 +67,15 @@ class SyllabusesService
|
|||
course.course_infos << course_info
|
||||
end
|
||||
|
||||
def send_wechat_create_class_notice user,course
|
||||
count = ShieldWechatMessage.where("container_type='User' and container_id=#{user.id} and shield_type='Course' and shield_id=#{course.id}").count
|
||||
if count == 0
|
||||
ws = WechatService.new
|
||||
title = "恭喜您创建班级成功"
|
||||
ws.create_class_notice user.id, "create_course_notice", course.id,title, course.name, user.show_name, 0, "点击查看班级详情"
|
||||
end
|
||||
end
|
||||
|
||||
#创建大纲
|
||||
# params {title: '大纲名称', [{course}, {course}]}
|
||||
def create(user, title, courses = [])
|
||||
|
@ -83,6 +87,7 @@ class SyllabusesService
|
|||
if ::Course === course
|
||||
course.syllabus_id = sy.id
|
||||
course.save!
|
||||
send_wechat_create_class_notice user,course
|
||||
elsif Hash === course
|
||||
c = ::Course.new(course)
|
||||
c.tea_id = user.id
|
||||
|
@ -91,6 +96,7 @@ class SyllabusesService
|
|||
c.is_public = 0
|
||||
c.save!
|
||||
after_create_course(c, user)
|
||||
send_wechat_create_class_notice user,c
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -134,6 +140,7 @@ class SyllabusesService
|
|||
course.is_public = 0
|
||||
course.save!
|
||||
after_create_course(course, user)
|
||||
send_wechat_create_class_notice user,course
|
||||
end
|
||||
status = 0
|
||||
end
|
||||
|
|
|
@ -115,7 +115,7 @@ class WechatService
|
|||
data = {
|
||||
touser:openid,
|
||||
template_id:template_id,
|
||||
url:"#{Setting.protocol}://#{Setting.host_name}/assets/wechat/app.html#/#{type}/#{id}",
|
||||
url:"#{Setting.protocol}://#{Setting.host_name}/wechat/user_activities#/#{type}/#{id}",#/assets/wechat/app.html#/#{type}/#{id}
|
||||
topcolor:"#FF0000",
|
||||
data:{
|
||||
first: {
|
||||
|
@ -139,11 +139,43 @@ class WechatService
|
|||
data
|
||||
end
|
||||
|
||||
def three_keys_template(openid, template_id, type, id, first, key1, key2, key3, remark="")
|
||||
data = {
|
||||
touser:openid,
|
||||
template_id:template_id,
|
||||
url:"#{Setting.protocol}://#{Setting.host_name}/wechat/user_activities#/#{type}/#{id}",#/assets/wechat/app.html#/#{type}/#{id}
|
||||
topcolor:"#FF0000",
|
||||
data:{
|
||||
first: {
|
||||
value:first,
|
||||
color:"#707070"
|
||||
},
|
||||
keyword1:{
|
||||
value:key1,
|
||||
color:"#707070"
|
||||
},
|
||||
keyword2:{
|
||||
value:key2,
|
||||
color:"#707070"
|
||||
},
|
||||
keyword3:{
|
||||
value:key3,
|
||||
color:"#707070"
|
||||
},
|
||||
remark:{
|
||||
value:remark,
|
||||
color:"#707070"
|
||||
}
|
||||
}
|
||||
}
|
||||
data
|
||||
end
|
||||
|
||||
def four_keys_template(openid, template_id, type, id, first, key1, key2, key3, key4, remark="")
|
||||
data = {
|
||||
touser:openid,
|
||||
template_id:template_id,
|
||||
url:"#{Setting.protocol}://#{Setting.host_name}/assets/wechat/app.html#/#{type}/#{id}",
|
||||
url:"#{Setting.protocol}://#{Setting.host_name}/wechat/user_activities#/#{type}/#{id}", #/assets/wechat/app.html#/#{type}/#{id}
|
||||
topcolor:"#FF0000",
|
||||
data:{
|
||||
first: {
|
||||
|
@ -250,4 +282,45 @@ class WechatService
|
|||
end
|
||||
end
|
||||
|
||||
def create_class_notice(user_id, type, id, first, key1, key2, key3, remark="")
|
||||
uw = UserWechat.where(user_id: user_id).first
|
||||
unless uw.nil?
|
||||
data = {
|
||||
touser:uw.openid,
|
||||
template_id:Wechat.config.create_class_notice,
|
||||
url:"#{Setting.protocol}://#{Setting.host_name}/wechat/user_activities#/class?id="+id.to_s,
|
||||
topcolor:"#FF0000",
|
||||
data:{
|
||||
first: {
|
||||
value:first,
|
||||
color:"#707070"
|
||||
},
|
||||
keyword1:{
|
||||
value:key1,
|
||||
color:"#707070"
|
||||
},
|
||||
keyword2:{
|
||||
value:key2,
|
||||
color:"#707070"
|
||||
},
|
||||
keyword3:{
|
||||
value:key3,
|
||||
color:"#707070"
|
||||
},
|
||||
remark:{
|
||||
value:remark,
|
||||
color:"#707070"
|
||||
}
|
||||
}
|
||||
}
|
||||
#data = three_keys_template uw.openid,Wechat.config.create_class_notice, type, id, first, key1, key2, key3, remark
|
||||
begin
|
||||
req = Wechat.api.template_message_send Wechat::Message.to(uw.openid).template(data)
|
||||
rescue Exception => e
|
||||
Rails.logger.error "[wechat_create_class_notice] ===> #{e}"
|
||||
end
|
||||
Rails.logger.info "send over. #{req}"
|
||||
end
|
||||
end
|
||||
|
||||
end
|
|
@ -1,4 +1,4 @@
|
|||
<%= stylesheet_link_tag 'new_user'%>
|
||||
<%= stylesheet_link_tag 'css/public'%>
|
||||
<div class="homepageContent BgBox">
|
||||
<h2 class="BgBox_h2">关于我们</h2>
|
||||
<div class="AgreementBox">
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<%= stylesheet_link_tag 'new_user'%>
|
||||
<%= stylesheet_link_tag 'css/public'%>
|
||||
<!--<div class="homepageContentContainer mb20" >-->
|
||||
<div class="homepageContent BgBox mt10">
|
||||
<h2 class="BgBox_h2">Trustie服务协议</h2>
|
||||
|
@ -28,24 +28,5 @@
|
|||
|
||||
|
||||
</div><!---BgBox end--->
|
||||
<!--</div><!–-homepageContentContainer end-–>-->
|
||||
<script>
|
||||
$(".resourcesList").mousedown(function(e) {
|
||||
if (3 == e.which) {
|
||||
document.oncontextmenu = function() {return false;}
|
||||
$("#contextMenu").hide();
|
||||
$("#contextMenu").attr("style","display: block; position: fixed; top:"
|
||||
+ e.pageY
|
||||
+ "px; left:"
|
||||
+ e.pageX
|
||||
+ "px; width: 80px;");
|
||||
$("#contextMenu").show();
|
||||
}
|
||||
|
||||
});
|
||||
$(".resourcesList").click(function(e) {
|
||||
$("#contextMenu").hide();
|
||||
document.oncontextmenu = function() {return true;}
|
||||
});
|
||||
</script>
|
||||
<!--</div>-->
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<%= stylesheet_link_tag 'new_user'%>
|
||||
<%= stylesheet_link_tag 'leftside'%>
|
||||
<%= stylesheet_link_tag 'css/common'%>
|
||||
<%= stylesheet_link_tag 'css/public'%>
|
||||
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function(){
|
||||
|
@ -62,7 +62,7 @@
|
|||
});
|
||||
|
||||
$mail.blur(function (event) {
|
||||
if (/^[a-z0-9]+([._\\-]*[a-z0-9])*@([a-z0-9]+[-a-z0-9]*[a-z0-9]+.){1,63}[a-z0-9]+$/.test(this.value) == false){
|
||||
if (/^[a-zA-Z0-9]+([._\\]*[a-z0-9])*@([a-z0-9]+[-a-z0-9]*[a-z0-9]+.){1,63}[a-z0-9]+$/.test(this.value) == false){
|
||||
$('#mail_req').html( '<span style="color: #c00202">邮件格式不对</span>').show();
|
||||
$mail_correct = false;
|
||||
return ;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<%= stylesheet_link_tag 'new_user'%>
|
||||
<%= stylesheet_link_tag 'css/public'%>
|
||||
|
||||
<div class="homepageContentContainer ">
|
||||
<div class="homepageContent BgBox">
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
</span>
|
||||
</td>
|
||||
<td align="center">
|
||||
<%= link_to(course.try(:teacher).try(:realname).truncate(6, omission: '...'), user_path(course.teacher)) %>
|
||||
<%= link_to(course.teacher.show_name.truncate(6, omission: '...'), user_path(course.teacher)) %>
|
||||
</td>
|
||||
<td align="center">
|
||||
<%= course.class_period %>
|
||||
|
@ -15,6 +15,9 @@
|
|||
<td class="center">
|
||||
<%= checked_image course.is_public? %>
|
||||
</td>
|
||||
<td class="center">
|
||||
<%= course.is_delete == 0 ? '正常' : '归档' %>
|
||||
</td>
|
||||
<td class="center">
|
||||
<%= format_date(course.created_at) %>
|
||||
</td>
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
<span>
|
||||
<a title="<%= syllabus.title %>" id="rename_syllabus_title_<%= syllabus.id %>" ondblclick="rename_syllabus_title($(this),'<%=syllabus.title %>','<%=syllabus.id %>');"><%= syllabus.title %></a>
|
||||
</span>
|
|
@ -27,10 +27,10 @@
|
|||
<table class="list" style="width: 100%;table-layout: fixed">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="width: 30px;">
|
||||
<th style="width: 20px;">
|
||||
序号
|
||||
</th>
|
||||
<th style="width: 85px;">
|
||||
<th style="width: 70px;">
|
||||
班级
|
||||
</th>
|
||||
<th style="width: 35px;">
|
||||
|
@ -42,6 +42,9 @@
|
|||
<th style="width: 15px;">
|
||||
<%=l(:field_is_public)%>
|
||||
</th>
|
||||
<th style="width: 20px;">
|
||||
状态
|
||||
</th>
|
||||
<th style="width: 45px;">
|
||||
<%=l(:field_created_on)%>
|
||||
</th>
|
||||
|
@ -58,9 +61,11 @@
|
|||
</thead>
|
||||
<tbody>
|
||||
<% @courses.each do |course| %>
|
||||
<% unless course.teacher.nil? %>
|
||||
<tr class="<%= cycle("odd", "even") %>" id="course_<%=course.id %>">
|
||||
<%=render :partial => 'courselist_detail_tr', :locals => {:course => course} %>
|
||||
</tr>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
|
|
|
@ -27,10 +27,10 @@
|
|||
<table class="list" style="width: 100%;table-layout: fixed">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="width: 30px;">
|
||||
<th style="width: 20px;">
|
||||
序号
|
||||
</th>
|
||||
<th style="width: 85px;">
|
||||
<th style="width: 70px;">
|
||||
班级
|
||||
</th>
|
||||
<th style="width: 35px;">
|
||||
|
@ -42,6 +42,9 @@
|
|||
<th style="width: 15px;">
|
||||
<%=l(:field_is_public)%>
|
||||
</th>
|
||||
<th style="width: 20px;">
|
||||
状态
|
||||
</th>
|
||||
<th style="width: 45px;">
|
||||
<%=l(:field_created_on)%>
|
||||
</th>
|
||||
|
@ -58,17 +61,18 @@
|
|||
</thead>
|
||||
<tbody>
|
||||
<% @courses.each do |course| %>
|
||||
<% unless course.teacher.nil? %>
|
||||
<tr class="<%= cycle("odd", "even") %>" id="course_<%=course.id %>">
|
||||
<td style="text-align: center;">
|
||||
<%= course.id %>
|
||||
</td>
|
||||
<td style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" class="name" title='<%=course.name%>'>
|
||||
<td style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" class="name" title='<%=course.name%>' id="syllabus_course_name_<%=course.id %>">
|
||||
<span>
|
||||
<a title="<%=course.name %>" id="rename_course_name_<%=course.id %>" ondblclick="rename_course_name($(this),'<%=course.name %>','<%=course.id %>');"><%= course.name%></a>
|
||||
</span>
|
||||
</td>
|
||||
<td align="center">
|
||||
<%= link_to(course.try(:teacher).try(:realname).truncate(6, omission: '...'), user_path(course.teacher)) %>
|
||||
<%= link_to(course.teacher.show_name.truncate(6, omission: '...'), user_path(course.teacher)) %>
|
||||
</td>
|
||||
<td align="center">
|
||||
<%= course.class_period %>
|
||||
|
@ -76,6 +80,9 @@
|
|||
<td class="center">
|
||||
<%= checked_image course.is_public? %>
|
||||
</td>
|
||||
<td class="center">
|
||||
<%= course.is_delete == 0 ? '正常' : '归档' %>
|
||||
</td>
|
||||
<td class="center">
|
||||
<%= format_date(course.created_at) %>
|
||||
</td>
|
||||
|
@ -90,6 +97,7 @@
|
|||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
|
|
@ -46,10 +46,8 @@
|
|||
<td style="text-align: center;">
|
||||
<%= syllabus.id %>
|
||||
</td>
|
||||
<td style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" class="name" title='<%=syllabus.title%>'>
|
||||
<span>
|
||||
<%= link_to(syllabus.title, syllabus_path(syllabus.id)) %>
|
||||
</span>
|
||||
<td style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" class="name" title='<%=syllabus.title%>' id="syllabus_title_<%=syllabus.id %>">
|
||||
<%= render :partial => 'admin/rename_syllabus_title', :locals => {:syllabus => syllabus} %>
|
||||
</td>
|
||||
<td class="center">
|
||||
</td>
|
||||
|
@ -89,23 +87,24 @@
|
|||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
var tagNameHtml; //当前双击的链接的父节点的html
|
||||
var parentCssBorder; //当前双击的链接的父节点
|
||||
var ele; //当前双击的链接
|
||||
var tagId; //班级的id
|
||||
var tagName; //班级名称
|
||||
var CourseTagNameHtml; //当前双击的链接的父节点的html
|
||||
var CourseParentCssBorder; //当前双击的链接的父节点
|
||||
var CourseEle; //当前双击的链接
|
||||
var CourseTagId; //班级的id
|
||||
var CourseTagName; //班级名称
|
||||
var CourseIsdb;
|
||||
|
||||
function rename_course_name(domEle,name,id){
|
||||
isdb = true; //这是双击
|
||||
CourseIsdb = true; //这是双击
|
||||
//clearTimeout(clickFunction);
|
||||
if (domEle.children().get(0) != undefined) { //已经是编辑框的情况下不要动
|
||||
return;
|
||||
}
|
||||
tagNameHtml = domEle.parent().html();
|
||||
parentCssBorder = domEle.parent().css("border");
|
||||
ele = domEle;
|
||||
tagId = id;
|
||||
tagName = name;
|
||||
CourseTagNameHtml = domEle.parent().html();
|
||||
CourseParentCssBorder = domEle.parent().css("border");
|
||||
CourseEle = domEle;
|
||||
CourseTagId = id;
|
||||
CourseTagName = name;
|
||||
domEle.html('<input name="" id="renameCourseName" maxlength="120" minlength="1" style="width:125px;" value="' + name + '"/>');
|
||||
domEle.parent().css("border", "1px solid #ffffff");
|
||||
$("#renameCourseName").focus();
|
||||
|
@ -119,20 +118,66 @@
|
|||
updateCourseName();
|
||||
}
|
||||
});
|
||||
$("#renameSyllabusTitle").live("blur",function(){
|
||||
updateSyllabusTitle();
|
||||
}).live("keypress",function(e){
|
||||
if (e.keyCode == '13') {
|
||||
updateSyllabusTitle();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
//执行修改TAGName方法
|
||||
function updateCourseName(){
|
||||
if(isdb){
|
||||
isdb = false;
|
||||
if($("#renameCourseName").val() == tagName){ //如果值一样,则恢复原来的状态
|
||||
if(CourseIsdb){
|
||||
CourseIsdb = false;
|
||||
if($("#renameCourseName").val() == CourseTagName){ //如果值一样,则恢复原来的状态
|
||||
ele.parent().css("border","");
|
||||
ele.parent().html(tagNameHtml);
|
||||
ele.parent().html(CourseTagNameHtml);
|
||||
}
|
||||
else{
|
||||
$.post(
|
||||
'<%= admin_update_course_name_path %>',
|
||||
{"course_id": tagId, "name": $("#renameCourseName").val().trim()}
|
||||
{"course_id": CourseTagId, "name": $("#renameCourseName").val().trim()}
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var SyllabusTagNameHtml; //当前双击的链接的父节点的html
|
||||
var SyllabusParentCssBorder; //当前双击的链接的父节点
|
||||
var SyllabusEle; //当前双击的链接
|
||||
var SyllabusTagId; //课程的id
|
||||
var SyllabusTagName; //课程名称
|
||||
var SyllabusIsdb;
|
||||
function rename_syllabus_title(domEle,name,id){
|
||||
SyllabusIsdb = true; //这是双击
|
||||
//clearTimeout(clickFunction);
|
||||
if (domEle.children().get(0) != undefined) { //已经是编辑框的情况下不要动
|
||||
return;
|
||||
}
|
||||
SyllabusTagNameHtml = domEle.parent().html();
|
||||
SyllabusParentCssBorder = domEle.parent().css("border");
|
||||
SyllabusEle = domEle;
|
||||
SyllabusTagId = id;
|
||||
SyllabusTagName = name;
|
||||
domEle.html('<input name="" id="renameSyllabusTitle" maxlength="120" minlength="1" style="width:125px;" value="' + name + '"/>');
|
||||
domEle.parent().css("border", "1px solid #ffffff");
|
||||
$("#renameSyllabusTitle").focus();
|
||||
}
|
||||
|
||||
//执行修改TAGName方法
|
||||
function updateSyllabusTitle(){
|
||||
if(SyllabusIsdb){
|
||||
SyllabusIsdb = false;
|
||||
if($("#renameSyllabusTitle").val() == SyllabusTagName){ //如果值一样,则恢复原来的状态
|
||||
ele.parent().css("border","");
|
||||
ele.parent().html(SyllabusTagNameHtml);
|
||||
}
|
||||
else{
|
||||
$.post(
|
||||
'<%= admin_update_syllabus_title_path %>',
|
||||
{"syllabus_id": SyllabusTagId, "name": $("#renameSyllabusTitle").val().trim()}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
$("#syllabus_title_<%=@syllabus.id %>").html("<%=escape_javascript(render :partial => 'admin/rename_syllabus_title', :locals => {:syllabus => @syllabus}) %>");
|
|
@ -9,7 +9,7 @@
|
|||
</span>
|
||||
<span class="add_attachment">
|
||||
<% id ="file#{container.id}"%>
|
||||
<a href="javascript:void(0);" class="AnnexBtn fl" style= "<%= ie8? ? 'display:none' : ''%>" onclick="$('#'+'<%= id %>').click();">上传附件</a>
|
||||
<a href="javascript:void(0);" class="AnnexBtn fl mr10" style= "<%= ie8? ? 'display:none' : ''%>" onclick="$('#'+'<%= id %>').click();">上传附件</a>
|
||||
<%= file_field_tag 'attachments[dummy][file]',
|
||||
:id => "file#{container.id}",
|
||||
:class => 'file_selector',
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
<span class="attachment">
|
||||
<%= link_to truncate(history.filename,length: 35, omission: '...'),
|
||||
download_history_attachment_path(history.id, history.filename),
|
||||
:title => history.filename+"\n"+history.description.to_s, :style => "overflow: hidden; white-space: nowrap;text-overflow: ellipsis; max-width:300px;",:class => "linkBlue f_14 f_b link_file_a2 fl" %>
|
||||
:title => history.filename+"\n"+history.description.to_s, :style => "overflow: hidden; white-space: nowrap;text-overflow: ellipsis; max-width:300px;",:class => "linkBlue f_14 f_b upload_filename fl" %>
|
||||
<span class="fr">版本号:<%= history.version %></span>
|
||||
<div class="cl"></div>
|
||||
</span>
|
||||
|
|
|
@ -46,7 +46,7 @@
|
|||
</li>
|
||||
<li class=" ml90" >
|
||||
<a class="blue_btn fl c_white" onclick="submit_new_bid('<%= bid_id%>');" href="javascript:void(0)"><%= l(:button_create)%></a>
|
||||
<%= link_to l(:button_cancel), homework_course_path(@course), :class => "blue_btn grey_btn fl c_white"%>
|
||||
<%= link_to l(:button_cancel), homework_course_path(@course), :class => "grey_btn fl c_white ml10"%>
|
||||
<div class="cl"></div>
|
||||
</li>
|
||||
</ul>
|
||||
|
|
|
@ -3,12 +3,15 @@
|
|||
<div class="ReplyToMessageInputContainer mb10">
|
||||
<% if User.current.logged? %>
|
||||
<div nhname='new_message_<%= reply.id%>'>
|
||||
<%= form_for @blog_comment, :as => :reply, :url => {:controller => 'blog_comments',:action => 'reply', :id => @blogComment.id}, :html => {:multipart => true, :id => 'new_form'} do |f| %>
|
||||
<input type="hidden" name="quote[quote]" id="quote_quote">
|
||||
<%= form_for('new_form', :url => {:controller => 'blog_comments',:action => 'reply', :id => reply.id, :blog_id => reply.blog.id, :user_id => User.current.id}, :method => "post", :html => {:multipart => true}) do |f| %>
|
||||
|
||||
<%#= form_for @blog_comment, :as => :reply, :url => {:controller => 'blog_comments',:action => 'reply', :id => @blogComment.id}, :html => {:multipart => true, :id => 'new_form'} do |f| %>
|
||||
<input type="hidden" name="quote[quote]" value="" id="quote_quote">
|
||||
<% if course_id%>
|
||||
<input type="hidden" name="course_id" id="" value="<%= course_id%>">
|
||||
<% end %>
|
||||
<input type="hidden" name="blog_comment[title]" id="reply_subject">
|
||||
<%= hidden_field_tag 'parent_id', params[:parent_id], :value => reply.id %>
|
||||
<%= hidden_field_tag 'reply_id', params[:reply_id], :value => reply.author_id %>
|
||||
<div nhname='toolbar_container_<%= reply.id%>'></div>
|
||||
<textarea placeholder="有问题或有建议,请直接给我留言吧!" style="display: none" nhname='new_message_textarea_<%= reply.id%>' name="blog_comment[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>
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
<% if @in_user_homepage %>
|
||||
<% homepage = BlogComment.find(User.current.blog.homepage_id) %>
|
||||
$("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'blogs/homepage', :locals => {:activity => @blog_comment, :user_activity_id => homepage.id}) %>");
|
||||
<% else%>
|
||||
$("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/user_blog', :locals => {:activity => @blog_comment,:user_activity_id =>@user_activity_id}) %>");
|
||||
<% end %>
|
||||
sd_create_editor_from_data(<%= @user_activity_id%>,"","100%", 'UserActivity');
|
|
@ -1,8 +1,6 @@
|
|||
if($("#reply_message_<%= @blogComment.id%>").length > 0) {
|
||||
$("#reply_message_<%= @blogComment.id%>").replaceWith("<%= escape_javascript(render :partial => 'blog_comments/simple_ke_reply_form', :locals => {:reply => @blogComment,:temp =>@temp,:subject =>@subject,:course_id=>@course_id}) %>");
|
||||
$("#reply_message_<%= @blogComment.id%>").replaceWith("<%= escape_javascript(render :partial => 'blog_comments/simple_ke_reply_form', :locals => {:reply => @blogComment,:temp =>@temp,:course_id=>@course_id}) %>");
|
||||
$(function(){
|
||||
$('#reply_subject').val("<%= raw escape_javascript(@subject) %>");
|
||||
$('#quote_quote').val("<%= raw escape_javascript(@temp.content.html_safe) %>");
|
||||
sd_create_editor_from_data(<%= @blogComment.id%>,null,"100%", "<%=@blogComment.class.to_s%>");
|
||||
});
|
||||
}else if($("#reply_to_message_<%= @blogComment.id%>").length >0) {
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
$("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/user_blog', :locals => {:activity => @article,:user_activity_id =>@user_activity_id}) %>");
|
||||
// init_activity_KindEditor_data(<%#= @user_activity_id%>,"","87%", 'UserActivity');
|
||||
<% else%>
|
||||
$("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'blogs/article', :locals => {:activity => @article,:user_activity_id =>@user_activity_id}) %>");
|
||||
$("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/user_blog', :locals => {:activity => @article,:user_activity_id =>@user_activity_id}) %>");
|
||||
//init_activity_KindEditor_data(<%#= @user_activity_id%>,"","87%", 'UserActivity');
|
||||
<% end %>
|
||||
sd_create_editor_from_data(<%= @user_activity_id%>,"","100%", 'UserActivity');
|
|
@ -91,9 +91,7 @@
|
|||
</div>
|
||||
<div class="postDetailDate mb5"><%= format_time( @article.created_on)%></div>
|
||||
<div class="cl"></div>
|
||||
<!--<div class="homepagePostIntro memo-content upload_img break_word" id="message_description_<%= @article.id %>" style="word-break: break-all; word-wrap:break-word;margin-bottom: 0px !important;" >-->
|
||||
<!--<%#= @article.content.html_safe%>-->
|
||||
<!--</div>-->
|
||||
|
||||
<%=render :partial =>"users/intro_content", :locals=>{:user_activity_id =>@article.id, :content=>@article.content} %>
|
||||
<div class="cl"></div>
|
||||
<div class=" fl" style="width: 600px">
|
||||
|
@ -107,73 +105,84 @@
|
|||
<div class="cl"></div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<% count=0 %>
|
||||
<% if @article.parent %>
|
||||
<% count=@article.parent.children.count%>
|
||||
<% else %>
|
||||
<% count=@article.children.count%>
|
||||
<% end %>
|
||||
<% all_comments = []%>
|
||||
<% count=get_all_children(all_comments, @article).count %>
|
||||
<div class="homepagePostReply">
|
||||
<%# unless count == 0 %>
|
||||
<div class="homepagePostReplyBanner">
|
||||
<div class="homepagePostReplyBannerCount">回复
|
||||
<sapn class="mr15"><%= count>0 ? "(#{count})" : "" %></sapn><span style="color: #cecece;">▪</span>
|
||||
<span id="praise_count_<%=@article.id %>">
|
||||
<%=render :partial=> "praise_tread/praise", :locals => {:activity=>@article, :user_activity_id=>@article.id,:type=>"activity"}%>
|
||||
<div class="homepagePostReplyBanner">
|
||||
<div class="homepagePostReplyBannerCount">回复
|
||||
<sapn class="mr15"><%= count>0 ? "(#{count})" : "" %></sapn>
|
||||
<span style="color: #cecece;">▪</span>
|
||||
<span id="praise_count_<%= @article.id %>">
|
||||
<%= render :partial => "praise_tread/praise", :locals => {:activity => @article, :user_activity_id => @article.id, :type => "activity"} %>
|
||||
</span>
|
||||
</div>
|
||||
<div class="homepagePostReplyBannerTime"></div>
|
||||
</div>
|
||||
<div class="" id="reply_div_<%= @article.id %>">
|
||||
<%@article.children.reorder('created_on desc').each_with_index do |reply,i| %>
|
||||
</div>
|
||||
<div class="homepagePostReplyBannerTime"></div>
|
||||
</div>
|
||||
|
||||
<% all_comments = []%>
|
||||
<% comments = get_all_children(all_comments, @article) %>
|
||||
<% if count > 0 %>
|
||||
<div class="" id="reply_div_<%= @article.id %>">
|
||||
<% comments.each do |comment| %>
|
||||
<script type="text/javascript">
|
||||
$(function(){
|
||||
showNormalImage('reply_message_description_<%= reply.id %>');
|
||||
autoUrl('reply_message_description_<%= reply.id %>');
|
||||
showNormalImage('reply_content_<%= comment.id %>');
|
||||
autoUrl('reply_content_<%= comment.id %>');
|
||||
});
|
||||
</script>
|
||||
<div class="homepagePostReplyContainer" 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.author), :width => 33,:height => 33), user_path(reply.author) %>
|
||||
<%= 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 reply.author.show_name, user_path(reply.author_id,:host=>Setting.host_user), :class => "newsBlue mr10 f14" %>
|
||||
<%= 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>
|
||||
<div class="homepagePostReplyContent upload_img break_word" id="reply_message_description_<%= reply.id %>">
|
||||
<%= reply.content.html_safe%>
|
||||
</div>
|
||||
<div style="margin-top: -7px; margin-bottom: 5px">
|
||||
<%= format_time(reply.created_on) %>
|
||||
<span id="reply_praise_count_<%=reply.id %>">
|
||||
<%=render :partial=> "praise_tread/praise", :locals => {:activity=>reply, :user_activity_id=>reply.id,:type=>"reply"}%>
|
||||
<% if !comment.parent.nil? && !comment.parent.parent.nil? %>
|
||||
<%= render :partial => 'users/message_contents', :locals => {:comment => comment}%>
|
||||
<% end %>
|
||||
<% 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>
|
||||
<div class="fr mr10" id="reply_edit_menu_<%= reply.id%>" style="display: none">
|
||||
<span style="position: relative" class="fr mr20">
|
||||
<%= link_to(
|
||||
l(:button_reply),
|
||||
{:controller => 'blog_comments',:action => 'quote',:user_id=>reply.author_id,:blog_id=>reply.blog_id, :id => reply.id},
|
||||
{:controller => 'blog_comments', :action => 'quote', :user_id => comment.author_id, :blog_id => comment.blog_id, :id => comment.id},
|
||||
:remote => true,
|
||||
:method => 'get',
|
||||
:class => 'fr newsBlue',
|
||||
:title => l(:button_reply)) if !@article.locked? && User.current.logged? %>
|
||||
:title => l(:button_reply)) if !@article.locked? %>
|
||||
<span id="reply_iconup_<%=comment.id %>" class="reply_iconup02" style="display: none"> ︿</span>
|
||||
</span>
|
||||
<% if comment.author == User.current %>
|
||||
<%= link_to(
|
||||
l(:button_delete),
|
||||
{:controller => 'blog_comments',:action => 'destroy', :id => reply.id},
|
||||
{:controller => 'blog_comments', :action => 'destroy', :id => comment.id},
|
||||
:method => :delete,
|
||||
:class => 'fr newsGrey mr10',
|
||||
:class => 'fr mr20',
|
||||
:data => {:confirm => l(:text_are_you_sure)},
|
||||
:title => l(:button_delete)
|
||||
) if reply.author.id == User.current.id %>
|
||||
</div>
|
||||
</div>
|
||||
<p id="reply_message_<%= reply.id%>"></p>
|
||||
) %>
|
||||
<% end %>
|
||||
</span>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
</div>
|
||||
<p id="reply_message_<%= comment.id%>"></p>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<% end %>
|
||||
</li><% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<%# end %>
|
||||
<div class="cl"></div>
|
||||
<% if !@article.locked? && User.current.logged?%>
|
||||
<div class="talkWrapMsg" nhname="about_talk_reply">
|
||||
|
|
|
@ -48,14 +48,16 @@
|
|||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<% count=activity.children.count %>
|
||||
<% all_comments = []%>
|
||||
<% count=get_all_children(all_comments, activity).count %>
|
||||
<div class="homepagePostReply">
|
||||
<%= render :partial => 'users/reply_banner', :locals => {:count => count, :activity => activity, :user_activity_id => user_activity_id} %>
|
||||
<%= render :partial => 'users/blog_comment_reply_banner', :locals => {:count => count, :activity => activity, :user_activity_id => user_activity_id, :homepage => 1} %>
|
||||
|
||||
<% comments = activity.children.reorder("created_on desc").limit(3) %>
|
||||
<% 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/all_replies', :locals => {:comments => comments}%>
|
||||
<%= render :partial => 'users/blog_comments_replies', :locals => {:comments => comments, :user_activity_id => user_activity_id, :type => 'BlogComment', :activity_id =>activity.id, :homepage => 1}%>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
<%= render :partial => 'form_project',
|
||||
:locals => {:f => f, :replying => !topic.parent.nil?, :topic => topic} %>
|
||||
<div class="ml55 fl" nhname="toolbar_container"></div>
|
||||
<a href="javascript:void(0)" nhname='cancelbtn' class="blue_btn grey_btn fr c_white ml10"><%= l(:button_cancel) %></a>
|
||||
<a href="javascript:void(0)" nhname='cancelbtn' class="grey_btn fr c_white ml10"><%= l(:button_cancel) %></a>
|
||||
<a href="javascript:void(0)" nhname='submitbtn' class="blue_btn fr c_white" ><%= l(:button_submit)%></a>
|
||||
<%#= link_to l(:button_cancel), board_message_url(topic.board, topic.root, :r => (topic.parent_id && topic.id)), :class => "blue_btn grey_btn fl c_white" %>
|
||||
</ul>
|
||||
|
@ -33,7 +33,7 @@
|
|||
<%= render :partial => 'form_course',
|
||||
:locals => {:f => f, :replying => !topic.parent.nil?, :topic => topic} %>
|
||||
<div class="ml55 fl" nhname="toolbar_container"></div>
|
||||
<a href="javascript:void(0)" nhname='cancelbtn' class="blue_btn grey_btn fr c_white ml10"><%= l(:button_cancel) %></a>
|
||||
<a href="javascript:void(0)" nhname='cancelbtn' class="grey_btn fr c_white ml10"><%= l(:button_cancel) %></a>
|
||||
<a href="javascript:void(0)" nhname='submitbtn' class="blue_btn fr c_white"><%= l(:button_submit)%></a>
|
||||
|
||||
<% end %>
|
||||
|
|
|
@ -53,8 +53,8 @@
|
|||
</li>
|
||||
<li class="ml45 mb10">
|
||||
<label><span class="c_red">*</span> <%= l(:label_tags_syllabus_name)%> :</label>
|
||||
<%= select_tag :syllabus_id,options_for_select(syllabus_option,@course.syllabus_id), {:id=>"new_syllabus_id", :class=>"syllabus_input"} %>
|
||||
<span class="c_red" id="new_syllabus_notice" style="display: none;">请选择课程大纲</span>
|
||||
<%= 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>
|
||||
</li>
|
||||
<li class="ml45">
|
||||
<label><span class="c_red">*</span> <%= l(:label_tags_course_name)%> :</label>
|
||||
|
|
|
@ -35,8 +35,8 @@
|
|||
<div nhname='toolbar_container_' ></div>
|
||||
<textarea placeholder="有问题或有建议,请直接给我留言吧!" nhname='new_message_textarea_' name="new_form[course_message]"></textarea>
|
||||
<p nhname='contentmsg_'></p>
|
||||
<a id="new_message_cancel_btn_" href="javascript:void(0)" class="grey_btn fr mt10">取消</a>
|
||||
<a href="javascript:void(0);" class="blue_btn fr ml10 mt10" id="new_message_submit_btn_" >留言</a>
|
||||
<a id="new_message_cancel_btn_" href="javascript:void(0)" class="grey_btn fr mt10 ml10 mb10">取消</a>
|
||||
<a href="javascript:void(0);" class="blue_btn fr mt10" id="new_message_submit_btn_" >留言</a>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
|
|
@ -10,12 +10,12 @@
|
|||
<% elsif @state == 1 %>
|
||||
alert("密码错误");
|
||||
<% elsif @state == 2 %>
|
||||
alert("课程已过期\n请联系课程管理员重启课程。(在配置课程处)");
|
||||
alert("班级已过期\n请联系班级管理员重启班级。(在配置班级处)");
|
||||
<% elsif @state == 3 %>
|
||||
alert("您已经加入了课程");
|
||||
alert("您已经加入了班级");
|
||||
window.location.href= "http://"+"<%= Setting.host_name%>"+"/courses/" + "<%= course.id%>"
|
||||
<% elsif @state == 4 %>
|
||||
alert("您加入的课程不存在");
|
||||
alert("您加入的班级不存在");
|
||||
<% elsif @state == 5 %>
|
||||
alert("您还未登录");
|
||||
<% elsif @state == 6 %>
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
<span><%=@syllabus.title %></span>
|
||||
<input style="display: none;" name="syllabus_id" value="<%=@syllabus.id %>" />
|
||||
<% end %>
|
||||
<span class="c_red" id="new_syllabus_notice" style="display: none;">如果列表中没有对应的课程,请您先<%=link_to '创建课程', new_syllabus_path(),:target => '_blank', :class => 'ml5 green_btn_share c_white'%></span>
|
||||
<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">
|
||||
|
@ -75,7 +75,7 @@
|
|||
</li>
|
||||
<li class=" ml90" >
|
||||
<a href="javascript:void(0)" class="blue_btn fl c_white" onclick="submit_new_course();" >提交</a>
|
||||
<%= link_to "取消",user_activities_path(User.current.id),:class => "blue_btn grey_btn fl c_white"%>
|
||||
<%= link_to "取消",user_activities_path(User.current.id),:class => "grey_btn fl c_white ml10"%>
|
||||
<div class="cl"></div>
|
||||
</li>
|
||||
<% end%>
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
<li class="ml45 mb10">
|
||||
<label><span class="c_red">*</span> <%= l(:label_tags_syllabus_name)%> :</label>
|
||||
<%= select_tag :syllabus_id,options_for_select(course_syllabus_option,@course.syllabus_id), {:id=>"edit_syllabus_id", :class=>"syllabus_input", :style=>'width:280px'} %>
|
||||
<span class="c_red" id="edit_syllabus_notice" style="display: none;">如果列表中没有对应的课程,请您先<%=link_to '创建课程', new_syllabus_path(),:target => '_blank', :class => 'ml5 green_btn_share c_white'%></span>
|
||||
<span class="c_red" id="edit_syllabus_notice">如果列表中没有对应的课程,请您先<%=link_to '创建课程', new_syllabus_path(),:target => '_blank', :class => 'ml5 green_btn_share c_white'%></span>
|
||||
</li>
|
||||
<li class="ml45">
|
||||
<label><span class="c_red">*</span> <%= l(:label_tags_course_name)%> :</label>
|
||||
|
@ -92,7 +92,7 @@
|
|||
</li>
|
||||
<li class=" ml90" >
|
||||
<a href="javascript:void(0)" class="blue_btn fl c_white" onclick="submit_edit_course(<%= @course.id%>);" >提交</a>
|
||||
<%= link_to l(:button_cancel), course_path(@course), :class => "blue_btn grey_btn fl c_white" %>
|
||||
<%= link_to l(:button_cancel), course_path(@course), :class => "grey_btn fl c_white ml10" %>
|
||||
<div class="cl"></div>
|
||||
</li>
|
||||
<% end %>
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
<!--</div>-->
|
||||
<!--</div>-->
|
||||
<%= stylesheet_link_tag 'org' %>
|
||||
<%= stylesheet_link_tag 'css/org' %>
|
||||
|
||||
<div>
|
||||
<div class="relateOrg fl">
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
<%= get_acts_list_type @type %></div>
|
||||
<ul class="resourcesSelect">
|
||||
<li class="resourcesSelected"><a href="javascript:void(0);" class="resourcesIcon"></a>
|
||||
<ul class="homepagePostType">
|
||||
<ul class="homepagePostType" style="width:90px; left:-80px;">
|
||||
<li>
|
||||
<ul class="homepagePostTypeHomework fl">
|
||||
<li><%= link_to "全部动态", {:controller => "courses", :action => "show", :type => nil}, :class =>"homepagePostTypeAll postTypeGrey"%></li>
|
||||
|
|
|
@ -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>: </label>
|
||||
<label name='select_items' class='w60'>选项<%=convert_to_char (index+1).to_s %><span class="ur_index"></span>: </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>
|
||||
|
|
|
@ -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>: </label>
|
||||
<label name='select_items' class='w60'>选项A<span class="ur_index"></span>: </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>: </label>
|
||||
<label name='select_items' class='w60'>选项B<span class="ur_index"></span>: </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>: </label>
|
||||
<label name='select_items' class='w60'>选项C<span class="ur_index"></span>: </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>: </label>
|
||||
<label name='select_items' class='w60'>选项D<span class="ur_index"></span>: </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>
|
||||
|
|
|
@ -55,28 +55,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>: </label>'+
|
||||
'<label name="select_items" class="w60">选项A<span class="ur_index"></span>: </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>: </label>'+
|
||||
'<label name="select_items" class="w60">选项B<span class="ur_index"></span>: </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>: </label>'+
|
||||
'<label name="select_items" class="w60">选项C<span class="ur_index"></span>: </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>: </label>'+
|
||||
'<label name="select_items" class="w60">选项D<span class="ur_index"></span>: </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>'+
|
||||
|
|
|
@ -93,6 +93,6 @@
|
|||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
|
@ -14,7 +14,7 @@
|
|||
id: "relation_file_form" do %>
|
||||
<%= hidden_field_tag(:file_id, file.id) %>
|
||||
<%= content_tag('div', courses_check_box_tags('courses[course][]', User.current.courses,course,file), :id => 'courses')%>
|
||||
<a id="submit_quote" href="javascript:void(0)" class="blue_btn fl c_white" onclick="submit_quote();">引 用</a><a href="javascript:void(0)" class="blue_btn grey_btn fl c_white" onclick="closeModal();">取 消</a>
|
||||
<a id="submit_quote" href="javascript:void(0)" class="blue_btn fl c_white" onclick="submit_quote();">引 用</a><a href="javascript:void(0)" class="grey_btn fl c_white ml10" onclick="closeModal();">取 消</a>
|
||||
<% end -%>
|
||||
</div>
|
||||
<% end %>
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
id: "relation_file_form" do %>
|
||||
<%= hidden_field_tag(:file_id, file.id) %>
|
||||
<%= content_tag('div', org_subfields_check_box_tags('org_subfields[org_subfield][]',org_subfield.organization.org_subfields.where("field_type='Resource'"),file), :id => 'org_subfields')%>
|
||||
<a id="submit_quote" href="javascript:void(0)" class="blue_btn fl c_white" onclick="submit_quote();">引 用</a><a href="javascript:void(0)" class="blue_btn grey_btn fl c_white" onclick="closeModal();">取 消</a>
|
||||
<a id="submit_quote" href="javascript:void(0)" class="blue_btn fl c_white" onclick="submit_quote();">引 用</a><a href="javascript:void(0)" class="grey_btn fl c_white ml10" onclick="closeModal();">取 消</a>
|
||||
<% end -%>
|
||||
</div>
|
||||
<% end %>
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
id: "relation_file_form" do %>
|
||||
<%= hidden_field_tag(:file_id, file.id) %>
|
||||
<%= content_tag('div', projects_check_box_tags('projects[project][]', User.current.projects,project,file), :id => 'projects', :class => "hidden")%>
|
||||
<a id="submit_quote" href="javascript:void(0)" class="blue_btn fl c_white" onclick="submit_quote();">引 用</a><a href="javascript:void(0)" class="blue_btn grey_btn fl c_white" onclick="closeModal();">取 消</a>
|
||||
<a id="submit_quote" href="javascript:void(0)" class="blue_btn fl c_white" onclick="submit_quote();">引 用</a><a href="javascript:void(0)" class="grey_btn fl c_white ml10" onclick="closeModal();">取 消</a>
|
||||
<% end -%>
|
||||
</div>
|
||||
<% end %>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<%= stylesheet_link_tag 'courses'%>
|
||||
<%= stylesheet_link_tag 'css/courses'%>
|
||||
<script>
|
||||
function searchone4reload(fileid){
|
||||
var url = "<%= searchone4reload_org_subfield_files_path(@org_subfield)%>";
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
<!--<input type="hidden" name="org_subfield_attachment_type" value="<%#= org_subfield_attachment_type%>">-->
|
||||
<%= render :partial => 'files/org_upload_attachment_list', :locals => {:container => org}%>
|
||||
<div class="cl"></div>
|
||||
<a href="javascript:void(0);" class=" fr grey_btn mr40" onclick="hideModal();"><%= l(:button_cancel)%></a>
|
||||
<a href="javascript:void(0);" class="fr grey_btn mr40 ml10" onclick="hideModal();"><%= l(:button_cancel)%></a>
|
||||
<a id="submit_org_resource" href="javascript:void(0);" class="blue_btn fr" onclick="submit_resource();"><%= l(:button_confirm)%></a>
|
||||
<% end %>
|
||||
</div>
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
<!--<input type="hidden" name="org_subfield_attachment_type" value="<%#= org_subfield_attachment_type%>">-->
|
||||
<%= render :partial => 'files/org_upload_attachment_list_banner', :locals => {:container => org}%>
|
||||
<div class="cl"></div>
|
||||
<a href="javascript:void(0);" class=" fr grey_btn mr40" onclick="hideModal();"><%= l(:button_cancel)%></a>
|
||||
<a href="javascript:void(0);" class="fr grey_btn mr40 ml10" onclick="hideModal();"><%= l(:button_cancel)%></a>
|
||||
<a id="submit_org_resource" href="javascript:void(0);" class="blue_btn fr" onclick="submit_resource();"><%= l(:button_confirm)%></a>
|
||||
<% end %>
|
||||
</div>
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
<div class="cl"></div>
|
||||
</div>
|
||||
|
||||
<a href="javascript:void(0);" class=" fr grey_btn mr40" onclick="hideModal();"><%= l(:button_cancel)%></a>
|
||||
<a href="javascript:void(0);" class="fr grey_btn mr40 f14 ml10" onclick="hideModal();"><%= l(:button_cancel)%></a>
|
||||
<!--<a id="submit_resource" href="javascript:void(0);" class="blue_btn fr" onclick="submit_resource();"><%#= l(:button_confirm)%></a>-->
|
||||
<%= submit_tag '确定',:onclick=>'submit_resource();', :onfocus=>'this.blur()', :id=>'submit_resource', :class=>'sendSourceText fr' %>
|
||||
<% end %>
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
<input type="hidden" name="course_attachment_type" value="<%= course_attachment_type%>">
|
||||
<%= render :partial => 'attachement_list',:locals => {:course => course} %>
|
||||
<div class="cl"></div>
|
||||
<a href="javascript:void(0);" class=" fr grey_btn mr40" onclick="closeModal();"><%= l(:button_cancel)%></a>
|
||||
<a href="javascript:void(0);" class="fr grey_btn mr40 f14 fl" onclick="closeModal();"><%= l(:button_cancel)%></a>
|
||||
<!--<a id="submit_resource" href="javascript:void(0);" class="blue_btn fr" onclick="submit_resource();"><%#= l(:button_confirm)%></a>-->
|
||||
<%= submit_tag '确定',:onclick=>'submit_resource();',:onfocus=>'this.blur()',:id=>'submit_resource',:class=>'sendSourceText fr' %>
|
||||
<% end %>
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
<input type="hidden" name="course_attachment_type" value="<%= project_attachment_type %>">
|
||||
<%= render :partial => 'attachement_list',:locals => {:project => project} %>
|
||||
<div class="cl"></div>
|
||||
<a href="javascript:void(0);" class=" fr grey_btn mr40" onclick="closeModal();"><%= l(:button_cancel)%></a>
|
||||
<a href="javascript:void(0);" class="fr grey_btn mr40 f14 ml10" onclick="closeModal();"><%= l(:button_cancel)%></a>
|
||||
<!--<a id="submit_resource" href="javascript:void(0);" class="blue_btn fr" onclick="submit_resource();"><%#= l(:button_confirm)%></a>-->
|
||||
<%= submit_tag '确定',:onclick=>'submit_resource();',:onfocus=>'this.blur()',:id=>'submit_resource',:class=>'sendSourceText fr' %>
|
||||
<% end %>
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<a href="javascript:void(0);" class=" fr grey_btn mr40" onclick="hideModal();"><%= l(:button_cancel)%></a>
|
||||
<a href="javascript:void(0);" class="fr grey_btn mr40 ml10" onclick="hideModal();"><%= l(:button_cancel)%></a>
|
||||
<a id="submit_resource" href="javascript:void(0);" class="blue_btn fr" onclick="submit_resource();"><%= l(:button_confirm)%></a>
|
||||
<% end %>
|
||||
</div>
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
<div class="postDetailReply fr">
|
||||
<a href="<%= forum_memo_path(topic.forum, topic)%>" class="postReplyIcon mr5" target="_blank"></a>
|
||||
<%= link_to (topic.replies_count), forum_memo_path(topic.forum, topic),:target =>'_blank',:class=>'linkGrey2' %>
|
||||
<a href="javascript:void(0);" class="linkGrey2 disablePostLikeIcon ml10 mt20" style="cursor: default" title="点赞人数" > <%= get_praise_num(topic)%></a>
|
||||
<a href="javascript:void(0);" class="linkGrey2 disablePostLikeIcon ml10" style="cursor: default" title="点赞人数" > <%= get_praise_num(topic)%></a>
|
||||
</div>
|
||||
|
||||
<div class="postDetailDes" id = "postDetailDes_<%= topic.id %>"><%= topic.content.html_safe%>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<%= javascript_include_tag 'new_user' %>
|
||||
<%= stylesheet_link_tag 'public'%>
|
||||
<%= stylesheet_link_tag 'css/common','css/public'%>
|
||||
<script>
|
||||
function add_class(id){
|
||||
if($("#"+id).hasClass("sortArrowActiveD")){
|
||||
|
|
|
@ -4,15 +4,15 @@
|
|||
<ul class="fl">
|
||||
<li>
|
||||
<label class="label"><span class="c_red f12">*</span><%= l(:field_status) %>:</label>
|
||||
<% if @issue.safe_attribute?('status_id') && @allowed_statuses.present? %>
|
||||
<%# if @issue.safe_attribute?('status_id') && @allowed_statuses.present? %>
|
||||
<%= f.select :status_id, (@allowed_statuses.collect { |p| [p.name, p.id] }),
|
||||
{:no_label => true},
|
||||
# ajax 刷新
|
||||
#:onchange => "updateIssueFrom('#{escape_javascript project_issue_form_path(@project, :id => @issue, :format => 'js')}')",
|
||||
:class => "w150" %>
|
||||
<% else %>
|
||||
<%= h(@issue.status.name) %>
|
||||
<% end %>
|
||||
<%# else %>
|
||||
<%#= h(@issue.status.name) %>
|
||||
<%# end %>
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
<li>
|
||||
|
@ -46,7 +46,7 @@
|
|||
:method => 'get',
|
||||
:title => l(:label_version_new),
|
||||
:tabindex => 200) if User.current.allowed_to?(:manage_versions, @issue.project) %>
|
||||
<%= link_to "", new_project_version_path(@issue.project), :class => "pic_add mt5 ml5 ", :target => "_blank" %>
|
||||
<%= link_to "", new_project_version_path(@issue.project), :class => "pic_add mt5 ml5 fl", :target => "_blank" %>
|
||||
<!--<a href="javascript:viod(0)" class="pic_add mt5 ml5"></a>-->
|
||||
<% end %>
|
||||
</li>
|
||||
|
|
|
@ -58,13 +58,6 @@
|
|||
</ul>
|
||||
</div>
|
||||
<li>
|
||||
<%# if @copy_from && @copy_from.attachments.any? %>
|
||||
<!--<p>-->
|
||||
<!-- 去除附件复制功能 -->
|
||||
<!-- <label for="copy_attachments"><#%= l(:label_copy_attachments) %></label>
|
||||
<#%= check_box_tag 'copy_attachments', '1', @copy_attachments %> -->
|
||||
<!--</p>-->
|
||||
<%# end %>
|
||||
<% if @copy_from && !@copy_from.leaf? %>
|
||||
<p>
|
||||
<label for="copy_subtasks"><%= l(:label_copy_subtasks) %></label>
|
||||
|
@ -83,24 +76,7 @@
|
|||
<%= render :partial => 'issues/attributes' %>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<!--<div class="newpro_box02 ">-->
|
||||
<!--<label class="label"> <%#= l(:label_issue_watchers) %>:</label>-->
|
||||
<!--<input id="" name="" size="22" class="fl mb10 h26" type="text" placeholder="搜索添加跟踪者">-->
|
||||
<!--<span class="search_for_watchers">-->
|
||||
<%#= link_to "",
|
||||
# {:controller => 'watchers', :action => 'new', :project_id => @issue.project},
|
||||
# :remote => true,
|
||||
# :method => 'get',
|
||||
:class => "pic_sch mt5 ml5" %>
|
||||
<!--</span>-->
|
||||
<%#= javascript_tag "observeSearchfield('user_search', 'users_for_watcher', '#{ escape_javascript watchers_autocomplete_for_user_path(:user => @available_watchers, :format => 'js', :flag => 'ture') }')" %>
|
||||
<!--<div class="cl"></div>-->
|
||||
<!--<span id="watchers_inputs">-->
|
||||
<!--<%#= watchers_checkboxes(@issue, @available_watchers) %>-->
|
||||
<!--</span>-->
|
||||
<!--<div class="cl"></div>-->
|
||||
<!--</div>-->
|
||||
<%= call_hook(:view_issues_form_details_bottom, {:issue => @issue, :form => f}) %>
|
||||
<% end %>
|
||||
<a href="javascript:void(0);" onclick="issue_desc_editor.sync();$('#issue-form').submit();" class="blue_btn fl ml80"> 确定</a>
|
||||
<a href="javascript:void(0);" onclick="issueDetailShow();" class="grey_btn fl mr50" > 取消 </a>
|
||||
<a href="javascript:void(0);" onclick="issueDetailShow();" class="grey_btn fl mr50 ml10" > 取消 </a>
|
||||
|
|
|
@ -42,7 +42,6 @@
|
|||
l(:button_delete),
|
||||
{:controller => 'issues',:action => 'delete_journal', :id => issue.id,:journal_id=>reply.id},
|
||||
:method => :get,
|
||||
:remote=>true,
|
||||
:class => 'fr newsGrey mr10',
|
||||
:data => {:confirm => l(:text_are_you_sure)},
|
||||
:title => l(:button_delete)
|
||||
|
@ -73,9 +72,9 @@
|
|||
<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 => @issue} %>
|
||||
<%= render :partial => 'attachments/issue_reply', :locals => {:container => @jour.nil? ? @issue : @jour} %>
|
||||
</div>
|
||||
<span nhname='contentmsg_<%= @issue.id %>' class="fl"></span>
|
||||
<span nhname='contentmsg_<%= @issue.id %>' class="fl mt8"></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 %>
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<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", :remote => true) do |f|%>
|
||||
<%= 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=""/>
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
<% if @issue_id %> //issue详情中回复
|
||||
$("#reply_div_<%= @issue_id %>").html("<%= escape_javascript(render :partial => 'issues/issue_replies', :locals => {:issue => Issue.find( @issue_id),:replies_all_i=>0}) %>");
|
||||
$("#div_issue_attachment_<%=@issue.id %>").html("<%= escape_javascript(render :partial => 'issues/issue_attachments', :locals => {:issue => Issue.find( @issue_id)}) %>");
|
||||
$("#issue_edit").replaceWith('<%= escape_javascript(render :partial => 'issues/edit') %>')
|
||||
sd_create_editor_from_data(<%= @issue.id%>, null, "100%", "<%=@issue.class.name%>");
|
||||
$("#issue_detail_show").html('<%= escape_javascript(render :partial => 'issues/detail') %>')
|
||||
$("#issue_edit_show").html('<%= escape_javascript(render :partial => 'issues/edit') %>')
|
||||
sd_create_editor_from_data(<%= @issue.id %>, null, "100%", "<%= @issue.class.name %>");
|
||||
issue_desc_editor = KindEditor.create('#issue_description',
|
||||
{"width":"85%",
|
||||
"resizeType":0,
|
||||
|
|
|
@ -57,7 +57,7 @@
|
|||
<div class="problem_search fr" >
|
||||
<input class="problem_search_input fl" id="v_subject" type="text" name="subject" placeholder="请输入问题名称" onkeypress="EnterPress(event)" onkeydown="EnterPress()">
|
||||
<a href="javascript:void(0)" class="problem_search_btn fl" onclick="remote_function();" >搜索</a>
|
||||
<a href="javascript:void(0)" class="grey_btn fl ml10" onclick="nh_reset_form();" >清空</a>
|
||||
<a href="javascript:void(0)" class="grey_btn fl ml10 f14" onclick="nh_reset_form();" >清空</a>
|
||||
</div><!--problem_search end-->
|
||||
<%#= link_to '新建问题', new_project_issue_path(@project) , :class => "green_u_btn fr ml10" %>
|
||||
<p class="problem_p fl" ><%= l(:label_issues_sum) %>:<a href="javascript:void(0)" class="c_red"><%= @project.project_score.issue_num %></a>
|
||||
|
@ -96,13 +96,13 @@
|
|||
<div class="fl"> </div>
|
||||
<div>
|
||||
<input name="issue_create_date_start" nhname="date_val" type="hidden"/>
|
||||
<%= text_field_tag 'issue_create_date_start_show', '创建日期起始',:readonly=>true, :size=>15, :nhname=>'date_show',:style=>'float:left;'%>
|
||||
<%= text_field_tag 'issue_create_date_start_show', '创建日期起始',:readonly=>true, :size=>13, :nhname=>'date_show',:style=>'float:left;'%>
|
||||
<%= calendar_for('issue_create_date_start_show') %>
|
||||
</div>
|
||||
<div style="float:left;"> - </div>
|
||||
<div>
|
||||
<input name="issue_create_date_end" nhname="date_val" type="hidden"/>
|
||||
<%= text_field_tag 'issue_create_date_end_show', '创建日期结束',:readonly=>true, :size=>15, :nhname=>'date_show',:style=>'float:left;'%>
|
||||
<%= text_field_tag 'issue_create_date_end_show', '创建日期结束',:readonly=>true, :size=>13, :nhname=>'date_show',:style=>'float:left;'%>
|
||||
<%= calendar_for('issue_create_date_end_show') %>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
}
|
||||
});
|
||||
</script>
|
||||
<div class="homepageRight mt0 ml10" >
|
||||
<div class="homepageRight mt0 ml10" id =issue_show_total"">
|
||||
<div class="homepageRightBanner">
|
||||
<div class="NewsBannerName">问题跟踪</div>
|
||||
</div>
|
||||
|
@ -23,8 +23,12 @@
|
|||
<div class="resources mt10" >
|
||||
<div class="pro_page_box">
|
||||
<div class="problem_main borderBottomNone">
|
||||
<div id="issue_detail_show">
|
||||
<%= render :partial => 'issues/detail'%>
|
||||
</div>
|
||||
<div id="issue_edit_show">
|
||||
<%= render :partial => 'issues/edit'%>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!--problem_main end-->
|
||||
|
|
|
@ -58,7 +58,7 @@
|
|||
<div class="navHomepageProfile" id="navHomepageProfile">
|
||||
<ul>
|
||||
<li class="homepageProfileMenuIcon" id="homepageProfileMenuIcon">
|
||||
<%= link_to "<div class='mt5 mb8' id='user_avatar'>#{image_tag(url_to_avatar(User.current),:width =>"40",:height => "40",:class => "portraitRadius",:alt=>"头像", :id => "nh_user_logo")}</div>".html_safe,user_activities_path(User.current.id)%>
|
||||
<%= link_to "<div class='mt5 mb8' id='user_avatar'>#{image_tag(url_to_avatar(User.current),:width =>"40",:height => "40",:class => "portraitRadius",:alt=>"头像",:style=>"display:block;", :id => "nh_user_logo")}</div>".html_safe,user_activities_path(User.current.id)%>
|
||||
<ul class="topnav_login_list none" id="topnav_login_list">
|
||||
<li>
|
||||
<%= link_to "修改资料", my_account_path, :class => "menuGrey"%>
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<ul class="shadowbox_news_list">
|
||||
<% messages.each do |ma| %>
|
||||
<% if ma.class == SystemMessage %>
|
||||
<li><a href="<%=user_system_messages_path(User.current) %>" target="_blank" title="Trustie平台 发布新消息:<%= ma.subject.blank? ? (ma.content.nil? ? ma.description.html_safe : ma.content.html_safe) : ma.subject%>"><span class="shadowbox_news_user">Trustie平台 </span>发布新消息:<%= ma.subject.blank? ? (ma.content.nil? ? ma.description.html_safe : ma.content.html_safe) : ma.subject%></a></li>
|
||||
<li><a href="<%=user_system_messages_path(User.current) %>" target="_blank" title="Trustie平台 发布新消息:<%= ma.subject.blank? ? (ma.content.nil? ? message_content(ma.description) : message_content(ma.content)) : ma.subject%>"><span class="shadowbox_news_user">Trustie平台 </span>发布新消息:<%= ma.subject.blank? ? (ma.content.nil? ? message_content(ma.description) : message_content(ma.content)) : ma.subject%></a></li>
|
||||
<% elsif ma.class == CourseMessage %>
|
||||
<% if ma.course_message_type == "News" %>
|
||||
<li><a href="<%=news_path(ma.course_message.id) %>" target="_blank" title="<%=ma.course_message.author.show_name %> 发布了通知:<%= ma.course_message.title%>"><span class="shadowbox_news_user"><%=ma.course_message.author.show_name %> </span>发布了通知:<%= ma.course_message.title%></a></li>
|
||||
|
@ -50,18 +50,18 @@
|
|||
<% elsif ma.course_message_type == "Poll" %>
|
||||
<li><a href="<%= poll_path(ma.course_message.id) %>" target="_blank" title="<%=ma.course_message.user.show_name %> 发布了问卷:<%= ma.course_message.polls_name.nil? ? "未命名问卷" : ma.course_message.polls_name %>"><span class="shadowbox_news_user"><%=ma.course_message.user.show_name %> </span>发布了问卷:<%= ma.course_message.polls_name.nil? ? "未命名问卷" : ma.course_message.polls_name%></a></li>
|
||||
<% elsif ma.course_message_type == "Message" %>
|
||||
<% content = ma.course_message.parent_id.nil? ? ma.course_message.subject : ma.course_message.content.html_safe %>
|
||||
<% content = ma.course_message.parent_id.nil? ? ma.course_message.subject : message_content(ma.course_message.content) %>
|
||||
<% href = board_message_path(ma.course_message.board_id, ma.course_message.parent_id ? ma.course_message.parent_id : ma.course_message.id) %>
|
||||
<li><a href="<%= href %>" target="_blank" title="<%=ma.course_message.author.show_name %> <%= ma.course_message.parent_id.nil? ? "发布了班级帖子:" : "评论了班级帖子:" %><%= content%>"><span class="shadowbox_news_user"><%=ma.course_message.author.show_name %> </span><%= ma.course_message.parent_id.nil? ? "发布了班级帖子:" : "评论了班级帖子:" %><%= content%></a></li>
|
||||
<% elsif ma.course_message_type == "StudentWorksScore" %>
|
||||
<li><a href="<%= student_work_index_path(:homework => ma.course_message.student_work.homework_common_id) %>" target="_blank" title="<%=ma.course_message.reviewer_role == 3 ? '匿名用户' : ma.course_message.user.show_name+"老师" %> <%= ma.status == 0 ? "评阅了您的作品:" : "重新评阅了您的作品:" %><%= ma.content.html_safe if !ma.content.nil?%>"><span class="shadowbox_news_user"><%=ma.course_message.reviewer_role == 3 ? '匿名用户' : ma.course_message.user.show_name+"老师" %> </span><%= ma.status == 0 ? "评阅了您的作品:" : "重新评阅了您的作品:" %><%= ma.content.html_safe if !ma.content.nil?%></a></li>
|
||||
<li><a href="<%= student_work_index_path(:homework => ma.course_message.student_work.homework_common_id) %>" target="_blank" title="<%=ma.course_message.reviewer_role == 3 ? '匿名用户' : ma.course_message.user.show_name+"老师" %> <%= ma.status == 0 ? "评阅了您的作品:" : "重新评阅了您的作品:" %><%= message_content(ma.content) if !ma.content.nil?%>"><span class="shadowbox_news_user"><%=ma.course_message.reviewer_role == 3 ? '匿名用户' : ma.course_message.user.show_name+"老师" %> </span><%= ma.status == 0 ? "评阅了您的作品:" : "重新评阅了您的作品:" %><%= message_content(ma.content) if !ma.content.nil?%></a></li>
|
||||
<% elsif ma.course_message_type == "JournalsForMessage" %>
|
||||
<% if ma.course_message.jour_type == 'Course' %>
|
||||
<li><a href="<%= course_feedback_path(ma.course_id) %>" target="_blank" title="<%=ma.course_message.user.show_name %> 在班级中留言了:<%= ma.course_message.notes.html_safe%>"><span class="shadowbox_news_user"><%=ma.course_message.user.show_name %> </span>在班级中留言了:<%= ma.course_message.notes.html_safe%></a></li>
|
||||
<li><a href="<%= course_feedback_path(ma.course_id) %>" target="_blank" title="<%=ma.course_message.user.show_name %> 在班级中留言了:<%= message_content(ma.course_message.notes)%>"><span class="shadowbox_news_user"><%=ma.course_message.user.show_name %> </span>在班级中留言了:<%= message_content(ma.course_message.notes)%></a></li>
|
||||
<% elsif ma.course_message.jour_type == 'HomeworkCommon' %>
|
||||
<li><a href="<%= homework_common_index_url_in_org(ma.course_id) %>" target="_blank" title="<%=ma.course_message.user.show_name %> <%=ma.course_message.m_parent_id.nil? ? '回复了您的作业:' : '在作业中回复了您:' %><%= ma.course_message.notes.html_safe%>"><span class="shadowbox_news_user"><%=ma.course_message.user.show_name %> </span><%=ma.course_message.m_parent_id.nil? ? '回复了您的作业:' : '在作业中回复了您:' %><%= ma.course_message.notes.html_safe%></a></li>
|
||||
<li><a href="<%= homework_common_index_url_in_org(ma.course_id) %>" target="_blank" title="<%=ma.course_message.user.show_name %> <%=ma.course_message.m_parent_id.nil? ? '回复了您的作业:' : '在作业中回复了您:' %><%= message_content(ma.course_message.notes)%>"><span class="shadowbox_news_user"><%=ma.course_message.user.show_name %> </span><%=ma.course_message.m_parent_id.nil? ? '回复了您的作业:' : '在作业中回复了您:' %><%= message_content(ma.course_message.notes)%></a></li>
|
||||
<% else %>
|
||||
<li><a href="<%= student_work_index_path(:homework => ma.course_message.jour.student_work.homework_common_id,:show_work_id => ma.course_message.jour.student_work_id) %>" target="_blank" title="<%=ma.course_message.user.show_name %><%=ma.course_message.user.allowed_to?(:as_teacher, ma.course) ? '老师' : '同学' %> 回复了作品评论:<%= ma.course_message.notes%>"><span class="shadowbox_news_user"><%=ma.course_message.user.show_name %><%=ma.course_message.user.allowed_to?(:as_teacher, ma.course) ? '老师' : '同学' %> </span>回复了作品评论:<%= ma.course_message.notes%></a></li>
|
||||
<li><a href="<%= student_work_index_path(:homework => ma.course_message.jour.student_work.homework_common_id,:show_work_id => ma.course_message.jour.student_work_id) %>" target="_blank" title="<%=ma.course_message.user.show_name %><%=ma.course_message.user.allowed_to?(:as_teacher, ma.course) ? '老师' : '同学' %> 回复了作品评论:<%= message_content(ma.course_message.notes)%>"><span class="shadowbox_news_user"><%=ma.course_message.user.show_name %><%=ma.course_message.user.allowed_to?(:as_teacher, ma.course) ? '老师' : '同学' %> </span>回复了作品评论:<%= message_content(ma.course_message.notes)%></a></li>
|
||||
<% end %>
|
||||
<% elsif ma.course_message_type == "StudentWork" && !ma.course_message.homework_common.nil? && !User.current.allowed_to?(:as_teacher, ma.course_message.homework_common.course) %>
|
||||
<li><a href="<%=student_work_index_path(:homework => ma.course_message.homework_common_id) %>" target="_blank" title="<%=ma.course_message.homework_common.user.show_name %>老师 发布的作业:<%=ma.course_message.homework_common.name %>,由于迟交作业,您及您的作品都不能参与该作业的匿评"><span class="shadowbox_news_user"><%=ma.course_message.homework_common.user.show_name %>老师 </span>发布的作业:<%=ma.course_message.homework_common.name %>,由于迟交作业,您及您的作品都不能参与该作业的匿评</a></li>
|
||||
|
@ -112,11 +112,11 @@
|
|||
<% end %>
|
||||
<% elsif ma.class == MemoMessage %>
|
||||
<% if ma.memo_type == "Memo" %>
|
||||
<li><a href="<%=forum_memo_path(ma.memo.forum_id, ma.memo.parent_id ? ma.memo.parent_id: ma.memo.id) %>" target="_blank" title="<%=ma.memo.author.show_name %> <%= ma.memo.parent_id.nil? ? "在贴吧发布帖子:" : "回复了贴吧帖子:" %><%= ma.memo.parent_id.nil? ? ma.memo.subject : ma.memo.content.html_safe%>"><span class="shadowbox_news_user"><%=ma.memo.author.show_name %> </span><%= ma.memo.parent_id.nil? ? "在贴吧发布帖子:" : "回复了贴吧帖子:" %><%= ma.memo.parent_id.nil? ? ma.memo.subject : ma.memo.content.html_safe%></a></li>
|
||||
<li><a href="<%=forum_memo_path(ma.memo.forum_id, ma.memo.parent_id ? ma.memo.parent_id: ma.memo.id) %>" target="_blank" title="<%=ma.memo.author.show_name %> <%= ma.memo.parent_id.nil? ? "在贴吧发布帖子:" : "回复了贴吧帖子:" %><%= ma.memo.parent_id.nil? ? ma.memo.subject : message_content(ma.memo.content)%>"><span class="shadowbox_news_user"><%=ma.memo.author.show_name %> </span><%= ma.memo.parent_id.nil? ? "在贴吧发布帖子:" : "回复了贴吧帖子:" %><%= ma.memo.parent_id.nil? ? ma.memo.subject : message_content(ma.memo.content)%></a></li>
|
||||
<% end %>
|
||||
<% elsif ma.class == UserFeedbackMessage %>
|
||||
<% if ma.journals_for_message_type == "JournalsForMessage" %>
|
||||
<li><a href="<%=feedback_path(ma.journals_for_message.jour_id) %>" target="_blank" title="<%=ma.journals_for_message.user.show_name %> <%= ma.journals_for_message.reply_id == 0 ? "给你留言了:" : "回复了你的留言:" %><%= ma.journals_for_message.notes.gsub("<p>","").gsub("</p>","").gsub("<br />","").html_safe%>"><span class="shadowbox_news_user"><%=ma.journals_for_message.user.show_name %> </span><%= ma.journals_for_message.reply_id == 0 ? "给你留言了:" : "回复了你的留言:" %><%= ma.journals_for_message.notes.gsub("<p>","").gsub("</p>","").gsub("<br />","").html_safe%></a></li>
|
||||
<li><a href="<%=feedback_path(ma.journals_for_message.jour_id) %>" target="_blank" title="<%=ma.journals_for_message.user.show_name %> <%= ma.journals_for_message.reply_id == 0 || ma.journals_for_message.reply_id.nil? ? "给你留言了:" : "回复了你的留言:" %><%= message_content(ma.journals_for_message.notes)%>"><span class="shadowbox_news_user"><%=ma.journals_for_message.user.show_name %> </span><%= ma.journals_for_message.reply_id == 0 || ma.journals_for_message.reply_id.nil? ? "给你留言了:" : "回复了你的留言:" %><%= message_content(ma.journals_for_message.notes)%></a></li>
|
||||
<% end %>
|
||||
<% elsif ma.class == OrgMessage %>
|
||||
<% if ma.message_type == 'ApplySubdomain' %>
|
||||
|
|
|
@ -3,6 +3,6 @@
|
|||
<% else%>
|
||||
<span class="fontGrey">课程英文名称</span>
|
||||
<% end %>
|
||||
<% if User.current == syllabus.user %>
|
||||
<% 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 %>
|
|
@ -8,14 +8,14 @@
|
|||
<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" onblur="edit_syllabus_title('<%= edit_syllabus_title_syllabus_path(@syllabus.id)%>');"><%= @syllabus.title %></textarea>
|
||||
<textarea class="syllabusTitleTextarea none" placeholder="请编辑课程名称" id="syllabus_title_edit"></textarea>
|
||||
</div>
|
||||
<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" onblur="edit_syllabus_eng_name('<%= edit_syllabus_eng_name_syllabus_path(@syllabus.id)%>');"><%= @syllabus.eng_name %></textarea>
|
||||
<textarea class="homepageSignatureTextarea none" placeholder="请编辑英文名称" id="syllabus_eng_name_edit"></textarea>
|
||||
</div>
|
||||
<!--
|
||||
<div class="pr_info_foot ">
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<span style="word-break: normal; word-wrap: break-word;"><%=@syllabus.title %></span>
|
||||
|
||||
<% if User.current == syllabus.user %>
|
||||
<%= 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();"%>
|
||||
<% 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 %>
|
|
@ -17,7 +17,7 @@
|
|||
<%= call_hook :view_layouts_base_html_head %>
|
||||
<!-- page specific tags -->
|
||||
<%= yield :header_tags -%>
|
||||
<%= stylesheet_link_tag 'base','header', :media => 'all'%>
|
||||
<%= stylesheet_link_tag 'css/common','css/structure','css/public', :media => 'all'%>
|
||||
<!-- MathJax的配置 -->
|
||||
<script type="text/javascript"
|
||||
src="/javascripts/MathJax/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
<%= javascript_heads %>
|
||||
<%= heads_for_theme %>
|
||||
<%= call_hook :view_layouts_base_html_head %>
|
||||
<%= stylesheet_link_tag 'header','jquery/jquery-ui-1.9.2','public', 'leftside','prettify', 'courses','share'%>
|
||||
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2','css/common','css/public', 'css/structure','prettify', 'css/courses','css/popup'%>
|
||||
<%= javascript_include_tag "course","header","attachments",'prettify' %>
|
||||
<!-- page specific tags -->
|
||||
<%= yield :header_tags -%>
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<meta name="keywords" content="issue,bug,tracker" />
|
||||
<%= csrf_meta_tag %>
|
||||
<%= favicon %>
|
||||
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2','application','prettify', 'nyan','leftside', :media => 'all' %>
|
||||
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2','application','prettify', 'nyan', :media => 'all' %>
|
||||
<%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %>
|
||||
<%= javascript_include_tag('jquery-1.8.3-ui-1.9.2-ujs-2.0.3', 'application', 'jquery.colorbox-min') %>
|
||||
|
||||
|
@ -18,7 +18,7 @@
|
|||
|
||||
<%= call_hook :view_layouts_base_html_head %>
|
||||
<%= yield :header_tags -%>
|
||||
<%= stylesheet_link_tag 'base','header','new_user', :media => 'all'%>
|
||||
<%= stylesheet_link_tag 'css/common','css/structure','css/public', :media => 'all'%>
|
||||
<!-- MathJax的配置 -->
|
||||
<script type="text/javascript"
|
||||
src="/javascripts/MathJax/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
<%= javascript_include_tag "ckeditor/ckeditor.js",'prettify' %>
|
||||
<!-- page specific tags -->
|
||||
<%= yield :header_tags -%>
|
||||
<%= stylesheet_link_tag 'base','header', :media => 'all'%>
|
||||
<%= stylesheet_link_tag 'css/common','css/structure','css/public', :media => 'all'%>
|
||||
<!-- MathJax的配置 -->
|
||||
<script type="text/javascript"
|
||||
src="/javascripts/MathJax/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
<%= favicon %>
|
||||
<%= javascript_heads %>
|
||||
<%= heads_for_theme %>
|
||||
<%= stylesheet_link_tag 'pleft','prettify','jquery/jquery-ui-1.9.2','header','new_user','repository','courses','org', 'share' %>
|
||||
<%= stylesheet_link_tag 'prettify','jquery/jquery-ui-1.9.2','css/common','css/structure','css/public','repository','css/courses','css/org','css/project', 'css/popup' %>
|
||||
<%= javascript_include_tag 'cookie','project', 'organization','header','prettify','select_list_move','org'%>
|
||||
<%= javascript_include_tag 'attachments' %>
|
||||
<%= call_hook :view_layouts_base_html_head %>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<!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">
|
||||
<%= stylesheet_link_tag 'pleft','prettify','jquery/jquery-ui-1.9.2','header','new_user','repository','org' %>
|
||||
<%= stylesheet_link_tag 'pleft','prettify','jquery/jquery-ui-1.9.2','css/structure','css/public','repository','org' %>
|
||||
<%= javascript_include_tag 'cookie','project', 'header','prettify','select_list_move','org'%>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
|
@ -104,10 +104,10 @@
|
|||
<div id="Footer">
|
||||
<div class="footerAboutContainer">
|
||||
<ul class="footerAbout">
|
||||
<li class="fl"><a href="javascript:void:(0);" class=" f_grey mw20" target="_blank">关于我们</a>|</li>
|
||||
<li class="fl"><a href="javascript:void:(0);" class=" f_grey mw20" target="_blank">服务协议</a>|</li>
|
||||
<li class="fl"><a href="javascript:void:(0);" class="f_grey mw20" target="_blank">帮助中心</a>|</li>
|
||||
<li class="fl"><a href="javascript:void:(0);" class=" f_grey mw20" target="_blank">贴吧交流</a></li>
|
||||
<li class="fl"><a href="javascript:void(0);" class=" f_grey mw20" target="_blank">关于我们</a>|</li>
|
||||
<li class="fl"><a href="javascript:void(0);" class=" f_grey mw20" target="_blank">服务协议</a>|</li>
|
||||
<li class="fl"><a href="javascript:void(0);" class="f_grey mw20" target="_blank">帮助中心</a>|</li>
|
||||
<li class="fl"><a href="javascript:void(0);" class=" f_grey mw20" target="_blank">贴吧交流</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
<%= favicon %>
|
||||
<%= javascript_heads %>
|
||||
<%= heads_for_theme %>
|
||||
<%= stylesheet_link_tag 'header','scm','public', 'pleft', 'project','prettify','jquery/jquery-ui-1.9.2','repository','share' %>
|
||||
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2','css/common','css/structure','scm','css/public', 'css/project','css/popup','prettify','repository' %>
|
||||
<%= javascript_include_tag 'cookie','project', 'header','prettify','select_list_move','attachments' %>
|
||||
|
||||
<%= call_hook :view_layouts_base_html_head %>
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<meta name="keywords" content="issue,bug,tracker" />
|
||||
<%= csrf_meta_tag %>
|
||||
<%= favicon %>
|
||||
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2', 'syllabus','new_user','prettify','share',:media => 'all' %>
|
||||
<%= 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'%>
|
||||
|
@ -75,8 +75,13 @@
|
|||
<% end%>
|
||||
<% end%>
|
||||
</div>
|
||||
<% 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").limit(5) %>
|
||||
<% all_count = User.current.courses.visible.where("is_delete =? and syllabus_id =?", 0, @syllabus.id).count%>
|
||||
<% 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>
|
||||
|
@ -116,15 +121,21 @@
|
|||
<span><%= l(:label_loading) %></span>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
$(function(){
|
||||
$(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();
|
||||
$("#courseMenu").mouseenter(function () {
|
||||
$("#topnav_course_menu").show();
|
||||
});
|
||||
$("#courseMenu").mouseleave(function () {
|
||||
$("#topnav_course_menu").hide();
|
||||
});
|
||||
});
|
||||
function leftCourseslistChange(){
|
||||
$('#homepageLeftMenuCourses').slideToggle();
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
<%= call_hook :view_layouts_base_html_head %>
|
||||
<!-- page specific tags -->
|
||||
<%= yield :header_tags -%>
|
||||
<%= stylesheet_link_tag 'base','header', :media => 'all'%>
|
||||
<%= stylesheet_link_tag 'css/common','css/structure','css/public', :media => 'all'%>
|
||||
<!-- MathJax的配置 -->
|
||||
<script type="text/javascript"
|
||||
src="/javascripts/MathJax/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
<meta name="keywords" content="issue,bug,tracker" />
|
||||
<%= csrf_meta_tag %>
|
||||
<%= favicon %>
|
||||
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2', 'public_new', 'leftside_new','prettify','users', :media => 'all' %>
|
||||
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2', 'css/common', 'css/structure','prettify','css/public', :media => 'all' %>
|
||||
<%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %>
|
||||
<%= javascript_heads %>
|
||||
<%= javascript_include_tag "avatars",'prettify'%>
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue