Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removes navigation settings that are not used by Volto #5964

Merged
merged 1 commit into from
May 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/volto/news/5961.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Removes navigation settings that are not used by Volto. @wesleybl
7 changes: 7 additions & 0 deletions packages/volto/src/config/ControlPanels.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,13 @@ export const filterControlPanelsSchema = (controlpanel) => {
'picture_variants',
'image_captioning',
],
navigation: [
'generate_tabs',
'navigation_depth',
'sort_tabs_on',
'sort_tabs_reversed',
'sitemap_depth',
],
};

// Creates modified version of properties object
Expand Down
232 changes: 232 additions & 0 deletions packages/volto/src/config/config.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,232 @@
import config from '@plone/volto/registry';

const navigation_controlpanel = {
'@id': '/@controlpanels/navigation',
data: {
displayed_types: [
{
title: 'Link',
token: 'Link',
},
{
title: 'News Item',
token: 'News Item',
},
{
title: 'Folder',
token: 'Folder',
},
{
title: 'Page',
token: 'Document',
},
{
title: 'Event',
token: 'Event',
},
{
title: 'Collection',
token: 'Collection',
},
],
filter_on_workflow: false,
generate_tabs: true,
navigation_depth: 3,
nonfolderish_tabs: true,
parent_types_not_to_query: ['TempFolder'],
root: '/',
show_excluded_items: false,
sitemap_depth: 3,
sort_tabs_on: {
title: 'Position in Parent',
token: 'getObjPositionInParent',
},
sort_tabs_reversed: false,
workflow_states_to_show: [],
},
group: 'General',
schema: {
fieldsets: [
{
behavior: 'plone',
fields: [
'navigation_depth',
'generate_tabs',
'nonfolderish_tabs',
'sort_tabs_on',
'sort_tabs_reversed',
'displayed_types',
'filter_on_workflow',
'workflow_states_to_show',
'show_excluded_items',
'root',
'sitemap_depth',
'parent_types_not_to_query',
],
id: 'default',
title: 'Default',
},
],
properties: {
displayed_types: {
additionalItems: true,
default: [
'Link',
'News Item',
'Folder',
'Document',
'Event',
'Collection',
],
description:
'The content types that should be shown in the navigation and site map.',
factory: 'Tuple',
items: {
description: '',
factory: 'Choice',
title: '',
type: 'string',
vocabulary: {
'@id':
'http://localhost:3000/@vocabularies/plone.app.vocabularies.ReallyUserFriendlyTypes',
},
},
title: 'Displayed content types',
type: 'array',
uniqueItems: true,
},
filter_on_workflow: {
default: false,
description:
'The workflow states that should be shown in the navigation and the site map.',
factory: 'Yes/No',
title: 'Filter on workflow state',
type: 'boolean',
},
generate_tabs: {
default: true,
description:
'By default, all items created at the root level will appear as tabs. You can turn this off if you prefer manually constructing this part of the navigation.',
factory: 'Yes/No',
title: 'Automatically generate tabs',
type: 'boolean',
},
navigation_depth: {
default: 3,
description: 'Number of folder levels to show in the navigation.',
factory: 'Integer',
title: 'Navigation depth',
type: 'integer',
},
nonfolderish_tabs: {
default: true,
description:
"By default, any content item in the root of the portal will appear as a tab. If you turn this option off, only folders will be shown. This only has an effect if 'automatically generate tabs' is enabled.",
factory: 'Yes/No',
title: 'Generate tabs for items other than folders.',
type: 'boolean',
},
parent_types_not_to_query: {
additionalItems: true,
default: ['TempFolder'],
description: 'Hide content inside the following types in Navigation.',
factory: 'List',
items: {
description: '',
factory: 'Text line (String)',
title: '',
type: 'string',
},
title: 'Hide children of these types',
type: 'array',
uniqueItems: false,
},
root: {
default: '/',
description:
"Path to be used as navigation root, relative to Plone site root.Starts with '/'",
factory: 'Text line (String)',
title: 'Root',
type: 'string',
},
show_excluded_items: {
default: false,
description:
'If an item has been excluded from navigation should it be shown in navigation when viewing content contained within it or within a subfolder.',
factory: 'Yes/No',
title:
'Show items normally excluded from navigation if viewing their children.',
type: 'boolean',
},
sitemap_depth: {
default: 3,
description: 'Number of folder levels to show in the site map.',
factory: 'Integer',
title: 'Sitemap depth',
type: 'integer',
},
sort_tabs_on: {
choices: [
['getObjPositionInParent', 'Position in Parent'],
['sortable_title', 'Title'],
['getId', 'Short Name (ID)'],
],
default: 'getObjPositionInParent',
description: 'Index used to sort the tabs',
enum: ['getObjPositionInParent', 'sortable_title', 'getId'],
enumNames: ['Position in Parent', 'Title', 'Short Name (ID)'],
factory: 'Choice',
title: 'Sort tabs on',
type: 'string',
vocabulary: {
'@id': 'http://localhost:3000/@sources/sort_tabs_on',
},
},
sort_tabs_reversed: {
default: false,
description: 'Sort tabs in descending.',
factory: 'Yes/No',
title: 'Reversed sort order for tabs.',
type: 'boolean',
},
workflow_states_to_show: {
additionalItems: true,
default: [],
description: '',
factory: 'Tuple',
items: {
description: '',
factory: 'Choice',
title: '',
type: 'string',
vocabulary: {
'@id':
'http://localhost:3000/@vocabularies/plone.app.vocabularies.WorkflowStates',
},
},
title: '',
type: 'array',
uniqueItems: true,
},
},
required: ['navigation_depth', 'sort_tabs_on', 'root', 'sitemap_depth'],
type: 'object',
},
title: 'Navigation',
};

test('test navigation controlpanel fields', () => {
const { filterControlPanelsSchema } = config.settings;
const result = filterControlPanelsSchema(navigation_controlpanel);
const not_in_navigation = [
'generate_tabs',
'navigation_depth',
'sort_tabs_on',
'sort_tabs_reversed',
'sitemap_depth',
];
const hasField = result['fieldsets'][0]['fields'].some((field) =>
not_in_navigation.includes(field),
);
expect(hasField).toBe(false);
});