Sonarr/UI/Settings/MediaManagement/Naming/View.js

40 lines
1.1 KiB
JavaScript
Raw Normal View History

2013-07-14 07:00:50 +00:00
'use strict';
2013-07-05 03:26:07 +00:00
define(
[
'marionette',
'Mixins/AsModelBoundView'
], function (Marionette, AsModelBoundView) {
var view = Marionette.ItemView.extend({
template: 'Settings/MediaManagement/Naming/ViewTemplate',
ui: {
2013-07-14 07:00:50 +00:00
namingOptions : '.x-naming-options',
renameEpisodesCheckbox: '.x-rename-episodes'
2013-07-05 03:26:07 +00:00
},
events: {
2013-07-14 07:00:50 +00:00
'change .x-rename-episodes': '_setNamingOptionsVisibility'
2013-07-05 03:26:07 +00:00
},
2013-07-14 07:00:50 +00:00
onRender: function(){
if(!this.model.get('renameEpisodes')){
this.ui.namingOptions.hide();
}
2013-07-05 03:26:07 +00:00
},
2013-07-14 07:00:50 +00:00
_setNamingOptionsVisibility: function () {
2013-07-05 03:26:07 +00:00
var checked = this.ui.renameEpisodesCheckbox.prop('checked');
2013-07-14 07:00:50 +00:00
if (checked) {
this.ui.namingOptions.slideDown();
2013-07-05 03:26:07 +00:00
}
else {
2013-07-14 07:00:50 +00:00
this.ui.namingOptions.slideUp();
2013-07-05 03:26:07 +00:00
}
}
});
return AsModelBoundView.call(view);
});