OSDN Git Service

t#31896:refact elm
[pettanr/pettanr.git] / app / models / speech_balloon.rb
index f3f9108..06e1881 100644 (file)
@@ -68,26 +68,6 @@ class SpeechBalloon < ActiveRecord::Base
     self.panel.visible? roles
   end
   
-  def new_index
-    @new_index
-  end
-  
-  def new_index= v
-    @new_index = v
-  end
-  
-  def new_panel
-    @new_panel
-  end
-  
-  def new_panel= v
-    @new_panel = v
-  end
-  
-  def get_panel
-    self.panel || @new_panel
-  end
-  
   def new_sballoon
     @new_balloon
   end
@@ -119,21 +99,21 @@ class SpeechBalloon < ActiveRecord::Base
       self.new_balloon = self.build_balloon 
       self.new_speech = self.build_speech 
     end
-    self.get_balloon.extend self.speech_balloon_template.engine_balloon_module
-    self.get_speech.extend self.speech_balloon_template.engine_speech_module
-    self.get_balloon.new_speech_balloon = self
-    self.get_speech.new_speech_balloon = self
+    self.balloon.extend self.speech_balloon_template.engine_balloon_module
+    self.speech.extend self.speech_balloon_template.engine_speech_module
+    self.balloon.new_parent = self
+    self.speech.new_parent = self
     self.extend_speech_balloon = if self.settings.blank?
       {}
     else
       JSON.parse(self.settings)
     end
-    self.get_balloon.extend_balloon = if self.get_balloon.settings.blank?
+    self.balloon.extend_balloon = if self.balloon.settings.blank?
       {}
     else
       JSON.parse(self.get_balloon.settings)
     end
-    self.get_speech.extend_speech = if self.get_speech.settings.blank?
+    self.speech.extend_speech = if self.speech.settings.blank?
       {}
     else
       JSON.parse(self.get_speech.settings)
@@ -155,30 +135,10 @@ class SpeechBalloon < ActiveRecord::Base
     end
   end
   
-  def tag_id c = nil
-    'panel' + tag_panel_id + 'speech_balloon' + tag_element_id + c.to_s
-  end
-  
-  def field_tag_id f
-    self.tag_id + f.to_s
-  end
-  
-  def tag_panel_id
-    self.get_panel.new_record? ? '0' : self.get_panel.id.to_s
-  end
-  
-  def tag_element_id
-    self.new_record? ? '0' : self.id.to_s
-  end
-  
   def tag_element_type
     'speech_balloon'
   end
   
-  def tag_new_index
-    self.new_index.to_s
-  end
-  
   def self.default_page_size
     25
   end