Add missing activity toggle capability to photos
This commit is contained in:
parent
8b3ab4e6bb
commit
4370d0b967
3 changed files with 38 additions and 19 deletions
|
@ -1361,17 +1361,6 @@ function photos_content(App $a)
|
|||
$tpl = Renderer::getMarkupTemplate('photo_item.tpl');
|
||||
$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 (($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);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
|
||||
<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}}
|
||||
<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}}
|
||||
<img id="like-rotator-{{$id}}" class="like-rotator" src="images/rotator.gif" alt="{{$wait}}" title="{{$wait}}" style="display: none;" />
|
||||
</div>
|
||||
|
|
|
@ -1,12 +1,20 @@
|
|||
|
||||
<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">
|
||||
<i class="faded-icon page-action fa fa-thumbs-up" aria-hidden="true"></i>
|
||||
<button type="button"
|
||||
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> {{$like}}
|
||||
</button>
|
||||
{{if $dislike}}
|
||||
<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">
|
||||
<i class="faded-icon page-action fa fa-thumbs-down" aria-hidden="true"></i>
|
||||
{{if !$hide_dislike}}
|
||||
<span class="icon-padding"> </span>
|
||||
<button type="button"
|
||||
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> {{$dislike}}
|
||||
</button>
|
||||
{{/if}}
|
||||
<img id="like-rotator-{{$id}}" class="like-rotator" src="images/rotator.gif" alt="{{$wait}}" title="{{$wait}}" style="display: none;" />
|
||||
|
|
Loading…
Reference in a new issue