X-Git-Url: http://git.osdn.net/view?a=blobdiff_plain;f=app%2Fcontrollers%2Fpictures_controller.rb;h=08479172f687f768caed015aa824049106a4ca0c;hb=b922609711ac4713a21d2e64cac393765c0917e9;hp=4f472f4cf3f5bf31756e51307b232b09d9678510;hpb=a62696b8377211ed0324839867d5ff9b2f3d58db;p=pettanr%2Fpettanr.git diff --git a/app/controllers/pictures_controller.rb b/app/controllers/pictures_controller.rb index 4f472f4c..08479172 100644 --- a/app/controllers/pictures_controller.rb +++ b/app/controllers/pictures_controller.rb @@ -1,6 +1,5 @@ class PicturesController < ApplicationController - layout 'test' if MagicNumber['test_layout'] - if MagicNumber['run_mode'] == 0 + if Manifest.manifest.magic_numbers['run_mode'] == 0 before_filter :authenticate_user, :only => [] before_filter :authenticate_author, :only => [] else @@ -8,29 +7,45 @@ class PicturesController < ApplicationController before_filter :authenticate_resource_reader, :only => [:show, :credit, :search] before_filter :authenticate_author, :only => [] end - before_filter :authenticate_admin!, :only => [:list, :browse] + before_filter :authenticate_admin, :only => [:index, :by_artist, :count, :count_by_artist] + + def self.model + Picture + end + + def index + filer_list + end + + def by_artist + filer_list + end + + def show_html_format format + format.html { + @item.boosts 'post' + @picture = @item + } + end def show - @item = Picture.show(params[:id], [@user, @admin, @demand_user]) - + 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], [@user, @admin, @demand_user]) + @picture = Picture.show(params[:id], @operators) respond_to do |format| - format.html { render :layout => false } # show.html.erb + format.html { render :layout => false } format.json { render :json => @picture.to_json} end end @@ -44,21 +59,12 @@ class PicturesController < ApplicationController end end - def list - @pictures = Picture.all - - respond_to do |format| - format.html { render layout: 'system' }# index.html.erb - format.json { render json: @pictures } - end + def count + list_count end - - def browse - @picture = Picture.find(params[:id]) - - respond_to do |format| - format.html { render layout: 'system' } # show.html.erb - format.json { render json: @picture } - end + + def count_by_artist + list_count end + end