OSDN Git Service

Merge branch 'v05' of git.sourceforge.jp:/gitroot/pettanr/pettanr into v05
[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     before_filter :authenticate_author, :only => []
6   else
7     before_filter :authenticate_reader, :only => [:index, :show]
8     before_filter :authenticate_user, :only => []
9     before_filter :authenticate_author, :only => []
10   end
11
12   # GET /ground_pictures
13   # GET /ground_pictures.json
14   def index
15     @page = GroundPicture.page params[:page]
16     @page_size = GroundPicture.page_size params[:page_size]
17     @ground_pictures = GroundPicture.list(@page, @page_size)
18
19     respond_to do |format|
20       format.html # index.html.erb
21       format.json { render :json => @ground_pictures.to_json(GroundPicture.list_json_opt) }
22     end
23   end
24
25   def show
26     @ground_picture = GroundPicture.show(params[:id], [@user, @admin])
27     respond_to do |format|
28       format.html # show.html.erb
29       format.json { render json: @ground_picture.to_json(GroundPicture.show_json_opt) }
30     end
31   end
32 end