|
|
@ -2,11 +2,12 @@
|
|
|
|
define(
|
|
|
|
define(
|
|
|
|
[
|
|
|
|
[
|
|
|
|
'marionette',
|
|
|
|
'marionette',
|
|
|
|
|
|
|
|
'Settings/MediaManagement/Naming/NamingSampleModel',
|
|
|
|
'Mixins/AsModelBoundView'
|
|
|
|
'Mixins/AsModelBoundView'
|
|
|
|
], function (Marionette, AsModelBoundView) {
|
|
|
|
], function (Marionette, NamingSampleModel, AsModelBoundView) {
|
|
|
|
|
|
|
|
|
|
|
|
var view = Marionette.ItemView.extend({
|
|
|
|
var view = Marionette.ItemView.extend({
|
|
|
|
template: 'Settings/MediaManagement/Naming/ViewTemplate',
|
|
|
|
template: 'Settings/MediaManagement/Naming/NamingViewTemplate',
|
|
|
|
|
|
|
|
|
|
|
|
ui: {
|
|
|
|
ui: {
|
|
|
|
namingOptions : '.x-naming-options',
|
|
|
|
namingOptions : '.x-naming-options',
|
|
|
@ -24,8 +25,11 @@ define(
|
|
|
|
this.ui.namingOptions.hide();
|
|
|
|
this.ui.namingOptions.hide();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
this.listenTo(this.model, 'change', this._updateExamples);
|
|
|
|
this.namingSampleModel = new NamingSampleModel();
|
|
|
|
this._updateExamples();
|
|
|
|
|
|
|
|
|
|
|
|
this.listenTo(this.model, 'change', this._updateSamples);
|
|
|
|
|
|
|
|
this.listenTo(this.namingSampleModel, 'sync', this._showSamples);
|
|
|
|
|
|
|
|
this._updateSamples();
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
_setNamingOptionsVisibility: function () {
|
|
|
|
_setNamingOptionsVisibility: function () {
|
|
|
@ -39,20 +43,13 @@ define(
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
_updateExamples: function () {
|
|
|
|
_updateSamples: function () {
|
|
|
|
//TODO: make this use events/listeners
|
|
|
|
this.namingSampleModel.fetch({ data: this.model.toJSON() });
|
|
|
|
var self = this;
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
var promise = $.ajax({
|
|
|
|
|
|
|
|
type: 'GET',
|
|
|
|
|
|
|
|
url : window.NzbDrone.ApiRoot + '/config/naming/samples',
|
|
|
|
|
|
|
|
data: this.model.toJSON()
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
promise.done(function (result) {
|
|
|
|
_showSamples: function () {
|
|
|
|
self.ui.singleEpisodeExample.html(result.singleEpisodeExample);
|
|
|
|
this.ui.singleEpisodeExample.html(this.namingSampleModel.get('singleEpisodeExample'));
|
|
|
|
self.ui.multiEpisodeExample.html(result.multiEpisodeExample);
|
|
|
|
this.ui.multiEpisodeExample.html(this.namingSampleModel.get('multiEpisodeExample'));
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|