provide visible star status for starred posts

This commit is contained in:
Mario Vavti 2018-04-13 11:58:12 +02:00
parent 4aaea422bc
commit e04d3c45a4
5 changed files with 30 additions and 62 deletions

View file

@ -238,9 +238,9 @@ class ThreadItem {
'do' => t("Add Star"), 'do' => t("Add Star"),
'undo' => t("Remove Star"), 'undo' => t("Remove Star"),
'toggle' => t("Toggle Star Status"), 'toggle' => t("Toggle Star Status"),
'classdo' => (intval($item['item_starred']) ? "hidden" : ""), 'classdo' => ((intval($item['item_starred'])) ? "hidden" : ""),
'classundo' => (intval($item['item_starred']) ? "" : "hidden"), 'classundo' => ((intval($item['item_starred'])) ? "" : "hidden"),
'isstarred' => (intval($item['item_starred']) ? "starred fa-star" : "unstarred fa-star-o"), 'isstarred' => ((intval($item['item_starred'])) ? true : false),
'starred' => t('starred'), 'starred' => t('starred'),
); );

View file

@ -1724,7 +1724,7 @@ function network_tabs() {
if(feature_enabled(local_channel(),'star_posts')) { if(feature_enabled(local_channel(),'star_posts')) {
$tabs[] = array( $tabs[] = array(
'label' => t('Starred'), 'label' => t('Starred'),
'url'=>z_root() . '/' . $cmd . ((x($_GET,'cid')) ? '/?f=&cid=' . $_GET['cid'] : '') . '&star=1', 'url'=>z_root() . '/' . $cmd . '/?f=' . ((x($_GET,'cid')) ? '&cid=' . $_GET['cid'] : '') . '&star=1',
'sel'=>$starred_active, 'sel'=>$starred_active,
'title' => t('Favourite Posts'), 'title' => t('Favourite Posts'),
); );

View file

@ -1075,18 +1075,21 @@ function dostar(ident) {
if(data.result == 1) { if(data.result == 1) {
$('#starred-' + ident).addClass('starred'); $('#starred-' + ident).addClass('starred');
$('#starred-' + ident).removeClass('unstarred'); $('#starred-' + ident).removeClass('unstarred');
$('#starred-' + ident).addClass('fa-star-full'); $('#starred-' + ident).addClass('fa-star');
$('#starred-' + ident).removeClass('fa-star-o'); $('#starred-' + ident).removeClass('fa-star-o');
$('#star-' + ident).addClass('hidden'); $('#star-' + ident).addClass('hidden');
$('#unstar-' + ident).removeClass('hidden'); $('#unstar-' + ident).removeClass('hidden');
var btn_tpl = '<div class="btn-group" id="star-button-' + ident + '"><button type="button" class="btn btn-outline-secondary btn-sm wall-item-like" onclick="dostar(' + ident + ');"><i class="fa fa-star"></i></button></div>'
$('#wall-item-tools-left-' + ident).prepend(btn_tpl);
} }
else { else {
$('#starred-' + ident).addClass('unstarred'); $('#starred-' + ident).addClass('unstarred');
$('#starred-' + ident).removeClass('starred'); $('#starred-' + ident).removeClass('starred');
$('#starred-' + ident).addClass('fa-star-o'); $('#starred-' + ident).addClass('fa-star-o');
$('#starred-' + ident).removeClass('fa-star-full'); $('#starred-' + ident).removeClass('fa-star');
$('#star-' + ident).removeClass('hidden'); $('#star-' + ident).removeClass('hidden');
$('#unstar-' + ident).addClass('hidden'); $('#unstar-' + ident).addClass('hidden');
$('#star-button-' + ident).remove();
} }
$('#like-rotator-' + ident).hide(); $('#like-rotator-' + ident).hide();
}); });

View file

