1 class ResourcePicturesController < ApplicationController
2 before_filter :authenticate_user!, :only => [:index, :show]
3 before_filter :authenticate_admin!, :only => [:list, :browse]
5 # GET /resource_pictures
6 # GET /resource_pictures.json
8 @resource_pictures = ResourcePicture.find(:all,
9 :include => {:original_picture => [:artist, :license]}, :order => 'updated_at', :limit => 20
12 respond_to do |format|
13 format.html # index.html.erb
14 format.json { render :json => @resource_pictures.to_json(
15 :include => [:original_picture, :artist, :license]
20 # GET /resource_pictures/1
21 # GET /resource_pictures/1.json
23 @resource_picture = ResourcePicture.find(params[:id])
25 respond_to do |format|
26 opt = {:type => @resource_picture.mime_type, :disposition=>"inline"}
27 format.png { send_data(@resource_picture.restore(params[:subdir]), opt ) }
28 format.gif { send_data(@resource_picture.restore(params[:subdir]), opt ) }
29 format.jpeg { send_data(@resource_picture.restore(params[:subdir]), opt ) }
30 format.html # show.html.erb
31 format.json { render json: @resource_picture}
36 @resource_pictures = ResourcePicture.all
38 respond_to do |format|
39 format.html { render layout: 'system' }
40 format.json { render json: @resource_pictures }
45 @resource_picture = ResourcePicture.find(params[:id])
47 respond_to do |format|
48 format.html { render layout: 'system' }
49 format.json { render json: @resource_picture }