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