From e6388a186ffce5caf1a84a2d96cca7740c3b1002 Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Tue, 26 May 2020 09:24:08 -0400 Subject: [PATCH] [frio] Disable unexpected asynchronous compose form submission --- view/theme/frio/js/theme.js | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/view/theme/frio/js/theme.js b/view/theme/frio/js/theme.js index b64c7d020..3a3f02c5e 100644 --- a/view/theme/frio/js/theme.js +++ b/view/theme/frio/js/theme.js @@ -112,10 +112,8 @@ $(document).ready(function(){ } }); - //$('ul.flex-nav').flexMenu(); - // initialize the bootstrap tooltips - $('body').tooltip({ + $body.tooltip({ selector: '[data-toggle="tooltip"]', container: 'body', animation: true, @@ -364,10 +362,17 @@ $(document).ready(function(){ // Comment form submit $body.on('submit', '.comment-edit-form', function(e) { + let id = $form.data('item-id'); + + // Compose page form exception: id is always 0 and form must not be submitted asynchronously + if (id === 0) { + return; + } + e.preventDefault(); let $form = $(this); - let id = $form.data('item-id'); + let $commentSubmit = $form.find('.comment-edit-submit').button('loading'); unpause();