Skip to content

Commit

Permalink
Move promotion JS from backend to legacy_promotions
Browse files Browse the repository at this point in the history
This moves those templates, views, and JS files that are necessary for
the promotion admin to function to the legacy_promotions gem.
  • Loading branch information
mamhoff committed Mar 15, 2024
1 parent b1363b0 commit 3ee3434
Show file tree
Hide file tree
Showing 16 changed files with 17 additions and 8 deletions.
2 changes: 0 additions & 2 deletions backend/app/assets/javascripts/spree/backend.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,6 @@
//= require spree/backend/products/index
//= require spree/backend/product_picker
//= require spree/backend/progress
//= require spree/backend/promotions
//= require spree/backend/promotions/activation
//= require spree/backend/shipments
//= require spree/backend/spree-select2
//= require spree/backend/stock_management
Expand Down
1 change: 0 additions & 1 deletion backend/app/assets/javascripts/spree/backend/namespaces.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ _.extend(window.Spree, {
Zones: {},
Payment: {},
Product: {},
Promotions: {},
Stock: {},
Tables: {}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@
//= require spree/backend/templates/orders/shipping_method
//= require spree/backend/templates/products/sortable
//= require spree/backend/templates/products/upload_progress
//= require spree/backend/templates/promotions/calculators/fields/tiered_flat_rate
//= require spree/backend/templates/promotions/calculators/fields/tiered_percent
//= require spree/backend/templates/promotions/rules/option_values
//= require spree/backend/templates/stock_items/stock_location_stock_item
//= require spree/backend/templates/taxons/_tree
//= require spree/backend/templates/taxons/tree
Expand Down
2 changes: 0 additions & 2 deletions backend/app/assets/javascripts/spree/backend/views/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
//= require 'spree/backend/views/calculators/tiered'
//= require 'spree/backend/views/cart/add_line_item_button'
//= require 'spree/backend/views/cart/empty_cart_button'
//= require 'spree/backend/views/cart/line_item_row'
Expand All @@ -22,7 +21,6 @@
//= require 'spree/backend/views/payment/payment_row'
//= require 'spree/backend/views/payment/edit_credit_card'
//= require 'spree/backend/views/product/search'
//= require 'spree/backend/views/promotions/option_values_rule'
//= require 'spree/backend/views/tables/editable_table'
//= require 'spree/backend/views/tables/editable_table_row'
//= require 'spree/backend/views/tables/return_items'
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
//= link solidus_legacy_promotions/promotions.css
//= link spree/backend/edit_promotion.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
//= require_tree ./templates
//= require spree/backend/views/promotions.js
//= require spree/backend/views/number_with_currency.js
//= require spree/backend/views/promotions/option_values_rule
//= require spree/backend/views/calculators/tiered
//= require spree/backend/promotions
//= require spree/backend/promotions/activation
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
//= require spree/backend/namespaces.js

window.Spree.Views.Promotions = {}
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

<% content_for :head do %>
<%= stylesheet_link_tag 'solidus_legacy_promotions/promotions' %>
<%= javascript_include_tag 'spree/backend/edit_promotion' %>
<% end %>

<%= form_for @promotion, url: object_url, method: :put do |f| %>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
<% admin_breadcrumb(link_to plural_resource_name(Spree::Promotion), spree.admin_promotions_path) %>
<% admin_breadcrumb(t('spree.new_promotion')) %>

<% content_for :head do %>
<%= stylesheet_link_tag 'solidus_legacy_promotions/promotions' %>
<%= javascript_include_tag 'spree/backend/edit_promotion' %>
<% end %>

<%= form_for @promotion, url: collection_url do |f| %>
<%= render partial: 'form', locals: { f: f } %>
<%= render partial: 'spree/admin/shared/new_resource_links' %>
Expand Down

0 comments on commit 3ee3434

Please sign in to comment.