X-Git-Url: http://git.osdn.net/view?a=blobdiff_plain;ds=sidebyside;f=app%2Fmodels%2Fground_picture.rb;h=3562d32d6ccb3ccf03d44bee41645a4fc936832f;hb=4a6e0f4d50891db192d5f477f61b7448c1d90a02;hp=50428685e120bdfc451ea35622158c8553232830;hpb=9422adf65e507c3c96ee4892ad61ab8abe8336d8;p=pettanr%2Fpettanr.git diff --git a/app/models/ground_picture.rb b/app/models/ground_picture.rb index 50428685..3562d32d 100644 --- a/app/models/ground_picture.rb +++ b/app/models/ground_picture.rb @@ -75,7 +75,7 @@ class GroundPicture < ActiveRecord::Base def opt_div_style full_url, spot = nil, opacity = 20 o = (spot and spot != self) ? "opacity: #{opacity.to_f/100}; filter:alpha(opacity=#{opacity});" : '' - "position: absolute; width:#{self.panel.width}px; height:#{self.panel.height}px; top: 0px; left: 0px; z-index:#{self.z}; background-image: url(#{full_url}); background-repeat: #{self.repeat_text}; background-position: #{self.x}px #{self.y}px; #{o}" + "position: absolute; width:#{self.get_panel.width}px; height:#{self.get_panel.height}px; top: 0px; left: 0px; z-index:#{self.z}; background-image: url(#{full_url}); background-repeat: #{self.repeat_text}; background-position: #{self.x}px #{self.y}px; #{o}" end def tmb_opt_img_tag @@ -83,6 +83,18 @@ class GroundPicture < ActiveRecord::Base {:src => self.picture.url, :width => tw, :height => th, :alt => self.caption} end + def new_panel + @new_panel + end + + def new_panel= v + @new_panel = v + end + + def get_panel + self.panel || @new_panel + end + def tag_id c = nil 'panel' + tag_panel_id + 'ground_picture' + tag_element_id + c.to_s end @@ -92,7 +104,7 @@ class GroundPicture < ActiveRecord::Base end def tag_panel_id - self.panel.new_record? ? '0' : self.panel.id.to_s + self.get_panel.new_record? ? '0' : self.get_panel.id.to_s end def tag_element_id