Fix ctb button link for components

This commit is contained in:
soupette 2019-12-11 17:43:28 +01:00
parent ee9af6c0d3
commit d0952e5188
4 changed files with 6 additions and 10 deletions

View File

@ -403,7 +403,7 @@ const EditSettingsView = ({
slug,
emitEvent,
push,
{ componentSlug, type }
{ componentSlug, type, modifiedData }
)}
</div>
</div>

View File

@ -50,7 +50,7 @@
"components.TableEmpty.withoutFilter": "There is no {contentType}...",
"containers.Edit.addAnItem": "Add an item...",
"containers.Edit.pluginHeader.title.new": "Create an Entry",
"containers.Edit.pluginHeader.title.new": "Create an entry",
"containers.Edit.clickToJump": "Click to jump to the entry",
"containers.Edit.delete": "Delete",
"containers.Edit.editing": "Editing...",

View File

@ -16,7 +16,7 @@ import getTrad from '../../utils/getTrad';
function EditViewButton(props) {
const { formatMessage } = useGlobalContext();
// Retrieve URL from props
const { componentSlug, type } = get(
const { modifiedData, componentSlug, type } = get(
props,
['viewProps', '0'],
@ -28,16 +28,12 @@ function EditViewButton(props) {
const baseUrl = `/plugins/content-type-builder/${
type === 'content-types' ? type : 'component-categories'
}`;
let splitted = [];
if (componentSlug) {
splitted = componentSlug.split('.');
}
const category = get(modifiedData, 'category', '');
const suffixUrl =
type === 'content-types'
? props.getModelName()
: `${splitted[0]}/${componentSlug}`;
: `${category}/${componentSlug}`;
const handleClick = () => {
props.push(`${baseUrl}/${suffixUrl}`);

View File

@ -3,7 +3,7 @@ import pluginPkg from '../../package.json';
import App from './containers/App';
import Initializer from './containers/Initializer';
import Link from './InjectedComponents/ContentManager/EditViewLink';
import Button from './InjectedComponents/ContentManager/EditViewButton';
import Button from './InjectedComponents/ContentManager/EditSettingViewButton';
import lifecycles from './lifecycles';
import trads from './translations';
import pluginId from './pluginId';