OSDN Git Service

d8cbb0b12cbe8a78a6a23a15e84c18777b0999a8
[pettanr/pettanr.git] / app / controllers / system_controller.rb
1 class SystemController < ApplicationController
2   before_filter :authenticate_admin!, :except => [:start]
3   
4   #layout :system
5   
6   def start
7   end
8   
9   def index
10   end
11   
12   def browse
13   end
14   
15   def auth_token
16   end
17   
18   def create_token
19     @admin = current_admin
20     respond_to do |format|
21       if @admin.create_token
22         format.html { redirect_to({:action => :auth_token}, {:notice => 'admin token was successfully created.'}) }
23       else
24         format.html { render action: "auth_token" }
25       end
26     end
27   end
28   
29   def delete_token
30     current_admin.delete_token
31     respond_to do |format|
32       format.html { redirect_to :action => :auth_token}
33     end
34   end
35   
36   def approve
37     @admin = Admin.find params[:id]
38     respond_to do |format|
39       if @admin.apv
40         format.html { redirect_to({:action => :waiting_list}, {:notice => 'admin was successfully approved.'}) }
41       else
42         format.html { render action: "waiting_list" }
43       end
44     end
45   end
46   
47   def waiting_list
48     @waits = Admin.find(:all, :conditions => ['approve = 0'])
49   end
50   
51   def accept_admin
52     @newadmin = Admin.find params[:id]
53     if admin_signed_in? and current_admin.activate
54       @newadmin.activate = 1
55       @newadmin.save
56     else
57     end
58   end
59   
60   def production_layout
61     MagicNumber['test_layout'] = false
62     respond_to do |format|
63       format.html { render text: 'production', status: 200 }
64     end
65   end
66   
67   def test_layout
68     MagicNumber['test_layout'] = 'test'
69     respond_to do |format|
70       format.html { render text: 'test', status: 200 }
71     end
72   end
73   
74 end