OSDN Git Service

fix manifest
[pettanr/pettanr.git] / app / controllers / home_controller.rb
index 8466eb3..5457786 100644 (file)
@@ -1,14 +1,12 @@
 class HomeController < ApplicationController
-  layout 'test' if MagicNumber['test_layout']
-  before_filter :authenticate_user!, :only => [
+  before_filter :authenticate_user, :only => [
     :index, :show, :profile, :configure, :create_token, :delete_token, 
-    :comic, :story, :panel, :picture, :panel_picture, :panel_color, :ground_picture, :ground_color
+    :scrolls, :scroll_panels, :comics, :stories, :story_sheets, :sheets, :sheet_panels, :panels, :resource_pictures, :panel_pictures, :speech_balloons, :ground_pictures, :ground_colors
   ]
   before_filter :authenticate_author, :only => [
-    :index, :show, :profile, :configure, :create_token, :delete_token, 
-    :comic, :story, :panel, :picture, :panel_picture, :panel_color, :ground_picture, :ground_color
+    :scrolls, :scroll_panels, :comics, :stories, :story_sheets, :sheets, :sheet_panels, :panels, :panel_pictures, :speech_balloons, :ground_pictures, :ground_colors
   ]
-  before_filter :authenticate_artist, :only => [:picture]
+  before_filter :authenticate_artist, :only => [:resource_pictures]
   
   def index
   end
@@ -20,97 +18,79 @@ class HomeController < ApplicationController
   end
   
   def create_token
-    respond_to do |format|
-      if @user.create_token
-        format.html { redirect_to({:action => :configure}, {:notice => 'user token was successfully created.'}) }
-      else
-        format.html { render action: "auth_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
-    @user.delete_token
-    respond_to do |format|
-      format.html { redirect_to :action => :configure}
+    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 comic
-    @page = Author.page params[:page]
-    @page_size = Author.comic_page_size params[:page_size]
-    @comics = Comic.mylist(@author, @page, @page_size)
-
-    respond_to do |format|
-      format.html # index.html.erb
-      format.json { render json: @comics.to_json(Comic.list_json_opt) }
-    end
+  def scrolls
+    filer_list
   end
   
-  def story
-    @page = Author.page params[:page]
-    @page_size = Author.story_page_size params[:page_size]
-    @stories = Story.mylist(@author, @page, @page_size)
-
-    respond_to do |format|
-      format.html # index.html.erb
-      format.json { render text: Story.list_as_json_text(@stories) }
-    end
+  def scroll_panels
+    filer_list
   end
   
-  def panel
-    @page = Author.page params[:page]
-    @page_size = Author.panel_page_size params[:page_size]
-    @panels = Panel.mylist(@author, @page, @page_size)
-
-    respond_to do |format|
-      format.html # index.html.erb
-      format.json { render text: Panel.list_as_json_text(@panels) }
-    end
+  def comics
+    filer_list
   end
   
-  def panel_picture
-    @page = Author.page params[:page]
-    @page_size = Author.panel_picture_page_size params[:page_size]
-    @panel_pictures = PanelPicture.mylist(@author, @page, @page_size)
-
-    respond_to do |format|
-      format.html # index.html.erb
-      format.json { render json: @panel_pictures.to_json(PanelPicture.list_json_opt) }
-    end
+  def stories
+    filer_list
   end
   
-  def panel_color
-    @page = Author.page params[:page]
-    @page_size = Author.panel_page_size params[:page_size]
-    @panel_colors = PanelColor.mylist(@author, @page, @page_size)
-
-    respond_to do |format|
-      format.html # index.html.erb
-      format.json { render json: @panel_colors.to_json(PanelColor.list_json_opt) }
-    end
+  def story_sheets
+    filer_list
   end
   
-  def ground_picture
-    @page = Author.page params[:page]
-    @page_size = Author.panel_page_size params[:page_size]
-    @ground_pictures = GroundPicture.mylist(@author, @page, @page_size)
-
-    respond_to do |format|
-      format.html # index.html.erb
-      format.json { render json: @ground_pictures.to_json(GroundPicture.list_json_opt) }
-    end
+  def sheets
+    filer_list
   end
   
-  def ground_color
-    @page = Author.page params[:page]
-    @page_size = Author.panel_page_size params[:page_size]
-    @ground_colors = GroundColor.mylist(@author, @page, @page_size)
-
-    respond_to do |format|
-      format.html # index.html.erb
-      format.json { render json: @ground_colors.to_json(GroundColor.list_json_opt) }
-    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 ground_pictures
+    filer_list
+  end
+  
+  def ground_colors
+    filer_list
+  end
+  
+  def resource_pictures
+    filer_list
   end
   
 end