1
0
Fork 0

Add missing activity toggle capability to photos

This commit is contained in:
Hypolite Petovan 2020-11-21 11:10:04 -05:00
parent 8b3ab4e6bb
commit 4370d0b967
3 changed files with 38 additions and 19 deletions

View file

@ -1361,17 +1361,6 @@ function photos_content(App $a)
$tpl = Renderer::getMarkupTemplate('photo_item.tpl'); $tpl = Renderer::getMarkupTemplate('photo_item.tpl');
$return_path = DI::args()->getCommand(); $return_path = DI::args()->getCommand();
if ($cmd === 'view' && ($can_post || Security::canWriteToUserWall($owner_uid))) {
$like_tpl = Renderer::getMarkupTemplate('like_noshare.tpl');
$likebuttons = Renderer::replaceMacros($like_tpl, [
'$id' => $link_item['id'],
'$likethis' => DI::l10n()->t("I like this \x28toggle\x29"),
'$dislike' => DI::pConfig()->get(local_user(), 'system', 'hide_dislike') ? '' : DI::l10n()->t("I don't like this \x28toggle\x29"),
'$wait' => DI::l10n()->t('Please wait'),
'$return_path' => DI::args()->getQueryString(),
]);
}
if (!DBA::isResult($items)) { if (!DBA::isResult($items)) {
if (($can_post || Security::canWriteToUserWall($owner_uid))) { if (($can_post || Security::canWriteToUserWall($owner_uid))) {
/* /*
@ -1534,6 +1523,28 @@ function photos_content(App $a)
} }
} }
$responses = [];
foreach ($conv_responses as $verb => $activity) {
if (isset($activity[$link_item['uri']])) {
$responses[$verb] = $activity[$link_item['uri']];
}
}
if ($cmd === 'view' && ($can_post || Security::canWriteToUserWall($owner_uid))) {
$like_tpl = Renderer::getMarkupTemplate('like_noshare.tpl');
$likebuttons = Renderer::replaceMacros($like_tpl, [
'$id' => $link_item['id'],
'$like' => DI::l10n()->t('Like'),
'$like_title' => DI::l10n()->t('I like this (toggle)'),
'$dislike' => DI::l10n()->t('Dislike'),
'$wait' => DI::l10n()->t('Please wait'),
'$dislike_title' => DI::l10n()->t('I don\'t like this (toggle)'),
'$hide_dislike' => DI::pConfig()->get(local_user(), 'system', 'hide_dislike'),
'$responses' => $responses,
'$return_path' => DI::args()->getQueryString(),
]);
}
$paginate = $pager->renderFull($total); $paginate = $pager->renderFull($total);
} }

View file

@ -1,8 +1,8 @@
<div class="wall-item-like-buttons" id="wall-item-like-buttons-{{$id}}"> <div class="wall-item-like-buttons" id="wall-item-like-buttons-{{$id}}">
<a href="#" class="icon like" title="{{$likethis}}" onclick="dolike({{$id}},'like'); return false"></a> <a href="#" class="icon like" title="{{$like_title}}" onclick="dolike({{$id}}, 'like'{{if $responses.like.self}}, true{{/if}}); return false"></a>
{{if $dislike}} {{if $dislike}}
<a href="#" class="icon dislike" title="{{$dislike}}" onclick="dolike({{$id}},'dislike'); return false"></a> <a href="#" class="icon dislike" title="{{$dislike_title}}" onclick="dolike({{$id}}, 'dislike'{{if $responses.dislike.self}}, true{{/if}}); return false"></a>
{{/if}} {{/if}}
<img id="like-rotator-{{$id}}" class="like-rotator" src="images/rotator.gif" alt="{{$wait}}" title="{{$wait}}" style="display: none;" /> <img id="like-rotator-{{$id}}" class="like-rotator" src="images/rotator.gif" alt="{{$wait}}" title="{{$wait}}" style="display: none;" />
</div> </div>

View file

@ -1,12 +1,20 @@
<div class="wall-item-actions" id="wall-item-like-buttons-{{$id}}"> <div class="wall-item-actions" id="wall-item-like-buttons-{{$id}}">
<button type="button" class="btn-link button-likes" id="like-{{$id}}" title="{{$likethis}}" onclick="dolike({{$id}},'like'); return false;" data-toggle="button"> <button type="button"
<i class="faded-icon page-action fa fa-thumbs-up" aria-hidden="true"></i> class="btn-link button-likes{{if $responses.like.self}} active" aria-pressed="true{{/if}}" id="like-{{$id}}"
title="{{$like_title}}"
onclick="doLikeAction({{$id}}, 'like'{{if $responses.like.self}}, true{{/if}});"
data-toggle="button">
<i class="fa fa-thumbs-up" aria-hidden="true"></i>&nbsp;{{$like}}
</button> </button>
{{if $dislike}} {{if !$hide_dislike}}
<span class="icon-padding"> </span> <span class="icon-padding"> </span>
<button type="button" class="btn-link button-likes" id="dislike-{{$id}}" title="{{$dislike}}" onclick="dolike({{$id}},'dislike'); return false;" data-toggle="button"> <button type="button"
<i class="faded-icon page-action fa fa-thumbs-down" aria-hidden="true"></i> class="btn-link button-likes{{if $responses.dislike.self}} active" aria-pressed="true{{/if}}"
id="dislike-{{$id}}"
title="{{$dislike_title}}"
onclick="doLikeAction({{$id}}, 'dislike'{{if $responses.dislike.self}}, true{{/if}});"
data-toggle="button"><i class="fa fa-thumbs-down" aria-hidden="true"></i>&nbsp;{{$dislike}}
</button> </button>
{{/if}} {{/if}}
<img id="like-rotator-{{$id}}" class="like-rotator" src="images/rotator.gif" alt="{{$wait}}" title="{{$wait}}" style="display: none;" /> <img id="like-rotator-{{$id}}" class="like-rotator" src="images/rotator.gif" alt="{{$wait}}" title="{{$wait}}" style="display: none;" />