Add spinner to external preview

This commit is contained in:
Jure Grabnar 2019-06-26 19:43:35 +02:00
parent b2b752fcf8
commit 7d71608166

View file

@ -8,15 +8,18 @@ function applyClickCallbackOnProtocolCards() {
protocol_source: $(this).data('protocol-source'), protocol_source: $(this).data('protocol-source'),
protocol_id: $(this).data('show-protocol-id') protocol_id: $(this).data('show-protocol-id')
}, },
beforeSend: animateSpinner($('.protocol-preview-panel'), true),
success: function(data) { success: function(data) {
$('.empty-preview-panel').hide(); $('.empty-preview-panel').hide();
$('.full-preview-panel').show(); $('.full-preview-panel').show();
$('.preview-iframe').contents().find('body').html(data.html); $('.preview-iframe').contents().find('body').html(data.html);
animateSpinner($('.protocol-preview-panel'), false);
}, },
error: function(_error) { error: function(_error) {
// TODO: we should probably show some alert bubble // TODO: we should probably show some alert bubble
$('.empty-preview-panel').show(); $('.empty-preview-panel').show();
$('.full-preview-panel').hide(); $('.full-preview-panel').hide();
animateSpinner($('.protocol-preview-panel'), false);
} }
}); });
e.preventDefault(); e.preventDefault();