1 class BalloonTemplatesController < ApplicationController
2 before_filter :authenticate_author!, :except => [:index]
4 # GET /balloon_templates
5 # GET /balloon_templates.json
7 @balloon_templates = BalloonTemplate.all
10 format.html # index.html.erb
11 format.json { render json: @balloon_templates }
15 # GET /balloon_templates/1
16 # GET /balloon_templates/1.json
18 @balloon_template = BalloonTemplate.find(params[:id])
20 respond_to do |format|
21 format.html # show.html.erb
22 format.json { render json: @balloon_template }
26 # GET /balloon_templates/new
27 # GET /balloon_templates/new.json
29 @balloon_template = BalloonTemplate.new
31 respond_to do |format|
32 format.html # new.html.erb
33 format.json { render json: @balloon_template }
37 # GET /balloon_templates/1/edit
39 @balloon_template = BalloonTemplate.find(params[:id])
42 # POST /balloon_templates
43 # POST /balloon_templates.json
45 @balloon_template = BalloonTemplate.new(params[:balloon_template])
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 }
52 format.html { render action: "new" }
53 format.json { render json: @balloon_template.errors, status: :unprocessable_entity }
58 # PUT /balloon_templates/1
59 # PUT /balloon_templates/1.json
61 @balloon_template = BalloonTemplate.find(params[:id])
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 }
68 format.html { render action: "edit" }
69 format.json { render json: @balloon_template.errors, status: :unprocessable_entity }
74 # DELETE /balloon_templates/1
75 # DELETE /balloon_templates/1.json
77 @balloon_template = BalloonTemplate.find(params[:id])
78 @balloon_template.destroy
80 respond_to do |format|
81 format.html { redirect_to balloon_templates_url }
82 format.json { head :ok }