fix(forum): align forum pages with the reference layout
- cards: restore the shared card shell, add author follow/message actions, score group, last-reply meta and reference plate header actions - home: desktop left tab rail, widget-only sidebar, reference load-more markup - plate: 1-based tabs, reference defaults (全部/推荐/最新回复/热门/精华) - post: fixed action rail, score footer, author card, h1 article title - quick publish: plate selector moved into the submit row like the reference
This commit is contained in:
1 parent
7a59c65252
commit
ec5dfcd82f
15 files changed
+396
-166
No files matched your search
+11
-11
@@ -11,7 +11,7 @@ final class EditView {
|
||||
$post = $edit_id > 0 ? get_post($edit_id) : null;
|
||||
if ($edit_id > 0 && (!$post instanceof \WP_Post || !Access::can_manage_post(get_current_user_id(), $edit_id))) {
|
||||
status_header(403);
|
||||
echo '<main id="forum" class="jio-forum forum-edit"><div class="container"><div class="zib-widget full-widget-sm text-center" style="min-height:60vh;">' . jio_get_null('抱歉!您暂无编辑此内容的权限', 60, 'null-post.svg') . '</div></div></main>';
|
||||
echo '<main id="forum" class="jio-forum forum-edit"><div class="container"><div class="jio-panel full-widget-sm text-center" style="min-height:60vh;">' . jio_get_null('抱歉!您暂无编辑此内容的权限', 60, 'null-post.svg') . '</div></div></main>';
|
||||
get_footer();
|
||||
return;
|
||||
}
|
||||
@@ -25,7 +25,7 @@ final class EditView {
|
||||
|
||||
wp_enqueue_editor();
|
||||
echo '<main id="forum" class="jio-forum forum-edit"><form id="bbs-posts-edit" data-forum-form="post" data-id="' . (int) $edit_id . '"><div class="container"><div class="content-wrap"><div class="content-layout">';
|
||||
echo '<div class="zib-widget full-widget-sm editor-main-box" style="min-height:60vh">';
|
||||
echo '<div class="jio-panel full-widget-sm editor-main-box" style="min-height:60vh">';
|
||||
if ($user_id <= 0) {
|
||||
echo jio_get_null('请先登录后再发布', 40, 'null-user.svg') . '<p class="text-center"><a class="but jb-blue padding-lg" href="' . esc_url(jio_get_login_url(Core::edit_url($edit_id))) . '"><i class="fa fas fa-sign-in-alt mr6"></i>登录</a></p>';
|
||||
echo '</div>';
|
||||
@@ -73,7 +73,7 @@ final class EditView {
|
||||
echo self::vote_box($vote_options, $post);
|
||||
echo self::hide_box($post);
|
||||
if (!$post && function_exists('jio_render_captcha') && function_exists('jio_is_captcha_enabled_for') && jio_is_captcha_enabled_for('forum_post')) {
|
||||
echo '<div class="zib-widget mb10-sm mb20 jio-forum__captcha">';
|
||||
echo '<div class="jio-panel mb10-sm mb20 jio-forum__captcha">';
|
||||
jio_render_captcha('forum_post');
|
||||
echo '</div>';
|
||||
}
|
||||
@@ -90,7 +90,7 @@ final class EditView {
|
||||
|
||||
private static function submit_box(?\WP_Post $post): string {
|
||||
$last = $post ? get_the_modified_time('Y-m-d H:i:s', $post->ID) : '';
|
||||
$html = '<div class="zib-widget mb10-sm mb20"><div class="but-average mb20 main-radius">';
|
||||
$html = '<div class="jio-panel mb10-sm mb20"><div class="but-average mb20 main-radius">';
|
||||
if (!$post || !in_array($post->post_status, ['publish', 'pending'], true)) {
|
||||
$html .= '<button type="button" class="but jb-green padding-10" data-forum-draft><i class="fa far fa-save mr6"></i>保存草稿</button>';
|
||||
}
|
||||
@@ -109,7 +109,7 @@ final class EditView {
|
||||
foreach (['pending' => '待审核', 'draft' => '草稿', 'publish' => '发布'] as $key => $label) {
|
||||
$list .= '<span data-forum-status="' . $key . '" class="badg mr3 p2-10 pointer' . ($key === $status ? ' active' : '') . '">' . $label . '</span>';
|
||||
}
|
||||
return '<div class="zib-widget mb10 type-drop"><div class="flex ac jsb"><div class="flex ac c-red"><i class="fa fas fa-thumbtack mr10"></i>设置状态</div><div class="em09">' . $list . '</div></div><input type="hidden" name="post_status" value="' . esc_attr($status) . '"></div>';
|
||||
return '<div class="jio-panel mb10 type-drop"><div class="flex ac jsb"><div class="flex ac c-red"><i class="fa fas fa-thumbtack mr10"></i>设置状态</div><div class="em09">' . $list . '</div></div><input type="hidden" name="post_status" value="' . esc_attr($status) . '"></div>';
|
||||
}
|
||||
|
||||
private static function allow_view_box(string $current): string {
|
||||
@@ -118,7 +118,7 @@ final class EditView {
|
||||
foreach ($labels as $key => $label) {
|
||||
$options .= '<div data-forum-view="' . $key . '" class="pointer but p2-10 mb6' . ($key === $current ? ' active' : '') . '">' . esc_html($label) . '</div>';
|
||||
}
|
||||
return '<div class="allow-view-drop drop-select dropdown zib-widget mb10-sm mb20"><div data-toggle-class="open" data-target=".allow-view-drop" class="flex ac jsb drop-btn"><div class="flex ac"><i class="fa far fa-eye mr6"></i>阅读权限</div><div class="flex ac"><span name="view_limit" class="em09 muted-2-color">' . esc_html($labels[$current] ?? '公开') . '</span><i class="ml6 fa fas fa-angle-right em12"></i></div></div><div class="dropdown-menu fluid"><div class="padding-10 flex jsb muted-2-color em09">设置阅读权限<span data-toggle-class="close" data-target=".allow-view-drop" class="pointer">完成</span></div><div class="mini-scrollbar padding-w10 select-drop-box">' . $options . '</div></div></div>';
|
||||
return '<div class="allow-view-drop drop-select dropdown jio-panel mb10-sm mb20"><div data-toggle-class="open" data-target=".allow-view-drop" class="flex ac jsb drop-btn"><div class="flex ac"><i class="fa far fa-eye mr6"></i>阅读权限</div><div class="flex ac"><span name="view_limit" class="em09 muted-2-color">' . esc_html($labels[$current] ?? '公开') . '</span><i class="ml6 fa fas fa-angle-right em12"></i></div></div><div class="dropdown-menu fluid"><div class="padding-10 flex jsb muted-2-color em09">设置阅读权限<span data-toggle-class="close" data-target=".allow-view-drop" class="pointer">完成</span></div><div class="mini-scrollbar padding-w10 select-drop-box">' . $options . '</div></div></div>';
|
||||
}
|
||||
|
||||
private static function plate_box(int $current): string {
|
||||
@@ -128,7 +128,7 @@ final class EditView {
|
||||
$options .= '<div data-forum-plate="' . (int) $plate->ID . '" class="pointer but p2-10 mb6' . ((int) $plate->ID === $current ? ' active' : '') . '">' . esc_html($plate->post_title) . '</div>';
|
||||
}
|
||||
$name = $current > 0 ? get_the_title($current) : '请选择';
|
||||
return '<div class="plate-drop drop-select dropdown zib-widget mb10-sm mb20"><div data-toggle-class="open" data-target=".plate-drop" class="flex ac jsb drop-btn"><div class="flex ac"><i class="fa fas fa-cube mr6"></i>版块</div><div class="flex ac"><span name="plate_id" class="em09 muted-2-color text-ellipsis">' . esc_html($name) . '</span><i class="ml6 fa fas fa-angle-right em12"></i></div></div><input type="hidden" name="plate_id" value="' . ($current ?: '') . '"><div class="dropdown-menu fluid"><div class="mini-scrollbar padding-w10 select-drop-box">' . $options . '</div></div></div>';
|
||||
return '<div class="plate-drop drop-select dropdown jio-panel mb10-sm mb20"><div data-toggle-class="open" data-target=".plate-drop" class="flex ac jsb drop-btn"><div class="flex ac"><i class="fa fas fa-cube mr6"></i>版块</div><div class="flex ac"><span name="plate_id" class="em09 muted-2-color text-ellipsis">' . esc_html($name) . '</span><i class="ml6 fa fas fa-angle-right em12"></i></div></div><input type="hidden" name="plate_id" value="' . ($current ?: '') . '"><div class="dropdown-menu fluid"><div class="mini-scrollbar padding-w10 select-drop-box">' . $options . '</div></div></div>';
|
||||
}
|
||||
|
||||
/** @param string[] $selected */
|
||||
@@ -140,7 +140,7 @@ final class EditView {
|
||||
$active = in_array($term->name, $selected, true);
|
||||
$options .= '<label class="but p2-10 mb6 pointer' . ($active ? ' active' : '') . '"><input type="checkbox" data-forum-' . esc_attr($field) . ' value="' . esc_attr($term->name) . '"' . checked($active, true, false) . ' hidden> ' . esc_html($term->name) . '</label>';
|
||||
}
|
||||
return '<div class="' . esc_attr($field) . '-drop drop-select dropdown zib-widget mb10-sm mb20"><div data-toggle-class="open" data-target=".' . esc_attr($field) . '-drop" class="flex ac jsb drop-btn"><div class="flex ac"><i class="fa fas ' . esc_attr($icon) . ' mr6"></i>' . esc_html($label) . '</div><div class="flex ac"><span class="em09 muted-2-color text-ellipsis" data-forum-' . esc_attr($field) . '-label>' . esc_html($selected ? implode('、', array_slice($selected, 0, 2)) : '请选择') . '</span><i class="ml6 fa fas fa-angle-right em12"></i></div></div><input type="hidden" name="' . esc_attr($field) . '" value="' . esc_attr(implode(',', $selected)) . '"><div class="dropdown-menu fluid"><div class="mini-scrollbar padding-w10 select-drop-box">' . $options . '</div></div></div>';
|
||||
return '<div class="' . esc_attr($field) . '-drop drop-select dropdown jio-panel mb10-sm mb20"><div data-toggle-class="open" data-target=".' . esc_attr($field) . '-drop" class="flex ac jsb drop-btn"><div class="flex ac"><i class="fa fas ' . esc_attr($icon) . ' mr6"></i>' . esc_html($label) . '</div><div class="flex ac"><span class="em09 muted-2-color text-ellipsis" data-forum-' . esc_attr($field) . '-label>' . esc_html($selected ? implode('、', array_slice($selected, 0, 2)) : '请选择') . '</span><i class="ml6 fa fas fa-angle-right em12"></i></div></div><input type="hidden" name="' . esc_attr($field) . '" value="' . esc_attr(implode(',', $selected)) . '"><div class="dropdown-menu fluid"><div class="mini-scrollbar padding-w10 select-drop-box">' . $options . '</div></div></div>';
|
||||
}
|
||||
|
||||
private static function type_box(string $current): string {
|
||||
@@ -153,7 +153,7 @@ final class EditView {
|
||||
foreach ($options as $key => $label) {
|
||||
$list .= '<span data-forum-type-set="' . $key . '" class="but p2-10 pointer' . ($key === $current ? ' active' : '') . '">' . esc_html($label) . '</span>';
|
||||
}
|
||||
return '<div class="type-drop zib-widget mb10-sm mb20"><div class="flex ac jsb"><div class="flex ac"><i class="fa fas fa-delicious mr6"></i>发布类型</div><div class="but-average radius em09">' . $list . '</div></div></div>';
|
||||
return '<div class="type-drop jio-panel mb10-sm mb20"><div class="flex ac jsb"><div class="flex ac"><i class="fa fas fa-delicious mr6"></i>发布类型</div><div class="but-average radius em09">' . $list . '</div></div></div>';
|
||||
}
|
||||
|
||||
/** Hidden-content composer: the block becomes a site visibility shortcode on save. */
|
||||
@@ -162,7 +162,7 @@ final class EditView {
|
||||
foreach (['logged' => '登录可见', 'reply' => '评论可见', 'vip1' => '会员可见', 'payshow' => '付费可见'] as $key => $label) {
|
||||
$types .= '<span data-forum-hide-type="' . $key . '" class="mb6 mr6 badg p2-10 pointer' . ($key === 'logged' ? ' active' : '') . '">' . esc_html($label) . '</span>';
|
||||
}
|
||||
return '<div class="hide-type-drop drop-select dropdown zib-widget mb10-sm mb20"><div data-toggle-class="open" data-target=".hide-type-drop" class="flex ac jsb drop-btn"><span class="flex ac"><i class="far fa-eye-slash mr6"></i>隐藏内容</span><i class="ml6 fa fas fa-angle-right em12"></i></div>'
|
||||
return '<div class="hide-type-drop drop-select dropdown jio-panel mb10-sm mb20"><div data-toggle-class="open" data-target=".hide-type-drop" class="flex ac jsb drop-btn"><span class="flex ac"><i class="far fa-eye-slash mr6"></i>隐藏内容</span><i class="ml6 fa fas fa-angle-right em12"></i></div>'
|
||||
. '<input type="hidden" name="hide_type" value="">'
|
||||
. '<div class="dropdown-menu fluid"><div class="mini-scrollbar padding-w10 select-drop-box"><div class="em09 muted-3-color mb10">添加额外的隐藏内容</div><div class="flex hh">' . $types . '</div>'
|
||||
. '<textarea rows="6" name="hide_content" class="form-control input-textarea" placeholder="在此输入需要隐藏的内容"></textarea></div></div></div>';
|
||||
@@ -171,7 +171,7 @@ final class EditView {
|
||||
/** @param string[] $options */
|
||||
private static function vote_box(array $options, ?\WP_Post $post): string {
|
||||
$type = $post ? (string) get_post_meta($post->ID, '_jio_forum_type', true) : 'normal';
|
||||
return '<div class="type-drop zib-widget mb10-sm mb20 forum-type-vote"' . ($type === 'vote' ? '' : ' hidden') . '><div class="mb10"><i class="fa fas fa-poll mr6"></i>投票设置</div>'
|
||||
return '<div class="type-drop jio-panel mb10-sm mb20 forum-type-vote"' . ($type === 'vote' ? '' : ' hidden') . '><div class="mb10"><i class="fa fas fa-poll mr6"></i>投票设置</div>'
|
||||
. '<input class="form-control mb6" name="vote_title" maxlength="60" placeholder="投票标题" value="' . esc_attr($post ? (string) get_post_meta($post->ID, '_jio_forum_vote_title', true) : '') . '">'
|
||||
. '<select class="form-control mb6" name="vote_type"><option value="single">单选</option><option value="multiple">多选</option><option value="pk">双选 PK</option></select>'
|
||||
. '<textarea class="form-control mb6" name="vote_options" rows="4" placeholder="每行一个选项">' . esc_textarea(implode("\n", $options)) . '</textarea>'
|
||||
|
||||
Reference in new issue
Block a user