bnzbd
+ clickable
mouseenter
mouseleave
diff --git a/UI/AddSeries/AddSeriesLayout.js b/UI/AddSeries/AddSeriesLayout.js
index 64d902ef6..1a382b34e 100644
--- a/UI/AddSeries/AddSeriesLayout.js
+++ b/UI/AddSeries/AddSeriesLayout.js
@@ -19,20 +19,26 @@ define([
'click .x-import': '_importSeries'
},
- onRender: function () {
+ initialize: function () {
+ this.rootFolderLayout = new NzbDrone.AddSeries.RootFolders.Layout();
+ this.rootFolderLayout.on('folderSelected', this._folderSelected, this);
+
+ },
- /* rootFolderCollection.fetch({success: function () {
- self.importExisting.show(new NzbDrone.AddSeries.Existing.RootDirListView({model: rootFolderCollection.at(0)}));
- }});*/
+ _folderSelected: function (options) {
+ NzbDrone.modalRegion.closeModal();
+ this.workspace.show(new NzbDrone.AddSeries.Existing.ListView({model: options.model}));
+ },
+
+ onRender: function () {
qualityProfileCollection.fetch();
rootFolderCollection.fetch();
this.workspace.show(new NzbDrone.AddSeries.AddSeriesView());
},
-
_importSeries: function () {
- NzbDrone.modalRegion.show(new NzbDrone.AddSeries.RootFolders.Layout());
+ NzbDrone.modalRegion.show(this.rootFolderLayout);
}
});
});
diff --git a/UI/AddSeries/AddSeriesView.js b/UI/AddSeries/AddSeriesView.js
index f4dddaa4c..df2fd8ceb 100644
--- a/UI/AddSeries/AddSeriesView.js
+++ b/UI/AddSeries/AddSeriesView.js
@@ -1,9 +1,9 @@
"use strict";
define(['app',
- 'AddSeries/RootFolders/RootFolderCollection',
- 'AddSeries/SearchResultView',
- 'Shared/SpinnerView',
- 'AddSeries/Collection'], function () {
+ 'AddSeries/RootFolders/RootFolderCollection',
+ 'AddSeries/SearchResultView',
+ 'Shared/SpinnerView',
+ 'AddSeries/Collection'], function () {
NzbDrone.AddSeries.AddSeriesView = Backbone.Marionette.Layout.extend({
template: 'AddSeries/AddSeriesTemplate',
@@ -16,18 +16,7 @@ define(['app',
},
initialize: function () {
-
this.collection = new NzbDrone.AddSeries.Collection();
- NzbDrone.AddSeries.New.AddNewSeriesContext = this;
-
- NzbDrone.vent.on(NzbDrone.Events.SeriesAdded, function (options) {
- if (!options.existing) {
- NzbDrone.AddSeries.New.AddNewSeriesContext.ui.seriesSearch.val('');
-
- //Todo: Figure out why this is inconsistent
- options.series.collection.reset();
- }
- });
},
onRender: function () {
diff --git a/UI/AddSeries/Existing/ImportSeriesView.js b/UI/AddSeries/Existing/ImportSeriesView.js
index 8c4515f8e..927f27d16 100644
--- a/UI/AddSeries/Existing/ImportSeriesView.js
+++ b/UI/AddSeries/Existing/ImportSeriesView.js
@@ -5,7 +5,7 @@ define([
'AddSeries/Existing/UnmappedFolderModel',
'AddSeries/Collection',
'AddSeries/SearchResultView',
- 'Series/SeriesModel'], function (app, rootFolders, qualityProfileCollection) {
+ 'Series/SeriesModel'], function () {
NzbDrone.AddSeries.Existing.UnmappedFolderCompositeView = Backbone.Marionette.CompositeView.extend({
@@ -31,9 +31,9 @@ define([
this.collection = new NzbDrone.AddSeries.Collection();
this.collection.bind('reset', this.collectionReset, this);
- this.on("itemview:seriesAdded", function () {
+ this.on("item:removed", function () {
this.close();
- });
+ }, this);
},
onRender: function () {
@@ -53,7 +53,7 @@ define([
this.searchCollection.fetch({
data : { term: this.ui.searchText.val() },
- success: function (collection) {
+ success: function () {
icon.removeClass('icon-spin icon-spinner disabled').addClass('icon-search');
deferred.resolve();
self.collection.add(self.searchCollection.shift());
@@ -101,7 +101,7 @@ define([
return {
qualityProfile: this.ui.profileList,
rootFolder : this.model.get('rootFolder'),
- folder : this.model.get('folder'),
+ folder : this.model.get('folder').path,
isExisting : true
};
}
diff --git a/UI/AddSeries/RootFolders/RootFolderItemTemplate.html b/UI/AddSeries/RootFolders/RootFolderItemTemplate.html
index e0408702a..f3f438c63 100644
--- a/UI/AddSeries/RootFolders/RootFolderItemTemplate.html
+++ b/UI/AddSeries/RootFolders/RootFolderItemTemplate.html
@@ -1,5 +1,5 @@
- |
-
+ | |
+
|
diff --git a/UI/AddSeries/RootFolders/RootFolderView.js b/UI/AddSeries/RootFolders/RootFolderView.js
index 0c962222b..6b18a0b62 100644
--- a/UI/AddSeries/RootFolders/RootFolderView.js
+++ b/UI/AddSeries/RootFolders/RootFolderView.js
@@ -8,14 +8,18 @@ define(['app', 'AddSeries/RootFolders/RootFolderCollection', 'Mixins/AutoComplet
tagName : 'tr',
events: {
- 'click .x-remove': 'removeFolder'
+ 'click .x-remove': 'removeFolder',
+ 'click .x-folder': 'folderSelected'
},
removeFolder: function () {
this.model.destroy({ wait: true });
this.model.collection.remove(this.model);
- }
+ },
+ folderSelected: function () {
+ this.trigger('folderSelected', this.model);
+ }
});
NzbDrone.AddSeries.RootDirListView = Backbone.Marionette.CollectionView.extend({
@@ -40,14 +44,22 @@ define(['app', 'AddSeries/RootFolders/RootFolderCollection', 'Mixins/AutoComplet
'click .x-add': 'addFolder'
},
+ initialize: function () {
+ this.collection = rootFolders;
+ this.rootfolderListView = new NzbDrone.AddSeries.RootDirListView({ collection: rootFolders });
+ this.rootfolderListView.on('itemview:folderSelected', this._onFolderSelected, this);
+ },
+
onRender: function () {
- this.collection = rootFolders;
- this.currentDirs.show(new NzbDrone.AddSeries.RootDirListView({ collection: this.collection }));
+ this.currentDirs.show(this.rootfolderListView);
this.ui.pathInput.autoComplete('/directories');
},
+ _onFolderSelected: function (options) {
+ this.trigger('folderSelected', options);
+ },
addFolder: function () {
var newDir = new NzbDrone.AddSeries.RootFolders.RootFolderModel(
@@ -55,25 +67,12 @@ define(['app', 'AddSeries/RootFolders/RootFolderCollection', 'Mixins/AutoComplet
Path: this.ui.pathInput.val()
});
- var self = this;
- this.collection.create(newDir, {
+ rootFolders.create(newDir, {
wait: true, success: function () {
- self.collection.fetch();
+ rootFolders.fetch();
}
});
- },
-
- search: function (context) {
-
- var term = context.ui.seriesSearch.val();
-
- if (term === "") {
- context.collection.reset();
- } else {
- console.log(term);
- context.collection.fetch({ data: { term: term } });
- }
}
});
diff --git a/UI/AddSeries/SearchResultView.js b/UI/AddSeries/SearchResultView.js
index c4a3bcffa..630c0c7e5 100644
--- a/UI/AddSeries/SearchResultView.js
+++ b/UI/AddSeries/SearchResultView.js
@@ -17,9 +17,13 @@ define(['app', 'Series/SeriesCollection', 'AddSeries/RootFolders/RootFolderTempl
},
initialize: function () {
- if (this.isExisting) {
- this.modal.set('isExisting', true);
+
+ if (!this.model) {
+ throw 'model is required';
}
+
+ this.model.set('isExisting', this.options.isExisting);
+ this.model.set('path', this.options.folder);
},
onRender: function () {
@@ -41,12 +45,14 @@ define(['app', 'Series/SeriesCollection', 'AddSeries/RootFolders/RootFolderTempl
this.model.save(undefined, {
url : NzbDrone.Series.SeriesCollection.prototype.url,
success: function () {
+ self.close();
icon.removeClass('icon-spin icon-spinner disabled').addClass('icon-search');
NzbDrone.Shared.Messenger.show({
message: 'Added: ' + self.model.get('title')
});
- NzbDrone.vent.trigger(NzbDrone.Events.SeriesAdded, { existing: false, series: self.model });
+ NzbDrone.vent.trigger(NzbDrone.Events.SeriesAdded, { series: self.model });
+ self.model.collection.remove(self.model);
},
fail : function () {
icon.removeClass('icon-spin icon-spinner disabled').addClass('icon-search');
diff --git a/UI/Mixins/backbone.modelbinder.mixin.js b/UI/Mixins/backbone.modelbinder.mixin.js
index c25bcd509..21eae70b1 100644
--- a/UI/Mixins/backbone.modelbinder.mixin.js
+++ b/UI/Mixins/backbone.modelbinder.mixin.js
@@ -47,12 +47,3 @@ Marionette.ItemView.prototype.render = function () {
return result;
};
-
-Marionette.CollectionView.prototype.render = function () {
-
- if (this.model) {
- NzbDrone.ModelBinder.bind(this.model, this.el);
- }
-
- return oldItemCollectionViewRender.apply(this, arguments);
-};
\ No newline at end of file
diff --git a/UI/Shared/Modal/Region.js b/UI/Shared/Modal/Region.js
index 8c906f8c7..e8a4f9fcd 100644
--- a/UI/Shared/Modal/Region.js
+++ b/UI/Shared/Modal/Region.js
@@ -22,6 +22,12 @@ define(function () {
//https://github.com/twitter/bootstrap/issues/4663
this.$el.attr('tabindex', '-1');
this.$el.modal({'show': true, 'keyboard': true});
+ },
+
+
+ closeModal: function () {
+ this.$el.modal('hide');
+ this.close();
}
});
|