mirror of
https://github.com/WordPress/five-for-the-future.git
synced 2025-04-20 18:13:44 +03:00
Pledge List Filters: Update style and add filter on-change functionality
- Style search box & filter dropdown - Enable sort filter on select change - Fix some PHP notices
This commit is contained in:
parent
5b5a1d50ff
commit
14ed8d4d6b
|
@ -10,6 +10,8 @@ if ( ! have_posts() ) {
|
||||||
nocache_headers();
|
nocache_headers();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$pledge_order = isset( $_GET['order'] ) ? $_GET['order'] : '';
|
||||||
|
|
||||||
get_header(); ?>
|
get_header(); ?>
|
||||||
|
|
||||||
<main id="main" class="site-main" role="main">
|
<main id="main" class="site-main" role="main">
|
||||||
|
@ -28,13 +30,13 @@ get_header(); ?>
|
||||||
<form method="get" action="<?php echo esc_url( get_post_type_archive_link( CPT_ID ) ); ?>">
|
<form method="get" action="<?php echo esc_url( get_post_type_archive_link( CPT_ID ) ); ?>">
|
||||||
<label for="pledge-sort"><?php esc_html_e( 'Sort pledges by', 'wordpressorg' ); ?></label>
|
<label for="pledge-sort"><?php esc_html_e( 'Sort pledges by', 'wordpressorg' ); ?></label>
|
||||||
<select class="custom-select" id="pledge-sort" name="order">
|
<select class="custom-select" id="pledge-sort" name="order">
|
||||||
<option value="" <?php selected( $_GET['order'], '' ); ?>>
|
<option value="" <?php selected( $pledge_order, '' ); ?>>
|
||||||
<?php esc_html_e( 'All Pledges', 'wordpressorg' ); ?>
|
<?php esc_html_e( 'All Pledges', 'wordpressorg' ); ?>
|
||||||
</option>
|
</option>
|
||||||
<option value="alphabetical" <?php selected( $_GET['order'], 'alphabetical' ); ?>>
|
<option value="alphabetical" <?php selected( $pledge_order, 'alphabetical' ); ?>>
|
||||||
<?php esc_html_e( 'Alphabetical', 'wordpressorg' ); ?>
|
<?php esc_html_e( 'Alphabetical', 'wordpressorg' ); ?>
|
||||||
</option>
|
</option>
|
||||||
<option value="contributors" <?php selected( $_GET['order'], 'contributors' ); ?>>
|
<option value="contributors" <?php selected( $pledge_order, 'contributors' ); ?>>
|
||||||
<?php esc_html_e( 'Total Contributors', 'wordpressorg' ); ?>
|
<?php esc_html_e( 'Total Contributors', 'wordpressorg' ); ?>
|
||||||
</option>
|
</option>
|
||||||
</select>
|
</select>
|
||||||
|
@ -68,5 +70,10 @@ get_header(); ?>
|
||||||
|
|
||||||
</main><!-- #main -->
|
</main><!-- #main -->
|
||||||
|
|
||||||
|
<script type="text/javascript">
|
||||||
|
jQuery( "#pledge-sort" ).change( function( event ) {
|
||||||
|
jQuery( event.target ).closest( 'form' ).submit();
|
||||||
|
} );
|
||||||
|
</script>
|
||||||
<?php
|
<?php
|
||||||
get_footer();
|
get_footer();
|
||||||
|
|
|
@ -3,14 +3,13 @@
|
||||||
.custom-select {
|
.custom-select {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
margin: -0.5rem 0;
|
|
||||||
padding: 0.5rem 2rem 0.5rem .8rem;
|
padding: 0.5rem 2rem 0.5rem .8rem;
|
||||||
width: auto;
|
width: auto;
|
||||||
|
|
||||||
font-size: 1em;
|
font-size: 1em;
|
||||||
line-height: 1.3;
|
line-height: 1.3;
|
||||||
|
|
||||||
border: none;
|
border: 1px solid $color__text-lighter;
|
||||||
box-shadow: none;
|
box-shadow: none;
|
||||||
border-radius: 0.5em;
|
border-radius: 0.5em;
|
||||||
-moz-appearance: none;
|
-moz-appearance: none;
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
@import "pledge-contributors";
|
@import "pledge-contributors";
|
||||||
@import "pledge-list";
|
@import "pledge-list";
|
||||||
@import "pledge-single";
|
@import "pledge-single";
|
||||||
|
@import "search-form";
|
||||||
@import "site-content";
|
@import "site-content";
|
||||||
@import "site-header";
|
@import "site-header";
|
||||||
@import "site-title";
|
@import "site-title";
|
||||||
|
|
|
@ -21,28 +21,23 @@ body.archive.post-type-archive-5ftf_pledge {
|
||||||
.page-header-callout {
|
.page-header-callout {
|
||||||
grid-column: 2;
|
grid-column: 2;
|
||||||
grid-row: 1;
|
grid-row: 1;
|
||||||
|
|
||||||
|
.button {
|
||||||
|
padding: 0.5em 1.5em;
|
||||||
|
height: auto;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.page-header-controls {
|
.page-header-controls {
|
||||||
grid-column: 1 / span 2;
|
grid-column: 1 / span 2;
|
||||||
grid-row: 2;
|
grid-row: 2;
|
||||||
|
|
||||||
display: grid;
|
display: flex;
|
||||||
grid-template-columns: 1fr 1fr;
|
flex-wrap: wrap;
|
||||||
|
justify-content: space-between;
|
||||||
margin-top: ms(2);
|
margin-top: ms(2);
|
||||||
border-top: 1px solid $color-gray-light-500;
|
border-top: 1px solid $color-gray-light-500;
|
||||||
padding-top: ms(2);
|
padding-top: ms(2);
|
||||||
|
|
||||||
form:nth-of-type(2n+1) {
|
|
||||||
grid-column: 1;
|
|
||||||
grid-row: 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
form:nth-of-type(2n) {
|
|
||||||
grid-column: 2;
|
|
||||||
grid-row: 1;
|
|
||||||
text-align: right;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -51,6 +46,7 @@ body.archive.post-type-archive-5ftf_pledge {
|
||||||
|
|
||||||
label {
|
label {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
|
margin-right: 6px;
|
||||||
font-size: 1em;
|
font-size: 1em;
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
}
|
}
|
||||||
|
|
38
themes/wporg-5ftf/css/components/_search-form.scss
Normal file
38
themes/wporg-5ftf/css/components/_search-form.scss
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
.search-form {
|
||||||
|
|
||||||
|
.site-main & {
|
||||||
|
display: flex;
|
||||||
|
align-items: stretch;
|
||||||
|
justify-content: flex-end;
|
||||||
|
border: 1px solid $color-gray-light-600;
|
||||||
|
background: $color-gray-light-100;
|
||||||
|
|
||||||
|
.search-field {
|
||||||
|
flex: 0 1 auto;
|
||||||
|
margin: 0;
|
||||||
|
padding: 0.8em 1em;
|
||||||
|
background: transparent;
|
||||||
|
border: none;
|
||||||
|
box-shadow: none;
|
||||||
|
|
||||||
|
&::-moz-placeholder {
|
||||||
|
color: $color-gray-200;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.button-search {
|
||||||
|
flex: 0 1 auto;
|
||||||
|
height: auto;
|
||||||
|
background: transparent;
|
||||||
|
border: none;
|
||||||
|
border-radius: 0;
|
||||||
|
box-shadow: none;
|
||||||
|
text-shadow: none;
|
||||||
|
color: $color-gray-200;
|
||||||
|
|
||||||
|
&:focus {
|
||||||
|
outline: 2px solid $color__wporg-blue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue