Merge pull request #8697 from MrPetovan/task/8691-like-links-one-way

Make like links one way
This commit is contained in:
Michael Vogel 2020-05-29 15:33:24 +02:00 committed by GitHub
commit 235f4eaa89
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
16 changed files with 137 additions and 102 deletions

View file

@ -183,6 +183,8 @@ function display_content(App $a, $update = false, $update_uid = 0)
$item = null; $item = null;
$force = (bool)($_REQUEST['force'] ?? false);
if ($update) { if ($update) {
$item_id = $_REQUEST['item_id']; $item_id = $_REQUEST['item_id'];
$item = Item::selectFirst(['uid', 'parent', 'parent-uri'], ['id' => $item_id]); $item = Item::selectFirst(['uid', 'parent', 'parent-uri'], ['id' => $item_id]);
@ -281,7 +283,7 @@ function display_content(App $a, $update = false, $update_uid = 0)
} }
// We need the editor here to be able to reshare an item. // We need the editor here to be able to reshare an item.
if ($is_owner) { if ($is_owner && !$update) {
$x = [ $x = [
'is_owner' => true, 'is_owner' => true,
'allow_location' => $a->user['allow_location'], 'allow_location' => $a->user['allow_location'],
@ -304,7 +306,7 @@ function display_content(App $a, $update = false, $update_uid = 0)
$unseen = false; $unseen = false;
} }
if ($update && !$unseen) { if ($update && !$unseen && !$force) {
return ''; return '';
} }

View file

@ -2946,39 +2946,6 @@ class Item
return false; return false;
} }
switch ($verb) {
case 'like':
case 'unlike':
$activity = Activity::LIKE;
break;
case 'dislike':
case 'undislike':
$activity = Activity::DISLIKE;
break;
case 'attendyes':
case 'unattendyes':
$activity = Activity::ATTEND;
break;
case 'attendno':
case 'unattendno':
$activity = Activity::ATTENDNO;
break;
case 'attendmaybe':
case 'unattendmaybe':
$activity = Activity::ATTENDMAYBE;
break;
case 'follow':
case 'unfollow':
$activity = Activity::FOLLOW;
break;
default:
Logger::log('like: unknown verb ' . $verb . ' for item ' . $item_id);
return false;
}
// Enable activity toggling instead of on/off
$event_verb_flag = $activity === Activity::ATTEND || $activity === Activity::ATTENDNO || $activity === Activity::ATTENDMAYBE;
Logger::log('like: verb ' . $verb . ' item ' . $item_id); Logger::log('like: verb ' . $verb . ' item ' . $item_id);
$item = self::selectFirst(self::ITEM_FIELDLIST, ['`id` = ? OR `uri` = ?', $item_id, $item_id]); $item = self::selectFirst(self::ITEM_FIELDLIST, ['`id` = ? OR `uri` = ?', $item_id, $item_id]);
@ -3027,9 +2994,44 @@ class Item
} }
} }
$activity = null;
switch ($verb) {
case 'like':
case 'unlike':
$activity = Activity::LIKE;
break;
case 'dislike':
case 'undislike':
$activity = Activity::DISLIKE;
break;
case 'attendyes':
case 'unattendyes':
$activity = Activity::ATTEND;
break;
case 'attendno':
case 'unattendno':
$activity = Activity::ATTENDNO;
break;
case 'attendmaybe':
case 'unattendmaybe':
$activity = Activity::ATTENDMAYBE;
break;
case 'follow':
case 'unfollow':
$activity = Activity::FOLLOW;
break;
default:
Logger::log('like: unknown verb ' . $verb . ' for item ' . $item_id);
return false;
}
$mode = Strings::startsWith($verb, 'un') ? 'delete' : 'create';
// Enable activity toggling instead of on/off
$event_verb_flag = $activity === Activity::ATTEND || $activity === Activity::ATTENDNO || $activity === Activity::ATTENDMAYBE;
// Look for an existing verb row // Look for an existing verb row
// event participation are essentially radio toggles. If you make a subsequent choice, // Event participation activities are mutually exclusive, only one of them can exist at all times.
// we need to eradicate your first choice.
if ($event_verb_flag) { if ($event_verb_flag) {
$verbs = [Activity::ATTEND, Activity::ATTENDNO, Activity::ATTENDMAYBE]; $verbs = [Activity::ATTEND, Activity::ATTENDNO, Activity::ATTENDMAYBE];
@ -3044,20 +3046,43 @@ class Item
$condition = ['vid' => $vids, 'deleted' => false, 'gravity' => GRAVITY_ACTIVITY, $condition = ['vid' => $vids, 'deleted' => false, 'gravity' => GRAVITY_ACTIVITY,
'author-id' => $author_id, 'uid' => $item['uid'], 'thr-parent' => $item_uri]; 'author-id' => $author_id, 'uid' => $item['uid'], 'thr-parent' => $item_uri];
$like_item = self::selectFirst(['id', 'guid', 'verb'], $condition); $like_item = self::selectFirst(['id', 'guid', 'verb'], $condition);
// If it exists, mark it as deleted
if (DBA::isResult($like_item)) { if (DBA::isResult($like_item)) {
self::markForDeletionById($like_item['id']); /**
* Truth table for existing activities
*
* | Inputs || Outputs |
* |----------------------------||-------------------|
* | Mode | Event | Same verb || Delete? | Return? |
* |--------|-------|-----------||---------|---------|
* | create | Yes | Yes || No | Yes |
* | create | Yes | No || Yes | No |
* | create | No | Yes || No | Yes |
* | create | No | No || N/A† |
* | delete | Yes | Yes || Yes | N/A‡ |
* | delete | Yes | No || No | N/A‡ |
* | delete | No | Yes || Yes | N/A‡ |
* | delete | No | No || N/A† |
* |--------|-------|-----------||---------|---------|
* | A | B | C || A xor C | !B or C |
*
* Can't happen: It's impossible to find an existing non-event activity without
* the same verb because we are only looking for this single verb.
*
* The "mode = delete" is returning early whether an existing activity was found or not.
*/
if ($mode == 'create' xor $like_item['verb'] == $activity) {
self::markForDeletionById($like_item['id']);
}
if (!$event_verb_flag || $like_item['verb'] == $activity) { if (!$event_verb_flag || $like_item['verb'] == $activity) {
return true; return true;
} }
} }
// Verb is "un-something", just trying to delete existing entries // No need to go further if we aren't creating anything
if (strpos($verb, 'un') === 0) { if ($mode == 'delete') {
return true; return true;
} }

View file

@ -22,6 +22,7 @@
namespace Friendica\Module; namespace Friendica\Module;
use Friendica\BaseModule; use Friendica\BaseModule;
use Friendica\Core\System;
use Friendica\DI; use Friendica\DI;
use Friendica\Model\Item; use Friendica\Model\Item;
use Friendica\Core\Session; use Friendica\Core\Session;
@ -68,5 +69,7 @@ class Like extends BaseModule
DI::baseUrl()->redirect($returnPath . $rand); DI::baseUrl()->redirect($returnPath . $rand);
} }
System::jsonExit(['status' => 'OK']);
} }
} }

