Sha256: 748eee10607e60d25cad4e605bdc695d926f7afc2b1778a959314c5a16b5be8c

Contents?: true

Size: 1.14 KB

Versions: 18

Compression:

Stored size: 1.14 KB

Contents

//= require spree/backend/routes
//= require spree/backend/collections/line_items
//= require spree/backend/collections/shipments
//= require spree/backend/models/address

Spree.Models.Order = Backbone.Model.extend({
  urlRoot: Spree.pathFor('api/orders'),
  idAttribute: "number",

  relations: {
    "line_items": Spree.Collections.LineItems,
    "shipments": Spree.Collections.Shipments,
    "bill_address": Spree.Models.Address,
    "ship_address": Spree.Models.Address
  },

  advance: function(opts) {
    var options = {
      url: Spree.pathFor('api/checkouts/' + this.id + '/advance'),
      type: 'PUT',
    };
    _.extend(options, opts);
    return this.fetch(options)
  },

  empty: function (opts) {
    var options = {
      url: Spree.pathFor('api/orders/' + this.id + '/empty'),
      type: 'PUT',
    };
    _.extend(options, opts);
    return this.fetch(options)
  }
});

Spree.Models.Order.fetch = function(number, opts) {
  var options = (opts || {});
  var model = new Spree.Models.Order({
    number: number,
    line_items: [],
    shipments: [],
    bill_address: {},
    ship_address: {},
  });
  model.fetch(options);
  return model;
}

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
solidus_backend-2.11.17 app/assets/javascripts/spree/backend/models/order.js
solidus_backend-2.11.16 app/assets/javascripts/spree/backend/models/order.js
solidus_backend-2.11.15 app/assets/javascripts/spree/backend/models/order.js
solidus_backend-2.11.14 app/assets/javascripts/spree/backend/models/order.js
solidus_backend-2.11.13 app/assets/javascripts/spree/backend/models/order.js
solidus_backend-2.11.12 app/assets/javascripts/spree/backend/models/order.js
solidus_backend-2.11.11 app/assets/javascripts/spree/backend/models/order.js
solidus_backend-2.11.10 app/assets/javascripts/spree/backend/models/order.js
solidus_backend-2.11.9 app/assets/javascripts/spree/backend/models/order.js
solidus_backend-2.11.8 app/assets/javascripts/spree/backend/models/order.js
solidus_backend-2.11.7 app/assets/javascripts/spree/backend/models/order.js
solidus_backend-2.11.6 app/assets/javascripts/spree/backend/models/order.js
solidus_backend-2.11.5 app/assets/javascripts/spree/backend/models/order.js
solidus_backend-2.11.4 app/assets/javascripts/spree/backend/models/order.js
solidus_backend-2.11.3 app/assets/javascripts/spree/backend/models/order.js
solidus_backend-2.11.2 app/assets/javascripts/spree/backend/models/order.js
solidus_backend-2.11.1 app/assets/javascripts/spree/backend/models/order.js
solidus_backend-2.11.0 app/assets/javascripts/spree/backend/models/order.js