mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-29 08:44:10 +02:00
Apply behaviors correctly on startup
This commit is contained in:
parent
d99d50b3c4
commit
5d2e849491
@ -97,7 +97,7 @@
|
|||||||
this.history = new Icinga.History(this);
|
this.history = new Icinga.History(this);
|
||||||
var self = this;
|
var self = this;
|
||||||
$.each(Icinga.Behaviors, function(name, Behavior) {
|
$.each(Icinga.Behaviors, function(name, Behavior) {
|
||||||
self.behaviors[name.toLowerCase()] = new Behavior();
|
self.behaviors[name.toLowerCase()] = new Behavior(self);
|
||||||
});
|
});
|
||||||
|
|
||||||
this.timezone.initialize();
|
this.timezone.initialize();
|
||||||
|
@ -32,26 +32,17 @@
|
|||||||
initialize: function () {
|
initialize: function () {
|
||||||
this.applyGlobalDefaults();
|
this.applyGlobalDefaults();
|
||||||
this.applyHandlers($('#layout'));
|
this.applyHandlers($('#layout'));
|
||||||
var self = this;
|
|
||||||
|
|
||||||
// define global site behavior
|
|
||||||
$.each(self.icinga.behaviors, function (name, behavior) {
|
|
||||||
behavior.bind();
|
|
||||||
});
|
|
||||||
|
|
||||||
// prepare container html
|
|
||||||
$('.container').each(function(idx, el) {
|
$('.container').each(function(idx, el) {
|
||||||
// apply event handlers
|
|
||||||
icinga.events.applyHandlers($(el));
|
icinga.events.applyHandlers($(el));
|
||||||
icinga.ui.initializeControls($(el));
|
icinga.ui.initializeControls($(el));
|
||||||
$.each(self.icinga.behaviors, function (name, behavior) {
|
|
||||||
behavior.apply(el);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
// TODO: What's this?
|
// TODO: What's this?
|
||||||
applyHandlers: function (el) {
|
applyHandlers: function (el) {
|
||||||
|
$.each(this.icinga.behaviors, function (name, behavior) {
|
||||||
|
behavior.apply(el);
|
||||||
|
});
|
||||||
|
|
||||||
var icinga = this.icinga;
|
var icinga = this.icinga;
|
||||||
|
|
||||||
@ -152,6 +143,10 @@
|
|||||||
* Global default event handlers
|
* Global default event handlers
|
||||||
*/
|
*/
|
||||||
applyGlobalDefaults: function () {
|
applyGlobalDefaults: function () {
|
||||||
|
$.each(self.icinga.behaviors, function (name, behavior) {
|
||||||
|
behavior.bind();
|
||||||
|
});
|
||||||
|
|
||||||
// We catch resize events
|
// We catch resize events
|
||||||
$(window).on('resize', { self: this.icinga.ui }, this.icinga.ui.onWindowResize);
|
$(window).on('resize', { self: this.icinga.ui }, this.icinga.ui.onWindowResize);
|
||||||
|
|
||||||
@ -673,6 +668,9 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
unbindGlobalHandlers: function () {
|
unbindGlobalHandlers: function () {
|
||||||
|
$.each(self.icinga.behaviors, function (name, behavior) {
|
||||||
|
behavior.unbind();
|
||||||
|
});
|
||||||
$(window).off('resize', this.onWindowResize);
|
$(window).off('resize', this.onWindowResize);
|
||||||
$(window).off('load', this.onLoad);
|
$(window).off('load', this.onLoad);
|
||||||
$(window).off('unload', this.onUnload);
|
$(window).off('unload', this.onUnload);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user