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

Feature: Allow publishing from preview #115

Merged
merged 25 commits into from
Aug 6, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
0db0028
Add Publish Snapshot link.
miina Feb 9, 2017
be831ba
Add frontend JS.
miina Feb 9, 2017
e38959b
Add relevant scripts, actions.
miina Feb 9, 2017
7f214b9
Add publishing logic. Use wp.ajax.post.
miina Feb 10, 2017
24840c8
Remove todos.
miina Feb 14, 2017
0edf0de
Fix JSCS.
miina Feb 14, 2017
8270875
Fix phpcs. Fix ESLint.
miina Feb 14, 2017
10ca219
Permission fixes.
miina Feb 15, 2017
62bba49
Fix indent.
miina Feb 15, 2017
472182d
Fix phpcs.
miina Feb 15, 2017
f42969c
Add support for theme change.
miina Feb 15, 2017
c5aaa1f
Fix coveralls phpunit.
miina Feb 15, 2017
93c91e1
Change Snapshot to Changeset.
miina Feb 20, 2017
e786376
Merge develop.
miina Jul 20, 2017
2c1282f
Resolve merge conflicts. Merge two frontend js files into one.
miina Jul 27, 2017
a1ef155
Remove changeset from storage after publishing.
miina Jul 27, 2017
b6fb4e3
Rework publishing changeset to use wp_nonce_url instead of AJAX.
miina Jul 31, 2017
b2ba684
Phpcs fixes.
miina Jul 31, 2017
2aaf977
Fix logic for non-action cases.
miina Jul 31, 2017
4fd7832
Remove obsolete ajax code; ensure valid redirect; improve query param…
westonruter Aug 2, 2017
1cf34c1
Merge branch 'develop' into feature/allow_publishing_from_preview
westonruter Aug 2, 2017
8dbccab
Rename references from snapshots to changesets
westonruter Aug 6, 2017
9a424ca
Improve handling of error scenarios when publishing from frontend
westonruter Aug 6, 2017
a4d8ff9
Merge branch 'develop' of https://github.com/xwp/wp-customize-snapsho…
westonruter Aug 6, 2017
f9fc1bb
Limit admin bar links for unauthorized users
westonruter Aug 6, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix JSCS.
  • Loading branch information
miina committed Feb 14, 2017
commit 0edf0dee2cc8a5d10a22a05c8e2061655c4c8083
8 changes: 4 additions & 4 deletions js/customize-snapshots-front.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,25 +41,25 @@ var CustomizeSnapshotsFront = (function( $ ) {
var request;
e.preventDefault();

if ( ! confirm( component.data.confirmationMsg ) ) {
if ( ! window.confirm( component.data.confirmationMsg ) ) {
return false;
}
request = wp.ajax.post( component.data.action, {
nonce: component.data.snapshotsFrontendPublishNonce,
uuid: component.data.uuid
} );
request.done( function( data ) {
if ( data && data.success ){
if ( data && data.success ) {
window.location = e.target.href;
}
} );
request.fail( function( data ) {
alert( data.errorMsg );
window.alert( data.errorMsg );
} );

return true;
} );
};

return component;
})( jQuery );
})( jQuery );
4 changes: 2 additions & 2 deletions php/class-customize-snapshot-manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ function hooks() {
add_action( 'customize_controls_enqueue_scripts', array( $this, 'enqueue_controls_scripts' ) );
add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_scripts' ) );
add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_frontend_scripts' ) );
add_action( 'wp_ajax_customize-snapshots-frontend-publish', array( $this, 'snapshot_frontend_publish' ) );
add_action( 'wp_ajax_customize-snapshots-frontend-publish', array( $this, 'ajax_snapshot_frontend_publish' ) );

add_action( 'customize_controls_init', array( $this, 'add_snapshot_uuid_to_return_url' ) );
add_action( 'customize_controls_print_footer_scripts', array( $this, 'render_templates' ) );
Expand Down Expand Up @@ -977,7 +977,7 @@ public function get_customize_uuid_param() {
/**
* Publishes changeset from frontend.
*/
public function snapshot_frontend_publish() {
public function ajax_snapshot_frontend_publish() {
if ( ! check_ajax_referer( 'customize-snapshots-frontend-publish', 'nonce' ) ) {
status_header( 400 );
wp_send_json_error( 'bad_nonce' );
Expand Down