Fix #1214 add option to display the first page of comments by default

This commit is contained in:
Kijin Sung 2020-03-23 01:45:25 +09:00
parent 676781a83e
commit b8665d73cb
5 changed files with 26 additions and 1 deletions

View file

@ -1747,6 +1747,12 @@ class commentController extends comment
$comment_config->comment_page_count = 10;
}
$comment_config->default_page = Context::get('default_page');
if($comment_config->default_page !== 'first')
{
$comment_config->default_page = 'last';
}
$comment_config->use_vote_up = Context::get('use_vote_up');
if(!$comment_config->use_vote_up)
{

View file

@ -491,7 +491,11 @@ class commentModel extends comment
// get a very last page if no page exists
$total_pages = max(1, ceil($document_comment_count / $comment_count));
if(!$page || $page > $total_pages)
if(!$page)
{
$page = (isset($comment_config->default_page) && $comment_config->default_page === 'first') ? 1 : $total_pages;
}
if($page > $total_pages)
{
$page = $total_pages;
}

View file

@ -7,6 +7,9 @@ $lang->trash = 'Recycle Bin';
$lang->cmd_trash = 'Move to Recycle Bin';
$lang->comment_count = 'Number of Comments per Page';
$lang->comment_page_count = 'Number of Pages';
$lang->comment_default_page = 'Default Page';
$lang->comment_default_page_first = 'First page';
$lang->comment_default_page_last = 'Last page';
$lang->about_comment_count = 'Set the number of comments to show on each page.';
$lang->about_comment_page_count = 'Set the number of pagination links to show at the bottom.';
$lang->msg_cart_is_null = 'Please select an article to delete.';

View file

@ -7,6 +7,9 @@ $lang->trash = '휴지통';
$lang->cmd_trash = '휴지통으로 이동';
$lang->comment_count = '댓글 수';
$lang->comment_page_count = '댓글 페이지 수';
$lang->comment_default_page = '댓글 기본 페이지';
$lang->comment_default_page_first = '첫 페이지';
$lang->comment_default_page_last = '마지막 페이지';
$lang->about_comment_count = '댓글을 정해진 수 만큼만 표시하고, 그 이상일 경우 페이지 번호를 표시해서 이동할 수 있게 합니다.';
$lang->about_comment_page_count = '하단에 표시할 페이지 링크 수를 설정할 수 있습니다.';
$lang->msg_cart_is_null = '삭제할 글을 선택해주세요.';

View file

@ -19,6 +19,15 @@
<p class="x_help-inline">{$lang->about_comment_page_count}</p>
</div>
</div>
<div class="x_control-group">
<label for="comment_count" class="x_control-label">{$lang->comment_default_page}</label>
<div class="x_controls">
<select name="default_page" id="default_page">
<option value="first" selected="selected"|cond="$comment_config->default_page === 'first'">{$lang->comment_default_page_first}</option>
<option value="last" selected="selected"|cond="$comment_config->default_page !== 'first'">{$lang->comment_default_page_last}</option>
</select>
</div>
</div>
<div class="x_control-group">
<label for="use_vote_up" class="x_control-label">{$lang->cmd_vote}</label>
<div class="x_controls">