New: Manual Import episodes

This commit is contained in:
Mark McDowall 2015-03-03 16:42:37 -08:00
parent 29ca1bc9da
commit 6dd22e7dcb
66 changed files with 1766 additions and 117 deletions

View file

@ -37,8 +37,9 @@ module.exports = Marionette.Layout.extend({
this.collection.showLastModified = options.showLastModified || false;
this.input = options.input;
this._setColumns();
this.listenTo(this.collection, "sync", this._showGrid);
this.listenTo(this.collection, "filebrowser:folderselected", this._rowSelected);
this.listenTo(this.collection, 'sync', this._showGrid);
this.listenTo(this.collection, 'filebrowser:row:folderselected', this._rowSelected);
this.listenTo(this.collection, 'filebrowser:row:fileselected', this._fileSelected);
},
onRender : function() {
@ -51,30 +52,30 @@ module.exports = Marionette.Layout.extend({
_setColumns : function() {
this.columns = [
{
name : "type",
label : "",
name : 'type',
label : '',
sortable : false,
cell : FileBrowserTypeCell
},
{
name : "name",
label : "Name",
name : 'name',
label : 'Name',
sortable : false,
cell : FileBrowserNameCell
}
];
if (this.collection.showLastModified) {
this.columns.push({
name : "lastModified",
label : "Last Modified",
name : 'lastModified',
label : 'Last Modified',
sortable : false,
cell : RelativeDateCell
});
}
if (this.collection.showFiles) {
this.columns.push({
name : "size",
label : "Size",
name : 'size',
label : 'Size',
sortable : false,
cell : FileSizeCell
});
@ -100,17 +101,33 @@ module.exports = Marionette.Layout.extend({
row : FileBrowserRow,
collection : this.collection,
columns : this.columns,
className : "table table-hover"
className : 'table table-hover'
});
this.browser.show(grid);
},
_rowSelected : function(model) {
var path = model.get("path");
var path = model.get('path');
this._updatePath(path);
this._fetchCollection(path);
},
_fileSelected : function(model) {
var path = model.get('path');
var type = model.get('type');
this.input.val(path);
this.input.trigger('change');
this.input.trigger('filebrowser:fileselected', {
type : type,
path : path
});
vent.trigger(vent.Commands.CloseFileBrowser);
},
_pathChanged : function(e, path) {
this._fetchCollection(path.value);
this._updatePath(path.value);
@ -118,7 +135,7 @@ module.exports = Marionette.Layout.extend({
_inputChanged : function() {
var path = this.ui.path.val();
if (path === "" || path.endsWith("\\") || path.endsWith("/")) {
if (path === '' || path.endsWith('\\') || path.endsWith('/')) {
this._fetchCollection(path);
}
},
@ -130,8 +147,16 @@ module.exports = Marionette.Layout.extend({
},
_selectPath : function() {
this.input.val(this.ui.path.val());
this.input.trigger("change");
var path = this.ui.path.val();
this.input.val(path);
this.input.trigger('change');
this.input.trigger('filebrowser:folderselected', {
type: 'folder',
path: path
});
vent.trigger(vent.Commands.CloseFileBrowser);
}
});
});