OSDN Git Service

t#31223:add them contents list for author and artist
[pettanr/pettanr.git] / app / controllers / artists_controller.rb
index 032a98a..51543bb 100644 (file)
@@ -4,7 +4,7 @@ class ArtistsController < ApplicationController
     before_filter :authenticate_user, :only => [:new, :create, :edit, :update, :destroy]
     before_filter :authenticate_author, :only => [:new, :create, :edit, :update, :destroy]
   else
-    before_filter :authenticate_resource_reader, :only => [:index, :show]
+    before_filter :authenticate_resource_reader, :only => [:index, :show, :resource_pictures]
     before_filter :authenticate_user, :only => [:new, :create, :edit, :update, :destroy]
     before_filter :authenticate_author, :only => [:new, :create, :edit, :update, :destroy]
   end
@@ -34,6 +34,19 @@ class ArtistsController < ApplicationController
     end
   end
 
+  def resource_pictures
+    @ar = Artist.show(params[:id], [@user, @admin, @demand_user])
+    
+    @page = Author.page params[:page]
+    @page_size = Author.resource_picture_page_size params[:page_size]
+    @resource_pictures = ResourcePicture.mylist(@ar, @page, @page_size)
+
+    respond_to do |format|
+      format.html # index.html.erb
+      format.json { render json: @resource_pictures.to_json(ResourcePicture.list_json_opt) }
+    end
+  end
+  
   def count
     @ar = {:count => Artist.visible_count}
     respond_to do |format|