OSDN Git Service

t#31945:separate js
[pettanr/pettanr.git] / app / models / panel_picture.rb
index cef80fe..32468bc 100644 (file)
@@ -1,4 +1,6 @@
 class PanelPicture < ActiveRecord::Base
+  include Element
+  include ElementInspire
   belongs_to :panel
   belongs_to :picture
   
@@ -21,6 +23,43 @@ class PanelPicture < ActiveRecord::Base
     end
   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 => {
+        :picture => {:artist => {}, :license => {}}
+      }
+    }
+  end
+  
+  def self.show_opt_for_panel
+    {
+      :panel_pictures => {
+        :picture => {:artist => {}, :license => {}}
+      }
+    }
+  end
+  
+  def self.json_opt_for_panel
+    {
+      :picture => {:artist => {}, :license => {}}
+    }
+  end
+  
+  def self.has_picture?
+    true
+  end
+  
   def visible? roles
     if MagicNumber['run_mode'] == 0
       return false unless guest_role_check(roles)
@@ -79,30 +118,13 @@ class PanelPicture < ActiveRecord::Base
     {:src => self.url, :width => tw, :height => th, :alt => self.caption}
   end
   
-  def tag_id c = nil
-    'panel' + tag_panel_id + 'panel_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
+  def boost
   end
   
   def tag_element_type
     'panel_picture'
   end
   
-  def field_tree f
-    'panels-' + self.tag_panel_id + '-panel_pictures_attributes-' + self.tag_element_id + '-' + f.to_s
-  end
-  
   def self.default_page_size
     25
   end