Merge remote-tracking branch 'adv/modal-details'

# Conflicts:
#	cps/static/js/main.js
#	cps/templates/detail.html
This commit is contained in:
OzzieIsaacs
2017-07-23 14:03:02 +02:00
12 changed files with 69 additions and 28 deletions

View File

@ -18,6 +18,11 @@ $(document).on("change", "input[type=\"checkbox\"][data-control]", function () {
$(function() {
// Allow ajax prefilters to be added/removed dynamically
// eslint-disable-next-line new-cap
const preFilters = $.Callbacks();
$.ajaxPrefilter(preFilters.fire);
function restartTimer() {
$("#spinner").addClass("hidden");
$("#RestartDialog").modal("hide");
@ -137,6 +142,26 @@ $(function() {
$("input[data-control]").trigger("change");
$("#bookDetailsModal")
.on("show.bs.modal", function(e) {
const $modalBody = $(this).find(".modal-body");
// Prevent static assets from loading multiple times
const useCache = (options) => {
options.async = true;
options.cache = true;
};
preFilters.add(useCache);
$.get(e.relatedTarget.href).done(function(content) {
$modalBody.html(content);
preFilters.remove(useCache);
});
})
.on("hidden.bs.modal", function() {
$(this).find(".modal-body").html("...");
});
$(window).resize(function(event) {
$(".discover .row").isotope("reLayout");
});