class ResourcePicturesController < ApplicationController
layout 'test' if MagicNumber['test_layout']
if MagicNumber['run_mode'] == 0
- before_filter :authenticate_resource_user, :only => [:new, :create, :update, :destroy]
- before_filter :authenticate_artist, :only => [:new, :create, :destroy]
+ before_filter :authenticate_user, :only => [:new, :create, :update, :destroy]
+ before_filter :authenticate_artist, :only => [:new, :create, :update, :destroy]
else
before_filter :authenticate_resource_reader, :only => [:index, :show, :credit]
before_filter :authenticate_user, :only => [:new, :create, :update, :destroy]
- before_filter :authenticate_artist, :only => [:new, :create, :destroy]
+ before_filter :authenticate_artist, :only => [:new, :create, :update, :destroy]
end
before_filter :authenticate_admin!, :only => [:list, :browse]
- # GET /resource_pictures
- # GET /resource_pictures.json
+ def self.model
+ ResourcePicture
+ end
+ def self.controller
+ Pettanr::Application::manifest.controller_managers[self.model.item_name]
+ end
+ def self.profiler_manager
+ Pettanr::Application::manifest.profiler_managers[self.model.item_name]
+ end
+
def index
- @page = ResourcePicture.page params[:page]
- @page_size = ResourcePicture.page_size params[:page_size]
- @resource_pictures = ResourcePicture.list(@page, @page_size)
-
+ action_name = params[:action]
+ @action = self.class.controller.open(action_name, params, @operators)
+ @items = @action.items
respond_to do |format|
- format.html # index.html.erb
- format.json { render :json => @resource_pictures.to_json(ResourcePicture.list_json_opt) }
+ format.html {
+ @filer = @action.filer
+ render :template => 'system/filer', :locals => {
+ :filer => @filer
+ }
+ }
+ format.json { render json: @items.to_json(self.class.model.list_json_opt) }
+ format.atom
+ format.rss
end
end
- # GET /resource_pictures/1
- # GET /resource_pictures/1.json
def show
- @resource_picture = ResourcePicture.show(params[:id], @author)
+ @item = ResourcePicture.show(params[:id], @operators)
respond_to do |format|
- opt = {:type => @resource_picture.mime_type, :disposition=>"inline"}
- format.png { send_data(@resource_picture.restore(params[:subdir]), opt ) }
- format.gif { send_data(@resource_picture.restore(params[:subdir]), opt ) }
- format.jpeg { send_data(@resource_picture.restore(params[:subdir]), opt ) }
- format.html # show.html.erb
- format.json { render :json => @resource_picture.to_json(ResourcePicture.show_json_opt)}
+ 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 {
+ @resource_picture = @item
+ }
+ format_prof format
+ format.json { render :json => @item.to_json(ResourcePicture.show_json_opt)}
end
end
def credit
- @resource_picture = ResourcePicture.show(params[:id], @author)
+ @resource_picture = ResourcePicture.show(params[:id], [@user, @admin, @demand_user])
respond_to do |format|
format.html { render :layout => false } # show.html.erb