From 157d16460c17859bd87f41b33580c289d339cfe8 Mon Sep 17 00:00:00 2001 From: Martin Meyerhoff Date: Wed, 4 Oct 2023 15:41:58 +0200 Subject: [PATCH 1/4] Namespace routes to our controllers For the transition process between the two promotion systems, we want the admins to still have access to the legacy promotions. Prior to this commit, this access was thwarted as we used the exact same paths as core Solidus. This adds an extra `friendly/` to the path, so that the paths can be distinguished. This in turn revealed we have to use the right routing proxy for the promotions controller, otherwise we'd be sent to actions in the Solidus world. --- .../admin/promotions_controller.rb | 4 ++++ promotions/config/routes.rb | 16 +++++++++------- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/promotions/app/controllers/solidus_friendly_promotions/admin/promotions_controller.rb b/promotions/app/controllers/solidus_friendly_promotions/admin/promotions_controller.rb index ef5bb8bb..65957c9c 100644 --- a/promotions/app/controllers/solidus_friendly_promotions/admin/promotions_controller.rb +++ b/promotions/app/controllers/solidus_friendly_promotions/admin/promotions_controller.rb @@ -59,6 +59,10 @@ def load_data def location_after_save solidus_friendly_promotions.edit_admin_promotion_url(@promotion) end + + def routes_proxy + solidus_friendly_promotions + end end end end diff --git a/promotions/config/routes.rb b/promotions/config/routes.rb index 911a8da7..74792e80 100644 --- a/promotions/config/routes.rb +++ b/promotions/config/routes.rb @@ -2,14 +2,16 @@ SolidusFriendlyPromotions::Engine.routes.draw do namespace :admin do - resources :promotion_categories, except: [:show] + scope :friendly do + resources :promotion_categories, except: [:show] - resources :promotions do - resources :promotion_rules - resources :promotion_actions - resources :promotion_codes, only: [:index, :new, :create] - resources :promotion_code_batches, only: [:index, :new, :create] do - get "/download", to: "promotion_code_batches#download", defaults: {format: "csv"} + resources :promotions do + resources :promotion_rules + resources :promotion_actions + resources :promotion_codes, only: [:index, :new, :create] + resources :promotion_code_batches, only: [:index, :new, :create] do + get "/download", to: "promotion_code_batches#download", defaults: {format: "csv"} + end end end end From bff4b45eb26bd547607d1742ba58c60918899eb2 Mon Sep 17 00:00:00 2001 From: Martin Meyerhoff Date: Wed, 4 Oct 2023 15:46:16 +0200 Subject: [PATCH 2/4] 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 +++++++---- promotions/config/locales/en.yml | 1 + .../admin/promotion_actions_request_spec.rb | 4 ++-- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/promotions/app/views/solidus_friendly_promotions/admin/promotions/index.html.erb b/promotions/app/views/solidus_friendly_promotions/admin/promotions/index.html.erb index 8395681c..0910ed70 100644 --- a/promotions/app/views/solidus_friendly_promotions/admin/promotions/index.html.erb +++ b/promotions/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/promotions/config/locales/en.yml b/promotions/config/locales/en.yml index 87fef33b..8d9070d2 100644 --- a/promotions/config/locales/en.yml +++ b/promotions/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/promotions/spec/requests/solidus_friendly_promotions/admin/promotion_actions_request_spec.rb b/promotions/spec/requests/solidus_friendly_promotions/admin/promotion_actions_request_spec.rb index 09a979c8..1067952c 100644 --- a/promotions/spec/requests/solidus_friendly_promotions/admin/promotion_actions_request_spec.rb +++ b/promotions/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 From 69b342a39d4187cfd53adfbc2d25be7c34840901 Mon Sep 17 00:00:00 2001 From: Martin Meyerhoff Date: Thu, 5 Oct 2023 13:20:19 +0200 Subject: [PATCH 3/4] Add custom base controller The controller code we were using relied on a patch to Solidus[1] that will only be released with Solidus 4.2. We want to be compatible with Solidus 4 though, so we're incorporating that patch into our own BaseController and use that instead of Solidus' ResourceController. [1] https://github.com/solidusio/solidus/pull/5219 --- .../admin/base_controller.rb | 54 +++++++++++++++++++ .../admin/promotion_categories_controller.rb | 6 +-- .../promotion_code_batches_controller.rb | 2 +- .../admin/promotion_codes_controller.rb | 2 +- .../admin/promotions_controller.rb | 6 +-- 5 files changed, 58 insertions(+), 12 deletions(-) create mode 100644 promotions/app/controllers/solidus_friendly_promotions/admin/base_controller.rb diff --git a/promotions/app/controllers/solidus_friendly_promotions/admin/base_controller.rb b/promotions/app/controllers/solidus_friendly_promotions/admin/base_controller.rb new file mode 100644 index 00000000..d87386bb --- /dev/null +++ b/promotions/app/controllers/solidus_friendly_promotions/admin/base_controller.rb @@ -0,0 +1,54 @@ +# frozen_string_literal: true + +module SolidusFriendlyPromotions + module Admin + class BaseController < Spree::Admin::ResourceController + def parent + @parent ||= self.class.parent_data[:model_class] + .includes(self.class.parent_data[:includes]) + .find_by!(self.class.parent_data[:find_by] => params["#{parent_model_name}_id"]) + instance_variable_set("@#{parent_model_name}", @parent) + rescue ActiveRecord::RecordNotFound => e + resource_not_found(flash_class: e.model.constantize, redirect_url: routes_proxy.polymorphic_url([:admin, parent_model_name.pluralize.to_sym])) + end + + def new_object_url(options = {}) + if parent? + routes_proxy.new_polymorphic_url([:admin, parent, model_class], options) + else + routes_proxy.new_polymorphic_url([:admin, model_class], options) + end + end + + def edit_object_url(object, options = {}) + if parent? + routes_proxy.polymorphic_url([:edit, :admin, parent, object], options) + else + routes_proxy.polymorphic_url([:edit, :admin, object], options) + end + end + + def object_url(object = nil, options = {}) + target = object || @object + + if parent? + routes_proxy.polymorphic_url([:admin, parent, target], options) + else + routes_proxy.polymorphic_url([:admin, target], options) + end + end + + def collection_url(options = {}) + if parent? + routes_proxy.polymorphic_url([:admin, parent, model_class], options) + else + routes_proxy.polymorphic_url([:admin, model_class], options) + end + end + + def routes_proxy + solidus_friendly_promotions + end + end + end +end diff --git a/promotions/app/controllers/solidus_friendly_promotions/admin/promotion_categories_controller.rb b/promotions/app/controllers/solidus_friendly_promotions/admin/promotion_categories_controller.rb index a9861ca3..53a1e1f3 100644 --- a/promotions/app/controllers/solidus_friendly_promotions/admin/promotion_categories_controller.rb +++ b/promotions/app/controllers/solidus_friendly_promotions/admin/promotion_categories_controller.rb @@ -2,16 +2,12 @@ module SolidusFriendlyPromotions module Admin - class PromotionCategoriesController < Spree::Admin::ResourceController + class PromotionCategoriesController < BaseController private def model_class SolidusFriendlyPromotions::PromotionCategory end - - def routes_proxy - solidus_friendly_promotions - end end end end diff --git a/promotions/app/controllers/solidus_friendly_promotions/admin/promotion_code_batches_controller.rb b/promotions/app/controllers/solidus_friendly_promotions/admin/promotion_code_batches_controller.rb index 24d5be4d..7361d860 100644 --- a/promotions/app/controllers/solidus_friendly_promotions/admin/promotion_code_batches_controller.rb +++ b/promotions/app/controllers/solidus_friendly_promotions/admin/promotion_code_batches_controller.rb @@ -2,7 +2,7 @@ module SolidusFriendlyPromotions module Admin - class PromotionCodeBatchesController < Spree::Admin::ResourceController + class PromotionCodeBatchesController < BaseController belongs_to "solidus_friendly_promotions/promotion" create.after :build_promotion_code_batch diff --git a/promotions/app/controllers/solidus_friendly_promotions/admin/promotion_codes_controller.rb b/promotions/app/controllers/solidus_friendly_promotions/admin/promotion_codes_controller.rb index 291e3d3b..d95bc9ba 100644 --- a/promotions/app/controllers/solidus_friendly_promotions/admin/promotion_codes_controller.rb +++ b/promotions/app/controllers/solidus_friendly_promotions/admin/promotion_codes_controller.rb @@ -4,7 +4,7 @@ module SolidusFriendlyPromotions module Admin - class PromotionCodesController < Spree::Admin::ResourceController + class PromotionCodesController < BaseController before_action :load_promotion def index diff --git a/promotions/app/controllers/solidus_friendly_promotions/admin/promotions_controller.rb b/promotions/app/controllers/solidus_friendly_promotions/admin/promotions_controller.rb index 65957c9c..bd838a23 100644 --- a/promotions/app/controllers/solidus_friendly_promotions/admin/promotions_controller.rb +++ b/promotions/app/controllers/solidus_friendly_promotions/admin/promotions_controller.rb @@ -2,7 +2,7 @@ module SolidusFriendlyPromotions module Admin - class PromotionsController < ::Spree::Admin::ResourceController + class PromotionsController < BaseController before_action :load_data helper "solidus_friendly_promotions/admin/promotion_rules" @@ -59,10 +59,6 @@ def load_data def location_after_save solidus_friendly_promotions.edit_admin_promotion_url(@promotion) end - - def routes_proxy - solidus_friendly_promotions - end end end end From 9a8a5ab9e5972adf1475e93363e0e2e3d9911883 Mon Sep 17 00:00:00 2001 From: Martin Meyerhoff Date: Fri, 6 Oct 2023 11:43:24 +0200 Subject: [PATCH 4/4] Change references to legacy promotion system in views There were many references to the promotion system in solidus core in our views folder still. This commit changes them. --- .../admin/promotion_categories/edit.html.erb | 4 ++-- .../admin/promotion_categories/new.html.erb | 4 ++-- .../admin/promotion_codes/index.html.erb | 14 +++++++------- .../admin/promotion_codes/new.html.erb | 4 ++-- .../admin/promotion_rules/_promotion_rule.html.erb | 2 +- .../admin/promotion_rules/new.html.erb | 2 +- .../rules/_first_repeat_purchase_since.html.erb | 2 +- .../promotion_rules/rules/_nth_order.html.erb | 2 +- .../admin/promotion_rules/rules/_product.html.erb | 2 +- .../admin/promotion_rules/rules/_taxon.html.erb | 2 +- .../promotion_rules/rules/_user_role.html.erb | 2 +- .../admin/promotions/_activations_new.html.erb | 2 +- .../admin/promotions/edit.html.erb | 8 ++++---- .../admin/promotions/index.html.erb | 14 +++++++------- .../admin/promotions/new.html.erb | 2 +- 15 files changed, 33 insertions(+), 33 deletions(-) diff --git a/promotions/app/views/solidus_friendly_promotions/admin/promotion_categories/edit.html.erb b/promotions/app/views/solidus_friendly_promotions/admin/promotion_categories/edit.html.erb index f6b3136f..e5112ac9 100644 --- a/promotions/app/views/solidus_friendly_promotions/admin/promotion_categories/edit.html.erb +++ b/promotions/app/views/solidus_friendly_promotions/admin/promotion_categories/edit.html.erb @@ -1,5 +1,5 @@ -<% admin_breadcrumb(link_to plural_resource_name(Spree::Promotion), solidus_friendly_promotions.admin_promotions_path) %> -<% admin_breadcrumb(link_to plural_resource_name(Spree::PromotionCategory), solidus_friendly_promotions.admin_promotion_categories_path) %> +<% admin_breadcrumb(link_to plural_resource_name(SolidusFriendlyPromotions::Promotion), solidus_friendly_promotions.admin_promotions_path) %> +<% admin_breadcrumb(link_to plural_resource_name(SolidusFriendlyPromotions::PromotionCategory), solidus_friendly_promotions.admin_promotion_categories_path) %> <% admin_breadcrumb(@promotion_category.name) %> <%= form_for @promotion_category, url: object_url, method: :put do |f| %> diff --git a/promotions/app/views/solidus_friendly_promotions/admin/promotion_categories/new.html.erb b/promotions/app/views/solidus_friendly_promotions/admin/promotion_categories/new.html.erb index 7b557fc6..f0bdf88d 100644 --- a/promotions/app/views/solidus_friendly_promotions/admin/promotion_categories/new.html.erb +++ b/promotions/app/views/solidus_friendly_promotions/admin/promotion_categories/new.html.erb @@ -1,5 +1,5 @@ -<% admin_breadcrumb(link_to plural_resource_name(Spree::Promotion), solidus_friendly_promotions.admin_promotions_path) %> -<% admin_breadcrumb(link_to plural_resource_name(Spree::PromotionCategory), solidus_friendly_promotions.admin_promotion_categories_path) %> +<% admin_breadcrumb(link_to plural_resource_name(SolidusFriendlyPromotions::Promotion), solidus_friendly_promotions.admin_promotions_path) %> +<% admin_breadcrumb(link_to plural_resource_name(SolidusFriendlyPromotions::PromotionCategory), solidus_friendly_promotions.admin_promotion_categories_path) %> <% admin_breadcrumb(t('spree.new_promotion_category')) %> <%= form_for :promotion_category, url: collection_url do |f| %> diff --git a/promotions/app/views/solidus_friendly_promotions/admin/promotion_codes/index.html.erb b/promotions/app/views/solidus_friendly_promotions/admin/promotion_codes/index.html.erb index 75e00969..300ef013 100644 --- a/promotions/app/views/solidus_friendly_promotions/admin/promotion_codes/index.html.erb +++ b/promotions/app/views/solidus_friendly_promotions/admin/promotion_codes/index.html.erb @@ -1,14 +1,14 @@ -<% admin_breadcrumb link_to plural_resource_name(Spree::Promotion), spree.admin_promotions_path %> -<% admin_breadcrumb link_to(@promotion.name, spree.edit_admin_promotion_path(@promotion)) %> -<% admin_breadcrumb plural_resource_name(Spree::PromotionCode) %> +<% admin_breadcrumb link_to plural_resource_name(SolidusFriendlyPromotions::Promotion), solidus_friendly_promotions.admin_promotions_path %> +<% admin_breadcrumb link_to(@promotion.name, solidus_friendly_promotions.edit_admin_promotion_path(@promotion)) %> +<% admin_breadcrumb plural_resource_name(SolidusFriendlyPromotions::PromotionCode) %> <% content_for :page_actions do %>
  • - <% if can?(:create, Spree::PromotionCode) && !@promotion.apply_automatically? %> - <%= link_to t('spree.create_promotion_code'), new_admin_promotion_promotion_code_path(promotion_id: @promotion.id), class: 'btn btn-primary' %> + <% if can?(:create, SolidusFriendlyPromotions::PromotionCode) && !@promotion.apply_automatically? %> + <%= link_to t('spree.create_promotion_code'), solidus_friendly_promotions.new_admin_promotion_promotion_code_path(promotion_id: @promotion.id), class: 'btn btn-primary' %> <% end %> - <%= link_to t('spree.download_promotion_codes_list'), admin_promotion_promotion_codes_path(promotion_id: @promotion.id, format: :csv), class: 'btn btn-primary' %> + <%= link_to t('spree.download_promotion_codes_list'), solidus_friendly_promotions.admin_promotion_promotion_codes_path(promotion_id: @promotion.id, format: :csv), class: 'btn btn-primary' %>
  • <% end %> @@ -18,7 +18,7 @@ - + <% @promotion_codes.each do |promotion_code| %> diff --git a/promotions/app/views/solidus_friendly_promotions/admin/promotion_codes/new.html.erb b/promotions/app/views/solidus_friendly_promotions/admin/promotion_codes/new.html.erb index 894df09e..5b82b40d 100644 --- a/promotions/app/views/solidus_friendly_promotions/admin/promotion_codes/new.html.erb +++ b/promotions/app/views/solidus_friendly_promotions/admin/promotion_codes/new.html.erb @@ -1,6 +1,6 @@ -<% admin_breadcrumb link_to plural_resource_name(Spree::Promotion), solidus_friendly_promotions.admin_promotions_path %> +<% admin_breadcrumb link_to plural_resource_name(SolidusFriendlyPromotions::Promotion), solidus_friendly_promotions.admin_promotions_path %> <% admin_breadcrumb link_to(@promotion.name, solidus_friendly_promotions.edit_admin_promotion_path(@promotion)) %> -<% admin_breadcrumb plural_resource_name(Spree::PromotionCode) %> +<% admin_breadcrumb plural_resource_name(SolidusFriendlyPromotions::PromotionCode) %> <% content_for :page_actions do %>
  • diff --git a/promotions/app/views/solidus_friendly_promotions/admin/promotion_rules/_promotion_rule.html.erb b/promotions/app/views/solidus_friendly_promotions/admin/promotion_rules/_promotion_rule.html.erb index e1c55fce..493d6ddd 100644 --- a/promotions/app/views/solidus_friendly_promotions/admin/promotion_rules/_promotion_rule.html.erb +++ b/promotions/app/views/solidus_friendly_promotions/admin/promotion_rules/_promotion_rule.html.erb @@ -3,7 +3,7 @@ <%= form_with model: promotion_rule, scope: :promotion_rule, url: solidus_friendly_promotions.admin_promotion_promotion_rule_path(@promotion, promotion_rule), method: :patch do |form| %>
    <%= promotion_rule.class.model_name.human %>
    <% if can?(:destroy, promotion_rule) %> - <%= link_to_with_icon 'trash', '', spree.admin_promotion_promotion_rule_path(@promotion, promotion_rule), method: :delete, class: 'delete' %> + <%= link_to_with_icon 'trash', '', solidus_friendly_promotions.admin_promotion_promotion_rule_path(@promotion, promotion_rule), method: :delete, class: 'delete' %> <% end %>

    <%= promotion_rule.class.human_attribute_name(:description) %> diff --git a/promotions/app/views/solidus_friendly_promotions/admin/promotion_rules/new.html.erb b/promotions/app/views/solidus_friendly_promotions/admin/promotion_rules/new.html.erb index ad0174a5..f65d4ce7 100644 --- a/promotions/app/views/solidus_friendly_promotions/admin/promotion_rules/new.html.erb +++ b/promotions/app/views/solidus_friendly_promotions/admin/promotion_rules/new.html.erb @@ -1,7 +1,7 @@ <%= turbo_frame_tag @promotion, "new_#{@level}_promotion_rule" do %>

    <%= t(:add_rule, scope: :solidus_friendly_promotions) %>
    - <%= link_to_with_icon 'trash', '', spree.edit_admin_promotion_path(@promotion), class: 'delete' %> + <%= link_to_with_icon 'trash', '', solidus_friendly_promotions.edit_admin_promotion_path(@promotion), class: 'delete' %> <%= render 'type_select', level: @level %> <% flash.each do |severity, message| %> <%= content_tag(:div, "", data: { controller: :flash, severity: severity, message: message }) %> diff --git a/promotions/app/views/solidus_friendly_promotions/admin/promotion_rules/rules/_first_repeat_purchase_since.html.erb b/promotions/app/views/solidus_friendly_promotions/admin/promotion_rules/rules/_first_repeat_purchase_since.html.erb index 8e2e587a..c1de9b24 100644 --- a/promotions/app/views/solidus_friendly_promotions/admin/promotion_rules/rules/_first_repeat_purchase_since.html.erb +++ b/promotions/app/views/solidus_friendly_promotions/admin/promotion_rules/rules/_first_repeat_purchase_since.html.erb @@ -1,7 +1,7 @@
    - <%= Spree::Promotion::Rules::FirstRepeatPurchaseSince.human_attribute_name(:form_text) %> + <%= SolidusFriendlyPromotions::Rules::FirstRepeatPurchaseSince.human_attribute_name(:form_text) %>
    diff --git a/promotions/app/views/solidus_friendly_promotions/admin/promotion_rules/rules/_nth_order.html.erb b/promotions/app/views/solidus_friendly_promotions/admin/promotion_rules/rules/_nth_order.html.erb index 0a37ce60..6e2a0b20 100644 --- a/promotions/app/views/solidus_friendly_promotions/admin/promotion_rules/rules/_nth_order.html.erb +++ b/promotions/app/views/solidus_friendly_promotions/admin/promotion_rules/rules/_nth_order.html.erb @@ -1,7 +1,7 @@
    - <%= Spree::Promotion::Rules::NthOrder.human_attribute_name(:form_text) %> + <%= SolidusFriendlyPromotions::Rules::NthOrder.human_attribute_name(:form_text) %>
    diff --git a/promotions/app/views/solidus_friendly_promotions/admin/promotion_rules/rules/_product.html.erb b/promotions/app/views/solidus_friendly_promotions/admin/promotion_rules/rules/_product.html.erb index 2d11f098..1b1e3465 100644 --- a/promotions/app/views/solidus_friendly_promotions/admin/promotion_rules/rules/_product.html.erb +++ b/promotions/app/views/solidus_friendly_promotions/admin/promotion_rules/rules/_product.html.erb @@ -8,7 +8,7 @@
    diff --git a/promotions/app/views/solidus_friendly_promotions/admin/promotion_rules/rules/_taxon.html.erb b/promotions/app/views/solidus_friendly_promotions/admin/promotion_rules/rules/_taxon.html.erb index bec9eb7e..13a0e124 100644 --- a/promotions/app/views/solidus_friendly_promotions/admin/promotion_rules/rules/_taxon.html.erb +++ b/promotions/app/views/solidus_friendly_promotions/admin/promotion_rules/rules/_taxon.html.erb @@ -4,6 +4,6 @@
    diff --git a/promotions/app/views/solidus_friendly_promotions/admin/promotion_rules/rules/_user_role.html.erb b/promotions/app/views/solidus_friendly_promotions/admin/promotion_rules/rules/_user_role.html.erb index e078526d..5a136ba6 100644 --- a/promotions/app/views/solidus_friendly_promotions/admin/promotion_rules/rules/_user_role.html.erb +++ b/promotions/app/views/solidus_friendly_promotions/admin/promotion_rules/rules/_user_role.html.erb @@ -7,6 +7,6 @@
    diff --git a/promotions/app/views/solidus_friendly_promotions/admin/promotions/_activations_new.html.erb b/promotions/app/views/solidus_friendly_promotions/admin/promotions/_activations_new.html.erb index 47cf2da5..51646009 100644 --- a/promotions/app/views/solidus_friendly_promotions/admin/promotions/_activations_new.html.erb +++ b/promotions/app/views/solidus_friendly_promotions/admin/promotions/_activations_new.html.erb @@ -28,7 +28,7 @@
    - <%= label_tag :single_code, Spree::PromotionCode.model_name.human, class: "required" %> + <%= label_tag :single_code, SolidusFriendlyPromotions::PromotionCode.model_name.human, class: "required" %> <%= text_field_tag :single_code, @promotion.codes.first.try!(:value), class: "fullwidth", required: true %>
    diff --git a/promotions/app/views/solidus_friendly_promotions/admin/promotions/edit.html.erb b/promotions/app/views/solidus_friendly_promotions/admin/promotions/edit.html.erb index 34402a4f..57f3cc7a 100644 --- a/promotions/app/views/solidus_friendly_promotions/admin/promotions/edit.html.erb +++ b/promotions/app/views/solidus_friendly_promotions/admin/promotions/edit.html.erb @@ -1,6 +1,6 @@ <% admin_layout "full-width" %> -<% admin_breadcrumb(link_to plural_resource_name(Spree::Promotion), solidus_friendly_promotions.admin_promotions_path) %> +<% admin_breadcrumb(link_to plural_resource_name(SolidusFriendlyPromotions::Promotion), solidus_friendly_promotions.admin_promotions_path) %> <% admin_breadcrumb(@promotion.name) %> <%= content_for :head do %> @@ -9,14 +9,14 @@ <% content_for :page_actions do %>
  • - <% if can?(:show, Spree::PromotionCode) %> + <% if can?(:show, SolidusFriendlyPromotions::PromotionCode) %> <%= link_to t('solidus_friendly_promotions.view_promotion_codes_list'), solidus_friendly_promotions.admin_promotion_promotion_codes_path(promotion_id: @promotion.id), class: 'btn btn-primary' %> <%= link_to t('solidus_friendly_promotions.download_promotion_codes_list'), solidus_friendly_promotions.admin_promotion_promotion_codes_path(promotion_id: @promotion.id, format: :csv), class: 'btn btn-primary' %> <% end %> - <% if can?(:show, Spree::PromotionCodeBatch) %> - <%= link_to plural_resource_name(Spree::PromotionCodeBatch), solidus_friendly_promotions.admin_promotion_promotion_code_batches_path(promotion_id: @promotion.id), class: 'btn btn-primary' %> + <% if can?(:show, SolidusFriendlyPromotions::PromotionCodeBatch) %> + <%= link_to plural_resource_name(SolidusFriendlyPromotions::PromotionCodeBatch), solidus_friendly_promotions.admin_promotion_promotion_code_batches_path(promotion_id: @promotion.id), class: 'btn btn-primary' %> <% end %>
  • <% end %> diff --git a/promotions/app/views/solidus_friendly_promotions/admin/promotions/index.html.erb b/promotions/app/views/solidus_friendly_promotions/admin/promotions/index.html.erb index 0910ed70..a54f02f5 100644 --- a/promotions/app/views/solidus_friendly_promotions/admin/promotions/index.html.erb +++ b/promotions/app/views/solidus_friendly_promotions/admin/promotions/index.html.erb @@ -72,13 +72,13 @@
    <%= Spree::PromotionCode.human_attribute_name :value %><%= SolidusFriendlyPromotions::PromotionCode.human_attribute_name :value %>
    - - - - - - - + + + + + + + diff --git a/promotions/app/views/solidus_friendly_promotions/admin/promotions/new.html.erb b/promotions/app/views/solidus_friendly_promotions/admin/promotions/new.html.erb index d9302bd6..cac42ceb 100644 --- a/promotions/app/views/solidus_friendly_promotions/admin/promotions/new.html.erb +++ b/promotions/app/views/solidus_friendly_promotions/admin/promotions/new.html.erb @@ -1,6 +1,6 @@ <% admin_layout "full-width" %> -<% admin_breadcrumb(link_to plural_resource_name(Spree::Promotion), solidus_friendly_promotions.admin_promotions_path) %> +<% admin_breadcrumb(link_to plural_resource_name(SolidusFriendlyPromotions::Promotion), solidus_friendly_promotions.admin_promotions_path) %> <% admin_breadcrumb(t('solidus_friendly_promotions.new_promotion')) %> <%= form_for @promotion, url: collection_url do |f| %>
    <%= Spree::Promotion.human_attribute_name(:name) %><%= Spree::Promotion.human_attribute_name(:code) %><%= Spree::Promotion.human_attribute_name(:status) %><%= Spree::Promotion.human_attribute_name(:usage_limit) %><%= Spree::Promotion.human_attribute_name(:uses) %><%= Spree::Promotion.human_attribute_name(:starts_at) %><%= Spree::Promotion.human_attribute_name(:expires_at) %><%= SolidusFriendlyPromotions::Promotion.human_attribute_name(:name) %><%= SolidusFriendlyPromotions::Promotion.human_attribute_name(:code) %><%= SolidusFriendlyPromotions::Promotion.human_attribute_name(:status) %><%= SolidusFriendlyPromotions::Promotion.human_attribute_name(:usage_limit) %><%= SolidusFriendlyPromotions::Promotion.human_attribute_name(:uses) %><%= SolidusFriendlyPromotions::Promotion.human_attribute_name(:starts_at) %><%= SolidusFriendlyPromotions::Promotion.human_attribute_name(:expires_at) %>