Lazy-load dashboard widgets

This commit is contained in:
Raphael Michel
2019-08-12 12:19:02 +02:00
parent 9bdb715874
commit 5363f4206e
6 changed files with 139 additions and 67 deletions

View File

@@ -0,0 +1,13 @@
/*global $,gettext*/
$(function () {
if ($("div[data-lazy-id]").length == 0) {
return;
}
$.getJSON("widgets.json", function (data) {
$.each(data.widgets, function (k, v) {
$("[data-lazy-id=" + v.lazy + "]").removeClass("widget-lazy-loading");
$("[data-lazy-id=" + v.lazy + "] .widget").html(v.content);
});
});
});

View File

@@ -27,6 +27,16 @@
width: 25%;
}
.dashboard .widget-container.widget-lazy-loading {
text-align: center;
.fa-cog {
color: #ccc;
margin-top: 30px;
-webkit-animation: fa-spin 4s infinite linear;
animation: fa-spin 4s infinite linear;
}
}
.dashboard-panels .panel-heading .fa {
opacity: 0.5;
}