Using messenger for notifications on series add
This commit is contained in:
parent
42fb4fcaa4
commit
c039aedbb9
|
@ -2,10 +2,9 @@
|
||||||
define([
|
define([
|
||||||
'app', 'AddSeries/RootFolders/RootFolderCollection',
|
'app', 'AddSeries/RootFolders/RootFolderCollection',
|
||||||
'Quality/QualityProfileCollection',
|
'Quality/QualityProfileCollection',
|
||||||
'Shared/NotificationCollection',
|
|
||||||
'AddSeries/Existing/UnmappedFolderModel',
|
'AddSeries/Existing/UnmappedFolderModel',
|
||||||
'AddSeries/Collection',
|
'AddSeries/Collection',
|
||||||
'Series/SeriesModel'], function (app, rootFolders, qualityProfileCollection, notificationCollection) {
|
'Series/SeriesModel'], function (app, rootFolders, qualityProfileCollection) {
|
||||||
|
|
||||||
NzbDrone.AddSeries.Existing.FolderMatchResultView = Backbone.Marionette.ItemView.extend({
|
NzbDrone.AddSeries.Existing.FolderMatchResultView = Backbone.Marionette.ItemView.extend({
|
||||||
template: 'AddSeries/SearchResultTemplate',
|
template: 'AddSeries/SearchResultTemplate',
|
||||||
|
@ -34,19 +33,12 @@ define([
|
||||||
this.model.set('rootFolderId', rootFolderId);
|
this.model.set('rootFolderId', rootFolderId);
|
||||||
this.model.set('folder', folder);
|
this.model.set('folder', folder);
|
||||||
|
|
||||||
var seriesCollection = new NzbDrone.AddSeries.Collection();
|
|
||||||
seriesCollection.add(this.model);
|
|
||||||
|
|
||||||
this.model.save(undefined, {
|
this.model.save(undefined, {
|
||||||
success: function () {
|
success: function () {
|
||||||
var notificationModel = new NzbDrone.Shared.NotificationModel({
|
NzbDrone.Shared.Messenger.show({
|
||||||
tvDbId : self.model.get('tvDbId'),
|
message: 'Added: ' + self.model.get('title')
|
||||||
title : 'Added',
|
|
||||||
message: self.model.get('title'),
|
|
||||||
level : 'success'
|
|
||||||
});
|
});
|
||||||
|
|
||||||
notificationCollection.push(notificationModel);
|
|
||||||
NzbDrone.vent.trigger(NzbDrone.Events.SeriesAdded, { existing: true, series: self.model });
|
NzbDrone.vent.trigger(NzbDrone.Events.SeriesAdded, { existing: true, series: self.model });
|
||||||
self.trigger('seriesAdded');
|
self.trigger('seriesAdded');
|
||||||
self.close();
|
self.close();
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
define(['app', 'Shared/NotificationCollection', 'Series/SeriesCollection'], function (app, notificationCollection) {
|
define(['app', 'Series/SeriesCollection'], function (app) {
|
||||||
|
|
||||||
NzbDrone.AddSeries.New.SearchItemView = Backbone.Marionette.ItemView.extend({
|
NzbDrone.AddSeries.New.SearchItemView = Backbone.Marionette.ItemView.extend({
|
||||||
|
|
||||||
|
@ -32,13 +32,10 @@ define(['app', 'Shared/NotificationCollection', 'Series/SeriesCollection'], func
|
||||||
this.model.save(undefined, {
|
this.model.save(undefined, {
|
||||||
url : NzbDrone.Series.SeriesCollection.prototype.url,
|
url : NzbDrone.Series.SeriesCollection.prototype.url,
|
||||||
success: function () {
|
success: function () {
|
||||||
var notificationModel = new NzbDrone.Shared.NotificationModel({
|
NzbDrone.Shared.Messenger.show({
|
||||||
title : 'Added',
|
message: 'Added: ' + self.model.get('title')
|
||||||
message: self.model.get('title'),
|
|
||||||
level : 'success'
|
|
||||||
});
|
});
|
||||||
|
|
||||||
notificationCollection.push(notificationModel);
|
|
||||||
NzbDrone.vent.trigger(NzbDrone.Events.SeriesAdded, { existing: false, series: self.model });
|
NzbDrone.vent.trigger(NzbDrone.Events.SeriesAdded, { existing: false, series: self.model });
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue