OSDN Git Service

t#30558:fix auth filter
[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     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_colors
13   # GET /ground_colors.json
14   def index
15     @page = GroundColor.page params[:page]
16     @page_size = GroundColor.page_size params[:page_size]
17     @ground_colors = GroundColor.list(@page, @page_size)
18
19     respond_to do |format|
20       format.html # index.html.erb
21       format.json { render :json => @ground_colors.to_json(GroundColor.list_json_opt) }
22     end
23   end
24   
25   def show
26     @ground_color = GroundColor.show(params[:id], [@user, @admin])
27     respond_to do |format|
28       format.html # show.html.erb
29       format.json { render json: @ground_color.to_json(GroundColor.show_json_opt) }
30     end
31   end
32 end