Skip to content
This repository has been archived by the owner on Feb 23, 2024. It is now read-only.

Enable re-select category for Featured Category block #4559

Merged

Conversation

thisissandip
Copy link
Contributor

@thisissandip thisissandip commented Aug 8, 2021

Fixes #4177

It was not possible to re-select the selected category of a featured category block, This PR adds the edit button (pencil icon) to the block toolbar that allows changing the selected category.

Screenshots

featured-category-block

How to test the changes in this Pull Request:

  1. Insert a featured category block.
  2. Select a category to be featured.
  3. To re-select the category: click on the edit button (pencil button)

Changelog

Featured Category Block: Allow user to re-select categories using the edit icon

@thisissandip thisissandip requested a review from a team as a code owner August 8, 2021 19:22
@thisissandip thisissandip requested review from mikejolley and removed request for a team August 8, 2021 19:22
Copy link
Contributor

@Aljullu Aljullu left a comment

Choose a reason for hiding this comment

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

Thanks for working on this @thisissandip, it looks promising!

One issue I noticed is that after changing the category, the button link is still pointing to the previous category. Ie: if you select Clothing, then click the 'Edit' button and select T-Shirts. The button will still be linking to Clothing.

I remember we had a similar issue in the Featured Product block. It was solved in this commit: 5d85b0e#diff-7664311fec7278a6254b7583f11a7d7df2ebbb5ab350cc4440430dbb3a815757. I think you will need to copy & paste all changes from that commit into the Featured Category block. Be aware of changing product with category in some places.

Let us know if you have any questions and thanks for contributing! 🙂

@Aljullu Aljullu added focus: blocks Specific work involving or impacting how blocks behave. needs feedback type: enhancement The issue is a request for an enhancement. block: featured category Issues related to the Featured Category block, labels Aug 9, 2021
@thisissandip
Copy link
Contributor Author

@Aljullu Thank you for taking a look! 😄

I have made the required changes.
Now, the URL of "Shop Now" is also updated when the category is reselected.

Copy link
Contributor

@Aljullu Aljullu left a comment

Choose a reason for hiding this comment

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

Thanks for updating this PR @thisissandip. This is working like a charm now and code changes look good! I left a minor comment below, but once it's addressed this should be ready for merge.

assets/js/blocks/featured-category/block.js Outdated Show resolved Hide resolved
Co-authored-by: Albert Juhé Lluveras <aljullu@gmail.com>
Copy link
Contributor

@Aljullu Aljullu left a comment

Choose a reason for hiding this comment

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

Thanks for updating @thisissandip. I will merge this PR once all automated workflows pass and, if everything goes well, it will be included in WC Blocks 5.7.0 and WooCommerce core 5.7.0. Thanks again for your contribution. 🥳

@Aljullu Aljullu added this to the 5.7.0 milestone Aug 9, 2021
@Aljullu
Copy link
Contributor

Aljullu commented Aug 9, 2021

Linting job is failing but it doesn't seem related to this PR (error is: Error: Resource not accessible by integration). I run npm lint locally and there weren't issues.

I will merge this PR as-is and keep an eye open in case the linting job fails in other PRs.

@Aljullu Aljullu changed the title Enable re-select category for featured category block Enable re-select category for Featured Category block Aug 9, 2021
@Aljullu Aljullu merged commit 8fd02b6 into woocommerce:trunk Aug 9, 2021
@thisissandip
Copy link
Contributor Author

I ran npm run test and then npm run lint locally and there were no failing tests.

@thisissandip
Copy link
Contributor Author

@Aljullu Thank you for reviewing and merging this PR! 🚀

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
block: featured category Issues related to the Featured Category block, focus: blocks Specific work involving or impacting how blocks behave. type: enhancement The issue is a request for an enhancement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unable to re-select featured category block
3 participants