diff --git a/mod/photos.php b/mod/photos.php index c683cc086a..5e5917452c 100644 --- a/mod/photos.php +++ b/mod/photos.php @@ -1404,6 +1404,7 @@ function photos_content(App $a) '$comment' => DI::l10n()->t('Comment'), '$submit' => DI::l10n()->t('Submit'), '$preview' => DI::l10n()->t('Preview'), + '$loading' => DI::l10n()->t('Loading...'), '$sourceapp' => DI::l10n()->t($a->sourcename), '$ww' => '', '$rand_num' => Crypto::randomDigits(12) diff --git a/src/Object/Post.php b/src/Object/Post.php index f55dbde0d5..7b8f4b00d6 100644 --- a/src/Object/Post.php +++ b/src/Object/Post.php @@ -919,6 +919,7 @@ class Post '$myphoto' => DI::baseUrl()->remove($a->contact['thumb']), '$comment' => DI::l10n()->t('Comment'), '$submit' => DI::l10n()->t('Submit'), + '$loading' => DI::l10n()->t('Loading...'), '$edbold' => DI::l10n()->t('Bold'), '$editalic' => DI::l10n()->t('Italic'), '$eduline' => DI::l10n()->t('Underline'), diff --git a/view/theme/frio/js/theme.js b/view/theme/frio/js/theme.js index 29d043a6a4..2ea3aa6d2f 100644 --- a/view/theme/frio/js/theme.js +++ b/view/theme/frio/js/theme.js @@ -94,6 +94,8 @@ $(document).ready(function(){ } } + let $body = $('body'); + // show bulk deletion button at network page if checkbox is checked $("body").change("input.item-select", function(){ var checked = false; @@ -368,6 +370,45 @@ $(document).ready(function(){ showHideEventMap(this); }); + // Comment form submit + $body.on('submit', '.comment-edit-form', function(e) { + e.preventDefault(); + + let $form = $(this); + let id = $form.data('item-id'); + let $commentSubmit = $form.find('.comment-edit-submit').button('loading'); + + unpause(); + commentBusy = true; + + $.post( + 'item', + $form.serialize(), + 'json' + ) + .then(function(data) { + if (data.success) { + $('#comment-edit-wrapper-' + id).hide(); + let $textarea = $('#comment-edit-text-' + id); + $textarea.val(''); + if ($textarea.get(0)) { + commentClose($textarea.get(0), id); + } + if (timer) { + clearTimeout(timer); + } + timer = setTimeout(NavUpdate,10); + force_update = true; + update_item = id; + } + if (data.reload) { + window.location.href = data.reload; + } + }) + .always(function() { + $commentSubmit.button('reset'); + }); + }) }); function openClose(theID) { diff --git a/view/theme/frio/templates/comment_item.tpl b/view/theme/frio/templates/comment_item.tpl index b60f5c429e..d4284d39b8 100644 --- a/view/theme/frio/templates/comment_item.tpl +++ b/view/theme/frio/templates/comment_item.tpl @@ -4,7 +4,7 @@ {{else}}
{{/if}} -
+ @@ -55,9 +55,9 @@

{{if $preview}} - + {{/if}} - +