OSDN Git Service

Merge branch 'v06' of git.sourceforge.jp:/gitroot/pettanr/pettanr into v06
[pettanr/pettanr.git] / app / models / panel_picture.rb
index 8607279..e960e3e 100644 (file)
@@ -57,8 +57,8 @@ class PanelPicture < ActiveRecord::Base
     '/pictures/' + self.filename
   end
   
-  def opt_img_tag opacity = nil
-    o = opacity ? "opacity: #{opacity.to_f/100}; filter:alpha(opacity=#{opacity});" : ''
+  def opt_img_tag spot = nil, opacity = 20
+    o = spot and spot != self ? "opacity: #{opacity.to_f/100}; filter:alpha(opacity=#{opacity});" : ''
     {:src => self.url, :vPicture => self.id, :width => self.width.abs, :height => self.height.abs, :alt => self.caption, :style => "top:#{self.y}px; left:#{self.x}px; z-index:#{self.z}; #{o}"}
   end
   
@@ -172,25 +172,22 @@ class PanelPicture < ActiveRecord::Base
   end
   
   def remove au
-    PanelPicture.transaction do
-      d = false
-      panel_pictures_attributes = {}
-      
-      self.panel.panel_pictures.each do |panel_picture|
-        attr = panel_picture.attributes
-        if panel_picture == self
-          attr['_destroy'] = true
-          d = true
-        else
-          if d
-            attr['t']  -= 1 
-          end
+    d = false
+    panel_pictures_attributes = {}
+    self.panel.panel_pictures.each do |panel_picture|
+      attr = panel_picture.attributes
+      if panel_picture == self
+        attr['_destroy'] = true
+        d = true
+      else
+        if d
+          attr['t']  -= 1 
         end
-        panel_pictures_attributes[panel_picture.id] = attr
       end
-      self.panel.attributes = {:panel_pictures_attributes => panel_pictures_attributes}
-      self.panel.store({}, au)
+      panel_pictures_attributes[panel_picture.id] = attr
     end
+    self.panel.attributes = {:panel_pictures_attributes => panel_pictures_attributes}
+    self.panel.store({}, au)
   end
   
   def scenario