Give feedback if no update

This commit is contained in:
Ruud
2012-07-01 00:49:07 +02:00
parent f15351aa73
commit 6162ea9f42
3 changed files with 14 additions and 11 deletions
@@ -22,8 +22,10 @@ var UpdaterBase = new Class({
if(json.update_available) if(json.update_available)
self.doUpdate(); self.doUpdate();
else else {
App.unBlockPage() App.unBlockPage();
App.fireEvent('message', 'No updates available');
}
} }
}) })
@@ -11,6 +11,7 @@ var NotificationBase = new Class({
App.addEvent('unload', self.stopPoll.bind(self)); App.addEvent('unload', self.stopPoll.bind(self));
App.addEvent('reload', self.startInterval.bind(self, [true])); App.addEvent('reload', self.startInterval.bind(self, [true]));
App.addEvent('notification', self.notify.bind(self)); App.addEvent('notification', self.notify.bind(self));
App.addEvent('message', self.showMessage.bind(self));
// Add test buttons to settings page // Add test buttons to settings page
App.addEvent('load', self.addTestButtons.bind(self)); App.addEvent('load', self.addTestButtons.bind(self));
@@ -86,7 +87,7 @@ var NotificationBase = new Class({
startInterval: function(force){ startInterval: function(force){
var self = this; var self = this;
if(self.stopped && !force){ if(self.stopped && !force){
self.stopped = false; self.stopped = false;
return; return;
@@ -141,30 +142,30 @@ var NotificationBase = new Class({
// Restart poll // Restart poll
self.startPoll() self.startPoll()
}, },
showMessage: function(message){ showMessage: function(message){
var self = this; var self = this;
if(!self.message_container) if(!self.message_container)
self.message_container = new Element('div.messages').inject(document.body); self.message_container = new Element('div.messages').inject(document.body);
var new_message = new Element('div.message', { var new_message = new Element('div.message', {
'text': message 'text': message
}).inject(self.message_container); }).inject(self.message_container);
setTimeout(function(){ setTimeout(function(){
new_message.addClass('show') new_message.addClass('show')
}, 10); }, 10);
setTimeout(function(){ setTimeout(function(){
new_message.addClass('hide') new_message.addClass('hide')
setTimeout(function(){ setTimeout(function(){
new_message.destroy(); new_message.destroy();
}, 1000); }, 1000);
}, 4000); }, 4000);
}, },
// Notification setting tests // Notification setting tests
addTestButtons: function(){ addTestButtons: function(){
var self = this; var self = this;
+1 -1
View File
@@ -80,7 +80,7 @@ var CouchPotato = new Class({
} }
}), }),
new Element('a', { new Element('a', {
'text': 'Check for updates', 'text': 'Update to latest',
'events': { 'events': {
'click': self.checkForUpdate.bind(self, null) 'click': self.checkForUpdate.bind(self, null)
} }