OSDN Git Service

import all source code
[pettanr/pettanr.git] / app / controllers / balloon_templates_controller.rb
1 class BalloonTemplatesController < ApplicationController
2   before_filter :authenticate_author!, :except => [:index]
3   
4   # GET /balloon_templates
5   # GET /balloon_templates.json
6   def index
7     @balloon_templates = BalloonTemplate.all
8
9     respond_to do |format|
10       format.html # index.html.erb
11       format.json { render json: @balloon_templates }
12     end
13   end
14 =begin
15   # GET /balloon_templates/1
16   # GET /balloon_templates/1.json
17   def show
18     @balloon_template = BalloonTemplate.find(params[:id])
19
20     respond_to do |format|
21       format.html # show.html.erb
22       format.json { render json: @balloon_template }
23     end
24   end
25
26   # GET /balloon_templates/new
27   # GET /balloon_templates/new.json
28   def new
29     @balloon_template = BalloonTemplate.new
30
31     respond_to do |format|
32       format.html # new.html.erb
33       format.json { render json: @balloon_template }
34     end
35   end
36
37   # GET /balloon_templates/1/edit
38   def edit
39     @balloon_template = BalloonTemplate.find(params[:id])
40   end
41
42   # POST /balloon_templates
43   # POST /balloon_templates.json
44   def create
45     @balloon_template = BalloonTemplate.new(params[:balloon_template])
46
47     respond_to do |format|
48       if @balloon_template.save
49         format.html { redirect_to @balloon_template, notice: 'Balloon template was successfully created.' }
50         format.json { render json: @balloon_template, status: :created, location: @balloon_template }
51       else
52         format.html { render action: "new" }
53         format.json { render json: @balloon_template.errors, status: :unprocessable_entity }
54       end
55     end
56   end
57
58   # PUT /balloon_templates/1
59   # PUT /balloon_templates/1.json
60   def update
61     @balloon_template = BalloonTemplate.find(params[:id])
62
63     respond_to do |format|
64       if @balloon_template.update_attributes(params[:balloon_template])
65         format.html { redirect_to @balloon_template, notice: 'Balloon template was successfully updated.' }
66         format.json { head :ok }
67       else
68         format.html { render action: "edit" }
69         format.json { render json: @balloon_template.errors, status: :unprocessable_entity }
70       end
71     end
72   end
73
74   # DELETE /balloon_templates/1
75   # DELETE /balloon_templates/1.json
76   def destroy
77     @balloon_template = BalloonTemplate.find(params[:id])
78     @balloon_template.destroy
79
80     respond_to do |format|
81       format.html { redirect_to balloon_templates_url }
82       format.json { head :ok }
83     end
84   end
85 =end
86 end