OSDN Git Service

fix js
[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     :scrolls_count, :scroll_panels_count, :comics_count, :stories_count, :story_sheets_count, :sheets_count, :sheet_panels_count, :panels_count, :resource_pictures_count, :panel_pictures_count, :speech_balloons_count, :ground_pictures_count, :ground_colors_count
6   ]
7   before_filter :authenticate_author, :only => [
8     :scrolls, :scroll_panels, :comics, :stories, :story_sheets, :sheets, :sheet_panels, :panels, :panel_pictures, :speech_balloons, :ground_pictures, :ground_colors,
9     :scrolls_count, :scroll_panels_count, :comics_count, :stories_count, :story_sheets_count, :sheets_count, :sheet_panels_count, :panels_count, :resource_pictures_count, :panel_pictures_count, :speech_balloons_count, :ground_pictures_count, :ground_colors_count
10   ]
11   before_filter :authenticate_artist, :only => [:resource_pictures]
12   
13   def index
14   end
15   
16   def profile
17   end
18   
19   def configure
20     @author = @operators.author
21     unless @author
22       @author = Author.new
23       @author.supply_default
24     end
25     @author.boosts 'post'
26     @author_form = Locmare::Bucket.factory @author.item_name, @author, true, true, @operators
27     @artist = @operators.artist
28     unless @artist
29       @artist = Artist.new
30       @artist.supply_default
31     end
32     @artist.boosts 'post'
33     @artist_form = Locmare::Bucket.factory @artist.item_name, @artist, true, true, @operators
34   end
35   
36   def create_token
37     if @operators.user.create_token
38       respond_to do |format|
39         flash[:notice] = I18n.t('flash.notice.created', :model => User.human_attribute_name(:authentication_token))
40         format.html { redirect_to({:action => :configure}) }
41       end
42     else
43       flash[:notice] = I18n.t('flash.notice.not_created', :model => User.human_attribute_name(:authentication_token))
44       format.html { render action: "configure" }
45     end
46   end
47   
48   def delete_token
49     if @operators.user.delete_token
50       respond_to do |format|
51         flash[:notice] = I18n.t('flash.notice.destroyed', :model => User.human_attribute_name(:authentication_token))
52         format.html { redirect_to :action => :configure}
53       end
54     else
55       flash[:notice] = I18n.t('flash.notice.not_destroyed', :model => User.human_attribute_name(:authentication_token))
56       format.html { render action: "configure" }
57     end
58   end
59   
60   def scrolls
61     filer_list
62   end
63   
64   def scroll_panels
65     filer_list
66   end
67   
68   def comics
69     filer_list
70   end
71   
72   def stories
73     filer_list
74   end
75   
76   def story_sheets
77     filer_list
78   end
79   
80   def sheets
81     filer_list
82   end
83   
84   def sheet_panels
85     filer_list
86   end
87   
88   def panels
89     filer_list
90   end
91   
92   def panel_pictures
93     filer_list
94   end
95   
96   def speech_balloons
97     filer_list
98   end
99   
100   def ground_pictures
101     filer_list
102   end
103   
104   def ground_colors
105     filer_list
106   end
107   
108   def resource_pictures
109     filer_list
110   end
111   
112   def scrolls_count
113     list_count
114   end
115   
116   def scroll_panels_count
117     list_count
118   end
119   
120   def comics_count
121     list_count
122   end
123   
124   def stories_count
125     list_count
126   end
127   
128   def story_sheets_count
129     list_count
130   end
131   
132   def sheets_count
133     list_count
134   end
135   
136   def sheet_panels_count
137     list_count
138   end
139   
140   def panels_count
141     list_count
142   end
143   
144   def panel_pictures_count
145     list_count
146   end
147   
148   def speech_balloons_count
149     list_count
150   end
151   
152   def ground_pictures_count
153     list_count
154   end
155   
156   def ground_colors_count
157     list_count
158   end
159   
160   def resource_pictures_count
161     list_count
162   end
163   
164 end