Module: Maglev::SectionsConcern

Included in:
Page, Site
Defined in:
app/models/concerns/maglev/sections_concern.rb

Overview

rubocop:disable Style/ClassAndModuleChildren

Instance Method Summary collapse

Instance Method Details

#prepare_sections(theme) ⇒ Object



5
6
7
8
9
10
11
12
# File 'app/models/concerns/maglev/sections_concern.rb', line 5

def prepare_sections(theme)
  # NOTE: pages defined in the theme definition
  # don't include the ids for sections/blocks
  self.sections ||= [] # NOTE: the self is mandatory here
  sections.each do |section|
    prepare_section(theme, section)
  end
end

#prepare_sections_translations(theme) ⇒ Object



14
15
16
17
18
19
20
21
22
# File 'app/models/concerns/maglev/sections_concern.rb', line 14

def prepare_sections_translations(theme)
  return if sections_translations.blank?

  sections_translations.each_key do |locale|
    Maglev::I18n.with_locale(locale) do
      prepare_sections(theme)
    end
  end
end