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

Add frontend preview link when snapshot is saved #57

Merged
merged 3 commits into from
Jul 11, 2016

Conversation

westonruter
Copy link
Contributor

Initial state, preview icon links to previewUrl on the frontend without a snapshot UUUID:

image

Once a change is made, the preview link is hidden because the snapshot is not saved:

image

Once the snapshot is saved, the preview link appears, this time with the URL including the customize_snapshot_uuid:

image

Once published, the initial state is restored:

image

Note that plugins can override/rewrite the URL used that is used for the frontend preview link (such as pointing to another domain for a headless WP instance) by defining a validate method like so:

wp.customize.Snapshots.frontendPreviewUrl.validate = function( url ) {
    var urlParser = document.createElement( 'a' );
    urlParser.href = url;
    urlParser.hostname = 'some-other-frontend.example.com';
    return urlParser.href;
};

@coveralls
Copy link

coveralls commented Jul 8, 2016

Coverage Status

Coverage remained the same at 92.105% when pulling 5a74134 on feature/frontend-preview-link into 5dd4ed9 on develop.

@coveralls
Copy link

coveralls commented Jul 8, 2016

Coverage Status

Coverage remained the same at 92.105% when pulling ce29035 on feature/frontend-preview-link into 5dd4ed9 on develop.

@coveralls
Copy link

coveralls commented Jul 8, 2016

Coverage Status

Coverage remained the same at 92.105% when pulling 194c9de on feature/frontend-preview-link into 5dd4ed9 on develop.

@valendesigns valendesigns merged commit 04c80c0 into develop Jul 11, 2016
@valendesigns valendesigns deleted the feature/frontend-preview-link branch July 11, 2016 20:55
@westonruter westonruter modified the milestone: 0.5.0 Aug 12, 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