OSDN Git Service

293ed5d9ea71016e6fed51d020e301f9c084a9b3
[pettanr/pettanr.git] / app / controllers / home_controller.rb
1 class HomeController < ApplicationController
2   before_filter :authenticate_user, :only => [
3     :index, :show, :profile, :configure, :create_token, :delete_token, 
4     :scrolls, :scroll_panels, :comics, :stories, :story_sheets, :sheets, :sheet_panels, :panels, :resource_pictures, :panel_pictures, :speech_balloons, :ground_pictures, :ground_colors
5   ]
6   before_filter :authenticate_author, :only => [:scrolls, :scroll_panels, :comics, :stories, :story_sheets, :sheets, :sheet_panels, :panels, :panel_pictures, :speech_balloons, :ground_pictures, :ground_colors]
7   before_filter :authenticate_artist, :only => [:resource_pictures]
8   
9   def index
10   end
11   
12   def profile
13   end
14   
15   def configure
16   end
17   
18   def create_token
19     if @operators.user.create_token
20       respond_to do |format|
21         flash[:notice] = I18n.t('flash.notice.created', :model => User.human_attribute_name(:authentication_token))
22         format.html { redirect_to({:action => :configure}) }
23       end
24     else
25       flash[:notice] = I18n.t('flash.notice.not_created', :model => User.human_attribute_name(:authentication_token))
26       format.html { render action: "configure" }
27     end
28   end
29   
30   def delete_token
31     if @operators.user.delete_token
32       respond_to do |format|
33         flash[:notice] = I18n.t('flash.notice.destroyed', :model => User.human_attribute_name(:authentication_token))
34         format.html { redirect_to :action => :configure}
35       end
36     else
37       flash[:notice] = I18n.t('flash.notice.not_destroyed', :model => User.human_attribute_name(:authentication_token))
38       format.html { render action: "configure" }
39     end
40   end
41   
42   def scrolls
43     my_list params
44   end
45   
46   def scroll_panels
47     my_list params
48   end
49   
50   def comics
51     my_list params
52   end
53   
54   def stories
55     my_list params
56   end
57   
58   def story_sheets
59     my_list params
60   end
61   
62   def sheets
63     my_list params
64   end
65   
66   def sheet_panels
67     my_list params
68   end
69   
70   def panels
71     my_list params
72   end
73   
74   def panel_pictures
75     my_list params
76   end
77   
78   def speech_balloons
79     my_list params
80   end
81   
82   def ground_pictures
83     my_list params
84   end
85   
86   def ground_colors
87     my_list params
88   end
89   
90   def resource_pictures
91     my_list params
92   end
93   
94 end