1 class SystemPicturesController < ApplicationController
2 layout 'test' if MagicNumber['test_layout']
3 if MagicNumber['run_mode'] == 0
4 before_filter :authenticate_user!, :only => []
5 before_filter :authenticate_author, :only => []
7 before_filter :authenticate_user!, :only => [:index, :show]
8 before_filter :authenticate_author, :only => [:index, :show]
10 before_filter :authenticate_admin!, :only => [:list, :browse, :new, :create]
12 # GET /system_pictures
13 # GET /system_pictures.json
15 @page = SystemPicture.page params[:page]
16 @page_size = SystemPicture.page_size params[:page_size]
17 @system_pictures = SystemPicture.list(@page, @page_size)
19 respond_to do |format|
20 format.html # index.html.erb
21 format.json { render json: @system_pictures.to_json(SystemPicture.list_json_opt) }
25 # GET /system_pictures/1
26 # GET /system_pictures/1.json
28 @system_picture = SystemPicture.show(params[:id], @author)
30 respond_to do |format|
31 opt = {:type => @system_picture.mime_type, :disposition=>"inline"}
32 format.png { send_data(@system_picture.restore, opt ) }
33 format.gif { send_data(@system_picture.restore, opt ) }
34 format.jpeg { send_data(@system_picture.restore, opt ) }
35 format.html # show.html.erb
36 format.json { render json: @system_picture.to_json(SystemPicture.show_json_opt)}
41 @system_pictures = SystemPicture.all
43 respond_to do |format|
44 format.html { render layout: 'system' }
45 format.json { render json: @system_pictures }
50 @system_picture = SystemPicture.find(params[:id])
52 respond_to do |format|
53 format.html { render layout: 'system' }
54 format.json { render json: @system_picture}