From b65f2e7845b7b1bc01b16f5fb1f3ba13d66264bc Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Fri, 4 Apr 2014 10:58:21 -0700 Subject: [PATCH] Messenger supports hideOnNavigate now New: After adding a series you will be able to navigate to it via the UI notification --- src/UI/AddSeries/SearchResultView.js | 28 +++++++++++++++++++++++++--- src/UI/Shared/Messenger.js | 5 ++++- 2 files changed, 29 insertions(+), 4 deletions(-) diff --git a/src/UI/AddSeries/SearchResultView.js b/src/UI/AddSeries/SearchResultView.js index c176115ed..4450cee72 100644 --- a/src/UI/AddSeries/SearchResultView.js +++ b/src/UI/AddSeries/SearchResultView.js @@ -1,9 +1,10 @@ 'use strict'; define( [ + 'underscore', 'vent', 'AppLayout', - 'underscore', + 'backbone', 'marionette', 'Quality/QualityProfileCollection', 'AddSeries/RootFolders/RootFolderCollection', @@ -13,7 +14,18 @@ define( 'Shared/Messenger', 'Mixins/AsValidatedView', 'jquery.dotdotdot' - ], function (vent, AppLayout, _, Marionette, QualityProfiles, RootFolders, RootFolderLayout, SeriesCollection, Config, Messenger, AsValidatedView) { + ], function (_, + vent, + AppLayout, + Backbone, + Marionette, + QualityProfiles, + RootFolders, + RootFolderLayout, + SeriesCollection, + Config, + Messenger, + AsValidatedView) { var view = Marionette.ItemView.extend({ @@ -156,7 +168,17 @@ define( icon.removeClass('icon-spin icon-spinner disabled').addClass('icon-search'); Messenger.show({ - message: 'Added: ' + self.model.get('title') + message: 'Added: ' + self.model.get('title'), + actions : { + goToSeries: { + label: 'Go to Series Page', + action: function() { + Backbone.history.navigate('/series/' + self.model.get('titleSlug'), { trigger: true }); + } + } + }, + hideAfter: 8, + hideOnNavigate: true }); vent.trigger(vent.Events.SeriesAdded, { series: self.model }); diff --git a/src/UI/Shared/Messenger.js b/src/UI/Shared/Messenger.js index 04823f984..2a81b3c70 100644 --- a/src/UI/Shared/Messenger.js +++ b/src/UI/Shared/Messenger.js @@ -23,13 +23,16 @@ define(function () { } } + options.hideOnNavigate = options.hideOnNavigate || false; + return window.Messenger().post({ message : options.message, type : options.type, showCloseButton: true, hideAfter : options.hideAfter, id : options.id, - actions : options.actions + actions : options.actions, + hideOnNavigate : options.hideOnNavigate }); },