Sha256: 224f4f410705f98bc59aedeb51575a3d945351711766ebf4ceed7cd836ed1116

Contents?: true

Size: 1.33 KB

Versions: 13

Compression:

Stored size: 1.33 KB

Contents

module Locomotive
  module Concerns
    module Site
      module Sections

        extend ActiveSupport::Concern
        include Concerns::Shared::JsonAttribute

        included do

          ## fields ##
          field :sections_content, type: Hash, default: {}, localize: true

          ## behaviours ##
          json_attribute  :sections_content
        end

        private

        # Example:
        #
        # {
        #   "header": {
        #     "settings": {
        #       "brand_name": "Acme Corp",
        #       "background_color": "#333"
        #     },
        #     "blocks": []
        #   },
        #   "footer": {
        #     "settings": {
        #       "copyright": "2018 (c) copyright Acme LTD"
        #     }
        #   }
        # }
        #
        def _sections_content_schema
          {
            id: 'http://www.locomotive.cms/schemas/site/sections_content.json',
            type: 'object',
            patternProperties: {
              "^[a-z][a-z0-9_]+$" => {
                type: 'object',
                properties: {
                  type:     { type: 'string' },
                  settings: { type: 'object' },
                  blocks:   { type: 'array' }
                },
                additionalProperties: false
              }
            }
          }
        end

      end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
locomotivecms-4.2.0.alpha2 app/models/locomotive/concerns/site/sections.rb
locomotivecms-4.2.0.alpha1 app/models/locomotive/concerns/site/sections.rb
locomotivecms-4.1.1 app/models/locomotive/concerns/site/sections.rb
locomotivecms-4.1.0 app/models/locomotive/concerns/site/sections.rb
locomotivecms-4.1.0.rc1 app/models/locomotive/concerns/site/sections.rb
locomotivecms-4.0.3 app/models/locomotive/concerns/site/sections.rb
locomotivecms-4.0.2 app/models/locomotive/concerns/site/sections.rb
locomotivecms-4.0.1 app/models/locomotive/concerns/site/sections.rb
locomotivecms-4.0.0 app/models/locomotive/concerns/site/sections.rb
locomotivecms-4.0.0.rc0 app/models/locomotive/concerns/site/sections.rb
locomotivecms-4.0.0.alpha3 app/models/locomotive/concerns/site/sections.rb
locomotivecms-4.0.0.alpha2 app/models/locomotive/concerns/site/sections.rb
locomotivecms-4.0.0.alpha1 app/models/locomotive/concerns/site/sections.rb