OSDN Git Service

Merge branch 'v06' of git.sourceforge.jp:/gitroot/pettanr/pettanr into v06
[pettanr/pettanr.git] / app / controllers / home_controller.rb
index cc3895a..38af1a3 100644 (file)
@@ -1,8 +1,16 @@
 class HomeController < ApplicationController
-  
-  def start
-    
-  end
+  before_filter :authenticate_user, :only => [
+    :index, :show, :profile, :configure, :create_token, :delete_token, 
+    :scrolls, :scroll_panels, :comics, :comic_stories, :stories, :story_sheets, 
+    :sheets, :sheet_panels, 
+    :panels, :panel_pictures, :speech_balloons, :balloons, :speeches, :ground_pictures, :ground_colors
+  ]
+  before_filter :authenticate_author, :only => [
+    :scrolls, :scroll_panels, :comics, :comic_stories, :stories, :story_sheets, 
+    :sheets, :sheet_panels, 
+    :panels, :panel_pictures, :speech_balloons, :balloons, :speeches, :ground_pictures, :ground_colors
+  ]
+  before_filter :authenticate_artist, :only => [:resource_pictures]
   
   def index
   end
@@ -10,4 +18,109 @@ class HomeController < ApplicationController
   def profile
   end
   
+  def configure
+    @author = @operators.author
+    unless @author
+      @author = Author.new
+      @author.supply_default
+    end
+    @author.boosts 'post'
+    @author_form = Locmare::Bucket.factory @author.item_name, 'default', @author, true, true, @operators
+    @artist = @operators.artist
+    unless @artist
+      @artist = Artist.new
+      @artist.supply_default
+    end
+    @artist.boosts 'post'
+    @artist_form = Locmare::Bucket.factory @artist.item_name, 'default', @artist, true, true, @operators
+  end
+  
+  def create_token
+    if @operators.user.create_token
+      respond_to do |format|
+        flash[:notice] = I18n.t('flash.notice.created', :model => User.human_attribute_name(:authentication_token))
+        format.html { redirect_to({:action => :configure}) }
+      end
+    else
+      flash[:notice] = I18n.t('flash.notice.not_created', :model => User.human_attribute_name(:authentication_token))
+      format.html { render action: "configure" }
+    end
+  end
+  
+  def delete_token
+    if @operators.user.delete_token
+      respond_to do |format|
+        flash[:notice] = I18n.t('flash.notice.destroyed', :model => User.human_attribute_name(:authentication_token))
+        format.html { redirect_to :action => :configure}
+      end
+    else
+      flash[:notice] = I18n.t('flash.notice.not_destroyed', :model => User.human_attribute_name(:authentication_token))
+      format.html { render action: "configure" }
+    end
+  end
+  
+  def scrolls
+    filer_list
+  end
+  
+  def scroll_panels
+    filer_list
+  end
+  
+  def comics
+    filer_list
+  end
+  
+  def comic_stories
+    filer_list
+  end
+  
+  def stories
+    filer_list
+  end
+  
+  def story_sheets
+    filer_list
+  end
+  
+  def sheets
+    filer_list
+  end
+  
+  def sheet_panels
+    filer_list
+  end
+  
+  def panels
+    filer_list
+  end
+  
+  def panel_pictures
+    filer_list
+  end
+  
+  def speech_balloons
+    filer_list
+  end
+  
+  def balloons
+    filer_list
+  end
+  
+  def speeches
+    filer_list
+  end
+  
+  def ground_pictures
+    filer_list
+  end
+  
+  def ground_colors
+    filer_list
+  end
+  
+  def resource_pictures
+    filer_list
+  end
+  
 end