Sha256: c658ae9ed257a7d882302409e2ac570299af1f1cbfd8e98e1ebd2484432e6fc3
Contents?: true
Size: 950 Bytes
Versions: 12
Compression:
Stored size: 950 Bytes
Contents
# frozen_string_literal: true module Maglev # Create the default pages of the theme. # Called by the GenerateSite service. class SetupPages include Injectable dependency :persist_page, class: Maglev::PersistPage argument :site argument :theme def call pages&.map do |page_attributes| create_page(page_attributes) end end private def pages theme&.pages end def create_page(page_attributes) persist_page.call( site: site, site_attributes: site_attributes_from(page_attributes), theme: theme, page: Maglev::Page.new, page_attributes: page_attributes ) end def site_attributes_from(page_attributes) { sections: (page_attributes[:sections] || []).find_all do |section| definition = theme.sections.find(section['type']) definition.site_scoped? end } end end end
Version data entries
12 entries across 12 versions & 1 rubygems