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

CPT/Editor: Refactor close button label to account for custom post types #4029

Merged
merged 5 commits into from
Mar 15, 2016

Conversation

aduth
Copy link
Contributor

@aduth aduth commented Mar 14, 2016

Related: #3695

This pull request seeks to start refactoring the editor sidebar header such that "Posts" and "Pages" labels are appropriately replaced with a custom post type-specific menu name label for non-hardcoded types.

Close label

Refactoring includes:

  • Start moving sidebar to separate components (currently only header)
  • Toggle draft state in global Redux store
  • Account for non-hardcoded types in all posts URL generation and label

Testing instructions:

There should be no noticeable changes when editing posts or pages, whether in desktop or in mobile contexts. Because custom post types are not yet available for editing in the post editor, this is a bit trickier to test. After applying the following changes, start your local development server using DISABLE_FEATURES=persist-redux make run:

diff --git a/client/post-editor/editor-sidebar/header.jsx b/client/post-editor/editor-sidebar/header.jsx
index b4aa818..32151ba 100644
--- a/client/post-editor/editor-sidebar/header.jsx
+++ b/client/post-editor/editor-sidebar/header.jsx
@@ -23,7 +23,7 @@ import PostCountsData from 'components/data/post-counts-data';
 import QueryPostTypes from 'components/data/query-post-types';

 function PostEditorSidebarHeader( { typeSlug, type, siteId, showDrafts, toggleDrafts, allPostsUrl, toggleSidebar } ) {
-       const isCustomPostType = ( 'post' !== typeSlug && 'page' !== typeSlug );
+       const isCustomPostType = true;
        const className = classnames( 'post-editor-sidebar__header', {
                'is-drafts-visible': showDrafts,
                'is-loading': isCustomPostType && ! type
@@ -31,8 +31,6 @@ function PostEditorSidebarHeader( { typeSlug, type, siteId, showDrafts, toggleDr

        let allPostsLabel;
        switch ( typeSlug ) {
-               case 'post': allPostsLabel = translate( 'Posts' ); break;
-               case 'page': allPostsLabel = translate( 'Pages' ); break;
                default: allPostsLabel = get( type, 'labels.menu_name', translate( 'Loading…' ) );
        }
  1. Navigate to the Calypso post editor
  2. Select a site, if prompted
  3. Note that a loading indicator is shown where the "< Posts" label is normally visible in the sidebar header
  4. Note that the loading indicator is replaced with "< Posts" after post types have finished loading

@aduth aduth added [Feature] Post/Page Editor The editor for editing posts and pages. [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. Custom Post Types (CPT) labels Mar 14, 2016
@@ -0,0 +1,36 @@
.post-editor-sidebar__header {
Copy link
Member

Choose a reason for hiding this comment

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

These should be .editor-sidebar__header

Copy link
Contributor Author

Choose a reason for hiding this comment

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

These should be .editor-sidebar__header

Renamed in c4dcf3e .

@aduth aduth force-pushed the update/cpt-editor-all-posts branch from c4dcf3e to dae43ee Compare March 15, 2016 14:31
@aduth aduth added [Status] Ready to Merge and removed [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. labels Mar 15, 2016
aduth added a commit that referenced this pull request Mar 15, 2016
CPT/Editor: Refactor close button label to account for custom post types
@aduth aduth merged commit e7b2683 into master Mar 15, 2016
@aduth aduth deleted the update/cpt-editor-all-posts branch March 15, 2016 14:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Custom Post Types (CPT) [Feature] Post/Page Editor The editor for editing posts and pages.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants