return false unless reader_role_check(roles)
end
return true if self.own?(roles)
+ return true if self.new_record?
self.visible > 0
end
Sheet.validate_elements_serial validate_serial_list
end
+ def boost
+ @new_element_index = 0
+ self.panel_elements.each do |elm|
+ if elm.new_record?
+ elm.new_index = @new_element_index
+ @new_element_index += 1
+ end
+ end
+ end
+
def store attr, au
if attr == false
self.errors.add :base, I18n.t('errors.invalid_json')
self.overwrite au
res = false
Sheet.transaction do
+ self.sheet_elements.each do |elm|
+ elm.new_sheet = self
+ elm.boost au
+ end
res = self.save
unless validate_child
res = false
r
end
+ def copyable?
+ r = true
+ Sheet.each_element_class_names do |n|
+ self.elements_by_class_name(n).each do |elm|
+ next if elm.copyable?
+ r = false
+ break
+ end
+ break unless r
+ end
+ r
+ end
+
def copy
attr = self.copy_attributes
Sheet.each_element_class_names do |n|
- attr.merge! Sheet.class_name_to_class(n).panelize(self.elements_by_class_name(n).map {|elm| elm.copy_attributes})
+ element_attr = Sheet.class_name_to_class(n).panelize(
+ self.elements_by_class_name(n).map {|elm|
+ elm.copy_attributes.merge elm.panel_attributes
+ }
+ )
+ attr.merge! element_attr
end
attr
end