OSDN Git Service

Merge branch 'v05' of git.sourceforge.jp:/gitroot/pettanr/pettanr into v05
[pettanr/pettanr.git] / app / controllers / system_controller.rb
index 20ac6e4..778c9c9 100644 (file)
@@ -9,6 +9,9 @@ class SystemController < ApplicationController
   def index
   end
   
+  def import
+  end
+  
   def browse
   end
   
@@ -19,17 +22,24 @@ class SystemController < ApplicationController
     @admin = current_admin
     respond_to do |format|
       if @admin.create_token
-        format.html { redirect_to({:action => :auth_token}, {:notice => 'admin token was successfully created.'}) }
+        flash[:notice] = I18n.t('flash.notice.created', :model => Admin.human_attribute_name(:authentication_token))
+        format.html { redirect_to({:action => :auth_token}) }
       else
+        flash[:notice] = I18n.t('flash.notice.not_created', :model => Admin.human_attribute_name(:authentication_token))
         format.html { render action: "auth_token" }
       end
     end
   end
   
   def delete_token
-    current_admin.delete_token
     respond_to do |format|
-      format.html { redirect_to :action => :auth_token}
+      if current_admin.delete_token
+        flash[:notice] = I18n.t('flash.notice.destroyed', :model => Admin.human_attribute_name(:authentication_token))
+        format.html { redirect_to :action => :auth_token}
+      else
+        flash[:notice] = I18n.t('flash.notice.not_destroyed', :model => Admin.human_attribute_name(:authentication_token))
+        format.html { render action: "auth_token" }
+      end
     end
   end
   
@@ -58,14 +68,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