OSDN Git Service

work
[pettanr/pettanr.git] / app / controllers / speech_balloons_controller.rb
index 9247534..6e95295 100644 (file)
@@ -10,14 +10,12 @@ class SpeechBalloonsController < ApplicationController
   end
   before_filter :authenticate_admin!, :only => [:list, :browse]
 
-  @@model = SpeechBalloon
+  def self.model
+    SpeechBalloon
+  end
+  
   def index
-    set_filer
-
-    respond_to do |format|
-      format_filer format
-      format.json { render json: @items.to_json(@@model.list_json_opt) }
-    end
+    public_list
   end
   
   def show
@@ -50,10 +48,10 @@ class SpeechBalloonsController < ApplicationController
   end
 
   def new
-    raise Pettanr::NotWork unless @author.working_panel
-    @speech_balloon_template = SpeechBalloonTemplate.show params[:speech_balloon_template_id], @author
+    raise Pettanr::NotWork unless @operators.author.working_panel
+    @speech_balloon_template = SpeechBalloonTemplate.show params[:speech_balloon_template_id], @operators
     
-    @panel = Panel.edit(@author.working_panel, @author)
+    @panel = Panel.edit(@operators.author.working_panel, @operators)
     @speech_balloon = SpeechBalloon.new :panel_id => @panel.id, :speech_balloon_template_id => @speech_balloon_template.id
     @speech_balloon.boost
     @speech_balloon.supply_default
@@ -69,9 +67,9 @@ class SpeechBalloonsController < ApplicationController
   end
 
   def edit
-    @speech_balloon = SpeechBalloon.show(params[:id], @author)
+    @speech_balloon = SpeechBalloon.show(params[:id], @operators.author)
     @speech_balloon_template = @speech_balloon.speech_balloon_template
-    @panel = Panel.edit(@speech_balloon.panel.id, @author)
+    @panel = Panel.edit(@speech_balloon.panel.id, @operators.author)
     
     @speech_balloon.boost
     
@@ -83,9 +81,9 @@ class SpeechBalloonsController < ApplicationController
   end
 
   def create
-    raise Pettanr::NotWork unless @author.working_panel
+    raise Pettanr::NotWork unless @operators.author.working_panel
     SpeechBalloon.fold_extend_settings params
-    @panel = Panel.edit(@author.working_panel, @author)
+    @panel = Panel.edit(@operators.author.working_panel, @author)
     @speech_balloon = SpeechBalloon.new 
     @speech_balloon.attributes = params[:speech_balloon]
     
@@ -113,7 +111,7 @@ class SpeechBalloonsController < ApplicationController
 
   def update
     SpeechBalloon.fold_extend_settings params
-    @speech_balloon = SpeechBalloon.show(params[:id], @author)
+    @speech_balloon = SpeechBalloon.show(params[:id], @operators.author)
     @speech_balloon.attributes = params[:speech_balloon]
     
     @speech_balloon_template = @speech_balloon.speech_balloon_template
@@ -121,11 +119,11 @@ class SpeechBalloonsController < ApplicationController
     
     params[:speech_balloon][:balloon_attributes][:system_picture_id] = @speech_balloon.get_balloon.select_system_picture 
     
-    @panel = Panel.edit(@speech_balloon.panel.id, @author)
+    @panel = Panel.edit(@speech_balloon.panel.id, @operators.author)
     @speech_balloon.overwrite @panel.id
     
     respond_to do |format|
-      if @speech_balloon.valid? and @speech_balloon.store(@author, params[:speech_balloon])
+      if @speech_balloon.valid? and @speech_balloon.store(@operators.author, params[:speech_balloon])
         flash[:notice] = I18n.t('flash.notice.updated', :model => SpeechBalloon.model_name.human)
         format.html { redirect_to @speech_balloon }
         format.json { head :ok }
@@ -140,11 +138,11 @@ class SpeechBalloonsController < ApplicationController
   end
 
   def destroy
-    @speech_balloon = SpeechBalloon.show(params[:id], @author)
-    @panel = Panel.edit(@speech_balloon.panel.id, @author)
+    @speech_balloon = SpeechBalloon.show(params[:id], @operators.author)
+    @panel = Panel.edit(@speech_balloon.panel.id, @operators.author)
     
     respond_to do |format|
-      if @speech_balloon.remove @author
+      if @speech_balloon.remove @operators.author
         flash[:notice] = I18n.t('flash.notice.destroyed', :model => SpeechBalloon.model_name.human)
         format.html { redirect_to @panel }
         format.json { head :ok }