PageRenderTime 45ms CodeModel.GetById 20ms RepoModel.GetById 0ms app.codeStats 0ms

/src/Oro/Bundle/AddressBundle/Resources/public/js/region/collection.js

https://github.com/diimpp/platform
JavaScript | 32 lines | 15 code | 3 blank | 14 comment | 0 complexity | 307491b10ee3a91d0ee3c258a28913fc MD5 | raw file
  1. /*global define*/
  2. define(['backbone', 'routing', 'oroaddress/js/region/model'
  3. ], function (Backbone, routing, RegionModel) {
  4. 'use strict';
  5. /**
  6. * @export oroaddress/js/region/collection
  7. * @class oroaddress.region.Collection
  8. * @extends Backbone.Collection
  9. */
  10. return Backbone.Collection.extend({
  11. route: 'oro_api_country_get_regions',
  12. url: null,
  13. model: RegionModel,
  14. /**
  15. * Constructor
  16. */
  17. initialize: function () {
  18. this.url = routing.generate(this.route);
  19. },
  20. /**
  21. * Regenerate route for selected country
  22. *
  23. * @param id {string}
  24. */
  25. setCountryId: function (id) {
  26. this.url = routing.generate(this.route, {country: id});
  27. }
  28. });
  29. });