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

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

Merged
merged 36 commits into from Jul 22, 2016

Conversation

westonruter
Copy link
Contributor

@westonruter 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 Add live JS updates to post titles while waiting for selective refresh #43.
  • Let post section priority be tied to menu_order (if hierarchical) or post_date_gmt (if non-hierarchical). Fixes Post List Doesn't Update in Sync with Pagination #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 List all posts in a given section beyond just what is in preview [WIP] List all posts in a given section beyond just what is in preview Jul 11, 2016
…ic into new method; change add-new-button element into an actions element
* 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.
@westonruter westonruter force-pushed the feature/issue-146-list-all-section-posts branch from f01f39a to 561cf1d Compare July 18, 2016 06:05
@westonruter
Copy link
Contributor Author

@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 [WIP] List all posts in a given section beyond just what is in preview Introduce Select2 to jump to the desired post in a psot type panel Jul 19, 2016
@westonruter westonruter changed the title Introduce Select2 to jump to the desired post in a psot type panel Introduce Select2 to jump to the desired post in a post type panel Jul 19, 2016
@danielbachhuber
Copy link
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.

@westonruter
Copy link
Contributor Author

@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 Introduce Select2 to jump to the desired post in a post type panel [WIP] Introduce Select2 to jump to the desired post in a post type panel Jul 19, 2016
@westonruter westonruter changed the title [WIP] Introduce Select2 to jump to the desired post in a post type panel 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
@westonruter westonruter deleted the feature/issue-146-list-all-section-posts branch July 22, 2016 00:33
@ahmadawais
Copy link
Contributor

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

@ahmadawais
Copy link
Contributor

ahmadawais commented Jul 22, 2016

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

@westonruter
Copy link
Contributor Author

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
Include Select2 As a Dependency for Script

Resolves issue introduced in #196
@westonruter westonruter mentioned this pull request Jul 24, 2016
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.

None yet

3 participants