Add HTML buffer to reduce flicker on AJAX menu update. GitLab issue #511.
Signed-off-by: Roberto Rosario <roberto.rosario.gonzalez@gmail.com>
This commit is contained in:
@@ -115,6 +115,9 @@ class MayanApp {
|
|||||||
|
|
||||||
doRefreshMainMenu (options) {
|
doRefreshMainMenu (options) {
|
||||||
var self = this;
|
var self = this;
|
||||||
|
var $mainMenu = $('#main-menu');
|
||||||
|
var $mainMenuBuffer = $('#main-menu-buffer');
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
complete: function() {
|
complete: function() {
|
||||||
setTimeout(app.doRefreshMainMenu, options.interval, options);
|
setTimeout(app.doRefreshMainMenu, options.interval, options);
|
||||||
@@ -123,7 +126,12 @@ class MayanApp {
|
|||||||
var $elements = $('.dropdown.open');
|
var $elements = $('.dropdown.open');
|
||||||
if ($elements.length === 0) {
|
if ($elements.length === 0) {
|
||||||
// Don't refresh the HTML if there are open dropdowns
|
// Don't refresh the HTML if there are open dropdowns
|
||||||
$('#main-menu').html(data);
|
$mainMenuBuffer.html(data);
|
||||||
|
$mainMenuBuffer.show();
|
||||||
|
$mainMenu.hide();
|
||||||
|
$mainMenu.html($mainMenuBuffer.html());
|
||||||
|
$mainMenu.show();
|
||||||
|
$mainMenuBuffer.hide();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
url: options.url,
|
url: options.url,
|
||||||
@@ -240,7 +248,7 @@ class MayanApp {
|
|||||||
setTimeout(
|
setTimeout(
|
||||||
function () {
|
function () {
|
||||||
self.callbackAJAXSpinnerUpdate();
|
self.callbackAJAXSpinnerUpdate();
|
||||||
}, 350
|
}, 450
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -36,6 +36,7 @@
|
|||||||
<div id="main-menu">
|
<div id="main-menu">
|
||||||
{% include 'appearance/main_menu.html' %}
|
{% include 'appearance/main_menu.html' %}
|
||||||
</div>
|
</div>
|
||||||
|
<div id="main-menu-buffer" style="display: none;"></div>
|
||||||
<div class="container-fluid">
|
<div class="container-fluid">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-xs-12">
|
<div class="col-xs-12">
|
||||||
|
|||||||
Reference in New Issue
Block a user