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

Shows working copy options for Plone Site #6393

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/volto/cypress/tests/workingCopy/create.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@ describe('Working Copy Tests - Create', () => {
cy.findByText('View working copy');
});

it('Portal root does not have create option', function () {
it('Portal root have create option', function () {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
it('Portal root have create option', function () {
it('Portal root has create option', function () {

cy.visit('/');
cy.get('#toolbar-more').click();
cy.get('.menu-more').contains('Create working copy').should('not.exist');
cy.get('.menu-more').contains('Create working copy').should('exist');
});
});
1 change: 1 addition & 0 deletions packages/volto/news/5284.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Shows working copy options for Plone Site. @wesleybl
233 changes: 116 additions & 117 deletions packages/volto/src/components/manage/Toolbar/More.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -321,125 +321,124 @@ const More = (props) => {
</>
)}
</Pluggable>
{config.settings.hasWorkingCopySupport &&
content['@type'] !== 'Plone Site' && (
<>
{!content.working_copy && (
<Plug pluggable="toolbar-more-manage-content" id="workingcopy">
<li>
<button
aria-label={intl.formatMessage(messages.CreateWorkingCopy)}
onClick={() => {
dispatch(createWorkingCopy(path)).then((response) => {
history.push(flattenToAppURL(response['@id']));
props.closeMenu();
});
}}
>
{intl.formatMessage(messages.CreateWorkingCopy)}
{config.settings.hasWorkingCopySupport && (
<>
{!content.working_copy && (
<Plug pluggable="toolbar-more-manage-content" id="workingcopy">
<li>
<button
aria-label={intl.formatMessage(messages.CreateWorkingCopy)}
onClick={() => {
dispatch(createWorkingCopy(path)).then((response) => {
history.push(flattenToAppURL(response['@id']));
props.closeMenu();
});
}}
>
{intl.formatMessage(messages.CreateWorkingCopy)}

<Icon name={rightArrowSVG} size="24px" />
</button>
</li>
</Plug>
)}
{content.working_copy && content.working_copy_of && (
<Plug pluggable="toolbar-more-manage-content" id="workingcopy">
<li>
<button
aria-label={intl.formatMessage(messages.applyWorkingCopy)}
onClick={() => {
dispatch(applyWorkingCopy(path)).then((response) => {
history.push(
flattenToAppURL(content.working_copy_of['@id']),
);
props.closeMenu();
toast.info(
<Toast
info
title={intl.formatMessage(
messages.workingAppliedTitle,
)}
content={intl.formatMessage(
messages.workingCopyAppliedBy,
{
creator: content.working_copy?.creator_name,
date: (
<FormattedDate
date={content.working_copy?.created}
format={dateOptions}
/>
),
},
)}
/>,
{
toastId: 'workingcopyapplyinfo',
autoClose: 10000,
},
);
});
}}
>
{intl.formatMessage(messages.applyWorkingCopy)}
<Icon name={rightArrowSVG} size="24px" />
</button>
</li>
</Plug>
)}
{content.working_copy && content.working_copy_of && (
<Plug pluggable="toolbar-more-manage-content" id="workingcopy">
<li>
<button
aria-label={intl.formatMessage(messages.applyWorkingCopy)}
onClick={() => {
dispatch(applyWorkingCopy(path)).then((response) => {
history.push(
flattenToAppURL(content.working_copy_of['@id']),
);
props.closeMenu();
toast.info(
<Toast
info
title={intl.formatMessage(
messages.workingAppliedTitle,
)}
content={intl.formatMessage(
messages.workingCopyAppliedBy,
{
creator: content.working_copy?.creator_name,
date: (
<FormattedDate
date={content.working_copy?.created}
format={dateOptions}
/>
),
},
)}
/>,
{
toastId: 'workingcopyapplyinfo',
autoClose: 10000,
},
);
});
}}
>
{intl.formatMessage(messages.applyWorkingCopy)}

<Icon
name={applySVG}
size="24px"
title={intl.formatMessage(messages.applyWorkingCopy)}
/>
</button>
</li>
<li>
<button
aria-label={intl.formatMessage(messages.removeWorkingCopy)}
onClick={() => {
dispatch(removeWorkingCopy(path)).then((response) => {
history.push(
flattenToAppURL(content.working_copy_of['@id']),
);
props.closeMenu();
toast.info(
<Toast
info
title={intl.formatMessage(
messages.workingCopyRemovedTitle,
)}
/>,
{
toastId: 'workingcopyremovednotice',
autoClose: 10000,
},
);
});
}}
>
{intl.formatMessage(messages.removeWorkingCopy)}
<Icon
name={removeSVG}
size="24px"
color="#e40166"
title={intl.formatMessage(messages.removeWorkingCopy)}
/>
</button>
</li>
</Plug>
)}
{content.working_copy && !content.working_copy_of && (
<Plug pluggable="toolbar-more-manage-content" id="workingcopy">
<li>
<Link
to={flattenToAppURL(content.working_copy['@id'])}
onClick={() => props.closeMenu()}
>
{intl.formatMessage(messages.viewWorkingCopy)}
<Icon name={rightArrowSVG} size="24px" />
</Link>
</li>
</Plug>
)}
</>
)}
<Icon
name={applySVG}
size="24px"
title={intl.formatMessage(messages.applyWorkingCopy)}
/>
</button>
</li>
<li>
<button
aria-label={intl.formatMessage(messages.removeWorkingCopy)}
onClick={() => {
dispatch(removeWorkingCopy(path)).then((response) => {
history.push(
flattenToAppURL(content.working_copy_of['@id']),
);
props.closeMenu();
toast.info(
<Toast
info
title={intl.formatMessage(
messages.workingCopyRemovedTitle,
)}
/>,
{
toastId: 'workingcopyremovednotice',
autoClose: 10000,
},
);
});
}}
>
{intl.formatMessage(messages.removeWorkingCopy)}
<Icon
name={removeSVG}
size="24px"
color="#e40166"
title={intl.formatMessage(messages.removeWorkingCopy)}
/>
</button>
</li>
</Plug>
)}
{content.working_copy && !content.working_copy_of && (
<Plug pluggable="toolbar-more-manage-content" id="workingcopy">
<li>
<Link
to={flattenToAppURL(content.working_copy['@id'])}
onClick={() => props.closeMenu()}
>
{intl.formatMessage(messages.viewWorkingCopy)}
<Icon name={rightArrowSVG} size="24px" />
</Link>
</li>
</Plug>
)}
</>
)}
{editAction && config.settings.isMultilingual && (
<Plug pluggable="toolbar-more-manage-content" id="multilingual">
<li>
Expand Down
Loading