diff options
author | Mario Vavti <mario@mariovavti.com> | 2017-03-19 17:49:07 +0100 |
---|---|---|
committer | Mario Vavti <mario@mariovavti.com> | 2017-03-19 17:49:07 +0100 |
commit | 949ca844c5e580484c46fb3202a29d19049bb453 (patch) | |
tree | 5814cf3d5ade649bc2f2ccae85414fa8850c052c | |
parent | f31af3c7c0e157e375a08ce562221d91406bcef9 (diff) | |
download | volse-hubzilla-949ca844c5e580484c46fb3202a29d19049bb453.tar.gz volse-hubzilla-949ca844c5e580484c46fb3202a29d19049bb453.tar.bz2 volse-hubzilla-949ca844c5e580484c46fb3202a29d19049bb453.zip |
open like-modal directly if more than 10 likes
-rw-r--r-- | include/conversation.php | 10 | ||||
-rwxr-xr-x | view/tpl/conv_item.tpl | 11 | ||||
-rwxr-xr-x | view/tpl/conv_list.tpl | 13 |
3 files changed, 12 insertions, 22 deletions
diff --git a/include/conversation.php b/include/conversation.php index f2b394556..e6ba1fa6e 100644 --- a/include/conversation.php +++ b/include/conversation.php @@ -1927,15 +1927,11 @@ function get_responses($conv_responses,$response_verbs,$ob,$item) { $ret[$v] = array(); $ret[$v]['count'] = ((x($conv_responses[$v],$item['mid'])) ? $conv_responses[$v][$item['mid']] : ''); $ret[$v]['list'] = ((x($conv_responses[$v],$item['mid'])) ? $conv_responses[$v][$item['mid'] . '-l'] : ''); - if(count($ret[$v]['list']) > MAX_LIKERS) { - $ret[$v]['list_part'] = array_slice($ret[$v]['list'], 0, MAX_LIKERS); - array_push($ret[$v]['list_part'], '<a class="dropdown-item" href="#" data-toggle="modal" data-target="#' . $v . 'Modal-' - . (($ob) ? $ob->get_id() : $item['id']) . '"><b>' . t('View all') . '</b></a>'); - } else { - $ret[$v]['list_part'] = ''; - } $ret[$v]['button'] = get_response_button_text($v,$ret[$v]['count']); $ret[$v]['title'] = $conv_responses[$v]['title']; + if($ret[$v]['count'] > MAX_LIKERS) { + $ret[$v]['modal'] = true; + } } $count = 0; diff --git a/view/tpl/conv_item.tpl b/view/tpl/conv_item.tpl index 22250781c..bcdfe3ebc 100755 --- a/view/tpl/conv_item.tpl +++ b/view/tpl/conv_item.tpl @@ -205,13 +205,8 @@ {{foreach $item.responses as $verb=>$response}} {{if $response.count}} <div class="btn-group"> - <button type="button" class="btn btn-outline-secondary btn-sm wall-item-like dropdown-toggle" data-toggle="dropdown" id="wall-item-{{$verb}}-{{$item.id}}">{{$response.count}} {{$response.button}}</button> - {{if $response.list_part}} - <div class="dropdown-menu">{{foreach $response.list_part as $liker}}{{$liker}}{{/foreach}}</div> - {{else}} - <div class="dropdown-menu">{{foreach $response.list as $liker}}{{$liker}}{{/foreach}}</div> - {{/if}} - {{if $response.list_part}} + <button type="button" class="btn btn-outline-secondary btn-sm wall-item-like dropdown-toggle"{{if $response.modal}} data-toggle="modal" data-target="#{{$verb}}Modal-{{$item.id}}"{{else}} data-toggle="dropdown"{{/if}} id="wall-item-{{$verb}}-{{$item.id}}">{{$response.count}} {{$response.button}}</button> + {{if $response.modal}} <div class="modal" id="{{$verb}}Modal-{{$item.id}}"> <div class="modal-dialog"> <div class="modal-content"> @@ -228,6 +223,8 @@ </div><!-- /.modal-content --> </div><!-- /.modal-dialog --> </div><!-- /.modal --> + {{else}} + <div class="dropdown-menu">{{foreach $response.list as $liker}}{{$liker}}{{/foreach}}</div> {{/if}} </div> {{/if}} diff --git a/view/tpl/conv_list.tpl b/view/tpl/conv_list.tpl index e31ffea25..0f6ea22a3 100755 --- a/view/tpl/conv_list.tpl +++ b/view/tpl/conv_list.tpl @@ -216,19 +216,14 @@ {{foreach $item.responses as $verb=>$response}} {{if $response.count}} <div class="btn-group"> - <button type="button" class="btn btn-outline-secondary btn-sm wall-item-like dropdown-toggle" data-toggle="dropdown" id="wall-item-{{$verb}}-{{$item.id}}">{{$response.count}} {{$response.button}}</button> - {{if $response.list_part}} - <div class="dropdown-menu">{{foreach $response.list_part as $liker}}{{$liker}}{{/foreach}}</div> - {{else}} - <div class="dropdown-menu">{{foreach $response.list as $liker}}{{$liker}}{{/foreach}}</div> - {{/if}} - {{if $response.list_part}} + <button type="button" class="btn btn-outline-secondary btn-sm wall-item-like dropdown-toggle"{{if $response.modal}} data-toggle="modal" data-target="#{{$verb}}Modal-{{$item.id}}"{{else}} data-toggle="dropdown"{{/if}} id="wall-item-{{$verb}}-{{$item.id}}">{{$response.count}} {{$response.button}}</button> + {{if $response.modal}} <div class="modal" id="{{$verb}}Modal-{{$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">{{$response.title}}</h4> + <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> </div> <div class="modal-body response-list"> <ul class="nav nav-pills flex-column">{{foreach $response.list as $liker}}<li class="nav-item">{{$liker}}</li>{{/foreach}}</ul> @@ -239,6 +234,8 @@ </div><!-- /.modal-content --> </div><!-- /.modal-dialog --> </div><!-- /.modal --> + {{else}} + <div class="dropdown-menu">{{foreach $response.list as $liker}}{{$liker}}{{/foreach}}</div> {{/if}} </div> {{/if}} |