-class SpeachBalloonsController < ApplicationController
+class SpeechBalloonsController < ApplicationController
before_filter :authenticate_user!, :only => [:index, :show]
before_filter :authenticate_admin!, :only => [:list, :browse, :create, :update, :destroy]
end
public
- # GET /speach_balloons
- # GET /speach_balloons.json
+ # GET /speech_balloons
+ # GET /speech_balloons.json
def index
- @speach_balloons = SpeachBalloon.all
+ @speech_balloons = SpeechBalloon.all
respond_to do |format|
format.html # index.html.erb
- format.json { render json: @speach_balloons }
+ format.json { render json: @speech_balloons }
end
end
- # GET /speach_balloons/1
- # GET /speach_balloons/1.json
+ # GET /speech_balloons/1
+ # GET /speech_balloons/1.json
def show
- @speach_balloon = SpeachBalloon.find(params[:id], include: {:balloon_templates => :speach_templates})
+ @speech_balloon = SpeechBalloon.find(params[:id], include: {:balloon_templates => :speech_templates})
respond_to do |format|
format.html # show.html.erb
format.json {
- render :json => @speach_balloon.to_json(include: {
- :balloon_templates => {:include => :speach_templates}
+ render :json => @speech_balloon.to_json(include: {
+ :balloon_templates => {:include => :speech_templates}
})
}
format.jsonp {
- render :json => "callback(" + @speach_balloon.to_json(include: {
- :balloon_templates => {:include => :speach_templates}
+ render :json => "callback(" + @speech_balloon.to_json(include: {
+ :balloon_templates => {:include => :speech_templates}
}) + ")"
}
end
end
def list
- @speach_balloons = SpeachBalloon.all
+ @speech_balloons = SpeechBalloon.all
respond_to do |format|
format.html { render layout: 'system' }
- format.json { render json: @speach_balloons }
+ format.json { render json: @speech_balloons }
end
end
def browse
- @speach_balloon = SpeachBalloon.find(params[:id])
+ @speech_balloon = SpeechBalloon.find(params[:id])
respond_to do |format|
format.html { render layout: 'system' }
- format.json { render json: @speach_balloon }
+ format.json { render json: @speech_balloon }
end
end
- # POST /speach_balloons
- # POST /speach_balloons.json
+ # POST /speech_balloons
+ # POST /speech_balloons.json
def create
- @speach_balloon = SpeachBalloon.new(params[:speach_balloon])
- if em = validate_param(params[:speach_balloon])
+ @speech_balloon = SpeechBalloon.new(params[:speech_balloon])
+ if em = validate_param(params[:speech_balloon])
respond_to do |format|
format.json { render json: em, status: :unprocessable_entity }
end
else
respond_to do |format|
- if @speach_balloon.save
- format.html { redirect_to @speach_balloon, notice: 'Speach balloon was successfully created.' }
- format.json { render json: @speach_balloon, status: :created, location: @speach_balloon }
+ if @speech_balloon.save
+ format.html { redirect_to @speech_balloon, notice: 'Speech balloon was successfully created.' }
+ format.json { render json: @speech_balloon, status: :created, location: @speech_balloon }
else
format.html { render action: "new" }
- format.json { render json: @speach_balloon.errors, status: :unprocessable_entity }
+ format.json { render json: @speech_balloon.errors, status: :unprocessable_entity }
end
end
end
end
- # PUT /speach_balloons/1
- # PUT /speach_balloons/1.json
+ # PUT /speech_balloons/1
+ # PUT /speech_balloons/1.json
def update
- @speach_balloon = SpeachBalloon.find(params[:id])
+ @speech_balloon = SpeechBalloon.find(params[:id])
respond_to do |format|
- if @speach_balloon.update_attributes(params[:speach_balloon])
- format.html { redirect_to @speach_balloon, notice: 'Speach balloon was successfully updated.' }
+ if @speech_balloon.update_attributes(params[:speech_balloon])
+ format.html { redirect_to @speech_balloon, notice: 'Speech balloon was successfully updated.' }
format.json { head :ok }
else
format.html { render action: "edit" }
- format.json { render json: @speach_balloon.errors, status: :unprocessable_entity }
+ format.json { render json: @speech_balloon.errors, status: :unprocessable_entity }
end
end
end
- # DELETE /speach_balloons/1
- # DELETE /speach_balloons/1.json
+ # DELETE /speech_balloons/1
+ # DELETE /speech_balloons/1.json
def destroy
- @speach_balloon = SpeachBalloon.find(params[:id])
- @speach_balloon.destroy
+ @speech_balloon = SpeechBalloon.find(params[:id])
+ @speech_balloon.destroy
respond_to do |format|
- format.html { redirect_to speach_balloons_url }
+ format.html { redirect_to speech_balloons_url }
format.json { head :ok }
end
end