Added examples to naming settings

This commit is contained in:
Mark McDowall
2013-08-11 17:42:11 -07:00
parent a5e8452840
commit fded4cf7f3
8 changed files with 146 additions and 4 deletions

View File

@@ -10,7 +10,9 @@ define(
ui: {
namingOptions : '.x-naming-options',
renameEpisodesCheckbox: '.x-rename-episodes'
renameEpisodesCheckbox: '.x-rename-episodes',
singleEpisodeExample : '.x-single-episode-example',
multiEpisodeExample : '.x-multi-episode-example'
},
events: {
@@ -21,6 +23,9 @@ define(
if(!this.model.get('renameEpisodes')){
this.ui.namingOptions.hide();
}
this.listenTo(this.model, 'change', this._buildExamples);
this._buildExamples();
},
_setNamingOptionsVisibility: function () {
@@ -32,6 +37,24 @@ define(
else {
this.ui.namingOptions.slideUp();
}
},
_buildExamples: function () {
var self = this;
var data = this.model.toJSON();
data.id = 0;
var promise = $.ajax({
type: 'POST',
url : window.ApiRoot + '/naming',
data: JSON.stringify(data)
});
promise.done(function (result) {
self.ui.singleEpisodeExample.html(result.singleEpisodeExample);
self.ui.multiEpisodeExample.html(result.multiEpisodeExample);
});
}
});