Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh
Conflicts: app/views/layouts/base_projects.html.erb app/views/users/show.html.erb config/locales/zh.yml
This commit is contained in:
commit
4b19463db7
|
@ -21,3 +21,4 @@
|
|||
.rbenv-gemsets
|
||||
.DS_Store
|
||||
public/api_doc/
|
||||
/.metadata
|
||||
|
|
3
Gemfile
3
Gemfile
|
@ -21,7 +21,8 @@ gem 'acts-as-taggable-on', '2.4.1'
|
|||
gem 'spreadsheet'
|
||||
gem 'ruby-ole'
|
||||
#gem 'email_verifier', path: 'lib/email_verifier'
|
||||
|
||||
gem 'rufus-scheduler'
|
||||
#gem 'dalli', path: 'lib/dalli-2.7.2'
|
||||
group :development do
|
||||
gem 'grape-swagger'
|
||||
gem 'grape-swagger-ui', git: 'https://github.com/guange2015/grape-swagger-ui.git'
|
||||
|
|
348
Gemfile.lock
348
Gemfile.lock
|
@ -1,348 +0,0 @@
|
|||
GIT
|
||||
remote: https://github.com/guange2015/grape-swagger-ui.git
|
||||
revision: 4c33439f236c174ae0e774b3435ef2547995c21d
|
||||
specs:
|
||||
grape-swagger-ui (0.0.4)
|
||||
railties (>= 3.1)
|
||||
|
||||
PATH
|
||||
remote: lib/better_errors
|
||||
specs:
|
||||
better_errors (1.1.0)
|
||||
coderay (>= 1.0.0)
|
||||
erubis (>= 2.6.6)
|
||||
|
||||
PATH
|
||||
remote: lib/rack-mini-profiler
|
||||
specs:
|
||||
rack-mini-profiler (0.9.1)
|
||||
rack (>= 1.1.3)
|
||||
|
||||
PATH
|
||||
remote: lib/seems_rateable
|
||||
specs:
|
||||
seems_rateable (1.0.13)
|
||||
jquery-rails
|
||||
rails
|
||||
|
||||
GEM
|
||||
remote: http://rubygems.org/
|
||||
remote: https://rubygems.org/
|
||||
specs:
|
||||
actionmailer (3.2.13)
|
||||
actionpack (= 3.2.13)
|
||||
mail (~> 2.5.3)
|
||||
actionpack (3.2.13)
|
||||
activemodel (= 3.2.13)
|
||||
activesupport (= 3.2.13)
|
||||
builder (~> 3.0.0)
|
||||
erubis (~> 2.7.0)
|
||||
journey (~> 1.0.4)
|
||||
rack (~> 1.4.5)
|
||||
rack-cache (~> 1.2)
|
||||
rack-test (~> 0.6.1)
|
||||
sprockets (~> 2.2.1)
|
||||
activemodel (3.2.13)
|
||||
activesupport (= 3.2.13)
|
||||
builder (~> 3.0.0)
|
||||
activerecord (3.2.13)
|
||||
activemodel (= 3.2.13)
|
||||
activesupport (= 3.2.13)
|
||||
arel (~> 3.0.2)
|
||||
tzinfo (~> 0.3.29)
|
||||
activeresource (3.2.13)
|
||||
activemodel (= 3.2.13)
|
||||
activesupport (= 3.2.13)
|
||||
activesupport (3.2.13)
|
||||
i18n (= 0.6.1)
|
||||
multi_json (~> 1.0)
|
||||
acts-as-taggable-on (2.4.1)
|
||||
rails (>= 3, < 5)
|
||||
arel (3.0.3)
|
||||
axiom-types (0.1.1)
|
||||
descendants_tracker (~> 0.0.4)
|
||||
ice_nine (~> 0.11.0)
|
||||
thread_safe (~> 0.3, >= 0.3.1)
|
||||
builder (3.0.0)
|
||||
capybara (2.4.1)
|
||||
mime-types (>= 1.16)
|
||||
nokogiri (>= 1.3.3)
|
||||
rack (>= 1.0.0)
|
||||
rack-test (>= 0.5.4)
|
||||
xpath (~> 2.0)
|
||||
celluloid (0.16.0)
|
||||
timers (~> 4.0.0)
|
||||
childprocess (0.5.3)
|
||||
ffi (~> 1.0, >= 1.0.11)
|
||||
climate_control (0.0.3)
|
||||
activesupport (>= 3.0)
|
||||
cocaine (0.5.4)
|
||||
climate_control (>= 0.0.3, < 1.0)
|
||||
coderay (1.0.9)
|
||||
coercible (1.0.0)
|
||||
descendants_tracker (~> 0.0.1)
|
||||
coffee-rails (3.2.2)
|
||||
coffee-script (>= 2.2.0)
|
||||
railties (~> 3.2.0)
|
||||
coffee-script (2.3.0)
|
||||
coffee-script-source
|
||||
execjs
|
||||
coffee-script-source (1.7.1)
|
||||
descendants_tracker (0.0.4)
|
||||
thread_safe (~> 0.3, >= 0.3.1)
|
||||
diff-lcs (1.2.5)
|
||||
equalizer (0.0.9)
|
||||
erubis (2.7.0)
|
||||
execjs (2.2.1)
|
||||
factory_girl (4.4.0)
|
||||
activesupport (>= 3.0.0)
|
||||
faker (1.4.3)
|
||||
i18n (~> 0.5)
|
||||
fastercsv (1.5.5)
|
||||
ffi (1.9.3)
|
||||
ffi (1.9.3-x86-mingw32)
|
||||
formatador (0.2.5)
|
||||
grape (0.9.0)
|
||||
activesupport
|
||||
builder
|
||||
hashie (>= 2.1.0)
|
||||
multi_json (>= 1.3.2)
|
||||
multi_xml (>= 0.5.2)
|
||||
rack (>= 1.3.0)
|
||||
rack-accept
|
||||
rack-mount
|
||||
virtus (>= 1.0.0)
|
||||
grape-entity (0.4.4)
|
||||
activesupport
|
||||
multi_json (>= 1.3.2)
|
||||
grape-swagger (0.8.0)
|
||||
grape
|
||||
grape-entity
|
||||
guard (2.11.1)
|
||||
formatador (>= 0.2.4)
|
||||
listen (~> 2.7)
|
||||
lumberjack (~> 1.0)
|
||||
nenv (~> 0.1)
|
||||
notiffany (~> 0.0)
|
||||
pry (>= 0.9.12)
|
||||
shellany (~> 0.0)
|
||||
thor (>= 0.18.1)
|
||||
guard-rspec (2.5.0)
|
||||
guard (>= 1.1)
|
||||
rspec (~> 2.11)
|
||||
hashie (3.3.1)
|
||||
hike (1.2.3)
|
||||
hitimes (1.2.2)
|
||||
hitimes (1.2.2-x86-mingw32)
|
||||
htmlentities (4.3.2)
|
||||
i18n (0.6.1)
|
||||
ice_nine (0.11.0)
|
||||
journey (1.0.4)
|
||||
jquery-rails (2.0.3)
|
||||
railties (>= 3.1.0, < 5.0)
|
||||
thor (~> 0.14)
|
||||
json (1.8.1)
|
||||
kaminari (0.16.1)
|
||||
actionpack (>= 3.0.0)
|
||||
activesupport (>= 3.0.0)
|
||||
libv8 (3.16.14.3)
|
||||
listen (2.8.5)
|
||||
celluloid (>= 0.15.2)
|
||||
rb-fsevent (>= 0.9.3)
|
||||
rb-inotify (>= 0.9)
|
||||
lumberjack (1.0.9)
|
||||
mail (2.5.4)
|
||||
mime-types (~> 1.16)
|
||||
treetop (~> 1.4.8)
|
||||
metaclass (0.0.4)
|
||||
method_source (0.8.2)
|
||||
mime-types (1.25.1)
|
||||
mini_portile (0.6.0)
|
||||
mocha (1.1.0)
|
||||
metaclass (~> 0.0.1)
|
||||
multi_json (1.10.1)
|
||||
multi_xml (0.5.5)
|
||||
mysql2 (0.3.11)
|
||||
mysql2 (0.3.11-x86-mingw32)
|
||||
nenv (0.2.0)
|
||||
net-ldap (0.3.1)
|
||||
nokogiri (1.6.3)
|
||||
mini_portile (= 0.6.0)
|
||||
nokogiri (1.6.3-x86-mingw32)
|
||||
mini_portile (= 0.6.0)
|
||||
notiffany (0.0.3)
|
||||
nenv (~> 0.1)
|
||||
shellany (~> 0.0)
|
||||
paperclip (3.5.4)
|
||||
activemodel (>= 3.0.0)
|
||||
activesupport (>= 3.0.0)
|
||||
cocaine (~> 0.5.3)
|
||||
mime-types
|
||||
polyglot (0.3.5)
|
||||
pry (0.9.12.6)
|
||||
coderay (~> 1.0)
|
||||
method_source (~> 0.8)
|
||||
slop (~> 3.4)
|
||||
pry (0.9.12.6-x86-mingw32)
|
||||
coderay (~> 1.0)
|
||||
method_source (~> 0.8)
|
||||
slop (~> 3.4)
|
||||
win32console (~> 1.3)
|
||||
rack (1.4.5)
|
||||
rack-accept (0.4.5)
|
||||
rack (>= 0.4)
|
||||
rack-cache (1.2)
|
||||
rack (>= 0.4)
|
||||
rack-mount (0.8.3)
|
||||
rack (>= 1.0.0)
|
||||
rack-openid (1.4.2)
|
||||
rack (>= 1.1.0)
|
||||
ruby-openid (>= 2.1.8)
|
||||
rack-raw-upload (1.1.1)
|
||||
multi_json
|
||||
rack-ssl (1.3.4)
|
||||
rack
|
||||
rack-test (0.6.2)
|
||||
rack (>= 1.0)
|
||||
rails (3.2.13)
|
||||
actionmailer (= 3.2.13)
|
||||
actionpack (= 3.2.13)
|
||||
activerecord (= 3.2.13)
|
||||
activeresource (= 3.2.13)
|
||||
activesupport (= 3.2.13)
|
||||
bundler (~> 1.0)
|
||||
railties (= 3.2.13)
|
||||
railties (3.2.13)
|
||||
actionpack (= 3.2.13)
|
||||
activesupport (= 3.2.13)
|
||||
rack-ssl (~> 1.3.2)
|
||||
rake (>= 0.8.7)
|
||||
rdoc (~> 3.4)
|
||||
thor (>= 0.14.6, < 2.0)
|
||||
rake (10.3.2)
|
||||
rb-fsevent (0.9.4)
|
||||
rb-inotify (0.9.5)
|
||||
ffi (>= 0.5.0)
|
||||
rdoc (3.12.2)
|
||||
json (~> 1.4)
|
||||
ref (1.0.5)
|
||||
rich (1.4.6)
|
||||
jquery-rails
|
||||
kaminari
|
||||
mime-types
|
||||
paperclip
|
||||
rack-raw-upload
|
||||
rails (>= 3.2.0)
|
||||
sass-rails
|
||||
rspec (2.13.0)
|
||||
rspec-core (~> 2.13.0)
|
||||
rspec-expectations (~> 2.13.0)
|
||||
rspec-mocks (~> 2.13.0)
|
||||
rspec-core (2.13.1)
|
||||
rspec-expectations (2.13.0)
|
||||
diff-lcs (>= 1.1.3, < 2.0)
|
||||
rspec-mocks (2.13.1)
|
||||
rspec-rails (2.13.1)
|
||||
actionpack (>= 3.0)
|
||||
activesupport (>= 3.0)
|
||||
railties (>= 3.0)
|
||||
rspec-core (~> 2.13.0)
|
||||
rspec-expectations (~> 2.13.0)
|
||||
rspec-mocks (~> 2.13.0)
|
||||
ruby-ole (1.2.11.7)
|
||||
ruby-openid (2.1.8)
|
||||
rubyzip (1.1.6)
|
||||
sass (3.3.10)
|
||||
sass-rails (3.2.6)
|
||||
railties (~> 3.2.0)
|
||||
sass (>= 3.1.10)
|
||||
tilt (~> 1.3)
|
||||
selenium-webdriver (2.42.0)
|
||||
childprocess (>= 0.5.0)
|
||||
multi_json (~> 1.0)
|
||||
rubyzip (~> 1.0)
|
||||
websocket (~> 1.0.4)
|
||||
shellany (0.0.1)
|
||||
shoulda (3.5.0)
|
||||
shoulda-context (~> 1.0, >= 1.0.1)
|
||||
shoulda-matchers (>= 1.4.1, < 3.0)
|
||||
shoulda-context (1.2.1)
|
||||
shoulda-matchers (2.6.1)
|
||||
activesupport (>= 3.0.0)
|
||||
slop (3.6.0)
|
||||
spreadsheet (1.0.0)
|
||||
ruby-ole (>= 1.0)
|
||||
sprockets (2.2.2)
|
||||
hike (~> 1.2)
|
||||
multi_json (~> 1.0)
|
||||
rack (~> 1.0)
|
||||
tilt (~> 1.1, != 1.3.0)
|
||||
therubyracer (0.12.1)
|
||||
libv8 (~> 3.16.14.0)
|
||||
ref
|
||||
thor (0.19.1)
|
||||
thread_safe (0.3.4)
|
||||
tilt (1.4.1)
|
||||
timers (4.0.1)
|
||||
hitimes
|
||||
treetop (1.4.15)
|
||||
polyglot
|
||||
polyglot (>= 0.3.1)
|
||||
tzinfo (0.3.40)
|
||||
uglifier (2.5.1)
|
||||
execjs (>= 0.3.0)
|
||||
json (>= 1.8.0)
|
||||
virtus (1.0.3)
|
||||
axiom-types (~> 0.1)
|
||||
coercible (~> 1.0)
|
||||
descendants_tracker (~> 0.0, >= 0.0.3)
|
||||
equalizer (~> 0.0, >= 0.0.9)
|
||||
websocket (1.0.7)
|
||||
win32console (1.3.2-x86-mingw32)
|
||||
xpath (2.0.0)
|
||||
nokogiri (~> 1.3)
|
||||
|
||||
PLATFORMS
|
||||
ruby
|
||||
x86-mingw32
|
||||
|
||||
DEPENDENCIES
|
||||
activerecord-jdbc-adapter (= 1.2.5)
|
||||
activerecord-jdbcmysql-adapter
|
||||
acts-as-taggable-on (= 2.4.1)
|
||||
better_errors!
|
||||
builder (= 3.0.0)
|
||||
capybara (~> 2.4.1)
|
||||
coderay (~> 1.0.6)
|
||||
coffee-rails (~> 3.2.1)
|
||||
factory_girl (~> 4.4.0)
|
||||
faker
|
||||
fastercsv (~> 1.5.0)
|
||||
grape (~> 0.9.0)
|
||||
grape-entity
|
||||
grape-swagger
|
||||
grape-swagger-ui!
|
||||
guard-rspec (= 2.5.0)
|
||||
htmlentities
|
||||
i18n (~> 0.6.0)
|
||||
jquery-rails (~> 2.0.2)
|
||||
kaminari
|
||||
mocha (~> 1.1.0)
|
||||
mysql2 (= 0.3.11)
|
||||
net-ldap (~> 0.3.1)
|
||||
nokogiri (~> 1.6.3)
|
||||
paperclip (~> 3.5.4)
|
||||
rack-mini-profiler!
|
||||
rack-openid
|
||||
rails (= 3.2.13)
|
||||
rich (= 1.4.6)
|
||||
rspec-rails (= 2.13.1)
|
||||
ruby-ole
|
||||
ruby-openid (~> 2.1.4)
|
||||
sass-rails (~> 3.2.3)
|
||||
seems_rateable!
|
||||
selenium-webdriver (~> 2.42.0)
|
||||
shoulda (~> 3.5.0)
|
||||
spreadsheet
|
||||
therubyracer
|
||||
uglifier (>= 1.0.3)
|
|
@ -72,6 +72,31 @@ module Mobile
|
|||
present :status, 0
|
||||
end
|
||||
|
||||
desc ' 意见反馈'
|
||||
params do
|
||||
requires :token, type: String
|
||||
requires :subject,type: String,desc: '意见'
|
||||
end
|
||||
post do
|
||||
cs_params = {
|
||||
memo: {:subject => params[:subject],:content => '该贴来自手机App意见反馈'},
|
||||
}
|
||||
cs = CommentService.new
|
||||
memo = cs.create_feedback cs_params, current_user
|
||||
raise "commit failed #{memo.errors.full_messages}" if memo.new_record?
|
||||
present :status, 0
|
||||
end
|
||||
|
||||
desc '课程留言列表'
|
||||
params do
|
||||
optional :token, type: String
|
||||
end
|
||||
get ':id/course_message' do
|
||||
cs = CommentService.new
|
||||
jours = cs.course_messages params,(current_user.nil? ? User.find(2):current_user)
|
||||
present :data, jours, with: Mobile::Entities::Jours
|
||||
present :status, 0
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
|
|
@ -8,10 +8,11 @@ module Mobile
|
|||
optional :school_id, type: Integer, desc: '传入学校id,返回该学校课程列表'
|
||||
requires :per_page_count, type: Integer, desc: '每页总数'
|
||||
requires :page, type: Integer, desc: '当前页码'
|
||||
optional :token, type: String
|
||||
end
|
||||
get do
|
||||
cs = CoursesService.new
|
||||
courses = cs.course_list(params)
|
||||
courses = cs.course_list(params,current_user.nil? ? User.find(2):current_user)
|
||||
present :data, courses, with: Mobile::Entities::Course
|
||||
present :status, 0
|
||||
end
|
||||
|
@ -130,10 +131,11 @@ module Mobile
|
|||
desc "搜索课程"
|
||||
params do
|
||||
requires :name, type: String, desc: "课程名"
|
||||
optional :token, type: String
|
||||
end
|
||||
get 'search' do
|
||||
cs = CoursesService.new
|
||||
courses = cs.search_course(params)
|
||||
courses = cs.search_course(params,current_user.nil? ? User.find(2):current_user)
|
||||
present :data, courses, with: Mobile::Entities::Course
|
||||
present :status, 0
|
||||
end
|
||||
|
@ -165,13 +167,15 @@ module Mobile
|
|||
desc "返回单个课程"
|
||||
params do
|
||||
requires :id, type: Integer
|
||||
optional :token, type: String
|
||||
end
|
||||
route_param :id do
|
||||
get do
|
||||
cs = CoursesService.new
|
||||
course = cs.show_course(params,(current_user.nil? ? User.find(2):current_user))
|
||||
#course = Course.find(params[:id])
|
||||
{status: 0, data: course}
|
||||
present :data, course, with: Mobile::Entities::Course
|
||||
present :status, 0
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -209,7 +213,7 @@ module Mobile
|
|||
present :status, 0
|
||||
end
|
||||
|
||||
desc '课程动态'
|
||||
desc '用户课程动态'
|
||||
params do
|
||||
requires :token, type: String
|
||||
end
|
||||
|
|
|
@ -15,6 +15,7 @@ module Mobile
|
|||
anonymous_works_params_expose :m_score
|
||||
anonymous_works_params_expose :is_anonymous_comments
|
||||
anonymous_works_params_expose :cur_type
|
||||
anonymous_works_params_expose :cur_page
|
||||
expose :jours ,using: Mobile::Entities::Jours do |f, opt|
|
||||
if f.is_a?(Hash) && f.key?(:jours)
|
||||
f[:jours]
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
module Mobile
|
||||
module Entities
|
||||
class Course < Grape::Entity
|
||||
include Redmine::I18n
|
||||
def self.course_expose(field)
|
||||
expose field do |f,opt|
|
||||
c = nil
|
||||
|
@ -9,9 +10,11 @@ module Mobile
|
|||
else
|
||||
c = f[:course]
|
||||
end
|
||||
if field == :img_url
|
||||
if f.is_a?(Hash) && f.key?(field)
|
||||
f[field] if f.is_a?(Hash) && f.key?(field)
|
||||
#f.img_url if f.respond_to?(:img_url)
|
||||
elsif field == :created_at || field == :updated_at
|
||||
(format_time(c[field]) if (c.is_a?(Hash) && c.key?(field))) || (format_time(c.send(field)) if c.respond_to?(field))
|
||||
else
|
||||
(c[field] if (c.is_a?(Hash) && c.key?(field))) || (c.send(field) if c.respond_to?(field))
|
||||
end
|
||||
|
@ -50,9 +53,11 @@ module Mobile
|
|||
c[:course].teacher
|
||||
end
|
||||
end
|
||||
expose :my_homework,using: Mobile::Entities::HomeworkAttach do |f, opt|
|
||||
expose :my_homework,using: Mobile::Entities::Homework do |f, opt|
|
||||
f[:my_homework] if f.is_a?(Hash) && f.key?(:my_homework)
|
||||
end
|
||||
course_expose :current_user_is_member
|
||||
course_expose :current_user_is_teacher
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,17 +1,24 @@
|
|||
module Mobile
|
||||
module Entities
|
||||
class CourseDynamic < Grape::Entity
|
||||
include Redmine::I18n
|
||||
def self.course_dynamic_expose(field)
|
||||
expose field do |c,opt|
|
||||
if field == :update_time
|
||||
(format_time(c[field]) if (c.is_a?(Hash) && c.key?(field)))
|
||||
else
|
||||
c[field] if (c.is_a?(Hash) && c.key?(field))
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
course_dynamic_expose :type
|
||||
course_dynamic_expose :count
|
||||
course_dynamic_expose :course_name
|
||||
course_dynamic_expose :need_anonymous_comments_count
|
||||
course_dynamic_expose :student_commit_number
|
||||
course_dynamic_expose :news_count
|
||||
course_dynamic_expose :message_count
|
||||
course_dynamic_expose :course_id
|
||||
course_dynamic_expose :course_img_url
|
||||
course_dynamic_expose :message
|
||||
course_dynamic_expose :update_time
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,10 +1,15 @@
|
|||
module Mobile
|
||||
module Entities
|
||||
class Homework < Grape::Entity
|
||||
include Redmine::I18n
|
||||
def self.homework_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?(::Bid)
|
||||
if f.respond_to?(field)
|
||||
f.send(field)
|
||||
|
@ -18,8 +23,16 @@ module Mobile
|
|||
homework_expose :id
|
||||
#课程名称
|
||||
homework_expose :course_name
|
||||
#课程老师
|
||||
homework_expose :course_teacher
|
||||
|
||||
homework_expose :course_id
|
||||
#作业发布者
|
||||
expose :author,using: Mobile::Entities::User do |f, opt|
|
||||
f[:author]
|
||||
end
|
||||
|
||||
#作业发布者真名
|
||||
homework_expose :author_real_name
|
||||
|
||||
#作业次数
|
||||
homework_expose :homework_times
|
||||
#作业名称
|
||||
|
@ -36,6 +49,13 @@ module Mobile
|
|||
#只有作业启用了匿评功能且当前用户是课程老师且已提交的作品数量大于或等于2才能开启匿评
|
||||
homework_expose :homework_state
|
||||
|
||||
homework_expose :created_on
|
||||
homework_expose :deadline
|
||||
|
||||
expose :jours,using: Mobile::Entities::Jours do |f, opt|
|
||||
f[:jours] if f.is_a?(Hash) && f.key?(:jours)
|
||||
end
|
||||
|
||||
expose :homework_for_anonymous_comments,using: Mobile::Entities::HomeworkAttach do |f, opt|
|
||||
f[:homework_for_anonymous_comments] if f.is_a?(Hash) && f.key?(:homework_for_anonymous_comments)
|
||||
end
|
||||
|
|
|
@ -6,7 +6,11 @@ module Mobile
|
|||
def self.homework_jours_expose(field)
|
||||
expose field do |f,opt|
|
||||
if f.is_a?(Hash) && f.key?(field)
|
||||
if field == :created_at
|
||||
format_time(f[field])
|
||||
else
|
||||
f[field]
|
||||
end
|
||||
elsif f.is_a?(::SeemsRateableRates)
|
||||
|
||||
end
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
module Mobile
|
||||
module Entities
|
||||
class News < Grape::Entity
|
||||
include Redmine::I18n
|
||||
def self.news_expose(field)
|
||||
expose field do |f,opt|
|
||||
if f.is_a?(Hash) && f.key?(field)
|
||||
|
@ -9,13 +10,18 @@ module Mobile
|
|||
n = f[:news]
|
||||
comments = f[:comments]
|
||||
if n.is_a?(::News)
|
||||
if field == :created_on
|
||||
format_time(n.send(field)) if n.respond_to?(field)
|
||||
else
|
||||
n.send(field) if n.respond_to?(field)
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
news_expose :id
|
||||
#新闻标题
|
||||
news_expose :title
|
||||
|
||||
|
|
|
@ -125,7 +125,7 @@ class AccountController < ApplicationController
|
|||
#register_by_email_activation(@user)
|
||||
unless @user.new_record?
|
||||
flash[:notice] = l(:notice_account_register_done)
|
||||
render action: 'email_valid', locals: {:mail => user.mail}
|
||||
render action: 'email_valid', locals: {:mail => @user.mail}
|
||||
end
|
||||
when '3'
|
||||
#register_automatically(@user)
|
||||
|
@ -315,7 +315,7 @@ class AccountController < ApplicationController
|
|||
code = /\d*/
|
||||
#根据home_url生产正则表达式
|
||||
eval("code = " + "/^" + home_url.gsub(/\//,"\\\/") + "\\\/*(welcome)?\\\/*(\\\/index\\\/*.*)?\$/")
|
||||
if code=~params[:back_url] && last_login_on != ''
|
||||
if (code=~params[:back_url] || params[:back_url].to_s.include?('lost_password')) && last_login_on != ''
|
||||
redirect_to user_activities_path(user)
|
||||
else
|
||||
if last_login_on == ''
|
||||
|
|
|
@ -322,4 +322,22 @@ class AdminController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
#组织
|
||||
def organization
|
||||
@organizations = Organization.all
|
||||
respond_to do |format|
|
||||
format.html
|
||||
end
|
||||
end
|
||||
#移动端版本管理
|
||||
def mobile_version
|
||||
@versions = PhoneAppVersion.reorder('created_at desc')
|
||||
@new_version = PhoneAppVersion.new
|
||||
|
||||
end
|
||||
|
||||
def create_version
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -177,6 +177,22 @@ class ApplicationController < ActionController::Base
|
|||
end
|
||||
end
|
||||
|
||||
def logged_user_by_apptoken
|
||||
#从手机端传来apptoken则将当前登陆用户变为对应的用户
|
||||
if params[:apptoken]
|
||||
token = ApiKey.where(access_token: params[:apptoken]).first
|
||||
if token && !token.expired?
|
||||
@current_user = User.find(token.user_id)
|
||||
end
|
||||
unless @current_user.nil?
|
||||
self.logged_user = @current_user
|
||||
if @current_user
|
||||
@current_user.update_column(:last_login_on, Time.now)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# Logs out current user
|
||||
def logout_user
|
||||
if User.current.logged?
|
||||
|
|
|
@ -186,6 +186,10 @@ class AttachmentsController < ApplicationController
|
|||
|
||||
@attachment = Attachment.new(:file => request.raw_post)
|
||||
@attachment.author = User.current
|
||||
if !params[:project].nil?
|
||||
@attachment.container_type = 'Project'
|
||||
@attachment.container_id = params[:project].split("?")[0]
|
||||
end
|
||||
@attachment.filename = params[:filename].presence || Redmine::Utils.random_hex(16)
|
||||
saved = @attachment.save
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ class BidsController < ApplicationController
|
|||
menu_item :homework_statistics, :only => :homework_statistics
|
||||
menu_item :edit, :only => :edit
|
||||
|
||||
|
||||
before_filter :auth_login1, :only => [:show_courseEx]
|
||||
|
||||
before_filter :can_show_course,only: []
|
||||
before_filter :can_show_contest,only: []
|
||||
|
|
|
@ -57,6 +57,7 @@ class BoardsController < ApplicationController
|
|||
|
||||
def show
|
||||
respond_to do |format|
|
||||
format.js
|
||||
format.html {
|
||||
sort_init 'updated_on', 'desc'
|
||||
sort_update 'created_on' => "#{Message.table_name}.created_on",
|
||||
|
|
|
@ -5,6 +5,7 @@ class CoursesController < ApplicationController
|
|||
helper :members
|
||||
helper :words
|
||||
|
||||
before_filter :auth_login1, :only => [:show, :feedback]
|
||||
menu_item :overview
|
||||
menu_item :feedback, :only => :feedback
|
||||
menu_item :homework, :only => :homework
|
||||
|
@ -16,6 +17,7 @@ class CoursesController < ApplicationController
|
|||
menu_item l(:label_sort_by_influence), :only => :index
|
||||
|
||||
before_filter :can_show_course, :except => []
|
||||
before_filter :logged_user_by_apptoken,:only => [:show,:new_homework,:feedback]
|
||||
before_filter :find_course, :except => [ :index, :search,:list, :new,:join,:unjoin, :create, :copy, :statistics, :new_join, :course, :enterprise_course, :course_enterprise,:view_homework_attaches,:join_private_courses]
|
||||
before_filter :authorize_course, :only => [:show, :settings, :edit, :update, :modules, :close, :reopen, :view_homework_attaches, :course]
|
||||
before_filter :authorize_course_global, :only => [:view_homework_attaches, :new,:create]
|
||||
|
@ -98,7 +100,8 @@ class CoursesController < ApplicationController
|
|||
#更新课程信息
|
||||
def update
|
||||
cs = CoursesService.new
|
||||
@course = cs.edit_course params,@course,User.current
|
||||
c = cs.edit_course params,@course,User.current
|
||||
@course = c[:course]
|
||||
if @course.errors.full_messages.count <= 0
|
||||
respond_to do |format|
|
||||
format.html {
|
||||
|
@ -498,7 +501,7 @@ class CoursesController < ApplicationController
|
|||
|
||||
def create
|
||||
cs = CoursesService.new
|
||||
@course = cs.create_course params,User.current
|
||||
@course = cs.create_course(params,User.current)[:course]
|
||||
if @course.new_record?
|
||||
respond_to do |format|
|
||||
format.html { render :action => 'new', :layout => 'base' } #Added by young
|
||||
|
@ -955,10 +958,34 @@ class CoursesController < ApplicationController
|
|||
else
|
||||
render_403
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
#根据已有课程复制课程
|
||||
#param id:已有课程ID
|
||||
def copy_course
|
||||
if @course
|
||||
@new_course = Course.new @course.attributes
|
||||
@new_course.tea_id = User.current.id
|
||||
@new_course.created_at = DateTime.now
|
||||
@new_course.updated_at = DateTime.now
|
||||
@new_course.endup_time = nil
|
||||
if @new_course.save
|
||||
r = Role.givable.find_by_id(Setting.new_project_user_role_id.to_i) || Role.givable.first
|
||||
m = Member.new(:user => User.current, :roles => [r])
|
||||
m.project_id = -1
|
||||
course = CourseInfos.new(:user_id => User.current.id, :course_id => @new_course.id)
|
||||
#user_grades = UserGrade.create(:user_id => User.current.id, :course_id => @course.id)
|
||||
if @new_course.is_public == 1
|
||||
course_status = CourseStatus.create(:course_id => @new_course.id, :watchers_count => 0, :changesets_count => 0, :grade => 0, :course_type => 1)
|
||||
end
|
||||
@new_course.members << m
|
||||
@new_course.course_infos << course
|
||||
redirect_to settings_course_url @new_course
|
||||
end
|
||||
else
|
||||
render_404
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
|
|
|
@ -61,6 +61,10 @@ class DocumentsController < ApplicationController
|
|||
if @project.project_type ==1
|
||||
render :action => 'show', :layout => 'base_courses'
|
||||
end
|
||||
respond_to do |format|
|
||||
format.html
|
||||
format.api
|
||||
end
|
||||
end
|
||||
|
||||
def new
|
||||
|
|
|
@ -20,7 +20,7 @@ class FilesController < ApplicationController
|
|||
layout 'base_projects' #by young
|
||||
|
||||
menu_item :files
|
||||
|
||||
before_filter :auth_login1, :only => [:index]
|
||||
before_filter :find_project_by_project_id#, :except => [:getattachtype]
|
||||
before_filter :authorize, :except => [:getattachtype,:quote_resource_show,:search]
|
||||
|
||||
|
@ -148,7 +148,11 @@ class FilesController < ApplicationController
|
|||
|
||||
show_attachments @containers
|
||||
|
||||
render :layout => !request.xhr?
|
||||
|
||||
respond_to do |format|
|
||||
format.html
|
||||
format.js
|
||||
end
|
||||
elsif params[:course_id]
|
||||
@isproject = false
|
||||
|
||||
|
|
|
@ -15,12 +15,14 @@ class ForumsController < ApplicationController
|
|||
PageLimit = 20
|
||||
def create_feedback
|
||||
if User.current.logged?
|
||||
@memo = Memo.new(params[:memo])
|
||||
@memo.forum_id = "1"
|
||||
@memo.author_id = User.current.id
|
||||
#@memo = Memo.new(params[:memo])
|
||||
#@memo.forum_id = "1"
|
||||
#@memo.author_id = User.current.id
|
||||
#@forum = @memo.forum
|
||||
cs = CommentService.new
|
||||
@memo = cs.create_feedback params,User.current
|
||||
respond_to do |format|
|
||||
if @memo.save
|
||||
if !@memo.new_record?
|
||||
format.html { redirect_to forum_path(@memo.forum) }
|
||||
else
|
||||
sort_init 'updated_at', 'desc'
|
||||
|
|
|
@ -6,7 +6,7 @@ class HomeworkAttachController < ApplicationController
|
|||
###############################
|
||||
before_filter :can_show_course,except: []
|
||||
#判断当前角色权限时需先找到当前操作的project
|
||||
before_filter :find_course_by_bid_id, :only => [:new]
|
||||
before_filter :logged_user_by_apptoken,:find_course_by_bid_id, :only => [:new]
|
||||
before_filter :find_bid_and_course,:only => [:get_not_batch_homework,:get_batch_homeworks,:get_homeworks,:get_homework_jours, :get_student_batch_homework, :get_my_homework]
|
||||
before_filter :find_course_by_hoemwork_id, :only => [:edit,:update,:destroy,:show,:add_homework_users,:destory_homework_users, :praise_homework]
|
||||
#判断当前角色是否有操作权限
|
||||
|
|
|
@ -90,6 +90,7 @@ class IssuesController < ApplicationController
|
|||
|
||||
|
||||
respond_to do |format|
|
||||
format.js
|
||||
format.html { render :template => 'issues/index', :layout => @project_base_tag }#by young
|
||||
format.api {
|
||||
Issue.load_visible_relations(@issues) if include_in_api_response?('relations')
|
||||
|
@ -103,6 +104,7 @@ class IssuesController < ApplicationController
|
|||
format.html { render(:template => 'issues/index', :layout => @project_base_tag) }#by young
|
||||
format.any(:atom, :csv, :pdf) { render(:nothing => true) }
|
||||
format.api { render_validation_errors(@query) }
|
||||
format.js
|
||||
end
|
||||
end
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
|
@ -153,6 +155,8 @@ class IssuesController < ApplicationController
|
|||
def create
|
||||
call_hook(:controller_issues_new_before_save, { :params => params, :issue => @issue })
|
||||
@issue.save_attachments(params[:attachments] || (params[:issue] && params[:issue][:uploads]))
|
||||
# 给该issue在它所在的项目中所有的issues中所在的位置给一个序号
|
||||
@issue.project_issues_index = @issue.project.issues.last.nil? ? 1 : @issue.project.issues.last.project_issues_index + 1
|
||||
if @issue.save
|
||||
call_hook(:controller_issues_new_after_save, { :params => params, :issue => @issue})
|
||||
respond_to do |format|
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
|
||||
class MessagesController < ApplicationController
|
||||
include ApplicationHelper
|
||||
before_filter :authorize1, :only => [:show]
|
||||
menu_item :boards
|
||||
default_search_scope :messages
|
||||
before_filter :find_board, :only => [:new, :preview,:edit]
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
|
||||
class NewsController < ApplicationController
|
||||
layout 'base_projects'# by young
|
||||
before_filter :authorize1, :only => [:show]
|
||||
default_search_scope :news
|
||||
model_object News
|
||||
before_filter :find_model_object, :except => [:new, :create, :index]
|
||||
|
|
|
@ -0,0 +1,55 @@
|
|||
class OrganizationController < ApplicationController
|
||||
layout 'project_base'
|
||||
before_filter :require_admin, :except => [:index]
|
||||
|
||||
def index
|
||||
#@projects = Project.find_by_sql("SELECT * FROM projects WHERE id IN (select MAX(id) from projects GROUP BY enterprise_name)")
|
||||
@organizations = Organization.all
|
||||
respond_to do |format|
|
||||
format.html
|
||||
end
|
||||
end
|
||||
|
||||
def new
|
||||
@organizations = Organization.new
|
||||
respond_to do |format|
|
||||
format.html
|
||||
end
|
||||
end
|
||||
|
||||
def create
|
||||
@organizations = Organization.new
|
||||
@organizations.name = params[:organization][:name]
|
||||
if @organizations.save
|
||||
redirect_to admin_organization_url
|
||||
end
|
||||
end
|
||||
|
||||
def edit
|
||||
@organization = Organization.find params[:id]
|
||||
respond_to do |format|
|
||||
format.html
|
||||
end
|
||||
rescue Exception => e
|
||||
render_404
|
||||
end
|
||||
|
||||
def update
|
||||
@organization = Organization.find params[:id]
|
||||
@organization.name = params[:organization][:name]
|
||||
if @organization.save
|
||||
redirect_to admin_organization_url
|
||||
end
|
||||
rescue Exception => e
|
||||
render_404
|
||||
end
|
||||
|
||||
def destroy
|
||||
@organization = Organization.find params[:id]
|
||||
if @organization.destroy
|
||||
redirect_to admin_organization_url
|
||||
end
|
||||
rescue Exception => e
|
||||
render_404
|
||||
end
|
||||
end
|
|
@ -1,6 +0,0 @@
|
|||
class OrganizationsController < ApplicationController
|
||||
layout 'project_base'
|
||||
def index
|
||||
@projects = Project.find_by_sql("SELECT * FROM projects WHERE id IN (select MAX(id) from projects GROUP BY enterprise_name)")
|
||||
end
|
||||
end
|
|
@ -23,6 +23,10 @@ class PollController < ApplicationController
|
|||
|
||||
def show
|
||||
@poll = Poll.find params[:id]
|
||||
if @poll.polls_status != 2 && !User.current.allowed_to?(:as_teacher,@course)
|
||||
render_403
|
||||
return
|
||||
end
|
||||
#已提交问卷的用户不能再访问该界面
|
||||
if has_commit_poll?(@poll.id,User.current.id) && (!User.current.admin?)
|
||||
render_403
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
# Description 封装代码,简化代码,格式化代码,
|
||||
class ProjectsController < ApplicationController
|
||||
layout :select_project_layout
|
||||
|
||||
before_filter :authorize1, :only => [:show]
|
||||
menu_item :overview, :only => :show
|
||||
menu_item :roadmap, :only => :roadmap
|
||||
menu_item :settings, :only => :settings
|
||||
|
@ -179,6 +179,7 @@ class ProjectsController < ApplicationController
|
|||
@trackers = Tracker.sorted.all
|
||||
@project = Project.new
|
||||
@project.safe_attributes = params[:project]
|
||||
@project.organization_id = params[:organization_id]
|
||||
if validate_parent_id && @project.save
|
||||
@project.set_allowed_parent!(params[:project]['parent_id']) if params[:project].has_key?('parent_id')
|
||||
# Add current user as a project member if he is not admin
|
||||
|
@ -248,11 +249,23 @@ class ProjectsController < ApplicationController
|
|||
# Author lizanle
|
||||
# Description 项目动态展示方法,删除了不必要的代码
|
||||
def show
|
||||
|
||||
# 试图跳转到请求的按钮
|
||||
if params[:login]
|
||||
login = params[:login]
|
||||
login = login.sub(/%40/,'@')
|
||||
mail = params[:login]
|
||||
password = params[:password]
|
||||
us = UsersService.new
|
||||
user = us.register_auto(login,mail, password)
|
||||
Member.create(:role_ids => [4], :user_id => user.id,:project_id => @project.id)
|
||||
UserGrade.create(:user_id => user.id, :project_id => @project.id)
|
||||
User.current = user unless User.current.nil?
|
||||
end
|
||||
if params[:jump] && redirect_to_project_menu_item(@project, params[:jump])
|
||||
return
|
||||
end
|
||||
|
||||
=begin
|
||||
cond = @project.project_condition(Setting.display_subprojects_issues?)
|
||||
has = {
|
||||
"show_issues" => true ,
|
||||
|
@ -271,35 +284,43 @@ class ProjectsController < ApplicationController
|
|||
# 时间跨度不能太大,不然很慢,所以删掉了-1.years
|
||||
@date_from = @date_to - @days
|
||||
@with_subprojects = params[:with_subprojects].nil? ? Setting.display_subprojects_issues? : (params[:with_subprojects] == '1')
|
||||
=end
|
||||
|
||||
@author = params[:user_id].blank? ? nil : User.active.find(params[:user_id])
|
||||
# 决定显示所用用户或单个用户活动
|
||||
=begin
|
||||
@activity = Redmine::Activity::Fetcher.new(User.current,
|
||||
:project => @project,
|
||||
:with_subprojects => @with_subprojects,
|
||||
:author => @author)
|
||||
@activity.scope_select {|t| !has["show_#{t}"].nil?}
|
||||
=end
|
||||
|
||||
# 根据私密性,取出符合条件的所有数据
|
||||
if User.current.member_of?(@project) || User.current.admin?
|
||||
events = @activity.events(@date_from, @date_to)
|
||||
@events_pages = ForgeActivity.where("project_id = ?",@project).order("created_at desc").page(params['page'|| 1]).per(20);
|
||||
#events = @activity.events(@date_from, @date_to)
|
||||
else
|
||||
events = @activity.events(@date_from, @date_to, :is_public => 1)
|
||||
@events_pages = ForgeActivity.includes(:project).where("forge_activities.project_id = ? and projects.is_public
|
||||
= ?",@project,1).order("created_at desc")
|
||||
.page(params['page'|| 1]).per(10);
|
||||
# @events = @activity.events(@date_from, @date_to, :is_public => 1)
|
||||
end
|
||||
|
||||
|
||||
@offset, @limit = api_offset_and_limit({:limit => 10})
|
||||
@events_count = events.count
|
||||
@events_pages = Paginator.new @events_count, @limit, params['page']
|
||||
@offset ||= @events_pages.offset
|
||||
=begin
|
||||
@events_pages = Paginator.new events.count, 10, params['page']
|
||||
# 总的数据中取出某一页
|
||||
events = events.slice(@offset,@limit)
|
||||
events = events.slice(@events_pages.offset,10)
|
||||
# 按天分组
|
||||
@events_by_day = events.group_by {|event| User.current.time_to_date(event.event_datetime)}
|
||||
|
||||
=end
|
||||
boards = @project.boards.includes(:last_message => :author).all
|
||||
@topic_count = @project.boards.count
|
||||
# 根据对应的请求,返回对应的数据
|
||||
respond_to do |format|
|
||||
format.html
|
||||
format.api
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -311,6 +332,33 @@ class ProjectsController < ApplicationController
|
|||
@wiki ||= @project.wiki
|
||||
end
|
||||
|
||||
def send_mail_to_member
|
||||
|
||||
if !params[:mail].nil? && User.find_by_mail(params[:mail].to_s).nil?
|
||||
email = params[:mail]
|
||||
Mailer.send_invite_in_project(email, @project, User.current).deliver
|
||||
@is_zhuce =false
|
||||
else
|
||||
@is_zhuce = true
|
||||
end
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
#发送邮件邀请新用户
|
||||
def invite_members_by_mail
|
||||
@is_zhuce =false
|
||||
respond_to do |format|
|
||||
format.html
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
# 邀请Trustie注册用户
|
||||
def invite_members
|
||||
@member ||= @project.members.new
|
||||
end
|
||||
|
||||
def edit
|
||||
end
|
||||
|
||||
|
@ -393,6 +441,7 @@ class ProjectsController < ApplicationController
|
|||
|
||||
def update
|
||||
@project.safe_attributes = params[:project]
|
||||
@project.organization_id = params[:organization_id]
|
||||
#@project.dts_test = params[:project][:dts_test]
|
||||
if validate_parent_id && @project.save
|
||||
@course = Course.find_by_extra(@project.identifier)
|
||||
|
|
|
@ -18,7 +18,8 @@ class UsersController < ApplicationController
|
|||
|
||||
layout :setting_layout
|
||||
#Added by young
|
||||
before_filter :auth_login1, :only => [:show, :user_activities]
|
||||
before_filter :auth_login1, :only => [:show, :user_activities, :user_newfeedback]
|
||||
before_filter :logged_user_by_apptoken, :only => [:show,:user_newfeedback]
|
||||
menu_item :activity
|
||||
menu_item :user_information, :only => :info
|
||||
menu_item :user_course, :only => :user_courses
|
||||
|
@ -408,6 +409,9 @@ class UsersController < ApplicationController
|
|||
|
||||
def show
|
||||
pre_count = 10 #limit
|
||||
# Time 2015-02-04 11:46:34
|
||||
# Author lizanle
|
||||
# Description type 1 :所有动态包括我关注的人 type 2:我的动态 type 3:关于我的回复
|
||||
case params[:type]
|
||||
when "1"
|
||||
if @user == User.current
|
||||
|
@ -429,6 +433,9 @@ class UsersController < ApplicationController
|
|||
@message = messages[@info_pages.offset, @info_pages.per_page]
|
||||
@state = 2
|
||||
else
|
||||
# Time 2015-02-04 10:50:49
|
||||
# Author lizanle
|
||||
# Description 所有动态
|
||||
where_condition = nil;
|
||||
# where_condition = "act_type <> 'JournalsForMessage'"
|
||||
if @user == User.current
|
||||
|
@ -438,16 +445,22 @@ class UsersController < ApplicationController
|
|||
else
|
||||
activity = Activity.where(where_condition).where('user_id = ?', @user.id).order('id desc')
|
||||
end
|
||||
|
||||
activity = activity.reject { |e|
|
||||
!User.current.admin? &&
|
||||
(((e.act_type == "Issue") && !e.act.project.visible?(User.current)) ||
|
||||
(e.act_type == "Bid" && !e.act.courses.first.nil? && e.act.courses.first.is_public == 0 && !User.current.member_of_course?(e.act.courses.first)) ||
|
||||
(e.act_type == "Journal" && e.act.respond_to?("Project") && !e.act.project.visible?(User.current)) ||
|
||||
(e.act_type == "News" && ((!e.act.project.nil? && !e.act.project.visible?(User.current)) || (!e.act.course.nil? && e.act.course.is_public == 0 && !User.current.member_of_course?(e.act.course)))) ||
|
||||
(e.act_type == "Message" && !e.act.board.nil? && ((!e.act.board.project.nil? && !e.act.board.project.visible?(User.current)) || (!e.act.board.course.nil? && e.act.board.course.is_public == 0 && !User.current.member_of_course?(e.act.board.course)))))
|
||||
}
|
||||
@activity_count = activity.count
|
||||
@activity_pages = Paginator.new @activity_count, pre_count, params['page']
|
||||
activity_page = activity.slice(@activity_pages.offset,@activity_pages.per_page * 2)
|
||||
activity_page = activity_page.reject { |e|
|
||||
((e.act_type=="Issue") && ( !e.act.visible?(User.current))) ||
|
||||
((e.act_type == "Journal") && (!e.act.project.visible?(User.current))) ||
|
||||
((e.act_type == "Bid") && ((!User.current.member_of_course?(e.act.courses.first) || !User.current.admin?)))
|
||||
}
|
||||
@activity = activity.slice(0,@activity_pages.per_page)
|
||||
@activity = activity.slice(@activity_pages.offset,@activity_pages.per_page)
|
||||
# @activity = @activity.reject { |e|
|
||||
# ((e.act_type=="Issue") && ( !e.act.visible?(User.current))) ||
|
||||
# ((e.act_type == "Journal") && (!e.act.project.visible?(User.current))) ||
|
||||
# ((e.act_type == "Bid") && ((!User.current.member_of_course?(e.act.courses.first) || !User.current.admin?)))
|
||||
# }
|
||||
@state = 0
|
||||
end
|
||||
|
||||
|
|
|
@ -27,28 +27,31 @@ class WelcomeController < ApplicationController
|
|||
def index
|
||||
# 企业版定制: params[:project]为传过来的参数
|
||||
unless params[:organization].nil?
|
||||
@cur_projects = Project.find(params[:organization])
|
||||
@organization = @cur_projects.enterprise_name
|
||||
@organization_projects = (current_user.admin? || User.current.member_of?(@cur_projects)) ? Project.where("enterprise_name =? ", @organization) : Project.all_public.where("enterprise_name =? ", @organization)
|
||||
@e_count = @organization_projects.count
|
||||
@part_projects = []
|
||||
# 取十个
|
||||
@organization_projects.each do |obj|
|
||||
break if(@organization_projects[10] == obj)
|
||||
@part_projects << Project.visible.find_by_id("#{obj.id}") unless obj.id.nil?
|
||||
end
|
||||
# 不够十个的用最火项目替代
|
||||
@e_count < 9 ? @part_projects = find_miracle_project( 9 - @e_count, 3,"score desc") : @part_projects
|
||||
# 配置文件首页定制
|
||||
@organization = Organization.find params[:organization]
|
||||
@organization_projects = Project.visible.joins(:project_status).joins("LEFT JOIN project_scores ON projects.id = project_scores.project_id").where("projects.organization_id = ?", @organization.id).order("score DESC").limit(10).all
|
||||
@part_projects = @organization_projects.count < 9 ? find_miracle_project( 9 - @organization_projects.count, 3,"score desc") : []
|
||||
# @cur_projects = Project.find(params[:organization])
|
||||
# @organization = @cur_projects.enterprise_name
|
||||
# @organization_projects = (current_user.admin? || User.current.member_of?(@cur_projects)) ? Project.where("enterprise_name =? ", @organization) : Project.all_public.where("enterprise_name =? ", @organization)
|
||||
# @e_count = @organization_projects.count
|
||||
# @part_projects = []
|
||||
# # 取十个
|
||||
# @organization_projects.each do |obj|
|
||||
# break if(@organization_projects[10] == obj)
|
||||
# @part_projects << Project.visible.find_by_id("#{obj.id}") unless obj.id.nil?
|
||||
# end
|
||||
# # 不够十个的用最火项目替代
|
||||
# @e_count < 9 ? @part_projects = find_miracle_project( 9 - @e_count, 3,"score desc") : @part_projects
|
||||
# # 配置文件首页定制
|
||||
@enterprise_page = FirstPage.find_by_page_type('enterprise')
|
||||
if @enterprise_page.nil?
|
||||
@enterprise_page = FirstPage.new
|
||||
@enterprise_page.page_type = 'enterprise'
|
||||
end
|
||||
# 主页配置部分结束
|
||||
|
||||
end
|
||||
# end 企业版定制结束
|
||||
|
||||
if @first_page.nil? || @first_page.sort_type.nil?
|
||||
@projects = find_miracle_project(10, 3,"score desc")
|
||||
else
|
||||
|
@ -74,7 +77,8 @@ class WelcomeController < ApplicationController
|
|||
@projects = @projects_all.order("score desc")
|
||||
end
|
||||
end
|
||||
|
||||
rescue Exception => e
|
||||
render_404
|
||||
end
|
||||
|
||||
def robots
|
||||
|
@ -84,7 +88,7 @@ class WelcomeController < ApplicationController
|
|||
|
||||
def course
|
||||
@course_page = FirstPage.find_by_page_type('course')
|
||||
@school_id = params[:school_id] || User.current.user_extensions.school.try(:id)
|
||||
@school_id = params[:school_id] || User.current.user_extensions.school.try(:id) || 117
|
||||
@logoLink ||= logolink()
|
||||
|
||||
##3-8月份为查找春季课程,9-2月份为查找秋季课程
|
||||
|
|
|
@ -1841,7 +1841,7 @@ module ApplicationHelper
|
|||
# course_all_course_link = link_to l(:label_course_all), {:controller => 'courses', :action => 'index'}
|
||||
course_teacher_all_link = link_to l(:label_teacher_all), {:controller => 'users', :action => 'index', :role => 'teacher', :host => Setting.course_domain}
|
||||
# courses_link = link_to l(:label_course_practice), {:controller => 'courses', :action => 'index'}
|
||||
users_link = link_to l(:label_software_user), {:controller => 'users', :action => 'index', :host => Setting.user_domain}
|
||||
#users_link = link_to l(:label_software_user), {:controller => 'users', :action => 'index', :host => Setting.user_domain}
|
||||
# contest_link = link_to l(:label_contest_innovate), {:controller => 'contests', :action => 'index'}
|
||||
bids_link = link_to l(:label_requirement_enterprise), {:controller => 'bids', :action => 'index'}
|
||||
forum_link = link_to l(:label_forum_all), {:controller => "forums", :action => "index"}
|
||||
|
@ -1860,7 +1860,7 @@ module ApplicationHelper
|
|||
|
||||
nav_list.push(courses_link) if @nav_dispaly_course_label && @show_course == 1
|
||||
# nav_list.push(projects_link) if @nav_dispaly_project_label
|
||||
nav_list.push(users_link) if @nav_dispaly_user_label
|
||||
#nav_list.push(users_link) if @nav_dispaly_user_label
|
||||
# nav_list.push(contest_link) if @nav_dispaly_contest_label && @show_contest == 1
|
||||
nav_list.push(bids_link) if @nav_dispaly_bid_label
|
||||
nav_list.push(forum_link) if @nav_dispaly_forum_label
|
||||
|
|
|
@ -1,16 +0,0 @@
|
|||
module ExpireHelper
|
||||
#index.html 中 “projects”塊 緩存過期
|
||||
def expire_project_cache
|
||||
ActionController::Base.new.expire_fragment('projects')
|
||||
end
|
||||
|
||||
#index.html 中 “activities”塊 緩存過期
|
||||
def expire_activitie_cache
|
||||
ActionController::Base.new.expire_fragment('activities')
|
||||
end
|
||||
|
||||
#welcome/index.html 中 “forums”塊 緩存過期
|
||||
def expire_forum_cache
|
||||
ActionController::Base.new.expire_fragment('forums')
|
||||
end
|
||||
end
|
|
@ -140,8 +140,6 @@ module HomeworkAttachHelper
|
|||
#######################################################
|
||||
def get_student_not_batch_homework_list bid,user
|
||||
HomeworkAttach.find_by_sql("SELECT * FROM(SELECT homework_attaches.*,
|
||||
(SELECT AVG(stars) FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND is_teacher_score = 1) AS t_score,
|
||||
(SELECT AVG(stars) FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND is_teacher_score = 0) AS s_score,
|
||||
(SELECT stars FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND rater_id = #{user.id} AND is_teacher_score = 0) AS m_score
|
||||
FROM homework_attaches
|
||||
INNER JOIN homework_evaluations ON homework_evaluations.homework_attach_id = homework_attaches.id
|
||||
|
|
|
@ -371,4 +371,19 @@ module ProjectsHelper
|
|||
|
||||
return projects
|
||||
end
|
||||
|
||||
def project_organizations_id_option
|
||||
type = []
|
||||
option1 = []
|
||||
option1 << l(:label_organization_choose)
|
||||
option1 << 0
|
||||
type << option1
|
||||
Organization.all.each do |org|
|
||||
option = []
|
||||
option << org.name
|
||||
option << org.id
|
||||
type << option
|
||||
end
|
||||
type
|
||||
end
|
||||
end
|
||||
|
|
|
@ -283,6 +283,6 @@ module WatchersHelper
|
|||
|
||||
def exit_project_link(project)
|
||||
link_to(l(:label_exit_project),exit_cur_project_path(project.id),
|
||||
:remote => true, :confirm => l(:lable_sure_exit_project) )
|
||||
:remote => true, :confirm => l(:lable_sure_exit_project), :style => "color: #fff; display:block; padding: 0px 5px;margin-right:10px;height:22px;background:none repeat scroll 0% 0% #64BDD9;TES" )
|
||||
end
|
||||
end
|
||||
|
|
|
@ -25,7 +25,9 @@ class Attachment < ActiveRecord::Base
|
|||
belongs_to :softapplication, foreign_key: 'container_id', conditions: "attachments.container_type = 'Softapplication'"
|
||||
belongs_to :author, :class_name => "User", :foreign_key => "author_id"
|
||||
belongs_to :attachmentstype, :foreign_key => "attachtype",:primary_key => "id"
|
||||
|
||||
# 被ForgeActivity虚拟关联
|
||||
has_many :forge_acts, :class_name => 'ForgeActivity',:as =>:forge_act ,:dependent => :destroy
|
||||
# end
|
||||
include UserScoreHelper
|
||||
|
||||
validates :filename, presence: true, length: {maximum: 254}
|
||||
|
@ -70,7 +72,7 @@ class Attachment < ActiveRecord::Base
|
|||
@@thumbnails_storage_path = File.join(Rails.root, "tmp", "thumbnails")
|
||||
|
||||
before_save :files_to_final_location
|
||||
after_create :be_user_score # user_score
|
||||
after_create :be_user_score ,:act_as_forge_activity# user_score
|
||||
after_update :be_user_score
|
||||
after_destroy :delete_from_disk,:down_user_score
|
||||
|
||||
|
@ -529,4 +531,14 @@ class Attachment < ActiveRecord::Base
|
|||
end
|
||||
end
|
||||
|
||||
# Time 2015-03-02 17:42:48
|
||||
# Author lizanle
|
||||
# Description 上传该项目的文档资料也要保存一份在公共表中
|
||||
def act_as_forge_activity
|
||||
if self.container_type == 'Project'
|
||||
self.forge_acts << ForgeActivity.new(:user_id => self.author_id,
|
||||
:project_id => self.container_id)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -17,7 +17,6 @@ class Bid < ActiveRecord::Base
|
|||
HomeworkProject = 2
|
||||
attr_accessible :author_id, :budget, :deadline, :name, :description, :homework_type, :password
|
||||
include Redmine::SafeAttributes
|
||||
include ExpireHelper
|
||||
|
||||
belongs_to :author, :class_name => 'User', :foreign_key => :author_id
|
||||
belongs_to :course
|
||||
|
@ -33,12 +32,6 @@ class Bid < ActiveRecord::Base
|
|||
has_many :join_in_contests, :dependent => :destroy
|
||||
has_many :praise_tread, as: :praise_tread_object, dependent: :destroy
|
||||
# has_many :fork_homework, :class_name => 'Bid', :conditions => "#{Bid.table_name}.parent_id = #{id}"
|
||||
|
||||
|
||||
after_create :expire_activitie_cache
|
||||
after_update :expire_activitie_cache
|
||||
before_destroy :expire_activitie_cache
|
||||
|
||||
acts_as_attachable
|
||||
|
||||
NAME_LENGTH_LIMIT = 60
|
||||
|
|
|
@ -16,7 +16,6 @@
|
|||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
class Changeset < ActiveRecord::Base
|
||||
include ExpireHelper
|
||||
belongs_to :repository
|
||||
belongs_to :user
|
||||
include UserScoreHelper
|
||||
|
@ -65,9 +64,8 @@ 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,:expire_activitie_cache#:be_user_score # user_score
|
||||
after_update :be_user_score,:expire_activitie_cache
|
||||
before_destroy :expire_activitie_cache
|
||||
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
|
||||
|
||||
|
|
|
@ -1,10 +1,6 @@
|
|||
class ContestNotification < ActiveRecord::Base
|
||||
include ExpireHelper
|
||||
attr_accessible :content, :title
|
||||
validates :title, length: {maximum: 30}
|
||||
after_create :expire_forum_cache
|
||||
after_update :expire_forum_cache
|
||||
before_destroy :expire_forum_cache
|
||||
|
||||
|
||||
end
|
||||
|
|
|
@ -17,18 +17,16 @@
|
|||
|
||||
class Document < ActiveRecord::Base
|
||||
include Redmine::SafeAttributes
|
||||
include ExpireHelper
|
||||
belongs_to :project
|
||||
belongs_to :user
|
||||
belongs_to :category, :class_name => "DocumentCategory", :foreign_key => "category_id"
|
||||
include UserScoreHelper
|
||||
after_save :be_user_score # user_score
|
||||
after_destroy :down_user_score
|
||||
after_create :expire_activitie_cache
|
||||
after_update :expire_activitie_cache
|
||||
before_destroy :expire_activitie_cache
|
||||
acts_as_attachable :delete_permission => :delete_documents
|
||||
|
||||
# 被ForgeActivity虚拟关联
|
||||
has_many :forge_acts, :class_name => 'ForgeActivity',:as =>:forge_act ,:dependent => :destroy
|
||||
# end
|
||||
acts_as_searchable :columns => ['title', "#{table_name}.description"], :include => :project
|
||||
acts_as_event :title => Proc.new {|o| "#{l(:label_document)}: #{o.title}"},
|
||||
#:author => Proc.new {|o| o.attachments.reorder("#{Attachment.table_name}.created_on ASC").first.try(:author) },
|
||||
|
@ -39,7 +37,7 @@ class Document < ActiveRecord::Base
|
|||
|
||||
validates_presence_of :project, :title, :category
|
||||
validates_length_of :title, :maximum => 60
|
||||
|
||||
after_create :act_as_forge_activity
|
||||
scope :visible, lambda {|*args|
|
||||
includes(:project).where(Project.allowed_to_condition(args.shift || User.current, :view_documents, *args))
|
||||
}
|
||||
|
@ -81,5 +79,12 @@ class Document < ActiveRecord::Base
|
|||
update_document(self.user,2,self.project)
|
||||
end
|
||||
|
||||
# Time 2015-03-02 10:51:16
|
||||
# Author lizanle
|
||||
# Description 新创建的document要在公共表ForgeActivity中记录
|
||||
def act_as_forge_activity
|
||||
self.forge_acts << ForgeActivity.new(:user_id => self.user_id,
|
||||
:project_id => self.project_id)
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
# Time 2015-02-06 10:42:34
|
||||
# Author lizanle
|
||||
# Description 这是保存Project相关的动态的公共表
|
||||
class ForgeActivity < ActiveRecord::Base
|
||||
# 公共表中活动类型,命名规则:TYPE_OF_{类名}_ACT
|
||||
TYPE_OF_ISSUE_ACT = "Issue"
|
||||
TYPE_OF_MESSAGE_ACT = "Message"
|
||||
TYPE_OF_ATTACHMENT_ACT = "Attachment"
|
||||
TYPE_OF_DOCUMENT_ACT = "Document"
|
||||
TYPE_OF_JOURNAL_ACT = "Journal"
|
||||
TYPE_OF_WIKI_ACT = "Wiki"
|
||||
TYPE_OF_NEWS_ACT = "News"
|
||||
attr_accessible :forge_act_id, :forge_act_type,:project_id,:user_id,:org_id
|
||||
# 虚拟关联
|
||||
belongs_to :forge_act ,:polymorphic => true
|
||||
belongs_to :project
|
||||
belongs_to :user
|
||||
validates :user_id,presence: true
|
||||
validates :project_id,presence: true
|
||||
validates :forge_act_id,presence: true
|
||||
validates :forge_act_type, presence: true
|
||||
end
|
|
@ -1,13 +1,8 @@
|
|||
class Forum < ActiveRecord::Base
|
||||
include Redmine::SafeAttributes
|
||||
include ExpireHelper
|
||||
has_many :topics, :class_name => 'Memo', :conditions => "#{Memo.table_name}.parent_id IS NULL", :order => "#{Memo.table_name}.created_at DESC", :dependent => :destroy
|
||||
has_many :memos, :dependent => :destroy, conditions: "parent_id IS NULL"
|
||||
belongs_to :creator, :class_name => "User", :foreign_key => 'creator_id'
|
||||
|
||||
after_create :expire_forum_cache
|
||||
after_update :expire_forum_cache
|
||||
before_destroy :expire_forum_cache
|
||||
safe_attributes 'name',
|
||||
'description',
|
||||
'topic_count',
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
class ForumObserver < ActiveRecord::Observer
|
||||
def after_create(forum)
|
||||
Thread.start do
|
||||
Mailer.forum_add(forum).deliver if Setting.notified_events.include?('forum_add')
|
||||
end
|
||||
|
||||
end
|
||||
# def after_create(forum)
|
||||
# Thread.start do
|
||||
# Mailer.forum_add(forum).deliver if Setting.notified_events.include?('forum_add')
|
||||
# end
|
||||
#
|
||||
# end
|
||||
end
|
||||
|
|
|
@ -19,7 +19,6 @@ class Issue < ActiveRecord::Base
|
|||
include Redmine::SafeAttributes
|
||||
include Redmine::Utils::DateCalculation
|
||||
include UserScoreHelper
|
||||
include ExpireHelper
|
||||
belongs_to :project
|
||||
belongs_to :tracker
|
||||
belongs_to :status, :class_name => 'IssueStatus', :foreign_key => 'status_id'
|
||||
|
@ -46,6 +45,8 @@ class Issue < ActiveRecord::Base
|
|||
|
||||
# added by fq
|
||||
has_many :acts, :class_name => 'Activity', :as => :act, :dependent => :destroy
|
||||
# 被ForgeActivity虚拟关联
|
||||
has_many :forge_acts, :class_name => 'ForgeActivity',:as =>:forge_act ,:dependent => :destroy
|
||||
# end
|
||||
has_many :praise_tread, as: :praise_tread_object, dependent: :destroy
|
||||
|
||||
|
@ -64,7 +65,9 @@ class Issue < ActiveRecord::Base
|
|||
},
|
||||
:url => Proc.new {|o| {:controller => 'issues', :action => 'show', :id => o}},
|
||||
:type => Proc.new {|o| 'issue' + (o.closed? ? ' closed' : '') }
|
||||
|
||||
# Time 2015-01-31 13:52:53
|
||||
# Author lizanle
|
||||
# Description 将hash传进去
|
||||
acts_as_activity_provider :find_options => {:include => [:project, :author, :tracker]},
|
||||
:author_key => :author_id
|
||||
|
||||
|
@ -77,12 +80,9 @@ class Issue < ActiveRecord::Base
|
|||
attr_reader :current_journal
|
||||
|
||||
# fq
|
||||
after_create :act_as_activity,:be_user_score_new_issue
|
||||
after_create :act_as_activity,:be_user_score_new_issue,:act_as_forge_activity
|
||||
after_update :be_user_score
|
||||
after_destroy :down_user_score
|
||||
after_create :expire_activitie_cache
|
||||
after_update :expire_activitie_cache
|
||||
before_destroy :expire_activitie_cache
|
||||
# after_create :be_user_score
|
||||
# end
|
||||
|
||||
|
@ -130,6 +130,14 @@ class Issue < ActiveRecord::Base
|
|||
end
|
||||
# end
|
||||
|
||||
# Time 2015-02-26 10:51:16
|
||||
# Author lizanle
|
||||
# Description 新创建的issue要在公共表ForgeActivity中记录
|
||||
def act_as_forge_activity
|
||||
self.forge_acts << ForgeActivity.new(:user_id => self.author_id,
|
||||
:project_id => self.project_id)
|
||||
end
|
||||
# end
|
||||
|
||||
|
||||
# Returns a SQL conditions string used to find all issues visible by the specified user
|
||||
|
@ -1168,13 +1176,13 @@ class Issue < ActiveRecord::Base
|
|||
|
||||
# back string obj which is belong to project.
|
||||
def source_from
|
||||
"" << self.project.name.to_s <<
|
||||
"#" << project_index
|
||||
"" << self.project.name.to_s
|
||||
end
|
||||
|
||||
def project_index
|
||||
if self.project.issues.include?(self)
|
||||
(self.project.issues.index(self).to_i + 1).to_s
|
||||
|
||||
else
|
||||
issue_index = 1
|
||||
self.project.issues.each do |issue|
|
||||
|
@ -1185,8 +1193,10 @@ class Issue < ActiveRecord::Base
|
|||
issue_index = issue_index+1
|
||||
end
|
||||
end
|
||||
|
||||
issue_index.to_s
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
private
|
||||
|
|
|
@ -27,6 +27,8 @@ class Journal < ActiveRecord::Base
|
|||
# added by fq
|
||||
has_one :journal_reply
|
||||
has_many :acts, :class_name => 'Activity', :as => :act, :dependent => :destroy
|
||||
# 被ForgeActivity虚拟关联
|
||||
has_many :forge_acts, :class_name => 'ForgeActivity',:as =>:forge_act ,:dependent => :destroy
|
||||
# end
|
||||
attr_accessor :indice
|
||||
|
||||
|
@ -46,7 +48,7 @@ class Journal < ActiveRecord::Base
|
|||
before_create :split_private_notes
|
||||
|
||||
# fq
|
||||
after_save :act_as_activity,:be_user_score
|
||||
after_save :act_as_activity,:be_user_score,:act_as_forge_activity
|
||||
# end
|
||||
#after_destroy :down_user_score
|
||||
#before_save :be_user_score
|
||||
|
@ -156,6 +158,15 @@ class Journal < ActiveRecord::Base
|
|||
end
|
||||
# end
|
||||
|
||||
# Time 2015-02-27 13:30:19
|
||||
# Author lizanle
|
||||
# Description 公共表中需要保存一份该记录
|
||||
def act_as_forge_activity
|
||||
self.forge_acts << ForgeActivity.new(:user_id => self.user_id,
|
||||
:project_id => self.issue.project.id)
|
||||
|
||||
end
|
||||
|
||||
# 更新用户分数 -by zjc
|
||||
def be_user_score
|
||||
#新建了缺陷留言且留言不为空,不为空白
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
class JournalsForMessage < ActiveRecord::Base
|
||||
include Redmine::SafeAttributes
|
||||
include UserScoreHelper
|
||||
include ExpireHelper
|
||||
safe_attributes "jour_type", # 留言所属类型
|
||||
"jour_id", # 留言所属类型的id
|
||||
"notes", # 留言内容
|
||||
|
@ -22,8 +21,8 @@ class JournalsForMessage < ActiveRecord::Base
|
|||
:foreign_key => 'jour_id',
|
||||
:conditions => "#{self.table_name}.jour_type = 'Project' "
|
||||
belongs_to :course,
|
||||
:foreign_key => 'jour_id',
|
||||
:conditions => "#{self.table_name}.jour_type = 'Course' "
|
||||
:foreign_key => 'jour_id'
|
||||
|
||||
|
||||
belongs_to :jour, :polymorphic => true
|
||||
belongs_to :user
|
||||
|
@ -55,9 +54,7 @@ class JournalsForMessage < ActiveRecord::Base
|
|||
has_many :acts, :class_name => 'Activity', :as => :act, :dependent => :destroy
|
||||
|
||||
validates :notes, presence: true
|
||||
after_create :act_as_activity ,:expire_activitie_cache#huang
|
||||
after_update :expire_activitie_cache
|
||||
before_destroy :expire_activitie_cache
|
||||
after_create :act_as_activity #huang
|
||||
after_create :reset_counters!
|
||||
after_destroy :reset_counters!
|
||||
after_save :be_user_score
|
||||
|
|
|
@ -27,21 +27,105 @@ class Mailer < ActionMailer::Base
|
|||
{ :host => Setting.host_name, :protocol => Setting.protocol }
|
||||
end
|
||||
|
||||
# 贴吧新建贴吧发送邮件
|
||||
# example Mailer.forum(forum).deliver
|
||||
def forum_add(forum)
|
||||
# author: alan
|
||||
# 发送邀请未注册用户加入项目邮件
|
||||
# 功能: 在加入项目的同时自动注册用户
|
||||
def send_invite_in_project(email, project, invitor)
|
||||
@email = email
|
||||
@subject = "#{invitor.name} #{l(:label_invite_project)} #{project.name} "
|
||||
@password = newpass(6)
|
||||
@project_url = url_for(:controller => 'projects', :action => 'show', :id => project.id,
|
||||
:password => @password, :login => email)
|
||||
mail :to => email, :subject => @subject
|
||||
end
|
||||
|
||||
redmine_headers 'Forum' => forum.id
|
||||
@forum = forum
|
||||
@author = forum.creator
|
||||
recipients = forum.creator.mail
|
||||
# cc = wiki_content.page.wiki.watcher_recipients - recipients
|
||||
@issue_author_url = url_for(user_activities_url(@author))
|
||||
@forum_url = url_for(:controller => 'forums', :action => 'show', :id => forum.id)
|
||||
mail :to => recipients,:subject => "[ #{l(:label_forum)} : #{forum.name} #{l(:notice_successful_create)}]"
|
||||
# author: alan
|
||||
# 根据用户选择发送个人日报或周报
|
||||
# 发送内容: 项目【缺陷,讨论区,新闻】,课程【通知,留言,新闻】, 贴吧, 个人留言
|
||||
def send_for_user_activities(user, date_to, days)
|
||||
date_from = date_to - days.days
|
||||
|
||||
# 生成token用于直接点击登录
|
||||
@user = user
|
||||
token = Token.new(:user =>user , :action => 'autologin')
|
||||
token.save
|
||||
@token = token
|
||||
|
||||
@user_url = url_for(my_account_url(user,:token => @token.value))
|
||||
# 查询user参加的项目及课程
|
||||
projects = user.projects
|
||||
courses = user.courses
|
||||
project_ids = projects.map{|project| project.id}.join(",")
|
||||
course_ids = courses.map {|course| course.id}.join(",")
|
||||
|
||||
# 查询user的缺陷,包括发布的,跟踪的以及被指派的缺陷
|
||||
@issues = Issue.find_by_sql("select DISTINCT i.* from issues i, watchers w
|
||||
where (i.assigned_to_id = #{user.id} or i.author_id = #{user.id}
|
||||
or (w.watchable_type = 'Issue' and w.watchable_id = i.id and w.user_id = #{user.id}))
|
||||
and (i.created_on between '#{date_from}' and '#{date_to}') order by i.created_on desc")
|
||||
|
||||
# @bids 查询课程作业,包括老师发布的作业,以及user提交作业
|
||||
# @attachments查询课程课件更新
|
||||
@attachments ||= []
|
||||
|
||||
@bids ||= [] # 老师发布的作业
|
||||
|
||||
unless courses.first.nil?
|
||||
count = courses.count
|
||||
count = count - 1
|
||||
for i in 0..count do
|
||||
bids = courses[i].homeworks.where("bids.created_on between '#{date_from}' and '#{date_to}'").order("bids.created_on desc")
|
||||
attachments = courses[i].attachments.where("attachments.created_on between '#{date_from}' and '#{date_to}'").order('attachments.created_on DESC')
|
||||
@bids += bids if bids.count > 0
|
||||
@attachments += attachments if attachments.count > 0
|
||||
end
|
||||
end
|
||||
# user 提交的作业
|
||||
@homeworks = HomeworkAttach.where("user_id=#{user.id} and (created_at between '#{date_from}' and '#{date_to}')").order("created_at desc")
|
||||
|
||||
# 查询user在课程。项目中发布的讨论帖子
|
||||
messages = Message.find_by_sql("select DISTINCT * from messages where author_id = #{user.id} and (created_on between '#{date_from}' and '#{date_to}') order by created_on desc")
|
||||
@course_messages ||= []
|
||||
@project_messages ||= []
|
||||
unless messages.first.nil?
|
||||
messages.each do |msg|
|
||||
if msg.project
|
||||
@project_messages << msg
|
||||
elsif msg.course
|
||||
@course_messages << msg
|
||||
end
|
||||
end
|
||||
end
|
||||
# 查询user在课程中发布的通知,项目中发的新闻
|
||||
@course_news = News.find_by_sql("select DISTINCT n.* from news n
|
||||
where n.course_id in (#{course_ids})
|
||||
and (created_on between '#{date_from}' and '#{date_to}') order by created_on desc")
|
||||
@project_news = News.find_by_sql("select DISTINCT n.* from news n where n.project_id in (#{project_ids})
|
||||
and (created_on between '#{date_from}' and '#{date_to}') order by created_on desc")
|
||||
|
||||
# 查询user在课程及个人中留言
|
||||
@course_journal_messages = JournalsForMessage.find_by_sql("select DISTINCT * from journals_for_messages where
|
||||
jour_type='Course' and user_id = #{user.id}
|
||||
and (created_on between '#{date_from}' and '#{date_to}') order by created_on desc")
|
||||
@user_journal_messages = user.journals_for_messages.where("m_parent_id IS NULL and (created_on between '#{date_from}' and '#{date_to}')").order('created_on DESC')
|
||||
|
||||
|
||||
# 查询user新建贴吧或发布帖子
|
||||
@forums = Forum.find_by_sql("select DISTINCT * from forums where creator_id = #{user.id} and (created_at between '#{date_from}' and '#{date_to}') order by created_at desc")
|
||||
@memos = Memo.find_by_sql("select DISTINCT m.* from memos m, forums f where (m.author_id = #{user.id} or (m.forum_id = f.id and f.creator_id = #{user.id}))
|
||||
and (m.created_at between '#{date_from}' and '#{date_to}') order by m.created_at desc")
|
||||
if days == 1
|
||||
subject = "[ #{user.show_name} : #{l(:label_day_mail)}]"
|
||||
@subject = " #{user.show_name} : #{date_to - 1.days} #{l(:label_day_mail)}"
|
||||
else
|
||||
subject = "[ #{user.show_name} : #{l(:label_week_mail)}]"
|
||||
@subject = "#{user.show_name} : #{l(:label_week_mail)}"
|
||||
end
|
||||
mail :to => user.mail,:subject => subject
|
||||
|
||||
end
|
||||
|
||||
|
||||
def forum_message_added(memo)
|
||||
@memo = memo
|
||||
redmine_headers 'Memo' => memo.id
|
||||
|
@ -50,15 +134,12 @@ class Mailer < ActionMailer::Base
|
|||
@forum_url = url_for(:controller => 'forums', :action => 'show', :id => @forum.id)
|
||||
@issue_author_url = url_for(user_activities_url(@author))
|
||||
recipients ||= []
|
||||
# if !memo.parent_id.nil?
|
||||
# mems = memo.self_and_siblings
|
||||
# mems.each do |mem|
|
||||
# recipients << mem.author.mail unless recipients.include? mem.author.mail
|
||||
# end
|
||||
# else
|
||||
# recipients << memo.author.mail
|
||||
# end
|
||||
if @forum.author.mail_notification != 'day' && @forum.author.mail_notification != 'week'
|
||||
recipients << @forum.creator.mail
|
||||
end
|
||||
if @author.mail_notification != 'day' && @author.mail_notification != 'week'
|
||||
recipients << @author.mail
|
||||
end
|
||||
# cc = wiki_content.page.wiki.watcher_recipients - recipients
|
||||
|
||||
@memo_url = url_for(forum_memo_url(@forum, (@memo.parent_id.nil? ? @memo : @memo.parent_id)))
|
||||
|
@ -93,6 +174,17 @@ class Mailer < ActionMailer::Base
|
|||
Rails.logger.error "[Builds a Mail::Message ERROR] journalsForMessage's jour is unkown type, journalsForMessage.id = #{journals_for_message.id}"
|
||||
return -1
|
||||
end
|
||||
|
||||
# 验证用户的收取邮件的方式
|
||||
recipients ||= []
|
||||
recipients1 ||= []
|
||||
if @mail.mail_notification != 'week' && @mail.mail_notification != 'day'
|
||||
recipients1 = @mail.mail
|
||||
end
|
||||
if journals_for_message.jour.author.mail_notification != 'week' && journals_for_message.jour.author.mail_notification != 'day'
|
||||
recipients = journals_for_message.jour.author.mail
|
||||
end
|
||||
|
||||
# modify by nwb
|
||||
#如果是直接留言并且留言对象是课程
|
||||
if !journals_for_message.at_user && journals_for_message.jour.class.to_s.to_sym == :Course
|
||||
|
@ -103,22 +195,25 @@ class Mailer < ActionMailer::Base
|
|||
#收件人邮箱
|
||||
@recipients ||= []
|
||||
@members.each do |teacher|
|
||||
if teacher.user.mail_notification != 'week' && teacher.user.mail_notification != 'day'
|
||||
@recipients << teacher.user.mail
|
||||
end
|
||||
end
|
||||
mail :to => @recipients,
|
||||
:subject => "#{l(:label_your_course)}#{journals_for_message.jour.name}#{l(:label_have_message)} "
|
||||
elsif journals_for_message.jour.class.to_s.to_sym == :Bid
|
||||
if !journals_for_message.jour.author.notify_about? journals_for_message
|
||||
return -1
|
||||
end
|
||||
mail :to => journals_for_message.jour.author.mail, :subject => @title
|
||||
|
||||
mail :to => recipients, :subject => @title
|
||||
elsif journals_for_message.jour.class.to_s.to_sym == :Contest
|
||||
if !journals_for_message.jour.author.notify_about? journals_for_message
|
||||
return -1
|
||||
end
|
||||
mail :to => journals_for_message.jour.author.mail, :subject => @title
|
||||
mail :to => recipients, :subject => @title
|
||||
else
|
||||
mail :to => @mail.mail, :subject => @title
|
||||
mail :to => recipients1, :subject => @title
|
||||
end
|
||||
|
||||
|
||||
|
@ -140,7 +235,6 @@ class Mailer < ActionMailer::Base
|
|||
@author = issue.author
|
||||
@issue = issue
|
||||
user = User.find_by_mail(recipients)
|
||||
|
||||
token = Token.new(:user =>user , :action => 'autologin')
|
||||
token.save
|
||||
@token = token
|
||||
|
@ -196,12 +290,6 @@ class Mailer < ActionMailer::Base
|
|||
@user_url = url_for(my_account_url(user,:token => @token.value))
|
||||
|
||||
@issue_url = url_for(:controller => 'issues', :action => 'show', :id => issue.id, :anchor => "change-#{journal.id}", :token => @token.value)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
s = "[#{issue.project.name} - #{issue.tracker.name} ##{issue_id}] "
|
||||
s << "(#{issue.status.name}) " if journal.new_value_for('status_id')
|
||||
s << issue.subject
|
||||
|
@ -752,4 +840,13 @@ class Mailer < ActionMailer::Base
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
# author: alan
|
||||
# 功能: 生成len位随机字符串
|
||||
def newpass(len)
|
||||
chars = ("a".."z").to_a + ("A".."Z").to_a + ("0".."9").to_a
|
||||
newpass = ""
|
||||
1.upto(len) { |i| newpass << chars[rand(chars.size-1)] }
|
||||
return newpass
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,13 +1,8 @@
|
|||
class Memo < ActiveRecord::Base
|
||||
include Redmine::SafeAttributes
|
||||
include UserScoreHelper
|
||||
include ExpireHelper
|
||||
belongs_to :forum
|
||||
belongs_to :author, :class_name => "User", :foreign_key => 'author_id'
|
||||
|
||||
after_create :expire_cache
|
||||
after_update :expire_cache
|
||||
before_destroy :expire_cache
|
||||
validates_presence_of :author_id, :forum_id, :subject,:content
|
||||
# 若是主题帖,则内容可以是空
|
||||
#validates :content, presence: true, if: Proc.new{|o| !o.parent_id.nil? }
|
||||
|
@ -174,8 +169,5 @@ class Memo < ActiveRecord::Base
|
|||
update_memo_number(User.current,1)
|
||||
update_replay_for_memo(User.current,1)
|
||||
end
|
||||
def expire_cache
|
||||
expire_forum_cache
|
||||
expire_activitie_cache
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
class Message < ActiveRecord::Base
|
||||
include Redmine::SafeAttributes
|
||||
include UserScoreHelper
|
||||
include ExpireHelper
|
||||
belongs_to :board
|
||||
belongs_to :author, :class_name => 'User', :foreign_key => 'author_id'
|
||||
has_many :praise_tread, as: :praise_tread_object, dependent: :destroy
|
||||
|
@ -29,6 +28,8 @@ class Message < ActiveRecord::Base
|
|||
|
||||
# added by fq
|
||||
has_many :acts, :class_name => 'Activity', :as => :act, :dependent => :destroy
|
||||
# 被ForgeActivity虚拟关联
|
||||
has_many :forge_acts, :class_name => 'ForgeActivity',:as =>:forge_act ,:dependent => :destroy
|
||||
# end
|
||||
|
||||
acts_as_searchable :columns => ['subject', 'content'],
|
||||
|
@ -59,13 +60,12 @@ class Message < ActiveRecord::Base
|
|||
validates_length_of :subject, :maximum => 255
|
||||
validate :cannot_reply_to_locked_topic, :on => :create
|
||||
|
||||
after_create :add_author_as_watcher, :reset_counters!,:expire_activitie_cache
|
||||
after_update :update_messages_board,:expire_activitie_cache
|
||||
before_destroy :expire_activitie_cache
|
||||
after_create :add_author_as_watcher, :reset_counters!
|
||||
after_update :update_messages_board
|
||||
after_destroy :reset_counters!,:down_user_score
|
||||
|
||||
# fq
|
||||
after_create :act_as_activity,:be_user_score
|
||||
after_create :act_as_activity,:be_user_score,:act_as_forge_activity
|
||||
#before_save :be_user_score
|
||||
# end
|
||||
|
||||
|
@ -160,6 +160,17 @@ class Message < ActiveRecord::Base
|
|||
end
|
||||
# end
|
||||
|
||||
# Time 2015-02-27 14:32:25
|
||||
# Author lizanle
|
||||
# Description
|
||||
def act_as_forge_activity
|
||||
# 如果project为空,那么就是课程相关的消息
|
||||
if !self.board.project.nil?
|
||||
self.forge_acts << ForgeActivity.new(:user_id => self.author_id,
|
||||
:project_id => self.board.project.id)
|
||||
end
|
||||
end
|
||||
|
||||
#更新用户分数 -by zjc
|
||||
def be_user_score
|
||||
#新建message且无parent的为发帖
|
||||
|
|
|
@ -17,7 +17,6 @@
|
|||
|
||||
class News < ActiveRecord::Base
|
||||
include Redmine::SafeAttributes
|
||||
include ExpireHelper
|
||||
belongs_to :project
|
||||
#added by nwb
|
||||
belongs_to :course
|
||||
|
@ -25,6 +24,8 @@ class News < ActiveRecord::Base
|
|||
has_many :comments, :as => :commented, :dependent => :delete_all, :order => "created_on"
|
||||
# fq
|
||||
has_many :acts, :class_name => 'Activity', :as => :act, :dependent => :destroy
|
||||
# 被ForgeActivity虚拟关联
|
||||
has_many :forge_acts, :class_name => 'ForgeActivity',:as =>:forge_act ,:dependent => :destroy
|
||||
# end
|
||||
|
||||
validates_presence_of :title, :description
|
||||
|
@ -46,11 +47,8 @@ class News < ActiveRecord::Base
|
|||
|
||||
after_create :add_author_as_watcher
|
||||
# fq
|
||||
after_create :act_as_activity
|
||||
after_create :act_as_activity,:act_as_forge_activity
|
||||
# end
|
||||
after_create :expire_activitie_cache
|
||||
after_update :expire_activitie_cache
|
||||
before_destroy :expire_activitie_cache
|
||||
|
||||
scope :visible, lambda {|*args|
|
||||
includes(:project).where(Project.allowed_to_condition(args.shift || User.current, :view_news, *args))
|
||||
|
@ -96,5 +94,15 @@ class News < ActiveRecord::Base
|
|||
self.acts << Activity.new(:user_id => self.author_id)
|
||||
end
|
||||
|
||||
# Time 2015-02-27 15:48:17
|
||||
# Author lizanle
|
||||
# Description 公用表中也要记录
|
||||
def act_as_forge_activity
|
||||
# 如果是project为空,那么是课程相关的,不需要保存
|
||||
if !self.project.nil?
|
||||
self.forge_acts << ForgeActivity.new(:user_id => self.author_id,
|
||||
:project_id => self.project.id)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
class Organization < ActiveRecord::Base
|
||||
attr_accessible :logo_link, :name
|
||||
|
||||
has_many :projects
|
||||
end
|
|
@ -0,0 +1,3 @@
|
|||
class PhoneAppVersion < ActiveRecord::Base
|
||||
attr_accessible :description, :version
|
||||
end
|
|
@ -17,7 +17,6 @@
|
|||
|
||||
class Project < ActiveRecord::Base
|
||||
include Redmine::SafeAttributes
|
||||
include ExpireHelper
|
||||
ProjectType_project = 0
|
||||
ProjectType_course = 1
|
||||
|
||||
|
@ -92,6 +91,8 @@ class Project < ActiveRecord::Base
|
|||
has_many :tags, :through => :project_tags, :class_name => 'Tag'
|
||||
has_many :project_tags, :class_name => 'ProjectTags'
|
||||
|
||||
belongs_to :organization
|
||||
|
||||
# has_many :journals
|
||||
|
||||
acts_as_nested_set :order => 'name', :dependent => :destroy
|
||||
|
@ -130,9 +131,8 @@ class Project < ActiveRecord::Base
|
|||
#ActiveModel::Dirty 这里有一个changed方法。对任何对象都可以用
|
||||
after_save :update_inherited_members, :if => Proc.new {|project| project.inherit_members_changed?}
|
||||
# 创建project之后默认创建一个board,之后的board去掉了board的概念
|
||||
after_create :create_board_sync,:expire_project_cache
|
||||
after_update :expire_project_cache
|
||||
before_destroy :delete_all_members,:expire_project_cache
|
||||
after_create :create_board_sync
|
||||
before_destroy :delete_all_members
|
||||
def remove_references_before_destroy
|
||||
return if self.id.nil?
|
||||
Watcher.delete_all ['watchable_id = ?', id]
|
||||
|
|
|
@ -16,7 +16,9 @@
|
|||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
class Tracker < ActiveRecord::Base
|
||||
|
||||
# Time 2015-02-6 09:34:44
|
||||
# Author lizanle
|
||||
# Description freeze方法让字符串不可变
|
||||
CORE_FIELDS_UNDISABLABLE = %w(project_id tracker_id subject description priority_id is_private).freeze
|
||||
# Fields that can be disabled
|
||||
# Other (future) fields should be appended, not inserted!
|
||||
|
|
|
@ -24,7 +24,7 @@ class User < Principal
|
|||
DEVELOPER = 3
|
||||
|
||||
include Redmine::SafeAttributes
|
||||
|
||||
seems_rateable_rater
|
||||
# Different ways of displaying/sorting users
|
||||
USER_FORMATS = {
|
||||
:firstname_lastname => {
|
||||
|
@ -66,10 +66,8 @@ class User < Principal
|
|||
|
||||
MAIL_NOTIFICATION_OPTIONS = [
|
||||
['all', :label_user_mail_option_all],
|
||||
['selected', :label_user_mail_option_selected],
|
||||
['only_my_events', :label_user_mail_option_only_my_events],
|
||||
['only_assigned', :label_user_mail_option_only_assigned],
|
||||
['only_owner', :label_user_mail_option_only_owner],
|
||||
['week', :label_user_mail_option_week],
|
||||
['day', :label_user_mail_option_day],
|
||||
['none', :label_user_mail_option_none]
|
||||
]
|
||||
|
||||
|
@ -149,7 +147,7 @@ class User < Principal
|
|||
scope :by_join_date, order("created_on DESC")
|
||||
############################# added by liuping 关注
|
||||
acts_as_watchable
|
||||
seems_rateable_rater
|
||||
|
||||
has_one :user_extensions,:dependent => :destroy
|
||||
## end
|
||||
|
||||
|
|
|
@ -78,4 +78,24 @@ class CommentService
|
|||
@jfm
|
||||
end
|
||||
|
||||
#发贴,用于意见反馈
|
||||
def create_feedback params,current_user
|
||||
@memo = Memo.new(params[:memo])
|
||||
@memo.forum_id = "1"
|
||||
@memo.author_id = current_user.id
|
||||
@memo.save
|
||||
@memo
|
||||
end
|
||||
|
||||
#课程留言列表
|
||||
def course_messages params,current_user
|
||||
@course = ::Course.find(params[:id])
|
||||
if (current_user.admin? || @course.is_public == 1 || (@course.is_public == 0 && current_user.member_of_course?(@course)))
|
||||
@jours = @course.journals_for_messages.where('m_parent_id IS NULL').order('created_on DESC')
|
||||
else
|
||||
raise '403'
|
||||
end
|
||||
@jours
|
||||
end
|
||||
|
||||
end
|
|
@ -1,13 +1,14 @@
|
|||
#coding=utf-8
|
||||
class CoursesService
|
||||
include ApplicationHelper
|
||||
include CoursesHelper
|
||||
include HomeworkAttachHelper
|
||||
include ApiHelper
|
||||
#TODO:尚未整合权限系统
|
||||
|
||||
#参数school_id为0或不传时返回所有课程,否则返回对应学校的课程
|
||||
#参数per_page_count分页功能,每页显示的课程数
|
||||
#参数page分页功能,当前页码
|
||||
def course_list params
|
||||
def course_list params,current_user
|
||||
@school_id = params[:school_id]
|
||||
per_page_option = params[:per_page_count] || 10
|
||||
page_no = params[:page] || 1
|
||||
|
@ -25,13 +26,13 @@ class CoursesService
|
|||
@courses = @courses.offset(@course_pages.offset).limit(@course_pages.per_page)
|
||||
course_list = []
|
||||
@courses.each do |course|
|
||||
course_list << {:course => course,:img_url => url_to_avatar(course)}
|
||||
course_list << {:course => course,: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)}
|
||||
end
|
||||
course_list
|
||||
end
|
||||
|
||||
#搜索课程
|
||||
def search_course params
|
||||
def search_course params,current_user
|
||||
courses_all = Course.all_course
|
||||
name = params[:name]
|
||||
if name.blank?
|
||||
|
@ -44,6 +45,11 @@ class CoursesService
|
|||
@courses_all = @courses;
|
||||
end
|
||||
@courses_all
|
||||
course_list = []
|
||||
@courses_all.each do |course|
|
||||
course_list << {:course => course,: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)}
|
||||
end
|
||||
course_list
|
||||
end
|
||||
|
||||
#获取头像
|
||||
|
@ -117,7 +123,7 @@ class CoursesService
|
|||
scope = @course ? @course.news.course_visible(current_user) : News.course_visible(current_user)
|
||||
news = []
|
||||
scope.each do |n|
|
||||
news << {:title => n.title,:author_name => n.author.name,:author_id => n.author.id, :description => n.description,:created_on => format_time(n.created_on),:comments_count => n.comments_count}
|
||||
news << {:id => n.id,:title => n.title,:author_name => n.author.name,:author_id => n.author.id, :description => n.description,:created_on => format_time(n.created_on),:comments_count => n.comments_count}
|
||||
end
|
||||
news
|
||||
end
|
||||
|
@ -153,12 +159,12 @@ class CoursesService
|
|||
|
||||
|
||||
#显示课程
|
||||
def show_course(params,currnet_user)
|
||||
def show_course(params,current_user)
|
||||
course = Course.find(params[:id])
|
||||
unless (course.is_public == 1 || currnet_user.member_of_course?(@course)|| currnet_user.admin?)
|
||||
unless (course.is_public == 1 || current_user.member_of_course?(course) || current_user.admin?)
|
||||
raise '403'
|
||||
end
|
||||
course
|
||||
{:course => course,: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)}
|
||||
end
|
||||
|
||||
#创建课程
|
||||
|
@ -206,7 +212,7 @@ class CoursesService
|
|||
@course.members << m
|
||||
@course.course_infos << course
|
||||
end
|
||||
@course
|
||||
{:course => @course,: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)}
|
||||
end
|
||||
|
||||
#验证编辑课程的权限
|
||||
|
@ -243,7 +249,7 @@ class CoursesService
|
|||
course_status = CourseStatus.create(:course_id => course.id, :grade => 0)
|
||||
end
|
||||
end
|
||||
course
|
||||
{:course => course,: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)}
|
||||
end
|
||||
|
||||
#退出课程
|
||||
|
@ -328,24 +334,84 @@ class CoursesService
|
|||
end
|
||||
|
||||
def course_dynamic(params,current_user)
|
||||
course = Course.find(params[:id])
|
||||
if current_user.nil? || !(current_user.admin? || course.is_public == 1 || (course.is_public == 0 && current_user.member_of_course?(course)))
|
||||
raise '403'
|
||||
|
||||
@user = User.find(params[:id])
|
||||
if !current_user.admin? && !@user.active?
|
||||
raise '404'
|
||||
return
|
||||
end
|
||||
count,is_teacher = get_course_anonymous_evaluation current_user,course
|
||||
if is_teacher
|
||||
student_commit_number = count
|
||||
if current_user == @user || current_user.admin?
|
||||
membership = @user.coursememberships.all
|
||||
else
|
||||
need_anonymous_comments_count = count
|
||||
membership = @user.coursememberships.all(:conditions => Course.visible_condition(current_user))
|
||||
end
|
||||
news_count = course.news.count
|
||||
message_count = course.journals_for_messages.count
|
||||
{:course_name => course.name,:need_anonymous_comments_count=>need_anonymous_comments_count,:student_commit_number=>student_commit_number,:news_count=> news_count,:message_count=>message_count}
|
||||
if membership.nil? || membership.count == 0
|
||||
raise l(:label_no_courses,:locale => current_user.language.nil? ? 'zh':current_user.language)
|
||||
end
|
||||
membership.sort! {|older, newer| newer.created_on <=> older.created_on }
|
||||
result = []
|
||||
membership.each do |mp|
|
||||
course = mp.course
|
||||
latest_course_dynamics = []
|
||||
latest_news = course.news.order("created_on desc").first
|
||||
unless latest_news.nil?
|
||||
latest_course_dynamics << {:type => 1,:time => latest_news.created_on,:message => '最近更新了通知' }#l(:label_recently_updated_notification,:locale => current_user.language.nil? ? 'zh':current_user.language)}
|
||||
end
|
||||
latest_message = course.journals_for_messages.order("created_on desc").first
|
||||
unless latest_message.nil?
|
||||
latest_course_dynamics << {:type => 2,:time => latest_message.created_on,:message => '最近更新了留言'}#l(:label_recently_updated_message,:locale => current_user.language.nil? ? 'zh':current_user.language)}
|
||||
end
|
||||
latest_attachment = course.attachments.order("created_on desc").first
|
||||
unless latest_attachment.nil?
|
||||
latest_course_dynamics << {:type => 3,:time => latest_attachment.created_on,:message => '最近更新了课件'}#l(:label_recently_updated_courseware,:locale => current_user.language.nil? ? 'zh':current_user.language)}
|
||||
end
|
||||
latest_bid = course.homeworks.order('updated_on DESC').first
|
||||
unless latest_bid.nil?
|
||||
latest_course_dynamics << {:type => 4,:time => latest_bid.updated_on,:message => '最近更新了作业'}#l(:label_recently_updated_homework,:locale => current_user.language.nil? ? 'zh':current_user.language)}
|
||||
end
|
||||
#每个作业中的最新留言
|
||||
messages = []
|
||||
course.homeworks.each do |bid|
|
||||
jour = bid.journals_for_messages.order("created_on desc").first
|
||||
unless jour.nil?
|
||||
messages << jour
|
||||
end
|
||||
end
|
||||
unless messages.count == 0
|
||||
messages.sort!{|order,newer| newer.created_on <=> order.created_on}
|
||||
end
|
||||
latest_bid_message = messages.first
|
||||
unless latest_bid_message.nil?
|
||||
latest_course_dynamics << {:type => 2,:time => latest_bid_message.created_on,:message => '最近更新了留言'}#l(:label_recently_updated_message,:locale => current_user.language.nil? ? 'zh':current_user.language)}
|
||||
end
|
||||
#每个作业中学生最后提交的作业
|
||||
homeworks = []
|
||||
course.homeworks.each do |bid|
|
||||
homework_attach = bid.homeworks.order('updated_at DESC').first
|
||||
unless homework_attach.nil?
|
||||
homeworks << homework_attach
|
||||
end
|
||||
end
|
||||
unless homeworks.count == 0
|
||||
homeworks.sort!{|order,newer| newer.updated_at <=> order.updated_at}
|
||||
end
|
||||
latest_homework_attach = homeworks.first
|
||||
unless latest_homework_attach.nil?
|
||||
latest_course_dynamics << {:type => 4,:time => latest_homework_attach.updated_at,:message => '最近更新了作业'}#l(:label_recently_updated_homework,:locale => current_user.language.nil? ? 'zh':current_user.language)}
|
||||
end
|
||||
latest_course_dynamics.sort!{|order,newer| newer[:time] <=> order[:time]}
|
||||
latest_course_dynamic = latest_course_dynamics.first
|
||||
unless latest_course_dynamic.nil?
|
||||
result << {:course_name => course.name,:course_id => course.id,:course_img_url => url_to_avatar(course),:type => latest_course_dynamic[:type],:update_time => latest_course_dynamic[:time],:message => latest_course_dynamic[:message],:count => nil}
|
||||
end
|
||||
end
|
||||
result.sort!{|order,newer| newer[:update_time] <=> order[:update_time]}
|
||||
result
|
||||
end
|
||||
|
||||
private
|
||||
def show_homework_info course,bid,current_user,is_course_teacher
|
||||
author = bid.author.lastname + bid.author.firstname
|
||||
author_real_name = bid.author.lastname + bid.author.firstname
|
||||
many_times = course.homeworks.index(bid) + 1
|
||||
name = bid.name
|
||||
homework_count = bid.homeworks.count #已提交的作业数量
|
||||
|
@ -358,8 +424,9 @@ class CoursesService
|
|||
end
|
||||
#end
|
||||
open_anonymous_evaluation = bid.open_anonymous_evaluation
|
||||
{:course_name => course.name,:id => bid.id, :course_teacher => author, :homework_times => many_times, :homework_name => name, :homework_count => homework_count,:student_questions_count => student_questions_count,
|
||||
:description => description, :homework_state => state,:open_anonymous_evaluation => open_anonymous_evaluation,:homework_for_anonymous_comments => homework_for_anonymous_comments}
|
||||
{:course_name => course.name,:course_id => course.id,:id => bid.id, :author => bid.author,:author_real_name => author_real_name, :homework_times => many_times, :homework_name => name, :homework_count => homework_count,:student_questions_count => student_questions_count,
|
||||
:description => description, :homework_state => state,:open_anonymous_evaluation => open_anonymous_evaluation,:homework_for_anonymous_comments => homework_for_anonymous_comments,:created_on => bid.created_on,:deadline => bid.deadline}
|
||||
|
||||
end
|
||||
|
||||
#显示作业列表的同时显示分配给当前学生匿评的作业
|
||||
|
|
|
@ -6,6 +6,7 @@ class HomeworkService
|
|||
include WordsHelper
|
||||
include ApiHelper
|
||||
include HomeworkAttachHelper
|
||||
include CoursesHelper
|
||||
|
||||
# 作业详情(老师才显示启动匿评,学生不显示 )
|
||||
# many_times 第几次(作业)
|
||||
|
@ -25,8 +26,9 @@ class HomeworkService
|
|||
state = @bid.comment_status
|
||||
#end
|
||||
open_anonymous_evaluation = @bid.open_anonymous_evaluation
|
||||
{:course_name => course.name,:id => @bid.id, :course_teacher => author, :homework_times => many_times, :homework_name => name, :homework_count => homework_count,:student_questions_count => student_questions_count,
|
||||
:description => description, :homework_state => state,:open_anonymous_evaluation => open_anonymous_evaluation}
|
||||
jours = @bid.journals_for_messages.where('m_parent_id IS NULL').order('created_on DESC')
|
||||
{:course_name => course.name,:course_id => course.id,:id => @bid.id, :author => @bid.author,:author_real_name =>author, :homework_times => many_times, :homework_name => name, :homework_count => homework_count,:student_questions_count => student_questions_count,
|
||||
:description => description, :homework_state => state,:open_anonymous_evaluation => open_anonymous_evaluation,:created_on => @bid.created_on,:deadline => @bid.deadline,:jours => jours}
|
||||
end
|
||||
|
||||
# 启动作业匿评前提示信息
|
||||
|
@ -115,7 +117,7 @@ class HomeworkService
|
|||
@is_anonymous_comments = @bid.comment_status == 1 && !@homework.users.include?(current_user) && @homework.user != current_user && !@is_teacher #判断是不是匿评(开启匿评,当前用户不是作业的创建者或者参与者,不是老师)
|
||||
jours = @homework.journals_for_messages.where("is_comprehensive_evaluation = 3 or is_comprehensive_evaluation is null").order("created_on DESC")#jours留言 is null条件用以兼容历史数据
|
||||
#@jour = paginateHelper jours,5 #留言
|
||||
#@cur_page = params[:cur_page] || 1
|
||||
@cur_page = params[:cur_page] || 1
|
||||
@cur_type = params[:cur_type] || 5
|
||||
teacher_stars_json_like = stars_to_json_like(@teacher_stars,true,@homework,true)
|
||||
student_stars_json_like = stars_to_json_like(@student_stars,false,@homework,(false || @is_teacher))
|
||||
|
@ -124,7 +126,7 @@ class HomeworkService
|
|||
end
|
||||
|
||||
[@homework,{:is_teacher => @is_teacher,:m_score => @m_score,:jours => jours,:teacher_stars => teacher_stars_json_like,
|
||||
:student_stars => student_stars_json_like,:is_anonymous_comments => @is_anonymous_comments,:cur_type => @cur_type}]
|
||||
:student_stars => student_stars_json_like,:is_anonymous_comments => @is_anonymous_comments,:cur_type => @cur_type,:cur_page => @cur_page}]
|
||||
#name = @homework.name
|
||||
#desc = @homework.description
|
||||
#datetime = @homework.created_at
|
||||
|
@ -273,10 +275,26 @@ class HomeworkService
|
|||
membership.each do |mp|
|
||||
my_homeworks = []
|
||||
mp.course.homeworks.each do |bid|
|
||||
hw = bid.homeworks.where("user_id = #{current_user.id}")
|
||||
my_homeworks << hw[0] unless (hw.nil? || hw[0].nil?)
|
||||
#hw = bid.homeworks.where("user_id = #{current_user.id}")
|
||||
@bid = bid
|
||||
course = @bid.courses.first
|
||||
author = @bid.author.lastname + @bid.author.firstname
|
||||
many_times = course.homeworks.index(@bid) + 1
|
||||
name = @bid.name
|
||||
homework_count = @bid.homeworks.count #已提交的作业数量
|
||||
student_questions_count = @bid.commit.nil? ? 0 : @bid.commit
|
||||
description = @bid.description
|
||||
#if is_course_teacher(User.current, course) && @bid.open_anonymous_evaluation == 1 && @bid.homeworks.count >= 2
|
||||
state = @bid.comment_status
|
||||
#end
|
||||
open_anonymous_evaluation = @bid.open_anonymous_evaluation
|
||||
|
||||
my_homeworks << {:course_name => course.name,:id => @bid.id, :author => @bid.author,:author_real_name =>author, :homework_times => many_times, :homework_name => name, :homework_count => homework_count,:student_questions_count => student_questions_count,
|
||||
:description => description, :homework_state => state,:open_anonymous_evaluation => open_anonymous_evaluation}
|
||||
end
|
||||
if mp.course.homeworks.count != 0
|
||||
course_list << {:course => mp.course,:img_url => url_to_avatar(mp.course),:my_homework => my_homeworks,:current_user_is_member => current_user.member_of_course?(mp.course),:current_user_is_teacher => is_course_teacher(current_user,mp.course)}
|
||||
end
|
||||
course_list << {:course => mp.course,:img_url => url_to_avatar(mp.course),:my_homework => my_homeworks}
|
||||
end
|
||||
course_list
|
||||
end
|
||||
|
|
|
@ -44,7 +44,31 @@ class UsersService
|
|||
#location = get_user_location @user
|
||||
#{:id => @user.id, :img_url => img_url, :nickname => @user.login, :gender => gender, :work_unit => work_unit, :mail => @user.mail, :location => location, :brief_introduction => @user.user_extensions.brief_introduction}
|
||||
end
|
||||
def register_auto(login,mail,password)
|
||||
@user = User.new
|
||||
@user.admin = false
|
||||
@user.register
|
||||
@user.login = login
|
||||
@user.mail =mail
|
||||
password_confirmation = password
|
||||
should_confirmation_password = true
|
||||
if !password.blank? && !password_confirmation.blank? && should_confirmation_password
|
||||
@user.password, @user.password_confirmation = password, password_confirmation
|
||||
elsif !password.blank? && !should_confirmation_password
|
||||
@user.password = password
|
||||
else
|
||||
@user.password = ""
|
||||
end
|
||||
|
||||
@user = automatically_register(@user)
|
||||
|
||||
if @user.id != nil
|
||||
ue = @user.user_extensions ||= UserExtensions.new
|
||||
ue.user_id = @user.id
|
||||
ue.save
|
||||
end
|
||||
@user
|
||||
end
|
||||
#显示用户
|
||||
#id用户id
|
||||
def show_user(params)
|
||||
|
@ -134,7 +158,7 @@ class UsersService
|
|||
membership.sort! {|older, newer| newer.created_on <=> older.created_on }
|
||||
course_list = []
|
||||
membership.each do |mp|
|
||||
course_list << {:course => mp.course,:img_url => url_to_avatar(mp.course)}
|
||||
course_list << {:course => mp.course,:img_url => url_to_avatar(mp.course),:current_user_is_member => current_user.member_of_course?(mp.course),:current_user_is_teacher => is_course_teacher(current_user,mp.course)}
|
||||
end
|
||||
course_list
|
||||
end
|
||||
|
|
|
@ -1,7 +1,12 @@
|
|||
#coding=utf-8
|
||||
class WatchesService
|
||||
def watch params
|
||||
@current_user = User.find(params[:current_user_id])
|
||||
if params[:object_type] == 'user' && params[:current_user_id] == params[:object_id]
|
||||
raise '不能关注自己!'
|
||||
end
|
||||
@watchables = find_watchables params
|
||||
|
||||
if @watchables.nil?
|
||||
raise '404'
|
||||
end
|
||||
|
|
|
@ -33,7 +33,4 @@
|
|||
<%= submit_tag l(:button_save), :class => "small", :name => nil %>
|
||||
<% end %>
|
||||
<div>
|
||||
|
||||
|
||||
|
||||
</div>
|
|
@ -0,0 +1,55 @@
|
|||
<h3><%= l(:label_mobile_version) %></h3>
|
||||
<a href="javascript:void(0)" onclick="$('#new_version').slideToggle(400); ">发布新版本</a>
|
||||
<div>
|
||||
<form id="new_version" style="display: none">
|
||||
发布新版本
|
||||
</form>
|
||||
</div>
|
||||
<br/>
|
||||
<div>当前版本:</div>
|
||||
<table class="list">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><%=l(:label_version_number)%></th>
|
||||
<th><%=l(:label_version_description)%></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% if @versions.count > 0 %>
|
||||
<tr class="<%= cycle("odd", "even") %>">
|
||||
<td><%= @versions.first.version %></td>
|
||||
<td align="center" style="width: 70%">
|
||||
<%= @versions.first.description %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<br/>
|
||||
|
||||
<div>历史版本:</div>
|
||||
<table class="list">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><%=l(:label_version_number)%></th>
|
||||
<th><%=l(:label_version_description)%></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% if @versions.count > 0 %>
|
||||
<% for version in @versions %>
|
||||
<tr class="<%= cycle("odd", "even") %>">
|
||||
<td><%= version.version %></td>
|
||||
<td align="center" style="width: 70%">
|
||||
<%= version.description %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<!-- <div class="pagination"><#%= pagination_links_full @role_pages %></div> -->
|
||||
|
||||
<% html_title(l(:label_mobile_version)) -%>
|
|
@ -0,0 +1,43 @@
|
|||
<div class="contextual">
|
||||
<%= link_to l(:label_organization_new), new_organization_path, :class => 'icon icon-add' %>
|
||||
</div>
|
||||
|
||||
<h3>
|
||||
<%=l(:label_organization_list)%>
|
||||
</h3>
|
||||
|
||||
<div class="autoscroll">
|
||||
<table class="list" style="width: 100%;table-layout: fixed">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>
|
||||
<%=l(:label_organization)%>
|
||||
</th>
|
||||
<th>
|
||||
<%=l(:field_created_on)%>
|
||||
</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% @organizations.each do |org|%>
|
||||
<tr class="<%= cycle("odd", "even") %>">
|
||||
<td style="text-align:center;white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" class="name" title='<%=org.name%>'>
|
||||
<span>
|
||||
<%= link_to org.name,home_path(:organization => org.id) %>
|
||||
</span>
|
||||
</td>
|
||||
<td align="center">
|
||||
<%= format_date(org.created_at) %>
|
||||
</td>
|
||||
<td class="buttons">
|
||||
<%= link_to(l(:button_change), edit_organization_path(org.id), :class => 'icon icon-copy') %>
|
||||
<%= link_to(l(:button_delete), organization_path(org.id), :method => :delete,:confirm => l(:text_are_you_sure), :class => 'icon icon-del') %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end%>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<% html_title(l(:label_project_plural)) -%>
|
|
@ -2,13 +2,22 @@
|
|||
<%= link_to l(:label_project_new), {:controller => 'projects', :action => 'new'}, :class => 'icon icon-add' %>
|
||||
</div>
|
||||
|
||||
<h3><%=l(:label_project_plural)%></h3>
|
||||
<h3>
|
||||
<%=l(:label_project_plural)%>
|
||||
</h3>
|
||||
|
||||
<%= form_tag({}, :method => :get) do %>
|
||||
<fieldset><legend><%= l(:label_filter_plural) %></legend>
|
||||
<label for='status'><%= l(:field_status) %> :</label>
|
||||
<fieldset>
|
||||
<legend>
|
||||
<%= l(:label_filter_plural) %>
|
||||
</legend>
|
||||
<label for='status'>
|
||||
<%= l(:field_status) %> :
|
||||
</label>
|
||||
<%= select_tag 'status', project_status_options_for_select(@status), :class => "small", :onchange => "this.form.submit(); return false;" %>
|
||||
<label for='name'><%= l(:label_project) %>:</label>
|
||||
<label for='name'>
|
||||
<%= l(:label_project) %>:
|
||||
</label>
|
||||
<%= text_field_tag 'name', params[:name], :size => 30 %>
|
||||
<%= submit_tag l(:button_apply), :class => "small", :name => nil %>
|
||||
<%= link_to l(:button_clear), {:controller => 'admin', :action => 'projects'}, :class => 'icon icon-reload' %>
|
||||
|
@ -19,17 +28,31 @@
|
|||
<div class="autoscroll">
|
||||
<table class="list" style="width: 100%;table-layout: fixed">
|
||||
<thead><tr>
|
||||
<th><%=l(:label_project)%></th>
|
||||
<th><%=l(:field_is_public)%></th>
|
||||
<th><%=l(:field_created_on)%></th>
|
||||
<th>
|
||||
<%=l(:label_project)%>
|
||||
</th>
|
||||
<th>
|
||||
<%=l(:field_is_public)%>
|
||||
</th>
|
||||
<th>
|
||||
<%=l(:field_created_on)%>
|
||||
</th>
|
||||
<th></th>
|
||||
</tr></thead>
|
||||
<tbody>
|
||||
<% project_tree(@projects) do |project, level| %>
|
||||
<tr class="<%= cycle("odd", "even") %> <%= project.css_classes %> <%= level > 0 ? "idnt idnt-#{level}" : nil %>">
|
||||
<td style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" class="name" title='<%=project.name%>'><span><%= link_to_project_settings(project, {}) %></span></td>
|
||||
<td align="center"><%= checked_image project.is_public? %></td>
|
||||
<td align="center"><%= format_date(project.created_on) %></td>
|
||||
<td style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" class="name" title='<%=project.name%>'>
|
||||
<span>
|
||||
<%= link_to_project_settings(project, {}) %>
|
||||
</span>
|
||||
</td>
|
||||
<td align="center">
|
||||
<%= checked_image project.is_public? %>
|
||||
</td>
|
||||
<td align="center">
|
||||
<%= format_date(project.created_on) %>
|
||||
</td>
|
||||
<td class="buttons">
|
||||
<%= link_to(l(:button_archive), { :controller => 'projects', :action => 'archive', :id => project, :status => params[:status] }, :data => {:confirm => l(:text_are_you_sure)}, :method => :post, :class => 'icon icon-lock') unless project.archived? %>
|
||||
<%= link_to(l(:button_unarchive), { :controller => 'projects', :action => 'unarchive', :id => project, :status => params[:status] }, :method => :post, :class => 'icon icon-unlock') if project.archived? && (project.parent.nil? || !project.parent.archived?) %>
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
// file.click();
|
||||
// }
|
||||
</script>
|
||||
<% project = project %>
|
||||
<span class="add_attachment" style="font-weight:normal;">
|
||||
<%#= button_tag "浏览", :type=>"button", :onclick=>"CompatibleSend();" %>
|
||||
<!--%= link_to image_tag(),"javascript:void(0)", :onclick => "_file.click()"%-->
|
||||
|
@ -41,7 +42,7 @@
|
|||
:max_file_size => Setting.attachment_max_size.to_i.kilobytes,
|
||||
:max_file_size_message => l(:error_attachment_too_big, :max_size => number_to_human_size(Setting.attachment_max_size.to_i.kilobytes)),
|
||||
:max_concurrent_uploads => Redmine::Configuration['max_concurrent_ajax_uploads'].to_i,
|
||||
:upload_path => uploads_path(:format => 'js'),
|
||||
:upload_path => uploads_path(:format => 'js',:project =>project),
|
||||
:description_placeholder => l(:label_optional_description)
|
||||
} %>
|
||||
<span id="upload_file_count">
|
||||
|
|
|
@ -9,11 +9,8 @@
|
|||
</script>
|
||||
<div id="add-message" class="add_frame" style="display:none;">
|
||||
<% if User.current.logged? %>
|
||||
<h3>
|
||||
<%= link_to h(@board.name), project_board_path(@project, @board) %> » <%= l(:label_message_new) %>
|
||||
</h3>
|
||||
<div class="add_frame_header">
|
||||
<%= l(:label_message_new) %>
|
||||
<div class="project_r_h">
|
||||
<h2 class="project_h2"><%= l(:label_message_new) %></h2>
|
||||
</div>
|
||||
<%= form_for @message, :url => new_board_message_path(@board), :html => {:multipart => true, :id => 'message-form'} do |f| %>
|
||||
<%= render :partial => 'messages/form', :locals => {:f => f} %>
|
||||
|
@ -27,8 +24,8 @@
|
|||
</div>
|
||||
|
||||
<!--display the board-->
|
||||
<div class="borad-title">
|
||||
<%= h @board.name %>
|
||||
<div class="project_r_h">
|
||||
<h2 class="project_h2"><%= h @board.name %></h2>
|
||||
</div>
|
||||
|
||||
<% if !User.current.logged? %>
|
||||
|
@ -48,7 +45,7 @@
|
|||
<%= link_to @topic_count,:controller => 'boards',:action => 'index' %>
|
||||
个贴子
|
||||
</span>
|
||||
<% if @project.enabled_modules.where("name = 'boards'").count > 0 %>
|
||||
<% if @project.enabled_modules.where("name = 'boards'").count > 0 && User.current.member_of?(@project) %>
|
||||
<span>
|
||||
<%= link_to l(:label_message_new),
|
||||
new_board_message_path(@board),
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
<h3><%= @query.new_record? ? l(:label_calendar) : h(@query.name) %></h3>
|
||||
<div class="project_r_h">
|
||||
<h2 class="project_h2"><%= @query.new_record? ? l(:label_calendar) : h(@query.name) %></h2>
|
||||
</div>
|
||||
|
||||
<%= form_tag({:controller => 'calendars', :action => 'show', :project_id => @project},
|
||||
:method => :get, :id => 'query_form') do %>
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
<div class="project_r_h">
|
||||
<h2 class="project_h2"><%=l(:label_document_plural)%></h2>
|
||||
</div>
|
||||
<div class="contextual">
|
||||
<!--Moved by young-->
|
||||
<%= l(:label_documents_sort) %>
|
||||
|
@ -24,8 +27,6 @@
|
|||
<% end %>
|
||||
</div>
|
||||
|
||||
<h3><%=l(:label_document_plural)%></h3>
|
||||
|
||||
<% if @grouped.empty? %>
|
||||
<p class="nodata">
|
||||
<%= l(:label_no_data) %>
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
<div class="project_r_h">
|
||||
<h2 class="project_h2"><%=h @document.title %></h2>
|
||||
</div>
|
||||
<div class="frame-wiki">
|
||||
|
||||
<div class="contextual">
|
||||
|
@ -9,7 +12,6 @@
|
|||
<% end %>
|
||||
</div>
|
||||
|
||||
<h2 style="word-wrap: break-word; word-break: normal;"><%=h @document.title %></h2>
|
||||
|
||||
<p><em><%#=h @document.category.name %><br />
|
||||
<%= format_date @document.created_on %></em></p>
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
|
||||
</p>
|
||||
|
||||
<p><%=l(:label_attachment_plural)%></label><%= render :partial => 'attachments/form' %></p>
|
||||
<p><%=l(:label_attachment_plural)%></label><%= render :partial => 'attachments/form', locals: {project: project} %></p>
|
||||
</div>
|
||||
<%= submit_tag l(:button_add) %>
|
||||
<% end %>
|
||||
|
|
|
@ -1,11 +1,8 @@
|
|||
|
||||
<% attachmenttypes = @project.attachmenttypes %>
|
||||
<% sufixtypes = @project.contenttypes %>
|
||||
|
||||
<span class="borad-title">
|
||||
<%= (@project.project_type == 1) ? t(:label_user_course) : t(:label_project) %>
|
||||
资源共享区
|
||||
</span>
|
||||
<div class="project_r_h">
|
||||
<h2 class="project_h2">资源共享区</h2>
|
||||
</div>
|
||||
|
||||
<div class="content-title-top">
|
||||
<%#= link_to(l(:label_attachment_new), 'javascript:void(0);', :onclick=>"$('#file_buttons').slideToggle();", :class => 'icon icon-add') if User.current.allowed_to?(:manage_files, @project) %>
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
<!-- <h3> --><!-- %=l(:label_attachment_plural)%></h3 -->
|
||||
<div id="resource_list">
|
||||
<% if @isproject %>
|
||||
<%= render :partial => 'project_file', locals: {project: @project} %>
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
<h3><%=l(:label_attachment_new)%></h3>
|
||||
<div class="project_r_h">
|
||||
<h2 class="project_h2"><%=l(:label_attachment_new)%></h2>
|
||||
</div>
|
||||
|
||||
<%= error_messages_for 'attachment' %>
|
||||
<%= form_tag(project_files_path(@project), :multipart => true, :class => "tabular") do %>
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
<% @gantt.view = self %>
|
||||
<h3><%= @query.new_record? ? l(:label_gantt) : h(@query.name) %></h3>
|
||||
<div class="project_r_h">
|
||||
<h2 class="project_h2"><% @gantt.view = self %>
|
||||
<%= @query.new_record? ? l(:label_gantt) : h(@query.name) %></h2>
|
||||
</div>
|
||||
|
||||
<%= form_tag({:controller => 'gantts', :action => 'show',
|
||||
:project_id => @project, :month => params[:month],
|
||||
|
|
|
@ -0,0 +1,139 @@
|
|||
<div class="project_r_h">
|
||||
<h2 class="project_h2">问题跟踪</h2>
|
||||
</div>
|
||||
<div class="problem_top">
|
||||
<% if @project.enabled_modules.where("name = 'issue_tracking'").count > 0 %>
|
||||
<span>
|
||||
<% if User.current.member_of?(@project) %>
|
||||
<%= link_to l(:label_issue_new), {:controller => 'issues', :action => 'new', :copy_from => nil}, :param => :project_id, :caption => :label_issue_new,
|
||||
:html => {:accesskey => Redmine::AccessKeys.key_for(:new_issue)}, :class => 'icon icon-add' %>
|
||||
<% end %>
|
||||
<%= link_to l(:label_query), '#', :class => 'icon icon-help',
|
||||
:onclick => '$("#custom_query").slideToggle(400); ' if true || User.current.logged? %>
|
||||
</span>
|
||||
<% end %>
|
||||
<span class="problem_p fr">问题总数:<span><%= @project.issues.count %></span> 未解决:<span><%= @project.issues.where('status_id in (1,2,4,6)').count %></span></span>
|
||||
</div>
|
||||
<div class="contextual">
|
||||
<% if !@query.new_record? && @query.editable_by?(User.current) %>
|
||||
<%= link_to l(:button_edit), edit_query_path(@query), :class => 'icon icon-edit' %>
|
||||
<%= delete_link query_path(@query) %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<% html_title(@query.new_record? ? l(:label_issue_plural) : @query.name) %>
|
||||
<div style="clear:right; ">
|
||||
<%= form_tag({:controller => 'issues', :action => 'index', :project_id => @project}, :method => :get, :id => 'query_form', :class => 'query_form') do %>
|
||||
<%= hidden_field_tag 'set_filter', '1' %>
|
||||
|
||||
<div id="custom_query" class="custom_query" style="display: <%= !params[:utf8].blank? ? 'block' : 'none' %>;">
|
||||
<span>---<%= l :label_query_new %>---</span>
|
||||
|
||||
<div id="query_form_content" class="hide-when-print">
|
||||
<fieldset id="filters" class="collapsible <%= @query.new_record? ? "" : "collapsed" %>">
|
||||
<legend onclick="toggleFieldset(this);">
|
||||
<%= l(:label_issue_query_condition) %>
|
||||
</legend>
|
||||
<div style="<%= @query.new_record? ? "" : "display: none;" %>">
|
||||
<%= render :partial => 'queries/filters', :locals => {:query => @query} %>
|
||||
</div>
|
||||
</fieldset>
|
||||
<!--
|
||||
<fieldset class="collapsible collapsed">
|
||||
<legend onclick="toggleFieldset(this);">
|
||||
<%= l(:label_options) %>
|
||||
</legend>
|
||||
<div style="display: none;">
|
||||
<table>
|
||||
<tr>
|
||||
<td><%= l(:field_column_names) %></td>
|
||||
<td><%= render_query_columns_selection(@query) %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><label for='group_by'><%= l(:field_group_by) %></label></td>
|
||||
<td><%= select_tag('group_by', options_for_select([[]] + @query.groupable_columns.collect { |c| [c.caption, c.name.to_s] }, @query.group_by)) %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><%= l(:button_show) %></td>
|
||||
<td><%= available_block_columns_tags(@query) %></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</fieldset>
|
||||
-->
|
||||
<div class="buttons hide-when-print">
|
||||
<%= link_to_function l(:label_issue_query), 'submit_query_form("query_form")', :class => 'icon icon-checked' %>
|
||||
<%= link_to l(:label_issue_cancel_query), {:set_filter => 1, :project_id => @project}, :class => 'icon icon-reload' %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<%= error_messages_for 'query' %>
|
||||
|
||||
<% if @query.valid? %>
|
||||
<% if @issues.empty? %>
|
||||
<p class="nodata">
|
||||
<%= l(:label_no_data) %>
|
||||
</p>
|
||||
<% else %>
|
||||
<%= render :partial => 'issues/list', :locals => {:issues => @issues, :query => @query} %>
|
||||
<div class="pagination">
|
||||
<ul><%= pagination_links_full @issue_pages, @issue_count %></ul>
|
||||
</div>
|
||||
<% end %>
|
||||
<div style="float: right; padding-top: 30px">
|
||||
<% other_formats_links do |f| %>
|
||||
<%= f.link_to 'Atom', :url => params.merge(:key => User.current.rss_key) %>
|
||||
<%= f.link_to 'CSV', :url => params, :onclick => "showModal('csv-export-options', '330px'); return false;" %>
|
||||
<%= f.link_to 'PDF', :url => params %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
|
||||
<div id="csv-export-options" style="display:none;">
|
||||
<h3 class="title"><%= l(:label_export_options, :export_format => 'CSV') %></h3>
|
||||
<%= form_tag(params.merge({:format => 'csv', :page => nil}), :method => :get, :id => 'csv-export-form') do %>
|
||||
<p>
|
||||
<label>
|
||||
<%= radio_button_tag 'columns', 'all' %>
|
||||
<%= l(:description_all_columns) %>
|
||||
</label>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<label>
|
||||
<%= check_box_tag 'description', '1', @query.has_column?(:description) %>
|
||||
<%= l(:field_description) %>
|
||||
</label>
|
||||
</p>
|
||||
|
||||
<p class="buttons">
|
||||
<%= submit_tag l(:button_export), :name => nil, :onclick => "hideModal(this);" %>
|
||||
<%= submit_tag l(:button_cancel), :name => nil, :onclick => "hideModal(this);", :type => 'button' %>
|
||||
</p>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<% end %>
|
||||
|
||||
<%= call_hook(:view_issues_index_bottom, {:issues => @issues, :project => @project, :query => @query}) %>
|
||||
|
||||
<% content_for :sidebar do %>
|
||||
<%= render :partial => 'issues/sidebar' %>
|
||||
<% end %>
|
||||
|
||||
<% content_for :header_tags do %>
|
||||
<%= auto_discovery_link_tag(:atom,
|
||||
{:query_id => @query, :format => 'atom',
|
||||
:page => nil, :key => User.current.rss_key},
|
||||
:title => l(:label_issue_plural)) %>
|
||||
<%= auto_discovery_link_tag(:atom,
|
||||
{:controller => 'journals', :action => 'index',
|
||||
:query_id => @query, :format => 'atom',
|
||||
:page => nil, :key => User.current.rss_key},
|
||||
:title => l(:label_changes_details)) %>
|
||||
<% end %>
|
||||
|
||||
<%= context_menu issues_context_menu_path %>
|
|
@ -1,135 +1 @@
|
|||
<div class="content-title-top">
|
||||
<% if @project.enabled_modules.where("name = 'issue_tracking'").count > 0 %>
|
||||
<div>
|
||||
<%= link_to l(:label_issue_new), {:controller => 'issues', :action => 'new', :copy_from => nil}, :param => :project_id, :caption => :label_issue_new,
|
||||
:html => {:accesskey => Redmine::AccessKeys.key_for(:new_issue)}, :class => 'icon icon-add' %>
|
||||
|
||||
<%= link_to l(:label_query), '#', :class => 'icon icon-help',
|
||||
:onclick => '$("#custom_query").slideToggle(400); ' if true || User.current.logged? %>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<div class="contextual">
|
||||
<% if !@query.new_record? && @query.editable_by?(User.current) %>
|
||||
<%= link_to l(:button_edit), edit_query_path(@query), :class => 'icon icon-edit' %>
|
||||
<%= delete_link query_path(@query) %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<% html_title(@query.new_record? ? l(:label_issue_plural) : @query.name) %>
|
||||
<div style="clear:right; ">
|
||||
<%= form_tag({:controller => 'issues', :action => 'index', :project_id => @project}, :method => :get, :id => 'query_form', :class => 'query_form') do %>
|
||||
<%= hidden_field_tag 'set_filter', '1' %>
|
||||
|
||||
<div id="custom_query" class="custom_query" style="display: <%= !params[:utf8].blank? ? 'block' : 'none' %>;">
|
||||
<span>---<%= l :label_query_new %>---</span>
|
||||
|
||||
<div id="query_form_content" class="hide-when-print">
|
||||
<fieldset id="filters" class="collapsible <%= @query.new_record? ? "" : "collapsed" %>">
|
||||
<legend onclick="toggleFieldset(this);">
|
||||
<%= l(:label_issue_query_condition) %>
|
||||
</legend>
|
||||
<div style="<%= @query.new_record? ? "" : "display: none;" %>">
|
||||
<%= render :partial => 'queries/filters', :locals => {:query => @query} %>
|
||||
</div>
|
||||
</fieldset>
|
||||
<!--
|
||||
<fieldset class="collapsible collapsed">
|
||||
<legend onclick="toggleFieldset(this);">
|
||||
<%= l(:label_options) %>
|
||||
</legend>
|
||||
<div style="display: none;">
|
||||
<table>
|
||||
<tr>
|
||||
<td><%= l(:field_column_names) %></td>
|
||||
<td><%= render_query_columns_selection(@query) %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><label for='group_by'><%= l(:field_group_by) %></label></td>
|
||||
<td><%= select_tag('group_by', options_for_select([[]] + @query.groupable_columns.collect { |c| [c.caption, c.name.to_s] }, @query.group_by)) %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><%= l(:button_show) %></td>
|
||||
<td><%= available_block_columns_tags(@query) %></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</fieldset>
|
||||
-->
|
||||
<div class="buttons hide-when-print">
|
||||
<%= link_to_function l(:label_issue_query), 'submit_query_form("query_form")', :class => 'icon icon-checked' %>
|
||||
<%= link_to l(:label_issue_cancel_query), {:set_filter => 1, :project_id => @project}, :class => 'icon icon-reload' %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<%= error_messages_for 'query' %>
|
||||
|
||||
<% if @query.valid? %>
|
||||
<% if @issues.empty? %>
|
||||
<p class="nodata">
|
||||
<%= l(:label_no_data) %>
|
||||
</p>
|
||||
<% else %>
|
||||
<%= render :partial => 'issues/list', :locals => {:issues => @issues, :query => @query} %>
|
||||
<div class="pagination">
|
||||
<ul><%= pagination_links_full @issue_pages, @issue_count %></ul>
|
||||
</div>
|
||||
<% end %>
|
||||
<div style="float: right; padding-top: 30px">
|
||||
<% other_formats_links do |f| %>
|
||||
<%= f.link_to 'Atom', :url => params.merge(:key => User.current.rss_key) %>
|
||||
<%= f.link_to 'CSV', :url => params, :onclick => "showModal('csv-export-options', '330px'); return false;" %>
|
||||
<%= f.link_to 'PDF', :url => params %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
|
||||
<div id="csv-export-options" style="display:none;">
|
||||
<h3 class="title"><%= l(:label_export_options, :export_format => 'CSV') %></h3>
|
||||
<%= form_tag(params.merge({:format => 'csv', :page => nil}), :method => :get, :id => 'csv-export-form') do %>
|
||||
<p>
|
||||
<label>
|
||||
<%= radio_button_tag 'columns', 'all' %>
|
||||
<%= l(:description_all_columns) %>
|
||||
</label>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<label>
|
||||
<%= check_box_tag 'description', '1', @query.has_column?(:description) %>
|
||||
<%= l(:field_description) %>
|
||||
</label>
|
||||
</p>
|
||||
|
||||
<p class="buttons">
|
||||
<%= submit_tag l(:button_export), :name => nil, :onclick => "hideModal(this);" %>
|
||||
<%= submit_tag l(:button_cancel), :name => nil, :onclick => "hideModal(this);", :type => 'button' %>
|
||||
</p>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<% end %>
|
||||
|
||||
<%= call_hook(:view_issues_index_bottom, {:issues => @issues, :project => @project, :query => @query}) %>
|
||||
|
||||
<% content_for :sidebar do %>
|
||||
<%= render :partial => 'issues/sidebar' %>
|
||||
<% end %>
|
||||
|
||||
<% content_for :header_tags do %>
|
||||
<%= auto_discovery_link_tag(:atom,
|
||||
{:query_id => @query, :format => 'atom',
|
||||
:page => nil, :key => User.current.rss_key},
|
||||
:title => l(:label_issue_plural)) %>
|
||||
<%= auto_discovery_link_tag(:atom,
|
||||
{:controller => 'journals', :action => 'index',
|
||||
:query_id => @query, :format => 'atom',
|
||||
:page => nil, :key => User.current.rss_key},
|
||||
:title => l(:label_changes_details)) %>
|
||||
<% end %>
|
||||
|
||||
<%= context_menu issues_context_menu_path %>
|
||||
<%= render :partial => 'issues/newissue_index' %>
|
|
@ -0,0 +1 @@
|
|||
$('#content').html('<%= escape_javascript(render :partial => 'issues/newissue_index') %>');
|
|
@ -1,3 +1,6 @@
|
|||
<div class="project_r_h">
|
||||
<h2 class="project_h2">问题跟踪</h2>
|
||||
</div>
|
||||
<%= call_hook(:view_issues_new_top, {:issue => @issue}) %>
|
||||
|
||||
<%= labelled_form_for @issue, :url => project_issues_path(@project),
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
<div class="project_r_h">
|
||||
<h2 class="project_h2"><%= l(:label_issue_plural) %></h2>
|
||||
</div>
|
||||
<%# html_title "#{@issue.tracker.name} ##{@issue.id}: #{@issue.subject}" %>
|
||||
|
||||
<% html_title "#{@issue.tracker.name} #{@issue.source_from}: #{@issue.subject}" %>
|
||||
<% html_title "#{@issue.tracker.name} #{@issue.source_from}'#'#{@issue.project_index}: #{@issue.subject}" %>
|
||||
|
||||
<%= render :partial => 'action_menu' %>
|
||||
|
||||
|
@ -87,7 +89,7 @@ end %>
|
|||
<%= render_custom_fields_rows(@issue) %>
|
||||
<%= call_hook(:view_issues_show_details_bottom, :issue => @issue) %>
|
||||
</table>
|
||||
|
||||
woca
|
||||
<% if @issue.description? || @issue.attachments.any? -%>
|
||||
<hr />
|
||||
<% if @issue.description? %>
|
||||
|
|
|
@ -9,5 +9,5 @@
|
|||
<%= link_to_unless page.current?, page, url, {:remote => remote, :rel => page.next? ? 'next' : page.prev? ? 'prev' : nil}
|
||||
-%>
|
||||
|
||||
<%= link_to_unless page.current?, page, url, {:remote => remote, :rel => page.next? ? 'next' : page.prev? ? 'prev' : nil} %>
|
||||
<%= link_to page, url, page.current? ? {:remote => remote,:class => 'current-page', :rel => page.next? ? 'next' : page.prev? ? 'prev' : nil} : {:remote => remote, :rel => page.next? ? 'next' : page.prev? ? 'prev' : nil} %>
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
paginator: the paginator that renders the pagination tags inside
|
||||
-%>
|
||||
<%= paginator.render do -%>
|
||||
<div class="pagination">
|
||||
<div id="paginator" class="pagination">
|
||||
<%= first_page_tag unless current_page.first? %>
|
||||
<%= prev_page_tag unless current_page.first? %>
|
||||
<% each_page do |page| -%>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<style type="text/css">
|
||||
#scrollsidebar{ font-size:12px; font-family:"微软雅黑","宋体"; line-height:1.9; background:#fff; font-style:normal;}
|
||||
#scrollsidebar{ font-size:12px; font-family:"微软雅黑","宋体"; line-height:1.9; background:#F6F7F8; font-style:normal;}
|
||||
#scrollsidebar div,html,img,ul,li,p,body,h1,h2,h3,h4,p,a,table,tr,td,fieldset,input,span,ol{ }
|
||||
#scrollsidebar div,img,tr,td,table{ border:0;}
|
||||
#scrollsidebar ol,ul,li{ list-style-type:none}
|
||||
|
@ -7,26 +7,24 @@
|
|||
#scrollsidebar a{ text-decoration:none;}
|
||||
|
||||
html{ overflow-x:hidden;}
|
||||
.custom_service p img {display: inline; margin-top:-5px; vertical-align:middle;}
|
||||
.scrollsidebar{position:absolute; z-index:999; top:150px;background:none !important;}
|
||||
.scrollsidebar{ position:absolute;top:1px; right:1px; background:none; }
|
||||
.side_content{width:154px; height:auto; overflow:hidden; float:left; }
|
||||
.side_content .side_list {width:154px;overflow:hidden;}
|
||||
.show_btn{ width:0; height:112px; overflow:hidden; margin-top:50px; float:left; cursor:pointer;}
|
||||
.show_btn{ width:0; height:112px; overflow:hidden; float:left; cursor:pointer;}
|
||||
.show_btn span { display:none;}
|
||||
.close_btn{width:24px;height:24px;cursor:pointer;}
|
||||
.side_title,.side_bottom,.close_btn,.show_btn {background:url(/images/sidebar_bg.png) no-repeat; }
|
||||
.side_title {height:46px;}
|
||||
.side_title {height:35px;}
|
||||
.side_bottom { height:8px;}
|
||||
.side_center {font-family:Verdana, Geneva, sans-serif; padding:5px 12px; font-size:12px;}
|
||||
.close_btn { float:right; display:block; width:21px; height:16px; margin:16px 10px 0 0; _margin:16px 5px 0 0;}
|
||||
.side_center {font-family:Verdana, Geneva, sans-serif; padding:0px 12px; font-size:12px;}
|
||||
.close_btn { float:right; display:block; width:21px; height:16px; margin:9px 10px 0 0; _margin:16px 5px 0 0;}
|
||||
.close_btn span { display:none;}
|
||||
.side_center .custom_service p { text-align:center; padding:6px 0; margin:0; vertical-align:middle;}
|
||||
.msgserver { margin:10px 0 4px 4px;}
|
||||
.msgserver { margin:2px 0px 0px 4px; padding-top: 0px}
|
||||
.msgserver a { background:url(/images/sidebar_bg.png) no-repeat -119px -115px; padding-left:22px;}
|
||||
.opnionText{ width:120px; height:180px; border-color:#cecece; -moz-border-radius:5px; -webkit-border-radius:5px; border-radius:5px; color:#999; padding:3px;}
|
||||
a.opnionButton{ display:block; font-weight: bold; margin:-25px auto 0; text-align:center;}
|
||||
a:hover.opnionButton{ text-decoration:underline;}
|
||||
|
||||
.opnionText{ width:122px; height:180px; border-color: #DFDFDF; background:#fff; color:#999; padding:3px; font-size:12px;}
|
||||
.opnionButton{ display:block; background:#15bccf; width:130px; height:23px; margin-top:5px; text-align:center; padding-top:3px;}
|
||||
.opnionButton:hover{background: #0fa9bb; }
|
||||
|
||||
/* blue skin as the default skin */
|
||||
.side_title {background-position:-195px 0;}
|
||||
|
@ -87,21 +85,6 @@ a:hover.opnionButton{ text-decoration:underline;}
|
|||
show_btn.css('width', 25);
|
||||
|
||||
}
|
||||
//???????
|
||||
if(options.skin) thisBox.addClass('side_'+options.skin);
|
||||
|
||||
|
||||
//????scroll???
|
||||
$(window).bind("scroll",function(){
|
||||
var offsetTop = defaultTop + $(window).scrollTop() + "px";
|
||||
thisBox.animate({
|
||||
top: offsetTop
|
||||
},
|
||||
{
|
||||
duration: options.durationTime,
|
||||
queue: false //???????????????????
|
||||
});
|
||||
});
|
||||
//close???
|
||||
closeBtn.bind("click",function(){
|
||||
sideContent.animate({width: '0px'},"fast");
|
||||
|
@ -186,14 +169,12 @@ function cookieget(n)
|
|||
<%= f.text_area :subject, :class => "opnionText",:placeholder => "有什么想说的,尽管来咆哮吧~~"%>
|
||||
<%= f.hidden_field :content, :required => true ,:value=>'该贴来自用户反馈!'%>
|
||||
<%#= f.submit :value => l(:label_memo_create), :class => "opnionButton", :id => "button1" %>
|
||||
<a href="javascript:void(0);" class="opnionButton" style=" color:#fd6e2a;" id="" onclick="f_submit();">提 交</a>
|
||||
<a href="javascript:void(0);" class="opnionButton" style=" color:#fff;" id="" onclick="f_submit();">提 交</a>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="msgserver">
|
||||
<p>
|
||||
<a href="http://user.trustie.net/users/12/user_newfeedback" style="color: #15BCCF;"><%= l(:label_technical_support) %>黄井泉</a></br>
|
||||
<a href="http://user.trustie.net/users/12/user_newfeedback" style="color: #15BCCF;"><%= l(:label_technical_support) %>黄井泉</a>
|
||||
<a href="http://user.trustie.net/users/34/user_newfeedback" style="color: #15BCCF;"><%= l(:label_technical_support) %>白 羽</a>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="side_bottom"></div>
|
||||
|
|
|
@ -40,17 +40,14 @@
|
|||
</div>
|
||||
<div class="debug">
|
||||
<%= debug(params) if Rails.env.development? %>
|
||||
<div class="hidden">
|
||||
<script>
|
||||
|
||||
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
|
||||
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
|
||||
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
|
||||
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
|
||||
|
||||
ga('create', 'UA-46523987-1', 'trustie.net');
|
||||
ga('send', 'pageview');
|
||||
|
||||
var _hmt = _hmt || [];
|
||||
(function() {
|
||||
var hm = document.createElement("script");
|
||||
hm.src = "//hm.baidu.com/hm.js?67e9738474be83f55f1233001a6ac34e";
|
||||
var s = document.getElementsByTagName("script")[0];
|
||||
s.parentNode.insertBefore(hm, s);
|
||||
})();
|
||||
</script>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -1,19 +1,13 @@
|
|||
<div style="margin-left: 20px;">
|
||||
|
||||
<div class="pr_info_join fl">
|
||||
<!--关注项目-->
|
||||
<% if ( !(User.current.member_of? @project) && User.current.login?) %> <!--added by linchun-->
|
||||
<span class="icon-fav icon"></span><%= watcher_link(@project, User.current) %>
|
||||
<span><%= watcher_link(@project, User.current) %></span>
|
||||
<% end %>
|
||||
</div>
|
||||
<!--添加项目申请-->
|
||||
<div style="margin-left: 20px;">
|
||||
<!--加入项目 -->
|
||||
<% if ( !(User.current.member_of? @project) && User.current.login?) %>
|
||||
<span class="icon-fav icon"></span>
|
||||
<%= applied_link(@project, User.current) %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<!--添加退出项目-->
|
||||
<div style="margin-left: 20px;">
|
||||
<!--退出项目-->
|
||||
<% if ((User.current.member_of? @project) &&
|
||||
User.current.login? &&
|
||||
Member.where(:user_id => User.current.id, :project_id=>@project.id).first.roles.first.to_s != "Manager") %>
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
<% @nav_dispaly_project_label = 1
|
||||
@nav_dispaly_forum_label = 1 %>
|
||||
<%#@nav_dispaly_project_label = 1 %>
|
||||
|
@ -30,14 +29,8 @@
|
|||
<div class="top-content">
|
||||
<table>
|
||||
<tr>
|
||||
<td class="info_font" style="width: 240px;" rowspan="2">
|
||||
<a href="http://<%= Setting.host_name%>" style="color: #15bccf;">
|
||||
<%= l(:label_projects_community)%>
|
||||
</a>
|
||||
</td>
|
||||
<td style="width: 430px; color: #15bccf">
|
||||
<strong><%= l(:label_user_location) %> : </strong>
|
||||
</td>
|
||||
<td class="info_font" style="width: 240px;" rowspan="2"><a href="http://<%= Setting.host_name%>" style="color: #15bccf;"> 软件项目托管社区 </a></td>
|
||||
<td style="width: 430px; color: #15bccf"><strong><%= l(:label_user_location) %> : </strong></td>
|
||||
<td rowspan="2" width="250px">
|
||||
<div class="top-content-search">
|
||||
<script type="text/javascript">
|
||||
|
@ -67,129 +60,138 @@
|
|||
<%= text_field_tag 'name', params[:name], :size => 20, :onkeyup => "regexName();", :style => "float:left" %>
|
||||
<%= hidden_field_tag 'project_type', params[:project_type] %>
|
||||
<%#= submit_tag l(:label_search), :class => "enterprise", :name => nil %>
|
||||
<a href="#" onclick="submitSerch();" class="ButtonColor m3p10" style="float:left;padding-top: 3px; margin: 0px;padding-bottom:0px;" >
|
||||
<%= l(:label_search)%>
|
||||
</a>
|
||||
<a href="#" onclick="submitSerch();" class="ButtonColor m3p10" style="float:left;padding-top: 3px; margin: 0px;padding-bottom:0px;" > <%= l(:label_search)%> </a>
|
||||
<br />
|
||||
<span id="project_name_span" style="float: left"></span>
|
||||
<% end %>
|
||||
</div>
|
||||
</td>
|
||||
</div></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p class="top-content-list">
|
||||
<%= link_to l(:label_home),home_path %> >
|
||||
<%= link_to @project, project_path(@project) %>
|
||||
</p>
|
||||
</td>
|
||||
</p></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<!-- 左边侧栏内容 -->
|
||||
<div id="sidebar">
|
||||
<div class="spaceleft">
|
||||
<div class="inf_user_image">
|
||||
<% @project = Project.find_by_id(@project.id)%>
|
||||
<table>
|
||||
<tr>
|
||||
<td>
|
||||
<%= image_tag(url_to_avatar(@project), :class => 'avatar2') %>
|
||||
</td>
|
||||
<td>
|
||||
<div class="info-course">
|
||||
<%= link_to @project.name, project_path(@project)%>
|
||||
</div>
|
||||
<div>
|
||||
<script type="text/javascript">
|
||||
$(function() {
|
||||
$(".subNav").click(function() {
|
||||
$(this).toggleClass("currentDd").siblings(".subNav").removeClass("currentDd")
|
||||
$(this).toggleClass("currentDt").siblings(".subNav").removeClass("currentDt")
|
||||
|
||||
// 修改数字控制速度, slideUp(500)控制卷起速度
|
||||
$(this).next(".navContent").slideToggle(500).siblings(".navContent").slideUp(500);
|
||||
})
|
||||
})
|
||||
</script>
|
||||
<div class="project_left">
|
||||
<div class="project_info">
|
||||
<div class="pr_info_logo fl mr10 mb5">
|
||||
<%= image_tag(url_to_avatar(@project), :style => 'width:61px; height:61px;') %>
|
||||
</div>
|
||||
<div class="pr_info_id fl mb5">
|
||||
ID:<%= @project.id %>
|
||||
</div>
|
||||
<!--关注、申请加入/退出项目-->
|
||||
<div id="join_exit_project_div">
|
||||
<%= render 'layouts/join_exit_project' %>
|
||||
</div>
|
||||
<!-- 项目得分 -->
|
||||
<div class="cl"></div>
|
||||
<div class="pr_info_name">
|
||||
<%= link_to @project.name, project_path(@project) %>
|
||||
<% if !@project.is_public? %>
|
||||
<span class="img_private">私有</span>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<div class="pr_info_score">
|
||||
<% if @project.project_type == 0 %>
|
||||
<%= l(:label_project_grade)%> :
|
||||
<%= link_to(format("%.2f" ,project_scores(@project) ).to_i, {:controller => 'projects',
|
||||
:action => 'show_projects_score',
|
||||
:remote => true,
|
||||
:id => @project.id
|
||||
}, :style => "color: #EC6300;")%>
|
||||
:id => @project.id },
|
||||
:style => "color: #EC6300;")%>
|
||||
<% end %>
|
||||
<!-- end -->
|
||||
</div>
|
||||
<div id="join_exit_project_div">
|
||||
<%= render 'layouts/join_exit_project' %>
|
||||
<div class="pr_info_foot">
|
||||
<%= l(:label_member) %>(<a class="info_foot_num" href="#" target="_blank"><%= link_to "#{@project.members.count}", project_member_path(@project) %></a>)
|
||||
<span>| </span><%= l(:label_user_watchered) %>(<a class="info_foot_num" href="#" target="_blank"><%= link_to @project.watcher_users.count, :controller=>"projects", :action=>"watcherlist", :id => @project %></a>)
|
||||
<span>| </span><%= l(:project_module_attachments) %>(<a class="info_foot_num" href="#" target="_blank"><%= link_to "#{@project.attachments.count}", project_files_path(@project) %></a>)</div>
|
||||
<div class="cl"></div>
|
||||
</div><!--项目信息 end-->
|
||||
|
||||
<div class="subNavBox">
|
||||
<% if User.current.member_of?(@project) %>
|
||||
<div class="subNav currentDd currentDt subNav_jiantou">邀请</div>
|
||||
<ul class="navContent " style="display:block; padding-left: 0px; margin-top:0px;">
|
||||
<li><%= link_to "发送邮件邀请新用户", :controller=>"projects", :action=>"invite_members_by_mail", :id => @project %></li>
|
||||
<li><%= link_to "邀请Trustie注册用户", :controller=>"projects", :action=>"invite_members", :id => @project %></li>
|
||||
</ul>
|
||||
<% end %>
|
||||
<div class="subNav">
|
||||
<%= link_to l(:label_activity), {:controller => 'projects', :action => 'show', :id => @project.id}, :style => "color:#3CA5C6" %>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<div class="subNav">
|
||||
<%= link_to l(:label_issue_tracking), project_issues_path(@project), :style => "color:#3CA5C6" %><span class="subnav_num">(<%= @project.issues.count %>)</span>
|
||||
<span>
|
||||
<% if User.current.logged? && User.current.member_of?(@project) %>
|
||||
<%= link_to "+发布问题", new_project_issue_path(@project) , :style => "font-size:12px;color:#fff; padding:1px 3px 3px 3px;height:18px;margin-top:3px;background:#28be6c;float:right;line-height:20px;" %></span>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="subNav">
|
||||
<%= link_to "讨论区", project_boards_path(@project), :style => "color:#3CA5C6" %>
|
||||
<span class="subnav_num">(<%= @project.boards.first.topics.count %>)</span>
|
||||
<% if User.current.logged? && User.current.member_of?(@project) %>
|
||||
<%= link_to "+发贴", new_board_message_path(@project.boards.first, true), :layout => 'base_projects',:style => "font-size:12px;color:#fff; padding:1px 3px 3px 3px;height:18px;margin-top:4px;background:#28be6c;float:right;line-height:20px;" %>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="subNav">
|
||||
<%= link_to l(:label_course_file), project_files_path(@project), :style => "color:#3CA5C6" %><span class="subnav_num">(<%= @project.attachments.count %>)</span>
|
||||
<% if User.current.logged? && User.current.member_of?(@project) %>
|
||||
<%= link_to "+上传资源", new_project_file_path(@project),:style => "font-size:12px;color:#fff; padding:1px 3px 3px 3px;height:18px;margin-top:3px;background:#28be6c;float:right;line-height:20px;" %>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="subNav">
|
||||
<%= link_to l(:field_user_active_changeset), {:controller => 'repositories', :action => 'show', :id => @project.id}, :style => "color:#3CA5C6" %>
|
||||
<span class="subnav_num">(<%= @project.repositories.count %>)</span>
|
||||
<% if User.current.logged? && User.current.member_of?(@project) %>
|
||||
<%= link_to "+创建版本库", new_project_repository_path(@project),:style => "font-size:12px;color:#fff; padding:1px 3px 3px 3px;height:18px;margin-top:3px;background:#28be6c;float:right;line-height:20px;" %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<div class="user_fans">
|
||||
<table width="240" border="0">
|
||||
<tr align="center" width="80px">
|
||||
<% files_count = @project.attachments.count %>
|
||||
<% @project.versions.each do |version| %>
|
||||
<% files_count += version.attachments.count %>
|
||||
<% end %>
|
||||
<td class="font_index">
|
||||
<%=link_to "#{@project.members.count}", project_member_path(@project) %>
|
||||
</td>
|
||||
<td class="font_index">
|
||||
<%=link_to @project.watcher_users.count, :controller=>"projects", :action=>"watcherlist", :id => @project %>
|
||||
</td>
|
||||
<!-- 项目sidebar栏显示问题数目为项目总问题数排除已关闭和已解决的项目问题数,即排除3(已解决),5(已关闭)的 项目问题数 !-->
|
||||
<td class="font_index">
|
||||
<%=link_to "#{@project.issues.where('status_id in (1,2,4,6)').count}", project_issues_path(@project) %>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="font_aram">
|
||||
<td align="center" width="70px">
|
||||
<%= l(:label_member) %>
|
||||
</td>
|
||||
<td align="center" width="100px">
|
||||
<%= l(:label_user_watchered) %>
|
||||
</td>
|
||||
<td align="center" width="70px">
|
||||
<%= l(:label_project_issues) %>
|
||||
</td>
|
||||
<!-- <td align="center" width="58px"><%#= l(:label_attachment) %></td> -->
|
||||
</tr>
|
||||
</table>
|
||||
<div class="user_underline"></div>
|
||||
<div class="subNav subNav_jiantou"><%= l(:label_more) %></div>
|
||||
<ul class="navContent" style="padding-left: 0px">
|
||||
<%= render 'projects/tools_expand' %>
|
||||
</ul>
|
||||
</div><!--项目侧导航 end-->
|
||||
<div class="cl"></div>
|
||||
<div class="project_intro">
|
||||
<h4 class="project_h4">项目简介:</h4><%= @project.description %>
|
||||
<div class="lg-foot">
|
||||
展开更多信息 <span class="g-arr-down"><img src="/images/new_project/jiantou.jpg" width="12" height="6" /></span>
|
||||
</div>
|
||||
<div class="inf_user_context">
|
||||
<div class="font_title_left">
|
||||
<%= l(:label_project_overview) %>
|
||||
</div>
|
||||
<div style="padding-bottom: 8px">
|
||||
<div class="font_lighter_sidebar" style="word-break:break-all;word-wrap: break-word;">
|
||||
<%= textilizable @project.description %>
|
||||
</div>
|
||||
<div class="created_on_project">
|
||||
<strong style="color: #15bccf">
|
||||
<%= l(:label_create_time) %>:
|
||||
</strong>
|
||||
<%= format_time(@project.created_on) %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="user_underline"></div>
|
||||
</div>
|
||||
<!--tags-->
|
||||
<div class="user_fans">
|
||||
<!-- added by william -for tag -->
|
||||
</div><!--项目简介 end-->
|
||||
<div class="project_Label">
|
||||
<h4 class="project_h4">标签:</h4>
|
||||
<div class="tag_h" >
|
||||
<div class="user_tags">
|
||||
<div id="tags">
|
||||
<%= render :partial => 'tags/tag', :locals => {:obj => @project,:object_flag => "2"}%>
|
||||
<%= render :partial => 'tags/project_tag', :locals => {:obj => @project,:object_flag => "2"}%>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!--tool-->
|
||||
<div class="user_underline"></div>
|
||||
<div class="tool">
|
||||
<%= render 'projects/tools_expand' %>
|
||||
</div>
|
||||
<div class="user_underline"></div>
|
||||
<div class="cl"></div>
|
||||
</div><!--项目标签 end-->
|
||||
</div>
|
||||
</div>
|
||||
<div id="content">
|
||||
<div class="tabs_new">
|
||||
<%= render_main_menu(@project) %>
|
||||
</div>
|
||||
|
||||
<%= render_flash_messages %>
|
||||
<%= yield %>
|
||||
<%= call_hook :view_layouts_base_content %>
|
||||
|
|
|
@ -0,0 +1,373 @@
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="content">
|
||||
<h4 class="wmail_h4" style="color:#474646; font-size:14px; margin-bottom:5px;" >
|
||||
<%= @subject %>
|
||||
</h4>
|
||||
<% if @attachments.first || @course_news.first || @bids.first ||
|
||||
@homeworks.first || @course_journal_messages.first|| @course_messages.first %>
|
||||
<div class="wmail_main" style="padding:20px 10px 0px;">
|
||||
<h2 class="wmail_h2" style="color:#15bccf; "><%= l(:label_course_overview)%></h2>
|
||||
<% unless @course_news.first.nil? %>
|
||||
<ul class="wmail_ul" style=" list-style-type:none;clear: both;margin-left:10px; border-bottom:1px dashed #cfcfcf; padding-bottom:15px; width:720px; margin-bottom:15px;">
|
||||
|
||||
<h4 class="wmail_h4" style="color:#474646; font-size:14px; margin-bottom:5px;" >
|
||||
<%= l(:label_course_news) %>
|
||||
<span class="wmail_num" style="color:#fe3f0c; margin-left:5px; font-weight:normal;">(<%= @course_news.count %>)</span>
|
||||
</h4>
|
||||
|
||||
<% @course_news.each do |course_new|%>
|
||||
<li style="clear: both; list-style: none;">
|
||||
<span class="wmail_dis" style="float:left; color:#000000; margin-right:5px;">▪</span>
|
||||
<span class="wmail_b" style="color:#1b55a7; font-weight:bold; float:left;">[</span>
|
||||
|
||||
<%= link_to truncate(course_new.course.name,length: 30,omission: '...'), course_url(course_new.course, :token => @token.value),
|
||||
:class=> "wmail_column",
|
||||
:style=> " font-weight: bold; display:block; float:left; color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %>
|
||||
<span class="wmail_b" style="color:#1b55a7; font-weight:bold; float:left;">]</span>
|
||||
|
||||
<%= link_to course_new.author, user_activities_url(course_new.author,:token => @token.value), :class => "wmail_name",
|
||||
:style => "color:#fe5722; float:left;display:block; margin-right:5px; margin-left:5px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"%>
|
||||
<span class="wmail_txt" style="float:left; margin-right:5px;color:#6e6e6e;"><%= l(:label_project_notice) %></span>
|
||||
|
||||
<%= link_to truncate(course_new.title,length: 30,omission: '...'), news_url(course_new,:token => @token.value),
|
||||
:class => 'wmail_info',
|
||||
:style => "color:#5a5a5a; float:left; margin-right:5px; display:block;color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"
|
||||
%>
|
||||
<span class="wmail_date" style="color:#6e6e6e; float:right;display:block; margin-left:10px;"><%= format_time(course_new.created_on) %></span>
|
||||
</li>
|
||||
<% end %>
|
||||
|
||||
<div class="cl"></div>
|
||||
</ul><!--课程动态 end-->
|
||||
<% end %>
|
||||
<% if !@bids.first.nil? || !@homeworks.first.nil? %>
|
||||
<ul class="wmail_ul" style="clear: both;margin-left:10px; border-bottom:1px dashed #cfcfcf; padding-bottom:15px; width:720px; margin-bottom:15px;">
|
||||
|
||||
<h4 class="wmail_h4" style="color:#474646; font-size:14px; margin-bottom:5px;"><%= l(:label_homework_overview) %><span class="wmail_num" style="color:#fe3f0c; margin-left:5px; font-weight:normal;">(<%= @bids.count %>)</span></h4>
|
||||
<% unless @bids.first.nil?%>
|
||||
<% @bids.each do |bid| %>
|
||||
<li style="clear: both; list-style: none;">
|
||||
<span class="wmail_dis" style="float:left; color:#000000; margin-right:5px;">▪</span>
|
||||
<span class="wmail_b" style="color:#1b55a7; font-weight:bold; float:left;">[</span>
|
||||
|
||||
<%= link_to truncate(bid.courses.first.name,length: 30,omission: '...'), course_url(bid.courses.first, :token => @token.value),
|
||||
:class=> "wmail_column",
|
||||
:style=> " font-weight: bold; display:block; float:left; color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %>
|
||||
<span class="wmail_b" style="color:#1b55a7; font-weight:bold; float:left;">]</span>
|
||||
|
||||
<%= link_to bid.author, user_activities_url(bid.author,:token => @token.value), :class => "wmail_name",
|
||||
:style => "color:#fe5722; float:left;display:block; margin-right:5px; margin-left:5px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"%>
|
||||
<span class="wmail_txt" style="float:left; margin-right:5px;color:#6e6e6e;"><%= l(:label_course_homework) %></span>
|
||||
|
||||
<%= link_to truncate(bid.name,length: 30,omission: '...'), course_for_bid_url(:id => bid.id,:token => @token.value),
|
||||
:class => 'wmail_info',
|
||||
:style => "color:#5a5a5a; float:left; margin-right:5px; display:block;color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"
|
||||
%>
|
||||
<span class="wmail_date" style="color:#6e6e6e; float:right;display:block; margin-left:10px;"><%= format_time(bid.created_on) %></span>
|
||||
</li>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% unless @homeworks.first.nil? %>
|
||||
<% @homeworks.each do |homework| %>
|
||||
<li style="clear: both; list-style: none;">
|
||||
<span class="wmail_dis" style="float:left; color:#000000; margin-right:5px;">▪</span>
|
||||
<span class="wmail_b" style="color:#1b55a7; font-weight:bold; float:left;">[</span>
|
||||
|
||||
<%= link_to truncate(homework.bid.courses.first.name,length: 30,omission: '...'), course_url(homework.bid.courses.first, :token => @token.value),
|
||||
:class=> "wmail_column",
|
||||
:style=> " font-weight: bold; display:block; float:left; color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %>
|
||||
<span class="wmail_b" style="color:#1b55a7; font-weight:bold; float:left;">]</span>
|
||||
|
||||
<%= link_to homework.user, user_activities_url(homework.user,:token => @token.value), :class => "wmail_name",
|
||||
:style => "color:#fe5722; float:left;display:block; margin-right:5px; margin-left:5px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"%>
|
||||
<span class="wmail_txt" style="float:left; margin-right:5px;color:#6e6e6e;"><%= l(:label_course_submit_homework) %></span>
|
||||
|
||||
<%= link_to truncate(homework.name,length: 30,omission: '...'), course_for_bid_url(:id => homework.bid.id,:token => @token.value),
|
||||
:class => 'wmail_info',
|
||||
:style => "color:#5a5a5a; float:left; margin-right:5px; display:block;color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"
|
||||
%>
|
||||
<span class="wmail_date" style="color:#6e6e6e; float:right;display:block; margin-left:10px;"><%= format_time(homework.created_on) %></span>
|
||||
</li>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
<div class="cl"></div>
|
||||
</ul><!--作业动态 end-->
|
||||
<% end %>
|
||||
|
||||
<% unless @course_journal_messages.first.nil? %>
|
||||
<ul class="wmail_ul" style="clear: both;margin-left:10px; border-bottom:1px dashed #cfcfcf; padding-bottom:15px; width:720px; margin-bottom:15px;">
|
||||
|
||||
<h4 class="wmail_h4" style="color:#474646; font-size:14px; margin-bottom:5px;" >
|
||||
<%= l(:view_course_journals_for_messages) %>
|
||||
<span class="wmail_num" style="color:#fe3f0c; margin-left:5px; font-weight:normal;">(<%= @course_journal_messages.count %>)</span>
|
||||
</h4>
|
||||
|
||||
<% @course_journal_messages.each do |course_journal_message|%>
|
||||
<li style="clear: both; list-style: none;">
|
||||
<span class="wmail_dis" style="float:left; color:#000000; margin-right:5px;">▪</span>
|
||||
<span class="wmail_b" style="color:#1b55a7; font-weight:bold; float:left;">[</span>
|
||||
|
||||
<%= link_to truncate(course_journal_message.course.name,length: 30,omission: '...'), course_url(course_journal_message.course, :token => @token.value),
|
||||
:class=> "wmail_column",
|
||||
:style=> " font-weight: bold; display:block; float:left; color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %>
|
||||
<span class="wmail_b" style="color:#1b55a7; font-weight:bold; float:left;">]</span>
|
||||
|
||||
<%= link_to course_journal_message.user, user_activities_url(course_journal_message.user,:token => @token.value), :class => "wmail_name",
|
||||
:style => "color:#fe5722; float:left;display:block; margin-right:5px; margin-left:5px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"%>
|
||||
<span class="wmail_txt" style="float:left; margin-right:5px;color:#6e6e6e;"><%= l(:label_send_course_journals_for_messages) %></span>
|
||||
|
||||
<%= link_to truncate(course_journal_message.notes,length: 30,omission: '...'), course_feedback_url(course_journal_message.course,:token => @token.value),
|
||||
:class => 'wmail_info',
|
||||
:style => "color:#5a5a5a; float:left; margin-right:5px; display:block;color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"
|
||||
%>
|
||||
<span class="wmail_date" style="color:#6e6e6e; float:right;display:block; margin-left:10px;"><%= format_time(course_journal_message.created_on) %></span>
|
||||
</li>
|
||||
<% end %>
|
||||
|
||||
<div class="cl"></div>
|
||||
</ul><!--课程留言 end-->
|
||||
<% end %>
|
||||
|
||||
<% unless @course_messages.first.nil? %>
|
||||
<ul class="wmail_ul" style="margin-left:10px; border-bottom:1px dashed #cfcfcf; padding-bottom:15px; width:720px; margin-bottom:15px;">
|
||||
|
||||
<h4 class="wmail_h4" style="color:#474646; font-size:14px; margin-bottom:5px;" >
|
||||
<%= l(:view_borad_course) %>
|
||||
<span class="wmail_num" style="color:#fe3f0c; margin-left:5px; font-weight:normal;">(<%= @course_journal_messages.count %>)</span>
|
||||
</h4>
|
||||
|
||||
<% @course_messages.each do |course_message|%>
|
||||
<li style="clear: both; list-style: none;">
|
||||
<span class="wmail_dis" style="float:left; color:#000000; margin-right:5px;">▪</span>
|
||||
<span class="wmail_b" style="color:#1b55a7; font-weight:bold; float:left;">[</span>
|
||||
|
||||
<%= link_to truncate(course_message.course.name,length: 30,omission: '...'), course_url(course_message.course.id, :token => @token.value),
|
||||
:class=> "wmail_column",
|
||||
:style=> " font-weight: bold; display:block; float:left; color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %>
|
||||
<span class="wmail_b" style="color:#1b55a7; font-weight:bold; float:left;">]</span>
|
||||
|
||||
<%= link_to course_message.author, user_activities_url(course_message.author,:token => @token.value), :class => "wmail_name",
|
||||
:style => "color:#fe5722; float:left;display:block; margin-right:5px; margin-left:5px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"%>
|
||||
<span class="wmail_txt" style="float:left; margin-right:5px;color:#6e6e6e;"><%= l(:label_send_course_messages) %></span>
|
||||
|
||||
<%= link_to truncate(course_message.subject,length: 30,omission: '...'),board_message_url(course_message, :board_id => course_message.board_id,:token => @token.value),
|
||||
:class => 'wmail_info',
|
||||
:style => "color:#5a5a5a; float:left; margin-right:5px; display:block;color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"
|
||||
%>
|
||||
<span class="wmail_date" style="color:#6e6e6e; float:right;display:block; margin-left:10px;"><%= format_time(course_message.created_on) %></span>
|
||||
</li>
|
||||
<% end %>
|
||||
|
||||
<div class="cl"></div>
|
||||
</ul><!--课程讨论 end-->
|
||||
<% end %>
|
||||
|
||||
<% unless @attachments.first.nil? %>
|
||||
<ul class="wmail_ul" style="margin-left:10px; border-bottom:1px dashed #cfcfcf; padding-bottom:15px; width:720px; margin-bottom:15px;">
|
||||
<h4 class="wmail_h4" style="color:#474646; font-size:14px; margin-bottom:5px;" >
|
||||
<%= l(:label_course_attendingcontestwork_download) %>
|
||||
<span class="wmail_num" style="color:#fe3f0c; margin-left:5px; font-weight:normal;">(<%= @attachments.count %>)</span>
|
||||
</h4>
|
||||
|
||||
<% @attachments.each do |attachment|%>
|
||||
<li style="clear: both; list-style: none;">
|
||||
<span class="wmail_dis" style="float:left; color:#000000; margin-right:5px;">▪</span>
|
||||
<span class="wmail_b" style="color:#1b55a7; font-weight:bold; float:left;">[</span>
|
||||
|
||||
<%= link_to truncate(attachment.course.name,length: 30,omission: '...'), course_url(attachment.course, :token => @token.value),
|
||||
:class=> "wmail_column",
|
||||
:style=> " font-weight: bold; display:block; float:left; color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %>
|
||||
<span class="wmail_b" style="color:#1b55a7; font-weight:bold; float:left;">]</span>
|
||||
|
||||
<%= link_to attachment.author, user_activities_url(attachment.author,:token => @token.value), :class => "wmail_name",
|
||||
:style => "color:#fe5722; float:left;display:block; margin-right:5px; margin-left:5px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"%>
|
||||
<span class="wmail_txt" style="float:left; margin-right:5px;color:#6e6e6e;"><%= l(:label_course_file_upload) %></span>
|
||||
|
||||
<%= link_to truncate(attachment.filename,length: 30,omission: '...'),course_files_url(attachment.course,:token => @token.value),
|
||||
:class => 'wmail_info',
|
||||
:style => "color:#5a5a5a; float:left; margin-right:5px; display:block;color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"
|
||||
%>
|
||||
<span class="wmail_date" style="color:#6e6e6e; float:right;display:block; margin-left:10px;"><%= format_time(attachment.created_on) %></span>
|
||||
</li>
|
||||
<% end %>
|
||||
<div class="cl"></div>
|
||||
</ul><!--课件下载 end-->
|
||||
<% end %>
|
||||
</div><!--课程动态 end-->
|
||||
<% end %>
|
||||
<% if @issues.first || @project_messages.first %>
|
||||
<div class="wmail_main" style="padding:20px 10px 0px;">
|
||||
<h2 class="wmail_h2" style="color:#15bccf; "><%= l(:label_project_overview_new)%></h2>
|
||||
<% unless @issues.first.nil? %>
|
||||
<ul class="wmail_ul" style="margin-left:10px; border-bottom:1px dashed #cfcfcf; padding-bottom:15px; width:720px; margin-bottom:15px;">
|
||||
<h4 class="wmail_h4" style="color:#474646; font-size:14px; margin-bottom:5px;" >
|
||||
<%= l(:label_issue_tracking) %>
|
||||
<span class="wmail_num" style="color:#fe3f0c; margin-left:5px; font-weight:normal;">(<%= @issues.count %>)</span>
|
||||
</h4>
|
||||
|
||||
<% @issues.each do |issue|%>
|
||||
<li style="clear: both; list-style: none;">
|
||||
<span class="wmail_dis" style="float:left; color:#000000; margin-right:5px;">▪</span>
|
||||
<span class="wmail_b" style="color:#1b55a7; font-weight:bold; float:left;">[</span>
|
||||
|
||||
<%= link_to truncate(issue.project.name,length: 30,omission: '...'), project_url(issue.project, :token => @token.value),
|
||||
:class=> "wmail_column",
|
||||
:style=> " font-weight: bold; display:block; float:left; color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %>
|
||||
<span class="wmail_b" style="color:#1b55a7; font-weight:bold; float:left;">]</span>
|
||||
|
||||
<%= link_to issue.author, user_activities_url(issue.author,:token => @token.value), :class => "wmail_name",
|
||||
:style => "color:#fe5722; float:left;display:block; margin-right:5px; margin-left:5px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"%>
|
||||
<span class="wmail_txt" style="float:left; margin-right:5px;color:#6e6e6e;"><%= l(:label_project_issue) %></span>
|
||||
|
||||
<%= link_to truncate(issue.subject,length: 30,omission: '...'),issue_url(issue, :token => @token.value),
|
||||
:class => 'wmail_info',
|
||||
:style => "color:#5a5a5a; float:left; margin-right:5px; display:block;color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"
|
||||
%>
|
||||
<span class="wmail_date" style="color:#6e6e6e; float:right;display:block; margin-left:10px;"><%= format_time(issue.created_on) %></span>
|
||||
</li>
|
||||
<% end %>
|
||||
|
||||
<div class="cl"></div>
|
||||
</ul><!--问题跟踪 end-->
|
||||
<% end %>
|
||||
|
||||
<% unless @project_messages.first.nil? %>
|
||||
<ul class="wmail_ul" style="margin-left:10px; border-bottom:1px dashed #cfcfcf; padding-bottom:15px; width:720px; margin-bottom:15px;">
|
||||
<h4 class="wmail_h4" style="color:#474646; font-size:14px; margin-bottom:5px;" >
|
||||
<%= l(:project_moule_boards_show) %>
|
||||
<span class="wmail_num" style="color:#fe3f0c; margin-left:5px; font-weight:normal;">(<%= @project_messages.count %>)</span>
|
||||
</h4>
|
||||
|
||||
<% @project_messages.each do |project_message|%>
|
||||
<li style="clear: both; list-style: none;">
|
||||
<span class="wmail_dis" style="float:left; color:#000000; margin-right:5px;">▪</span>
|
||||
<span class="wmail_b" style="color:#1b55a7; font-weight:bold; float:left;">[</span>
|
||||
|
||||
<%= link_to truncate(project_message.project.name,length: 30,omission: '...'), project_url(project_message.project, :token => @token.value),
|
||||
:class=> "wmail_column",
|
||||
:style=> " font-weight: bold; display:block; float:left; color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %>
|
||||
<span class="wmail_b" style="color:#1b55a7; font-weight:bold; float:left;">]</span>
|
||||
|
||||
<%= link_to project_message.author, user_activities_url(project_message.author,:token => @token.value), :class => "wmail_name",
|
||||
:style => "color:#fe5722; float:left;display:block; margin-right:5px; margin-left:5px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"%>
|
||||
<span class="wmail_txt" style="float:left; margin-right:5px;color:#6e6e6e;"><%= l(:label_send_course_messages) %></span>
|
||||
|
||||
<%= link_to truncate(project_message.subject,length: 30,omission: '...'),board_message_url(project_message, :board_id => project_message.board_id,:token => @token.value),
|
||||
:class => 'wmail_info',
|
||||
:style => "color:#5a5a5a; float:left; margin-right:5px; display:block;color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"
|
||||
%>
|
||||
<span class="wmail_date" style="color:#6e6e6e; float:right;display:block; margin-left:10px;"><%= format_time(project_message.created_on) %></span>
|
||||
</li>
|
||||
<% end %>
|
||||
|
||||
<div class="cl"></div>
|
||||
</ul><!--项目论坛 end-->
|
||||
<% end %>
|
||||
|
||||
|
||||
|
||||
</div><!--项目动态 end-->
|
||||
<% end %>
|
||||
<% unless @user_journal_messages.first.nil? %>
|
||||
<div class="wmail_main" style="padding:20px 10px 0px;">
|
||||
<h2 class="wmail_h2" style="color:#15bccf; "><%= l(:label_activities) %></h2>
|
||||
|
||||
<ul class="wmail_ul" style="margin-left:10px; border-bottom:1px dashed #cfcfcf; padding-bottom:15px; width:720px; margin-bottom:15px;">
|
||||
<h4 class="wmail_h4" style="color:#474646; font-size:14px; margin-bottom:5px;" >
|
||||
<%= l(:label_user_message) %>
|
||||
<span class="wmail_num" style="color:#fe3f0c; margin-left:5px; font-weight:normal;">(<%= @user_journal_messages.count %>)</span>
|
||||
</h4>
|
||||
|
||||
<% @user_journal_messages.each do |user_journal_message|%>
|
||||
<li style="clear: both; list-style: none;">
|
||||
<span class="wmail_dis" style="float:left; color:#000000; margin-right:5px;">▪</span>
|
||||
|
||||
<%= link_to user_journal_message.user, user_activities_url(user_journal_message.user,:token => @token.value),
|
||||
:class => "wmail_name",
|
||||
:style => "color:#fe5722; float:left;display:block; margin-right:5px; margin-left:5px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %>
|
||||
<span class="wmail_txt" style="float:left; margin-right:5px;color:#6e6e6e;"><%= l(:label_show_your_message) %></span>
|
||||
|
||||
<%= link_to truncate(user_journal_message.notes,length: 30,omission: '...'),feedback_url(@user,:token => @token.value),
|
||||
:class => 'wmail_info',
|
||||
:style => "color:#5a5a5a; float:left; margin-right:5px; display:block;color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"
|
||||
%>
|
||||
<span class="wmail_date" style="color:#6e6e6e; float:right;display:block; margin-left:10px;"><%= format_time(user_journal_message.created_on) %></span></li>
|
||||
|
||||
<% end %>
|
||||
|
||||
<div class="cl"></div>
|
||||
</ul><!--课程动态 end-->
|
||||
|
||||
</div><!--个人动态 end-->
|
||||
<% end %>
|
||||
<% if @forums.first || @memos.first %>
|
||||
<div class="wmail_main" style="padding:20px 10px 0px;">
|
||||
<h2 class="wmail_h2" style="color:#15bccf; "><%= l(:lable_bar_active) %></h2>
|
||||
<% unless @forums.first.nil? %>
|
||||
<ul class="wmail_ul" style="margin-left:10px; border-bottom:1px dashed #cfcfcf; padding-bottom:15px; width:720px; margin-bottom:15px;">
|
||||
<h4 class="wmail_h4" style="color:#474646; font-size:14px; margin-bottom:5px;" >
|
||||
<%= l(:label_user_forum) %>
|
||||
<span class="wmail_num" style="color:#fe3f0c; margin-left:5px; font-weight:normal;">(<%= @forums.count %>)</span>
|
||||
</h4>
|
||||
|
||||
<% @forums.each do |forum|%>
|
||||
<li style="clear: both; list-style: none;">
|
||||
<span class="wmail_dis" style="float:left; color:#000000; margin-right:5px;">▪</span>
|
||||
|
||||
<%= link_to forum.creator, user_activities_url(forum.creator,:token => @token.value),
|
||||
:class => "wmail_name",
|
||||
:style => "color:#fe5722; float:left;display:block; margin-right:5px; margin-left:5px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %>
|
||||
<span class="wmail_txt" style="float:left; margin-right:5px;color:#6e6e6e;"><%= l(:label_forum_new) %></span>
|
||||
|
||||
<%= link_to truncate(forum.name,length: 30,omission: '...'),forum_url(forum,:token => @token.value),
|
||||
:class => 'wmail_info',
|
||||
:style => "color:#5a5a5a; float:left; margin-right:5px; display:block;color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"
|
||||
%>
|
||||
<span class="wmail_date" style="color:#6e6e6e; float:right;display:block; margin-left:10px;"><%= format_time(forum.created_at) %></span></li>
|
||||
|
||||
<% end %>
|
||||
|
||||
<div class="cl"></div>
|
||||
</ul><!-- 新建贴吧 end-->
|
||||
<% end %>
|
||||
<% unless @memos.first.nil? %>
|
||||
<ul class="wmail_ul" style="margin-left:10px; border-bottom:1px dashed #cfcfcf; padding-bottom:15px; width:720px; margin-bottom:15px;">
|
||||
<h4 class="wmail_h4" style="color:#474646; font-size:14px; margin-bottom:5px;" >
|
||||
<%= l(:label_user_message_forum) %>
|
||||
<span class="wmail_num" style="color:#fe3f0c; margin-left:5px; font-weight:normal;">(<%= @memos.count %>)</span>
|
||||
</h4>
|
||||
|
||||
<% @memos.each do |memo|%>
|
||||
<li style="clear: both; list-style: none;">
|
||||
<span class="wmail_dis" style="float:left; color:#000000; margin-right:5px;">▪</span>
|
||||
|
||||
<%= link_to memo.author, user_activities_url(memo.author,:token => @token.value),
|
||||
:class => "wmail_name",
|
||||
:style => "color:#fe5722; float:left;display:block; margin-right:5px; margin-left:5px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %>
|
||||
<span class="wmail_txt" style="float:left; margin-right:5px;color:#6e6e6e;"><%= memo.parent_id.nil? ? l(:label_memo_new_from_forum) : l(:label_reply) %></span>
|
||||
|
||||
<%= link_to truncate(memo.subject,length: 30,omission: '...'),forum_memo_url(memo.forum, (memo.parent_id.nil? ? memo : memo.parent_id)),
|
||||
:class => 'wmail_info',
|
||||
:style => "color:#5a5a5a; float:left; margin-right:5px; display:block;color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"
|
||||
%>
|
||||
<span class="wmail_date" style="color:#6e6e6e; float:right;display:block; margin-left:10px;"><%= format_time(memo.created_at) %></span></li>
|
||||
|
||||
<% end %>
|
||||
|
||||
<div class="cl"></div>
|
||||
</ul><!-- 新建贴吧 end-->
|
||||
<% end %>
|
||||
</div><!--贴吧动态 end-->
|
||||
<% end %>
|
||||
<div class="wmail_foot" style="margin-top:20px;color:#2775d2; margin-left:10px;">
|
||||
<%= link_to l(:mail_footer), @user_url, :style => "margin-top:20px;color:#2775d2; margin-left:10px;" %>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
|
@ -0,0 +1,296 @@
|
|||
<%= @subject %>
|
||||
<% if @attachments.first || @course_news.first || @bids.first ||
|
||||
@homeworks.first || @course_journal_messages.first|| @course_messages.first %>
|
||||
<%= l(:label_course_overview)%>
|
||||
<% unless @course_news.first.nil? %>
|
||||
<%= l(:label_course_news) %>
|
||||
(<%= @course_news.count %>)
|
||||
|
||||
|
||||
<% @course_news.each do |course_new|%>
|
||||
|
||||
▪
|
||||
[
|
||||
|
||||
<%= link_to truncate(course_new.course.name,length: 30,omission: '...'), course_url(course_new.course, :token => @token.value)%>
|
||||
]
|
||||
|
||||
<%= link_to course_new.author, user_activities_url(course_new.author,:token => @token.value)
|
||||
%>
|
||||
<%= l(:label_project_notice) %>
|
||||
|
||||
<%= link_to truncate(course_new.title,length: 30,omission: '...'), news_url(course_new,:token => @token.value)
|
||||
|
||||
|
||||
%> <%= format_time(course_new.created_on) %>
|
||||
|
||||
<% end %>
|
||||
|
||||
<% end %>
|
||||
<% if !@bids.first.nil? || !@homeworks.first.nil? %>
|
||||
<%= l(:label_homework_overview) %><%= @bids.count %>
|
||||
<% unless @bids.first.nil?%>
|
||||
<% @bids.each do |bid| %>
|
||||
▪
|
||||
[
|
||||
|
||||
<%= link_to truncate(bid.courses.first.name,length: 30,omission: '...'),course_url(bid.courses.first, :token => @token.value)
|
||||
|
||||
%>
|
||||
]
|
||||
|
||||
<%= link_to bid.author, user_activities_url(bid.author,:token => @token.value)
|
||||
%>
|
||||
<%= l(:label_course_homework) %>
|
||||
|
||||
<%= link_to truncate(bid.name,length: 30,omission: '...'), course_for_bid_url(bid,:token => @token.value)
|
||||
|
||||
|
||||
%>
|
||||
<%= format_time(bid.created_on) %>
|
||||
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% unless @homeworks.first.nil? %>
|
||||
<% @homeworks.each do |homework| %>
|
||||
▪[
|
||||
|
||||
<%= link_to truncate(homework.bid.courses.first.name,length: 30,omission: '...'), course_url(homework.bid.courses.first, :token => @token.value)
|
||||
|
||||
%>
|
||||
]
|
||||
|
||||
<%= link_to homework.user, user_activities_url(homework.user,:token => @token.value)
|
||||
%>
|
||||
<%= l(:label_course_submit_homework) %>
|
||||
|
||||
<%= link_to truncate(homework.name,length: 30,omission: '...'), course_for_bid_url(homework.bid,:token => @token.value)
|
||||
|
||||
|
||||
%>
|
||||
<%= format_time(homework.created_at) %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
|
||||
<!--作业动态 end-->
|
||||
<% end %>
|
||||
|
||||
<% unless @course_journal_messages.first.nil? %>
|
||||
|
||||
<%= l(:view_course_journals_for_messages) %> (<%= @course_journal_messages.count %>)
|
||||
|
||||
|
||||
<% @course_journal_messages.each do |course_journal_message|%>
|
||||
|
||||
[
|
||||
|
||||
<%= link_to truncate(course_journal_message.course.name,length: 30,omission: '...'), course_url(course_journal_message.course, :token => @token.value)
|
||||
|
||||
%>
|
||||
]
|
||||
|
||||
<%= link_to course_journal_message.user, user_activities_url(course_journal_message.user,:token => @token.value)
|
||||
%>
|
||||
<%= l(:label_send_course_journals_for_messages) %>
|
||||
|
||||
<%= link_to truncate(course_journal_message.notes,length: 30,omission: '...'), course_feedback_url(course_journal_message.course,:token => @token.value)
|
||||
|
||||
|
||||
%>
|
||||
<%= format_time(course_journal_message.created_on) %>
|
||||
|
||||
<% end %>
|
||||
|
||||
|
||||
<% end %>
|
||||
|
||||
<% unless @course_messages.first.nil? %>
|
||||
|
||||
<%= l(:view_borad_course) %>
|
||||
(<%= @course_journal_messages.count %>)
|
||||
|
||||
|
||||
<% @course_messages.each do |course_message|%>
|
||||
|
||||
▪
|
||||
[
|
||||
|
||||
<%= link_to truncate(course_message.course.name,length: 30,omission: '...'), course_url(course_message.course, :token => @token.value)
|
||||
|
||||
%>
|
||||
]
|
||||
|
||||
<%= link_to course_message.author, user_activities_url(course_message.author,:token => @token.value)
|
||||
%>
|
||||
<%= l(:label_send_course_messages) %>
|
||||
|
||||
<%= link_to truncate(course_message.subject,length: 30,omission: '...'),board_message_url(course_message, :board_id => course_message.board_id,:token => @token.value)
|
||||
|
||||
|
||||
%>
|
||||
<%= format_time(course_message.created_on) %>
|
||||
|
||||
<% end %>
|
||||
|
||||
|
||||
<% end %>
|
||||
|
||||
<% unless @attachments.first.nil? %>
|
||||
|
||||
<%= l(:label_course_attendingcontestwork_download) %>
|
||||
(<%= @attachments.count %>)
|
||||
|
||||
|
||||
<% @attachments.each do |attachment|%>
|
||||
▪[
|
||||
|
||||
<%= link_to truncate(attachment.course.name,length: 30,omission: '...'), course_url(attachment.course, :token => @token.value)
|
||||
|
||||
%>
|
||||
]
|
||||
|
||||
<%= link_to attachment.author, user_activities_url(attachment.author,:token => @token.value)
|
||||
%>
|
||||
<%= l(:label_course_file_upload) %>
|
||||
|
||||
<%= link_to truncate(attachment.filename,length: 30,omission: '...'),course_files_url(attachment.course,:token => @token.value)
|
||||
|
||||
|
||||
%>
|
||||
<%= format_time(attachment.created_on) %>
|
||||
</li>
|
||||
<% end %>
|
||||
|
||||
</ul><!--课件下载 end-->
|
||||
<% end %>
|
||||
<% end %><!--课程动态 end-->
|
||||
|
||||
<% @issues.first || @project_messages.first %>
|
||||
<%= l(:label_project_overview_new)%>
|
||||
<% unless @issues.first.nil? %>
|
||||
|
||||
<%= l(:label_issue_tracking) %>
|
||||
(<%= @issues.count %>)
|
||||
|
||||
<% @issues.each do |issue|%>
|
||||
▪
|
||||
[
|
||||
|
||||
<%= link_to truncate(issue.project.name,length: 30,omission: '...'), project_url(issue.project, :token => @token.value)
|
||||
|
||||
%>
|
||||
]
|
||||
|
||||
<%= link_to issue.author, user_activities_url(issue.author,:token => @token.value)
|
||||
%>
|
||||
<%= l(:label_project_issue) %>
|
||||
|
||||
<%= link_to truncate(issue. subject,length: 30,omission: '...'),issue_url(issue, :token => @token.value)
|
||||
|
||||
|
||||
%>
|
||||
<%= format_time(issue.created_on) %>
|
||||
<% end %>
|
||||
|
||||
|
||||
<% end %>
|
||||
|
||||
<% unless @project_messages.first.nil? %>
|
||||
|
||||
<%= l(:project_moule_boards_show) %>
|
||||
(<%= @project_messages.count %>)
|
||||
|
||||
<% @project_messages.each do |project_message|%>
|
||||
▪[
|
||||
|
||||
<%= link_to truncate(project_message.project.name,length: 30,omission: '...'), project_url(project_message.project, :token => @token.value)
|
||||
|
||||
%>
|
||||
]
|
||||
|
||||
<%= link_to project_message.author, board_message_url(project_message, :board_id => project_message.board_id,:token => @token.value)
|
||||
%>
|
||||
<%= l(:label_send_course_messages) %>
|
||||
|
||||
<%= link_to truncate(project_message. subject,length: 30,omission: '...'),board_message_url(project_message, :board_id => project_message.board_id,:token => @token.value)
|
||||
|
||||
|
||||
%>
|
||||
<%= format_time(project_message.created_on) %>
|
||||
<% end %>
|
||||
|
||||
|
||||
<% end %>
|
||||
|
||||
|
||||
<% unless @user_journal_messages.first.nil? %>
|
||||
<%= l(:label_activities) %>
|
||||
|
||||
|
||||
<%= l(:label_user_message) %>
|
||||
(<%= @user_journal_messages.count %>)
|
||||
|
||||
<% @user_journal_messages.each do |user_journal_message|%>
|
||||
▪
|
||||
|
||||
<%= link_to user_journal_message.user, user_activities_url(user_journal_message.user,:token => @token.value)
|
||||
|
||||
%>
|
||||
<%= l(:label_show_your_message) %>
|
||||
|
||||
<%= link_to truncate(user_journal_message.notes,length: 30,omission: '...'), feedback_url(@user,:token => @token.value)
|
||||
|
||||
|
||||
%>
|
||||
<%= format_time(user_journal_message.created_on) %>
|
||||
|
||||
<% end %>
|
||||
|
||||
|
||||
<% end %>
|
||||
<% if @forums.first || @memos.first %>
|
||||
<%= l(:lable_bar_active) %>
|
||||
<% unless @forums.first.nil? %>
|
||||
|
||||
<%= l(:label_user_forum) %>
|
||||
(<%= @forums.count %>)
|
||||
|
||||
<% @forums.each do |forum|%>
|
||||
▪
|
||||
|
||||
<%= link_to forum.creator, user_activities_url(forum.creator,:token => @token.value) %>
|
||||
<%= l(:label_forum_new) %>
|
||||
|
||||
<%= link_to truncate(forum.name,length: 30,omission: '...'),forum_url(forum,:token => @token.value)
|
||||
%>
|
||||
<%= format_time(forum.created_at) %>
|
||||
|
||||
<% end %>
|
||||
|
||||
<!-- 新建贴吧 end-->
|
||||
<% end %>
|
||||
<% unless @memos.first.nil? %>
|
||||
|
||||
<%= l(:label_user_message_forum) %>
|
||||
(<%= @memos.count %>)
|
||||
|
||||
<% @memos.each do |memo|%>
|
||||
▪
|
||||
|
||||
<%= link_to memo.author, user_activities_url(memo.author,:token => @token.value)%>
|
||||
<%= memo.parent_id.nil? ? l(:label_memo_new_from_forum) : l(:label_reply) %>
|
||||
|
||||
<%= link_to truncate(memo.subject,length: 30,omission: '...'),forum_memo_url(memo.forum, (memo.parent_id.nil? ? memo : memo.parent_id))
|
||||
%>
|
||||
<%= format_time(memo.created_at) %>
|
||||
|
||||
<% end %>
|
||||
|
||||
|
||||
<!-- 新建贴吧 end-->
|
||||
<% end %>
|
||||
<!--贴吧动态 end-->
|
||||
<% end %>
|
||||
|
||||
<%= link_to l(:mail_footer), @user_url, :style => "margin-top:20px;color:#2775d2; margin-left:10px;" %>
|
|
@ -0,0 +1,21 @@
|
|||
|
||||
<div class="mail_box" style="border:1px solid #c8c8c8; width:570px; height: auto; padding:15px; margin-top:10px; margin-bottom:10px;">
|
||||
<ul style="list-style-type:none; margin:0; padding:0;">
|
||||
|
||||
<li style="list-style-type:none; margin:0; padding:0;"><span style="float: left;"><strong><%= l(:mail_issue_content)%></strong></span>
|
||||
<span style="float: left; width: 526px">
|
||||
<p><%= @subject %> </p>
|
||||
<p> <%= link_to @project_url, @project_url%></p>
|
||||
<p>点击链接后,将自动为您注册账号</p>
|
||||
<p>您的账号为:<%= @email %></p>
|
||||
<p>密码为: <%= @password %></p>
|
||||
|
||||
</span>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
<div class="cl" style="margin-top: 30px; clear:both; overflow:hidden;"></div>
|
||||
</div>
|
||||
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
<%= @subject %>
|
||||
<%= link_to @project_url, @project_url%>
|
|
@ -1,3 +1,6 @@
|
|||
<div class="project_r_h">
|
||||
<h2 class="project_h2"><%= l(:label_news) %></h2>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
function regexTitle()
|
||||
{
|
||||
|
@ -66,11 +69,7 @@
|
|||
label_tips = l(:label_news)
|
||||
end
|
||||
%>
|
||||
|
||||
<span style="font-size: 16px; border-bottom:1px solid #f0f0f0; margin-right: 15px;">
|
||||
<%= label_tips %>
|
||||
</span>
|
||||
<% if @project.enabled_modules.where("name = 'news'").count > 0 %>
|
||||
<% if @project.enabled_modules.where("name = 'news'").count > 0 && User.current.member_of?(@project) %>
|
||||
<%= link_to(btn_tips,
|
||||
new_project_news_path(@project),
|
||||
:class => 'icon icon-add',
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
<div class="project_r_h">
|
||||
<h2 class="project_h2"><%= l(:label_news) %></h2>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
function regexTitle()
|
||||
{
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
<%= error_messages_for 'project' %>
|
||||
<!--[form:project]-->
|
||||
<% unless @organizations.new_record? %>
|
||||
<p>
|
||||
<%= render :partial=>"avatar/avatar_form",:locals=> {source:@organizations} %>
|
||||
</p>
|
||||
<% end %>
|
||||
<p>
|
||||
<label for="project_description">
|
||||
<%= l(:label_organization_name)%>:
|
||||
<span class="required"> </span>
|
||||
</label>
|
||||
<%= f.text_field :name, :required => true, :size => 60, :style => "width:290px;" %>
|
||||
</p>
|
||||
<!--<p>-->
|
||||
<!--<label for="project_description">-->
|
||||
<%#= l(:field_description)%>
|
||||
<!--<span class="required"> </span>-->
|
||||
<!--</label>-->
|
||||
<!--<%#= f.text_area :description, :required => true, :size => 60, :style => "width:490px;" %>-->
|
||||
<!--</p>-->
|
|
@ -0,0 +1,25 @@
|
|||
<%= form_for(@organization) do |f|%>
|
||||
<h3>
|
||||
<%=l(:label_organization_edit)%>
|
||||
</h3>
|
||||
<div class="box tabular" >
|
||||
<%= error_messages_for 'project' %>
|
||||
<p>
|
||||
<%= render :partial=>"avatar/avatar_form",:locals=> {source:@organization} %>
|
||||
</p>
|
||||
<p>
|
||||
<label for="project_description">
|
||||
<%= l(:label_organization_name)%>:
|
||||
<span class="required"> </span>
|
||||
</label>
|
||||
<%= f.text_field :name, :required => true, :size => 60, :style => "width:290px;" %>
|
||||
</p>
|
||||
<span style="padding-left: 60px">
|
||||
<%= submit_tag l(:button_create), :class => "enterprise"%>
|
||||
</span>
|
||||
</div>
|
||||
<%#= submit_tag l(:button_create_and_continue), :name => 'continue' %>
|
||||
<%= javascript_tag "$('#project_name').focus();" %>
|
||||
<% end %>
|
||||
|
||||
<% html_title(l(:label_organization_edit)) -%>
|
|
@ -0,0 +1,31 @@
|
|||
<title>
|
||||
<%= l(:label_all_enterprises) %>
|
||||
</title>
|
||||
<div class="content_syqy">
|
||||
<div class="list">
|
||||
<%= l(:label_all_enterprises) %>
|
||||
</div>
|
||||
<div class="syqy_box">
|
||||
<% if @organizations.empty? %>
|
||||
<h3>
|
||||
<%= l(:label_enterprise_nil) %>
|
||||
</h3>
|
||||
<% else %>
|
||||
<% @organizations.each do |organization| %>
|
||||
<% unless organization.name.blank? %>
|
||||
<ul>
|
||||
<li >
|
||||
<img src="/images/organization_logo.jpg" width="30" height="30" alt="<%= organization.name%>" />
|
||||
<%= link_to organization.name, home_path(:organization => organization.id) %>
|
||||
</li>
|
||||
</ul>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
<div style="clear: both"></div>
|
||||
<div class="school-index">
|
||||
<ul id="schoollist" style="line-height: 25px"></ul>
|
||||
</div>
|
||||
<% html_title(l(:label_enterprise_all)) -%>
|
|
@ -0,0 +1,18 @@
|
|||
<%= form_for(@organizations, :method => :post,
|
||||
:name => 'new_form',
|
||||
:url => {:controller => 'organization',
|
||||
:action => 'create'}) do |f|%>
|
||||
<h3>
|
||||
<%=l(:label_organization_new)%>
|
||||
</h3>
|
||||
<div class="box tabular" >
|
||||
<%= render :partial => 'form', :locals => { :f => f } %>
|
||||
<span style="padding-left: 60px">
|
||||
<%= submit_tag l(:button_create), :class => "enterprise"%>
|
||||
</span>
|
||||
</div>
|
||||
<%#= submit_tag l(:button_create_and_continue), :name => 'continue' %>
|
||||
<%= javascript_tag "$('#project_name').focus();" %>
|
||||
<% end %>
|
||||
|
||||
<% html_title(l(:label_organization_new)) -%>
|
|
@ -1,23 +0,0 @@
|
|||
<title><%= l(:label_all_enterprises) %></title>
|
||||
<div class="content_syqy">
|
||||
<div class="list"><%= l(:label_all_enterprises) %></div>
|
||||
<div class="syqy_box">
|
||||
<% if @projects.count == 0 %>
|
||||
<h3><%= l(:label_enterprise_nil) %></h3>
|
||||
<% else %>
|
||||
<% @projects.each do |organization| %>
|
||||
<% unless organization.enterprise_name.blank? %>
|
||||
<ul>
|
||||
<li ><img src="/images/organization_logo.jpg" width="30" height="30" alt="#{project.enterprise_name}" />
|
||||
<%= link_to organization.enterprise_name, home_path(:organization => organization) %></li>
|
||||
</ul>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
<div style="clear: both"></div>
|
||||
<div class="school-index">
|
||||
<ul id="schoollist" style="line-height: 25px"></ul>
|
||||
</div>
|
||||
<% html_title(l(:label_enterprise_all)) -%>
|
|
@ -4,9 +4,14 @@
|
|||
<input type="text" maxlength="100" name="polls_name" id="polls_title" value="<%= @poll.polls_name %>" class="input_title" placeholder="问卷标题"/>
|
||||
</div>
|
||||
<div class="ur_title_editor_prefix">
|
||||
<textarea name="polls_description" maxlength="300" id="polls_description" class="textarea_editor"><%= @poll.polls_description%></textarea>
|
||||
<div contenteditable="true" id="polls_description_div" class="ur_textbox" style="min-height: 150px;width: 100%;background-color: #ffffff" onkeyup="edit_head();">
|
||||
<%= @poll.polls_description.nil? ? "" : @poll.polls_description.html_safe%>
|
||||
</div>
|
||||
<div class="ur_editor_footer">
|
||||
<textarea name="polls_description" maxlength="300" id="polls_description" class="textarea_editor" style="display: none">
|
||||
<%= @poll.polls_description%>
|
||||
</textarea>
|
||||
</div>
|
||||
<div class="ur_editor_footer" style="padding-top: 10px;">
|
||||
<a class="btn_submit" data-button="ok" onclick="pollsSubmit($(this));">
|
||||
<%= l(:label_button_ok)%>
|
||||
</a>
|
||||
|
|
|
@ -7,6 +7,11 @@
|
|||
<%#= javascript_include_tag "polls" %>
|
||||
|
||||
<script type="text/javascript">
|
||||
//编辑问卷描述之后
|
||||
function edit_head(){
|
||||
$("#polls_description").val($("#polls_description_div").html());
|
||||
}
|
||||
|
||||
function add_MC(){
|
||||
$("#new_poll_question").html("<%= escape_javascript(render :partial => 'new_MC') %>");
|
||||
$("#poll_questions_title").focus();
|
||||
|
|
|
@ -3,8 +3,6 @@
|
|||
<h1 class="ur_page_title" id="polls_name_h">
|
||||
<%= poll.polls_name%>
|
||||
</h1>
|
||||
<p class="ur_prefix_content" id="polls_description_p">
|
||||
<%= @poll.polls_description%>
|
||||
</p>
|
||||
<%= @poll.polls_description.nil? ? "" : @poll.polls_description.html_safe%>
|
||||
<div class="cl"></div>
|
||||
</div><!--头部显示 end-->
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue