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

Introduce Select2 to jump to the desired post in a post type panel #196

Merged
merged 36 commits into from Jul 22, 2016

Conversation

Projects
None yet
3 participants
@westonruter
Member

westonruter commented Jul 11, 2016

  • Eliminate adding settings for all posts and postmeta in preview and the syncing them to the pane via postMessage. Instead only keep tally of post IDs referenced, and send them up to the pane instead. Settings are then fetched once over Ajax as needed. This greatly improves performance (if there are many posts in the preview, this can yield a 100× performance boost for loading the preview).
  • Put Select2 for jumping to a post next to the Add New button, which now has its label reduced to screen reader text.
  • Selecting a post in Select2 causes the section to be loaded (data fetched as needed), focused, and for the post to be navigated in the preview (if post type is public).
  • Defer initializing partials until settings are created in preview.
  • Introduce live low-fidelity JS-based previews of post title changes while waiting for selective refresh. Fixes #43.
  • Let post section priority be tied to menu_order (if hierarchical) or post_date_gmt (if non-hierarchical). Fixes #124.
  • Eliminate static addition of post sections in PHP, switching to only add dynamically via JS. Post sections are now always active, not hiding when the post is no longer in the preview.
  • Eliminate the “no posts in preview” notice since there is now a Select2 to jump to any desired post.
  • Use customize_refresh_nonces filter for exporting customize-posts nonce to ensure it is kept fresh.
  • Add wp.customize.Posts.parseSettingId() utility function.
  • Add wp.customize.Posts.gatherFetchedPostsData() utility function.
  • Add wp.customize.Posts.addPostSettings() utility function.
  • Add wp.customize.Posts.ensurePosts() utility function, allowing plugins to ensure a post is loaded and section is present.
  • Add WP_Customize_Posts::get_settings( $post_ids ).
  • Add WP_Customize_Posts:: get_setting_params( $setting ).

Todo

  • Implement logic to fetch the post and postmeta settings for a given post ID to add a section without having to do a preview load. The pattern here has already been established in the new insertAutoDraftPost function which makes an Ajax request that returns a response containing all of the post/postmeta settings that would be needed for the new post section.
  • Potentially add a Select2 lookup field at the top of a post panel (near the new “Add Post” button) that allows you to quickly locate and load a post to edit.
  • Let's say you're on an archive where 10 posts are listed, and if you use the Select2 to edit a post that currently appears in the archive preview, that this should not result in navigating the preview away from the archive to the singular permalink.
  • Autofocus is not loading a section on demand as expected.

Fixes #124.
See #146.

@westonruter westonruter changed the title from List all posts in a given section beyond just what is in preview to [WIP] List all posts in a given section beyond just what is in preview Jul 11, 2016

westonruter added some commits Jul 11, 2016

Make text label for add new post a screen reader text; move click log…
…ic into new method; change add-new-button element into an actions element
Fix inserting a new post
* Use same get_settings() logic in auto-draft insertion request.
* Let api.Posts.addPostSection() take single settingId param instead of postType and postId.
* Introduce api.Posts.addPostSettings()
* Move addPostSection out of addSettings call.
* Introduce api.Posts.addPostSettings()
* Introduce api.Posts.parseSettingId().
* Use api.Posts.getPreviewUrl() instead of url passed back from auto-draft inerstion.
Add select2 to look up a post to load into the panel on demand
* Use customize_refresh_nonces instead of once-exported nonce.
* Move panel actions template to panel class.
Merge branch 'develop' of https://github.com/xwp/wp-customize-posts i…
…nto feature/issue-146-list-all-section-posts
@westonruter

This comment has been minimized.

Show comment
Hide comment
@westonruter

westonruter Jul 19, 2016

Member

@danielbachhuber take a look at this:

jump-to-page-1

jump-to-page-2

jump-to-page-3

Upon selection, the section is loaded, focused, and the post is loaded into the preview.

Member

westonruter commented Jul 19, 2016

@danielbachhuber take a look at this:

jump-to-page-1

jump-to-page-2

