OSDN Git Service

Merge branch 'v05' of git.sourceforge.jp:/gitroot/pettanr/pettanr into v05
[pettanr/pettanr.git] / app / controllers / system_controller.rb
index d8276f8..778c9c9 100644 (file)
@@ -4,23 +4,58 @@ class SystemController < ApplicationController
   #layout :system
   
   def start
-  
   end
   
   def index
   end
   
+  def import
+  end
+  
   def browse
   end
   
   def auth_token
   end
   
-  def approbe
+  def create_token
+    @admin = current_admin
+    respond_to do |format|
+      if @admin.create_token
+        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
+    respond_to do |format|
+      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
+  
+  def approve
+    @admin = Admin.find params[:id]
+    respond_to do |format|
+      if @admin.apv
+        format.html { redirect_to({:action => :waiting_list}, {:notice => 'admin was successfully approved.'}) }
+      else
+        format.html { render action: "waiting_list" }
+      end
+    end
   end
   
   def waiting_list
-    @newadmins = Admin.find(:all, :conditions => ['activate = 0'])
+    @waits = Admin.find(:all, :conditions => ['approve = 0'])
   end
   
   def accept_admin
@@ -32,4 +67,18 @@ class SystemController < ApplicationController
     end
   end
   
+  def production_layout
+    MagicNumber['test_layout'] = false
+    respond_to do |format|
+      format.html { render text: 'production', status: 200 }
+    end
+  end
+  
+  def test_layout
+    MagicNumber['test_layout'] = 'test'
+    respond_to do |format|
+      format.html { render text: 'test', status: 200 }
+    end
+  end
+  
 end