OSDN Git Service

t#29693:test layout flag move to magic number
authoryasushiito <yas@pen-chan.jp>
Tue, 9 Oct 2012 10:36:17 +0000 (19:36 +0900)
committeryasushiito <yas@pen-chan.jp>
Tue, 9 Oct 2012 10:36:17 +0000 (19:36 +0900)
25 files changed:
app/controllers/artists_controller.rb
app/controllers/authors_controller.rb
app/controllers/balloons_controller.rb
app/controllers/colors_controller.rb
app/controllers/comics_controller.rb
app/controllers/ground_colors_controller.rb
app/controllers/ground_pictures_controller.rb
app/controllers/home_controller.rb
app/controllers/license_groups_controller.rb
app/controllers/licenses_controller.rb
app/controllers/original_picture_license_groups_controller.rb
app/controllers/original_pictures_controller.rb
app/controllers/panel_colors_controller.rb
app/controllers/panel_pictures_controller.rb
app/controllers/panels_controller.rb
app/controllers/pictures_controller.rb
app/controllers/resource_pictures_controller.rb
app/controllers/speech_balloon_templates_controller.rb
app/controllers/speech_balloons_controller.rb
app/controllers/speeches_controller.rb
app/controllers/stories_controller.rb
app/controllers/system_controller.rb
app/controllers/system_pictures_controller.rb
app/views/layouts/test.html.erb
config/application.rb

index afacb4a..aab67cb 100644 (file)
@@ -1,5 +1,5 @@
 class ArtistsController < ApplicationController
-layout 'test'
+  layout 'test' if MagicNumber['test_layout']
   before_filter :authenticate_user!, :only => [:index, :show, :new, :create, :edit, :update, :destroy]
   before_filter :authenticate_admin!, :only => [:list, :browse]
 
index da74488..7e2055b 100644 (file)
@@ -1,4 +1,5 @@
 class AuthorsController < ApplicationController
+  layout 'test' if MagicNumber['test_layout']
   before_filter :authenticate_user!, :only => [:index, :show, :edit, :update]
   before_filter :authenticate_admin!, :only => [:list, :browse]
 
index 4d2bd33..8b58880 100644 (file)
@@ -1,4 +1,5 @@
 class BalloonsController < ApplicationController
+  layout 'test' if MagicNumber['test_layout']
   before_filter :authenticate_admin!, :only => [:list, :browse]
   
   def list
index d125dbb..ea99428 100644 (file)
@@ -1,5 +1,5 @@
 class ColorsController < ApplicationController
-  layout 'test' if Pettanr::Application.test_layout
+  layout 'test' if MagicNumber['test_layout']
   
   # GET /colors
   # GET /colors.json
index 4107325..bac6ee0 100644 (file)
@@ -1,5 +1,5 @@
 class ComicsController < ApplicationController
-  layout 'test' if Pettanr::Application.test_layout
+  layout 'test' if MagicNumber['test_layout']
   if MagicNumber['run_mode'] == 0
     before_filter :authenticate_user!, :only => [:new, :create, :edit, :update, :destroy]
   else
index 459f0b3..4879790 100644 (file)
@@ -1,5 +1,5 @@
 class GroundColorsController < ApplicationController
-  layout 'test' if Pettanr::Application.test_layout
+  layout 'test' if MagicNumber['test_layout']
   before_filter :authenticate_user!, :only => [:index]
 
   # GET /ground_colors
index 755c419..6415264 100644 (file)
@@ -1,5 +1,5 @@
 class GroundPicturesController < ApplicationController
-  layout 'test' if Pettanr::Application.test_layout
+  layout 'test' if MagicNumber['test_layout']
   before_filter :authenticate_user!, :only => [:index]
 
   # GET /ground_pictures
index af11ec4..fdc3fe3 100644 (file)
@@ -1,5 +1,5 @@
 class HomeController < ApplicationController