jump-to-page-3

Upon selection, the section is loaded, focused, and the post is loaded into the preview.

@westonruter westonruter changed the title from [WIP] List all posts in a given section beyond just what is in preview to Introduce Select2 to jump to the desired post in a psot type panel Jul 19, 2016

@westonruter westonruter changed the title from Introduce Select2 to jump to the desired post in a psot type panel to Introduce Select2 to jump to the desired post in a post type panel Jul 19, 2016

@danielbachhuber

This comment has been minimized.

Show comment
Hide comment
@danielbachhuber

danielbachhuber Jul 19, 2016

Contributor

Upon selection, the section is loaded, focused, and the post is loaded into the preview.

Would this apply just for the content that's out of view, or does it become the new default UI for accessing any content?

My preference would be the former, because I generally agree with the UX maxim that you shouldn't hide things from users.

Contributor

danielbachhuber commented Jul 19, 2016

Upon selection, the section is loaded, focused, and the post is loaded into the preview.

Would this apply just for the content that's out of view, or does it become the new default UI for accessing any content?

My preference would be the former, because I generally agree with the UX maxim that you shouldn't hide things from users.

@westonruter

This comment has been minimized.

Show comment
Hide comment
@westonruter

westonruter Jul 19, 2016

Member

@danielbachhuber Yes, it's UI for content that is out of view. Content that is in view would get sections added automatically. In other words, if the content is not in the preview, it wouldn't get a section added, so you'd have to use a Select2 to access it unless you wanted to navigate around the site to find an instance.

Member

westonruter commented Jul 19, 2016

@danielbachhuber Yes, it's UI for content that is out of view. Content that is in view would get sections added automatically. In other words, if the content is not in the preview, it wouldn't get a section added, so you'd have to use a Select2 to access it unless you wanted to navigate around the site to find an instance.

@westonruter westonruter changed the title from Introduce Select2 to jump to the desired post in a post type panel to [WIP] Introduce Select2 to jump to the desired post in a post type panel Jul 19, 2016

@westonruter westonruter changed the title from [WIP] Introduce Select2 to jump to the desired post in a post type panel to Introduce Select2 to jump to the desired post in a post type panel Jul 19, 2016

@westonruter westonruter added this to the 0.7 milestone Jul 20, 2016

@westonruter westonruter merged commit ca1aa64 into develop Jul 22, 2016

3 checks passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details
coverage/coveralls Coverage decreased (-3.4%) to 92.256%
Details

@westonruter westonruter deleted the feature/issue-146-list-all-section-posts branch Jul 22, 2016

@ahmadawais

This comment has been minimized.

Show comment
Hide comment
@ahmadawais

ahmadawais Jul 22, 2016

Contributor

UI for content that is out of view looks pretty slick @westonruter has it been pushed to the plugin?

Contributor

ahmadawais commented Jul 22, 2016

UI for content that is out of view looks pretty slick @westonruter has it been pushed to the plugin?

@ahmadawais

This comment has been minimized.

Show comment
Hide comment
@ahmadawais

ahmadawais Jul 22, 2016

Contributor

I believe it will be in 0.7 though, going to test the dev branch anyway.

Contributor

ahmadawais commented Jul 22, 2016

I believe it will be in 0.7 though, going to test the dev branch anyway.

@westonruter

This comment has been minimized.

Show comment
Hide comment
@westonruter

westonruter Jul 22, 2016

Member

@ahmadawais it's in the develop brach, yes. Will be part of the 0.7 release.

(Sorry for the accidental mention, @delawski.)

Member

westonruter commented Jul 22, 2016

@ahmadawais it's in the develop brach, yes. Will be part of the 0.7 release.

(Sorry for the accidental mention, @delawski.)

westonruter added a commit that referenced this pull request Jul 22, 2016

Merge pull request #199 from xwp/bugfix/select2-as-dependency
Include Select2 As a Dependency for Script

Resolves issue introduced in #196

@westonruter westonruter referenced this pull request Jul 24, 2016

Merged

Fix edit_post_link() #201

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment