Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh
This commit is contained in:
commit
4825c5287e
35
Gemfile
35
Gemfile
|
@ -1,4 +1,4 @@
|
||||||
source 'https://rubygems.org'
|
source 'https://ruby.taobao.org'
|
||||||
|
|
||||||
unless RUBY_PLATFORM =~ /w32/
|
unless RUBY_PLATFORM =~ /w32/
|
||||||
# unix-like only
|
# unix-like only
|
||||||
|
@ -19,19 +19,33 @@ gem 'acts-as-taggable-on', '2.4.1'
|
||||||
group :development do
|
group :development do
|
||||||
gem 'better_errors', path: 'lib/better_errors'
|
gem 'better_errors', path: 'lib/better_errors'
|
||||||
gem 'rack-mini-profiler', path: 'lib/rack-mini-profiler'
|
gem 'rack-mini-profiler', path: 'lib/rack-mini-profiler'
|
||||||
if ENV['PRY']
|
|
||||||
gem 'pry'
|
|
||||||
gem 'pry-nav'
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
group :test do
|
group :test do
|
||||||
# shoulda的版本做了改动
|
|
||||||
#gem "shoulda", "~> 3.3.2"
|
#gem "shoulda", "~> 3.3.2"
|
||||||
gem "shoulda", "> 3.3.2"
|
gem "shoulda", "> 3.3.2"
|
||||||
gem "mocha", "~> 0.13.3"
|
gem "mocha", "~> 0.13.3"
|
||||||
gem 'capybara', '~> 2.0.0'
|
gem 'capybara', '~> 2.0.0'
|
||||||
gem 'nokogiri', '< 1.6.0'
|
gem 'nokogiri', '< 1.6.0'
|
||||||
|
|
||||||
|
platforms :mri, :mingw do
|
||||||
|
group :rmagick do
|
||||||
|
# RMagick 2 supports ruby 1.9
|
||||||
|
# RMagick 1 would be fine for ruby 1.8 but Bundler does not support
|
||||||
|
# different requirements for the same gem on different platforms
|
||||||
|
gem "rmagick", ">= 2.0.0"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
group :development, :test do
|
||||||
|
gem "guard-rails"
|
||||||
|
gem 'spork-testunit'
|
||||||
|
gem 'guard-spork'
|
||||||
|
gem 'guard-test', '~> 1.0.0'
|
||||||
|
gem 'ruby-prof'
|
||||||
|
gem 'pry'
|
||||||
|
gem 'pry-nav'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
@ -53,15 +67,6 @@ group :ldap do
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
platforms :mri, :mingw do
|
|
||||||
group :rmagick do
|
|
||||||
# RMagick 2 supports ruby 1.9
|
|
||||||
# RMagick 1 would be fine for ruby 1.8 but Bundler does not support
|
|
||||||
# different requirements for the same gem on different platforms
|
|
||||||
gem "rmagick", ">= 2.0.0"
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
# Optional gem for OpenID authentication
|
# Optional gem for OpenID authentication
|
||||||
group :openid do
|
group :openid do
|
||||||
gem "ruby-openid", "~> 2.1.4", :require => "openid"
|
gem "ruby-openid", "~> 2.1.4", :require => "openid"
|
||||||
|
|
98
Gemfile.lock
98
Gemfile.lock
|
@ -19,7 +19,7 @@ PATH
|
||||||
rails
|
rails
|
||||||
|
|
||||||
GEM
|
GEM
|
||||||
remote: https://rubygems.org/
|
remote: https://ruby.taobao.org/
|
||||||
remote: https://rubygems.org/
|
remote: https://rubygems.org/
|
||||||
specs:
|
specs:
|
||||||
actionmailer (3.2.13)
|
actionmailer (3.2.13)
|
||||||
|
@ -51,7 +51,7 @@ GEM
|
||||||
multi_json (~> 1.0)
|
multi_json (~> 1.0)
|
||||||
acts-as-taggable-on (2.4.1)
|
acts-as-taggable-on (2.4.1)
|
||||||
rails (>= 3, < 5)
|
rails (>= 3, < 5)
|
||||||
arel (3.0.2)
|
arel (3.0.3)
|
||||||
builder (3.0.0)
|
builder (3.0.0)
|
||||||
capybara (2.0.3)
|
capybara (2.0.3)
|
||||||
mime-types (>= 1.16)
|
mime-types (>= 1.16)
|
||||||
|
@ -60,6 +60,8 @@ GEM
|
||||||
rack-test (>= 0.5.4)
|
rack-test (>= 0.5.4)
|
||||||
selenium-webdriver (~> 2.0)
|
selenium-webdriver (~> 2.0)
|
||||||
xpath (~> 1.0.0)
|
xpath (~> 1.0.0)
|
||||||
|
celluloid (0.15.2)
|
||||||
|
timers (~> 1.1.0)
|
||||||
childprocess (0.5.3)
|
childprocess (0.5.3)
|
||||||
ffi (~> 1.0, >= 1.0.11)
|
ffi (~> 1.0, >= 1.0.11)
|
||||||
climate_control (0.0.3)
|
climate_control (0.0.3)
|
||||||
|
@ -70,14 +72,31 @@ GEM
|
||||||
coffee-rails (3.2.2)
|
coffee-rails (3.2.2)
|
||||||
coffee-script (>= 2.2.0)
|
coffee-script (>= 2.2.0)
|
||||||
railties (~> 3.2.0)
|
railties (~> 3.2.0)
|
||||||
coffee-script (2.2.0)
|
coffee-script (2.3.0)
|
||||||
coffee-script-source
|
coffee-script-source
|
||||||
execjs
|
execjs
|
||||||
coffee-script-source (1.7.0)
|
coffee-script-source (1.7.1)
|
||||||
erubis (2.7.0)
|
erubis (2.7.0)
|
||||||
execjs (2.0.2)
|
execjs (2.2.1)
|
||||||
fastercsv (1.5.0)
|
fastercsv (1.5.5)
|
||||||
|
ffi (1.9.3)
|
||||||
ffi (1.9.3-x86-mingw32)
|
ffi (1.9.3-x86-mingw32)
|
||||||
|
formatador (0.2.5)
|
||||||
|
guard (2.6.1)
|
||||||
|
formatador (>= 0.2.4)
|
||||||
|
listen (~> 2.7)
|
||||||
|
lumberjack (~> 1.0)
|
||||||
|
pry (>= 0.9.12)
|
||||||
|
thor (>= 0.18.1)
|
||||||
|
guard-rails (0.5.2)
|
||||||
|
guard (~> 2.0)
|
||||||
|
guard-spork (1.5.1)
|
||||||
|
childprocess (>= 0.2.3)
|
||||||
|
guard (>= 1.1)
|
||||||
|
spork (>= 0.8.4)
|
||||||
|
guard-test (1.0.0)
|
||||||
|
guard (>= 1.8)
|
||||||
|
test-unit (~> 2.2)
|
||||||
hike (1.2.3)
|
hike (1.2.3)
|
||||||
htmlentities (4.3.2)
|
htmlentities (4.3.2)
|
||||||
i18n (0.6.1)
|
i18n (0.6.1)
|
||||||
|
@ -85,36 +104,56 @@ GEM
|
||||||
jquery-rails (2.0.3)
|
jquery-rails (2.0.3)
|
||||||
railties (>= 3.1.0, < 5.0)
|
railties (>= 3.1.0, < 5.0)
|
||||||
thor (~> 0.14)
|
thor (~> 0.14)
|
||||||
json (1.8.0)
|
json (1.8.1)
|
||||||
kaminari (0.16.1)
|
kaminari (0.16.1)
|
||||||
actionpack (>= 3.0.0)
|
actionpack (>= 3.0.0)
|
||||||
activesupport (>= 3.0.0)
|
activesupport (>= 3.0.0)
|
||||||
|
libv8 (3.16.14.3)
|
||||||
|
listen (2.7.9)
|
||||||
|
celluloid (>= 0.15.2)
|
||||||
|
rb-fsevent (>= 0.9.3)
|
||||||
|
rb-inotify (>= 0.9)
|
||||||
|
lumberjack (1.0.9)
|
||||||
mail (2.5.4)
|
mail (2.5.4)
|
||||||
mime-types (~> 1.16)
|
mime-types (~> 1.16)
|
||||||
treetop (~> 1.4.8)
|
treetop (~> 1.4.8)
|
||||||
metaclass (0.0.4)
|
metaclass (0.0.4)
|
||||||
mime-types (1.23)
|
method_source (0.8.2)
|
||||||
|
mime-types (1.25.1)
|
||||||
mocha (0.13.3)
|
mocha (0.13.3)
|
||||||
metaclass (~> 0.0.1)
|
metaclass (~> 0.0.1)
|
||||||
multi_json (1.7.6)
|
multi_json (1.10.1)
|
||||||
|
mysql2 (0.3.11)
|
||||||
mysql2 (0.3.11-x86-mingw32)
|
mysql2 (0.3.11-x86-mingw32)
|
||||||
net-ldap (0.3.1)
|
net-ldap (0.3.1)
|
||||||
|
nokogiri (1.5.11)
|
||||||
nokogiri (1.5.11-x86-mingw32)
|
nokogiri (1.5.11-x86-mingw32)
|
||||||
paperclip (3.5.4)
|
paperclip (3.5.4)
|
||||||
activemodel (>= 3.0.0)
|
activemodel (>= 3.0.0)
|
||||||
activesupport (>= 3.0.0)
|
activesupport (>= 3.0.0)
|
||||||
cocaine (~> 0.5.3)
|
cocaine (~> 0.5.3)
|
||||||
mime-types
|
mime-types
|
||||||
polyglot (0.3.3)
|
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)
|
||||||
|
pry-nav (0.2.3)
|
||||||
|
pry (~> 0.9.10)
|
||||||
rack (1.4.5)
|
rack (1.4.5)
|
||||||
rack-cache (1.2)
|
rack-cache (1.2)
|
||||||
rack (>= 0.4)
|
rack (>= 0.4)
|
||||||
rack-openid (1.3.1)
|
rack-openid (1.4.2)
|
||||||
rack (>= 1.1.0)
|
rack (>= 1.1.0)
|
||||||
ruby-openid (>= 2.1.8)
|
ruby-openid (>= 2.1.8)
|
||||||
rack-raw-upload (1.1.1)
|
rack-raw-upload (1.1.1)
|
||||||
multi_json
|
multi_json
|
||||||
rack-ssl (1.3.3)
|
rack-ssl (1.3.4)
|
||||||
rack
|
rack
|
||||||
rack-test (0.6.2)
|
rack-test (0.6.2)
|
||||||
rack (>= 1.0)
|
rack (>= 1.0)
|
||||||
|
@ -134,8 +173,12 @@ GEM
|
||||||
rdoc (~> 3.4)
|
rdoc (~> 3.4)
|
||||||
thor (>= 0.14.6, < 2.0)
|
thor (>= 0.14.6, < 2.0)
|
||||||
rake (10.3.2)
|
rake (10.3.2)
|
||||||
|
rb-fsevent (0.9.4)
|
||||||
|
rb-inotify (0.9.5)
|
||||||
|
ffi (>= 0.5.0)
|
||||||
rdoc (3.12.2)
|
rdoc (3.12.2)
|
||||||
json (~> 1.4)
|
json (~> 1.4)
|
||||||
|
ref (1.0.5)
|
||||||
rich (1.4.6)
|
rich (1.4.6)
|
||||||
jquery-rails
|
jquery-rails
|
||||||
kaminari
|
kaminari
|
||||||
|
@ -146,8 +189,9 @@ GEM
|
||||||
sass-rails
|
sass-rails
|
||||||
rmagick (2.13.2)
|
rmagick (2.13.2)
|
||||||
ruby-openid (2.1.8)
|
ruby-openid (2.1.8)
|
||||||
rubyzip (1.1.4)
|
ruby-prof (0.15.1)
|
||||||
sass (3.2.14)
|
rubyzip (1.1.6)
|
||||||
|
sass (3.3.10)
|
||||||
sass-rails (3.2.6)
|
sass-rails (3.2.6)
|
||||||
railties (~> 3.2.0)
|
railties (~> 3.2.0)
|
||||||
sass (>= 3.1.10)
|
sass (>= 3.1.10)
|
||||||
|
@ -163,25 +207,36 @@ GEM
|
||||||
shoulda-context (1.2.1)
|
shoulda-context (1.2.1)
|
||||||
shoulda-matchers (2.6.1)
|
shoulda-matchers (2.6.1)
|
||||||
activesupport (>= 3.0.0)
|
activesupport (>= 3.0.0)
|
||||||
|
slop (3.5.0)
|
||||||
|
spork (0.9.2)
|
||||||
|
spork-testunit (0.0.8)
|
||||||
|
spork (>= 0.6.0)
|
||||||
sprockets (2.2.2)
|
sprockets (2.2.2)
|
||||||
hike (~> 1.2)
|
hike (~> 1.2)
|
||||||
multi_json (~> 1.0)
|
multi_json (~> 1.0)
|
||||||
rack (~> 1.0)
|
rack (~> 1.0)
|
||||||
tilt (~> 1.1, != 1.3.0)
|
tilt (~> 1.1, != 1.3.0)
|
||||||
thor (0.18.1)
|
test-unit (2.5.5)
|
||||||
|
therubyracer (0.12.1)
|
||||||
|
libv8 (~> 3.16.14.0)
|
||||||
|
ref
|
||||||
|
thor (0.19.1)
|
||||||
tilt (1.4.1)
|
tilt (1.4.1)
|
||||||
treetop (1.4.14)
|
timers (1.1.0)
|
||||||
|
treetop (1.4.15)
|
||||||
polyglot
|
polyglot
|
||||||
polyglot (>= 0.3.1)
|
polyglot (>= 0.3.1)
|
||||||
tzinfo (0.3.37)
|
tzinfo (0.3.40)
|
||||||
uglifier (2.4.0)
|
uglifier (2.5.1)
|
||||||
execjs (>= 0.3.0)
|
execjs (>= 0.3.0)
|
||||||
json (>= 1.8.0)
|
json (>= 1.8.0)
|
||||||
websocket (1.0.7)
|
websocket (1.0.7)
|
||||||
|
win32console (1.3.2-x86-mingw32)
|
||||||
xpath (1.0.0)
|
xpath (1.0.0)
|
||||||
nokogiri (~> 1.3)
|
nokogiri (~> 1.3)
|
||||||
|
|
||||||
PLATFORMS
|
PLATFORMS
|
||||||
|
ruby
|
||||||
x86-mingw32
|
x86-mingw32
|
||||||
|
|
||||||
DEPENDENCIES
|
DEPENDENCIES
|
||||||
|
@ -194,6 +249,9 @@ DEPENDENCIES
|
||||||
coderay (~> 1.0.6)
|
coderay (~> 1.0.6)
|
||||||
coffee-rails (~> 3.2.1)
|
coffee-rails (~> 3.2.1)
|
||||||
fastercsv (~> 1.5.0)
|
fastercsv (~> 1.5.0)
|
||||||
|
guard-rails
|
||||||
|
guard-spork
|
||||||
|
guard-test (~> 1.0.0)
|
||||||
htmlentities
|
htmlentities
|
||||||
i18n (~> 0.6.0)
|
i18n (~> 0.6.0)
|
||||||
jquery-rails (~> 2.0.2)
|
jquery-rails (~> 2.0.2)
|
||||||
|
@ -203,14 +261,18 @@ DEPENDENCIES
|
||||||
net-ldap (~> 0.3.1)
|
net-ldap (~> 0.3.1)
|
||||||
nokogiri (< 1.6.0)
|
nokogiri (< 1.6.0)
|
||||||
paperclip (~> 3.5.4)
|
paperclip (~> 3.5.4)
|
||||||
|
pry
|
||||||
|
pry-nav
|
||||||
rack-mini-profiler!
|
rack-mini-profiler!
|
||||||
rack-openid
|
rack-openid
|
||||||
rails (= 3.2.13)
|
rails (= 3.2.13)
|
||||||
rich (= 1.4.6)
|
rich (= 1.4.6)
|
||||||
rmagick (>= 2.0.0)
|
rmagick (>= 2.0.0)
|
||||||
ruby-openid (~> 2.1.4)
|
ruby-openid (~> 2.1.4)
|
||||||
|
ruby-prof
|
||||||
sass-rails (~> 3.2.3)
|
sass-rails (~> 3.2.3)
|
||||||
seems_rateable!
|
seems_rateable!
|
||||||
shoulda (> 3.3.2)
|
shoulda (> 3.3.2)
|
||||||
|
spork-testunit
|
||||||
therubyracer
|
therubyracer
|
||||||
uglifier (>= 1.0.3)
|
uglifier (>= 1.0.3)
|
||||||
|
|
|
@ -0,0 +1,39 @@
|
||||||
|
# More info at https://github.com/guard/guard#readme
|
||||||
|
|
||||||
|
# guard 'rails' do
|
||||||
|
# watch('Gemfile.lock')
|
||||||
|
# watch(%r{^(config|lib)/.*})
|
||||||
|
# end
|
||||||
|
#
|
||||||
|
guard 'spork', :test_unit => true, :test_unit_env => {'RAILS_ENV' => 'test'}, :wait => 60 do
|
||||||
|
watch('config/application.rb')
|
||||||
|
watch('config/environment.rb')
|
||||||
|
watch('config/environments/test.rb')
|
||||||
|
watch(%r{^config/initializers/.+\.rb$})
|
||||||
|
watch('Gemfile.lock')
|
||||||
|
watch('spec/spec_helper.rb') { :rspec }
|
||||||
|
watch('test/test_helper.rb') { :test_unit }
|
||||||
|
watch(%r{features/support/}) { :cucumber }
|
||||||
|
end
|
||||||
|
|
||||||
|
guard :test, :drb => true, :all_after_pass => false, :all_on_start => false do
|
||||||
|
watch(%r{^test/.+_test\.rb$})
|
||||||
|
watch('test/test_helper.rb') { 'test' }
|
||||||
|
|
||||||
|
# Non-rails
|
||||||
|
watch(%r{^lib/(.+)\.rb$}) { |m| "test/#{m[1]}_test.rb" }
|
||||||
|
|
||||||
|
# Rails 4
|
||||||
|
# watch(%r{^app/(.+)\.rb}) { |m| "test/#{m[1]}_test.rb" }
|
||||||
|
# watch(%r{^app/controllers/application_controller\.rb}) { 'test/controllers' }
|
||||||
|
# watch(%r{^app/controllers/(.+)_controller\.rb}) { |m| "test/integration/#{m[1]}_test.rb" }
|
||||||
|
# watch(%r{^app/views/(.+)_mailer/.+}) { |m| "test/mailers/#{m[1]}_mailer_test.rb" }
|
||||||
|
# watch(%r{^lib/(.+)\.rb}) { |m| "test/lib/#{m[1]}_test.rb" }
|
||||||
|
|
||||||
|
# Rails < 4
|
||||||
|
watch(%r{^app/models/(.+)\.rb$}) { |m| "test/unit/#{m[1]}_test.rb" }
|
||||||
|
watch(%r{^app/controllers/(.+)\.rb$}) { |m| "test/functional/#{m[1]}_test.rb" }
|
||||||
|
watch(%r{^app/views/(.+)/.+\.erb$}) { |m| "test/functional/#{m[1]}_controller_test.rb" }
|
||||||
|
watch(%r{^app/views/.+$}) { 'test/integration' }
|
||||||
|
watch('app/controllers/application_controller.rb') { ['test/functional', 'test/integration'] }
|
||||||
|
end
|
|
@ -246,19 +246,21 @@ class AdminController < ApplicationController
|
||||||
@first_page.title = params[:title]
|
@first_page.title = params[:title]
|
||||||
if @first_page.save
|
if @first_page.save
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html {
|
|
||||||
flash[:notice] = l(:notice_successful_update)
|
flash[:notice] = l(:notice_successful_update)
|
||||||
|
format.html {
|
||||||
redirect_to admin_first_page_made_path
|
redirect_to admin_first_page_made_path
|
||||||
}
|
}
|
||||||
format.api { render_api_ok }
|
format.api { render_api_ok }
|
||||||
|
#format.json { render json: @first_page, status: :created, location: @first_page }
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
|
flash.now[:error] = "#{l :label_first_page_create_fail}: #{@first_page.errors.full_messages[0]}"
|
||||||
format.html {
|
format.html {
|
||||||
first_page_made
|
|
||||||
render :action => 'first_page_made'
|
render :action => 'first_page_made'
|
||||||
}
|
}
|
||||||
format.api { render_validation_errors(@first_page) }
|
format.api { render_validation_errors(@first_page) }
|
||||||
|
#format.json { render json: @first_page.errors, status: :unprocessable_entity }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -272,6 +274,7 @@ class AdminController < ApplicationController
|
||||||
@first_page = FirstPage.where("page_type = 'project'").first
|
@first_page = FirstPage.where("page_type = 'project'").first
|
||||||
@course_page = FirstPage.where("page_type = 'course'").first
|
@course_page = FirstPage.where("page_type = 'course'").first
|
||||||
@first_page.web_title = params[:web_title]
|
@first_page.web_title = params[:web_title]
|
||||||
|
@course_page.web_title = params[:web_title]
|
||||||
@course_page.title = params[:course_title]
|
@course_page.title = params[:course_title]
|
||||||
@course_page.description = params[:course_description]
|
@course_page.description = params[:course_description]
|
||||||
if @first_page.save && @course_page.save
|
if @first_page.save && @course_page.save
|
||||||
|
@ -284,8 +287,10 @@ class AdminController < ApplicationController
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
|
flash.now[:error] = "#{l :label_first_page_create_fail}: #{@first_page.errors.full_messages[0]}\n\t#{@course_page.errors.full_messages[0]}"
|
||||||
|
#flash.now[:error] = "#{l :label_first_page_create_fail}: #{@course_page.errors.full_messages[0]}"
|
||||||
format.html {
|
format.html {
|
||||||
course_page_made
|
|
||||||
render :action => 'course_page_made'
|
render :action => 'course_page_made'
|
||||||
}
|
}
|
||||||
format.api { render_validation_errors(@first_page) }
|
format.api { render_validation_errors(@first_page) }
|
||||||
|
@ -303,6 +308,7 @@ class AdminController < ApplicationController
|
||||||
@first_page = FirstPage.where("page_type = 'project'").first
|
@first_page = FirstPage.where("page_type = 'project'").first
|
||||||
@contest_page = FirstPage.where("page_type = 'contest'").first
|
@contest_page = FirstPage.where("page_type = 'contest'").first
|
||||||
@first_page.web_title = params[:web_title]
|
@first_page.web_title = params[:web_title]
|
||||||
|
@contest_page.web_title = params[:web_title]
|
||||||
@contest_page.title = params[:contest_title]
|
@contest_page.title = params[:contest_title]
|
||||||
@contest_page.description = params[:contest_description]
|
@contest_page.description = params[:contest_description]
|
||||||
if @first_page.save && @contest_page.save
|
if @first_page.save && @contest_page.save
|
||||||
|
@ -315,8 +321,8 @@ class AdminController < ApplicationController
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
|
flash.now[:error] = "#{l :label_first_page_create_fail}: #{@first_page.errors.full_messages[0]}\n\t#{@contest_page.errors.full_messages[0]}"
|
||||||
format.html {
|
format.html {
|
||||||
contest_page_made
|
|
||||||
render :action => 'contest_page_made'
|
render :action => 'contest_page_made'
|
||||||
}
|
}
|
||||||
format.api { render_validation_errors(@first_page) }
|
format.api { render_validation_errors(@first_page) }
|
||||||
|
|
|
@ -78,6 +78,40 @@ class AvatarController < ApplicationController
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
#add by zjc
|
||||||
|
#删除图片
|
||||||
|
def delete_image
|
||||||
|
@source_type = params[:source_type]
|
||||||
|
@source_id = params[:source_id]
|
||||||
|
@source = nil #eval(@source_type).find(@source_id)
|
||||||
|
c = Object.const_get(@source_type)
|
||||||
|
if c.respond_to?(:find)
|
||||||
|
@source = c.find(@source_id)
|
||||||
|
end
|
||||||
|
|
||||||
|
diskfile=disk_filename(@source_type,@source_id)
|
||||||
|
unless diskfile.nil? || diskfile == ""
|
||||||
|
path = File.dirname(diskfile)
|
||||||
|
if File.directory?(path) && File.exist?(diskfile)
|
||||||
|
File.delete(diskfile)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
rescue e do
|
||||||
|
logger.info e.message
|
||||||
|
end
|
||||||
|
respond_to do |format|
|
||||||
|
format.js
|
||||||
|
format.api {
|
||||||
|
if saved
|
||||||
|
render :action => 'upload', :status => :created
|
||||||
|
else
|
||||||
|
render_validation_errors(@avatar)
|
||||||
|
end
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def set_cache_buster
|
def set_cache_buster
|
||||||
|
|
|
@ -92,6 +92,22 @@ class RepositoriesController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def create
|
def create
|
||||||
|
if params[:repository_scm].to_s == 'Gitlab'
|
||||||
|
# add by nwb
|
||||||
|
# 增加对gitlab版本库的支持
|
||||||
|
attrs = pickup_extra_info
|
||||||
|
@repository = Repository.factory('Git')
|
||||||
|
@repository.safe_attributes = params[:repository]
|
||||||
|
if attrs[:attrs_extra].keys.any?
|
||||||
|
@repository.merge_extra_info(attrs[:attrs_extra])
|
||||||
|
end
|
||||||
|
@repository.project = @project
|
||||||
|
if request.post? && @repository.save
|
||||||
|
redirect_to settings_project_path(@project, :tab => 'repositories')
|
||||||
|
else
|
||||||
|
render :action => 'new'
|
||||||
|
end
|
||||||
|
else # 原逻辑
|
||||||
##xianbo
|
##xianbo
|
||||||
@root_path=RepositoriesHelper::ROOT_PATH
|
@root_path=RepositoriesHelper::ROOT_PATH
|
||||||
@repository_name=User.current.login.to_s+"/"+params[:repository][:identifier]+".git"
|
@repository_name=User.current.login.to_s+"/"+params[:repository][:identifier]+".git"
|
||||||
|
@ -144,6 +160,7 @@ class RepositoriesController < ApplicationController
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def edit
|
def edit
|
||||||
end
|
end
|
||||||
|
|
|
@ -108,6 +108,11 @@ class Course < ActiveRecord::Base
|
||||||
#description.gsub(/^(.{#{length}}[^\n\r]*).*$/m, '\1...').strip if description
|
#description.gsub(/^(.{#{length}}[^\n\r]*).*$/m, '\1...').strip if description
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# 课程的短名称信息
|
||||||
|
def short_name(length = 8)
|
||||||
|
name.gsub(/<\/?.*?>/,"").html_safe if name
|
||||||
|
end
|
||||||
|
|
||||||
def strip_html(html)
|
def strip_html(html)
|
||||||
return html if html.empty? || !html.include?('<')
|
return html if html.empty? || !html.include?('<')
|
||||||
output = ""
|
output = ""
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
class FirstPage < ActiveRecord::Base
|
class FirstPage < ActiveRecord::Base
|
||||||
attr_accessible :description, :title, :web_title,:page_type
|
attr_accessible :description, :title, :web_title,:page_type
|
||||||
|
validates_presence_of :web_title, :title, :description,:page_type
|
||||||
|
validates_length_of :web_title,:title, maximum: 30
|
||||||
|
validates_length_of :description, maximum: 100
|
||||||
end
|
end
|
||||||
|
|
|
@ -41,7 +41,7 @@ class Project < ActiveRecord::Base
|
||||||
has_many :principals, :through => :member_principals, :source => :principal
|
has_many :principals, :through => :member_principals, :source => :principal
|
||||||
has_many :enabled_modules, :dependent => :delete_all
|
has_many :enabled_modules, :dependent => :delete_all
|
||||||
has_and_belongs_to_many :trackers, :order => "#{Tracker.table_name}.position"
|
has_and_belongs_to_many :trackers, :order => "#{Tracker.table_name}.position"
|
||||||
has_many :issues, :dependent => :destroy, :include => [:status, :tracker] , :order => "id ASC"
|
has_many :issues, :dependent => :destroy, :include => [:status, :tracker]
|
||||||
has_many :issue_changes, :through => :issues, :source => :journals
|
has_many :issue_changes, :through => :issues, :source => :journals
|
||||||
has_many :versions, :dependent => :destroy, :order => "#{Version.table_name}.effective_date DESC, #{Version.table_name}.name DESC"
|
has_many :versions, :dependent => :destroy, :order => "#{Version.table_name}.effective_date DESC, #{Version.table_name}.name DESC"
|
||||||
has_many :time_entries, :dependent => :delete_all
|
has_many :time_entries, :dependent => :delete_all
|
||||||
|
|
|
@ -163,7 +163,7 @@ class Setting < ActiveRecord::Base
|
||||||
end
|
end
|
||||||
|
|
||||||
# fixed domain url in development. tantantan's bug
|
# fixed domain url in development. tantantan's bug
|
||||||
if Rails.env.development?
|
if Rails.env.development? || Rails.env.test?
|
||||||
methods.map do |m|
|
methods.map do |m|
|
||||||
define_singleton_method m do; nil; end if m.to_s =~ /([a-zA-Z]+_domain)$/
|
define_singleton_method m do; nil; end if m.to_s =~ /([a-zA-Z]+_domain)$/
|
||||||
end
|
end
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
<p style="margin-left:60px;padding-right: 20px;">
|
<p style="margin-left:60px;padding-right: 20px;">
|
||||||
<label for='attachments_fields'> <%= l(:label_site_image) %>:</label>
|
<label for='attachments_fields'> <%= l(:label_site_image) %>:</label>
|
||||||
</p>
|
</p>
|
||||||
<div style="margin-left: 82px;">
|
<div style="margin-left: 82px;" id="avatar">
|
||||||
<%= render :partial=>"avatar/avatar_form",:style => "display:inline",:locals=> {source:@contest_page} %>
|
<%= render :partial=>"avatar/avatar_form",:style => "display:inline",:locals=> {source:@contest_page} %>
|
||||||
</div>
|
</div>
|
||||||
<p style="margin-left:60px;padding-right: 20px;">
|
<p style="margin-left:60px;padding-right: 20px;">
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
<p style="margin-left:60px;padding-right: 20px;">
|
<p style="margin-left:60px;padding-right: 20px;">
|
||||||
<label for='attachments_fields'> <%= l(:label_site_image) %>:</label>
|
<label for='attachments_fields'> <%= l(:label_site_image) %>:</label>
|
||||||
</p>
|
</p>
|
||||||
<div style="margin-left: 82px;">
|
<div style="margin-left: 82px;" id="avatar">
|
||||||
<%= render :partial=>"avatar/avatar_form",:style => "display:inline",:locals=> {source:@course_page} %>
|
<%= render :partial=>"avatar/avatar_form",:style => "display:inline",:locals=> {source:@course_page} %>
|
||||||
</div>
|
</div>
|
||||||
<p style="margin-left:60px;padding-right: 20px;">
|
<p style="margin-left:60px;padding-right: 20px;">
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
<p style="margin-left:60px;padding-right: 20px;">
|
<p style="margin-left:60px;padding-right: 20px;">
|
||||||
<label for='attachments_fields'> <%= l(:label_site_image) %>:</label>
|
<label for='attachments_fields'> <%= l(:label_site_image) %>:</label>
|
||||||
</p>
|
</p>
|
||||||
<div style="margin-left: 82px;">
|
<div style="margin-left: 82px;" id="avatar">
|
||||||
<%= render :partial=>"avatar/avatar_form",:style => "display:inline",:locals=> {source:@first_page} %>
|
<%= render :partial=>"avatar/avatar_form",:style => "display:inline",:locals=> {source:@first_page} %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
<div id="avatardiv">
|
||||||
<style type="text/css">
|
<style type="text/css">
|
||||||
a, a:hover {text-decoration:none;}
|
a, a:hover {text-decoration:none;}
|
||||||
.btn_addPic
|
.btn_addPic
|
||||||
|
@ -42,6 +43,7 @@
|
||||||
<div id="upload_progressbar" style="height:14px; margin-bottom: 10px;display: block"></div>
|
<div id="upload_progressbar" style="height:14px; margin-bottom: 10px;display: block"></div>
|
||||||
</div>
|
</div>
|
||||||
</span>
|
</span>
|
||||||
|
<%= link_to l(:button_delete_file),{:controller => :avatar,:action => :delete_image,:remote=>true,:source_type=> source.class,:source_id=>source.id},:confirm => l(:text_are_you_sure), :method => :post, :class => "btn_addPic", :style => "text-decoration:none;" %>
|
||||||
<a href="javascript:void(0);" class="btn_addPic" style="text-decoration:none;">
|
<a href="javascript:void(0);" class="btn_addPic" style="text-decoration:none;">
|
||||||
<span><%= l(:button_upload_photo) %></span>
|
<span><%= l(:button_upload_photo) %></span>
|
||||||
</a>
|
</a>
|
||||||
|
@ -70,3 +72,4 @@
|
||||||
<% content_for :header_tags do %>
|
<% content_for :header_tags do %>
|
||||||
<%= javascript_include_tag 'avatars' %>
|
<%= javascript_include_tag 'avatars' %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
</div>
|
|
@ -0,0 +1,5 @@
|
||||||
|
var avatardiv = $('#avatardiv');
|
||||||
|
avatardiv.replaceWith("<%= escape_javascript(render :partial=>'avatar/avatar_form',:style => 'display:inline',:locals=> {source:@source}) %>");
|
||||||
|
//var imgSpan = $('#avatar_image');
|
||||||
|
|
||||||
|
//imgSpan.attr({"src":'<#%= @urlfile.to_s << "?" << Time.now.to_s%>'});
|
|
@ -35,7 +35,7 @@
|
||||||
</tr>
|
</tr>
|
||||||
<% end -%>
|
<% end -%>
|
||||||
<% container.attachments.each do |file| %>
|
<% container.attachments.each do |file| %>
|
||||||
<%if file.is_public == 0 && !User.current.member_of?(@project)%>
|
<%if file.is_public == 0 && !User.current.member_of_course?(@course)%>
|
||||||
<%next%>
|
<%next%>
|
||||||
<%end%>
|
<%end%>
|
||||||
<tr class="file <%= cycle("odd", "odd") %>">
|
<tr class="file <%= cycle("odd", "odd") %>">
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
<% @containers.each do |container| %>
|
<% @containers.each do |container| %>
|
||||||
<% next if container.attachments.empty? -%>
|
<% next if container.attachments.empty? -%>
|
||||||
<% container.attachments.each do |file| %>
|
<% container.attachments.each do |file| %>
|
||||||
<% if file.is_public == 0 && !User.current.member_of?(@project) %>
|
<% if file.is_public == 0 && !User.current.member_of_course?(@course) %>
|
||||||
<% next %>
|
<% next %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% if isTypeOk(file, selAttachType, selContentType) %>
|
<% if isTypeOk(file, selAttachType, selContentType) %>
|
||||||
|
|
|
@ -45,7 +45,7 @@
|
||||||
<ul class="course_sub_menu">
|
<ul class="course_sub_menu">
|
||||||
<% User.current.courses.each do |course| %>
|
<% User.current.courses.each do |course| %>
|
||||||
<% if !course_endTime_timeout?(course) %>
|
<% if !course_endTime_timeout?(course) %>
|
||||||
<li><%= link_to course.name, course_path(course) %></li>
|
<li><%= link_to course.name.truncate(10, omission: '...'), course_path(course) %></li>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
</ul>
|
</ul>
|
||||||
|
@ -54,7 +54,7 @@
|
||||||
<li id="project_loggedas_li"><%= link_to l(:label_my_projects), {:controller => 'users', :action => 'user_projects', id: User.current.id, host: Setting.project_domain} %>
|
<li id="project_loggedas_li"><%= link_to l(:label_my_projects), {:controller => 'users', :action => 'user_projects', id: User.current.id, host: Setting.project_domain} %>
|
||||||
<ul class="project_sub_menu">
|
<ul class="project_sub_menu">
|
||||||
<% User.current.projects.each do |project| %>
|
<% User.current.projects.each do |project| %>
|
||||||
<li><%= link_to project.name, project_path(project) %></li>
|
<li><%= link_to project.name.truncate(10, omission: '...'), project_path(project) %></li>
|
||||||
<% end %>
|
<% end %>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
|
|
|
@ -36,20 +36,21 @@
|
||||||
<%= error_messages_for 'user' %>
|
<%= error_messages_for 'user' %>
|
||||||
|
|
||||||
<fieldset class="box" style="margin:10px;">
|
<fieldset class="box" style="margin:10px;">
|
||||||
|
|
||||||
|
<%= labelled_form_for :user, @user,
|
||||||
|
:url => {:action => "account"},
|
||||||
|
:html => {:id => 'my_account_form',
|
||||||
|
:method => :post} do |f| %>
|
||||||
<fieldset class="collapsible collapsed" style="width:800px;margin-left: 10px;">
|
<fieldset class="collapsible collapsed" style="width:800px;margin-left: 10px;">
|
||||||
<legend onclick="toggleFieldset(this);">
|
<legend onclick="toggleFieldset(this);">
|
||||||
<%= l(:label_my_photo) %>
|
<%= l(:label_my_photo) %>
|
||||||
</legend>
|
</legend>
|
||||||
<div>
|
<div>
|
||||||
<!--upload profiles-->
|
<!--upload profiles-->
|
||||||
<%= render :partial => "avatar/avatar_form", :locals => {source: @user} %>
|
<%= render :partial => "avatar/avatar_form",:style => "display:inline", :locals => {source: @user} %>
|
||||||
<!--upload-->
|
<!--upload-->
|
||||||
</div>
|
</div>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
<%= labelled_form_for :user, @user,
|
|
||||||
:url => {:action => "account"},
|
|
||||||
:html => {:id => 'my_account_form',
|
|
||||||
:method => :post} do |f| %>
|
|
||||||
<fieldset class="collapsible collapsed" style="width:800px;margin-left: 10px;">
|
<fieldset class="collapsible collapsed" style="width:800px;margin-left: 10px;">
|
||||||
<legend onclick="toggleFieldset(this);">
|
<legend onclick="toggleFieldset(this);">
|
||||||
<%= l(:label_information_plural) %>
|
<%= l(:label_information_plural) %>
|
||||||
|
|
|
@ -266,6 +266,7 @@ zh:
|
||||||
field_value: 值
|
field_value: 值
|
||||||
field_category: 类别
|
field_category: 类别
|
||||||
field_title: 标题
|
field_title: 标题
|
||||||
|
field_web_title: 浏览器标题
|
||||||
field_project: 项目
|
field_project: 项目
|
||||||
field_issue: 问题
|
field_issue: 问题
|
||||||
field_status: 状态
|
field_status: 状态
|
||||||
|
@ -1484,6 +1485,7 @@ zh:
|
||||||
label_contest_description: 内容:对你的竞赛进行描述
|
label_contest_description: 内容:对你的竞赛进行描述
|
||||||
label_requirement_bargain_money: 输入具体奖励方式(如金钱、奖项、学分)
|
label_requirement_bargain_money: 输入具体奖励方式(如金钱、奖项、学分)
|
||||||
button_upload_photo: 上传图片
|
button_upload_photo: 上传图片
|
||||||
|
button_delete_file: 删除
|
||||||
label_leave_me_message: 给我留言了
|
label_leave_me_message: 给我留言了
|
||||||
label_leave_others_message: 给他留言了
|
label_leave_others_message: 给他留言了
|
||||||
label_leave_a_message: 给他(她)留言
|
label_leave_a_message: 给他(她)留言
|
||||||
|
@ -1911,6 +1913,7 @@ zh:
|
||||||
label_memo_create_fail: 发布失败
|
label_memo_create_fail: 发布失败
|
||||||
label_forum_create_succ: 贴吧新建成功
|
label_forum_create_succ: 贴吧新建成功
|
||||||
label_forum_create_fail: 贴吧新建失败
|
label_forum_create_fail: 贴吧新建失败
|
||||||
|
label_first_page_create_fail: 首页定制失败
|
||||||
label_forum_edit: 编辑讨论区
|
label_forum_edit: 编辑讨论区
|
||||||
label_memo_create: 发布
|
label_memo_create: 发布
|
||||||
label_memo_new: 新建主题
|
label_memo_new: 新建主题
|
||||||
|
|
|
@ -577,7 +577,6 @@ RedmineApp::Application.routes.draw do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
match 'projects/course', :to => 'courses#course', :as => 'courses_course'
|
|
||||||
match 'courses/search', :to => 'courses#search'
|
match 'courses/search', :to => 'courses#search'
|
||||||
# add by nwb
|
# add by nwb
|
||||||
# 课程路由设置
|
# 课程路由设置
|
||||||
|
@ -629,6 +628,7 @@ RedmineApp::Application.routes.draw do
|
||||||
match 'uploads', :to => 'attachments#upload', :via => :post
|
match 'uploads', :to => 'attachments#upload', :via => :post
|
||||||
# Added by Tao
|
# Added by Tao
|
||||||
match 'upload_avatar', :to => 'avatar#upload', :via => :post
|
match 'upload_avatar', :to => 'avatar#upload', :via => :post
|
||||||
|
match 'delete_avatar', :to => 'avatar#delete_image',:via => :post
|
||||||
# Endof Tao's code
|
# Endof Tao's code
|
||||||
get 'robots.txt', :to => 'welcome#robots'
|
get 'robots.txt', :to => 'welcome#robots'
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,7 @@ class CreateFirstPages < ActiveRecord::Migration
|
||||||
t.string :web_title
|
t.string :web_title
|
||||||
t.string :title
|
t.string :title
|
||||||
t.string :description
|
t.string :description
|
||||||
|
t.string :page_type
|
||||||
|
|
||||||
t.timestamps
|
t.timestamps
|
||||||
end
|
end
|
||||||
|
@ -12,6 +13,8 @@ class CreateFirstPages < ActiveRecord::Migration
|
||||||
fp.web_title = "Trustie - 为大学生技术创新筑巢"
|
fp.web_title = "Trustie - 为大学生技术创新筑巢"
|
||||||
fp.title = "Trustie在线项目托管平台"
|
fp.title = "Trustie在线项目托管平台"
|
||||||
fp.description = "面向中国大学生与软件从业者,提供社交化的项目管理、代码托管、资源共享、合作交流。"
|
fp.description = "面向中国大学生与软件从业者,提供社交化的项目管理、代码托管、资源共享、合作交流。"
|
||||||
|
fp.page_type = "project"
|
||||||
|
|
||||||
fp.save
|
fp.save
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
class AddCloumnToFirstPage < ActiveRecord::Migration
|
class AddCloumnToFirstPage < ActiveRecord::Migration
|
||||||
def change
|
def change
|
||||||
add_column :first_pages,:type,:string
|
#add_column :first_pages,:type,:string
|
||||||
|
|
||||||
fr = FirstPage.all.first
|
#fr = FirstPage.all.first
|
||||||
fr.type = "project"
|
#fr.type = "project"
|
||||||
fr.save
|
#fr.save
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
class AltColumnName < ActiveRecord::Migration
|
class AltColumnName < ActiveRecord::Migration
|
||||||
def change
|
def change
|
||||||
rename_column :first_pages,:type,:page_type
|
#rename_column :first_pages,:type,:page_type
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
# -*coding:utf-8 -*-
|
||||||
|
class SetWebTitle < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
FirstPage.all.each do |fp|
|
||||||
|
fp.web_title = "Trustie - 为大学生技术创新筑巢"
|
||||||
|
fp.save
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
File diff suppressed because it is too large
Load Diff
Binary file not shown.
|
@ -8,7 +8,7 @@ gem 'actionpack'
|
||||||
require 'action_controller'
|
require 'action_controller'
|
||||||
|
|
||||||
gem 'mocha'
|
gem 'mocha'
|
||||||
require 'mocha'
|
require 'mocha/setup'
|
||||||
|
|
||||||
gem 'ruby-openid'
|
gem 'ruby-openid'
|
||||||
require 'openid'
|
require 'openid'
|
||||||
|
|
Binary file not shown.
|
@ -51,6 +51,7 @@ function ajaxUpload(file, fileSpan, inputEl) {
|
||||||
ajaxUpload.uploading--;
|
ajaxUpload.uploading--;
|
||||||
fileSpan.removeClass('ajax-loading');
|
fileSpan.removeClass('ajax-loading');
|
||||||
var form = fileSpan.parents('form');
|
var form = fileSpan.parents('form');
|
||||||
|
|
||||||
if (form.queue('upload').length == 0 && ajaxUpload.uploading == 0) {
|
if (form.queue('upload').length == 0 && ajaxUpload.uploading == 0) {
|
||||||
$('input:submit', form).removeAttr('disabled');
|
$('input:submit', form).removeAttr('disabled');
|
||||||
}
|
}
|
||||||
|
|
|
@ -2170,7 +2170,7 @@ ul.messages-for-user-reply li {
|
||||||
left: 115px;
|
left: 115px;
|
||||||
padding-bottom: 5px;
|
padding-bottom: 5px;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 40px;
|
top: 0px;
|
||||||
font-size: 1.1em;
|
font-size: 1.1em;
|
||||||
margin: 0px auto;
|
margin: 0px auto;
|
||||||
padding: 0px 0px;
|
padding: 0px 0px;
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
require File.expand_path('../../test_helper', __FILE__)
|
require File.expand_path('../../test_helper', __FILE__)
|
||||||
|
|
||||||
begin
|
begin
|
||||||
require 'mocha'
|
require 'mocha/setup'
|
||||||
rescue
|
rescue
|
||||||
# Won't run some tests
|
# Won't run some tests
|
||||||
end
|
end
|
||||||
|
|
|
@ -0,0 +1,96 @@
|
||||||
|
# Redmine - project management software
|
||||||
|
# Copyright (C) 2006-2013 Jean-Philippe Lang
|
||||||
|
#
|
||||||
|
# This program is free software; you can redistribute it and/or
|
||||||
|
# modify it under the terms of the GNU General Public License
|
||||||
|
# as published by the Free Software Foundation; either version 2
|
||||||
|
# of the License, or (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program; if not, write to the Free Software
|
||||||
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
|
||||||
|
require File.expand_path('../../../test_helper', __FILE__)
|
||||||
|
|
||||||
|
class RoutingProjectsTest < ActionController::IntegrationTest
|
||||||
|
def test_courses
|
||||||
|
assert_routing(
|
||||||
|
{ :method => 'get', :path => "/courses" },
|
||||||
|
{ :controller => 'courses', :action => 'index' }
|
||||||
|
)
|
||||||
|
end
|
||||||
|
def test_courses_search
|
||||||
|
assert_routing(
|
||||||
|
"/courses/search",
|
||||||
|
{controller: 'courses', action: 'search'}
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_courses_item
|
||||||
|
assert_routing(
|
||||||
|
'courses/233',
|
||||||
|
{controller: 'courses', action: 'show', id: '233'}
|
||||||
|
)
|
||||||
|
# id eq str
|
||||||
|
assert_routing(
|
||||||
|
'courses/timestypo',
|
||||||
|
{controller: 'courses', action: 'show', id: 'timestypo'}
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_course_setting
|
||||||
|
assert_routing(
|
||||||
|
'courses/233/settings',
|
||||||
|
{controller: 'courses', action: 'settings', id: '233'}
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_course_homework
|
||||||
|
assert_routing(
|
||||||
|
'courses/233/homework',
|
||||||
|
{controller: 'courses', action: 'homework', id: '233'}
|
||||||
|
)
|
||||||
|
assert_routing(
|
||||||
|
'courses/233/new_homework',
|
||||||
|
{controller: 'courses', action: 'new_homework', id: '233'}
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_course_file
|
||||||
|
assert_routing(
|
||||||
|
'courses/233/file',
|
||||||
|
{controller: 'courses', action: 'file', id: '233'}
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_course_feedback
|
||||||
|
assert_routing(
|
||||||
|
'courses/233/feedback',
|
||||||
|
{controller: 'courses', action: 'feedback', id: '233'}
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_course_member
|
||||||
|
assert_routing(
|
||||||
|
'courses/233/member',
|
||||||
|
{controller: 'courses', action: 'member', id: '233'}
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_course_finish_restart_course
|
||||||
|
assert_routing(
|
||||||
|
{path: 'courses/233/finishcourse', method: :post},
|
||||||
|
{controller: 'courses', action: 'finishcourse', id: '233'}
|
||||||
|
)
|
||||||
|
assert_routing(
|
||||||
|
{path: 'courses/233/restartcourse', method: :post},
|
||||||
|
{controller: 'courses', action: 'restartcourse', id: '233'}
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
|
@ -1,3 +1,55 @@
|
||||||
|
require 'rubygems'
|
||||||
|
require 'spork'
|
||||||
|
#uncomment the following line to use spork with the debugger
|
||||||
|
#require 'spork/ext/ruby-debug'
|
||||||
|
|
||||||
|
Spork.prefork do
|
||||||
|
# Loading more in this block will cause your tests to run faster. However,
|
||||||
|
# if you change any configuration or code from libraries loaded here, you'll
|
||||||
|
# need to restart spork for it take effect.
|
||||||
|
ENV["RAILS_ENV"] = "test"
|
||||||
|
require File.expand_path('../../config/environment', __FILE__)
|
||||||
|
require 'rails/test_help'
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
Spork.each_run do
|
||||||
|
# This code will be run each time you run your specs.
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
# --- Instructions ---
|
||||||
|
# Sort the contents of this file into a Spork.prefork and a Spork.each_run
|
||||||
|
# block.
|
||||||
|
#
|
||||||
|
# The Spork.prefork block is run only once when the spork server is started.
|
||||||
|
# You typically want to place most of your (slow) initializer code in here, in
|
||||||
|
# particular, require'ing any 3rd-party gems that you don't normally modify
|
||||||
|
# during development.
|
||||||
|
#
|
||||||
|
# The Spork.each_run block is run each time you run your specs. In case you
|
||||||
|
# need to load files that tend to change during development, require them here.
|
||||||
|
# With Rails, your application modules are loaded automatically, so sometimes
|
||||||
|
# this block can remain empty.
|
||||||
|
#
|
||||||
|
# Note: You can modify files loaded *from* the Spork.each_run block without
|
||||||
|
# restarting the spork server. However, this file itself will not be reloaded,
|
||||||
|
# so if you change any of the code inside the each_run block, you still need to
|
||||||
|
# restart the server. In general, if you have non-trivial code in this file,
|
||||||
|
# it's advisable to move it into a separate file so you can easily edit it
|
||||||
|
# without restarting spork. (For example, with RSpec, you could move
|
||||||
|
# non-trivial code into a file spec/support/my_helper.rb, making sure that the
|
||||||
|
# spec/support/* files are require'd from inside the each_run block.)
|
||||||
|
#
|
||||||
|
# Any code that is left outside the two blocks will be run during preforking
|
||||||
|
# *and* during each_run -- that's probably not what you want.
|
||||||
|
#
|
||||||
|
# These instructions should self-destruct in 10 seconds. If they don't, feel
|
||||||
|
# free to delete them.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Redmine - project management software
|
# Redmine - project management software
|
||||||
# Copyright (C) 2006-2013 Jean-Philippe Lang
|
# Copyright (C) 2006-2013 Jean-Philippe Lang
|
||||||
#
|
#
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
|
|
||||||
require File.expand_path('../../../../../../test_helper', __FILE__)
|
require File.expand_path('../../../../../../test_helper', __FILE__)
|
||||||
begin
|
begin
|
||||||
require 'mocha'
|
require 'mocha/setup'
|
||||||
|
|
||||||
class BazaarAdapterTest < ActiveSupport::TestCase
|
class BazaarAdapterTest < ActiveSupport::TestCase
|
||||||
REPOSITORY_PATH = Rails.root.join('tmp/test/bazaar_repository').to_s
|
REPOSITORY_PATH = Rails.root.join('tmp/test/bazaar_repository').to_s
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
|
|
||||||
require File.expand_path('../../../../../../test_helper', __FILE__)
|
require File.expand_path('../../../../../../test_helper', __FILE__)
|
||||||
begin
|
begin
|
||||||
require 'mocha'
|
require 'mocha/setup'
|
||||||
|
|
||||||
class CvsAdapterTest < ActiveSupport::TestCase
|
class CvsAdapterTest < ActiveSupport::TestCase
|
||||||
REPOSITORY_PATH = Rails.root.join('tmp/test/cvs_repository').to_s
|
REPOSITORY_PATH = Rails.root.join('tmp/test/cvs_repository').to_s
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
|
|
||||||
require File.expand_path('../../../../../../test_helper', __FILE__)
|
require File.expand_path('../../../../../../test_helper', __FILE__)
|
||||||
begin
|
begin
|
||||||
require 'mocha'
|
require 'mocha/setup'
|
||||||
|
|
||||||
class DarcsAdapterTest < ActiveSupport::TestCase
|
class DarcsAdapterTest < ActiveSupport::TestCase
|
||||||
REPOSITORY_PATH = Rails.root.join('tmp/test/darcs_repository').to_s
|
REPOSITORY_PATH = Rails.root.join('tmp/test/darcs_repository').to_s
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
|
|
||||||
require File.expand_path('../../../../../../test_helper', __FILE__)
|
require File.expand_path('../../../../../../test_helper', __FILE__)
|
||||||
begin
|
begin
|
||||||
require 'mocha'
|
require 'mocha/setup'
|
||||||
|
|
||||||
class GitAdapterTest < ActiveSupport::TestCase
|
class GitAdapterTest < ActiveSupport::TestCase
|
||||||
REPOSITORY_PATH = Rails.root.join('tmp/test/git_repository').to_s
|
REPOSITORY_PATH = Rails.root.join('tmp/test/git_repository').to_s
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
|
|
||||||
require File.expand_path('../../../../../../test_helper', __FILE__)
|
require File.expand_path('../../../../../../test_helper', __FILE__)
|
||||||
begin
|
begin
|
||||||
require 'mocha'
|
require 'mocha/setup'
|
||||||
|
|
||||||
class MercurialAdapterTest < ActiveSupport::TestCase
|
class MercurialAdapterTest < ActiveSupport::TestCase
|
||||||
HELPERS_DIR = Redmine::Scm::Adapters::MercurialAdapter::HELPERS_DIR
|
HELPERS_DIR = Redmine::Scm::Adapters::MercurialAdapter::HELPERS_DIR
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
require File.expand_path('../../../../../../test_helper', __FILE__)
|
require File.expand_path('../../../../../../test_helper', __FILE__)
|
||||||
|
|
||||||
begin
|
begin
|
||||||
require 'mocha'
|
require 'mocha/setup'
|
||||||
|
|
||||||
class SubversionAdapterTest < ActiveSupport::TestCase
|
class SubversionAdapterTest < ActiveSupport::TestCase
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue