diff --git a/backend/app/assets/javascripts/spree/backend.js b/backend/app/assets/javascripts/spree/backend.js index 6161952595..0433a3fbe2 100644 --- a/backend/app/assets/javascripts/spree/backend.js +++ b/backend/app/assets/javascripts/spree/backend.js @@ -13,6 +13,7 @@ //= require solidus_admin/bootstrap //= require prism //= require spree +//= require spree/backend/namespaces //= require spree/backend/translation //= require spree/backend/backbone-overrides //= require spree/backend/spree-select2 diff --git a/backend/app/assets/javascripts/spree/backend/collections/line_items.js b/backend/app/assets/javascripts/spree/backend/collections/line_items.js index d4b1bfbf3e..e5d6b055e2 100644 --- a/backend/app/assets/javascripts/spree/backend/collections/line_items.js +++ b/backend/app/assets/javascripts/spree/backend/collections/line_items.js @@ -1,7 +1,5 @@ //= require spree/backend/models/line_item -Spree.Collections = (Spree.Collections || {}) - Spree.Collections.LineItems = Backbone.Collection.extend({ model: Spree.Models.LineItem, diff --git a/backend/app/assets/javascripts/spree/backend/models/line_item.js b/backend/app/assets/javascripts/spree/backend/models/line_item.js index 8158fbab1b..4c9d379f8b 100644 --- a/backend/app/assets/javascripts/spree/backend/models/line_item.js +++ b/backend/app/assets/javascripts/spree/backend/models/line_item.js @@ -1,7 +1,5 @@ //= require spree/backend/routes -Spree.Models = (Spree.Models || {}) - Spree.Models.LineItem = Backbone.Model.extend({ initialize: function(options) { this.order = this.collection.parent; diff --git a/backend/app/assets/javascripts/spree/backend/models/order.js b/backend/app/assets/javascripts/spree/backend/models/order.js index 54dbe6b0bc..ce2fb833ef 100644 --- a/backend/app/assets/javascripts/spree/backend/models/order.js +++ b/backend/app/assets/javascripts/spree/backend/models/order.js @@ -1,8 +1,6 @@ //= require spree/backend/routes //= require spree/backend/collections/line_items -Spree.Models || (Spree.Models = {}); - Spree.Models.Order = Backbone.Model.extend({ urlRoot: Spree.routes.orders_api, idAttribute: "number", diff --git a/backend/app/assets/javascripts/spree/backend/namespaces.js b/backend/app/assets/javascripts/spree/backend/namespaces.js new file mode 100644 index 0000000000..5a04a999ae --- /dev/null +++ b/backend/app/assets/javascripts/spree/backend/namespaces.js @@ -0,0 +1,8 @@ +_.extend(window.Spree, { + Models: {}, + Collections: {}, + Views: { + Order: {}, + Cart: {} + } +}) diff --git a/backend/app/assets/javascripts/spree/backend/views/cart/add_line_item_button.js b/backend/app/assets/javascripts/spree/backend/views/cart/add_line_item_button.js index 0ec626abd5..2567128212 100644 --- a/backend/app/assets/javascripts/spree/backend/views/cart/add_line_item_button.js +++ b/backend/app/assets/javascripts/spree/backend/views/cart/add_line_item_button.js @@ -1,6 +1,3 @@ -Spree.Views = (Spree.Views || {}) -Spree.Views.Cart = (Spree.Views.Cart || {}) - Spree.Views.Cart.AddLineItemButton = Backbone.View.extend({ initialize: function() { this.listenTo(this.collection, 'update', this.render); diff --git a/backend/app/assets/javascripts/spree/backend/views/cart/line_item_row.js b/backend/app/assets/javascripts/spree/backend/views/cart/line_item_row.js index 6f22403e51..f0a1672c13 100644 --- a/backend/app/assets/javascripts/spree/backend/views/cart/line_item_row.js +++ b/backend/app/assets/javascripts/spree/backend/views/cart/line_item_row.js @@ -1,6 +1,3 @@ -Spree.Views = (Spree.Views || {}) -Spree.Views.Cart = (Spree.Views.Cart || {}) - Spree.Views.Cart.LineItemRow = Backbone.View.extend({ tagName: 'tr', className: 'line-item', diff --git a/backend/app/assets/javascripts/spree/backend/views/cart/line_item_table.js b/backend/app/assets/javascripts/spree/backend/views/cart/line_item_table.js index 5340510838..82a20b619c 100644 --- a/backend/app/assets/javascripts/spree/backend/views/cart/line_item_table.js +++ b/backend/app/assets/javascripts/spree/backend/views/cart/line_item_table.js @@ -1,6 +1,3 @@ -Spree.Views = (Spree.Views || {}) -Spree.Views.Cart = (Spree.Views.Cart || {}) - Spree.Views.Cart.LineItemTable = Backbone.View.extend({ initialize: function() { this.listenTo(this.collection, 'add', this.add); diff --git a/backend/app/assets/javascripts/spree/backend/views/order/details_adjustments.js b/backend/app/assets/javascripts/spree/backend/views/order/details_adjustments.js index e42c607105..af5534c5a6 100644 --- a/backend/app/assets/javascripts/spree/backend/views/order/details_adjustments.js +++ b/backend/app/assets/javascripts/spree/backend/views/order/details_adjustments.js @@ -1,6 +1,3 @@ -Spree.Views = (Spree.Views || {}) -Spree.Views.Order = (Spree.Views.Order || {}) - Spree.Views.Order.DetailsAdjustments = Backbone.View.extend({ initialize: function() { this.listenTo(this.model, "change", this.render); diff --git a/backend/app/assets/javascripts/spree/backend/views/order/details_total.js b/backend/app/assets/javascripts/spree/backend/views/order/details_total.js index 285af121ac..c3b61f7d86 100644 --- a/backend/app/assets/javascripts/spree/backend/views/order/details_total.js +++ b/backend/app/assets/javascripts/spree/backend/views/order/details_total.js @@ -1,6 +1,3 @@ -Spree.Views = (Spree.Views || {}) -Spree.Views.Order = (Spree.Views.Order || {}) - Spree.Views.Order.DetailsTotal = Backbone.View.extend({ initialize: function() { this.listenTo(this.model, "change", this.render); diff --git a/backend/app/assets/javascripts/spree/backend/views/order/summary.js b/backend/app/assets/javascripts/spree/backend/views/order/summary.js index 30202cc9f3..ffccb877bb 100644 --- a/backend/app/assets/javascripts/spree/backend/views/order/summary.js +++ b/backend/app/assets/javascripts/spree/backend/views/order/summary.js @@ -1,6 +1,3 @@ -Spree.Views || (Spree.Views = {}); -Spree.Views.Order || (Spree.Views.Order = {}); - Spree.Views.Order.Summary = Backbone.View.extend({ initialize: function () { this.listenTo(this.model, "change", this.render);