1 class SystemPicturesController < ApplicationController
2 layout 'test' if MagicNumber['test_layout']
3 before_filter :authenticate_user!, :only => [:index, :show]
4 before_filter :authenticate_author, :only => [:index, :show]
5 before_filter :authenticate_admin!, :only => [:list, :browse, :new, :create]
8 # GET /system_pictures.json
10 @page = SystemPicture.page params[:page]
11 @page_size = SystemPicture.page_size params[:page_size]
12 @system_pictures = SystemPicture.list(@page, @page_size)
14 respond_to do |format|
15 format.html # index.html.erb
16 format.json { render json: @system_pictures.to_json(SystemPicture.list_json_opt) }
20 # GET /system_pictures/1
21 # GET /system_pictures/1.json
23 @system_picture = SystemPicture.show(params[:id], @author)
25 respond_to do |format|
26 opt = {:type => @system_picture.mime_type, :disposition=>"inline"}
27 format.png { send_data(@system_picture.restore, opt ) }
28 format.gif { send_data(@system_picture.restore, opt ) }
29 format.jpeg { send_data(@system_picture.restore, opt ) }
30 format.html # show.html.erb
31 format.json { render json: @system_picture.to_json(SystemPicture.show_json_opt)}
36 @system_pictures = SystemPicture.all
38 respond_to do |format|
39 format.html { render layout: 'system' }
40 format.json { render json: @system_pictures }
45 @system_picture = SystemPicture.find(params[:id])
47 respond_to do |format|
48 format.html { render layout: 'system' }
49 format.json { render json: @system_picture}