Give feedback if no update
This commit is contained in:
@@ -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;
|
||||||
|
|||||||
@@ -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)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user