OSDN Git Service

Merge branch 'v05' of git.sourceforge.jp:/gitroot/pettanr/pettanr into v05i18n
[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 import
13   end
14   
15   def browse
16   end
17   
18   def auth_token
19   end
20   
21   def create_token
22     @admin = current_admin
23     respond_to do |format|
24       if @admin.create_token
25         format.html { redirect_to({:action => :auth_token}, {:notice => 'admin token was successfully created.'}) }
26       else
27         format.html { render action: "auth_token" }
28       end
29     end
30   end
31   
32   def delete_token
33     current_admin.delete_token
34     respond_to do |format|
35       format.html { redirect_to :action => :auth_token}
36     end
37   end
38   
39   def approve
40     @admin = Admin.find params[:id]
41     respond_to do |format|
42       if @admin.apv
43         format.html { redirect_to({:action => :waiting_list}, {:notice => 'admin was successfully approved.'}) }
44       else
45         format.html { render action: "waiting_list" }
46       end
47     end
48   end
49   
50   def waiting_list
51     @waits = Admin.find(:all, :conditions => ['approve = 0'])
52   end
53   
54   def accept_admin
55     @newadmin = Admin.find params[:id]
56     if admin_signed_in? and current_admin.activate
57       @newadmin.activate = 1
58       @newadmin.save
59     else
60     end
61   end
62   
63   def production_layout
64     MagicNumber['test_layout'] = false
65     respond_to do |format|
66       format.html { render text: 'production', status: 200 }
67     end
68   end
69   
70   def test_layout
71     MagicNumber['test_layout'] = 'test'
72     respond_to do |format|
73       format.html { render text: 'test', status: 200 }
74     end
75   end
76   
77 end