diff options
author | friendica <info@friendica.com> | 2014-05-18 00:45:02 -0700 |
---|---|---|
committer | friendica <info@friendica.com> | 2014-05-18 00:45:02 -0700 |
commit | e79e8f4adde06315ab71877ec50a07d22fe2ec5b (patch) | |
tree | 5ba85e8d6dacadcfc2789191431e41d4664e7ea3 | |
parent | 070e7cc376ec6465d61a63aa4954969cf9cb9e6e (diff) | |
parent | 89b8bc07ac7178b8ea722f8d1faa2f649faa8c1b (diff) | |
download | volse-hubzilla-e79e8f4adde06315ab71877ec50a07d22fe2ec5b.tar.gz volse-hubzilla-e79e8f4adde06315ab71877ec50a07d22fe2ec5b.tar.bz2 volse-hubzilla-e79e8f4adde06315ab71877ec50a07d22fe2ec5b.zip |
Merge https://github.com/friendica/red into pending_merge
-rwxr-xr-x | boot.php | 2 | ||||
-rw-r--r-- | include/ItemObject.php | 18 | ||||
-rwxr-xr-x | view/tpl/conv_item.tpl | 44 |
3 files changed, 63 insertions, 1 deletions
@@ -347,7 +347,7 @@ define ( 'DROPITEM_PHASE2', 2); * Maximum number of "people who like (or don't like) this" that we will list by name */ -define ( 'MAX_LIKERS', 75); +define ( 'MAX_LIKERS', 10); /** * Communication timeout diff --git a/include/ItemObject.php b/include/ItemObject.php index 475642787..cdb09ecf1 100644 --- a/include/ItemObject.php +++ b/include/ItemObject.php @@ -125,11 +125,24 @@ class Item extends BaseObject { $like_count = ((x($alike,$item['mid'])) ? $alike[$item['mid']] : ''); $like_list = ((x($alike,$item['mid'])) ? $alike[$item['mid'] . '-l'] : ''); + if (count($like_list) > MAX_LIKERS) { + $like_list_part = array_slice($like_list, 0, MAX_LIKERS); + array_push($like_list_part, '<a href="#" data-toggle="modal" data-target="#likeModal-' . $this->get_id() . '"><b>' . t('View all') . '</b></a>'); + } else { + $like_list_part = ''; + } $like_button_label = ((x($alike,$item['mid'])) && ($alike[$item['mid']] < 2 ) ? t('Like') : t('Likes')); + if (feature_enabled($conv->get_profile_owner(),'dislike')) { $dislike_count = ((x($dlike,$item['mid'])) ? $dlike[$item['mid']] : ''); $dislike_list = ((x($dlike,$item['mid'])) ? $dlike[$item['mid'] . '-l'] : ''); $dislike_button_label = ((x($dlike,$item['mid'])) && ($dlike[$item['mid']] < 2) ? t('Dislike') : t('Dislikes')); + if (count($dislike_list) > MAX_LIKERS) { + $dislike_list_part = array_slice($dislike_list, 0, MAX_LIKERS); + array_push($dislike_list_part, '<a href="#" data-toggle="modal" data-target="#dislikeModal-' . $this->get_id() . '"><b>' . t('View all') . '</b></a>'); + } else { + $dislike_list_part = ''; + } } $showlike = ((x($alike,$item['mid'])) ? format_like($alike[$item['mid']],$alike[$item['mid'] . '-l'],'like',$item['mid']) : ''); @@ -261,10 +274,15 @@ class Item extends BaseObject { // end toolbar buttons 'like_count' => $like_count, 'like_list' => $like_list, + 'like_list_part' => $like_list_part, 'like_button_label' => $like_button_label, + 'like_modal_title' => t('Likes'), + 'dislike_modal_title' => t('Dislikes'), 'dislike_count' => ((feature_enabled($conv->get_profile_owner(),'dislike')) ? $dislike_count : ''), 'dislike_list' => ((feature_enabled($conv->get_profile_owner(),'dislike')) ? $dislike_list : ''), + 'dislike_list_part' => ((feature_enabled($conv->get_profile_owner(),'dislike')) ? $dislike_list_part : ''), 'dislike_button_label' => ((feature_enabled($conv->get_profile_owner(),'dislike')) ? $dislike_button_label : ''), + 'modal_dismiss' => t('Close'), 'showlike' => $showlike, 'showdislike' => $showdislike, 'comment' => $this->get_comment_box($indent), diff --git a/view/tpl/conv_item.tpl b/view/tpl/conv_item.tpl index f9be3b077..ee10b6633 100755 --- a/view/tpl/conv_item.tpl +++ b/view/tpl/conv_item.tpl @@ -103,16 +103,60 @@ {{if $item.like_count}} <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> + {{if $item.like_list_part}} + <ul class="dropdown-menu" role="menu" aria-labelledby="wall-item-like-{{$item.id}}">{{foreach $item.like_list_part as $liker}}<li role="presentation">{{$liker}}</li>{{/foreach}}</ul> + {{else}} <ul class="dropdown-menu" role="menu" aria-labelledby="wall-item-like-{{$item.id}}">{{foreach $item.like_list as $liker}}<li role="presentation">{{$liker}}</li>{{/foreach}}</ul> + {{/if}} </div> {{/if}} {{if $item.dislike_count}} <div class="btn-group"> <button type="button" class="btn btn-default btn-sm wall-item-dislike dropdown-toggle" data-toggle="dropdown" id="wall-item-dislike-{{$item.id}}">{{$item.dislike_count}} {{$item.dislike_button_label}}</button> + {{if $item.dislike_list_part}} + <ul class="dropdown-menu" role="menu" aria-labelledby="wall-item-dislike-{{$item.id}}">{{foreach $item.dislike_list_part as $disliker}}<li role="presentation">{{$disliker}}</li>{{/foreach}}</ul> + {{else}} <ul class="dropdown-menu" role="menu" aria-labelledby="wall-item-dislike-{{$item.id}}">{{foreach $item.dislike_list as $disliker}}<li role="presentation">{{$disliker}}</li>{{/foreach}}</ul> + {{/if}} </div> {{/if}} </div> + {{if $item.like_list_part}} + <div class="modal" id="likeModal-{{$item.id}}"> + <div class="modal-dialog"> + <div class="modal-content"> + <div class="modal-header"> + <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> + <h4 class="modal-title">{{$item.like_modal_title}}</h4> + </div> + <div class="modal-body"> + <ul>{{foreach $item.like_list as $liker}}<li role="presentation">{{$liker}}</li>{{/foreach}}</ul> + </div> + <div class="modal-footer clear"> + <button type="button" class="btn btn-default" data-dismiss="modal">{{$item.modal_dismiss}}</button> + </div> + </div><!-- /.modal-content --> + </div><!-- /.modal-dialog --> + </div><!-- /.modal --> + {{/if}} + {{if $item.dislike_list_part}} + <div class="modal" id="dislikeModal-{{$item.id}}"> + <div class="modal-dialog"> + <div class="modal-content"> + <div class="modal-header"> + <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> + <h4 class="modal-title">{{$item.dislike_modal_title}}</h4> + </div> + <div class="modal-body"> + <ul>{{foreach $item.dislike_list as $disliker}}<li role="presentation">{{$disliker}}</li>{{/foreach}}</ul> + </div> + <div class="modal-footer clear"> + <button type="button" class="btn btn-default" data-dismiss="modal">{{$item.modal_dismiss}}</button> + </div> + </div><!-- /.modal-content --> + </div><!-- /.modal-dialog --> + </div><!-- /.modal --> + {{/if}} </div> {{* we dont' use this do we? {{if $item.drop.pagedrop}} |