OSDN Git Service

883677963d43cd3369c144316db0a5aa755890ed
[pettanr/pettanr.git] / app / controllers / ground_pictures_controller.rb
1 class GroundPicturesController < ApplicationController
2   layout 'test' if MagicNumber['test_layout']
3   if MagicNumber['run_mode'] == 0
4     before_filter :authenticate_user, :only => []
5   else
6     before_filter :authenticate_reader, :only => [:index, :show]
7     before_filter :authenticate_user, :only => []
8   end
9
10   # GET /ground_pictures
11   # GET /ground_pictures.json
12   def index
13     @page = GroundPicture.page params[:page]
14     @page_size = GroundPicture.page_size params[:page_size]
15     @ground_pictures = GroundPicture.list(@page, @page_size)
16
17     respond_to do |format|
18       format.html # index.html.erb
19       format.json { render :json => @ground_pictures.to_json(GroundPicture.list_json_opt) }
20     end
21   end
22
23   def show
24     @ground_picture = GroundPicture.show(params[:id], [@author, @admin])
25     respond_to do |format|
26       format.html # show.html.erb
27       format.json { render json: @ground_picture.to_json(GroundPicture.show_json_opt) }
28     end
29   end
30 end