OSDN Git Service

69c0a9348ce1fa5e9685e1da395d306ea3ea5f6b
[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   
8   end
9   
10   def index
11   end
12   
13   def browse
14   end
15   
16   def auth_token
17   end
18   
19   def create_token
20     @admin = current_admin
21     respond_to do |format|
22       if @admin.create_token
23         format.html { redirect_to({:action => :auth_token}, {:notice => 'admin token was successfully created.'}) }
24       else
25         format.html { render action: "auth_token" }
26       end
27     end
28   end
29   
30   def delete_token
31     current_admin.delete_token
32     respond_to do |format|
33       format.html { redirect_to :action => :auth_token}
34     end
35   end
36   
37   def approve
38     @admin = Admin.find params[:id]
39     respond_to do |format|
40       if @admin.apv
41         format.html { redirect_to({:action => :waiting_list}, {:notice => 'admin was successfully approved.'}) }
42       else
43         format.html { render action: "waiting_list" }
44       end
45     end
46   end
47   
48   def waiting_list
49     @waits = Admin.find(:all, :conditions => ['approve = 0'])
50   end
51   
52   def accept_admin
53     @newadmin = Admin.find params[:id]
54     if admin_signed_in? and current_admin.activate
55       @newadmin.activate = 1
56       @newadmin.save
57     else
58     end
59   end
60   
61 end