OSDN Git Service

fix prof
[pettanr/pettanr.git] / app / controllers / speech_balloons_controller.rb
index 4198bec..aeeb9ce 100644 (file)
@@ -4,7 +4,7 @@ class SpeechBalloonsController < ApplicationController
     before_filter :authenticate_author, :only => [:new, :edit, :create, :update, :destroy]
   else
     before_filter :authenticate_reader, :only => [
-      :index, :show, :by_panel, :by_author, :count, :count_by_panel, :count_by_author
+      :index, :show, :by_panel, :by_author, :by_speech_balloon_template, :count, :count_by_panel, :count_by_author, :count_by_speech_balloon_template
     ]
     before_filter :authenticate_user, :only => [:new, :edit, :create, :update, :destroy]
     before_filter :authenticate_author, :only => [:new, :edit, :create, :update, :destroy]
@@ -26,6 +26,10 @@ class SpeechBalloonsController < ApplicationController
     filer_list
   end
   
+  def by_speech_balloon_template
+    filer_list
+  end
+  
   def show_html_format format
     format.html {
       @item.boosts 'post'
@@ -54,6 +58,10 @@ class SpeechBalloonsController < ApplicationController
     list_count
   end
   
+  def count_by_speech_balloon_template
+    list_count
+  end
+  
   def new
     form_new
   end
@@ -92,20 +100,21 @@ class SpeechBalloonsController < ApplicationController
   end
 
   def update
-    SpeechBalloon.fold_extend_settings params
-    @speech_balloon = SpeechBalloon.show(params[:id], @operators)
+    @item = SpeechBalloon.show(params[:id], @operators)
+    @speech_balloon = @item
+    @form = Locmare::Bucket.factory @item.item_name, @item, true, true, @operators
+    @form.fold_extend_settings params
     @speech_balloon.attributes = params[:speech_balloon]
     
     @speech_balloon_template = @speech_balloon.speech_balloon_template
-    @speech_balloon.boost
     
-    params[:speech_balloon][:balloon_attributes][:system_picture_id] = @speech_balloon.get_balloon.select_system_picture 
+    params[:speech_balloon][:balloon_attributes][:system_picture_id] = @speech_balloon.balloon.select_system_picture 
     
     @panel = Panel.edit(@speech_balloon.panel.id, @operators)
     @speech_balloon.overwrite @panel.id
     
     respond_to do |format|
-      if @speech_balloon.valid? and @speech_balloon.store(@operators, params[:speech_balloon])
+      if @speech_balloon.save
         flash[:notice] = I18n.t('flash.notice.updated', :model => SpeechBalloon.model_name.human)
         format.html { redirect_to @speech_balloon }
         format.json { head :ok }