-
Notifications
You must be signed in to change notification settings - Fork 10
Add snapshot fork feature #90
Conversation
1 similar comment
|
@westonruter / @valendesigns This PR is ready for review. |
js/customize-snapshots-admin.js
Outdated
|
|
||
| component.forkClick = function() { | ||
| var $forkButton = $( '#snapshot-fork' ), | ||
| $forkSnipper = $( '.snapshot-fork-spinner' ), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could change this to $spinner or at the very least fix the typo and change it to $forkSpinner.
js/customize-snapshots-admin.js
Outdated
| var $forkButton = $( '#snapshot-fork' ), | ||
| $forkSnipper = $( '.snapshot-fork-spinner' ), | ||
| $forkList = $( '#snapshot-fork-list' ), | ||
| forkItemTemplate = wp.template( 'snapshot-fork-item' ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add return space.
js/customize-snapshots-admin.js
Outdated
| request = wp.ajax.post( 'snapshot_fork', { | ||
| ID: $forkButton.data( 'post-id' ), | ||
| nonce: $forkButton.data( 'nonce' ) | ||
| } ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add return space.
js/customize-snapshots-admin.js
Outdated
| } ); | ||
| request.always( function() { | ||
| $forkSnipper.removeClass( 'is-active' ); | ||
| } ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add return space.
js/customize-snapshots-admin.js
Outdated
| var item; | ||
| item = $( $.trim( forkItemTemplate( data ) ) ); | ||
| $forkList.append( item ); | ||
| } ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add return space.
| * @param String $hook Current page. | ||
| */ | ||
| public function enqueue_admin_scripts( $hook ) { | ||
| global $post; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could be moved into the conditional, and add return space after the global.
| $frontend_view_url = get_permalink( $post->ID ); | ||
| echo sprintf( | ||
| '<a href="%s" class="button button-secondary">%s</a>', | ||
| '<a href="%s" class="button button-secondary">%s</a> ', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the extra whitespace in this line change a typo?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is a change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If it's just to add visual space to the buttons then it should probably be done with CSS on #snapshot-fork instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just being consistent with
| '<a href="%s" class="button button-secondary">%s</a> ', |
Should I remove space between both button and add CSS?
php/class-post-type.php
Outdated
| echo sprintf( '%1$s %2$s %3$s', esc_html__( 'Modified:', 'customize-snapshots' ), esc_html( get_the_modified_date( '' ) ), esc_html( get_the_modified_time( '' ) ) ) . '<br>'; | ||
| echo '</p>'; | ||
|
|
||
| $fork_markup = '<a href="#" id="snapshot-fork" class="button button-secondary" data-post-id="' . $post->ID . '" data-nonce="' . wp_create_nonce( 'snapshot-fork' ) . '">' . esc_html__( 'Fork', 'customize-snapshots' ) . '</a>'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be a button not a link and also using sprintf would clean things up. Something like:
$fork_markup = sprintf(
'<button id="snapshot-fork" class="button button-secondary" data-post-id="%s" data-nonce="%s">%s</button><span class="spinner snapshot-fork-spinner"></span>',
$post->ID,
wp_create_nonce( 'snapshot-fork' ),
esc_html__( 'Fork', 'customize-snapshots' )
);
| } ?> | ||
| </ul><?php | ||
| if ( $post->post_parent ) { | ||
| $parent = get_post( $post->post_parent ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could probably remove the and just add a space.
|
Todo:
|
|
Looks good, Ready for review. @westonruter |
…utton * Add fork button to Changeset Forks metabox. * Increase number of forked changesets listed, with showing message if more than 100 exist.
81499a3 to
9506db0
Compare
|
It appears that the coveralls Composer package is broken. I can see:
I'll disable it. |
9506db0 to
49afc85
Compare
Fixes: #41
Any UI improvements are welcome.
Remaining: