Class: Jigsaw::Layout

Inherits:
ApplicationRecord show all
Includes:
GridConfigurable
Defined in:
app/models/jigsaw/layout.rb

Constant Summary

Constants included from GridConfigurable

GridConfigurable::SCHEMA, GridConfigurable::SCHEMA_PATH

Instance Method Summary collapse

Methods included from GridConfigurable

#colGap=, #config=, #rowGap=, #sync_slots, #unique_area_names

Instance Method Details

#effective_compiled_cssObject



25
26
27
28
29
30
31
# File 'app/models/jigsaw/layout.rb', line 25

def effective_compiled_css
  if linked_to_template? && layout_template
    layout_template.compiled_css
  else
    compiled_css
  end
end

#effective_configObject

— Template Linking —



17
18
19
20
21
22
23
# File 'app/models/jigsaw/layout.rb', line 17

def effective_config
  if linked_to_template? && layout_template
    layout_template.config
  else
    config
  end
end


43
44
45
46
47
# File 'app/models/jigsaw/layout.rb', line 43

def link_to_template!(tmpl)
  self.layout_template = tmpl
  self.linked_to_template = true
  save!
end

#skip_config_validation?Boolean

Returns:

  • (Boolean)


11
12
13
# File 'app/models/jigsaw/layout.rb', line 11

def skip_config_validation?
  linked_to_template?
end


33
34
35
36
37
38
39
40
41
# File 'app/models/jigsaw/layout.rb', line 33

def unlink_from_template!
  return unless linked_to_template? && layout_template

  # Copy template's grid config locally
  self.config = layout_template.config.deep_dup
  self.linked_to_template = false
  self.layout_template = nil
  save!
end