From 767ad46d90ccc9a70dce9c5f149420a524b88435 Mon Sep 17 00:00:00 2001 From: Ruud Date: Sun, 27 May 2012 23:30:29 +0200 Subject: [PATCH] Reload after update --- couchpotato/core/_base/updater/static/updater.js | 5 +++-- couchpotato/static/scripts/couchpotato.js | 14 +++++--------- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/couchpotato/core/_base/updater/static/updater.js b/couchpotato/core/_base/updater/static/updater.js index 54310d7c..a2660086 100644 --- a/couchpotato/core/_base/updater/static/updater.js +++ b/couchpotato/core/_base/updater/static/updater.js @@ -82,10 +82,11 @@ var UpdaterBase = new Class({ 'onComplete': function(json){ if(json.success){ App.restart('Please wait while CouchPotato is being updated with more awesome stuff.', 'Updating'); - App.checkAvailable.delay(500, App); + App.checkAvailable.delay(500, App, [1000, function(){ + window.location.reload(); + }]); if(self.message) self.message.destroy(); - window.location.reload(); } } }); diff --git a/couchpotato/static/scripts/couchpotato.js b/couchpotato/static/scripts/couchpotato.js index c3a63397..21cd315b 100644 --- a/couchpotato/static/scripts/couchpotato.js +++ b/couchpotato/static/scripts/couchpotato.js @@ -220,18 +220,21 @@ var CouchPotato = new Class({ self.checkAvailable(3000); }, - checkAvailable: function(delay){ + checkAvailable: function(delay, onAvailable){ var self = this; (function(){ Api.request('app.available', { 'onFailure': function(){ - self.checkAvailable.delay(1000, self); + self.checkAvailable.delay(1000, self, [delay, onAvailable]); self.fireEvent('unload'); }, 'onSuccess': function(){ + if(onAvailable) + onAvailable() self.unBlockPage(); + self.fireEvent('reload'); } }); @@ -263,13 +266,6 @@ var CouchPotato = new Class({ createUrl: function(action, params){ return this.options.base_url + (action ? action+'/' : '') + (params ? '?'+Object.toQueryString(params) : '') - }, - - notify: function(options){ - return this.growl.notify({ - title: "this scrolls away", - text: "test - hello there. mouseover to pause away action" - }); } });