mirror of
https://github.com/Sonarr/Sonarr.git
synced 2025-01-17 10:45:49 +02:00
model should automatically be bound to view.
This commit is contained in:
parent
68eada4c4d
commit
30595e85a3
@ -11,10 +11,6 @@ define(['app', 'AddSeries/RootFolders/RootFolderCollection', 'Mixins/AutoComplet
|
||||
'click .x-remove': 'removeFolder'
|
||||
},
|
||||
|
||||
onRender: function () {
|
||||
NzbDrone.ModelBinder.bind(this.model, this.el);
|
||||
},
|
||||
|
||||
removeFolder: function () {
|
||||
this.model.destroy({ wait: true });
|
||||
this.model.collection.remove(this.model);
|
||||
|
@ -8,9 +8,5 @@ define([
|
||||
NzbDrone.Calendar.CalendarItemView = Backbone.Marionette.ItemView.extend({
|
||||
template : 'Calendar/CalendarItemTemplate',
|
||||
tagName : 'div',
|
||||
|
||||
onRender: function () {
|
||||
NzbDrone.ModelBinder.bind(this.model, this.el);
|
||||
}
|
||||
});
|
||||
});
|
@ -112,6 +112,7 @@
|
||||
<script src="/Mixins/backbone.ajax.js"></script>
|
||||
<script src="/Mixins/tablesorter.extensions.js"></script>
|
||||
<script src="/Mixins/spoon.js"></script>
|
||||
<script src="/Mixins/backbone.modelbinder.mixin.js"></script>
|
||||
|
||||
<script data-main="/app" src="/JsLibraries/require.js"></script>
|
||||
<script src="/Routing.js"></script>
|
||||
|
@ -8,9 +8,5 @@ define([
|
||||
NzbDrone.Missing.MissingItemView = Backbone.Marionette.ItemView.extend({
|
||||
template: 'Missing/MissingItemTemplate',
|
||||
tagName : 'tr',
|
||||
|
||||
onRender: function () {
|
||||
NzbDrone.ModelBinder.bind(this.model, this.el);
|
||||
}
|
||||
});
|
||||
});
|
@ -1,4 +1,6 @@
|
||||
define(['app'], function () {
|
||||
"use strict";
|
||||
|
||||
define(['app'], function () {
|
||||
|
||||
$.fn.autoComplete = function (resource) {
|
||||
$(this).typeahead({
|
||||
|
@ -1,4 +1,5 @@
|
||||
//try to add ajax data as query string to DELETE calls.
|
||||
"use strict";
|
||||
(function () {
|
||||
|
||||
var original = Backbone.ajax;
|
||||
|
26
UI/Mixins/backbone.modelbinder.mixin.js
Normal file
26
UI/Mixins/backbone.modelbinder.mixin.js
Normal file
@ -0,0 +1,26 @@
|
||||
'use strict';
|
||||
|
||||
var oldItemViewRender = Marionette.ItemView.prototype.render;
|
||||
var oldItemCollectionViewRender = Marionette.CollectionView.prototype.render;
|
||||
|
||||
Marionette.ItemView.prototype.render = function () {
|
||||
|
||||
if (this.model) {
|
||||
NzbDrone.ModelBinder.bind(this.model, this.el);
|
||||
}
|
||||
|
||||
console.log("render");
|
||||
|
||||
return oldItemViewRender.apply(this, arguments);
|
||||
};
|
||||
|
||||
Marionette.CollectionView.prototype.render = function () {
|
||||
|
||||
if (this.model) {
|
||||
NzbDrone.ModelBinder.bind(this.model, this.el);
|
||||
}
|
||||
|
||||
console.log("render");
|
||||
|
||||
return oldItemCollectionViewRender.apply(this, arguments);
|
||||
};
|
@ -15,10 +15,6 @@ define(['app', 'Series/SeriesModel'], function () {
|
||||
deleteFiles: '.x-delete-files'
|
||||
},
|
||||
|
||||
onRender: function () {
|
||||
NzbDrone.ModelBinder.bind(this.model, this.el);
|
||||
},
|
||||
|
||||
removeSeries: function () {
|
||||
|
||||
var deleteFiles = this.ui.deleteFiles.prop('checked');
|
||||
|
@ -12,8 +12,5 @@ define(['app', 'Series/SeasonModel'], function () {
|
||||
events : {
|
||||
|
||||
},
|
||||
onRender: function () {
|
||||
NzbDrone.ModelBinder.bind(this.model, this.el);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
@ -19,7 +19,6 @@ define(['app', 'Series/SeriesModel', 'Series/Delete/DeleteSeriesView', 'Quality/
|
||||
},
|
||||
|
||||
onRender: function () {
|
||||
NzbDrone.ModelBinder.bind(this.model, this.el);
|
||||
this.ui.switch.bootstrapSwitch();
|
||||
},
|
||||
|
||||
|
@ -37,10 +37,6 @@ define([
|
||||
this.viewStyle = options.viewStyle;
|
||||
},
|
||||
|
||||
onRender: function () {
|
||||
NzbDrone.ModelBinder.bind(this.model, this.el);
|
||||
},
|
||||
|
||||
editSeries: function () {
|
||||
var view = new NzbDrone.Series.Edit.EditSeriesView({ model: this.model});
|
||||
|
||||
|
@ -25,8 +25,6 @@ define([
|
||||
},
|
||||
|
||||
onRender: function () {
|
||||
NzbDrone.ModelBinder.bind(this.model, this.el);
|
||||
|
||||
this.ui.switch.bootstrapSwitch();
|
||||
this.ui.tooltip.tooltip({ placement: 'right', html: true });
|
||||
this.ui.pathInput.autoComplete('/directories');
|
||||
|
@ -7,9 +7,5 @@ define([
|
||||
|
||||
NzbDrone.Settings.Indexers.IndexersView = Backbone.Marionette.ItemView.extend({
|
||||
template: 'Settings/Indexers/IndexersTemplate',
|
||||
|
||||
onRender: function () {
|
||||
NzbDrone.ModelBinder.bind(this.model, this.el);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
@ -15,7 +15,6 @@ define([
|
||||
},
|
||||
|
||||
onRender: function () {
|
||||
NzbDrone.ModelBinder.bind(this.model, this.el);
|
||||
this.ui.switch.bootstrapSwitch();
|
||||
this.ui.tooltip.tooltip({ placement: 'right', html: true });
|
||||
}
|
||||
|
@ -19,7 +19,6 @@ define([
|
||||
},
|
||||
|
||||
onRender: function () {
|
||||
NzbDrone.ModelBinder.bind(this.model, this.el);
|
||||
this.ui.switch.bootstrapSwitch();
|
||||
this.ui.tooltip.tooltip({ placement: 'right' });
|
||||
}
|
||||
|
@ -7,9 +7,5 @@ define([
|
||||
|
||||
NzbDrone.Settings.Notifications.NotificationsView = Backbone.Marionette.ItemView.extend({
|
||||
template: 'Settings/Notifications/NotificationsTemplate',
|
||||
|
||||
onRender: function () {
|
||||
NzbDrone.ModelBinder.bind(this.model, this.el);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
@ -15,7 +15,6 @@ define(['app', 'Quality/QualityProfileModel'], function () {
|
||||
},
|
||||
|
||||
onRender: function () {
|
||||
NzbDrone.ModelBinder.bind(this.model, this.el);
|
||||
this.ui.switch.bootstrapSwitch();
|
||||
},
|
||||
|
||||
|
@ -20,13 +20,6 @@ define([
|
||||
'click .x-remove': 'removeSeries'
|
||||
},
|
||||
|
||||
initialize: function () {
|
||||
},
|
||||
|
||||
onRender: function () {
|
||||
NzbDrone.ModelBinder.bind(this.model, this.el);
|
||||
},
|
||||
|
||||
editSeries: function () {
|
||||
var view = new NzbDrone.Settings.Quality.Profile.EditQualityProfileView({ model: this.model});
|
||||
|
||||
|
@ -13,9 +13,5 @@ define([
|
||||
this.qualityProfileCollection = options.qualityProfiles;
|
||||
this.model.set({ qualityProfiles: this.qualityProfileCollection });
|
||||
},
|
||||
|
||||
onRender: function () {
|
||||
NzbDrone.ModelBinder.bind(this.model, this.el);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
@ -25,8 +25,6 @@ define([
|
||||
},
|
||||
|
||||
onRender: function () {
|
||||
NzbDrone.ModelBinder.bind(this.model, this.el);
|
||||
|
||||
var self = this;
|
||||
this.ui.slider.slider({
|
||||
min : 0,
|
||||
|
@ -7,9 +7,5 @@ define([
|
||||
|
||||
NzbDrone.Settings.System.SystemView = Backbone.Marionette.ItemView.extend({
|
||||
template: 'Settings/System/SystemTemplate',
|
||||
|
||||
onRender: function () {
|
||||
NzbDrone.ModelBinder.bind(this.model, this.el);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
@ -8,9 +8,5 @@ define([
|
||||
NzbDrone.Upcoming.UpcomingItemView = Backbone.Marionette.ItemView.extend({
|
||||
template: 'Upcoming/UpcomingItemTemplate',
|
||||
tagName : 'tr',
|
||||
|
||||
onRender: function () {
|
||||
NzbDrone.ModelBinder.bind(this.model, this.el);
|
||||
}
|
||||
})
|
||||
})
|
||||
});
|
||||
});
|
Loading…
Reference in New Issue
Block a user