From e3fb85a4511ab3921fb293171ee11ddbe7e9abdb Mon Sep 17 00:00:00 2001 From: Martin Meyerhoff Date: Wed, 4 Oct 2023 15:46:16 +0200 Subject: [PATCH] Use our own objects and translations, add link to legacy promotions This commit isn't super clear cut but really small: It adds a link to the top of the promotions index to the legacy Solidus promotions overview, and it also switches out some of the uses of the legacy system for our system. --- .../admin/promotions/index.html.erb | 11 +++++++---- config/locales/en.yml | 1 + .../admin/promotion_actions_request_spec.rb | 4 ++-- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/app/views/solidus_friendly_promotions/admin/promotions/index.html.erb b/app/views/solidus_friendly_promotions/admin/promotions/index.html.erb index 8395681c..0910ed70 100644 --- a/app/views/solidus_friendly_promotions/admin/promotions/index.html.erb +++ b/app/views/solidus_friendly_promotions/admin/promotions/index.html.erb @@ -1,9 +1,12 @@ -<% admin_breadcrumb(plural_resource_name(Spree::Promotion)) %> +<% admin_breadcrumb(plural_resource_name(SolidusFriendlyPromotions::Promotion)) %> <% content_for :page_actions do %> - <% if can? :create, Spree::Promotion %> + <% if can? :create, SolidusFriendlyPromotions::Promotion %>
  • - <%= link_to t('spree.new_promotion'), spree.new_admin_promotion_path, class: 'btn btn-primary' %> + <%= link_to t('solidus_friendly_promotions.new_promotion'), solidus_friendly_promotions.new_admin_promotion_path, class: 'btn btn-primary' %> +
  • +
  • + <%= link_to t('solidus_friendly_promotions.legacy_promotions'), spree.admin_promotions_path, class: 'btn btn-primary' %>
  • <% end %> <% end %> @@ -118,7 +121,7 @@ <% else %>
    <%= render 'spree/admin/shared/no_objects_found', - resource: Spree::Promotion, + resource: SolidusFriendlyPromotions::Promotion, new_resource_url: new_object_url %>
    <% end %> diff --git a/config/locales/en.yml b/config/locales/en.yml index 87fef33b..8d9070d2 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -25,6 +25,7 @@ en: new_promotion: New Promotion new_promotion_category: New Promotion Category new_promotion_code_batch: New Promotion Code Batch + legacy_promotions: Legacy Promotions no_rules_addes: No Rules Added promotion_successfully_created: Promotion has been successfully created! promotion_total_changed_before_complete: One or more of the promotions on your order have become ineligible and were removed. Please check the new order amounts and try again. diff --git a/spec/requests/solidus_friendly_promotions/admin/promotion_actions_request_spec.rb b/spec/requests/solidus_friendly_promotions/admin/promotion_actions_request_spec.rb index 09a979c8..1067952c 100644 --- a/spec/requests/solidus_friendly_promotions/admin/promotion_actions_request_spec.rb +++ b/spec/requests/solidus_friendly_promotions/admin/promotion_actions_request_spec.rb @@ -15,7 +15,7 @@ } } expect(response).to be_redirect - expect(response).to redirect_to spree.edit_admin_promotion_path(promotion) + expect(response).to redirect_to solidus_friendly_promotions.edit_admin_promotion_path(promotion) expect(promotion.actions.count).to eq(1) end @@ -24,7 +24,7 @@ promotion_action: {type: "Spree::InvalidType"} } expect(response).to be_redirect - expect(response).to redirect_to spree.edit_admin_promotion_path(promotion) + expect(response).to redirect_to solidus_friendly_promotions.edit_admin_promotion_path(promotion) expect(promotion.actions.count).to eq(0) end end