Skip to content
This repository has been archived by the owner on Dec 16, 2022. It is now read-only.

Post Creation #134

Merged
merged 44 commits into from
May 25, 2016
Merged

Post Creation #134

merged 44 commits into from
May 25, 2016

Conversation

valendesigns
Copy link
Contributor

@valendesigns valendesigns commented May 11, 2016

Fixes #48, fixes #50

  • Create a new post/page and reload the preview while giving focus to that section
  • Ensure any newly created post/page persist in the panel
  • Add a customize-draft status which is assigned to an auto-draft post once it has been saved as part of a snapshot. This will prevent it from being garbage-collected.
  • Add link in a post section to allow navigating back to the post/page in the preview after having navigated away.
  • Display Ajax error messages in the console
  • Add unit tests
  • Rework the dependency on refreshing the preview to see new posts in the panel

@valendesigns valendesigns added this to the 0.6 milestone May 11, 2016
@westonruter westonruter changed the title [WIP] Post Authoring [WIP] Post Creation May 11, 2016
@westonruter
Copy link
Contributor

@valendesigns what were the todos we listed out for this PR? I added one in the description. I realize we can continue to use auto-draft for posts added in the Customizer; we only need to introduce the customize-draft to prevent posts from being garbage-collected after they have become part of a snapshot. We'll need to think this through further with transactions, however.

@valendesigns
Copy link
Contributor Author

I'll update this later tonight I just got back from the airport. 😀

panel: panel
} ) );

$( '.add-new-' + panel.postType ).on( 'click', function( event ) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I believe this should be scoped, for example:

panel.container.find( '.add-new.button-secondary' ).on(  )

In this case, there wouldn't need to be a type-specific class name because the button would be scoped to the container.

@valendesigns
Copy link
Contributor Author

@westonruter This PR is ready for a final review.

public function include_previewed_drafts( $where, $query ) {
global $wpdb;

if ( ! $query->is_admin() && ! $query->is_singular() ) {
Copy link
Contributor

Choose a reason for hiding this comment

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

PhpStorm is complaining here that is_admin() is not a method found on WP_Query. I can't find a WP_Query::is_admin() method either, but also it is not throwing an error for me which is also unexpected. I suppose it is because there is a magic getter defined.

So that leads me to think that $query->is_admin() is actually always returning null and isn't returning the bool that you expect if accessing $query->is_admin.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

is_admin() will work.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We can change it to if ( ! is_admin() && ! $query->is_singular() ) {

Copy link
Contributor

Choose a reason for hiding this comment

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

For some reason $wp_query->is_admin() is returning a bool. However note:

$query = new WP_Query();
$query->is_admin = true;
$this->assertTrue( $query->is_admin() );

This test fails. All of this to say, I think that $query->is_admin should be used instead of $query->is_admin()

@valendesigns
Copy link
Contributor Author

@westonruter Looks good!

@valendesigns valendesigns changed the title [WIP] Post Creation Post Creation May 25, 2016
* Harden logic for focusing on first control in section
* Reject a promise with the error message provided.
* Export publicly_queryable among the post type args.
…t's URL

Skip showing navigation link if post type is not publicly_queryable
_.defer( function() {
firstControl.focus( {
completeCallback: function() {
firstControl.container.find( 'input:first' ).select();
Copy link
Contributor

Choose a reason for hiding this comment

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

Haha. I really did do some egregious callback nesting here didn't I 😆

westonruter and others added 9 commits May 24, 2016 23:54
…ain_query_post_type filter with any post type lookup
Always return WP_Post or WP_Error, pass back to client in error message
…odules gets created to fix ESLint checks

xwp/wp-dev-lib@046c3c5...4c79f77

d14fb0f Fix activation of plugins via WP_TEST_ACTIVATED_PLUGINS config
9a6eaba Merge pull request xwp/wp-dev-lib#176 from branch bugfix/test-activated-plugins
e34026e Ignore `node_modules` symlinks when installing `npm`.
6242f95 Merge pull request xwp/wp-dev-lib#177 from branch bugfix/ignore-node-modules-symlink
c05837c Define Paths * Define paths to the current WP install instead of using the wordpress-develop paths as per the tests bootstrap
ad82ec3 Define WP_CONTENT_DIR and WP_PLUGIN_DIR
4c79f77 Ensure symlink for node_modules gets created to fix ESLint checks
@westonruter westonruter merged commit 32e268d into develop May 25, 2016
@westonruter westonruter deleted the feature/authoring branch May 25, 2016 16:55
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Incorporate “Add New” buttons into post type panels Allow new posts and pages to be created
2 participants