OSDN Git Service

e
[pettanr/pettanr.git] / app / controllers / resource_pictures_controller.rb
index da074af..47772db 100644 (file)
@@ -4,7 +4,7 @@ class ResourcePicturesController < ApplicationController
     before_filter :authenticate_artist, :only => [:new, :create, :update, :destroy]
   else
     before_filter :authenticate_resource_reader, :only => [
-      :index, :show, :credit, :by_license, :by_artist, :count, :count_by_license, :count_by_artist
+      :index, :show, :credit, :by_original_picture, :by_license, :by_artist, :count, :count_by_license, :count_by_artist
     ]
     before_filter :authenticate_user, :only => [:new, :create, :update, :destroy]
     before_filter :authenticate_artist, :only => [:new, :create, :update, :destroy]
@@ -18,6 +18,10 @@ class ResourcePicturesController < ApplicationController
     filer_list
   end
   
+  def by_original_picture
+    filer_list
+  end
+  
   def by_license
     filer_list
   end
@@ -26,19 +30,22 @@ class ResourcePicturesController < ApplicationController
     filer_list
   end
   
+  def show_html_format format
+    format.html {
+      @resource_picture = @item
+    }
+  end
+  
   def show
-    @item = ResourcePicture.show(params[:id], @operators)
-
+    set_show
     respond_to do |format|
       opt = {:type => @item.mime_type, :disposition=>"inline"}
       format.png { send_data(@item.restore(params[:subdir]), opt ) }
       format.gif { send_data(@item.restore(params[:subdir]), opt ) }
       format.jpeg { send_data(@item.restore(params[:subdir]), opt ) }
-      format.html {
-        @resource_picture = @item
-      }
-      format_prof format
-      format.json { render :json => @item.to_json(ResourcePicture.show_json_opt)}
+      show_html_format format
+      show_prof_format format
+      show_json_format format
     end
   end