diff --git a/src/javascript/ContentEditor/ContentEditor/adaptSystemNameField.js b/src/javascript/ContentEditor/ContentEditor/adaptSystemNameField.js index f4a86a355..da06c5ef1 100644 --- a/src/javascript/ContentEditor/ContentEditor/adaptSystemNameField.js +++ b/src/javascript/ContentEditor/ContentEditor/adaptSystemNameField.js @@ -1,7 +1,7 @@ import {Constants} from '~/ContentEditor/ContentEditor.constants'; -const isContentOrFileNode = formData => { - const pattern = '^/sites/[^/]*/(contents|files)$'; +const isContentOrFileOrCategoriesNode = formData => { + const pattern = '^/sites/[^/]*/(contents|files|categories)$'; const regex = RegExp(pattern); return formData.technicalInfo.filter(info => { return regex.test(info.value); @@ -18,7 +18,7 @@ export const adaptSystemNameField = (formData, primaryNodeType) => { if (systemNameField) { // System name should be readonly for this specific nodetypes / should be in json overrides - if (Constants.systemName.READONLY_FOR_NODE_TYPES.includes(primaryNodeType.name) || isContentOrFileNode(formData)) { + if (Constants.systemName.READONLY_FOR_NODE_TYPES.includes(primaryNodeType.name) || isContentOrFileOrCategoriesNode(formData)) { systemNameField.readOnly = true; } } diff --git a/src/javascript/JContent/JContent.actions.jsx b/src/javascript/JContent/JContent.actions.jsx index 9933bb15f..84f9c7eb8 100644 --- a/src/javascript/JContent/JContent.actions.jsx +++ b/src/javascript/JContent/JContent.actions.jsx @@ -68,7 +68,12 @@ import {SelectionActionComponent} from './actions/selectionAction'; import {MenuItemRenderer} from './MenuItemRenderer'; import {MenuRenderer} from './MenuRenderer'; import {triggerRefetchAll} from './JContent.refetches'; -import {ACTION_PERMISSIONS, PATH_CONTENTS_ITSELF, PATH_FILES_ITSELF} from './actions/actions.constants'; +import { + ACTION_PERMISSIONS, + PATH_CATEGORIES_ITSELF, + PATH_CONTENTS_ITSELF, + PATH_FILES_ITSELF +} from './actions/actions.constants'; import {ViewUsagesComponent} from '~/JContent/actions/viewUsages'; import {OpenInPageBuilderActionComponent} from '~/JContent/actions/openInPageBuilderAction'; import {CopyMenuComponent} from '~/JContent/actions/copyPaste/CopyMenuComponent'; @@ -272,7 +277,7 @@ export const jContentActions = registry => { targets: ['contentActions:3.9', 'accordionContentActions:3.9', 'selectedContentActions:3.9', 'narrowHeaderSelectionMenu:3.9'], copyCutType: 'cut', hideOnNodeTypes: ['jnt:virtualsite', 'jmix:hideDeleteAction', 'jmix:isAreaList'], - hideForPaths: [PATH_FILES_ITSELF, PATH_CONTENTS_ITSELF], + hideForPaths: [PATH_FILES_ITSELF, PATH_CONTENTS_ITSELF, PATH_CATEGORIES_ITSELF], component: CopyCutActionComponent }); registry.add('action', 'paste', { diff --git a/src/javascript/JContent/actions/actions.constants.js b/src/javascript/JContent/actions/actions.constants.js index c1f35d152..98e6f70cc 100644 --- a/src/javascript/JContent/actions/actions.constants.js +++ b/src/javascript/JContent/actions/actions.constants.js @@ -1,5 +1,6 @@ export const PATH_CONTENTS_ITSELF = '^/sites/((?!/).)+/contents/?$'; export const PATH_FILES_ITSELF = '^/sites/((?!/).)+/files/?$'; +export const PATH_CATEGORIES_ITSELF = '^/sites/((?!/).)+/categories/?$'; export const ACTION_PERMISSIONS = { copyAction: 'copyAction', diff --git a/src/javascript/JContent/actions/deleteActions/deleteAction.jsx b/src/javascript/JContent/actions/deleteActions/deleteAction.jsx index 20a6e5ffe..ec453de7c 100644 --- a/src/javascript/JContent/actions/deleteActions/deleteAction.jsx +++ b/src/javascript/JContent/actions/deleteActions/deleteAction.jsx @@ -3,7 +3,7 @@ import {useSelector} from 'react-redux'; import {useNodeChecks} from '@jahia/data-helper'; import PropTypes from 'prop-types'; import React, {useContext} from 'react'; -import {PATH_CONTENTS_ITSELF, PATH_FILES_ITSELF} from '../actions.constants'; +import {PATH_CATEGORIES_ITSELF, PATH_CONTENTS_ITSELF, PATH_FILES_ITSELF} from '../actions.constants'; import Delete from './Delete'; import {ComponentRendererContext} from '@jahia/ui-extender'; @@ -22,7 +22,7 @@ export const DeleteActionComponent = ({path, paths, buttonProps, onDeleted, rend getDisplayName: true, getOperationSupport: true, requiredPermission: ['jcr:removeNode'], - hideForPaths: [PATH_FILES_ITSELF, PATH_CONTENTS_ITSELF], + hideForPaths: [PATH_FILES_ITSELF, PATH_CONTENTS_ITSELF, PATH_CATEGORIES_ITSELF], getLockInfo: true, ...others }, diff --git a/src/javascript/JContent/actions/deleteActions/deletePermanentlyAction.jsx b/src/javascript/JContent/actions/deleteActions/deletePermanentlyAction.jsx index 73fb908b1..b4c2b3b8d 100644 --- a/src/javascript/JContent/actions/deleteActions/deletePermanentlyAction.jsx +++ b/src/javascript/JContent/actions/deleteActions/deletePermanentlyAction.jsx @@ -3,7 +3,7 @@ import {useNodeChecks} from '@jahia/data-helper'; import PropTypes from 'prop-types'; import {isMarkedForDeletion} from '../../JContent.utils'; import {useSelector} from 'react-redux'; -import {PATH_CONTENTS_ITSELF, PATH_FILES_ITSELF} from './../actions.constants'; +import {PATH_CATEGORIES_ITSELF, PATH_CONTENTS_ITSELF, PATH_FILES_ITSELF} from './../actions.constants'; import Delete from './Delete'; import {ComponentRendererContext} from '@jahia/ui-extender'; @@ -35,7 +35,7 @@ export const DeletePermanentlyActionComponent = ({path, paths, buttonProps, onDe getOperationSupport: true, requiredPermission: ['jcr:removeNode'], hideOnNodeTypes: ['jnt:virtualsite'], - hideForPaths: [PATH_FILES_ITSELF, PATH_CONTENTS_ITSELF] + hideForPaths: [PATH_FILES_ITSELF, PATH_CONTENTS_ITSELF, PATH_CATEGORIES_ITSELF] }, { fetchPolicy: 'network-only' diff --git a/src/javascript/JContent/actions/deleteActions/undeleteAction.jsx b/src/javascript/JContent/actions/deleteActions/undeleteAction.jsx index 3a040d44a..bb3ea1a59 100644 --- a/src/javascript/JContent/actions/deleteActions/undeleteAction.jsx +++ b/src/javascript/JContent/actions/deleteActions/undeleteAction.jsx @@ -3,7 +3,7 @@ import {useSelector} from 'react-redux'; import {useNodeChecks} from '@jahia/data-helper'; import PropTypes from 'prop-types'; import React, {useContext} from 'react'; -import {PATH_CONTENTS_ITSELF, PATH_FILES_ITSELF} from '../actions.constants'; +import {PATH_CATEGORIES_ITSELF, PATH_CONTENTS_ITSELF, PATH_FILES_ITSELF} from '../actions.constants'; import {ComponentRendererContext} from '@jahia/ui-extender'; import Delete from './Delete'; @@ -23,7 +23,7 @@ export const UndeleteActionComponent = ({path, paths, buttonProps, onDeleted, re getOperationSupport: true, requiredPermission: ['jcr:removeNode'], hideOnNodeTypes: ['jnt:virtualsite'], - hideForPaths: [PATH_FILES_ITSELF, PATH_CONTENTS_ITSELF] + hideForPaths: [PATH_FILES_ITSELF, PATH_CONTENTS_ITSELF, PATH_CATEGORIES_ITSELF] }, { fetchPolicy: 'network-only' diff --git a/src/javascript/JContent/dnd/useNodeDrag.jsx b/src/javascript/JContent/dnd/useNodeDrag.jsx index 27690f39b..655408980 100644 --- a/src/javascript/JContent/dnd/useNodeDrag.jsx +++ b/src/javascript/JContent/dnd/useNodeDrag.jsx @@ -6,6 +6,7 @@ import {shallowEqual, useSelector} from 'react-redux'; import {useNodeChecks} from '@jahia/data-helper'; import {PATH_CONTENTS_ITSELF, PATH_FILES_ITSELF} from '~/JContent/actions/actions.constants'; import {JahiaAreasUtil} from '../JContent.utils'; +import {PATH_CATEGORIES_ITSELF} from '../actions/actions.constants'; export function useNodeDrag({dragSource}) { const {selection, language, displayLanguage} = useSelector(state => ({ @@ -21,7 +22,7 @@ export function useNodeDrag({dragSource}) { getPrimaryNodeType: true, requiredPermission: ['jcr:removeNode'], hideOnNodeTypes: ['jnt:virtualsite', 'jmix:hideDeleteAction', 'jmix:blockUiMove'], - hideForPaths: [PATH_FILES_ITSELF, PATH_CONTENTS_ITSELF], + hideForPaths: [PATH_FILES_ITSELF, PATH_CONTENTS_ITSELF, PATH_CATEGORIES_ITSELF], getLockInfo: true } );