Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: listing taxonomies and query mode #6

Merged
merged 91 commits into from
Dec 1, 2020
Merged

Conversation

dkoo
Copy link
Contributor

@dkoo dkoo commented Oct 13, 2020

All Submissions:

Changes proposed in this Pull Request:

  • Adds categories and tags to all listings CPTs (taxonomies are shared by all CPTs)
  • Adds a "query mode" to Curated List blocks which lets editors choose query options to populate the list, instead of manually selecting each listing item
  • Adds optional "load more" functionality to Curated Lists blocks in query mode that have more listings than the "max number of items" setting

How to test the changes in this Pull Request:

Testing display options

Previously from #5. Test the following display attributes for Curated List blocks:

  • Show list item numbers: toggles display of numbers alongside listings
  • Show featured image: toggles display of featured image
  • Show featured image caption (only available if featured image is enabled): toggles display of featured image caption
  • Featured image position (only available if featured image is enabled): sets position of featured image to top, left, or right
  • Mobile stack (only available if featured image position is left or right): if ON, featured image will stack on top of post content at smaller viewports.
  • Show author: toggles display of listing post authors
  • Show excerpt: toggles display of listing post excerpts
  • Type scale: sets font size of listing title, author, and excerpt
  • Text color: sets font color of listing title, author, and excerpt

Testing categories and tags

  1. Check out this PR. Flush permalinks.
  2. In WP Admin, under "Listings", observe new "Listing Categories" and "Listing Tags" menu items.
  3. Edit or create several listing posts. In the Document sidebar, observe that there are now Categories and Tags panels to add those terms.
  4. Add/create several categories and tags to several listings posts.
  5. In WP Admin, go to Listing Categories/Tags and observe that the terms you created contain the posts to which you added the terms.
  6. View a term page. Observe that it shows a standard archive page displaying the listings (any type) that have that term. We're removing archive pages for phase 1.

Testing Query Mode

  1. Ensure that you have multiple listing posts of various types created and published, with categories, tags, test content and featured images
  2. Edit or create a post and add a Curated List block to the content.
  3. Observe a UI asking whether you want to start with a query or specific listings. Select "specific listings".

Screen Shot 2020-11-04 at 11 04 28 AM

  1. While the block is NOT in query mode, add several listings manually to the Curated List block and save/publish the post.
  2. View the post's front-end and observe that the manually selected listing items are rendered in the same order as in the editor.
  3. In the editor, create a new Curated List block. This time, select "query".
  4. Observe that the block render changes to display queried listings. Default options are: all listing types, shown in descending order of publish date, max 10 items
  5. Save/update the post, view the front-end, observe that the listings shown match what's shown in the editor.
  6. In the editor, change some query options in the Curated List block sidebar (listing type, categories, tags, sort order, etc.). Confirm that the listings shown in both the editor and the front-end match the selected query options.
  7. Repeat with other query options, confirming each time that the results are as expected and match in editor vs. front-end.

Testing "load more" functionality

  1. Create a Curated List in query mode. Observe a "Show load more button" option in the block sidebar that is OFF by default.
  2. Make sure the query options are broad enough to show a bunch of listings. Use the "Max number of items" option to reduce the number of items shown in the list to something less than the number of listings that match the query options.
  3. Turn ON the "Show load more button" option. Observe that a "Show more listings" button appears at the bottom of the Curated List block.
  4. Also observe a new "Load more button text" option that appears only when the "Show load more button" option is on. Change the text in this setting and observe that the button label changes accordingly.
  5. Publish/update the post and view the front-end. Observe that there's a "Show more listings" button at the bottom of the list block with a label matching your "Load more button text" setting.
  6. Click the button, observe that more listings load as expected.
  7. Keep going until all listings are loaded. Observe that the "Show more listings" button disappears once all listings matching the query options are loaded.
  8. Test in both AMP and non-AMP mode—behavior should be identical.

Other information:

  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your changes, as applicable?
  • Have you successfully ran tests with your changes locally?

Sets up custom post types and Listing block prototype.
Instead of just registering a single Listing block and selecting the type in the parent post, this registers a separate block for each listing type (all of which use the same code).
Addresses pull request feedback and refactors post types config into a more DRY treatment.
This removes the Curated List CPT in favor of a wrapper block that can be inserted into any other post or page. This block can contain Listing blocks to create curated lists anywhere, and can be converted to a Reusable Block if it needs to be reusable.
Lays out a method of passing attributes data from the Curated List block to its child Listing inner blocks, without relying on contexts. We basically duplicate parent block attributes on each child block and sync the values of those attributes.
This establishes a pattern for providing block patterns for particular listings CPTs. This might let us provide structured content without having to register metadata fields for listing content.
Adds support for location-based data using the jetpack/maps block. If a listing CPT of any type contains a jetpack/map block with location data, the location data is used to show the listing on a map for any Curated List blocks containing the listing post.
Sets up a sync from certain content blocks to post meta fields. This will help us more easily implement search/filter functionality for listing posts on a large scale.
We want to avoid letting editors nest Curated Lists inside list items which could be nested inside Curated Lists which could be inside list items which could be... etc.
Moves shared styles to a `shared` SCSS folder and implements helpers to output the same class names in editor + front-end based on curated list block attributes.
- show author
- text color
- type scale
- all options reflected in both editor and front-end
@dkoo
Copy link
Contributor Author

