aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authormarijus <mario@mariovavti.com>2014-05-18 09:14:21 +0200
committermarijus <mario@mariovavti.com>2014-05-18 09:14:21 +0200
commit89b8bc07ac7178b8ea722f8d1faa2f649faa8c1b (patch)
tree51b062ede33c9a1db655f1492a0c9eeafdb718e7 /include
parent29e6f51ab8a12c222a131443066d19c913f94a08 (diff)
downloadvolse-hubzilla-89b8bc07ac7178b8ea722f8d1faa2f649faa8c1b.tar.gz
volse-hubzilla-89b8bc07ac7178b8ea722f8d1faa2f649faa8c1b.tar.bz2
volse-hubzilla-89b8bc07ac7178b8ea722f8d1faa2f649faa8c1b.zip
implement modal for more then 10 likes/dislikes
Diffstat (limited to 'include')
-rw-r--r--include/ItemObject.php18
1 files changed, 18 insertions, 0 deletions
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),