OSDN Git Service

temp
[pettanr/pettanr.git] / app / controllers / comics_controller.rb
index e7a071d..617439a 100644 (file)
@@ -10,30 +10,26 @@ class ComicsController < ApplicationController
   end
   before_filter :authenticate_admin!, :only => [:list, :browse]
 
-  def top
-    respond_to do |format|
-      format.html 
-    end
-  end
-  
+  @@model = Comic
   def index
-    @page = Comic.page params[:page]
-    @page_size = Comic.page_size params[:page_size]
-    @comics = Comic.list(@page, @page_size)
+    set_filer
+
     respond_to do |format|
-      format.html # index.html.erb
-      format.json { render json: @comics.to_json(Comic.list_json_opt) }
+      format_filer format
+      format.json { render json: @items.to_json(@@model.list_json_opt) }
       format.atom 
       format.rss
     end
   end
 
   def show
-    @comic = Comic.show(params[:id], [@user, @admin])
-
+    @item = Comic.show(params[:id], @operators)
     respond_to do |format|
-      format.html # show.html.erb
-      format.json { render json: @comic.to_json(Comic.show_json_opt) }
+      format.html {
+        @comic = @item
+      }
+      format_prof format
+      format.json { render json: @item.to_json(Comic.show_json_opt) }
       format.atom 
       format.rss 
     end
@@ -94,6 +90,7 @@ class ComicsController < ApplicationController
         format.html { redirect_to @comic }
         format.json { render json: @comic.to_json(Comic.show_json_opt), status: :created, location: @comic }
       else
+        flash[:notice] = I18n.t('flash.notice.not_created', :model => Comic.model_name.human)
         format.html { render action: "new" }
         format.json { render json: @comic.errors, status: :unprocessable_entity }
       end
@@ -110,6 +107,7 @@ class ComicsController < ApplicationController
         format.html { redirect_to @comic }
         format.json { head :ok }
       else
+        flash[:notice] = I18n.t('flash.notice.not_updated', :model => Comic.model_name.human)
         format.html { render action: "edit" }
         format.json { render json: @comic.errors, status: :unprocessable_entity }
       end
@@ -121,7 +119,7 @@ class ComicsController < ApplicationController
     respond_to do |format|
       if @comic.destroy_with_story
         flash[:notice] = I18n.t('flash.notice.destroyed', :model => Comic.model_name.human)
-        format.html { redirect_to '/home/comic' }
+        format.html { redirect_to '/home/comics' }
         format.json { head :ok }
       else
         flash[:notice] = I18n.t('flash.notice.not_destroyed', :model => Comic.model_name.human)