make errormessages modular and better

This commit is contained in:
Jakobus Schürz 2023-03-11 19:23:48 +01:00
parent 88f21c5892
commit f8018f8dfe
3 changed files with 15 additions and 16 deletions

View File

@ -253,12 +253,11 @@ class Page implements ArrayAccess
'$touch_icon' => $touch_icon, '$touch_icon' => $touch_icon,
'$block_public' => intval($config->get('system', 'block_public')), '$block_public' => intval($config->get('system', 'block_public')),
'$stylesheets' => $this->stylesheets, '$stylesheets' => $this->stylesheets,
'$likeNetError' => $l10n->t('Like not successfull (Network error)'), '$likeError' => $l10n->t('Like not successfull'),
'$dislikeNetError' => $l10n->t('Dislike not successfull (Network error)'), '$dislikeError' => $l10n->t('Dislike not successfull'),
'$annonNetError' => $l10n->t('Sharing not successfull (Network error)'), '$announceError' => $l10n->t('Sharing not successfull'),
'$likeSrvError' => $l10n->t('Like not successfull (Backend error)'), '$srvError' => $l10n->t('Backend error'),
'$dislikeSrvError' => $l10n->t('Dislike not successfull (Backend error)'), '$netError' => $l10n->t('Network error'),
'$annonSrvError' => $l10n->t('Sharing not successfull (Backend error)'),
]) . $this->page['htmlhead']; ]) . $this->page['htmlhead'];
} }

View File

@ -851,7 +851,8 @@ function doActivityItemAction(ident, verb, un) {
$('button[id^=shareMenuOptions-' + ident.toString() + '] i:first-child').addClass('fa-share'); $('button[id^=shareMenuOptions-' + ident.toString() + '] i:first-child').addClass('fa-share');
$('button[id^=' + verb + '-' + ident.toString() + '] i:first-child').addClass(thumbsClass); $('button[id^=' + verb + '-' + ident.toString() + '] i:first-child').addClass(thumbsClass);
$('a[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] + '<br>(' + aErrType['srvErr'] + ')', {sticky: false, theme: 'info', life: 5000});
} }
}) })
.error(function(data){ .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^=shareMenuOptions-' + ident.toString() + '] i:first-child').addClass('fa-share');
$('button[id^=' + verb + '-' + ident.toString() + '] i:first-child').addClass(thumbsClass); $('button[id^=' + verb + '-' + ident.toString() + '] i:first-child').addClass(thumbsClass);
$('a[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] + '<br>(' + aErrType['netErr'] + ')', {sticky: false, theme: 'info', life: 5000});
}); });
} }

View File

@ -10,14 +10,13 @@ They are loaded into the html <head> so that js functions can use them *}}
'blockAuthor' : "{{$blockAuthor|escape:'javascript' nofilter}}", 'blockAuthor' : "{{$blockAuthor|escape:'javascript' nofilter}}",
'ignoreAuthor' : "{{$ignoreAuthor|escape:'javascript' nofilter}}", 'ignoreAuthor' : "{{$ignoreAuthor|escape:'javascript' nofilter}}",
}; };
var aActNetErr = { var aActErr = {
'like' : "{{$likeNetError}}", 'like' : "{{$likeError}}",
'dislike' : "{{$dislikeNetError}}", 'dislike' : "{{$dislikeError}}",
'announce' : "{{$annonNetError}}", 'announce' : "{{$announceError}}",
}; };
var aActSrvErr = { var aErrType = {
'like' : "{{$likeSrvError}}", 'srvErr' : "{{$srvError}}",
'dislike' : "{{$dislikeSrvError}}", 'netErr' : "{{$netError}}",
'announce' : "{{$annonSrvError}}",
}; };
</script> </script>