mirror of
https://github.com/lidarr/lidarr.git
synced 2025-07-14 17:13:49 -07:00
settings is fully moved to required.
This commit is contained in:
parent
73f3459264
commit
6f8c73771d
54 changed files with 533 additions and 439 deletions
37
UI/Mixins/AsModelBoundView.js
Normal file
37
UI/Mixins/AsModelBoundView.js
Normal file
|
@ -0,0 +1,37 @@
|
|||
'use strict';
|
||||
|
||||
define(
|
||||
['backbone.modelbinder'],
|
||||
function (ModelBinder) {
|
||||
|
||||
return function () {
|
||||
|
||||
var originalOnRender = this.prototype.onRender,
|
||||
originalBeforeClose = this.prototype.onBeforeClose;
|
||||
|
||||
this.prototype.onRender = function () {
|
||||
if (this.model) {
|
||||
this._modelBinder = new ModelBinder();
|
||||
this._modelBinder.bind(this.model, this.el);
|
||||
}
|
||||
if (originalOnRender) {
|
||||
originalOnRender.call(this);
|
||||
}
|
||||
};
|
||||
|
||||
this.prototype.beforeClose = function () {
|
||||
|
||||
if (this._modelBinder) {
|
||||
this._modelBinder.unbind();
|
||||
delete this._modelBinder;
|
||||
}
|
||||
|
||||
if (originalBeforeClose) {
|
||||
originalBeforeClose.call(this);
|
||||
}
|
||||
};
|
||||
|
||||
return this;
|
||||
};
|
||||
}
|
||||
);
|
Loading…
Add table
Add a link
Reference in a new issue