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

Commit 9ab02b8

Browse files
committed
Reverse order of edit and frontend preview links
1 parent 74533b7 commit 9ab02b8

File tree

2 files changed

+22
-24
lines changed

2 files changed

+22
-24
lines changed

js/customize-snapshots.js

+21-21
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,27 @@
220220
component.snapshotButton.prop( 'disabled', true );
221221
component.snapshotButton.insertAfter( publishButton );
222222

223-
// Schedule button.
223+
// Preview link.
224+
component.previewLink = $( $.trim( wp.template( 'snapshot-preview-link' )() ) );
225+
component.previewLink.toggle( api.state( 'snapshot-saved' ).get() );
226+
component.previewLink.attr( 'target', component.data.uuid );
227+
setPreviewLinkHref = _.debounce( function() {
228+
if ( api.state( 'snapshot-exists' ).get() ) {
229+
component.previewLink.attr( 'href', component.getSnapshotFrontendPreviewUrl() );
230+
} else {
231+
component.previewLink.attr( 'href', component.frontendPreviewUrl.get() );
232+
}
233+
} );
234+
component.frontendPreviewUrl.bind( setPreviewLinkHref );
235+
setPreviewLinkHref();
236+
api.state.bind( 'change', setPreviewLinkHref );
237+
api.bind( 'saved', setPreviewLinkHref );
238+
component.snapshotButton.after( component.previewLink );
239+
api.state( 'snapshot-saved' ).bind( function( saved ) {
240+
component.previewLink.toggle( saved );
241+
} );
242+
243+
// Edit button.
224244
component.snapshotExpandButton = $( $.trim( wp.template( 'snapshot-expand-button' )( {} ) ) );
225245
component.snapshotExpandButton.insertAfter( component.snapshotButton );
226246

@@ -286,26 +306,6 @@
286306
}
287307
} );
288308

289-
// Preview link.
290-
component.previewLink = $( $.trim( wp.template( 'snapshot-preview-link' )() ) );
291-
component.previewLink.toggle( api.state( 'snapshot-saved' ).get() );
292-
component.previewLink.attr( 'target', component.data.uuid );
293-
setPreviewLinkHref = _.debounce( function() {
294-
if ( api.state( 'snapshot-exists' ).get() ) {
295-
component.previewLink.attr( 'href', component.getSnapshotFrontendPreviewUrl() );
296-
} else {
297-
component.previewLink.attr( 'href', component.frontendPreviewUrl.get() );
298-
}
299-
} );
300-
component.frontendPreviewUrl.bind( setPreviewLinkHref );
301-
setPreviewLinkHref();
302-
api.state.bind( 'change', setPreviewLinkHref );
303-
api.bind( 'saved', setPreviewLinkHref );
304-
component.snapshotButton.after( component.previewLink );
305-
api.state( 'snapshot-saved' ).bind( function( saved ) {
306-
component.previewLink.toggle( saved );
307-
} );
308-
309309
// Submit for review button.
310310
if ( ! component.data.currentUserCanPublish ) {
311311
publishButton.hide();

php/class-customize-snapshot-manager.php

+1-3
Original file line numberDiff line numberDiff line change
@@ -1405,8 +1405,6 @@ public function remove_all_non_snapshot_admin_bar_links( $wp_admin_bar ) {
14051405
*/
14061406
public function render_templates() {
14071407
$data = $this->get_month_choices();
1408-
1409-
$description = __( 'Schedule changes to publish (go live) at a future date.', 'customize-snapshots' );
14101408
?>
14111409
<script type="text/html" id="tmpl-snapshot-preview-link">
14121410
<a href="#" target="frontend-preview" id="snapshot-preview-link" class="dashicons dashicons-welcome-view-site" title="<?php esc_attr_e( 'View on frontend', 'customize-snapshots' ) ?>">
@@ -1442,7 +1440,7 @@ public function render_templates() {
14421440
<span class="reset-time">(<a href="#" title="<?php esc_attr_e( 'Reset scheduled date to original or current date', 'customize-snapshots' ); ?>"><?php esc_html_e( 'Reset', 'customize-snapshots' ) ?></a>)</span>
14431441
</label>
14441442
<p class="snapshot-schedule-description">
1445-
<?php echo esc_html( $description ); ?>
1443+
<?php esc_html_e( 'Schedule changes to publish (go live) at a future date.', 'customize-snapshots' ); ?>
14461444
</p>
14471445
<div class="snapshot-schedule-control date-inputs clear">
14481446
<label>

0 commit comments

Comments
 (0)