1 class SpeechBalloonTemplatesController < ApplicationController
2 layout 'test' if MagicNumber['test_layout']
3 if MagicNumber['run_mode'] == 0
4 before_filter :authenticate_user!, :only => []
5 before_filter :authenticate_author, :only => []
7 before_filter :authenticate_user!, :only => [:index, :show]
8 before_filter :authenticate_author, :only => [:index, :show]
10 before_filter :authenticate_admin!, :only => [:list, :browse, :destroy]
12 # GET /speech_balloon_templates
13 # GET /speech_balloon_templates.json
15 @speech_balloon_templates = SpeechBalloonTemplate.list
17 respond_to do |format|
18 format.html # index.html.erb
19 format.json { render json: @speech_balloon_templates.to_json(SpeechBalloonTemplate.list_json_opt) }
23 # GET /speech_balloon_templates/1
24 # GET /speech_balloon_templates/1.json
26 @speech_balloon_template = SpeechBalloonTemplate.show(params[:id], @author)
28 respond_to do |format|
29 format.html # show.html.erb
31 render :json => @speech_balloon_template.to_json(SpeechBalloonTemplate.show_json_opt)
34 render :json => "callback(" + @speech_balloon_template.to_json() + ")"
40 @speech_balloon_templates = SpeechBalloonTemplate.all
42 respond_to do |format|
43 format.html { render layout: 'system' }
44 format.json { render json: @speech_balloon_templates }
49 @speech_balloon_template = SpeechBalloonTemplate.find(params[:id])
51 respond_to do |format|
52 format.html { render layout: 'system' }
53 format.json { render json: @speech_balloon_template }
57 # DELETE /speech_balloon_templates/1
58 # DELETE /speech_balloon_templates/1.json
60 @speech_balloon_template = SpeechBalloonTemplate.find(params[:id])
61 @speech_balloon_template.destroy
63 respond_to do |format|
64 format.html { redirect_to :action => :list }
65 format.json { head :ok }