OSDN Git Service

5346ff146c0c6312c780ad9253431a75eee29c33
[pettanr/pettanr.git] / app / controllers / ground_colors_controller.rb
1 class GroundColorsController < 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_colors
11   # GET /ground_colors.json
12   def index
13     @page = GroundColor.page params[:page]
14     @page_size = GroundColor.page_size params[:page_size]
15     @ground_colors = GroundColor.list(@page, @page_size)
16
17     respond_to do |format|
18       format.html # index.html.erb
19       format.json { render :json => @ground_colors.to_json(GroundColor.list_json_opt) }
20     end
21   end
22   
23   def show
24     @ground_color = GroundColor.show(params[:id], @author)
25     respond_to do |format|
26       format.html # show.html.erb
27       format.json { render json: @ground_color.to_json(GroundColor.show_json_opt) }
28     end
29   end
30 end