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]
12 @speech_balloon_templates = SpeechBalloonTemplate.enable_list
14 respond_to do |format|
16 render :template => 'system/filer', :locals => {
17 :items => @speech_balloon_templates, :model => SpeechBalloonTemplate,
18 :roles => [@user, @admin], :pager => nil
21 format.json { render json: @speech_balloon_templates.to_json(SpeechBalloonTemplate.list_json_opt) }
26 @item = SpeechBalloonTemplate.show(params[:id], [@user, @admin])
28 respond_to do |format|
29 format.html # show.html.erb
32 render :json => @item.to_json(SpeechBalloonTemplate.show_json_opt)
35 render :json => "callback(" + @item.to_json() + ")"
41 @speech_balloon_templates = SpeechBalloonTemplate.all
43 respond_to do |format|
44 format.html { render layout: 'system' }
45 format.json { render json: @speech_balloon_templates }
50 @speech_balloon_template = SpeechBalloonTemplate.find(params[:id])
52 respond_to do |format|
53 format.html { render layout: 'system' }
54 format.json { render json: @speech_balloon_template }
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 }