OSDN Git Service

element
[pettanr/pettanr.git] / app / models / balloon.rb
index ad9bbe4..b36a825 100644 (file)
@@ -1,4 +1,5 @@
 class Balloon < Peta::Content
+  load_manifest
   include Peta::ElementPart
   belongs_to :speech_balloon
   belongs_to :system_picture
@@ -13,14 +14,6 @@ class Balloon < Peta::Content
 #  validates :caption, :presence => true
   validates :settings, :extend_balloon => true
 
-  def owner_model
-    self.speech_balloon.panel
-  end
-  
-  def self.valid_encode_columns
-    super + ['settings']
-  end
-  
   def self.colum_structures
     @@colum_structures ||= {
       :r => {
@@ -83,6 +76,13 @@ self.system_picture_id = 1
     {:include => {:speech_balloon => {:include => {:panel => {:include => {:author => {} }}, :speech => {}, :speech_balloon_template => {} }}}}
   end
   
+  def style
+    {
+      'width' => self.width.to_s + 'px','height' => self.height.to_s + 'px',
+      'top' => self.y.to_s + 'px','left' => self.x.to_s + 'px'
+    }
+  end
+  
   def copy_attributes
     r = self.attributes
     r.delete 'id'