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

Ensure frontend links and Ajax requests include UUID query param; add previewing of Ajax requests and form submissions #70

Merged
merged 32 commits into from Aug 10, 2016

Conversation

westonruter
Copy link
Contributor

@westonruter westonruter commented Aug 7, 2016

When previewing a snapshot on the frontend, the admin bar is modified accordingly:

wordpress_develop_food_ _just_another_customizer-driven_site_

- (Unchanged) The “Customize” link takes you to the Customizer with that snapshot state applied. - The “Inspect Snapshot” link takes you to the edit post screen (formerly submenu item under Customize). - A new “Exit Snapshot Preview” link appears which removes the `customize_snapshot_uuid` query param from the current URL. - All other admin bar links are removed, other than those which already contain the `customize_snapshot_uuid` query param (as in the Airplane Mode toggle shown here), or which are in-page links, such as the query monitor link.

When you are navigating around the site with a snapshot applied, the sessionStorage will store the UUID for this snapshot. While the JS will attempt to inject the customize_snapshot_uuid into all links in the document, if you do navigate away from a URL that has this query param, the JS on the new non-snapshotted page will see that you have a snapshot UUID in sessionStorage but no snapshot in the URL, and it will add an admin bar link to prompt you to resume the snapshot preview:

wordpress_develop_ _just_another_customizer-driven_site__and_2__vagrant_vvv_____bash_

This PR also ensures that Ajax requests made on the frontend include the customize_snapshot_uuid param so that the responses can be previewed. Additionally, Ajax requests made inside the Customizer preview also now get the Customizer state added so that their responses should be previewable as well.

Lastly, forms that have GET request methods (such as the search form) now are actually usable in the Customizer preview! Likewise, forms on the frontend will persist the current customize_snapshot_uuid in the requests. This fixes a long-standing Trac ticket #20714: Theme customizer: Impossible to preview a search results page. See sub-PR #72.

Fixes #47
Fixes #65

@coveralls
Copy link

coveralls commented Aug 7, 2016

Coverage Status

Coverage decreased (-0.9%) to 86.538% when pulling c1ce097 on feature/previewing-improvements into a928d18 on develop.

@coveralls
Copy link

coveralls commented Aug 7, 2016

Coverage Status

Coverage increased (+0.1%) to 87.557% when pulling 8bf8be2 on feature/previewing-improvements into a928d18 on develop.

@coveralls
Copy link

coveralls commented Aug 7, 2016

Coverage Status

Coverage increased (+0.2%) to 87.585% when pulling 0d74731 on feature/previewing-improvements into a928d18 on develop.

@coveralls
Copy link

coveralls commented Aug 7, 2016

Coverage Status

Coverage increased (+0.3%) to 87.753% when pulling ae9593d on feature/previewing-improvements into a928d18 on develop.

@coveralls
Copy link

coveralls commented Aug 8, 2016

Coverage Status

Coverage increased (+1.6%) to 88.999% when pulling 1100a2e on feature/previewing-improvements into a928d18 on develop.

@coveralls
Copy link

coveralls commented Aug 8, 2016

Coverage Status

Coverage increased (+1.7%) to 89.13% when pulling dd8e944 on feature/previewing-improvements into a928d18 on develop.

@coveralls
Copy link

coveralls commented Aug 8, 2016

Coverage Status

Coverage increased (+1.7%) to 89.13% when pulling 32c9c71 on feature/previewing-improvements into a928d18 on develop.

* Add is_previewing_settings() and current_snapshot_uuid() helper functions.
* Add example for how to bypass cache appropriately.
@coveralls
Copy link

coveralls commented Aug 8, 2016

Coverage Status

Coverage increased (+1.7%) to 89.103% when pulling e08290a on feature/previewing-improvements into a928d18 on develop.

@coveralls
Copy link

coveralls commented Aug 8, 2016

Coverage Status

Coverage increased (+1.7%) to 89.103% when pulling e08290a on feature/previewing-improvements into a928d18 on develop.

@westonruter westonruter changed the title [WIP] Ensure frontend links and Ajax requests include UUID query param Ensure frontend links and Ajax requests include UUID query param Aug 8, 2016
@westonruter westonruter changed the title Ensure frontend links and Ajax requests include UUID query param Ensure frontend links and Ajax requests include UUID query param; add previewing of Ajax requests in Customizer Preview Aug 8, 2016
@coveralls
Copy link

coveralls commented Aug 8, 2016

Coverage Status

Coverage increased (+0.6%) to 88.013% when pulling 50b04d3 on feature/previewing-improvements into a928d18 on develop.

@westonruter westonruter added this to the 0.5.0 milestone Aug 9, 2016
@coveralls
Copy link

coveralls commented Aug 9, 2016

Coverage Status

Coverage increased (+1.1%) to 88.536% when pulling f2e5a17 on feature/previewing-improvements into a928d18 on develop.

@coveralls
Copy link

coveralls commented Aug 9, 2016

Coverage Status

Coverage increased (+2.1%) to 89.56% when pulling be2a9cd on feature/previewing-improvements into a928d18 on develop.

@westonruter westonruter changed the title Ensure frontend links and Ajax requests include UUID query param; add previewing of Ajax requests in Customizer Preview Ensure frontend links and Ajax requests include UUID query param; add previewing of Ajax requests and form submissions Aug 10, 2016
@valendesigns
Copy link
Contributor

@westonruter Looks good! 👍

@coveralls
Copy link

coveralls commented Aug 10, 2016

Coverage Status

Coverage increased (+2.1%) to 89.511% when pulling 9d1ad7a on feature/previewing-improvements into a928d18 on develop.

@valendesigns valendesigns merged commit b53f954 into develop Aug 10, 2016
@valendesigns valendesigns deleted the feature/previewing-improvements branch August 10, 2016 05:15
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
3 participants