fix(submit): enable optional topic selection by default
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
ee65fc7fd2
commit
374de05059
4 files changed
+5
-5
No files matched your search
@@ -7,7 +7,7 @@ export const submitSchema = {
|
||||
post_article_s: true,
|
||||
post_article_btn_txte: '发布文章',
|
||||
post_article_cat: [],
|
||||
post_article_topics_s: false,
|
||||
post_article_topics_s: true,
|
||||
post_article_topics: [],
|
||||
post_article_custom_filter_s: true,
|
||||
post_article_tag: true,
|
||||
@@ -36,7 +36,7 @@ export const submitSchema = {
|
||||
},
|
||||
{ key: 'post_article_btn_txte', label: '按钮文字', type: 'input', default: '发布文章', dependsOn: { key: 'post_article_s', value: true }, description: '投稿按钮的显示的文字,推荐4个字更加协调' },
|
||||
{ key: 'post_article_cat', label: '投稿允许选择的分类', type: 'taxonomy_select', taxonomy: 'category', multiple: true, default: [], placeholder: '输入关键词以搜索分类', dependsOn: { key: 'post_article_s', value: true }, description: '投稿允许选择的分类,为空则允许选择全部分类,所选分类下如果有子分类则会自动显示,如果选择了上级分类,则不要再选该分类下的子分类。注意:请确保所选分类包含子分类总数不要超过50个,否则可能会引起页面崩溃' },
|
||||
{ key: 'post_article_topics_s', label: '允许选择专题', type: 'switch', default: false, dependsOn: { key: 'post_article_s', value: true } },
|
||||
{ key: 'post_article_topics_s', label: '允许选择专题', type: 'switch', default: true, dependsOn: { key: 'post_article_s', value: true }, description: '投稿时可选择关联的专题(非必选)' },
|
||||
{ key: 'post_article_topics', label: '投稿允许选择的专题', type: 'taxonomy_select', taxonomy: 'topics', multiple: true, default: [], dependsOn: { all: [{ key: 'post_article_s', value: true }, { key: 'post_article_topics_s', value: true }] } },
|
||||
{ key: 'post_article_custom_filter_s', label: '允许选择高级筛选', type: 'switch', default: true, dependsOn: { key: 'post_article_s', value: true } },
|
||||
{
|
||||
|
||||
@@ -270,7 +270,7 @@ class SchemaPostList {
|
||||
['key' => 'post_article_s', 'label' => '启用前台投稿', 'type' => 'switcher', 'default' => true, 'description' => '此功能启用后,可以在权限管理中设置用户的发布、审核权限'],
|
||||
['key' => 'post_article_btn_txte', 'label' => '按钮文字', 'type' => 'input', 'default' => '发布文章', 'dependsOn' => ['key' => 'post_article_s', 'value' => true], 'description' => '投稿按钮的显示的文字,推荐4个字更加协调'],
|
||||
['key' => 'post_article_cat', 'label' => '投稿允许选择的分类', 'type' => 'taxonomy_select', 'taxonomy' => 'category', 'multiple' => true, 'default' => [], 'placeholder' => '输入关键词以搜索分类', 'dependsOn' => ['key' => 'post_article_s', 'value' => true], 'description' => '投稿允许选择的分类,为空则允许选择全部分类,所选分类下如果有子分类则会自动显示,如果选择了上级分类,则不要再选该分类下的子分类。注意:请确保所选分类包含子分类总数不要超过50个,否则可能会引起页面崩溃'],
|
||||
['key' => 'post_article_topics_s', 'label' => '允许选择专题', 'type' => 'switch', 'default' => false, 'dependsOn' => ['key' => 'post_article_s', 'value' => true]],
|
||||
['key' => 'post_article_topics_s', 'label' => '允许选择专题', 'type' => 'switch', 'default' => true, 'dependsOn' => ['key' => 'post_article_s', 'value' => true], 'description' => '投稿时可选择关联的专题(非必选)'],
|
||||
['key' => 'post_article_topics', 'label' => '投稿允许选择的专题', 'type' => 'taxonomy_select', 'taxonomy' => 'topics', 'multiple' => true, 'default' => [], 'dependsOn' => ['all' => [['key' => 'post_article_s', 'value' => true], ['key' => 'post_article_topics_s', 'value' => true]]]],
|
||||
['key' => 'post_article_custom_filter_s', 'label' => '允许选择高级筛选', 'type' => 'switcher', 'default' => true, 'dependsOn' => ['key' => 'post_article_s', 'value' => true], 'description' => '此功能启用后,请先在文章列表/高级筛选中添加高级筛选明细'],
|
||||
['key' => 'post_article_tag', 'label' => '允许插入标签', 'type' => 'switcher', 'default' => true, 'dependsOn' => ['key' => 'post_article_s', 'value' => true], 'description' => '前台投稿时候允许设置文章标签'],
|
||||
|
||||
@@ -376,7 +376,7 @@ class PostDisplay {
|
||||
'allowed_cat_ids' => is_array($settings['post_article_cat'] ?? null) ? array_values(array_filter(array_map('intval', $settings['post_article_cat']))) : [],
|
||||
'default_user_id' => max(0, (int) ($settings['post_article_user'] ?? 1)),
|
||||
'allow_tags' => !isset($settings['post_article_tag']) || !empty($settings['post_article_tag']),
|
||||
'allow_topics' => !empty($settings['post_article_topics_s']),
|
||||
'allow_topics' => !isset($settings['post_article_topics_s']) || !empty($settings['post_article_topics_s']),
|
||||
'allowed_topic_ids' => is_array($settings['post_article_topics'] ?? null) ? array_values(array_filter(array_map('absint', $settings['post_article_topics']))) : [],
|
||||
'custom_filter_s' => !isset($settings['post_article_custom_filter_s']) || !empty($settings['post_article_custom_filter_s']),
|
||||
'pay_free_s' => !isset($settings['post_article_pay_free_s']) || !empty($settings['post_article_pay_free_s']),
|
||||
|
||||
@@ -103,7 +103,7 @@ test('PHP submit section 字段键与参考主题一致且顺序相同', () => {
|
||||
});
|
||||
|
||||
test('PHP submit section 包含专题开关与可选专题', () => {
|
||||
assert.match(submitPhp, /'post_article_topics_s',\s*'label'\s*=>\s*'允许选择专题',\s*'type'\s*=>\s*'switch',\s*'default'\s*=>\s*false/);
|
||||
assert.match(submitPhp, /'post_article_topics_s',\s*'label'\s*=>\s*'允许选择专题',\s*'type'\s*=>\s*'switch',\s*'default'\s*=>\s*true/);
|
||||
assert.match(submitPhp, /'post_article_topics',\s*'label'\s*=>\s*'投稿允许选择的专题',\s*'type'\s*=>\s*'taxonomy_select',\s*'taxonomy'\s*=>\s*'topics'/);
|
||||
});
|
||||
|
||||
|
||||
Reference in new issue
Block a user