OSDN Git Service

Merge branch 'v06jq' of git.sourceforge.jp:/gitroot/pettanr/pettanr into v06
[pettanr/pettanr.git] / app / models / speech_balloon.rb
index 6ca04cd..ff6716d 100644 (file)
@@ -44,6 +44,30 @@ class SpeechBalloon < ActiveRecord::Base
     self.panel.visible? roles
   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.panel.new_record? ? '0' : self.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 field_tree f
+    'panels-' + self.tag_panel_id + '-speech_balloons_attributes-' + self.tag_element_id + '-' + f.to_s
+  end
+  
   def self.default_page_size
     25
   end