From 6162ea9f429536fa6de1e56bb4674740f5a4a615 Mon Sep 17 00:00:00 2001 From: Ruud Date: Sun, 1 Jul 2012 00:49:07 +0200 Subject: [PATCH] Give feedback if no update --- .../core/_base/updater/static/updater.js | 6 ++++-- .../notifications/core/static/notification.js | 17 +++++++++-------- couchpotato/static/scripts/couchpotato.js | 2 +- 3 files changed, 14 insertions(+), 11 deletions(-) diff --git a/couchpotato/core/_base/updater/static/updater.js b/couchpotato/core/_base/updater/static/updater.js index fe0a632c..df6cf351 100644 --- a/couchpotato/core/_base/updater/static/updater.js +++ b/couchpotato/core/_base/updater/static/updater.js @@ -22,8 +22,10 @@ var UpdaterBase = new Class({ if(json.update_available) self.doUpdate(); - else - App.unBlockPage() + else { + App.unBlockPage(); + App.fireEvent('message', 'No updates available'); + } } }) diff --git a/couchpotato/core/notifications/core/static/notification.js b/couchpotato/core/notifications/core/static/notification.js index d3811d4d..595a39ed 100644 --- a/couchpotato/core/notifications/core/static/notification.js +++ b/couchpotato/core/notifications/core/static/notification.js @@ -11,6 +11,7 @@ var NotificationBase = new Class({ App.addEvent('unload', self.stopPoll.bind(self)); App.addEvent('reload', self.startInterval.bind(self, [true])); App.addEvent('notification', self.notify.bind(self)); + App.addEvent('message', self.showMessage.bind(self)); // Add test buttons to settings page App.addEvent('load', self.addTestButtons.bind(self)); @@ -86,7 +87,7 @@ var NotificationBase = new Class({ startInterval: function(force){ var self = this; - + if(self.stopped && !force){ self.stopped = false; return; @@ -141,30 +142,30 @@ var NotificationBase = new Class({ // Restart poll self.startPoll() }, - + showMessage: function(message){ var self = this; - + if(!self.message_container) self.message_container = new Element('div.messages').inject(document.body); - + var new_message = new Element('div.message', { 'text': message }).inject(self.message_container); - + setTimeout(function(){ new_message.addClass('show') }, 10); - + setTimeout(function(){ new_message.addClass('hide') setTimeout(function(){ new_message.destroy(); }, 1000); }, 4000); - + }, - + // Notification setting tests addTestButtons: function(){ var self = this; diff --git a/couchpotato/static/scripts/couchpotato.js b/couchpotato/static/scripts/couchpotato.js index 9a15bbab..c0860a99 100644 --- a/couchpotato/static/scripts/couchpotato.js +++ b/couchpotato/static/scripts/couchpotato.js @@ -80,7 +80,7 @@ var CouchPotato = new Class({ } }), new Element('a', { - 'text': 'Check for updates', + 'text': 'Update to latest', 'events': { 'click': self.checkForUpdate.bind(self, null) }