OSDN Git Service

fix:err dialog
[pettanr/pettanr.git] / app / controllers / speech_balloon_templates_controller.rb
index 4b4fe8a..574bb5a 100644 (file)
@@ -1,71 +1,52 @@
 class SpeechBalloonTemplatesController < ApplicationController
   if Manifest.manifest.magic_numbers['run_mode'] == 0
-    before_filter :authenticate_user, :only => []
+    before_action :authenticate_user, :only => []
   else
-    before_filter :authenticate_reader, :only => [:index, :show, :speech_balloons, :panels, :by_system_picture]
-    before_filter :authenticate_user, :only => []
-  end
-  before_filter :authenticate_admin!, :only => [:list, :browse, :destroy]
-
-  def self.model
-    SpeechBalloonTemplate
+    before_action :authenticate_reader, :only => [
+      :index, :show, :by_panel, :by_system_picture
+    ]
+    before_action :authenticate_user, :only => []
   end
+  before_action :authenticate_admin, :only => [:new, :create, :edit, :update, :destroy]
   
   def index
-    public_list
+    filer_list
   end
   
-  def speech_balloons
-    has_many_list
+  def by_panel
+    filer_list param: params[:id]
   end
   
-  def panels
-    has_many_list
+  def by_system_picture
+    filer_list param: params[:id]
   end
   
-  def by_system_picture
-    filter_list
+  def show_html_format format
+    format.html {
+    }
   end
   
   def show
-    @item = SpeechBalloonTemplate.show(params[:id], @operators)
-
+    set_show
     respond_to do |format|
-      format.html {
-        @speech_balloon_template = @item
-      }
-      format_prof format
-      format.json {
-        render :json => @item.to_json(SpeechBalloonTemplate.show_json_opt)
-      }
+      show_html_format format
+      show_prof_format format
+      show_json_format format
     end
   end
-
-  def list
-    @speech_balloon_templates = SpeechBalloonTemplate.all
-
-    respond_to do |format|
-      format.html { render layout: 'system' }
-      format.json { render json: @speech_balloon_templates }
-    end
+  
+  def new
+    form_new
   end
-
-  def browse
-    @speech_balloon_template = SpeechBalloonTemplate.find(params[:id])
-
-    respond_to do |format|
-      format.html { render layout: 'system' }
-      format.json { render json: @speech_balloon_template }
-    end
+  
+  def edit
+    form_edit
   end
-
+  
   def destroy
-    @speech_balloon_template = SpeechBalloonTemplate.find(params[:id])
-    @speech_balloon_template.destroy
-
-    respond_to do |format|
-      format.html { redirect_to :action => :list }
-      format.json { head :ok }
-    end
+    set_model
+    @item = @my_model_class.edit(params[:id], @operators)
+    render_destroy '/' + @my_model_class.path_name
   end
+  
 end