Pretty restart questions

This commit is contained in:
Ruud committed 2012-04-16 00:37:48 +02:00
1 parent 1dc5b4bac4
commit 7b95fd1a3c
1 file changed
+47 -2
+47 -2
View File
@@ -70,13 +70,13 @@ var CouchPotato = new Class({
[new Element('a.orange', { [new Element('a.orange', {
'text': 'Restart', 'text': 'Restart',
'events': { 'events': {
'click': self.restart.bind(self) 'click': self.restartQA.bind(self)
} }
}), }),
new Element('a.red', { new Element('a.red', {
'text': 'Shutdown', 'text': 'Shutdown',
'events': { 'events': {
'click': self.shutdown.bind(self) 'click': self.shutdownQA.bind(self)
} }
}), }),
new Element('a', { new Element('a', {
@@ -161,6 +161,29 @@ var CouchPotato = new Class({
self.checkAvailable(1000); self.checkAvailable(1000);
}, },
shutdownQA: function(){
var self = this;
new Question('Are you sure you want to shutdown CouchPotato?', '', [{
'text': 'Shutdown',
'class': 'shutdown red',
'events': {
'click': function(e){
(e).preventDefault();
self.blockPage('You have shutdown. This is what suppose to happen ;)');
Api.request('app.shutdown', {
'onComplete': self.blockPage.bind(self)
});
self.checkAvailable(1000);
}
}
}, {
'text': 'No, nevah!',
'cancel': true
}]);
},
restart: function(message, title){ restart: function(message, title){
var self = this; var self = this;
@@ -169,6 +192,28 @@ var CouchPotato = new Class({
self.checkAvailable(1000); self.checkAvailable(1000);
}, },
restartQA: function(message, title){
var self = this;
new Question('Are you sure you want to restart CouchPotato?', '', [{
'text': 'Restart',
'class': 'restart orange',
'events': {
'click': function(e){
(e).preventDefault();
self.blockPage(message || 'Restarting... please wait. If this takes to long, something must have gone wrong.', title);
Api.request('app.restart');
self.checkAvailable(1000);
}
}
}, {
'text': 'No, nevah!',
'cancel': true
}]);
},
checkForUpdate: function(func){ checkForUpdate: function(func){
var self = this; var self = this;