class GroundColor < ActiveRecord::Base
+ include Element
+ include ElementInspire
belongs_to :panel
belongs_to :color
end
end
+ def self.list_opt_for_panel
+ {
+ :ground_colors => {
+ }
+ }
+ end
+
+ def self.show_opt_for_panel
+ {
+ :ground_colors => {
+ }
+ }
+ end
+
+ def self.json_opt_for_panel
+ {
+ }
+ end
+
+ def self.has_picture?
+ false
+ end
+
def supply_default
self.code ||= 0
if self.panel
def opt_div_style 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; z-index:#{self.z}; background-color:##{format("%06x", self.code)}; #{o}"
+ "position: absolute; width:#{self.get_panel.width}px; height:#{self.get_panel.height}px; z-index:#{self.z}; background-color:##{format("%06x", self.code)}; #{o}"
+ end
+
+ def new_index
+ @new_index
+ end
+
+ def new_index= v
+ @new_index = v
+ 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
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
'ground_color'
end
- def field_tree f
- 'panels-' + self.tag_panel_id + '-ground_colors_attributes-' + self.tag_element_id + '-' + f.to_s
+ def tag_new_index
+ self.new_index.to_s
end
def self.default_page_size
end
def remove au
- d = false
- ground_colors_attributes = {}
- self.panel.ground_colors.each do |ground_color|
- attr = ground_color.attributes
- if ground_color == self
- attr['_destroy'] = true
- d = true
- else
- if d
- attr['t'] -= 1
- end
- end
- ground_colors_attributes[ground_color.id] = attr
- end
- self.panel.attributes = {:ground_colors_attributes => ground_colors_attributes}
- self.panel.store({}, au)
+ self.panel.remove_element(self, au)
end
def scenario
- ''
+ if caption.blank?
+ ''
+ else
+ '<p>' + ERB::Util.html_escape(self.caption) + '</p>'
+ end
+ end
+
+ def plain_scenario
+ if caption.blank?
+ ''
+ else
+ self.caption + "\n"
+ end
end
end