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)
self.doUpdate();
else
App.unBlockPage()
else {
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('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;
+1 -1
View File
@@ -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)
}