/modules/devel/webprofiler/js/app/collections/collectors.js
JavaScript | 35 lines | 18 code | 8 blank | 9 comment | 0 complexity | d99bb54d99c2921c7ee2728e079ad0d9 MD5 | raw file
- (function ($, Drupal, drupalSettings, Backbone) {
- "use strict";
- Drupal.webprofiler.collectors.Collectors = Backbone.Collection.extend({
- model: Drupal.webprofiler.models.Collector,
- url: Drupal.url('admin/reports/profiler/view/' + drupalSettings.webprofiler.token + '/collectors'),
- /**
- * Unselect all models.
- */
- resetSelected: function () {
- this.each(function (model) {
- model.set({"selected": false});
- });
- },
- /**
- * Select a specific model from the collection.
- *
- * @param id
- * @returns {*}
- */
- selectByID: function (id) {
- this.resetSelected();
- var collector = this.get(id);
- collector.set({"selected": true});
- return collector.id;
- }
- });
- }(jQuery, Drupal, drupalSettings, Backbone));