Skip to content
This repository was archived by the owner on Dec 27, 2022. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
b21c9ac
Allow snapshot to publish
PatelUtkarsh Jul 20, 2016
6e5debc
Fix unit test
PatelUtkarsh Jul 20, 2016
9d87000
Add expected actions from WP_Customize_Manager::save() when snapshot …
PatelUtkarsh Jul 21, 2016
1899d44
Update code of publish snapshot and add unit test
PatelUtkarsh Jul 21, 2016
516975c
Use snapshot manager method to init
PatelUtkarsh Jul 22, 2016
9d6ff83
Add edit snapshot post link
PatelUtkarsh Jul 22, 2016
2742e57
Fix unit-test
PatelUtkarsh Jul 22, 2016
c934531
Code review changes
PatelUtkarsh Jul 23, 2016
30f5dc6
Add save error on publish
PatelUtkarsh Jul 25, 2016
8d2aa9b
Fix unit test
PatelUtkarsh Jul 25, 2016
0ece6a2
Update unit-test
PatelUtkarsh Jul 25, 2016
730d1ad
Fix param issue
PatelUtkarsh Jul 25, 2016
253119d
[WIP] Fix unit-test
PatelUtkarsh Jul 25, 2016
cfb77b7
Fix infinite recursion in publish_snapshot_with_customize_save_after
westonruter Jul 25, 2016
70e5ff2
Use non-raw editLink template var
westonruter Jul 25, 2016
1cdf3ca
Ensure that new_customize_snapshot_uuid is returned by filter
westonruter Jul 25, 2016
1413ccb
Display error on published snapshot is any has setting error
PatelUtkarsh Jul 25, 2016
74faae2
Change static suppress_publish_hook to class member
PatelUtkarsh Jul 25, 2016
fb15ec7
Show localized error messages insetad of codes
westonruter Jul 25, 2016
4c497aa
Rename save_error to publish_error
westonruter Jul 25, 2016
4e3dbf4
Improve display of values that are empty strings
westonruter Jul 25, 2016
bde9eaa
Show admin notice when attempting to publish a snapshot with errored …
westonruter Jul 26, 2016
4b501ed
Skip check_customize_publish_authorization if not customize_save ajax…
westonruter Jul 26, 2016
5ef4f96
[WIP] Add prepare_snapshot_post_content_for_publish
westonruter Jul 26, 2016
795624d
Disable revision revert and publish metabox options for published sna…
westonruter Jul 26, 2016
88ba1fe
Introduce new doing_customize_save_ajax method without DOING_AJAX dep…
westonruter Jul 26, 2016
db98bfb
Add test stubs and improve coverage
westonruter Jul 26, 2016
d5ef5f2
Hide update button if snapshot published
westonruter Jul 27, 2016
e4c3002
Abort previewing already-published snapshots; prevent updates to publ…
westonruter Jul 27, 2016
f3b1436
Add hack to prevent WP_Customize_Widgets::customize_register from pre…
westonruter Jul 27, 2016
04cafb7
Merge branch 'feature/refactor' of https://github.com/xwp/wp-customiz…
westonruter Jul 27, 2016
823c658
Remove todo that was done
westonruter Jul 27, 2016
8976556
Add tests for disable_revision_ui_for_published_posts and hide_disabl…
westonruter Jul 27, 2016
5e56db1
Add tests for show_publish_error_admin_notice
westonruter Jul 27, 2016
f0b345c
Add unit test for prepare_snapshot_post_content_for_publish
PatelUtkarsh Jul 27, 2016
c55a906
Add unit test for save_settings_with_publish_snapshot
PatelUtkarsh Jul 27, 2016
b413115
Use test class object for WP_Customize_Manager
PatelUtkarsh Jul 27, 2016
a937a87
Fix unit tests in WP 4.5.x
westonruter Jul 27, 2016
1a7e8c8
Prevent edit_post_link from being double-encoded
westonruter Jul 27, 2016
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
5 changes: 4 additions & 1 deletion css/customize-snapshots.css
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
#snapshot-preview-link {
#snapshot-preview-link, #snapshot-edit-link {
float: right;
margin-top: 13px;
margin-right: 4px;
color: #656a6f;
}
#snapshot-edit-link{
display: block;
}

#snapshot-preview-link:hover,
#snapshot-preview-link:focus,
Expand Down
26 changes: 25 additions & 1 deletion js/customize-snapshots.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,9 @@
component.data.uuid = response.new_customize_snapshot_uuid;
component.previewLink.attr( 'target', component.data.uuid );
}
if ( response.edit_link ) {
component.data.editLink = response.edit_link;
}

api.state( 'snapshot-exists' ).set( false );

Expand Down Expand Up @@ -156,7 +159,8 @@
component.addButtons = function() {
var header = $( '#customize-header-actions' ),
publishButton = header.find( '#save' ),
snapshotButton, submitButton, data, setPreviewLinkHref;
snapshotEditLinkTemplate = wp.template( 'snapshot-edit-link' ),
snapshotButton, submitButton, data, setPreviewLinkHref, snapshotEditLinkEl;

// Save/update button.
snapshotButton = wp.template( 'snapshot-save' );
Expand All @@ -169,13 +173,25 @@
}
snapshotButton.prop( 'disabled', true );
snapshotButton.insertAfter( publishButton );

snapshotEditLinkEl = $( $.trim( snapshotEditLinkTemplate( component.data ) ) );
snapshotEditLinkEl.insertAfter( snapshotButton );
if ( ! component.data.editLink ) {
snapshotEditLinkEl.hide();
}

api.state( 'snapshot-saved' ).bind( function( saved ) {
snapshotButton.prop( 'disabled', saved );
if ( saved ) {
snapshotEditLinkEl.attr( 'href', component.data.editLink );
snapshotEditLinkEl.show();
}
} );

api.state( 'saved' ).bind( function( saved ) {
if ( saved ) {
snapshotButton.prop( 'disabled', true );
snapshotEditLinkEl.hide();
}
} );
api.bind( 'change', function() {
Expand All @@ -187,9 +203,14 @@
if ( exists ) {
buttonText = component.data.i18n.updateButton;
permsMsg = component.data.i18n.permsMsg.update;
if ( component.data.editLink ) {
snapshotEditLinkEl.attr( 'href', component.data.editLink );
snapshotEditLinkEl.show();
}
} else {
buttonText = component.data.i18n.saveButton;
permsMsg = component.data.i18n.permsMsg.save;
snapshotEditLinkEl.hide();
}

snapshotButton.text( buttonText );
Expand Down Expand Up @@ -284,6 +305,9 @@
spinner.addClass( 'is-active' );
request.always( function( response ) {
spinner.removeClass( 'is-active' );
if ( response.edit_link ) {
component.data.editLink = response.edit_link;
}

// @todo Remove privateness from _handleSettingValidities in Core.
if ( api._handleSettingValidities && response.setting_validities ) {
Expand Down
Loading