OSDN Git Service

t#31223:add them contents list for author and artist
[pettanr/pettanr.git] / app / controllers / authors_controller.rb
index 5e8632e..531f46d 100644 (file)
@@ -4,7 +4,7 @@ class AuthorsController < ApplicationController
     before_filter :authenticate_user, :only => [:new, :create, :edit, :update]
     before_filter :authenticate_author, :only => [:edit, :update]
   else
-    before_filter :authenticate_reader, :only => [:index, :show]
+    before_filter :authenticate_reader, :only => [:index, :show, :comics, :panels]
     before_filter :authenticate_user, :only => [:new, :create, :edit, :update]
     before_filter :authenticate_author, :only => [:edit, :update]
   end
@@ -30,6 +30,32 @@ class AuthorsController < ApplicationController
     end
   end
 
+  def comics
+    @au = Author.show(params[:id], [@user, @admin])
+
+    @page = Author.page params[:page]
+    @page_size = Author.comic_page_size params[:page_size]
+    @comics = Comic.mylist(@au, @page, @page_size)
+
+    respond_to do |format|
+      format.html # index.html.erb
+      format.json { render json: @comics.to_json(Comic.list_json_opt) }
+    end
+  end
+  
+  def panels
+    @au = Author.show(params[:id], [@user, @admin])
+
+    @page = Author.page params[:page]
+    @page_size = Author.panel_page_size params[:page_size]
+    @panels = Panel.mylist(@au, @page, @page_size)
+
+    respond_to do |format|
+      format.html # index.html.erb
+      format.json { render text: Panel.list_as_json_text(@panels) }
+    end
+  end
+  
   def count
     @au = {:count => Author.visible_count}
     respond_to do |format|