From 97850a27ff412de6ea4230e51a9cca4d92d62ca8 Mon Sep 17 00:00:00 2001 From: yasushiito Date: Sat, 29 Sep 2012 13:54:28 +0900 Subject: [PATCH] t#29689:test layout flag droppable --- app/controllers/colors_controller.rb | 2 +- app/controllers/comics_controller.rb | 2 +- app/controllers/ground_colors_controller.rb | 2 +- app/controllers/ground_pictures_controller.rb | 2 +- app/controllers/home_controller.rb | 2 +- app/controllers/license_groups_controller.rb | 2 +- app/controllers/licenses_controller.rb | 2 +- .../original_picture_license_groups_controller.rb | 2 +- app/controllers/original_pictures_controller.rb | 2 +- app/controllers/panel_colors_controller.rb | 2 +- app/controllers/panel_pictures_controller.rb | 2 +- app/controllers/panels_controller.rb | 2 +- app/controllers/pictures_controller.rb | 2 +- app/controllers/resource_pictures_controller.rb | 2 +- .../speech_balloon_templates_controller.rb | 2 +- app/controllers/stories_controller.rb | 2 +- app/controllers/system_controller.rb | 14 ++++++++++++++ app/controllers/system_pictures_controller.rb | 2 +- config/application.rb | 19 ++++++++++++++++++- config/environments/development.rb | 7 ------- config/environments/test.rb | 4 ++-- 21 files changed, 51 insertions(+), 27 deletions(-) diff --git a/app/controllers/colors_controller.rb b/app/controllers/colors_controller.rb index 00ea365f..d125dbb1 100644 --- a/app/controllers/colors_controller.rb +++ b/app/controllers/colors_controller.rb @@ -1,5 +1,5 @@ class ColorsController < ApplicationController - layout 'test' if Pettanr::TestLayout + layout 'test' if Pettanr::Application.test_layout # GET /colors # GET /colors.json diff --git a/app/controllers/comics_controller.rb b/app/controllers/comics_controller.rb index 1b6ccb35..38077173 100644 --- a/app/controllers/comics_controller.rb +++ b/app/controllers/comics_controller.rb @@ -1,5 +1,5 @@ class ComicsController < ApplicationController - layout 'test' if Pettanr::TestLayout + layout 'test' if Pettanr::Application.test_layout if Const.run_mode == 0 before_filter :authenticate_user!, :only => [:new, :create, :edit, :update, :destroy] else diff --git a/app/controllers/ground_colors_controller.rb b/app/controllers/ground_colors_controller.rb index 772f647c..459f0b3e 100644 --- a/app/controllers/ground_colors_controller.rb +++ b/app/controllers/ground_colors_controller.rb @@ -1,5 +1,5 @@ class GroundColorsController < ApplicationController - layout 'test' if Pettanr::TestLayout + layout 'test' if Pettanr::Application.test_layout before_filter :authenticate_user!, :only => [:index] # GET /ground_colors diff --git a/app/controllers/ground_pictures_controller.rb b/app/controllers/ground_pictures_controller.rb index aa23e7f0..755c4199 100644 --- a/app/controllers/ground_pictures_controller.rb +++ b/app/controllers/ground_pictures_controller.rb @@ -1,5 +1,5 @@ class GroundPicturesController < ApplicationController - layout 'test' if Pettanr::TestLayout + layout 'test' if Pettanr::Application.test_layout before_filter :authenticate_user!, :only => [:index] # GET /ground_pictures diff --git a/app/controllers/home_controller.rb b/app/controllers/home_controller.rb index 0384ec45..af11ec46 100644 --- a/app/controllers/home_controller.rb +++ b/app/controllers/home_controller.rb @@ -1,5 +1,5 @@ class HomeController < ApplicationController - layout 'test' if Pettanr::TestLayout + layout 'test' if Pettanr::Application.test_layout before_filter :authenticate_user!, :only => [ :index, :show, :profile, :configure, :create_token, :delete_token, :step2, :save_step2, :step3, :save_step3, :comic, :panel, :picture, :panel_picture, :panel_color, :ground_picture, :ground_color diff --git a/app/controllers/license_groups_controller.rb b/app/controllers/license_groups_controller.rb index 406de336..df576d8c 100644 --- a/app/controllers/license_groups_controller.rb +++ b/app/controllers/license_groups_controller.rb @@ -1,5 +1,5 @@ class LicenseGroupsController < ApplicationController - layout 'test' if Pettanr::TestLayout + layout 'test' if Pettanr::Application.test_layout before_filter :authenticate_admin!, :only => [:list, :browse] # GET /license_groups diff --git a/app/controllers/licenses_controller.rb b/app/controllers/licenses_controller.rb index 6e89e308..72c99331 100644 --- a/app/controllers/licenses_controller.rb +++ b/app/controllers/licenses_controller.rb @@ -1,5 +1,5 @@ class LicensesController < ApplicationController - layout 'test' if Pettanr::TestLayout + layout 'test' if Pettanr::Application.test_layout before_filter :authenticate_admin!, :only => [:list, :browse] # GET /licenses diff --git a/app/controllers/original_picture_license_groups_controller.rb b/app/controllers/original_picture_license_groups_controller.rb index 21f4f337..296e3b29 100644 --- a/app/controllers/original_picture_license_groups_controller.rb +++ b/app/controllers/original_picture_license_groups_controller.rb @@ -1,5 +1,5 @@ class OriginalPictureLicenseGroupsController < ApplicationController - layout 'test' if Pettanr::TestLayout + layout 'test' if Pettanr::Application.test_layout before_filter :authenticate_user!, :only => [:new, :create] before_filter :authenticate_artist, :only => [:new, :create] diff --git a/app/controllers/original_pictures_controller.rb b/app/controllers/original_pictures_controller.rb index e773eb90..3e5d9068 100644 --- a/app/controllers/original_pictures_controller.rb +++ b/app/controllers/original_pictures_controller.rb @@ -1,6 +1,6 @@ #原画 class OriginalPicturesController < ApplicationController - layout 'test' if Pettanr::TestLayout + layout 'test' if Pettanr::Application.test_layout before_filter :authenticate_user!, :only => [:index, :show, :history, :new, :edit, :create, :update, :destroy] before_filter :authenticate_admin!, :only => [:list, :browse] before_filter :authenticate_artist, :only => [:index, :show, :history, :new, :edit, :create, :update, :destroy] diff --git a/app/controllers/panel_colors_controller.rb b/app/controllers/panel_colors_controller.rb index 8572c1f5..2d43bef3 100644 --- a/app/controllers/panel_colors_controller.rb +++ b/app/controllers/panel_colors_controller.rb @@ -1,5 +1,5 @@ class PanelColorsController < ApplicationController - layout 'test' if Pettanr::TestLayout + layout 'test' if Pettanr::Application.test_layout before_filter :authenticate_user!, :only => [:index] # GET /ground_pictures diff --git a/app/controllers/panel_pictures_controller.rb b/app/controllers/panel_pictures_controller.rb index 4011887b..d7695a6d 100644 --- a/app/controllers/panel_pictures_controller.rb +++ b/app/controllers/panel_pictures_controller.rb @@ -1,5 +1,5 @@ class PanelPicturesController < ApplicationController - layout 'test' if Pettanr::TestLayout + layout 'test' if Pettanr::Application.test_layout before_filter :authenticate_user!, :only => [:index, :show] before_filter :authenticate_admin!, :only => [:list, :browse] diff --git a/app/controllers/panels_controller.rb b/app/controllers/panels_controller.rb index a7ad65f8..4065e12a 100644 --- a/app/controllers/panels_controller.rb +++ b/app/controllers/panels_controller.rb @@ -1,5 +1,5 @@ class PanelsController < ApplicationController - layout 'test' if Pettanr::TestLayout + layout 'test' if Pettanr::Application.test_layout before_filter :authenticate_user!, :only => [:index, :show, :new, :edit, :create, :update, :destroy] before_filter :authenticate_admin!, :only => [:list, :browse] diff --git a/app/controllers/pictures_controller.rb b/app/controllers/pictures_controller.rb index 4fe261a5..64c1d9fd 100644 --- a/app/controllers/pictures_controller.rb +++ b/app/controllers/pictures_controller.rb @@ -1,5 +1,5 @@ class PicturesController < ApplicationController - layout 'test' if Pettanr::TestLayout + layout 'test' if Pettanr::Application.test_layout before_filter :authenticate_user!, :only => [:show, :credit] def show diff --git a/app/controllers/resource_pictures_controller.rb b/app/controllers/resource_pictures_controller.rb index 8d31b6d5..5be77b5a 100644 --- a/app/controllers/resource_pictures_controller.rb +++ b/app/controllers/resource_pictures_controller.rb @@ -1,5 +1,5 @@ class ResourcePicturesController < ApplicationController - layout 'test' if Pettanr::TestLayout + layout 'test' if Pettanr::Application.test_layout before_filter :authenticate_user!, :only => [:index, :show, :credit, :new, :create, :update] before_filter :authenticate_admin!, :only => [:list, :browse] before_filter :authenticate_artist, :only => [:new, :create] diff --git a/app/controllers/speech_balloon_templates_controller.rb b/app/controllers/speech_balloon_templates_controller.rb index b84c68af..9f5bbd98 100644 --- a/app/controllers/speech_balloon_templates_controller.rb +++ b/app/controllers/speech_balloon_templates_controller.rb @@ -1,5 +1,5 @@ class SpeechBalloonTemplatesController < ApplicationController - layout 'test' if Pettanr::TestLayout + layout 'test' if Pettanr::Application.test_layout before_filter :authenticate_user!, :only => [:index, :show] before_filter :authenticate_admin!, :only => [:list, :browse, :destroy] diff --git a/app/controllers/stories_controller.rb b/app/controllers/stories_controller.rb index ea1bd9b7..c3fc902c 100644 --- a/app/controllers/stories_controller.rb +++ b/app/controllers/stories_controller.rb @@ -1,5 +1,5 @@ class StoriesController < ApplicationController - layout 'test' if Pettanr::TestLayout + layout 'test' if Pettanr::Application.test_layout if Const.run_mode == 0 before_filter :authenticate_user!, :only => [:new, :create, :edit, :update, :destroy] else diff --git a/app/controllers/system_controller.rb b/app/controllers/system_controller.rb index 528bd6ae..20ac6e41 100644 --- a/app/controllers/system_controller.rb +++ b/app/controllers/system_controller.rb @@ -57,4 +57,18 @@ class SystemController < ApplicationController end end + def production_layout + Pettanr::Application.test_layout = false + respond_to do |format| + format.html { render text: 'production', status: 200 } + end + end + + def test_layout + Pettanr::Application.test_layout = 'test' + respond_to do |format| + format.html { render text: 'test', status: 200 } + end + end + end diff --git a/app/controllers/system_pictures_controller.rb b/app/controllers/system_pictures_controller.rb index e43e6723..4d341f7e 100644 --- a/app/controllers/system_pictures_controller.rb +++ b/app/controllers/system_pictures_controller.rb @@ -1,5 +1,5 @@ class SystemPicturesController < ApplicationController - layout 'test' if Pettanr::TestLayout + layout 'test' if Pettanr::Application.test_layout before_filter :authenticate_user!, :only => [:index, :show] before_filter :authenticate_admin!, :only => [:list, :browse, :new, :create] diff --git a/config/application.rb b/config/application.rb index 3e3c7cce..683056d2 100644 --- a/config/application.rb +++ b/config/application.rb @@ -63,9 +63,22 @@ config.assets.initialize_on_precompile = false def self.licenses @@licenses end - + + def self.test_layout=(arg) + @@test_layout = arg + end + + def self.test_layout + @@test_layout + end end end + +if File.exist? Rails.root + 'config/test_layout' + Pettanr::Application.test_layout = 'test' +else + Pettanr::Application.test_layout = false +end Pettanr::Application.licenses = YAML.load(open(Rails.root + 'config/license.yml').read) MagicNumber = YAML.load(open(Rails.root + 'config/magic_number.yml').read) y = YAML.load(open(Rails.root + 'config/picture_io.yml').read) @@ -82,3 +95,7 @@ module ActiveRecord end end +module Pettanr + TestLayout = false +end + diff --git a/config/environments/development.rb b/config/environments/development.rb index 51f09cd2..2d66fcb3 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -32,10 +32,3 @@ Pettanr::Application.configure do # config.static_cache_control = "public, max-age=1" end -module Pettanr - if File.exist? Rails.root + 'config/test_layout' - TestLayout = 'test' - else - TestLayout = false - end -end diff --git a/config/environments/test.rb b/config/environments/test.rb index e05e0f33..3ceac7c9 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -40,8 +40,8 @@ end module Pettanr if File.exist? Rails.root + 'config/test_layout' - TestLayout = 'test' + test_layout = 'test' else - TestLayout = false + test_layout = false end end -- 2.11.0