diff --git a/src/App/Page.php b/src/App/Page.php
index e226252124..965c04915c 100644
--- a/src/App/Page.php
+++ b/src/App/Page.php
@@ -253,6 +253,11 @@ class Page implements ArrayAccess
'$touch_icon' => $touch_icon,
'$block_public' => intval($config->get('system', 'block_public')),
'$stylesheets' => $this->stylesheets,
+ '$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/lang/C/messages.po b/view/lang/C/messages.po
index 52888018bc..3c45d36705 100644
--- a/view/lang/C/messages.po
+++ b/view/lang/C/messages.po
@@ -673,7 +673,27 @@ msgid ""
"notifications."
msgstr ""
-#: src/App/Page.php:320
+#: src/App/Page.php:256
+msgid "Like not successfull"
+msgstr ""
+
+#: src/App/Page.php:257
+msgid "Dislike not successfull"
+msgstr ""
+
+#: src/App/Page.php:258
+msgid "Sharing not successfull"
+msgstr ""
+
+#: src/App/Page.php:259
+msgid "Backend error"
+msgstr ""
+
+#: src/App/Page.php:260
+msgid "Network error"
+msgstr ""
+
+#: src/App/Page.php:325
msgid "toggle mobile"
msgstr ""
diff --git a/view/theme/frio/js/theme.js b/view/theme/frio/js/theme.js
index 60aa88ba58..9196858bb7 100644
--- a/view/theme/frio/js/theme.js
+++ b/view/theme/frio/js/theme.js
@@ -764,12 +764,95 @@ function htmlToText(htmlString) {
* @param {boolean} un Whether to perform an activity removal instead of creation
*/
function doActivityItemAction(ident, verb, un) {
- if (verb.indexOf("attend") === 0) {
- $(".item-" + ident + " .button-event:not(#" + verb + "-" + ident + ")").removeClass("active");
+ _verb = un ? 'un' + verb : verb;
+ var thumbsClass = '';
+ switch (verb) {
+ case 'like':
+ thumbsClass = 'fa-thumbs-up';
+ break;
+ case 'dislike':
+ thumbsClass = 'fa-thumbs-down';
+ break;
+ case 'announce':
+ thumbsClass = 'fa-retweet';
}
- $("#" + verb + "-" + ident).toggleClass("active");
-
- doActivityItem(ident, verb, un);
+ if (verb.indexOf('announce') === 0 ) {
+ // Share-Button(s)
+ // remove share-symbol, to replace it by rotator
+ $('button[id^=shareMenuOptions-' + ident.toString() + '] i:first-child').removeClass('fa-share');
+ $('button[id^=announce-' + ident.toString() + '] i:first-child').removeClass('fa-retweet');
+ // avoid multiple rotators on like/share-button if klicked multiple times.
+ if ($('img[id^=waitfor-' + verb + '-' + ident.toString() + ']').length == 0) {
+ // append rotator to the shareMenu-button for small media
+ $('')
+ .attr({id: 'waitfor-' + verb + '-' + ident.toString(), src: 'images/rotator.gif'})
+ .addClass('fa')
+ .appendTo($('button[id^=shareMenuOptions-' + ident.toString() + '] i:first-child' ));
+ }
+ }
+ $('button[id^=' + verb + '-' + ident.toString() + '] i:first-child').removeClass(thumbsClass);
+ // if verb is announce, then one rotator is added above to the shareMedia-dropdown button
+ if ($('button:not(button.dropdown-toggle) img#waitfor-' + verb + '-' + ident.toString()).length == 0) {
+ $('')
+ .attr({id: 'waitfor-' + verb + '-' + ident.toString(), src: 'images/rotator.gif'})
+ .addClass('fa')
+ .appendTo($('button[id^=' + verb + '-' + ident.toString() + '] i:first-child'));
+ }
+ $.post('item/' + ident.toString() + '/activity/' + _verb)
+ .success(function(data){
+ $('img[id^=waitfor-' + verb + '-' + ident.toString() + ']').remove();
+ if (data.status == 'ok') {
+ if (data.verb == 'un' + verb) {
+ // like/dislike buttons
+ $('button[id^=' + verb + '-' + ident.toString() + ']' )
+ .removeClass('active')
+ .attr('onclick', 'doActivityItemAction(' + ident +', "' + verb + '",false )');
+ // link in share-menu
+ $('a[id^=' + verb + '-' + ident.toString() + ']' )
+ .removeClass('active')
+ .attr('href', 'javascript:doActivityItemAction(' + ident +', "' + verb + '",false )');
+ $('a[id^=' + verb + '-' + ident.toString() + '] i:first-child' ).addClass('fa-retweet').removeClass('fa-ban');
+ } else {
+ // like/dislike buttons
+ $('button[id^=' + verb + '-' + ident.toString() + ']' )
+ .addClass('active')
+ .attr('onclick', 'doActivityItemAction(' + ident + ', "' + verb + '", true )');
+ // link in share-menu
+ $('a[id^=' + verb + '-' + ident.toString() + ']' )
+ .addClass('active')
+ .attr('href', 'javascript:doActivityItemAction(' + ident + ', "' + verb + '", true )');
+ $('a[id^=' + verb + '-' + ident.toString() + '] i:first-child' ).removeClass('fa-retweet').addClass('fa-ban');
+ }
+ $('button[id^=' + verb + '-' + ident.toString() + '] i:first-child').addClass(thumbsClass).show();
+ if (verb.indexOf('announce') === 0 ) {
+ // ShareMenuButton
+ $('button[id^=shareMenuOptions-' + ident.toString() + '] i:first-child').addClass('fa-share');
+ if (data.verb == 'un' + verb) {
+ $('button[id^=shareMenuOptions-' + ident.toString() + ']').removeClass('active');
+ } else {
+ $('button[id^=shareMenuOptions-' + ident.toString() + ']').addClass('active');
+ }
+ }
+ } else {
+ /* server-response was not ok. Database-problems or some changes in
+ * data?
+ * reset all buttons
+ */
+ $('img[id^=waitfor-' + verb + '-' + ident.toString() + ']').remove();
+ $('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(aActErr[verb] + '
(' + aErrType['srvErr'] + ')', {sticky: false, theme: 'info', life: 5000});
+ }
+ })
+ .error(function(data){
+ // Server could not be reached successfully
+ $('img[id^=waitfor-' + verb + '-' + ident.toString() + ']').remove();
+ $('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(aActErr[verb] + '
(' + aErrType['netErr'] + ')', {sticky: false, theme: 'info', life: 5000});
+ });
}
// Decodes a hexadecimally encoded binary string
diff --git a/view/theme/frio/templates/js_strings.tpl b/view/theme/frio/templates/js_strings.tpl
index c27921afdb..39445a0ac1 100644
--- a/view/theme/frio/templates/js_strings.tpl
+++ b/view/theme/frio/templates/js_strings.tpl
@@ -10,4 +10,13 @@ They are loaded into the html