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
30 render :json => @speech_balloon_template.to_json(SpeechBalloonTemplate.show_json_opt)
33 render :json => "callback(" + @speech_balloon_template.to_json() + ")"
39 @speech_balloon_templates = SpeechBalloonTemplate.all
41 respond_to do |format|
42 format.html { render layout: 'system' }
43 format.json { render json: @speech_balloon_templates }
48 @speech_balloon_template = SpeechBalloonTemplate.find(params[:id])
50 respond_to do |format|
51 format.html { render layout: 'system' }
52 format.json { render json: @speech_balloon_template }
56 # DELETE /speech_balloon_templates/1
57 # DELETE /speech_balloon_templates/1.json
59 @speech_balloon_template = SpeechBalloonTemplate.find(params[:id])
60 @speech_balloon_template.destroy
62 respond_to do |format|
63 format.html { redirect_to :action => :list }
64 format.json { head :ok }