Skip to content

Commit

Permalink
Add vertical 'divider' next to the 'Accept' and 'Reject' buttons
Browse files Browse the repository at this point in the history
Per the designs, this applies the 'divider.'
There are about 20px on either side of it,
per a design decision to make this space similar
to that on /wp-admin/edit.php?post_type=page,
between 'Apply' and 'All dates.'
  • Loading branch information
kienstra committed Sep 25, 2018
1 parent e69d2f1 commit c714c21
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 8 deletions.
13 changes: 13 additions & 0 deletions assets/css/amp-validation-single-error-url.css
Original file line number Diff line number Diff line change
Expand Up @@ -140,3 +140,16 @@ table.striped > tbody > tr.even {
#post-body-content button.reject {
margin-left: 4px;
}

#accept-reject-buttons:not(.hidden) {
display: inline-block;
}

#vertical-divider {
display: inline-block;
vertical-align: middle;
width: 15px;
margin-right: 15px;
height: 30px;
border-right: 1px solid #a0a5aa;
}
7 changes: 3 additions & 4 deletions assets/js/amp-invalid-url-post-edit-screen.js
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,7 @@ var ampInvalidUrlPostEditScreen = ( function() { // eslint-disable-line no-unuse
component.handleBulkActions = function handleBulkActions() {
const acceptButton = document.querySelector( 'button.action.accept' );
const rejectButton = document.querySelector( 'button.action.reject' );
const acceptAndRejectContainer = document.getElementById( 'accept-reject-buttons' );

const onChange = function( event ) {
let areThereCheckedBoxes;
Expand All @@ -317,8 +318,7 @@ var ampInvalidUrlPostEditScreen = ( function() { // eslint-disable-line no-unuse

if ( event.target.checked ) {
// This checkbox was checked, so ensure the buttons display.
acceptButton.classList.remove( 'hidden' );
rejectButton.classList.remove( 'hidden' );
acceptAndRejectContainer.classList.remove( 'hidden' );
} else {
/*
* This checkbox was unchecked.
Expand All @@ -332,8 +332,7 @@ var ampInvalidUrlPostEditScreen = ( function() { // eslint-disable-line no-unuse
}
} );
if ( ! areThereCheckedBoxes ) {
acceptButton.classList.add( 'hidden' );
rejectButton.classList.add( 'hidden' );
acceptAndRejectContainer.classList.add( 'hidden' );
}
}
};
Expand Down
7 changes: 5 additions & 2 deletions includes/validation/class-amp-invalid-url-post-type.php
Original file line number Diff line number Diff line change
Expand Up @@ -1753,8 +1753,11 @@ public static function render_single_url_list_table( $post ) {
<?php $wp_list_table->search_box( esc_html__( 'Search Errors', 'amp' ), 'invalid-url-search' ); ?>
</form>

<button type="button" class="hidden button action accept"><?php esc_html_e( 'Accept', 'amp' ); ?></button>
<button type="button" class="hidden button action reject"><?php esc_html_e( 'Reject', 'amp' ); ?></button>
<div id="accept-reject-buttons" class="hidden">
<button type="button" class="button action accept"><?php esc_html_e( 'Accept', 'amp' ); ?></button>
<button type="button" class="button action reject"><?php esc_html_e( 'Reject', 'amp' ); ?></button>
<div id="vertical-divider"></div>
</div>
<div id="url-post-filter" class="alignleft actions">
<?php AMP_Validation_Error_Taxonomy::render_error_type_filter(); ?>
</div>
Expand Down
5 changes: 3 additions & 2 deletions tests/validation/test-class-amp-invalid-url-post-type.php
Original file line number Diff line number Diff line change
Expand Up @@ -1237,8 +1237,9 @@ public function test_render_single_url_list_table() {
AMP_Invalid_URL_Post_Type::render_single_url_list_table( $post_correct_post_type );
$output = ob_get_clean();
$this->assertContains( '<form class="search-form wp-clearfix" method="get">', $output );
$this->assertContains( '<button type="button" class="hidden button action accept">', $output );
$this->assertContains( '<button type="button" class="hidden button action reject">', $output );
$this->assertContains( '<div id="accept-reject-buttons" class="hidden">', $output );
$this->assertContains( '<button type="button" class="button action accept">', $output );
$this->assertContains( '<button type="button" class="button action reject">', $output );
}

/**
Expand Down

0 comments on commit c714c21

Please sign in to comment.