Browse Source

Pretty restart questions

pull/110/head
Ruud 13 years ago
parent
commit
7b95fd1a3c
  1. 49
      couchpotato/static/scripts/couchpotato.js

49
couchpotato/static/scripts/couchpotato.js

@ -70,13 +70,13 @@ var CouchPotato = new Class({
[new Element('a.orange', {
'text': 'Restart',
'events': {
'click': self.restart.bind(self)
'click': self.restartQA.bind(self)
}
}),
new Element('a.red', {
'text': 'Shutdown',
'events': {
'click': self.shutdown.bind(self)
'click': self.shutdownQA.bind(self)
}
}),
new Element('a', {
@ -161,6 +161,29 @@ var CouchPotato = new Class({
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){
var self = this;
@ -169,6 +192,28 @@ var CouchPotato = new Class({
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){
var self = this;

Loading…
Cancel
Save