OSDN Git Service

t#31056:add diff import
[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         flash[:notice] = I18n.t('flash.notice.created', :model => Admin.human_attribute_name(:authentication_token))
26         format.html { redirect_to({:action => :auth_token}) }
27       else
28         flash[:notice] = I18n.t('flash.notice.not_created', :model => Admin.human_attribute_name(:authentication_token))
29         format.html { render action: "auth_token" }
30       end
31     end
32   end
33   
34   def delete_token
35     respond_to do |format|
36       if current_admin.delete_token
37         flash[:notice] = I18n.t('flash.notice.destroyed', :model => Admin.human_attribute_name(:authentication_token))
38         format.html { redirect_to :action => :auth_token}
39       else
40         flash[:notice] = I18n.t('flash.notice.not_destroyed', :model => Admin.human_attribute_name(:authentication_token))
41         format.html { render action: "auth_token" }
42       end
43     end
44   end
45   
46   def approve
47     @admin = Admin.find params[:id]
48     respond_to do |format|
49       if @admin.apv
50         format.html { redirect_to({:action => :waiting_list}, {:notice => 'admin was successfully approved.'}) }
51       else
52         format.html { render action: "waiting_list" }
53       end
54     end
55   end
56   
57   def waiting_list
58     @waits = Admin.find(:all, :conditions => ['approve = 0'])
59   end
60   
61   def accept_admin
62     @newadmin = Admin.find params[:id]
63     if admin_signed_in? and current_admin.activate
64       @newadmin.activate = 1
65       @newadmin.save
66     else
67     end
68   end
69   
70   def production_layout
71     MagicNumber['test_layout'] = false
72     respond_to do |format|
73       format.html { render text: 'production', status: 200 }
74     end
75   end
76   
77   def test_layout
78     MagicNumber['test_layout'] = 'test'
79     respond_to do |format|
80       format.html { render text: 'test', status: 200 }
81     end
82   end
83   
84 end