|
|
@ -1,11 +1,12 @@
|
|
|
|
'use strict';
|
|
|
|
'use strict';
|
|
|
|
define(
|
|
|
|
define(
|
|
|
|
[
|
|
|
|
[
|
|
|
|
|
|
|
|
'jquery',
|
|
|
|
'vent',
|
|
|
|
'vent',
|
|
|
|
'marionette',
|
|
|
|
'marionette',
|
|
|
|
'Settings/MediaManagement/Naming/NamingSampleModel',
|
|
|
|
'Settings/MediaManagement/Naming/NamingSampleModel',
|
|
|
|
'Mixins/AsModelBoundView'
|
|
|
|
'Mixins/AsModelBoundView'
|
|
|
|
], function (vent, Marionette, NamingSampleModel, AsModelBoundView) {
|
|
|
|
], function ($, vent, Marionette, NamingSampleModel, AsModelBoundView) {
|
|
|
|
|
|
|
|
|
|
|
|
var view = Marionette.ItemView.extend({
|
|
|
|
var view = Marionette.ItemView.extend({
|
|
|
|
template: 'Settings/MediaManagement/Naming/NamingViewTemplate',
|
|
|
|
template: 'Settings/MediaManagement/Naming/NamingViewTemplate',
|
|
|
@ -15,12 +16,14 @@ define(
|
|
|
|
renameEpisodesCheckbox: '.x-rename-episodes',
|
|
|
|
renameEpisodesCheckbox: '.x-rename-episodes',
|
|
|
|
singleEpisodeExample : '.x-single-episode-example',
|
|
|
|
singleEpisodeExample : '.x-single-episode-example',
|
|
|
|
multiEpisodeExample : '.x-multi-episode-example',
|
|
|
|
multiEpisodeExample : '.x-multi-episode-example',
|
|
|
|
dailyEpisodeExample : '.x-daily-episode-example'
|
|
|
|
dailyEpisodeExample : '.x-daily-episode-example',
|
|
|
|
|
|
|
|
namingTokenHelper : '.x-naming-token-helper'
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
events: {
|
|
|
|
events: {
|
|
|
|
'change .x-rename-episodes': '_setFailedDownloadOptionsVisibility',
|
|
|
|
'change .x-rename-episodes' : '_setFailedDownloadOptionsVisibility',
|
|
|
|
'click .x-show-wizard' : '_showWizard'
|
|
|
|
'click .x-show-wizard' : '_showWizard',
|
|
|
|
|
|
|
|
'click .x-naming-token-helper a' : '_addToken'
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
onRender: function () {
|
|
|
|
onRender: function () {
|
|
|
@ -58,6 +61,28 @@ define(
|
|
|
|
|
|
|
|
|
|
|
|
_showWizard: function () {
|
|
|
|
_showWizard: function () {
|
|
|
|
vent.trigger(vent.Commands.ShowNamingWizard, { model: this.model });
|
|
|
|
vent.trigger(vent.Commands.ShowNamingWizard, { model: this.model });
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_addToken: function (e) {
|
|
|
|
|
|
|
|
e.preventDefault();
|
|
|
|
|
|
|
|
e.stopPropagation();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var target = e.target;
|
|
|
|
|
|
|
|
var token = '';
|
|
|
|
|
|
|
|
var input = $(target).closest('.x-helper-input').children('input');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ($(target).attr('data-token')) {
|
|
|
|
|
|
|
|
token = '{{0}}'.format($(target).attr('data-token'));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
else {
|
|
|
|
|
|
|
|
token = $(target).attr('data-separator');
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
input.val(input.val() + token);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.ui.namingTokenHelper.removeClass('open');
|
|
|
|
|
|
|
|
input.focus();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|