Skip to content

Commit 37846b4

Browse files
committed
[MOOSE-350]: fix fselect; fix flyout theme; remove all posts option
1 parent 3800314 commit 37846b4

File tree

6 files changed

+15
-30
lines changed

6 files changed

+15
-30
lines changed

wp-content/plugins/core/src/Components/Blocks/FacetWP_Grid_Controller.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ class FacetWP_Grid_Controller extends Abstract_Block_Controller {
88

99
protected \WP_Query $query;
1010
protected string $post_type;
11-
protected bool $show_all_posts;
1211
protected int $posts_per_page;
1312
protected bool $show_pagination;
1413

@@ -18,7 +17,6 @@ public function __construct( array $args = [] ) {
1817
$this->block_classes .= ' facetwp-template';
1918

2019
$this->post_type = $this->attributes['postType'] ?? 'post';
21-
$this->show_all_posts = $this->attributes['showAllPosts'] ?? false;
2220
$this->posts_per_page = absint( $this->attributes['postsPerPage'] ?? 12 );
2321
$this->show_pagination = $this->attributes['showPagination'] ?? false;
2422

@@ -56,7 +54,7 @@ private function set_query(): void {
5654
$this->query = new \WP_Query( [
5755
'post_type' => $this->post_type,
5856
'post_status' => 'publish',
59-
'posts_per_page' => $this->show_all_posts ? -1 : $this->posts_per_page,
57+
'posts_per_page' => $this->posts_per_page,
6058
'facetwp' => true,
6159
] );
6260
}

wp-content/themes/core/assets/pcss/integrations/facetwp.pcss

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@
140140

141141
.fs-option {
142142
--checkbox-size: 24px;
143+
position: relative;
143144

144145
/* top and bottom padding = half of the spacer-30 (helps each item have a larger click target)
145146
left padding = spacer-20 + checkbox size + spacer-10 [label displays here] */
@@ -170,6 +171,7 @@
170171
}
171172

172173
&.selected {
174+
background-color: transparent;
173175

174176
.fs-checkbox {
175177
border-color: var(--color-black);

wp-content/themes/core/blocks/tribe/facetwp-filter-bar/js/flyout.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ const openFlyout = ( block ) => {
8989

9090
trigger.setAttribute( 'aria-expanded', 'true' );
9191
flyout.setAttribute( 'aria-hidden', 'false' );
92+
flyout.classList.add( 'is-style-white' );
9293
flyout.classList.add( 'is-open' );
9394
bodyLock( true );
9495
closeBtn.focus();
@@ -114,6 +115,7 @@ const closeFlyout = ( block ) => {
114115
trigger.setAttribute( 'aria-expanded', 'false' );
115116
flyout.setAttribute( 'aria-hidden', 'true' );
116117
flyout.classList.remove( 'is-open' );
118+
flyout.classList.remove( 'is-style-white' );
117119
bodyLock( false );
118120
trigger.focus();
119121
flyout.removeEventListener( 'keydown', flyoutKeydown );

wp-content/themes/core/blocks/tribe/facetwp-filter-bar/style.pcss

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,7 @@
253253
overflow: auto;
254254
visibility: hidden;
255255
opacity: 0;
256+
color: var(--color-black);
256257
transition: visibility 0.2s, opacity 0.2s;
257258

258259
&[aria-hidden="false"].is-open {
@@ -270,6 +271,7 @@
270271
box-shadow: none;
271272
border-top-left-radius: 0;
272273
border-top-right-radius: 0;
274+
color: var(--color-text);
273275
}
274276
}
275277

wp-content/themes/core/blocks/tribe/facetwp-grid/block.json

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,6 @@
1212
"type": "string",
1313
"default": "post"
1414
},
15-
"showAllPosts": {
16-
"type": "boolean",
17-
"default": false
18-
},
1915
"postsPerPage": {
2016
"type": "number",
2117
"default": 12

wp-content/themes/core/blocks/tribe/facetwp-grid/edit.js

Lines changed: 8 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import metadata from './block.json';
1313
function Edit( { attributes, setAttributes, isSelected, postTypes } ) {
1414
const blockProps = useBlockProps();
1515

16-
const { postType, postsPerPage, showAllPosts, showPagination } = attributes;
16+
const { postType, postsPerPage, showPagination } = attributes;
1717

1818
const filteredPostTypes = postTypes?.filter(
1919
( type ) => type.visibility.show_in_nav_menus === true
@@ -45,33 +45,18 @@ function Edit( { attributes, setAttributes, isSelected, postTypes } ) {
4545
setAttributes( { postType: value } )
4646
}
4747
/>
48-
<ToggleControl
48+
<RangeControl
4949
__next40pxDefaultSize
5050
__nextHasNoMarginBottom
51-
label={ __( 'Show All Posts', 'tribe' ) }
52-
help={ __(
53-
'If checked, all posts will be displayed in the grid. If unchecked, the number of posts displayed will be limited to the number set in the "Posts Per Page" setting.',
54-
'tribe'
55-
) }
56-
checked={ showAllPosts }
51+
label={ __( 'Posts Per Page', 'tribe' ) }
52+
min={ 1 }
53+
max={ 99 }
54+
step={ 1 }
55+
value={ postsPerPage }
5756
onChange={ ( value ) =>
58-
setAttributes( { showAllPosts: value } )
57+
setAttributes( { postsPerPage: value } )
5958
}
6059
/>
61-
{ ! showAllPosts && (
62-
<RangeControl
63-
__next40pxDefaultSize
64-
__nextHasNoMarginBottom
65-
label={ __( 'Posts Per Page', 'tribe' ) }
66-
min={ 1 }
67-
max={ 24 }
68-
step={ 1 }
69-
value={ postsPerPage }
70-
onChange={ ( value ) =>
71-
setAttributes( { postsPerPage: value } )
72-
}
73-
/>
74-
) }
7560
<ToggleControl
7661
__next40pxDefaultSize
7762
__nextHasNoMarginBottom

0 commit comments

Comments
 (0)