OSDN Git Service

t#28985:add credit
[pettanr/pettanr.git] / app / controllers / pictures_controller.rb
1 class PicturesController < ApplicationController
2   layout 'test' if Pettanr::TestLayout
3   before_filter :authenticate_user!, :only => [:show, :credit]
4   
5   def show
6     @picture = Picture.show(params[:id])
7
8     respond_to do |format|
9       opt = {:type => @picture.mime_type, :disposition=>"inline"}
10       format.png { send_data(@picture.restore(params[:subdir]), opt ) }
11       format.gif { send_data(@picture.restore(params[:subdir]), opt ) }
12       format.jpeg { send_data(@picture.restore(params[:subdir]), opt ) }
13       format.json { render :json => @picture.to_json}
14     end
15   end
16   
17   def credit
18     @picture = Picture.show(params[:id])
19
20     respond_to do |format|
21       format.html { render :layout => false } # show.html.erb
22       format.json { render :json => @picture.to_json}
23     end
24   end
25   
26 end