-  layout 'test' if Pettanr::Application.test_layout
+  layout 'test' if MagicNumber['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
index df576d8..4433053 100644 (file)
@@ -1,5 +1,5 @@
 class LicenseGroupsController < ApplicationController
-  layout 'test' if Pettanr::Application.test_layout
+  layout 'test' if MagicNumber['test_layout']
   before_filter :authenticate_admin!, :only => [:list, :browse]
   
   # GET /license_groups
index 72c9933..59e24e2 100644 (file)
@@ -1,5 +1,5 @@
 class LicensesController < ApplicationController
-  layout 'test' if Pettanr::Application.test_layout
+  layout 'test' if MagicNumber['test_layout']
   before_filter :authenticate_admin!, :only => [:list, :browse]
 
   # GET /licenses
index 296e3b2..fd85cea 100644 (file)
@@ -1,5 +1,5 @@
 class OriginalPictureLicenseGroupsController < ApplicationController
-  layout 'test' if Pettanr::Application.test_layout
+  layout 'test' if MagicNumber['test_layout']
   before_filter :authenticate_user!, :only => [:new, :create]
   before_filter :authenticate_artist, :only => [:new, :create]
   
index 3e5d906..e322b6c 100644 (file)
@@ -1,6 +1,6 @@
 #原画
 class OriginalPicturesController < ApplicationController
-  layout 'test' if Pettanr::Application.test_layout
+  layout 'test' if MagicNumber['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]
index 2d43bef..1134379 100644 (file)
@@ -1,5 +1,5 @@
 class PanelColorsController < ApplicationController
-  layout 'test' if Pettanr::Application.test_layout
+  layout 'test' if MagicNumber['test_layout']
   before_filter :authenticate_user!, :only => [:index]
 
   # GET /ground_pictures
index d7695a6..dc5cd21 100644 (file)
@@ -1,5 +1,5 @@
 class PanelPicturesController < ApplicationController
-  layout 'test' if Pettanr::Application.test_layout
+  layout 'test' if MagicNumber['test_layout']
   before_filter :authenticate_user!, :only => [:index, :show]
   before_filter :authenticate_admin!, :only => [:list, :browse]
 
index 4065e12..544ecc0 100644 (file)
@@ -1,5 +1,5 @@
 class PanelsController < ApplicationController
-  layout 'test' if Pettanr::Application.test_layout
+  layout 'test' if MagicNumber['test_layout']
   before_filter :authenticate_user!, :only => [:index, :show, :new, :edit, :create, :update, :destroy]
   before_filter :authenticate_admin!, :only => [:list, :browse]
 
index 850ef31..30dd929 100644 (file)
@@ -1,5 +1,5 @@
 class PicturesController < ApplicationController
-  layout 'test' if Pettanr::Application.test_layout
+  layout 'test' if MagicNumber['test_layout']
   before_filter :authenticate_user!, :only => [:show, :credit, :md5]
   before_filter :authenticate_artist, :only => [:md5]
   
index 5be77b5..7054277 100644 (file)
@@ -1,5 +1,5 @@
 class ResourcePicturesController < ApplicationController
-  layout 'test' if Pettanr::Application.test_layout
+  layout 'test' if MagicNumber['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]
index 9f5bbd9..77a808d 100644 (file)
@@ -1,5 +1,5 @@
 class SpeechBalloonTemplatesController < ApplicationController
-  layout 'test' if Pettanr::Application.test_layout
+  layout 'test' if MagicNumber['test_layout']
   before_filter :authenticate_user!, :only => [:index, :show]
   before_filter :authenticate_admin!, :only => [:list, :browse, :destroy]
 
index 85a39e2..2152cd1 100644 (file)
@@ -1,4 +1,5 @@
 class SpeechBalloonsController < ApplicationController
+  layout 'test' if MagicNumber['test_layout']
   before_filter :authenticate_admin!, :only => [:list, :browse]
 
   def list
index 7e53b73..b9a3c7b 100644 (file)
@@ -1,4 +1,5 @@
 class SpeechesController < ApplicationController
+  layout 'test' if MagicNumber['test_layout']
   before_filter :authenticate_user!, :only => [:index, :show]
   before_filter :authenticate_admin!, :only => [:list, :browse]
 
index c8b710c..bcb470e 100644 (file)
@@ -1,5 +1,5 @@
 class StoriesController < ApplicationController
-  layout 'test' if Pettanr::Application.test_layout
+  layout 'test' if MagicNumber['test_layout']
   if MagicNumber['run_mode'] == 0
     before_filter :authenticate_user!, :only => [:new, :create, :edit, :update, :destroy]
   else
index 20ac6e4..d8cbb0b 100644 (file)
@@ -58,14 +58,14 @@ class SystemController < ApplicationController
   end
   
   def production_layout
-    Pettanr::Application.test_layout = false
+    MagicNumber['test_layout'] = false
     respond_to do |format|
       format.html { render text: 'production', status: 200 }
     end
   end
   
   def test_layout
-    Pettanr::Application.test_layout = 'test'
+    MagicNumber['test_layout'] = 'test'
     respond_to do |format|
       format.html { render text: 'test', status: 200 }
     end
index 4d341f7..ec7d4cb 100644 (file)
@@ -1,5 +1,5 @@
 class SystemPicturesController < ApplicationController
-  layout 'test' if Pettanr::Application.test_layout
+  layout 'test' if MagicNumber['test_layout']
   before_filter :authenticate_user!, :only => [:index, :show]
   before_filter :authenticate_admin!, :only => [:list, :browse, :new, :create]
 
index 45a8b70..cb151c1 100644 (file)
@@ -3,6 +3,7 @@
 <head>\r
   <title>Pettanr</title>\r
   <%= stylesheet_link_tag    "application" %>\r
+  <%= stylesheet_link_tag "test.css" %>\r
   <%= javascript_include_tag "application" %>\r
   <%= csrf_meta_tags %>\r
 </head>\r
index 683056d..66efbcc 100644 (file)
@@ -63,24 +63,16 @@ 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)
+MagicNumber['test_layout'] = if File.exist? Rails.root + 'config/test_layout'
+  'test'
+else
+  false
+end
 y = YAML.load(open(Rails.root + 'config/picture_io.yml').read)
 require y[Rails.env]["adapter"]
 pio = PictureIO.const_get y[Rails.env]["io"]