1 (function ($, Drupal, drupalSettings, Backbone) {
5 Drupal.webprofiler.views.Layout = Backbone.View.extend({
7 '<div id="overview" class="overview">' +
8 '<ul class="overview__list"></ul>' +
10 '<div id="details" class="details">' +
11 'Choose a collector.' +
17 * @returns {Drupal.webprofiler.views.Layout}
20 this.$el.html(this.template());
22 if(this.currentDetails) {
23 this.currentDetails.setElement(this.$('#details')).render();
26 this.overview.setElement(this.$('#overview ul')).render();
34 initialize: function (options) {
35 options.router.collectors.on('request', this.beginSync);
36 options.router.collectors.on('sync', this.finishSync);
38 this.overview = new Drupal.webprofiler.views.CollectorsList({
39 collection: options.router.collectors,
40 router: options.router
48 setDetails: function (collector) {
49 if (this.currentDetails) this.currentDetails.remove();
50 this.currentDetails = new Drupal.webprofiler.views.DetailsView({model: collector});
52 Drupal.attachBehaviors(/*this.$el, drupalSettings*/);
58 beginSync: function () {
59 $('.loader--fixed').fadeIn({duration: 100});
65 finishSync: function () {
66 $('.loader--fixed').fadeOut({duration: 100});
71 Drupal.webprofiler.views.Layout.getInstance = function (options) {
73 instance = new Drupal.webprofiler.views.Layout({
75 router: options.router,
76 collection: options.router.collectors
83 }(jQuery, Drupal, drupalSettings, Backbone));