From: Hypolite Petovan Date: Fri, 24 Mar 2017 02:47:56 +0000 (-0400) Subject: Improve display feedback on like actions X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=85144908fa9cf12594b568f4f0b2d37fa21b6be1;p=friendica.git Improve display feedback on like actions - Move rotator in sight - Preventively change display class before next item update --- diff --git a/view/theme/frio/js/theme.js b/view/theme/frio/js/theme.js index 62cd85df9b..4e8ede07fd 100644 --- a/view/theme/frio/js/theme.js +++ b/view/theme/frio/js/theme.js @@ -617,3 +617,24 @@ function htmlToText(htmlString) { return text; } + +/** + * Sends a /like API call and updates the display of the relevant action button + * before the update reloads the item. + * + * @param {string} ident The id of the relevant item + * @param {string} verb The verb of the action + * @returns {undefined} + */ +function doLikeAction(ident, verb) { + unpause(); + + if (verb.indexOf('attend') === 0) { + $('.item-' + ident + ' .button-event:not(#' + verb + '-' + ident + ')').removeClass('active'); + } + $('#' + verb + '-' + ident).toggleClass('active'); + $('#like-rotator-' + ident.toString()).show(); + $.get('like/' + ident.toString() + '?verb=' + verb, NavUpdate ); + liking = 1; + force_update = true; +} \ No newline at end of file diff --git a/view/theme/frio/templates/search_item.tpl b/view/theme/frio/templates/search_item.tpl index 51a9017c2b..095b38968b 100644 --- a/view/theme/frio/templates/search_item.tpl +++ b/view/theme/frio/templates/search_item.tpl @@ -2,12 +2,11 @@ -
+
{{* Put additional actions in a top-right dropdown menu *}} @@ -170,11 +169,11 @@ {{* Buttons for like and dislike *}} {{if $item.vote}} {{if $item.vote.like}} - + {{/if}} {{if $item.vote.dislike}} - + {{/if}} {{/if}} @@ -189,6 +188,7 @@ {{/if}} {{/if}} +
@@ -196,9 +196,9 @@ {{* Event attendance buttons *}} {{if $item.isevent}}
- - - + + +
{{/if}} diff --git a/view/theme/frio/templates/wall_thread.tpl b/view/theme/frio/templates/wall_thread.tpl index f276ee6f06..08057a1a95 100644 --- a/view/theme/frio/templates/wall_thread.tpl +++ b/view/theme/frio/templates/wall_thread.tpl @@ -68,9 +68,9 @@ as the value of $top_child_total (this is done at the end of this file) {{* Use a different div container in dependence max thread-level = 7 *}} {{if $item.thread_level<7}} -
+
{{else}} -
+
{{/if}}
{{* Put addional actions in a top-right dropdown menu *}} @@ -192,7 +192,6 @@ as the value of $top_child_total (this is done at the end of this file)
{{if $item.location}} @@ -287,13 +286,13 @@ as the value of $top_child_total (this is done at the end of this file) {{* Buttons for like and dislike *}} {{if $item.vote}} {{if $item.vote.like}} - + {{/if}} {{if $item.vote.like AND $item.vote.dislike}} • {{/if}} {{if $item.vote.dislike}} - + {{/if}} {{if ($item.vote.like OR $item.vote.dislike) AND $item.comment}} @@ -315,15 +314,16 @@ as the value of $top_child_total (this is done at the end of this file)
{{* Event attendance buttons *}} {{if $item.isevent}}
- - - + + +
{{/if}}