mirror of
https://framagit.org/hubzilla/core.git
synced 2026-06-21 00:52:33 -04:00
blog mode fixes
This commit is contained in:
@@ -353,10 +353,11 @@ class ThreadItem {
|
||||
$contact = App::$contacts[$item['author_xchan']];
|
||||
}
|
||||
|
||||
$blog_mode = $this->get_display_mode() === 'list';
|
||||
$load_more = false;
|
||||
$load_more_title = '';
|
||||
$comments_total_percent = 0;
|
||||
if ($conv->comments_total > $conv->comments_loaded) {
|
||||
if (($conv->comments_total > $conv->comments_loaded) || ($blog_mode && $conv->comments_total > 3)) {
|
||||
// provide a load more comments button
|
||||
$load_more = true;
|
||||
$load_more_title = sprintf(t('Load the next few of total %d comments'), $conv->comments_total);
|
||||
@@ -491,7 +492,7 @@ class ThreadItem {
|
||||
'tentativeaccept' => intval($item['observer_tentativeaccept_count'] ?? 0)
|
||||
],
|
||||
'threaded' => $this->threaded,
|
||||
'blog_mode' => $this->get_display_mode() === 'list',
|
||||
'blog_mode' => $blog_mode,
|
||||
'collapse_comments' => t('show less'),
|
||||
'expand_comments' => $this->threaded ? t('show more') : t('show all'),
|
||||
'load_more' => $load_more,
|
||||
|
||||
2
boot.php
2
boot.php
@@ -70,7 +70,7 @@ require_once('include/security.php');
|
||||
|
||||
|
||||
define('PLATFORM_NAME', 'hubzilla');
|
||||
define('STD_VERSION', '10.3.69');
|
||||
define('STD_VERSION', '10.3.70');
|
||||
define('ZOT_REVISION', '6.0');
|
||||
|
||||
define('DB_UPDATE_VERSION', 1263);
|
||||
|
||||
@@ -1426,7 +1426,7 @@ function get_responses($response_verbs, $item) {
|
||||
}
|
||||
|
||||
$ret[$v]['count'] = $item[$v . '_count'] ?? 0;
|
||||
$ret[$v]['button'] = get_response_button_text($v, $ret[$v]['count']);
|
||||
$ret[$v]['button'] = get_response_button_text($v, $ret[$v]['count'], $item['item_thread_top']);
|
||||
}
|
||||
|
||||
//logger('ret: ' . print_r($ret,true));
|
||||
@@ -1434,7 +1434,7 @@ function get_responses($response_verbs, $item) {
|
||||
return $ret;
|
||||
}
|
||||
|
||||
function get_response_button_text($v, $count = 0) {
|
||||
function get_response_button_text($v, $count = 0, $top_level) {
|
||||
switch($v) {
|
||||
case 'like':
|
||||
return ['label' => tt('Like','Likes',$count,'noun'), 'icon' => 'hand-thumbs-up', 'class' => 'like', 'action' => 'dolike'];
|
||||
@@ -1446,7 +1446,7 @@ function get_response_button_text($v, $count = 0) {
|
||||
return ['label' => tt('Dislike','Dislikes',$count,'noun'), 'icon' => 'hand-thumbs-down', 'class' => 'dislike', 'action' => 'dolike'];
|
||||
break;
|
||||
case 'comment':
|
||||
return ['label' => tt('Reply','Replies',$count,'noun'), 'icon' => 'chat', 'class' => 'comment', 'action' => ''];
|
||||
return ['label' => (($top_level) ? tt('Comment', 'Comments' ,$count, 'noun') : tt('Reply', 'Replies', $count, 'noun')), 'icon' => 'chat', 'class' => 'comment', 'action' => ''];
|
||||
break;
|
||||
case 'accept':
|
||||
return ['label' => tt('Attending','Attending',$count,'noun'), 'icon' => 'calendar-check', 'class' => 'accept', 'action' => 'dolike'];
|
||||
|
||||
@@ -102,6 +102,15 @@ $(document).ready(function() {
|
||||
const isCommentBtn = target.classList.contains('wall-item-comment');
|
||||
|
||||
if (isCommentBtn) {
|
||||
if (id === parentId) {
|
||||
// Handle blog mode
|
||||
target.classList.add('disabled');
|
||||
document.getElementById(`load-more-progress-wrapper-${id}`).classList.remove('d-none');
|
||||
document.getElementById(`load-more-${id}`).classList.remove('d-none')
|
||||
request(id, mid, 'load', parentId, uuid, isUserClick);
|
||||
return;
|
||||
}
|
||||
|
||||
// Get relevant DOM elements
|
||||
const threadWrapper = document.getElementById(`thread-wrapper-${id}`);
|
||||
const parentWrapper = document.getElementById(`thread-wrapper-${parentId}`);
|
||||
@@ -124,7 +133,7 @@ $(document).ready(function() {
|
||||
parentSubThreadWrapper.querySelectorAll('.thread-wrapper.item-highlight').forEach(el => el.classList.remove('item-highlight'));
|
||||
|
||||
if (isUserClick && parentIndentedThreads.length === 0 && !subThreadWrapper.children.length) {
|
||||
// Handle first-time expansion and highlighting
|
||||
// Handle first-time expansion and highlighting but not for toplevels (blog mode)
|
||||
threadWrapper.classList.add('item-highlight');
|
||||
} else {
|
||||
// Handle indentation and zooming
|
||||
|
||||
@@ -222,11 +222,11 @@
|
||||
</div>
|
||||
</div>
|
||||
{{if $item.thread_level == 1}}
|
||||
{{if $item.toplevel && $item.load_more && $item.threaded && !$item.blog_mode}}
|
||||
<div id="load-more-progress-wrapper-{{$item.id}}" class="progress " role="progressbar" aria-valuenow="{{$item.comments_total_percent}}" aria-valuemin="0" aria-valuemax="100" style="height: 1px">
|
||||
{{if $item.toplevel && $item.load_more && $item.threaded}}
|
||||
<div id="load-more-progress-wrapper-{{$item.id}}" class="progress{{if $item.blog_mode}} d-none{{/if}}" role="progressbar" aria-valuenow="{{$item.comments_total_percent}}" aria-valuemin="0" aria-valuemax="100" style="height: 1px">
|
||||
<div id="load-more-progress-{{$item.id}}" class="progress-bar bg-info" style="width: {{$item.comments_total_percent}}%; margin-left: auto; margin-right: auto;" data-comments-total="{{$item.comments_total}}"></div>
|
||||
</div>
|
||||
<div id="load-more-{{$item.id}}" class="text-center text-secondary cursor-pointer" title="{{$item.load_more_title}}" onclick="request(0, '{{$item.rawmid}}', 'load', {{$item.parent}}, ''); return false;">
|
||||
<div id="load-more-{{$item.id}}" class="text-center text-secondary cursor-pointer{{if $item.blog_mode}} d-none{{/if}}" title="{{$item.load_more_title}}" onclick="request(0, '{{$item.rawmid}}', 'load', {{$item.parent}}, ''); return false;">
|
||||
<span id="load-more-dots-{{$item.id}}" class=""><span class="dot-1">-</span> <span class="dot-2">-</span> <span class="dot-3">-</span></span>
|
||||
</div>
|
||||
{{/if}}
|
||||
|
||||
Reference in New Issue
Block a user