OSDN Git Service

t#:
[pettanr/pettanr.git] / app / controllers / pictures_controller.rb
index 69456b6..62be192 100644 (file)
@@ -1,24 +1,22 @@
 class PicturesController < ApplicationController
   if Manifest.manifest.magic_numbers['run_mode'] == 0
-    before_filter :authenticate_user, :only => []
-    before_filter :authenticate_author, :only => []
+    before_action :authenticate_user, :only => []
+    before_action :authenticate_author, :only => []
   else
-    before_filter :authenticate_user, :only => []
-    before_filter :authenticate_resource_reader, :only => [:show, :credit, :search]
-    before_filter :authenticate_author, :only => []
-  end
-  before_filter :authenticate_admin, :only => [:index, :by_artist, :count, :count_by_artist]
-  
-  def self.model
-    Picture
+    before_action :authenticate_user, :only => []
+    before_action :authenticate_resource_reader, :only => [
+      :show, :credit, :search
+    ]
+    before_action :authenticate_author, :only => []
   end
+  before_action :authenticate_admin, :only => [:index, :by_artist ]
   
   def index
     filer_list
   end
   
   def by_artist
-    filer_list
+    filer_list param: params[:id]
   end
   
   def show_html_format format
@@ -37,12 +35,13 @@ class PicturesController < ApplicationController
       format.jpeg { send_data(@item.restore(params[:subdir]), opt ) }
       show_html_format format
       show_json_format format
+      show_prof_format format
     end
   end
   
   def credit
     @picture = Picture.show(params[:id], @operators)
-
+    
     respond_to do |format|
       format.html { render :layout => false }
       format.json { render :json => @picture.to_json}
@@ -50,7 +49,7 @@ class PicturesController < ApplicationController
   end
   
   def search
-    @pictures = Picture.list_by_md5(params[:md5])
+    @pictures = Picture.find_by_md5(params[:md5])
     
     respond_to do |format|
       format.html
@@ -58,12 +57,4 @@ class PicturesController < ApplicationController
     end
   end
   
-  def count
-    list_count
-  end
-  
-  def count_by_artist
-    list_count
-  end
-  
 end