OSDN Git Service

Merge branch 'v06' of git.sourceforge.jp:/gitroot/pettanr/pettanr into v06
[pettanr/pettanr.git] / app / models / speech_balloon.rb
index d5a4148..0289e59 100644 (file)
@@ -10,10 +10,10 @@ class SpeechBalloon < Peta::Element
   
   validates :panel_id, :numericality => {:allow_blank => true}
   validates :speech_balloon_template_id, :presence => true, :numericality => true, :existence => {:both => false}
-  validates :speech_balloon_template_classname, :presence => true, :length => {:maximum => 50}
+  validates :speech_balloon_template_module_name, :presence => true, :length => {:maximum => 50}
   validates :z, :presence => true, :numericality => {:greater_than => 0}
   validates :t, :presence => true, :numericality => {:greater_than_or_equal_to => 0}
-  validates :speech_balloon_template_settings, :boost => {:resource_name => :speech_balloon_template}
+  validates :speech_balloon_template_settings, :boost => {:boost_name => :speech_balloon_template}
   
   def self.by_author_list_includes
     {
@@ -23,24 +23,6 @@ class SpeechBalloon < Peta::Element
     }
   end
   
-  def self.list_opt_for_panel
-    {
-      :speech_balloons => {:balloon => {}, :speech => {}}
-    }
-  end
-  
-  def self.show_opt_for_panel
-    {
-      :speech_balloons => {:balloon => {}, :speech => {}}
-    }
-  end
-  
-  def self.json_opt_for_panel
-    {
-      :balloon => {}, :speech => {}
-    }
-  end
-  
   def self.has_picture?
     false
   end
@@ -60,74 +42,18 @@ class SpeechBalloon < Peta::Element
     self.speech_balloon_template.symbol_option
   end
   
-  def tag_element_type
-    'speech_balloon'
+  def filer_caption
+    self.plain_scenario
   end
   
-  def self.public_list_where
+  def self.public_list_where list
     'panels.publish > 0'
   end
   
-  def self.list_order
-    'speech_balloons.updated_at desc'
-  end
-  
-  def self.list_json_opt
-    {:include => {:panel => {:include => {:author => {} }}, :balloon => {}, :speech => {}, :speech_balloon_template => {} }}
-  end
-  
   def self.show_opt
     {:include => {:panel => {:author => {}}, :balloon => {}, :speech => {}, :speech_balloon_template => {} }}
   end
   
-  def self.show_json_opt
-    {:include => {:panel => {:include => {:author => {} }}, :balloon => {}, :speech => {}, :speech_balloon_template => {} }}
-  end
-  
-  def store operators, attr
-    if self.new_record?
-      sb = self.panel.speech_balloons.build
-      sb.attributes = attr
-    else
-      self.panel.speech_balloons.each do |speech_balloon|
-        next unless speech_balloon == self
-        attr.delete 'id'
-        speech_balloon.attributes = attr
-        break
-      end
-    end
-    self.panel.store({}, operators)
-  end
-  
-  def remove au
-    self.panel.remove_element(self, au)
-  end
-  
-  def parts
-    @parts ||= [self.balloon, self.speech]
-  end
-  
-  def engine_path_name 
-    self.speech_balloon_template.engine_name + '/'
-  end
-  
-  def path_name with_engine = false
-    (with_engine ? self.engine_path_name : '') + 
-      self.class.path_name
-  end
-  
-  def form_template with_engine = false
-    self.path_name(true) + '/form'
-  end
-  
-  def speech_form_template with_engine = false
-    self.engine_path_name + 'speeches/form'
-  end
-  
-  def balloon_form_template with_engine = false
-    self.engine_path_name + 'balloons/form'
-  end
-  
   def scenario_template with_engine = false
     self.path_name(true) + '/scenario'
   end