You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
1.2 KiB
39 lines
1.2 KiB
var vent = require('vent');
|
|
var Marionette = require('marionette');
|
|
var AsModelBoundView = require('../Mixins/AsModelBoundView');
|
|
|
|
var view = Marionette.ItemView.extend({
|
|
template : 'Rename/RenamePreviewItemViewTemplate',
|
|
|
|
ui : {
|
|
itemDiv : '.rename-preview-item',
|
|
checkboxIcon : '.rename-checkbox i'
|
|
},
|
|
|
|
onRender : function() {
|
|
this._setItemState();
|
|
this.listenTo(this.model, 'change', this._setItemState);
|
|
this.listenTo(this.model, 'rename:select', this._onRenameAll);
|
|
},
|
|
|
|
_setItemState : function() {
|
|
var checked = this.model.get('rename');
|
|
this.model.trigger('rename:select', this.model, checked);
|
|
|
|
if (checked) {
|
|
this.ui.itemDiv.removeClass('do-not-rename');
|
|
this.ui.checkboxIcon.addClass('icon-lidarr-checked');
|
|
this.ui.checkboxIcon.removeClass('icon-lidarr-unchecked');
|
|
} else {
|
|
this.ui.itemDiv.addClass('do-not-rename');
|
|
this.ui.checkboxIcon.addClass('icon-lidarr-unchecked');
|
|
this.ui.checkboxIcon.removeClass('icon-lidarr-checked');
|
|
}
|
|
},
|
|
|
|
_onRenameAll : function(model, checked) {
|
|
this.model.set('rename', checked);
|
|
}
|
|
});
|
|
|
|
module.exports = AsModelBoundView.apply(view); |