Add ajax reload to org home

This commit is contained in:
cuom1999 2022-11-25 00:27:39 -06:00
parent 392a39c43e
commit e35f91ca2d
5 changed files with 32 additions and 22 deletions

View file

@ -97,6 +97,7 @@
$(function () { $(function () {
$('img.unveil').unveil(200); $('img.unveil').unveil(200);
}); });
const loading_page = `{% include "loading-page.html" %}`;
</script> </script>
{% endcompress %} {% endcompress %}

File diff suppressed because one or more lines are too long

View file

@ -14,5 +14,10 @@
$(this).parent().submit(); $(this).parent().submit();
} }
}); });
$('#control-panel a').on('click', function(e) {
e.preventDefault();
navigateTo($(this));
})
}); });
</script> </script>

View file

@ -129,18 +129,13 @@
}) })
$('#logout').on('click', () => $('#logout-form').submit()); $('#logout').on('click', () => $('#logout-form').submit());
} }
$(function () {
const loading_page = `{% include "loading-page.html" %}`;
window.addEventListener('popstate', (e) => {
window.location.href = e.currentTarget.location.href;
});
$('.left-sidebar-item').on('click', function() { function navigateTo($elem) {
var url = $(this).attr('data-href'); var url = $elem.attr('data-href') || $elem.attr('href');
if (url === '#') return; if (url === '#') return;
$('.left-sidebar-item').removeClass('active'); $('.left-sidebar-item').removeClass('active');
$(this).addClass('active'); $elem.addClass('active');
$('.middle-right-content').html(loading_page); $('.middle-right-content').html(loading_page);
$.get(url, function(data) { $.get(url, function(data) {
var reload_content = $(data).find('.middle-right-content'); var reload_content = $(data).find('.middle-right-content');
@ -155,6 +150,15 @@
window.location.href = url; window.location.href = url;
} }
}); });
}
$(function () {
window.addEventListener('popstate', (e) => {
window.location.href = e.currentTarget.location.href;
});
$('.left-sidebar-item').on('click', function() {
navigateTo($(this));
}); });
$('.blog-box').on('click', function() { $('.blog-box').on('click', function() {
var $description = $(this).children('.blog-description'); var $description = $(this).children('.blog-description');