@ -27,9 +27,9 @@
{{/if}} {{/if}}
{{/if}} {{/if}}
<div class="p-2 clearfix wall-item-head{{if $item.is_new && !$item.title && !$item.event && !$item.is_comment}} wall-item-head-new rounded-top{{/if}}"> <div class="p-2 clearfix wall-item-head{{if $item.is_new && !$item.title && !$item.event && !$item.is_comment}} wall-item-head-new rounded-top{{/if}}">
<div class="wall-item-info" id="wall-item-info-{{$item.id}}" > <div class="wall-item-info " id="wall-item-info-{{$item.id}}" >
<div class="wall-item-photo-wrapper{{if $item.owner_url}} wwfrom{{/if}} h-card p-author" id="wall-item-photo-wrapper-{{$item.id}}" data-toggle="dropdown"> <div class="wall-item-photo-wrapper{{if $item.owner_url}} wwfrom{{/if}} h-card p-author" id="wall-item-photo-wrapper-{{$item.id}}">
<a href="{{$item.profile_url}}" title="{{$item.linktitle}}" class="wall-item-photo-link u-url" id="wall-item-photo-link-{{$item.id}}"><img src="{{$item.thumb}}" class="wall-item-photo{{$item.sparkle}} u-photo p-name" id="wall-item-photo-{{$item.id}}" alt="{{$item.name}}" /></a> <img src="{{$item.thumb}}" class="fakelink wall-item-photo{{$item.sparkle}} u-photo p-name" id="wall-item-photo-{{$item.id}}" alt="{{$item.name}}" data-toggle="dropdown" />
{{if $item.thread_author_menu}} {{if $item.thread_author_menu}}
<div class="dropdown-menu"> <div class="dropdown-menu">
{{foreach $item.thread_author_menu as $mitem}} {{foreach $item.thread_author_menu as $mitem}}
@ -48,7 +48,7 @@
{{/if}} {{/if}}
<div class="wall-item-author"> <div class="wall-item-author">
{{if $item.previewing}}<span class="preview-indicator"><i class="fa fa-eye" title="{{$item.preview_lbl}}"></i></span>&nbsp;{{/if}} {{if $item.previewing}}<span class="preview-indicator"><i class="fa fa-eye" title="{{$item.preview_lbl}}"></i></span>&nbsp;{{/if}}
<a href="#" title="{{$item.linktitle}}" class="wall-item-name-link"><span class="wall-item-name{{$item.sparkle}} dropdown" id="wall-item-name-{{$item.id}}" >{{$item.name}}</span></a>{{if $item.owner_url}}&nbsp;{{$item.via}}&nbsp;<a href="{{$item.owner_url}}" title="{{$item.olinktitle}}" class="wall-item-name-link"><span class="wall-item-name{{$item.osparkle}}" id="wall-item-ownername-{{$item.id}}">{{$item.owner_name}}</span></a>{{/if}} <a href="{{$item.profile_url}}" title="{{$item.linktitle}}" class="wall-item-name-link u-url"><span class="wall-item-name{{$item.sparkle}}" id="wall-item-name-{{$item.id}}" >{{$item.name}}</span></a>{{if $item.owner_url}}&nbsp;{{$item.via}}&nbsp;<a href="{{$item.owner_url}}" title="{{$item.olinktitle}}" class="wall-item-name-link"><span class="wall-item-name{{$item.osparkle}}" id="wall-item-ownername-{{$item.id}}">{{$item.owner_name}}</span></a>{{/if}}
</div> </div>
<div class="wall-item-ago" id="wall-item-ago-{{$item.id}}"> <div class="wall-item-ago" id="wall-item-ago-{{$item.id}}">
{{if $item.verified}}<i class="fa fa-check item-verified" title="{{$item.verified}}"></i>&nbsp;{{elseif $item.forged}}<i class="fa fa-exclamation item-forged" title="{{$item.forged}}"></i>&nbsp;{{/if}}{{if $item.location}}<span class="wall-item-location p-location" id="wall-item-location-{{$item.id}}">{{$item.location}},&nbsp;</span>{{/if}}<span class="autotime" title="{{$item.isotime}}"><time class="dt-published" datetime="{{$item.isotime}}">{{$item.localtime}}</time>{{if $item.editedtime}}&nbsp;{{$item.editedtime}}{{/if}}{{if $item.expiretime}}&nbsp;{{$item.expiretime}}{{/if}}</span>{{if $item.editedtime}}&nbsp;<i class="fa fa-pencil"></i>{{/if}}&nbsp;{{if $item.app}}<span class="item.app">{{$item.str_app}}</span>{{/if}} {{if $item.verified}}<i class="fa fa-check item-verified" title="{{$item.verified}}"></i>&nbsp;{{elseif $item.forged}}<i class="fa fa-exclamation item-forged" title="{{$item.forged}}"></i>&nbsp;{{/if}}{{if $item.location}}<span class="wall-item-location p-location" id="wall-item-location-{{$item.id}}">{{$item.location}},&nbsp;</span>{{/if}}<span class="autotime" title="{{$item.isotime}}"><time class="dt-published" datetime="{{$item.isotime}}">{{$item.localtime}}</time>{{if $item.editedtime}}&nbsp;{{$item.editedtime}}{{/if}}{{if $item.expiretime}}&nbsp;{{$item.expiretime}}{{/if}}</span>{{if $item.editedtime}}&nbsp;<i class="fa fa-pencil"></i>{{/if}}&nbsp;{{if $item.app}}<span class="item.app">{{$item.str_app}}</span>{{/if}}
@ -66,32 +66,9 @@
{{/if}} {{/if}}
{{if $item.has_tags}} {{if $item.has_tags}}
<div class="p-2 wall-item-tools clearfix"> <div class="p-2 wall-item-tools clearfix">
<div class="body-tags"> <div class="body-tags">
<span class="tag">{{$item.mentions}} {{$item.tags}} {{$item.categories}} {{$item.folders}}</span> <span class="tag">{{$item.mentions}} {{$item.tags}} {{$item.categories}} {{$item.folders}}</span>
</div> </div>
{{**
{{if $item.mentions}}
<div class="body-tags" id="item-mentions">
<span class="tag">{{$item.mentions}}</span>
</div>
{{/if}}
{{if $item.tags}}
<div class="body-tags" id="item-tags">
<span class="tag">{{$item.tags}}</span>
</div>
{{/if}}
{{if $item.categories}}
<div class="body-tags" id="item-categories">
<span class="tag p-category">{{$item.categories}}</span>
</div>
{{/if}}
{{if $item.folders}}
<div class="body-tags" id="item-folders">
<span class="tag">{{$item.folders}}</span>
</div>
{{/if}}
**}}
</div> </div>
{{/if}} {{/if}}
<div class="p-2 clearfix wall-item-tools"> <div class="p-2 clearfix wall-item-tools">
@ -187,7 +164,7 @@
<a class="dropdown-item" href="#" onclick="itemAddToCal({{$item.id}}); return false;"><i id="addtocal-{{$item.id}}" class="generic-icons-nav fa fa-fw fa-calendar" title="{{$item.addtocal}}"></i>{{$item.addtocal}}</a> <a class="dropdown-item" href="#" onclick="itemAddToCal({{$item.id}}); return false;"><i id="addtocal-{{$item.id}}" class="generic-icons-nav fa fa-fw fa-calendar" title="{{$item.addtocal}}"></i>{{$item.addtocal}}</a>
{{/if}} {{/if}}
{{if $item.star}} {{if $item.star}}
<a class="dropdown-item" href="#" onclick="dostar({{$item.id}}); return false;"><i id="starred-{{$item.id}}" class="generic-icons-nav fa fa-fw fa-star {{$item.star.isstarred}}" title="{{$item.star.toggle}}"></i>{{$item.star.toggle}}</a> <a class="dropdown-item" href="#" onclick="dostar({{$item.id}}); return false;"><i id="starred-{{$item.id}}" class="generic-icons-nav fa fa-fw{{if $item.star.isstarred}} starred fa-star{{else}} unstarred fa-star-o{{/if}}" title="{{$item.star.toggle}}"></i>{{$item.star.toggle}}</a>
{{/if}} {{/if}}
{{if $item.thread_action_menu}} {{if $item.thread_action_menu}}
{{foreach $item.thread_action_menu as $mitem}} {{foreach $item.thread_action_menu as $mitem}}
@ -207,7 +184,12 @@
</div> </div>
{{if $item.responses || $item.attachments}} {{if $item.responses || $item.attachments}}
<div class="wall-item-tools-left{{if ($item.responses.count > 1) || ($item.responses.count && $item.attachments)}} btn-group{{/if}}"> <div class="wall-item-tools-left btn-group" id="wall-item-tools-left-{{$item.id}}">
{{if $item.star.isstarred}}
<div class="btn-group" id="star-button-{{$item.id}}">
<button type="button" class="btn btn-outline-secondary btn-sm wall-item-like" onclick="dostar({{$item.id}});"><i class="fa fa-star"></i></button>
</div>
{{/if}}
{{if $item.attachments}} {{if $item.attachments}}
<div class="btn-group"> <div class="btn-group">
<button type="button" class="btn btn-outline-secondary btn-sm wall-item-like dropdown-toggle" data-toggle="dropdown" id="attachment-menu-{{$item.id}}"><i class="fa fa-paperclip"></i></button> <button type="button" class="btn btn-outline-secondary btn-sm wall-item-like dropdown-toggle" data-toggle="dropdown" id="attachment-menu-{{$item.id}}"><i class="fa fa-paperclip"></i></button>

