mirror of
https://github.com/YunoHost/yunohost-admin.git
synced 2024-09-03 20:06:15 +02:00
Manipulate the loader pacman with semantic helpers
This commit is contained in:
parent
8f2c959cdd
commit
392a4de64a
5 changed files with 35 additions and 29 deletions
|
@ -523,8 +523,6 @@
|
|||
|
||||
if ((is_safe_for_install_color === "warning") || (is_safe_for_install_color === "danger"))
|
||||
{
|
||||
// Disable the pacman while we ask for confirmation
|
||||
$('div.loader').remove();
|
||||
c.confirm(
|
||||
y18n.t("applications"),
|
||||
y18n.t("confirm_install_app_"+is_safe_for_install_color),
|
||||
|
|
|
@ -24,20 +24,17 @@
|
|||
$('#masthead').show()
|
||||
.find('.logout-btn').hide();
|
||||
store.set('path-1', '#/login');
|
||||
if ($('div.loader').length === 0) {
|
||||
$('#main').append('<div class="loader loader-content"></div>');
|
||||
}
|
||||
|
||||
c.showLoader();
|
||||
|
||||
c.checkInstall(function(isInstalled) {
|
||||
if (isInstalled) {
|
||||
// Remove loader
|
||||
$('div.loader').remove();
|
||||
c.hideLoader();
|
||||
// Pass domain to hide form field
|
||||
c.view('login', { 'domain': window.location.hostname });
|
||||
} else if (typeof isInstalled === 'undefined') {
|
||||
if (app.isInstalledTry > 0) {
|
||||
app.isInstalledTry--;
|
||||
app.loaded = false; // Show pacman
|
||||
setTimeout(function() {
|
||||
c.redirect('#/');
|
||||
}, 5000);
|
||||
|
@ -56,12 +53,10 @@
|
|||
$(document).off('ajaxError');
|
||||
});
|
||||
|
||||
// Remove pacman
|
||||
app.loaded = true;
|
||||
$('div.loader').remove();
|
||||
c.hideLoader();
|
||||
}
|
||||
} else {
|
||||
$('div.loader').remove();
|
||||
c.hideLoader();
|
||||
c.redirect('#/postinstall');
|
||||
}
|
||||
});
|
||||
|
|
|
@ -146,7 +146,7 @@
|
|||
$('button[data-action="share"]').on("click", function() {
|
||||
c.api('GET', '/logs/display?path='+$(this).data('log-id')+'&share', {},
|
||||
function(data) {
|
||||
$('div.loader').remove();
|
||||
c.hideLoader();
|
||||
window.open(data.url, '_blank');
|
||||
});
|
||||
});
|
||||
|
@ -241,8 +241,7 @@
|
|||
$('#main').replaceWith('<div id="main"><div class="alert alert-warning"><i class="fa-power-off"></i> ' + y18n.t('tools_shuttingdown') + '</div></div>');
|
||||
}
|
||||
|
||||
// Remove loader if any
|
||||
$('div.loader').remove();
|
||||
c.hideLoader();
|
||||
|
||||
// Force scrollTop on page load
|
||||
$('html, body').scrollTop(0);
|
||||
|
|
|
@ -75,7 +75,7 @@
|
|||
if (data.security["CVE-2017-5754"].vulnerable) {
|
||||
c.flash('danger', y18n.t('meltdown'));
|
||||
}
|
||||
$('div.loader').remove();
|
||||
c.hideLoader();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -133,10 +133,9 @@
|
|||
if (window.navigator && window.navigator.language && (typeof data.locale === 'undefined')) {
|
||||
data.locale = y18n.locale || window.navigator.language.substr(0, 2);
|
||||
}
|
||||
app.loaded = false;
|
||||
if ($('div.loader').length === 0) {
|
||||
$('#main').append('<div class="loader loader-content"></div>');
|
||||
}
|
||||
|
||||
c.showLoader();
|
||||
|
||||
call = function(uri, callback, method, data, callbackOnFailure) {
|
||||
|
||||
var args = data;
|
||||
|
@ -152,6 +151,10 @@
|
|||
callbackOnFailure = function(xhr) {
|
||||
// Postinstall is a custom case, we have to wait that
|
||||
// operation is done before doing anything
|
||||
//
|
||||
// TODO / FIXME : maybe we should add this as a
|
||||
// callbackonfailure during the actual api call instead
|
||||
// of hard-coding it here...
|
||||
if ((uri === '/postinstall') && (post_installing)) {
|
||||
interval = window.location.hostname === args.domain ? 20000 : 5000;
|
||||
checkInstall = setInterval(function () {
|
||||
|
@ -216,8 +219,7 @@
|
|||
console.log(xhr);
|
||||
}
|
||||
|
||||
// Remove loader if any
|
||||
$('div.loader').remove();
|
||||
c.hideLoader();
|
||||
|
||||
// Force scrollTop on page load
|
||||
$('html, body').scrollTop(0);
|
||||
|
@ -285,10 +287,8 @@
|
|||
callback = typeof callback !== 'undefined' ? callback : function() {};
|
||||
enableSlide = (typeof enableSlide !== 'undefined') ? enableSlide : true; // Change to false to disable animation
|
||||
|
||||
app.loaded = true;
|
||||
|
||||
// Hide loader and modal
|
||||
$('div.loader').remove();
|
||||
c.hideLoader();
|
||||
$('#modal').modal('hide');
|
||||
|
||||
// Render content
|
||||
|
@ -394,10 +394,14 @@
|
|||
},
|
||||
|
||||
confirm: function(title, content, confirmCallback, cancelCallback) {
|
||||
c = this;
|
||||
|
||||
// Default callbacks
|
||||
confirmCallback = typeof confirmCallback !== 'undefined' ? confirmCallback : function() {};
|
||||
cancelCallback = typeof cancelCallback !== 'undefined' ? cancelCallback : function() {};
|
||||
|
||||
c.hideLoader();
|
||||
|
||||
// Get modal element
|
||||
var box = $('#modal');
|
||||
|
||||
|
@ -436,6 +440,18 @@
|
|||
return box.modal('show');
|
||||
},
|
||||
|
||||
showLoader: function() {
|
||||
app.loaded = false; // Not sure if that's really useful ... this is from old code with no explanation what it really does ...
|
||||
if ($('div.loader').length === 0) {
|
||||
$('#main').append('<div class="loader loader-content"></div>');
|
||||
}
|
||||
},
|
||||
|
||||
hideLoader: function() {
|
||||
app.loaded = true; // Not sure if that's really useful ... this is from old code with no explanation what it really does ...
|
||||
$('div.loader').remove();
|
||||
},
|
||||
|
||||
selectAllOrNone: function () {
|
||||
// Remove active style from buttons
|
||||
$(".select_all-none input").click(function(){ $(this).toggleClass("active"); });
|
||||
|
@ -545,8 +561,7 @@
|
|||
// Get paste content element
|
||||
var preElement = $($(this).data('paste-content'));
|
||||
|
||||
// Add pacman loader
|
||||
$('#main').append('<div class="loader loader-content"></div>');
|
||||
c.showLoader();
|
||||
|
||||
// Send to paste.yunohost.org
|
||||
$.ajax({
|
||||
|
@ -561,8 +576,7 @@
|
|||
c.flash('fail', y18n.t('paste_error'));
|
||||
})
|
||||
.always(function(){
|
||||
// Remove pacman
|
||||
$('div.loader').remove();
|
||||
c.hideLoader();
|
||||
});
|
||||
});
|
||||
},
|
||||
|
|
Loading…
Reference in a new issue