OSDN Git Service

t#31558:
[pettanr/pettanr.git] / app / models / ground_picture.rb
index 67cc2c4..cc375ee 100644 (file)
@@ -54,6 +54,30 @@ class GroundPicture < ActiveRecord::Base
     {:src => self.picture.url, :width => tw, :height => th, :alt => self.caption}
   end
   
+  def tag_id c = nil
+    'panel' + tag_panel_id + 'ground_picture' + 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
+    'ground_picture'
+  end
+  
+  def field_tree f
+    'panels-' + self.tag_panel_id + '-ground_pictures_attributes_-' + self.tag_element_id + '-' + f.to_s
+  end
+  
   def repeat_text
     @@repeat_texts[self.repeat]
   end