blog mode - turn the comment link into a button and group with the likes/dislikes

This commit is contained in:
friendica 2014-11-18 16:58:36 -08:00
parent 38d50cabd4
commit 11f0b45a90
2 changed files with 11 additions and 16 deletions

View File

@ -263,26 +263,18 @@ function like_content(&$a) {
else else
killme(); killme();
$r = q("SELECT id FROM item WHERE verb = '%s' AND item_restrict = 0
$r = q("SELECT * FROM item WHERE verb = '%s' AND item_restrict = 0
AND author_xchan = '%s' AND ( parent = %d OR thr_parent = '%s') LIMIT 1", AND author_xchan = '%s' AND ( parent = %d OR thr_parent = '%s') LIMIT 1",
dbesc($activity), dbesc($activity),
dbesc($observer['xchan_hash']), dbesc($observer['xchan_hash']),
intval($item_id), intval($item_id),
dbesc($item['mid']) dbesc($item['mid'])
); );
if($r) { if($r) {
$like_item = $r[0]; // already liked it. Drop that item.
require_once('include/items.php');
// Already liked/disliked it, delete it drop_item($r[0]['id'],false,DROPITEM_PHASE1);
$r = q("UPDATE item SET item_restrict = ( item_restrict & ~%d ), changed = '%s' WHERE id = %d",
intval(ITEM_DELETED),
dbesc(datetime_convert()),
intval($like_item['id'])
);
proc_run('php',"include/notifier.php","like",$like_item['id']);
return; return;
} }

View File

@ -104,7 +104,12 @@
</ul> </ul>
</div> </div>
<div id="like-rotator-{{$item.id}}" class="like-rotator"></div> <div id="like-rotator-{{$item.id}}" class="like-rotator"></div>
<div class="wall-item-tools-left{{if $item.like_count && $item.dislike_count}} btn-group{{/if}}"> <div class="wall-item-tools-left btn-group">
<div class="wall-item-list-comments btn-group"><button class="btn btn-default btn-sm" onclick="window.location.href='{{$item.llink}}'; return false;">{{$item.comment_count_txt}}{{if $item.unseen_comments}}
<span class="unseen-wall-indicator-{{$item.id}}">, {{$item.list_unseen_txt}}{{/if}}</span></button></div>{{if $item.unseen_comments}}<div class="unseen-wall-indicator-{{$item.id}} btn-group"><button class="btn btn-default btn-sm" title="{{$item.markseen}}" onclick="markItemRead({{$item.id}}); return false;"><i class="icon-check"></i></div>{{/if}}
{{if $item.like_count}} {{if $item.like_count}}
<div class="btn-group"> <div class="btn-group">
<button type="button" class="btn btn-default btn-sm wall-item-like dropdown-toggle" data-toggle="dropdown" id="wall-item-like-{{$item.id}}">{{$item.like_count}} {{$item.like_button_label}}</button> <button type="button" class="btn btn-default btn-sm wall-item-like dropdown-toggle" data-toggle="dropdown" id="wall-item-like-{{$item.id}}">{{$item.like_count}} {{$item.like_button_label}}</button>
@ -164,8 +169,6 @@
{{/if}} {{/if}}
</div> </div>
<div class="clear"></div> <div class="clear"></div>
<div class="wall-item-list-comments"><a href="{{$item.llink}}">{{$item.comment_count_txt}}{{if $item.unseen_comments}}
<span class="unseen-wall-indicator-{{$item.id}}">, {{$item.list_unseen_txt}}{{/if}}</span></a>{{if $item.unseen_comments}}<span class="unseen-wall-indicator-{{$item.id}}">&nbsp;&nbsp;&nbsp;<button class="btn btn-default" title="{{$item.markseen}}" onclick="markItemRead({{$item.id}}); return false;"><i class="icon-check"></i></span>{{/if}}</div>
</div> </div>
<div class="wall-item-wrapper-end"></div> <div class="wall-item-wrapper-end"></div>
<div class="wall-item-outside-wrapper-end {{$item.indent}}" ></div> <div class="wall-item-outside-wrapper-end {{$item.indent}}" ></div>