/src/Oro/Bundle/EmailBundle/Resources/public/js/email/template/collection.js

https://github.com/diimpp/platform · JavaScript · 32 lines · 15 code · 3 blank · 14 comment · 0 complexity · 9b84c2ef2fde07e850d15279a43fc5aa MD5 · raw file

  1. /*global define*/
  2. define(['backbone', 'routing', './model'
  3. ], function (Backbone, routing, EmailTemplateModel) {
  4. 'use strict';
  5. /**
  6. * @export oroemail/js/email/template/collection
  7. * @class oroemail.email.template.Collection
  8. * @extends Backbone.Collection
  9. */
  10. return Backbone.Collection.extend({
  11. route: 'oro_api_get_emailtemplate',
  12. url: null,
  13. model: EmailTemplateModel,
  14. /**
  15. * Constructor
  16. */
  17. initialize: function () {
  18. this.url = routing.generate(this.route, {entityName: null});
  19. },
  20. /**
  21. * Regenerate route for selected entity
  22. *
  23. * @param id {String}
  24. */
  25. setEntityId: function (id) {
  26. this.url = routing.generate(this.route, {entityName: id});
  27. }
  28. });
  29. });