validates :height, :presence => true, :numericality => true, :natural_number => true
validates :r, :presence => true, :numericality => true
# validates :caption, :presence => true
-# validates :settings, :presence => true
+ validates :settings, :extend_balloon => true
before_validation :valid_encode
self.system_picture_id = 1
end
+ def new_speech_balloon
+ @new_speech_balloon
+ end
+
+ def new_speech_balloon= v
+ @new_speech_balloon = v
+ end
+
def get_speech_balloon
- self.speech_balloon
+ self.speech_balloon || @new_speech_balloon
end
def get_panel_id
'balloon'
end
- def field_tree f
- 'panels-' + self.tag_panel_id + '-speech_balloons_attributes-' + self.tag_element_id + '-balloon_attributes-' + f.to_s
+ def tag_new_index
+ if self.get_speech_balloon == nil
+ nil
+ else
+ self.get_speech_balloon.tag_new_index
+ end
end
def self.default_page_size
{:include => {:speech_balloon => {:include => {:panel => {:include => {:author => {} }}, :speech => {}, :speech_balloon_template => {} }}}}
end
+ def copy_attributes
+ r = self.attributes
+ r.delete 'id'
+ r.delete 'speech_balloon_id'
+ r.delete 'created_at'
+ r.delete 'updated_at'
+ r
+ end
+
+ def self.panelize balloon_attributes
+ {'balloon_attributes' => balloon_attributes}
+ end
+
def scenario
end