1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2024-12-21 01:49:57 +02:00
Sonarr/UI/Settings/MediaManagement/Naming/View.js

40 lines
1.1 KiB
JavaScript
Raw Normal View History

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