OSDN Git Service

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