View file

@ -380,8 +380,11 @@ class Post
} }
// Disable features that aren't available in several networks // Disable features that aren't available in several networks
if ($buttons["dislike"] && !in_array($item["network"], [Protocol::ACTIVITYPUB, Protocol::DFRN, Protocol::DIASPORA])) { if (!in_array($item["network"], [Protocol::ACTIVITYPUB, Protocol::DFRN, Protocol::DIASPORA])) {
$buttons["dislike"] = false; if ($buttons["dislike"]) {
$buttons["dislike"] = false;
}
$isevent = false; $isevent = false;
$tagger = ''; $tagger = '';
} }

View file

@ -594,15 +594,17 @@ function liveUpdate(src) {
in_progress = true; in_progress = true;
if ($(document).scrollTop() == 0) { let force = force_update || $(document).scrollTop() === 0;
force_update = true;
}
var orgHeight = $("section").height(); var orgHeight = $("section").height();
var udargs = ((netargs.length) ? '/' + netargs : ''); var udargs = ((netargs.length) ? '/' + netargs : '');
var update_url = 'update_' + src + udargs + '&p=' + profile_uid + '&force=' + ((force_update) ? 1 : 0) + '&item=' + update_item; var update_url = 'update_' + src + udargs + '&p=' + profile_uid + '&force=' + (force ? 1 : 0) + '&item=' + update_item;
if (force_update) {
force_update = false;
}
if (getUrlParameter('page')) { if (getUrlParameter('page')) {
update_url += '&page=' + getUrlParameter('page'); update_url += '&page=' + getUrlParameter('page');
@ -614,9 +616,8 @@ function liveUpdate(src) {
update_url += '&max_id=' + getUrlParameter('max_id'); update_url += '&max_id=' + getUrlParameter('max_id');
} }
$.get(update_url,function(data) { $.get(update_url, function(data) {
in_progress = false; in_progress = false;
force_update = false;
update_item = 0; update_item = 0;
$('.wall-item-body', data).imagesLoaded(function() { $('.wall-item-body', data).imagesLoaded(function() {
@ -648,9 +649,15 @@ function imgdull(node) {
// trickery. This still could cause confusion if the "like" ajax call // trickery. This still could cause confusion if the "like" ajax call
// is delayed and NavUpdate runs before it completes. // is delayed and NavUpdate runs before it completes.
function dolike(ident,verb) { /**
* @param {int} ident The id of the relevant item
* @param {string} verb The verb of the action
* @param {boolean} un Whether to perform an activity removal instead of creation
*/
function dolike(ident, verb, un) {
unpause(); unpause();
$('#like-rotator-' + ident.toString()).show(); $('#like-rotator-' + ident.toString()).show();
verb = un ? 'un' + verb : verb;
$.get('like/' + ident.toString() + '?verb=' + verb, NavUpdate); $.get('like/' + ident.toString() + '?verb=' + verb, NavUpdate);
liking = 1; liking = 1;
force_update = true; force_update = true;

View file

@ -77,8 +77,8 @@
<div class="wall-item-tools" id="wall-item-tools-{{$item.id}}"> <div class="wall-item-tools" id="wall-item-tools-{{$item.id}}">
{{if $item.vote}} {{if $item.vote}}
<div class="wall-item-like-buttons" id="wall-item-like-buttons-{{$item.id}}"> <div class="wall-item-like-buttons" id="wall-item-like-buttons-{{$item.id}}">
<a href="#" class="icon like{{if $item.responses.like.self}} active{{/if}}" title="{{$item.vote.like.0}}" onclick="dolike({{$item.id}},'like'); return false"></a> <a href="#" class="icon like{{if $item.responses.like.self}} active{{/if}}" title="{{$item.vote.like.0}}" onclick="dolike({{$item.id}}, 'like'{{if $item.responses.like.self}}, true{{/if}}); return false"></a>
{{if $item.vote.dislike}}<a href="#" class="icon dislike{{if $item.responses.dislike.self}} active{{/if}}" title="{{$item.vote.dislike.0}}" onclick="dolike({{$item.id}},'dislike'); return false"></a>{{/if}} {{if $item.vote.dislike}}<a href="#" class="icon dislike{{if $item.responses.dislike.self}} active{{/if}}" title="{{$item.vote.dislike.0}}" onclick="dolike({{$item.id}},'dislike'{{if $item.responses.dislike.self}}, true{{/if}}); return false"></a>{{/if}}
{{if $item.vote.share}}<a href="#" class="icon recycle wall-item-share-buttons" title="{{$item.vote.share.0}}" onclick="jotShare({{$item.id}}); return false"></a>{{/if}} {{if $item.vote.share}}<a href="#" class="icon recycle wall-item-share-buttons" title="{{$item.vote.share.0}}" onclick="jotShare({{$item.id}}); return false"></a>{{/if}}
<img id="like-rotator-{{$item.id}}" class="like-rotator" src="images/rotator.gif" alt="{{$item.wait}}" title="{{$item.wait}}" style="display: none;" /> <img id="like-rotator-{{$item.id}}" class="like-rotator" src="images/rotator.gif" alt="{{$item.wait}}" title="{{$item.wait}}" style="display: none;" />
</div> </div>
@ -107,9 +107,9 @@
{{/if}} {{/if}}
{{if $item.isevent }} {{if $item.isevent }}
<div class="wall-item-attend-wrapper"> <div class="wall-item-attend-wrapper">
<a href="#" id="attendyes-{{$item.id}}" class="icon attendyes{{if $item.responses.attendyes.self}} active{{/if}}" onclick="dolike({{$item.id}},'attendyes'); return false;" title="{{$item.attend.0}}"></a> <a href="#" id="attendyes-{{$item.id}}" class="icon attendyes{{if $item.responses.attendyes.self}} active{{/if}}" onclick="dolike({{$item.id}}, 'attendyes'{{if $item.responses.attendyes.self}}, true{{/if}}); return false;" title="{{$item.attend.0}}"></a>
<a href="#" id="attendno-{{$item.id}}" class="icon attendno{{if $item.responses.attendno.self}} active{{/if}}" onclick="dolike({{$item.id}},'attendno'); return false;" title="{{$item.attend.1}}"></a> <a href="#" id="attendno-{{$item.id}}" class="icon attendno{{if $item.responses.attendno.self}} active{{/if}}" onclick="dolike({{$item.id}}, 'attendno'{{if $item.responses.attendno.self}}, true{{/if}}); return false;" title="{{$item.attend.1}}"></a>
<a href="#" id="attendmaybe-{{$item.id}}" class="icon attendmaybe{{if $item.responses.attendmaybe.self}} active{{/if}}" onclick="dolike({{$item.id}},'attendmaybe'); return false;" title="{{$item.attend.2}}"></a> <a href="#" id="attendmaybe-{{$item.id}}" class="icon attendmaybe{{if $item.responses.attendmaybe.self}} active{{/if}}" onclick="dolike({{$item.id}}, 'attendmaybe'{{if $item.responses.attendmaybe.self}}, true{{/if}}); return false;" title="{{$item.attend.2}}"></a>
</div> </div>
{{/if}} {{/if}}
<div class="wall-item-delete-wrapper" id="wall-item-delete-wrapper-{{$item.id}}" > <div class="wall-item-delete-wrapper" id="wall-item-delete-wrapper-{{$item.id}}" >

View file

@ -720,22 +720,17 @@ function htmlToText(htmlString) {
* Sends a /like API call and updates the display of the relevant action button * Sends a /like API call and updates the display of the relevant action button
* before the update reloads the item. * before the update reloads the item.
* *
* @param {string} ident The id of the relevant item * @param {int} ident The id of the relevant item
* @param {string} verb The verb of the action * @param {string} verb The verb of the action
* @returns {undefined} * @param {boolean} un Whether to perform an activity removal instead of creation
*/ */
function doLikeAction(ident, verb) { function doLikeAction(ident, verb, un) {
unpause();
if (verb.indexOf('attend') === 0) { if (verb.indexOf('attend') === 0) {
$('.item-' + ident + ' .button-event:not(#' + verb + '-' + ident + ')').removeClass('active'); $('.item-' + ident + ' .button-event:not(#' + verb + '-' + ident + ')').removeClass('active');
} }
$('#' + verb + '-' + ident).toggleClass('active'); $('#' + verb + '-' + ident).toggleClass('active');
$('#like-rotator-' + ident.toString()).show();
$.get('like/' + ident.toString() + '?verb=' + verb, NavUpdate ); dolike(ident, verb, un);
liking = 1;
force_update = true;
update_item = ident.toString();
} }
// Decodes a hexadecimally encoded binary string // Decodes a hexadecimally encoded binary string

View file

@ -144,14 +144,14 @@
{{* Buttons for like and dislike *}} {{* Buttons for like and dislike *}}
{{if $item.vote}} {{if $item.vote}}
{{if $item.vote.like}} {{if $item.vote.like}}
<button type="button" class="btn btn-defaultbutton-likes{{if $item.responses.like.self}} active" aria-pressed="true{{/if}}" id="like-{{$item.id}}" title="{{$item.vote.like.0}}" onclick="doLikeAction({{$item.id}}, 'like');">{{$item.vote.like.0}}</button> <button type="button" class="btn btn-defaultbutton-likes{{if $item.responses.like.self}} active" aria-pressed="true{{/if}}" id="like-{{$item.id}}" title="{{$item.vote.like.0}}" onclick="doLikeAction({{$item.id}}, 'like'{{if $item.responses.like.self}}, true{{/if}});">{{$item.vote.like.0}}</button>
{{/if}} {{/if}}
{{if $item.vote.like AND $item.vote.dislike}} {{if $item.vote.like AND $item.vote.dislike}}
<span role="presentation" class="separator">•</span> <span role="presentation" class="separator">•</span>
{{/if}} {{/if}}
{{if $item.vote.dislike}} {{if $item.vote.dislike}}
<button type="button" class="btn btn-defaultbutton-likes{{if $item.responses.like.self}} active" aria-pressed="true{{/if}}" id="dislike-{{$item.id}}" title="{{$item.vote.dislike.0}}" onclick="doLikeAction({{$item.id}}, 'dislike');">{{$item.vote.dislike.0}}</button> <button type="button" class="btn btn-defaultbutton-likes{{if $item.responses.like.self}} active" aria-pressed="true{{/if}}" id="dislike-{{$item.id}}" title="{{$item.vote.dislike.0}}" onclick="doLikeAction({{$item.id}}, 'dislike'{{if $item.responses.dislike.self}}, true{{/if}});">{{$item.vote.dislike.0}}</button>
{{/if}} {{/if}}
{{if ($item.vote.like OR $item.vote.dislike) AND $item.comment}} {{if ($item.vote.like OR $item.vote.dislike) AND $item.comment}}
<span role="presentation" class="separator">•</span> <span role="presentation" class="separator">•</span>
@ -249,9 +249,9 @@
{{* Event attendance buttons *}} {{* Event attendance buttons *}}
{{if $item.isevent}} {{if $item.isevent}}
<span class="vote-event"> <span class="vote-event">
<button type="button" class="btn btn-defaultbutton-event{{if $item.responses.attendyes.self}} active" aria-pressed="true{{/if}}" id="attendyes-{{$item.id}}" title="{{$item.attend.0}}" onclick="doLikeAction({{$item.id}}, 'attendyes');"><i class="fa fa-check" aria-hidden="true"><span class="sr-only">{{$item.attend.0}}</span></i></button> <button type="button" class="btn btn-defaultbutton-event{{if $item.responses.attendyes.self}} active" aria-pressed="true{{/if}}" id="attendyes-{{$item.id}}" title="{{$item.attend.0}}" onclick="doLikeAction({{$item.id}}, 'attendyes'{{if $item.responses.attendyes.self}}, true{{/if}});"><i class="fa fa-check" aria-hidden="true"><span class="sr-only">{{$item.attend.0}}</span></i></button>
<button type="button" class="btn btn-defaultbutton-event{{if $item.responses.attendno.self}} active" aria-pressed="true{{/if}}" id="attendno-{{$item.id}}" title="{{$item.attend.1}}" onclick="doLikeAction({{$item.id}}, 'attendno');"><i class="fa fa-times" aria-hidden="true"><span class="sr-only">{{$item.attend.1}}</span></i></button> <button type="button" class="btn btn-defaultbutton-event{{if $item.responses.attendno.self}} active" aria-pressed="true{{/if}}" id="attendno-{{$item.id}}" title="{{$item.attend.1}}" onclick="doLikeAction({{$item.id}}, 'attendno'{{if $item.responses.attendno.self}}, true{{/if}});"><i class="fa fa-times" aria-hidden="true"><span class="sr-only">{{$item.attend.1}}</span></i></button>
<button type="button" class="btn btn-defaultbutton-event{{if $item.responses.attendmaybe.self}} active" aria-pressed="true{{/if}}" id="attendmaybe-{{$item.id}}" title="{{$item.attend.2}}" onclick="doLikeAction({{$item.id}}, 'attendmaybe');"><i class="fa fa-question" aria-hidden="true"><span class="sr-only">{{$item.attend.2}}</span></i></button> <button type="button" class="btn btn-defaultbutton-event{{if $item.responses.attendmaybe.self}} active" aria-pressed="true{{/if}}" id="attendmaybe-{{$item.id}}" title="{{$item.attend.2}}" onclick="doLikeAction({{$item.id}}, 'attendmaybe'{{if $item.responses.attendmaybe.self}}, true{{/if}});"><i class="fa fa-question" aria-hidden="true"><span class="sr-only">{{$item.attend.2}}</span></i></button>
</span> </span>
{{/if}} {{/if}}

View file

@ -282,13 +282,13 @@ as the value of $top_child_total (this is done at the end of this file)
{{* Buttons for like and dislike *}} {{* Buttons for like and dislike *}}
{{if $item.vote}} {{if $item.vote}}
{{if $item.vote.like}} {{if $item.vote.like}}
<button type="button" class="btn-link button-likes{{if $item.responses.like.self}} active" aria-pressed="true{{/if}}" id="like-{{$item.id}}" title="{{$item.vote.like.0}}" onclick="doLikeAction({{$item.id}},'like');" data-toggle="button"><i class="fa fa-thumbs-up" aria-hidden="true"></i>&nbsp;{{$item.vote.like.1}}</button> <button type="button" class="btn-link button-likes{{if $item.responses.like.self}} active" aria-pressed="true{{/if}}" id="like-{{$item.id}}" title="{{$item.vote.like.0}}" onclick="doLikeAction({{$item.id}}, 'like'{{if $item.responses.like.self}}, true{{/if}});" data-toggle="button"><i class="fa fa-thumbs-up" aria-hidden="true"></i>&nbsp;{{$item.vote.like.1}}</button>
{{/if}} {{/if}}
{{if $item.vote.like AND $item.vote.dislike}} {{if $item.vote.like AND $item.vote.dislike}}
<span role="presentation" class="separator"></span> <span role="presentation" class="separator"></span>
{{/if}} {{/if}}
{{if $item.vote.dislike}} {{if $item.vote.dislike}}
<button type="button" class="btn-link button-likes{{if $item.responses.dislike.self}} active" aria-pressed="true{{/if}}" id="dislike-{{$item.id}}" title="{{$item.vote.dislike.0}}" onclick="doLikeAction({{$item.id}},'dislike');" data-toggle="button"><i class="fa fa-thumbs-down" aria-hidden="true"></i>&nbsp;{{$item.vote.dislike.1}}</button> <button type="button" class="btn-link button-likes{{if $item.responses.dislike.self}} active" aria-pressed="true{{/if}}" id="dislike-{{$item.id}}" title="{{$item.vote.dislike.0}}" onclick="doLikeAction({{$item.id}}, 'dislike'{{if $item.responses.dislike.self}}, true{{/if}});" data-toggle="button"><i class="fa fa-thumbs-down" aria-hidden="true"></i>&nbsp;{{$item.vote.dislike.1}}</button>
{{/if}} {{/if}}
{{if ($item.vote.like OR $item.vote.dislike) AND $item.comment}} {{if ($item.vote.like OR $item.vote.dislike) AND $item.comment}}
@ -390,9 +390,9 @@ as the value of $top_child_total (this is done at the end of this file)
{{* Event attendance buttons *}} {{* Event attendance buttons *}}
{{if $item.isevent}} {{if $item.isevent}}
<span class="vote-event"> <span class="vote-event">
<button type="button" class="btn btn-xs btn-default button-event{{if $item.responses.attendyes.self}} active" aria-pressed="true{{/if}}" id="attendyes-{{$item.id}}" title="{{$item.attend.0}}" onclick="doLikeAction({{$item.id}},'attendyes');"><i class="fa fa-check" aria-hidden="true"><span class="sr-only">{{$item.attend.0}}</span></i></button> <button type="button" class="btn btn-xs btn-default button-event{{if $item.responses.attendyes.self}} active" aria-pressed="true{{/if}}" id="attendyes-{{$item.id}}" title="{{$item.attend.0}}" onclick="doLikeAction({{$item.id}}, 'attendyes'{{if $item.responses.attendyes.self}}, true{{/if}});"><i class="fa fa-check" aria-hidden="true"><span class="sr-only">{{$item.attend.0}}</span></i></button>
<button type="button" class="btn btn-xs btn-default button-event{{if $item.responses.attendno.self}} active" aria-pressed="true{{/if}}" id="attendno-{{$item.id}}" title="{{$item.attend.1}}" onclick="doLikeAction({{$item.id}},'attendno');"><i class="fa fa-times" aria-hidden="true"><span class="sr-only">{{$item.attend.1}}</span></i></button> <button type="button" class="btn btn-xs btn-default button-event{{if $item.responses.attendno.self}} active" aria-pressed="true{{/if}}" id="attendno-{{$item.id}}" title="{{$item.attend.1}}" onclick="doLikeAction({{$item.id}}, 'attendno'{{if $item.responses.attendno.self}}, true{{/if}});"><i class="fa fa-times" aria-hidden="true"><span class="sr-only">{{$item.attend.1}}</span></i></button>
<button type="button" class="btn btn-xs btn-default button-event{{if $item.responses.attendmaybe.self}} active" aria-pressed="true{{/if}}" id="attendmaybe-{{$item.id}}" title="{{$item.attend.2}}" onclick="doLikeAction({{$item.id}},'attendmaybe');"><i class="fa fa-question" aria-hidden="true"><span class="sr-only">{{$item.attend.2}}</span></i></button> <button type="button" class="btn btn-xs btn-default button-event{{if $item.responses.attendmaybe.self}} active" aria-pressed="true{{/if}}" id="attendmaybe-{{$item.id}}" title="{{$item.attend.2}}" onclick="doLikeAction({{$item.id}}, 'attendmaybe'{{if $item.responses.attendmaybe.self}}, true{{/if}});"><i class="fa fa-question" aria-hidden="true"><span class="sr-only">{{$item.attend.2}}</span></i></button>
</span> </span>
{{/if}} {{/if}}
@ -409,10 +409,10 @@ as the value of $top_child_total (this is done at the end of this file)
{{if $item.vote}} {{if $item.vote}}
<div class="btn-group" role="group"> <div class="btn-group" role="group">
{{if $item.vote.like}} {{if $item.vote.like}}
<button type="button" class="btn btn-sm button-likes{{if $item.responses.like.self}} active" aria-pressed="true{{/if}}" id="like-{{$item.id}}" title="{{$item.vote.like.0}}" onclick="doLikeAction({{$item.id}},'like');" data-toggle="button""><i class="fa fa-thumbs-up" aria-hidden="true"></i></button> <button type="button" class="btn btn-sm button-likes{{if $item.responses.like.self}} active" aria-pressed="true{{/if}}" id="like-{{$item.id}}" title="{{$item.vote.like.0}}" onclick="doLikeAction({{$item.id}}, 'like'{{if $item.responses.like.self}}, true{{/if}});" data-toggle="button"><i class="fa fa-thumbs-up" aria-hidden="true"></i></button>
{{/if}} {{/if}}
{{if $item.vote.dislike}} {{if $item.vote.dislike}}
<button type="button" class="btn btn-sm button-likes{{if $item.responses.dislike.self}} active" aria-pressed="true{{/if}}" id="dislike-{{$item.id}}" title="{{$item.vote.dislike.0}}" onclick="doLikeAction({{$item.id}},'dislike');" data-toggle="button"><i class="fa fa-thumbs-down" aria-hidden="true"></i></button> <button type="button" class="btn btn-sm button-likes{{if $item.responses.dislike.self}} active" aria-pressed="true{{/if}}" id="dislike-{{$item.id}}" title="{{$item.vote.dislike.0}}" onclick="doLikeAction({{$item.id}}, 'dislike'{{if $item.responses.dislike.self}}, true{{/if}});" data-toggle="button"><i class="fa fa-thumbs-down" aria-hidden="true"></i></button>
{{/if}} {{/if}}
</div> </div>
{{/if}} {{/if}}
@ -441,9 +441,9 @@ as the value of $top_child_total (this is done at the end of this file)
{{* Event attendance buttons *}} {{* Event attendance buttons *}}
{{if $item.isevent}} {{if $item.isevent}}
<div class="btn-group" role="group"> <div class="btn-group" role="group">
<button type="button" class="btn btn-sm btn-default button-event{{if $item.responses.attendyes.self}} active" aria-pressed="true{{/if}}" id="attendyes-{{$item.id}}" title="{{$item.attend.0}}" onclick="doLikeAction({{$item.id}},'attendyes');"><i class="fa fa-check" aria-hidden="true"><span class="sr-only">{{$item.attend.0}}</span></i></button> <button type="button" class="btn btn-sm btn-default button-event{{if $item.responses.attendyes.self}} active" aria-pressed="true{{/if}}" id="attendyes-{{$item.id}}" title="{{$item.attend.0}}" onclick="doLikeAction({{$item.id}}, 'attendyes'{{if $item.responses.attendyes.self}}, true{{/if}});"><i class="fa fa-check" aria-hidden="true"><span class="sr-only">{{$item.attend.0}}</span></i></button>
<button type="button" class="btn btn-sm btn-default button-event{{if $item.responses.attendno.self}} active" aria-pressed="true{{/if}}" id="attendno-{{$item.id}}" title="{{$item.attend.1}}" onclick="doLikeAction({{$item.id}},'attendno');"><i class="fa fa-times" aria-hidden="true"><span class="sr-only">{{$item.attend.1}}</span></i></button> <button type="button" class="btn btn-sm btn-default button-event{{if $item.responses.attendno.self}} active" aria-pressed="true{{/if}}" id="attendno-{{$item.id}}" title="{{$item.attend.1}}" onclick="doLikeAction({{$item.id}}, 'attendno'{{if $item.responses.attendno.self}}, true{{/if}});"><i class="fa fa-times" aria-hidden="true"><span class="sr-only">{{$item.attend.1}}</span></i></button>
<button type="button" class="btn btn-sm btn-default button-event{{if $item.responses.attendmaybe.self}} active" aria-pressed="true{{/if}}" id="attendmaybe-{{$item.id}}" title="{{$item.attend.2}}" onclick="doLikeAction({{$item.id}},'attendmaybe');"><i class="fa fa-question" aria-hidden="true"><span class="sr-only">{{$item.attend.2}}</span></i></button> <button type="button" class="btn btn-sm btn-default button-event{{if $item.responses.attendmaybe.self}} active" aria-pressed="true{{/if}}" id="attendmaybe-{{$item.id}}" title="{{$item.attend.2}}" onclick="doLikeAction({{$item.id}}, 'attendmaybe'{{if $item.responses.attendmaybe.self}}, true{{/if}});"><i class="fa fa-question" aria-hidden="true"><span class="sr-only">{{$item.attend.2}}</span></i></button>
</div> </div>
{{/if}} {{/if}}

View file

@ -39,8 +39,8 @@
{{/if}} {{/if}}
{{if $vote}} {{if $vote}}
<a href="#" id="like-{{$id}}"{{if $item.responses.like.self}} class="active{{/if}}" title="{{$vote.like.0}}" onclick="dolike({{$id}},'like'); return false">{{$vote.like.1}}</a> <a href="#" id="like-{{$id}}"{{if $item.responses.like.self}} class="active{{/if}}" title="{{$vote.like.0}}" onclick="dolike({{$id}}, 'like'{{if $item.responses.like.self}}, true{{/if}}); return false">{{$vote.like.1}}</a>
<a href="#" id="dislike-{{$id}}"{{if $item.responses.dislike.self}} class="active{{/if}}" title="{{$vote.dislike.0}}" onclick="dolike({{$id}},'dislike'); return false">{{$vote.dislike.1}}</a> <a href="#" id="dislike-{{$id}}"{{if $item.responses.dislike.self}} class="active{{/if}}" title="{{$vote.dislike.0}}" onclick="dolike({{$id}},'dislike'{{if $item.responses.dislike.self}}, true{{/if}}); return false">{{$vote.dislike.1}}</a>
{{/if}} {{/if}}
{{if $vote.share}} {{if $vote.share}}

View file

@ -54,10 +54,10 @@
{{/if}} {{/if}}
{{if $item.vote.like}} {{if $item.vote.like}}
<a href="#" id="like-{{$item.id}}"{{if $item.responses.like.self}} class="active{{/if}}" title="{{$item.vote.like.0}}" onclick="dolike({{$item.id}},'like'); return false">{{$item.vote.like.1}}</a> <a href="#" id="like-{{$item.id}}"{{if $item.responses.like.self}} class="active{{/if}}" title="{{$item.vote.like.0}}" onclick="dolike({{$item.id}}, 'like'{{if $item.responses.like.self}}, true{{/if}}); return false">{{$item.vote.like.1}}</a>
{{/if}} {{/if}}
{{if $item.vote.dislike}} {{if $item.vote.dislike}}
<a href="#" id="dislike-{{$item.id}}"{{if $item.responses.dislike.self}} class="active{{/if}}" title="{{$item.vote.dislike.0}}" onclick="dolike({{$item.id}},'dislike'); return false">{{$item.vote.dislike.1}}</a> <a href="#" id="dislike-{{$item.id}}"{{if $item.responses.dislike.self}} class="active{{/if}}" title="{{$item.vote.dislike.0}}" onclick="dolike({{$item.id}}, 'dislike'{{if $item.responses.dislike.self}}, true{{/if}}); return false">{{$item.vote.dislike.1}}</a>
{{/if}} {{/if}}
{{if $item.vote.share}} {{if $item.vote.share}}

View file

@ -118,9 +118,9 @@
{{/if}} {{/if}}
{{if $item.vote}} {{if $item.vote}}
<a href="#" id="like-{{$item.id}}"{{if $item.responses.like.self}} class="active{{/if}}" title="{{$item.vote.like.0}}" onclick="dolike({{$item.id}},'like'); return false">{{$item.vote.like.1}}</a> <a href="#" id="like-{{$item.id}}"{{if $item.responses.like.self}} class="active{{/if}}" title="{{$item.vote.like.0}}" onclick="dolike({{$item.id}}, 'like'{{if $item.responses.like.self}}, true{{/if}}); return false">{{$item.vote.like.1}}</a>
{{if $item.vote.dislike}} {{if $item.vote.dislike}}
<a href="#" id="dislike-{{$item.id}}"{{if $item.responses.dislike.self}} class="active{{/if}}" title="{{$item.vote.dislike.0}}" onclick="dolike({{$item.id}},'dislike'); return false">{{$item.vote.dislike.1}}</a> <a href="#" id="dislike-{{$item.id}}"{{if $item.responses.dislike.self}} class="active{{/if}}" title="{{$item.vote.dislike.0}}" onclick="dolike({{$item.id}}, 'dislike'{{if $item.responses.dislike.self}}, true{{/if}}); return false">{{$item.vote.dislike.1}}</a>
{{/if}} {{/if}}
{{if $item.vote.share}} {{if $item.vote.share}}
<a href="#" id="share-{{$item.id}}" title="{{$item.vote.share.0}}" onclick="jotShare({{$item.id}}); return false">{{$item.vote.share.1}}</a> <a href="#" id="share-{{$item.id}}" title="{{$item.vote.share.0}}" onclick="jotShare({{$item.id}}); return false">{{$item.vote.share.1}}</a>
@ -129,9 +129,9 @@
{{if $item.isevent}} {{if $item.isevent}}
<div class="clear"></div> <div class="clear"></div>
<div class="wall-item-actions-isevent"> <div class="wall-item-actions-isevent">
<a href="#" id="attendyes-{{$item.id}}"{{if $item.responses.attendyes.self}} class="active{{/if}}" title="{{$item.attend.0}}" onclick="dolike({{$item.id}},'attendyes'); return false;">{{$item.attend.0}}</a> <a href="#" id="attendyes-{{$item.id}}"{{if $item.responses.attendyes.self}} class="active{{/if}}" title="{{$item.attend.0}}" onclick="dolike({{$item.id}}, 'attendyes'{{if $item.responses.attendyes.self}}, true{{/if}}); return false;">{{$item.attend.0}}</a>
<a href="#" id="attendno-{{$item.id}}"{{if $item.responses.attendno.self}} class="active{{/if}}" title="{{$item.attend.1}}" onclick="dolike({{$item.id}},'attendno'); return false;">{{$item.attend.1}}</a> <a href="#" id="attendno-{{$item.id}}"{{if $item.responses.attendno.self}} class="active{{/if}}" title="{{$item.attend.1}}" onclick="dolike({{$item.id}}, 'attendno'{{if $item.responses.attendno.self}}, true{{/if}}); return false;">{{$item.attend.1}}</a>
<a href="#" id="attendmaybe-{{$item.id}}"{{if $item.responses.attendmaybe.self}} class="active{{/if}}" title="{{$item.attend.2}}" onclick="dolike({{$item.id}},'attendmaybe'); return false;">{{$item.attend.2}}</a> <a href="#" id="attendmaybe-{{$item.id}}"{{if $item.responses.attendmaybe.self}} class="active{{/if}}" title="{{$item.attend.2}}" onclick="dolike({{$item.id}}, 'attendmaybe'{{if $item.responses.attendmaybe.self}}, true{{/if}}); return false;">{{$item.attend.2}}</a>
</div> </div>
{{/if}} {{/if}}

View file

@ -91,9 +91,9 @@
{{if $item.vote}} {{if $item.vote}}
<div class="wall-item-like-buttons" id="wall-item-like-buttons-{{$item.id}}"> <div class="wall-item-like-buttons" id="wall-item-like-buttons-{{$item.id}}">
<a href="#" class="icon like{{if $item.responses.like.self}} self{{/if}}" title="{{$item.vote.like.0}}" onclick="dolike({{$item.id}},'like'); return false"></a> <a href="#" class="icon like{{if $item.responses.like.self}} self{{/if}}" title="{{$item.vote.like.0}}" onclick="dolike({{$item.id}}, 'like'{{if $item.responses.like.self}}, true{{/if}}); return false"></a>
{{if $item.vote.dislike}} {{if $item.vote.dislike}}
<a href="#" class="icon dislike{{if $item.responses.dislike.self}} self{{/if}}" title="{{$item.vote.dislike.0}}" onclick="dolike({{$item.id}},'dislike'); return false"></a> <a href="#" class="icon dislike{{if $item.responses.dislike.self}} self{{/if}}" title="{{$item.vote.dislike.0}}" onclick="dolike({{$item.id}}, 'dislike'{{if $item.responses.dislike.self}}, true{{/if}}); return false"></a>
{{/if}} {{/if}}
{{if $item.vote.share}} {{if $item.vote.share}}
<a href="#" class="icon recycle wall-item-share-buttons" title="{{$item.vote.share.0}}" onclick="jotShare({{$item.id}}); return false"></a> {{/if}} <a href="#" class="icon recycle wall-item-share-buttons" title="{{$item.vote.share.0}}" onclick="jotShare({{$item.id}}); return false"></a> {{/if}}

View file

@ -46,8 +46,8 @@
{{/if}} {{/if}}
{{if $vote}} {{if $vote}}
<a href="#" id="like-{{$id}}"{{if $item.responses.like.self}} class="active"{{/if}} title="{{$vote.like.0}}" onclick="dolike({{$id}},'like'); return false">{{$vote.like.1}}</a> <a href="#" id="like-{{$id}}"{{if $item.responses.like.self}} class="active"{{/if}} title="{{$vote.like.0}}" onclick="dolike({{$id}}, 'like'{{if $item.responses.like.self}}, true{{/if}}); return false">{{$vote.like.1}}</a>
<a href="#" id="dislike-{{$id}}"{{if $item.responses.dislike.self}} class="active"{{/if}} title="{{$vote.dislike.0}}" onclick="dolike({{$id}},'dislike'); return false">{{$vote.dislike.1}}</a> <a href="#" id="dislike-{{$id}}"{{if $item.responses.dislike.self}} class="active"{{/if}} title="{{$vote.dislike.0}}" onclick="dolike({{$id}}, 'dislike'{{if $item.responses.dislike.self}}, true{{/if}}); return false">{{$vote.dislike.1}}</a>
{{/if}} {{/if}}
{{if $vote.share}} {{if $vote.share}}

View file

@ -61,10 +61,10 @@
{{/if}} {{/if}}
{{if $item.vote.like}} {{if $item.vote.like}}
<a href="#" id="like-{{$item.id}}"{{if $item.responses.like.self}} class="active"{{/if}} title="{{$item.vote.like.0}}" onclick="dolike({{$item.id}},'like'); return false">{{$item.vote.like.1}}</a> <a href="#" id="like-{{$item.id}}"{{if $item.responses.like.self}} class="active"{{/if}} title="{{$item.vote.like.0}}" onclick="dolike({{$item.id}}, 'like'{{if $item.responses.like.self}}, true{{/if}}); return false">{{$item.vote.like.1}}</a>
{{/if}} {{/if}}
{{if $item.vote.dislike}} {{if $item.vote.dislike}}
<a href="#" id="dislike-{{$item.id}}"{{if $item.responses.dislike.self}} class="active"{{/if}} title="{{$item.vote.dislike.0}}" onclick="dolike({{$item.id}},'dislike'); return false">{{$item.vote.dislike.1}}</a> <a href="#" id="dislike-{{$item.id}}"{{if $item.responses.dislike.self}} class="active"{{/if}} title="{{$item.vote.dislike.0}}" onclick="dolike({{$item.id}}, 'dislike'{{if $item.responses.dislike.self}}, true{{/if}}); return false">{{$item.vote.dislike.1}}</a>
{{/if}} {{/if}}
{{if $item.vote.share}} {{if $item.vote.share}}

View file

@ -114,16 +114,16 @@
{{/if}} {{/if}}
{{if $item.isevent}} {{if $item.isevent}}
<a role="button" id="attendyes-{{$item.id}}"{{if $item.responses.attendyes.self}} class="active"{{/if}} title="{{$item.attend.0}}" onclick="dolike({{$item.id}},'attendyes'); return false;"><i class="icon-ok icon-large"><span class="sr-only">{{$item.attend.0}}</span></i></a> <a role="button" id="attendyes-{{$item.id}}"{{if $item.responses.attendyes.self}} class="active"{{/if}} title="{{$item.attend.0}}" onclick="dolike({{$item.id}}, 'attendyes'{{if $item.responses.attendyes.self}}, true{{/if}}); return false;"><i class="icon-ok icon-large"><span class="sr-only">{{$item.attend.0}}</span></i></a>
<a role="button" id="attendno-{{$item.id}}"{{if $item.responses.attendno.self}} class="active"{{/if}} title="{{$item.attend.1}}" onclick="dolike({{$item.id}},'attendno'); return false;"><i class="icon-remove icon-large"><span class="sr-only">{{$item.attend.1}}</span></i></a> <a role="button" id="attendno-{{$item.id}}"{{if $item.responses.attendno.self}} class="active"{{/if}} title="{{$item.attend.1}}" onclick="dolike({{$item.id}}, 'attendno'{{if $item.responses.attendno.self}}, true{{/if}}); return false;"><i class="icon-remove icon-large"><span class="sr-only">{{$item.attend.1}}</span></i></a>
<a role="button" id="attendmaybe-{{$item.id}}"{{if $item.responses.attendmaybe.self}} class="active"{{/if}} title="{{$item.attend.2}}" onclick="dolike({{$item.id}},'attendmaybe'); return false;"><i class="icon-question icon-large"><span class="sr-only">{{$item.attend.2}}</span></i></a> <a role="button" id="attendmaybe-{{$item.id}}"{{if $item.responses.attendmaybe.self}} class="active"{{/if}} title="{{$item.attend.2}}" onclick="dolike({{$item.id}}, 'attendmaybe'{{if $item.responses.attendmaybe.self}}, true{{/if}}); return false;"><i class="icon-question icon-large"><span class="sr-only">{{$item.attend.2}}</span></i></a>
{{/if}} {{/if}}
{{if $item.vote}} {{if $item.vote}}
{{if $item.vote.like}} {{if $item.vote.like}}
<a role="button" id="like-{{$item.id}}"{{if $item.responses.like.self}} class="active"{{/if}} title="{{$item.vote.like.0}}" onclick="dolike({{$item.id}},'like'); return false"><i class="icon-thumbs-up icon-large"><span class="sr-only">{{$item.vote.like.0}}</span></i></a> <a role="button" id="like-{{$item.id}}"{{if $item.responses.like.self}} class="active"{{/if}} title="{{$item.vote.like.0}}" onclick="dolike({{$item.id}}, 'like'{{if $item.responses.like.self}}, true{{/if}}); return false"><i class="icon-thumbs-up icon-large"><span class="sr-only">{{$item.vote.like.0}}</span></i></a>
{{/if}}{{if $item.vote.dislike}} {{/if}}{{if $item.vote.dislike}}
<a role="button" id="dislike-{{$item.id}}"{{if $item.responses.dislike.self}} class="active"{{/if}} title="{{$item.vote.dislike.0}}" onclick="dolike({{$item.id}},'dislike'); return false"><i class="icon-thumbs-down icon-large"><span class="sr-only">{{$item.vote.dislike.0}}</span></i></a> <a role="button" id="dislike-{{$item.id}}"{{if $item.responses.dislike.self}} class="active"{{/if}} title="{{$item.vote.dislike.0}}" onclick="dolike({{$item.id}}, 'dislike'{{if $item.responses.dislike.self}}, true{{/if}}); return false"><i class="icon-thumbs-down icon-large"><span class="sr-only">{{$item.vote.dislike.0}}</span></i></a>
{{/if}} {{/if}}
{{if $item.vote.share}} {{if $item.vote.share}}
<a role="button" id="share-{{$item.id}}" title="{{$item.vote.share.0}}" onclick="jotShare({{$item.id}}); return false"><i class="icon-retweet icon-large"><span class="sr-only">{{$item.vote.share.0}}</span></i></a> <a role="button" id="share-{{$item.id}}" title="{{$item.vote.share.0}}" onclick="jotShare({{$item.id}}); return false"><i class="icon-retweet icon-large"><span class="sr-only">{{$item.vote.share.0}}</span></i></a>