View file

@ -28,8 +28,8 @@
{{/if}} {{/if}}
<div class="p-2 clearfix wall-item-head{{if $item.is_new && !$item.title && !$item.event && !$item.is_comment}} wall-item-head-new rounded-top{{/if}}"> <div class="p-2 clearfix wall-item-head{{if $item.is_new && !$item.title && !$item.event && !$item.is_comment}} wall-item-head-new rounded-top{{/if}}">
<div class="wall-item-info" id="wall-item-info-{{$item.id}}" > <div class="wall-item-info" id="wall-item-info-{{$item.id}}" >
<div class="wall-item-photo-wrapper{{if $item.owner_url}} wwfrom{{/if}} h-card p-author" id="wall-item-photo-wrapper-{{$item.id}}" data-toggle="dropdown"> <div class="wall-item-photo-wrapper{{if $item.owner_url}} wwfrom{{/if}} h-card p-author" id="wall-item-photo-wrapper-{{$item.id}}">
<a href="{{$item.profile_url}}" title="{{$item.linktitle}}" class="wall-item-photo-link u-url" id="wall-item-photo-link-{{$item.id}}"><img src="{{$item.thumb}}" class="wall-item-photo{{$item.sparkle}} u-photo p-name" id="wall-item-photo-{{$item.id}}" alt="{{$item.name}}" /></a> <img src="{{$item.thumb}}" class="fakelink wall-item-photo{{$item.sparkle}} u-photo p-name" id="wall-item-photo-{{$item.id}}" alt="{{$item.name}}" data-toggle="dropdown" /></a>
{{if $item.thread_author_menu}} {{if $item.thread_author_menu}}
<div class="dropdown-menu"> <div class="dropdown-menu">
{{foreach $item.thread_author_menu as $mitem}} {{foreach $item.thread_author_menu as $mitem}}
@ -47,7 +47,7 @@
</div> </div>
{{/if}} {{/if}}
<div class="wall-item-author"> <div class="wall-item-author">
<a href="{{$item.profile_url}}" title="{{$item.linktitle}}" class="wall-item-name-link"><span class="wall-item-name{{$item.sparkle}}" id="wall-item-name-{{$item.id}}" >{{$item.name}}</span></a>{{if $item.owner_url}}&nbsp;{{$item.via}}&nbsp;<a href="{{$item.owner_url}}" title="{{$item.olinktitle}}" class="wall-item-name-link"><span class="wall-item-name{{$item.osparkle}}" id="wall-item-ownername-{{$item.id}}">{{$item.owner_name}}</span></a>{{/if}} <a href="{{$item.profile_url}}" title="{{$item.linktitle}}" class="wall-item-name-link u-url"><span class="wall-item-name{{$item.sparkle}}" id="wall-item-name-{{$item.id}}" >{{$item.name}}</span></a>{{if $item.owner_url}}&nbsp;{{$item.via}}&nbsp;<a href="{{$item.owner_url}}" title="{{$item.olinktitle}}" class="wall-item-name-link"><span class="wall-item-name{{$item.osparkle}}" id="wall-item-ownername-{{$item.id}}">{{$item.owner_name}}</span></a>{{/if}}
</div> </div>
<div class="wall-item-ago" id="wall-item-ago-{{$item.id}}"> <div class="wall-item-ago" id="wall-item-ago-{{$item.id}}">
{{if $item.verified}}<i class="fa fa-check item-verified" title="{{$item.verified}}"></i>&nbsp;{{elseif $item.forged}}<i class="fa fa-exclamation item-forged" title="{{$item.forged}}"></i>&nbsp;{{/if}}{{if $item.location}}<span class="wall-item-location p-location" id="wall-item-location-{{$item.id}}">{{$item.location}},&nbsp;</span>{{/if}}<span class="autotime" title="{{$item.isotime}}"><time class="dt-published" datetime="{{$item.isotime}}">{{$item.localtime}}</time>{{if $item.editedtime}}&nbsp;{{$item.editedtime}}{{/if}}{{if $item.expiretime}}&nbsp;{{$item.expiretime}}{{/if}}</span>{{if $item.editedtime}}&nbsp;<i class="fa fa-pencil"></i>{{/if}}&nbsp;{{if $item.app}}<span class="item.app">{{$item.str_app}}</span>{{/if}} {{if $item.verified}}<i class="fa fa-check item-verified" title="{{$item.verified}}"></i>&nbsp;{{elseif $item.forged}}<i class="fa fa-exclamation item-forged" title="{{$item.forged}}"></i>&nbsp;{{/if}}{{if $item.location}}<span class="wall-item-location p-location" id="wall-item-location-{{$item.id}}">{{$item.location}},&nbsp;</span>{{/if}}<span class="autotime" title="{{$item.isotime}}"><time class="dt-published" datetime="{{$item.isotime}}">{{$item.localtime}}</time>{{if $item.editedtime}}&nbsp;{{$item.editedtime}}{{/if}}{{if $item.expiretime}}&nbsp;{{$item.expiretime}}{{/if}}</span>{{if $item.editedtime}}&nbsp;<i class="fa fa-pencil"></i>{{/if}}&nbsp;{{if $item.app}}<span class="item.app">{{$item.str_app}}</span>{{/if}}
@ -67,28 +67,6 @@
<div class="body-tags"> <div class="body-tags">
<span class="tag">{{$item.mentions}} {{$item.tags}} {{$item.categories}} {{$item.folders}}</span> <span class="tag">{{$item.mentions}} {{$item.tags}} {{$item.categories}} {{$item.folders}}</span>
</div> </div>
{{**
{{if $item.mentions}}
<div class="body-tags" id="item-mentions">
<span class="tag">{{$item.mentions}}</span>
</div>
{{/if}}
{{if $item.tags}}
<div class="body-tags" id="item-tags">
<span class="tag">{{$item.tags}}</span>
</div>
{{/if}}
{{if $item.categories}}
<div class="body-tags" id="item-categories">
<span class="tag p-category">{{$item.categories}}</span>
</div>
{{/if}}
{{if $item.folders}}
<div class="body-tags" id="item-folders">
<span class="tag">{{$item.folders}}</span>
</div>
{{/if}}
**}}
</div> </div>
{{/if}} {{/if}}
<div class="p-2 clearfix wall-item-tools"> <div class="p-2 clearfix wall-item-tools">
@ -179,7 +157,7 @@
<a class="dropdown-item" href="#" onclick="itemAddToCal({{$item.id}}); return false;"><i id="addtocal-{{$item.id}}" class="generic-icons-nav fa fa-fw fa-calendar" title="{{$item.addtocal}}"></i>{{$item.addtocal}}</a> <a class="dropdown-item" href="#" onclick="itemAddToCal({{$item.id}}); return false;"><i id="addtocal-{{$item.id}}" class="generic-icons-nav fa fa-fw fa-calendar" title="{{$item.addtocal}}"></i>{{$item.addtocal}}</a>
{{/if}} {{/if}}
{{if $item.star}} {{if $item.star}}
<a class="dropdown-item" href="#" onclick="dostar({{$item.id}}); return false;"><i id="starred-{{$item.id}}" class="generic-icons-nav fa fa-fw fa-star {{$item.star.isstarred}}" title="{{$item.star.toggle}}"></i>{{$item.star.toggle}}</a> <a class="dropdown-item" href="#" onclick="dostar({{$item.id}}); return false;"><i id="starred-{{$item.id}}" class="generic-icons-nav fa fa-fw{{if $item.star.isstarred}} starred fa-star{{else}} unstarred fa-star-o{{/if}}" title="{{$item.star.toggle}}"></i>{{$item.star.toggle}}</a>
{{/if}} {{/if}}
{{if $item.thread_action_menu}} {{if $item.thread_action_menu}}
{{foreach $item.thread_action_menu as $mitem}} {{foreach $item.thread_action_menu as $mitem}}
@ -198,7 +176,12 @@
</div> </div>
</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.unseen_comments || $item.like_count || $item.dislike_count || $item.attachments}} btn-group{{/if}}"> <div class="wall-item-tools-left btn-group" id="wall-item-tools-left-{{$item.id}}">
{{if $item.star.isstarred}}
<div class="btn-group" id="star-button-{{$item.id}}">
<button type="button" class="btn btn-outline-secondary btn-sm wall-item-like" onclick="dostar({{$item.id}});"><i class="fa fa-star"></i></button>
</div>
{{/if}}
{{if $item.attachments}} {{if $item.attachments}}
<div class="btn-group"> <div class="btn-group">
<button type="button" class="btn btn-outline-secondary btn-sm wall-item-like dropdown-toggle" data-toggle="dropdown" id="attachment-menu-{{$item.id}}"><i class="fa fa-paperclip"></i></button> <button type="button" class="btn btn-outline-secondary btn-sm wall-item-like dropdown-toggle" data-toggle="dropdown" id="attachment-menu-{{$item.id}}"><i class="fa fa-paperclip"></i></button>