From 6b57a51acd04daabe83b774af0568c3470e3b4c6 Mon Sep 17 00:00:00 2001 From: Tomasz Donarski Date: Mon, 4 Dec 2023 08:41:21 +0100 Subject: [PATCH] Add PromotionBatches menu item --- .../admin/main_menu/default_configuration_builder.rb | 8 ++++++++ .../admin/main_menu/default_configuration_builder_spec.rb | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/app/models/spree/admin/main_menu/default_configuration_builder.rb b/app/models/spree/admin/main_menu/default_configuration_builder.rb index 4ad4887506..b524eaada3 100644 --- a/app/models/spree/admin/main_menu/default_configuration_builder.rb +++ b/app/models/spree/admin/main_menu/default_configuration_builder.rb @@ -19,6 +19,7 @@ def build add_integrations_section(root) add_oauth_section(root) add_settings_section(root) + add_promotion_batches_section(root) root end @@ -255,6 +256,13 @@ def add_settings_section(root) build root.add(section) end + + def add_promotion_batches_section(root) + root.add(ItemBuilder.new('promotion_batches', admin_promotion_batches_path). + with_icon_key('stack.svg'). + with_admin_ability_check(Spree::PromotionBatch). + build) + end # rubocop:enable Metrics/AbcSize end # rubocop:enable Metrics/ClassLength diff --git a/spec/models/spree/admin/main_menu/default_configuration_builder_spec.rb b/spec/models/spree/admin/main_menu/default_configuration_builder_spec.rb index 353f05a9dc..455a3fec23 100644 --- a/spec/models/spree/admin/main_menu/default_configuration_builder_spec.rb +++ b/spec/models/spree/admin/main_menu/default_configuration_builder_spec.rb @@ -9,7 +9,7 @@ module Admin subject { builder.build } it 'builds a valid menu' do - expect(subject.items.count).to eq(12) + expect(subject.items.count).to eq(13) expect(subject.items.map(&:key)).to include('dashboard') expect(subject.items.map(&:key)).to include('orders') expect(subject.items.map(&:key)).to include('settings')