From: Jakobus Schürz Date: Sat, 11 Mar 2023 18:23:48 +0000 (+0100) Subject: make errormessages modular and better X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=f8018f8dfe0183ce7c8f7e8460e0d9fbd5b9395b;p=friendica.git make errormessages modular and better --- diff --git a/src/App/Page.php b/src/App/Page.php index c2a77b3251..965c04915c 100644 --- a/src/App/Page.php +++ b/src/App/Page.php @@ -253,12 +253,11 @@ class Page implements ArrayAccess '$touch_icon' => $touch_icon, '$block_public' => intval($config->get('system', 'block_public')), '$stylesheets' => $this->stylesheets, - '$likeNetError' => $l10n->t('Like not successfull (Network error)'), - '$dislikeNetError' => $l10n->t('Dislike not successfull (Network error)'), - '$annonNetError' => $l10n->t('Sharing not successfull (Network error)'), - '$likeSrvError' => $l10n->t('Like not successfull (Backend error)'), - '$dislikeSrvError' => $l10n->t('Dislike not successfull (Backend error)'), - '$annonSrvError' => $l10n->t('Sharing not successfull (Backend error)'), + '$likeError' => $l10n->t('Like not successfull'), + '$dislikeError' => $l10n->t('Dislike not successfull'), + '$announceError' => $l10n->t('Sharing not successfull'), + '$srvError' => $l10n->t('Backend error'), + '$netError' => $l10n->t('Network error'), ]) . $this->page['htmlhead']; } diff --git a/view/theme/frio/js/theme.js b/view/theme/frio/js/theme.js index f6d681203e..a94bd560b2 100644 --- a/view/theme/frio/js/theme.js +++ b/view/theme/frio/js/theme.js @@ -851,7 +851,8 @@ function doActivityItemAction(ident, verb, un) { $('button[id^=shareMenuOptions-' + ident.toString() + '] i:first-child').addClass('fa-share'); $('button[id^=' + verb + '-' + ident.toString() + '] i:first-child').addClass(thumbsClass); $('a[id^=' + verb + '-' + ident.toString() + '] i:first-child').addClass(thumbsClass); - $.jGrowl(aActSrvErr[verb], {sticky: false, theme: 'info', life: 5000}); + $('a[id^=' + verb + '-' + ident.toString() + '] i:first-child').addClass(thumbsClass); + $.jGrowl(aActErr[verb] + '
(' + aErrType['srvErr'] + ')', {sticky: false, theme: 'info', life: 5000}); } }) .error(function(data){ @@ -860,7 +861,7 @@ function doActivityItemAction(ident, verb, un) { $('button[id^=shareMenuOptions-' + ident.toString() + '] i:first-child').addClass('fa-share'); $('button[id^=' + verb + '-' + ident.toString() + '] i:first-child').addClass(thumbsClass); $('a[id^=' + verb + '-' + ident.toString() + '] i:first-child').addClass(thumbsClass); - $.jGrowl(aActNetErr[verb], {sticky: false, theme: 'info', life: 5000}); + $.jGrowl(aActErr[verb] + '
(' + aErrType['netErr'] + ')', {sticky: false, theme: 'info', life: 5000}); }); } diff --git a/view/theme/frio/templates/js_strings.tpl b/view/theme/frio/templates/js_strings.tpl index 540009c82d..39445a0ac1 100644 --- a/view/theme/frio/templates/js_strings.tpl +++ b/view/theme/frio/templates/js_strings.tpl @@ -10,14 +10,13 @@ They are loaded into the html so that js functions can use them *}} 'blockAuthor' : "{{$blockAuthor|escape:'javascript' nofilter}}", 'ignoreAuthor' : "{{$ignoreAuthor|escape:'javascript' nofilter}}", }; - var aActNetErr = { - 'like' : "{{$likeNetError}}", - 'dislike' : "{{$dislikeNetError}}", - 'announce' : "{{$annonNetError}}", + var aActErr = { + 'like' : "{{$likeError}}", + 'dislike' : "{{$dislikeError}}", + 'announce' : "{{$announceError}}", }; - var aActSrvErr = { - 'like' : "{{$likeSrvError}}", - 'dislike' : "{{$dislikeSrvError}}", - 'announce' : "{{$annonSrvError}}", + var aErrType = { + 'srvErr' : "{{$srvError}}", + 'netErr' : "{{$netError}}", };