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.
Lidarr/src/UI/ManualImport/Folder/SelectFolderView.js

50 lines
1.2 KiB

var Marionette = require('marionette');
require('../../Mixins/FileBrowser');
module.exports = Marionette.ItemView.extend({
template : 'ManualImport/Folder/SelectFolderViewTemplate',
ui : {
path : '.x-path',
buttons : '.x-button'
},
events: {
'click .x-manual-import' : '_manualImport',
'click .x-automatic-import' : '_automaticImport',
'change .x-path' : '_updateButtons',
'keyup .x-path' : '_updateButtons'
},
onRender : function() {
this.ui.path.fileBrowser();
this._updateButtons();
},
path : function() {
return this.ui.path.val();
},
_manualImport : function () {
if (this.ui.path.val()) {
this.trigger('manualImport', { folder: this.ui.path.val() });
}
},
_automaticImport : function () {
if (this.ui.path.val()) {
this.trigger('automaticImport', { folder: this.ui.path.val() });
}
},
_updateButtons : function () {
if (this.ui.path.val()) {
this.ui.buttons.removeAttr('disabled');
}
else {
this.ui.buttons.attr('disabled', 'disabled');
}
}
});