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
+41 -16
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);
}
});
});
+2 -2
View File
@@ -16,9 +16,9 @@ module.exports = Backgrid.Row.extend({
_selectRow : function() {
if (this.model.get('type') === 'file') {
this.model.collection.trigger('filebrowser:fileselected', this.model);
this.model.collection.trigger('filebrowser:row:fileselected', this.model);
} else {
this.model.collection.trigger('filebrowser:folderselected', this.model);
this.model.collection.trigger('filebrowser:row:folderselected', this.model);
}
}
});
+22 -5
View File
@@ -7,18 +7,22 @@ var EpisodeDetailsLayout = require('../../Episode/EpisodeDetailsLayout');
var HistoryDetailsLayout = require('../../Activity/History/Details/HistoryDetailsLayout');
var LogDetailsView = require('../../System/Logs/Table/Details/LogDetailsView');
var RenamePreviewLayout = require('../../Rename/RenamePreviewLayout');
var ManualImportLayout = require('../../ManualImport/ManualImportLayout');
var FileBrowserLayout = require('../FileBrowser/FileBrowserLayout');
module.exports = Marionette.AppRouter.extend({
initialize : function() {
vent.on(vent.Commands.OpenModalCommand, this._openModal, this);
vent.on(vent.Commands.CloseModalCommand, this._closeModal, this);
vent.on(vent.Commands.OpenModal2Command, this._openModal2, this);
vent.on(vent.Commands.CloseModal2Command, this._closeModal2, this);
vent.on(vent.Commands.EditSeriesCommand, this._editSeries, this);
vent.on(vent.Commands.DeleteSeriesCommand, this._deleteSeries, this);
vent.on(vent.Commands.ShowEpisodeDetails, this._showEpisode, this);
vent.on(vent.Commands.ShowHistoryDetails, this._showHistory, this);
vent.on(vent.Commands.ShowLogDetails, this._showLogDetails, this);
vent.on(vent.Commands.ShowRenamePreview, this._showRenamePreview, this);
vent.on(vent.Commands.ShowManualImport, this._showManualImport, this);
vent.on(vent.Commands.ShowFileBrowser, this._showFileBrowser, this);
vent.on(vent.Commands.CloseFileBrowser, this._closeFileBrowser, this);
},
@@ -31,6 +35,14 @@ module.exports = Marionette.AppRouter.extend({
AppLayout.modalRegion.closeModal();
},
_openModal2 : function(view) {
AppLayout.modalRegion2.show(view);
},
_closeModal2 : function() {
AppLayout.modalRegion2.closeModal();
},
_editSeries : function(options) {
var view = new EditSeriesView({ model : options.series });
AppLayout.modalRegion.show(view);
@@ -65,12 +77,17 @@ module.exports = Marionette.AppRouter.extend({
AppLayout.modalRegion.show(view);
},
_showFileBrowser : function(options) {
var view = new FileBrowserLayout(options);
AppLayout.fileBrowserModalRegion.show(view);
_showManualImport : function(options) {
var view = new ManualImportLayout(options);
AppLayout.modalRegion.show(view);
},
_closeFileBrowser : function(options) {
AppLayout.fileBrowserModalRegion.closeModal();
_showFileBrowser : function(options) {
var view = new FileBrowserLayout(options);
AppLayout.modalRegion2.show(view);
},
_closeFileBrowser : function() {
AppLayout.modalRegion2.closeModal();
}
});
@@ -4,7 +4,7 @@ var Marionette = require('marionette');
require('bootstrap');
var region = Marionette.Region.extend({
el : '#file-browser-modal-region',
el : '#modal-region2',
constructor : function() {
Backbone.Marionette.Region.prototype.constructor.apply(this, arguments);