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

Post Editor: add new Copy Post functionality #7320

Closed
wants to merge 151 commits into from
Closed

Conversation

Copons
Copy link
Contributor

@Copons Copons commented Aug 8, 2016

The Copy Post functionality will allow users to choose an existing post and use it as a template for a new one.
Title, content, taxonomies, custom fields and everything else will be copied into the draft, ready to be modified as needed.

My initial approach is to add a new accordion in the editor drawer, containing a searcheable list of all posts. Through it, users can find an existing post, select it and use it as a template for the current draft.

Test live: https://calypso.live/?branch=add/copy-post

Copons and others added 13 commits August 8, 2016 13:32
Editor: Refactor page templates to use Redux state
* Removed `push-notifications-ab-test` feature flag from production.

* Removed references to `push-notifications-ab-test` feature flag.

* Removed `pushNotificationsPreferences` abtest -- PNs for everybody now.

* Fix logic for when PN nudge is shown.
* First-view: Use config with paths for determining active view

* Wire up enable flag

* Update tests to account for config/path-based FVs

* Fix linting errors

* Fix tab linting errors
…y one site (#7314)

* Clean up and add test for only one site

* Factor sites popover to class method

* Skip site list popover if user only has one site
* Add entry for signup theme preview abtest

* Tweak variation names, percentages

* Replace flag logic with abtest logic

* Fix lint

* Remove config flag

* Fix lib/abtest import

* Remove explicit allowExistingUsers
Added PostSelector component.
It uses the internal state to avoid cluttering the global one with
changes only relevant to the actual Copy Post functionality.

Added updateCurrentPost(), aka the Copy Post function.
It still uses Flux, waiting for Posts to fully migrate to Redux.

Notable issues:
- post.content cannot be updated, either via PostActions.edit() or
PostActions.editRawContent();
- post.categories are updated (according to the taxonomy checkboxes
changing as expected), but then break the Save Post action, as
apparently they don't have .map() anymore; manually touching the
category checkboxes fixes the Save action (restoring
post.categories.map() ?).
import PostActions from 'lib/posts/actions';
import PostSelector from 'my-sites/post-selector';

module.exports = React.createClass( {
Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Regarding both your annotations: I actually had to refrain myself from using export and class and stateless components, as the few Calypso files I opened to understand Calypso's conventions didn't use them!
I'll update the files as soon as possible!

Copons added a commit that referenced this pull request Dec 8, 2016
Copons added a commit that referenced this pull request Dec 8, 2016
Copons added a commit that referenced this pull request Dec 8, 2016
Copons added a commit that referenced this pull request Dec 8, 2016
Copons added a commit that referenced this pull request Dec 8, 2016
Copons added a commit that referenced this pull request Dec 8, 2016
Copons added a commit that referenced this pull request Dec 8, 2016
Copons added a commit that referenced this pull request Dec 8, 2016
Copons added a commit that referenced this pull request Dec 8, 2016
Copons added a commit that referenced this pull request Dec 8, 2016
Copons added a commit that referenced this pull request Dec 8, 2016
Copons added a commit that referenced this pull request Jan 3, 2017
Copons added a commit that referenced this pull request Jan 3, 2017
Copons added a commit that referenced this pull request Jan 3, 2017
Copons added a commit that referenced this pull request Jan 3, 2017
Copons added a commit that referenced this pull request Jan 3, 2017
Copons added a commit that referenced this pull request Jan 3, 2017
Copons added a commit that referenced this pull request Jan 3, 2017
Copons added a commit that referenced this pull request Jan 3, 2017
Copons added a commit that referenced this pull request Jan 3, 2017
Copons added a commit that referenced this pull request Jan 3, 2017
Copons added a commit that referenced this pull request Jan 3, 2017
Copons added a commit that referenced this pull request Jan 3, 2017
Copons added a commit that referenced this pull request Jan 3, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Post/Page Editor The editor for editing posts and pages. OSS Citizen Posts
Projects
None yet
Development

Successfully merging this pull request may close these issues.