OSDN Git Service

add binder
[pettanr/pettanr.git] / app / models / panel_picture.rb
index a68af58..2943844 100644 (file)
@@ -1,6 +1,5 @@
-class PanelPicture < Pettanr::Content
-  include Element
-  include ElementInspire
+class PanelPicture < Peta::Element
+  load_manifest
   belongs_to :panel
   belongs_to :picture
   
@@ -14,25 +13,6 @@ class PanelPicture < Pettanr::Content
   validates :z, :presence => true, :numericality => {:greater_than => 0}
   validates :t, :presence => true, :numericality => {:greater_than_or_equal_to => 0}
   
-  def owner_model
-    self.panel
-  end
-  
-  def self.valid_encode_columns
-    super + ['link', 'caption']
-  end
-  
-  def self.colum_structures
-    @@colum_structures ||= {
-      :width => {
-        :helper => 'panels/size_helper'
-      }, 
-      :height => {
-        :helper => 'panels/size_helper'
-      }
-    }
-  end
-  
   def self.list_opt_for_panel
     {
       :panel_pictures => {
@@ -101,10 +81,11 @@ class PanelPicture < Pettanr::Content
   
   def opt_img_tag spot = nil, opacity = 20
     o = (spot and spot != self) ? "opacity: #{opacity.to_f/100}; filter:alpha(opacity=#{opacity});" : ''
-    {:id => self.tag_id(:img), :panel_id => self.tag_panel_id, :element_id => self.tag_element_id, :element_type => self.tag_element_type,
-    :class => "panel-picture", :vPicture => self.id, 
-    :src => self.url, :width => self.width.abs, :height => self.height.abs, :picture_id => self.picture_id, :ext => self.picture.ext, :alt => self.caption, 
-    :style => "#{o}"}
+    self.tag_attributes(:img, {
+      :class => "panel-picture", :vPicture => self.id, 
+      :src => self.url, :width => self.width.abs, :height => self.height.abs, :picture_id => self.picture_id, :ext => self.picture.ext, :alt => self.caption, 
+      :style => "#{o}"
+    })
   end
   
   def tmb_opt_img_tag
@@ -116,13 +97,6 @@ class PanelPicture < Pettanr::Content
     self.picture.symbol_option
   end
   
-  def boost
-  end
-  
-  def tag_element_type
-    'panel_picture'
-  end
-  
   def self.list_where
     'panels.publish > 0'
   end
@@ -147,7 +121,7 @@ class PanelPicture < Pettanr::Content
     {:include => {:panel => {:include => {:author => {}}}, :picture => {:include => {:artist => {}, :license => {}}} }}
   end
   
-  def store au
+  def store operators
     if self.new_record?
       self.panel.panel_pictures.build(self.attributes)
     else
@@ -159,11 +133,11 @@ class PanelPicture < Pettanr::Content
         break
       end
     end
-    self.panel.store({}, au)
+    self.panel.store({}, operators)
   end
   
-  def remove au
-    self.panel.remove_element(self, au)
+  def remove operators
+    self.panel.remove_element(self, operators)
   end
   
   def scenario