diff --git a/UI/AddSeries/Existing/ImportSeriesView.js b/UI/AddSeries/Existing/ImportSeriesView.js index 13cb74275..a474d4dbb 100644 --- a/UI/AddSeries/Existing/ImportSeriesView.js +++ b/UI/AddSeries/Existing/ImportSeriesView.js @@ -34,6 +34,8 @@ define([ }); notificationCollection.push(notificationModel); + NzbDrone.vent.trigger(NzbDrone.Events.SeriesAdded, { existing: true, series: self.model }); + self.trigger('seriesAdded'); self.close(); } }); @@ -60,6 +62,10 @@ define([ initialize: function () { this.collection = new NzbDrone.Series.SeriesCollection(); this.collection.bind('reset', this.collectionReset, this); + + this.on("itemview:seriesAdded", function(){ + this.close(); + }); }, onRender: function () { diff --git a/UI/AddSeries/New/AddNewSeriesView.js b/UI/AddSeries/New/AddNewSeriesView.js index f7a6fc728..343187851 100644 --- a/UI/AddSeries/New/AddNewSeriesView.js +++ b/UI/AddSeries/New/AddNewSeriesView.js @@ -13,6 +13,19 @@ define(['app', 'AddSeries/RootFolders/RootFolderCollection', 'AddSeries/New/Sear }, collection: new NzbDrone.Series.SeriesCollection(), + initialize: function () { + 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 () { var self = this; diff --git a/UI/AddSeries/New/SearchResultView.js b/UI/AddSeries/New/SearchResultView.js index 48eaf2347..f50915505 100644 --- a/UI/AddSeries/New/SearchResultView.js +++ b/UI/AddSeries/New/SearchResultView.js @@ -38,7 +38,7 @@ define(['app', 'Shared/NotificationCollection', 'Series/SeriesCollection'], func }); notificationCollection.push(notificationModel); - self.close(); + NzbDrone.vent.trigger(NzbDrone.Events.SeriesAdded, { existing: false, series: self.model }); } }); } diff --git a/UI/app.js b/UI/app.js index c359ca36d..49bad76da 100644 --- a/UI/app.js +++ b/UI/app.js @@ -58,7 +58,8 @@ define('app', function () { window.NzbDrone.Events = { OpenModalDialog : 'openModal', - CloseModalDialog: 'closeModal' + CloseModalDialog: 'closeModal', + SeriesAdded: 'seriesAdded' }; window.NzbDrone.Constants = {