Skip to content
This repository has been archived by the owner on Sep 12, 2019. It is now read-only.

Commit

Permalink
Add menu item
Browse files Browse the repository at this point in the history
  • Loading branch information
jhawthorn committed Nov 21, 2017
1 parent b4b7402 commit 09abf09
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions lib/solidus_stock_transfers/engine.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
require 'solidus_backend'

module SolidusStockTransfers
class Engine < Rails::Engine
require 'spree/core'
isolate_namespace Spree
engine_name 'solidus_stock_transfers'

Expand All @@ -9,12 +10,14 @@ class Engine < Rails::Engine
g.test_framework :rspec
end

def self.activate
Dir.glob(File.join(File.dirname(__FILE__), '../../app/**/*_decorator*.rb')) do |c|
Rails.configuration.cache_classes ? require(c) : load(c)
initializer "add_stock_transfer_menu_item" do
Spree::Backend::Config.configure do |config|
config.menu_items << config.class::MenuItem.new(
[:stock_transfers],
'exchange',
url: :admin_stock_transfers_path
)
end
end

config.to_prepare(&method(:activate).to_proc)
end
end

0 comments on commit 09abf09

Please sign in to comment.