mirror of
https://github.com/YunoHost/yunohost-admin.git
synced 2024-09-03 20:06:15 +02:00
Moaaar buttons (reboot/poweroff)
This commit is contained in:
parent
52b4623222
commit
266e349d1f
2 changed files with 38 additions and 45 deletions
|
@ -208,16 +208,13 @@
|
|||
|
||||
// Reboot or shutdown button
|
||||
app.get('#/tools/reboot', function (c) {
|
||||
c.view('tools/tools_reboot');
|
||||
});
|
||||
c.view('tools/tools_reboot', {}, function() {
|
||||
// Configure reboot/shutdown buttons behavior
|
||||
$("button[data-action]").on("click", function() {
|
||||
var action = $(this).data("action");
|
||||
|
||||
// Reboot or shutdown actions
|
||||
app.get('#/tools/reboot/:action', function (c) {
|
||||
var action = c.params['action'].toLowerCase();
|
||||
if (action == 'reboot' || action == 'shutdown') {
|
||||
c.confirm(
|
||||
y18n.t('tools_' + action),
|
||||
// confirm_reboot_action_reboot or confirm_reboot_action_shutdown
|
||||
y18n.t('confirm_reboot_action_' + action),
|
||||
function(){
|
||||
c.api('PUT', '/'+action+'?force', {}, function(data) {
|
||||
|
@ -247,13 +244,9 @@
|
|||
// Force scrollTop on page load
|
||||
$('html, body').scrollTop(0);
|
||||
}, false);
|
||||
}
|
||||
);
|
||||
}
|
||||
else {
|
||||
c.flash('fail', y18n.t('unknown_action', [action]));
|
||||
c.redirect_to('#/tools/reboot', {slide: false});
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
// Diagnosis
|
||||
|
|
|
@ -15,14 +15,14 @@
|
|||
</div>
|
||||
<div class="panel-body">
|
||||
<p>
|
||||
<a role="button" href="#/tools/reboot/reboot" class="btn btn-danger">
|
||||
<button class="btn btn-danger" data-action="reboot">
|
||||
<i class="fa-refresh"></i> {{t 'tools_reboot_btn'}}
|
||||
</a>
|
||||
</button>
|
||||
</p>
|
||||
<p>
|
||||
<a role="button" href="#/tools/reboot/shutdown" class="btn btn-danger">
|
||||
<button class="btn btn-danger" data-action="shutdown">
|
||||
<i class="fa-power-off"></i> {{t 'tools_shutdown_btn'}}
|
||||
</a>
|
||||
</button>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
|
Loading…
Add table
Reference in a new issue