fix(comments): denser zibll-like chrome and guest fields
Tighten comment form density, collapse guest name/email behind a toggle, and refine empty-state copy for closed/author-only views.
This commit is contained in:
1 parent
1d75170f8e
commit
357d710b1b
3 files changed
+125
-9
No files matched your search
@@ -463,7 +463,7 @@ if (!function_exists('aksrt_comments_render_form')) :
|
||||
<span class="comt-tips-left comment-form__reply-text"></span>
|
||||
<span class="comt-tips-right"><a href="javascript:;" id="cancel-comment-reply-link" class="comment-form__cancel-reply"><i class="fas fa-times"></i> <?php esc_html_e('取消', 'aksrt'); ?></a></span>
|
||||
</div>
|
||||
<textarea id="comment" name="comment" class="form-control grin" rows="3" placeholder="<?php echo esc_attr((string) $ctx['box_placeholder']); ?>" required></textarea>
|
||||
<textarea id="comment" name="comment" class="form-control grin comt-textarea" rows="2" placeholder="<?php echo esc_attr((string) $ctx['box_placeholder']); ?>" required></textarea>
|
||||
<div class="comt-ctrl">
|
||||
<div class="comment-toolbar" role="toolbar" aria-label="<?php esc_attr_e('评论工具栏', 'aksrt'); ?>">
|
||||
<button type="button" class="comment-toolbar__btn"<?php echo empty($toolbar['smilie']) ? ' hidden' : ''; ?> title="<?php esc_attr_e('表情', 'aksrt'); ?>" data-toolbar-action="emoji"><i class="far fa-smile"></i></button>
|
||||
@@ -474,8 +474,15 @@ if (!function_exists('aksrt_comments_render_form')) :
|
||||
</div>
|
||||
<div class="comment-form__submit-area">
|
||||
<?php if (!$is_logged_in) : ?>
|
||||
<input type="text" name="author" class="form-control form-control-sm comment-form__guest-field" placeholder="<?php esc_attr_e('昵称', 'aksrt'); ?>" required>
|
||||
<input type="email" name="email" class="form-control form-control-sm comment-form__guest-field" placeholder="<?php esc_attr_e('邮箱', 'aksrt'); ?>" required>
|
||||
<div class="comment-form__guest">
|
||||
<button type="button" class="comment-form__guest-toggle muted-color em09" data-aksrt-guest-toggle aria-expanded="false">
|
||||
<i class="fa fa-user-edit em09" aria-hidden="true"></i> <?php esc_html_e('填写昵称邮箱', 'aksrt'); ?>
|
||||
</button>
|
||||
<div class="comment-form__guest-fields" data-aksrt-guest-fields hidden>
|
||||
<input type="text" name="author" class="form-control form-control-sm comment-form__guest-field" placeholder="<?php esc_attr_e('昵称', 'aksrt'); ?>" required>
|
||||
<input type="email" name="email" class="form-control form-control-sm comment-form__guest-field" placeholder="<?php esc_attr_e('邮箱', 'aksrt'); ?>" required>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<button type="submit" class="btn btn-primary btn-sm comment-form__submit" id="comment-submit">
|
||||
<i class="fas fa-paper-plane" aria-hidden="true"></i>
|
||||
@@ -571,10 +578,21 @@ if (!function_exists('aksrt_comments_render_empty')) :
|
||||
* @param array<string,mixed> $ctx Comments context.
|
||||
*/
|
||||
function aksrt_comments_render_empty(array $ctx): void {
|
||||
$closed = !comments_open();
|
||||
$text = (string) ($ctx['empty_text'] ?? __('暂无评论内容', 'aksrt'));
|
||||
if ($closed) {
|
||||
$text = __('评论已关闭', 'aksrt');
|
||||
} elseif (!empty($ctx['author_only'])) {
|
||||
$text = __('暂无作者评论', 'aksrt');
|
||||
}
|
||||
$hint = $closed
|
||||
? __('本文评论已关闭,仅可浏览历史留言', 'aksrt')
|
||||
: (!empty($ctx['author_only'])
|
||||
? __('切换到「查看全部」可浏览其他评论', 'aksrt')
|
||||
: __('成为第一个评论者吧', 'aksrt'));
|
||||
if (function_exists('aksrt_get_null')) {
|
||||
echo aksrt_get_null($text, 40, 'null.svg', 'comment comment-null comments-empty', 220); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
||||
echo '<p class="comments-empty__hint muted-3-color em09 text-center" style="margin-top:-20px;">' . esc_html__('成为第一个评论者吧', 'aksrt') . '</p>';
|
||||
echo '<p class="comments-empty__hint muted-3-color em09 text-center" style="margin-top:-20px;">' . esc_html($hint) . '</p>';
|
||||
return;
|
||||
}
|
||||
?>
|
||||
@@ -583,7 +601,7 @@ if (!function_exists('aksrt_comments_render_empty')) :
|
||||
<i class="far fa-comment-dots"></i>
|
||||
</div>
|
||||
<p class="comments-empty__text"><?php echo esc_html($text); ?></p>
|
||||
<p class="comments-empty__hint"><?php esc_html_e('成为第一个评论者吧', 'aksrt'); ?></p>
|
||||
<p class="comments-empty__hint"><?php echo esc_html($hint); ?></p>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user