1 class SpeachTemplatesController < ApplicationController
2 before_filter :authenticate_author!, :except => [:index]
4 # GET /speach_templates
5 # GET /speach_templates.json
7 @speach_templates = SpeachTemplate.all
10 format.html # index.html.erb
11 format.json { render json: @speach_templates }
16 # GET /speach_templates/1
17 # GET /speach_templates/1.json
19 @speach_template = SpeachTemplate.find(params[:id])
21 respond_to do |format|
22 format.html # show.html.erb
23 format.json { render json: @speach_template }
27 # GET /speach_templates/new
28 # GET /speach_templates/new.json
30 @speach_template = SpeachTemplate.new
32 respond_to do |format|
33 format.html # new.html.erb
34 format.json { render json: @speach_template }
38 # GET /speach_templates/1/edit
40 @speach_template = SpeachTemplate.find(params[:id])
43 # POST /speach_templates
44 # POST /speach_templates.json
46 @speach_template = SpeachTemplate.new(params[:speach_template])
48 respond_to do |format|
49 if @speach_template.save
50 format.html { redirect_to @speach_template, notice: 'Speach template was successfully created.' }
51 format.json { render json: @speach_template, status: :created, location: @speach_template }
53 format.html { render action: "new" }
54 format.json { render json: @speach_template.errors, status: :unprocessable_entity }
59 # PUT /speach_templates/1
60 # PUT /speach_templates/1.json
62 @speach_template = SpeachTemplate.find(params[:id])
64 respond_to do |format|
65 if @speach_template.update_attributes(params[:speach_template])
66 format.html { redirect_to @speach_template, notice: 'Speach template was successfully updated.' }
67 format.json { head :ok }
69 format.html { render action: "edit" }
70 format.json { render json: @speach_template.errors, status: :unprocessable_entity }
75 # DELETE /speach_templates/1
76 # DELETE /speach_templates/1.json
78 @speach_template = SpeachTemplate.find(params[:id])
79 @speach_template.destroy
81 respond_to do |format|
82 format.html { redirect_to speach_templates_url }
83 format.json { head :ok }