OSDN Git Service

e
[pettanr/pettanr.git] / app / models / panel.rb
index 11ac112..1c81e69 100644 (file)
@@ -1,5 +1,6 @@
 #コマ
-class Panel < Pettanr::Content
+class Panel < Peta::Content
+  load_manifest
   belongs_to :author
   has_many :scroll_panels
   has_many :sheet_panels
@@ -23,7 +24,7 @@ class Panel < Pettanr::Content
   end
   
   def self.each_element_class_names
-    Pettanr::Application.manifest.system_resources.elements.each do |k, n|
+    Manifest.manifest.system_resources.elements.each do |k, n|
       yield k
     end
   end
@@ -54,7 +55,7 @@ class Panel < Pettanr::Content
   end
   
   def visible? operators
-    return false unless super
+    return true if super
     return true if self.new_record?
     self.publish?
   end
@@ -67,6 +68,13 @@ class Panel < Pettanr::Content
     self.publish > 0
   end
   
+  # ground_picture element template 
+  def style_wh
+    {
+      'width' => self.width.to_s + 'px', 'height' => self.height.to_s + 'px'
+    }
+  end
+  
   def tag_id c = nil
     'panel' + self.tag_panel_id + c.to_s
   end
@@ -87,13 +95,12 @@ class Panel < Pettanr::Content
   
   def select_tag_attributes(selected, column, opt = {})
     [
-      :last, :first, 
       {:html => {:selected => selected}}, 
       self.field_tag_attributes(column, opt)
     ]
   end
   
-  def field_tag_attributes column, opt = {}
+  def field_tag_attributes column, no_attr, opt = {}
     self.tag_attributes(column).merge(
       {:column => column}
     ).merge(opt)