OSDN Git Service

Merge branch 'v06' of git.sourceforge.jp:/gitroot/pettanr/pettanr into v06
[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, :comic_stories, :stories, :story_sheets, 
5     :sheets, :sheet_panels, 
6     :panels, :panel_pictures, :speech_balloons, :balloons, :speeches, :ground_pictures, :ground_colors
7   ]
8   before_filter :authenticate_author, :only => [
9     :scrolls, :scroll_panels, :comics, :comic_stories, :stories, :story_sheets, 
10     :sheets, :sheet_panels, 
11     :panels, :panel_pictures, :speech_balloons, :balloons, :speeches, :ground_pictures, :ground_colors
12   ]
13   before_filter :authenticate_artist, :only => [:resource_pictures]
14   
15   def index
16   end
17   
18   def profile
19   end
20   
21   def configure
22     @author = @operators.author
23     unless @author
24       @author = Author.new
25       @author.supply_default
26     end
27     @author.boosts 'post'
28     @author_form = Locmare::Bucket.factory @author.item_name, 'default', @author, true, true, @operators
29     @artist = @operators.artist
30     unless @artist
31       @artist = Artist.new
32       @artist.supply_default
33     end
34     @artist.boosts 'post'
35     @artist_form = Locmare::Bucket.factory @artist.item_name, 'default', @artist, true, true, @operators
36   end
37   
38   def create_token
39     if @operators.user.create_token
40       respond_to do |format|
41         flash[:notice] = I18n.t('flash.notice.created', :model => User.human_attribute_name(:authentication_token))
42         format.html { redirect_to({:action => :configure}) }
43       end
44     else
45       flash[:notice] = I18n.t('flash.notice.not_created', :model => User.human_attribute_name(:authentication_token))
46       format.html { render action: "configure" }
47     end
48   end
49   
50   def delete_token
51     if @operators.user.delete_token
52       respond_to do |format|
53         flash[:notice] = I18n.t('flash.notice.destroyed', :model => User.human_attribute_name(:authentication_token))
54         format.html { redirect_to :action => :configure}
55       end
56     else
57       flash[:notice] = I18n.t('flash.notice.not_destroyed', :model => User.human_attribute_name(:authentication_token))
58       format.html { render action: "configure" }
59     end
60   end
61   
62   def scrolls
63     filer_list
64   end
65   
66   def scroll_panels
67     filer_list
68   end
69   
70   def comics
71     filer_list
72   end
73   
74   def comic_stories
75     filer_list
76   end
77   
78   def stories
79     filer_list
80   end
81   
82   def story_sheets
83     filer_list
84   end
85   
86   def sheets
87     filer_list
88   end
89   
90   def sheet_panels
91     filer_list
92   end
93   
94   def panels
95     filer_list
96   end
97   
98   def panel_pictures
99     filer_list
100   end
101   
102   def speech_balloons
103     filer_list
104   end
105   
106   def balloons
107     filer_list
108   end
109   
110   def speeches
111     filer_list
112   end
113   
114   def ground_pictures
115     filer_list
116   end
117   
118   def ground_colors
119     filer_list
120   end
121   
122   def resource_pictures
123     filer_list
124   end
125   
126 end