dkoo commented Nov 6, 2020

When the Curated List block is unfocused, we shouldn't see the borders, paddings, [+], etc...

@thomasguillot My thought with this was that without the borders, it becomes really hard to tell that the listings are part of the same "parent" list when you have more than a few items in a list. Also, if we have no borders/padding when the block is unfocused, but add borders/padding when it is focused, won't that cause jitter and text reflow when the padding is added?

Also thinking that we should tackle further design updates in a separate PR, since I don't want this one to grow more than it has to.

Copy link

@jeffersonrabb jeffersonrabb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This feels really close to ready. I added a few more comments and confirmed/resolved most of the ones from the last round.

I'm comfortable coming back to the Map/Load More one in a separate PR. That's going to require some gymnastics.

Once you've resolved those last few things, I'll do one more round of functional testing just looking for regressions, then we should be good to go!

src/blocks/curated-list/edit.js Outdated Show resolved Hide resolved
src/blocks/curated-list/edit.js Outdated Show resolved Hide resolved
src/blocks/curated-list/edit.js Show resolved Hide resolved
The src folder is not copied during release archiving.
Copy link

@jeffersonrabb jeffersonrabb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's 🚢 this monster!

@dkoo dkoo merged commit 528e1e5 into master Dec 1, 2020
@dkoo dkoo deleted the feat/taxonomies-and-query branch December 1, 2020 22:21
matticbot pushed a commit that referenced this pull request Dec 16, 2020
# 1.0.0-alpha.1 (2020-12-16)

### Features

* initial post type and block setup ([#1](#1)) ([47dc0c1](47dc0c1))
* listing taxonomies and query mode ([#6](#6)) ([528e1e5](528e1e5))
* new Curated List block, block pattern, and map functionality ([#3](#3)) ([9be6e7e](9be6e7e))
@matticbot
Copy link
Contributor

🎉 This PR is included in version 1.0.0-alpha.1 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

matticbot pushed a commit that referenced this pull request Dec 16, 2020
# 1.0.0 (2020-12-16)

### Features

* initial post type and block setup ([#1](#1)) ([47dc0c1](47dc0c1))
* listing taxonomies and query mode ([#6](#6)) ([528e1e5](528e1e5))
* new Curated List block, block pattern, and map functionality ([#3](#3)) ([9be6e7e](9be6e7e))
@matticbot
Copy link
Contributor

🎉 This PR is included in version 1.0.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

matticbot pushed a commit that referenced this pull request Jul 19, 2021
# 1.0.0-alpha.1 (2021-07-19)

### Bug Fixes

* avoid meta sync update error ([#95](#95)) ([cab16aa](cab16aa))
* do not register post-specific sidebars in widgets page ([#93](#93)) ([7716775](7716775))
* editor errors with reusable blocks ([#89](#89)) ([fdc46d3](fdc46d3))
* errors and bugs related to WP 5.8 ([#83](#83)) ([90da6c5](90da6c5))
* force alpha rebuild ([acc2075](acc2075))
* minor bug fixes ([#21](#21)) ([5f90bc7](5f90bc7))
* missing condition for block appender in list container ([#74](#74)) ([2c49896](2c49896))
* syncing attributes from curated list block to inner blocks ([#64](#64)) ([cdbc0bb](cdbc0bb))
* use synced attributes for ListContainer directly ([#73](#73)) ([f8641a7](f8641a7))

### Features

* add block patterns ([#23](#23)) ([a273a40](a273a40))
* bump max number of items per list from 20 to 50 ([#97](#97)) ([009deab](009deab))
* initial post type and block setup ([#1](#1)) ([47dc0c1](47dc0c1))
* listing taxonomies and query mode ([#6](#6)) ([528e1e5](528e1e5))
* more block patterns (real estate, classified ads) ([#84](#84)) ([a51f5af](a51f5af))
* new Curated List block, block pattern, and map functionality ([#3](#3)) ([9be6e7e](9be6e7e))
* remove borders and padding in editor to match front-end styles ([#14](#14)) ([6c47a17](6c47a17))

* v2 release (#85) ([748810d](748810d)), closes [#85](#85) [#40](#40) [#39](#39) [#32](#32) [#41](#41) [#49](#49) [#43](#43) [#56](#56) [#51](#51) [#57](#57) [#61](#61) [#67](#67) [#60](#60) [#70](#70) [#65](#65) [#71](#71) [#66](#66) [#58](#58) [#77](#77) [#81](#81)

### BREAKING CHANGES

* This feature will deprecate existing custom taxonomies, so any existing terms for those taxonomies will be lost.

To fix, we can convert terms from the deprecated taxonomies to standard post categories/tags via a migration script.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants