X-Git-Url: http://git.osdn.net/view?a=blobdiff_plain;f=app%2Fcontrollers%2Fpictures_controller.rb;h=62be192af5f57b6648a346d1ba9d1b6cdfe37fa9;hb=c5fdcefa82de4c0b3bf5a69b6ec120827542a875;hp=81b5ad48e60b7b52e3a2ed96c9e9e0e341996920;hpb=2aa1323f37c9fb76373328c25e251291aa9addac;p=pettanr%2Fpettanr.git diff --git a/app/controllers/pictures_controller.rb b/app/controllers/pictures_controller.rb index 81b5ad48..62be192a 100644 --- a/app/controllers/pictures_controller.rb +++ b/app/controllers/pictures_controller.rb @@ -1,32 +1,47 @@ 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 => [] + 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 param: params[:id] + end + + def show_html_format format + format.html { + @item.boosts 'post' + @picture = @item + } end def show - @item = Picture.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 { - @picture = @item - } - format_prof format - format.json { render :json => @item.to_json} + 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} @@ -34,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