Sha256: 566bf7efce59eaa54b612ea44695846f4b5174cbf62cfaab3b383b42d9c843df

Contents?: true

Size: 784 Bytes

Versions: 1

Compression:

Stored size: 784 Bytes

Contents

# frozen_string_literal: true

require 'spree/core'
require 'solidus_static_content'

module SolidusStaticContent
  class Engine < Rails::Engine
    include SolidusSupport::EngineExtensions

    isolate_namespace ::Spree

    engine_name 'solidus_static_content'

    # use rspec for tests
    config.generators do |g|
      g.test_framework :rspec
    end

    def self.menu_item
      @menu_item ||= Spree::Backend::Config.class::MenuItem.new(
        [:pages],
        'file-text',
        condition: -> { can?(:admin, Spree::Page) },
      )
    end

    def self.activate_menu_items
      return if Spree::Backend::Config.menu_items.include?(menu_item)

      Spree::Backend::Config.menu_items << menu_item
    end

    config.to_prepare(&method(:activate_menu_items))
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
solidus_static_content-2.0.0 lib/solidus_static_content/engine.rb