Methods
A
N
R
S
Included Modules
Instance Public methods
attr(field)
# File app/models/cardboard/page_part.rb, line 54
def attr(field)
  field = field.to_s
  @attr ||= {}
  @attr[field] ||= begin
    f = self.fields.where(identifier: field).first
    return nil unless f
    out = f.value_uid.nil? ? nil : f.value
    out = f.default if f.required? && out.nil?

    f.type == "rich_text" ? out.try(:html_safe) : out
  end
end
new_subpart()
# File app/models/cardboard/page_part.rb, line 39
def new_subpart
  return nil if !repeatable? || subpart?
  master = self.subparts.first
  subpart = master.dup
  for field in master.fields
    new_field = field.dup
    new_field.value = nil
    new_field.object_with_field_id = nil
    new_field.object_with_field_type = nil
    new_field.page_part_id = nil
    subpart.fields << new_field
  end
  return subpart
end
repeatable?()
# File app/models/cardboard/page_part.rb, line 35
def repeatable?
   @parent_repeatable ||= self.parent ? self.parent[:repeatable] : super
end
subpart?()
# File app/models/cardboard/page_part.rb, line 31
def subpart?
  !self.parent_part_id.nil?
end