1 class SpeechBalloonTemplatesController < ApplicationController
2 layout 'test' if MagicNumber['test_layout']
3 if MagicNumber['run_mode'] == 0
4 before_filter :authenticate_user, :only => []
6 before_filter :authenticate_reader, :only => [:index, :show]
7 before_filter :authenticate_user, :only => []
9 before_filter :authenticate_admin!, :only => [:list, :browse, :destroy]
11 # GET /speech_balloon_templates
12 # GET /speech_balloon_templates.json
14 @speech_balloon_templates = SpeechBalloonTemplate.enable_list
16 respond_to do |format|
17 format.html # index.html.erb
18 format.json { render json: @speech_balloon_templates.to_json(SpeechBalloonTemplate.list_json_opt) }
22 # GET /speech_balloon_templates/1
23 # GET /speech_balloon_templates/1.json
25 @speech_balloon_template = SpeechBalloonTemplate.show(params[:id], [@user, @admin])
27 respond_to do |format|
28 format.html # show.html.erb
29 format.prof { render :template => 'top/prof', :layout => true }
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 }