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

Copying pages: Only add "(Copy)" if necessary #2521

Merged
merged 4 commits into from
Sep 20, 2023

Conversation

mamhoff
Copy link
Contributor

@mamhoff mamhoff commented Jul 13, 2023

What is this pull request for?

This should help with copying and pasting page trees. If one copies to a different parent page from the source page, then we don't need to add the "(Copy)" string to the new page. This is especially useful for copying larger structures between language trees.

Notable changes (remove if none)

Much less (Copy).

Checklist

  • I have followed Pull Request guidelines
  • I have added a detailed description into each commit message
  • I have added tests to cover this change

Copy link
Member

@tvdeyen tvdeyen left a comment

Choose a reason for hiding this comment

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

I really like this. This complex behavior could also be a PORO, dont you think?

app/models/alchemy/page.rb Outdated Show resolved Hide resolved
app/models/alchemy/page.rb Outdated Show resolved Hide resolved
@tvdeyen tvdeyen added this to the 7.1 milestone Jul 31, 2023
@tvdeyen
Copy link
Member

tvdeyen commented Sep 18, 2023

@mamhoff ping

This should help with copying and pasting page trees. If one copies to a
different parent page from the source page, then we don't need to add
the "(Copy)" string to the new page. This is especially useful for
copying larger structures between language trees.
@mamhoff mamhoff force-pushed the do-not-add-copy-unless-necessary branch from ca0f9ba to bb6ac7b Compare September 20, 2023 12:19
This class copies a page, respecting the need for changing the name of
the page if the new parent page already has a child with that name.

It's an extraction of code from the Alchemy::Page model. There's nothing
"new" here, except for the API.
This method is already in the model file.
This uses the new CopyPage class anywhere we need it in the
Alchemy::Page model.
@mamhoff mamhoff force-pushed the do-not-add-copy-unless-necessary branch from bb6ac7b to fd9c9c0 Compare September 20, 2023 12:36
Copy link
Member

@tvdeyen tvdeyen left a comment

Choose a reason for hiding this comment

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

Very nice work! Thanks 🍰

@tvdeyen tvdeyen merged commit 8151453 into AlchemyCMS:main Sep 20, 2023
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants