OSDN Git Service

t#31018:add search om license
[pettanr/pettanr.git] / app / controllers / colors_controller.rb
1 class ColorsController < ApplicationController
2   layout 'test' if MagicNumber['test_layout']
3   before_filter :authenticate_admin!, :only => [:list]
4   
5   # GET /colors
6   # GET /colors.json
7   def index
8     @page = Color.page params[:page]
9     @page_size = Color.page_size params[:page_size]
10     @colors = Color.list(@page, @page_size)
11
12     respond_to do |format|
13       format.html # index.html.erb
14       format.json { render json: @colors.to_json(Color.list_json_opt) }
15     end
16   end
17   
18   def show
19     @color = Color.show(params[:id], @author)
20     respond_to do |format|
21       format.html # show.html.erb
22       format.json { render json: @color.to_json(Color.show_json_opt) }
23     end
24   end
25
26   def list
27     @colors = Color.all
28
29     respond_to do |format|
30       format.html { render layout: 'system' }# index.html.erb
31       format.json { render json: @colors }
32     end
33   end
34 end