Skip to content

Commit

Permalink
Merge pull request solidusio#17 from friendlycart/require-solidus
Browse files Browse the repository at this point in the history
Require solidus
  • Loading branch information
mamhoff committed Oct 10, 2023
2 parents c2d8693 + 4af2069 commit b3a4ed8
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@
<li>
<%= link_to t('solidus_friendly_promotions.new_promotion'), solidus_friendly_promotions.new_admin_promotion_path, class: 'btn btn-primary' %>
</li>
<li>
<%= link_to t('solidus_friendly_promotions.legacy_promotions'), solidus_friendly_promotions.admin_promotions_path, class: 'btn btn-primary' %>
</li>
<% end %>
<% end %>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<ul class="admin-subnav" data-hook="admin_promotion_sub_tabs">
<% if can? :admin, SolidusFriendlyPromotions::Promotion %>
<%= tab url: solidus_friendly_promotions.admin_promotions_path, label: :promotions %>
<% end %>
<% if can? :admin, SolidusFriendlyPromotions::PromotionCategory %>
<%= tab url: solidus_friendly_promotions.admin_promotion_categories_path, label: :promotion_categories %>
<% end %>
</ul>
17 changes: 12 additions & 5 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@
# See https://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points.

en:
spree:
admin:
tab:
promotions: Promotions
promotion_categories: Promotion Categories
legacy_promotions: Legacy Promotions
legacy_promotion_categories: Legacy Promotion Categories
solidus_friendly_promotions:
actions: Actions
adjustment_labels:
Expand Down Expand Up @@ -81,11 +88,11 @@ en:
starts_at_placeholder: Immediately
edit:
order_rules: Order Rules
promotion_status:
active: Active
expired: Expired
inactive: Inactive
not_started: Not started
promotion_status:
active: Active
expired: Expired
inactive: Inactive
not_started: Not started
promotion_code_batch_mailer:
promotion_code_batch_errored:
message: 'Promotion code batch errored (%{error}) for promotion: '
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,27 @@
label: :promotion_categories,
url: -> { SolidusFriendlyPromotions::Engine.routes.url_helpers.admin_promotion_categories_path },
condition: -> { can?(:admin, SolidusFriendlyPromotions::PromotionCategory) }
),
Spree::BackendConfiguration::MenuItem.new(
label: :legacy_promotions,
condition: -> { can?(:admin, Spree::Promotion && Spree::Promotion.any?) },
url: -> { Spree::Core::Engine.routes.url_helpers.admin_promotions_path },
match_path: '/admin/promotions/'
),
Spree::BackendConfiguration::MenuItem.new(
label: :legacy_promotion_categories,
condition: -> { can?(:admin, Spree::PromotionCategory && Spree::Promotion.any?) },
url: -> { Spree::Core::Engine.routes.url_helpers.admin_promotion_categories_path },
match_path: '/admin/promotion_categories/'
)
]
)
else
Spree::BackendConfiguration::MenuItem.new(
[:promotions, :promotion_categories],
"bullhorn",
partial: "spree/admin/shared/promotion_sub_menu",
condition: -> { can?(:admin, Spree::Promotion) },
partial: "solidus_friendly_promotions/admin/shared/promotion_sub_menu",
condition: -> { can?(:admin, SolidusFriendlyPromotions::Promotion) },
url: -> { SolidusFriendlyPromotions::Engine.routes.url_helpers.admin_promotions_path },
position: 2
)
Expand Down
4 changes: 3 additions & 1 deletion lib/solidus_friendly_promotions.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# frozen_string_literal: true

require "spree"
require "solidus_core"
require "solidus_backend"
require "solidus_support"
require "turbo-rails"
require "importmap-rails"
require "stimulus-rails"
Expand Down

0 comments on commit b3a4ed8

Please sign in to comment.