PageRenderTime 43ms CodeModel.GetById 15ms RepoModel.GetById 0ms app.codeStats 0ms

/modules/devel/webprofiler/js/app/collections/collectors.js

https://gitlab.com/geeta7/drupal
JavaScript | 35 lines | 18 code | 8 blank | 9 comment | 0 complexity | d99bb54d99c2921c7ee2728e079ad0d9 MD5 | raw file
  1. (function ($, Drupal, drupalSettings, Backbone) {
  2. "use strict";
  3. Drupal.webprofiler.collectors.Collectors = Backbone.Collection.extend({
  4. model: Drupal.webprofiler.models.Collector,
  5. url: Drupal.url('admin/reports/profiler/view/' + drupalSettings.webprofiler.token + '/collectors'),
  6. /**
  7. * Unselect all models.
  8. */
  9. resetSelected: function () {
  10. this.each(function (model) {
  11. model.set({"selected": false});
  12. });
  13. },
  14. /**
  15. * Select a specific model from the collection.
  16. *
  17. * @param id
  18. * @returns {*}
  19. */
  20. selectByID: function (id) {
  21. this.resetSelected();
  22. var collector = this.get(id);
  23. collector.set({"selected": true});
  24. return collector.id;
  25. }
  26. });
  27. }(jQuery, Drupal, drupalSettings, Backbone));