Skip to content

[4.0] Fix categories accordion#35093

Merged
wilsonge merged 2 commits intojoomla:4.0-devfrom
joomdonation:fix_categories_accordion
Aug 13, 2021
Merged

[4.0] Fix categories accordion#35093
wilsonge merged 2 commits intojoomla:4.0-devfrom
joomdonation:fix_categories_accordion

Conversation

@joomdonation
Copy link
Copy Markdown
Contributor

@joomdonation joomdonation commented Aug 11, 2021

Pull Request for Issue # .

Summary of Changes

The categories accordion implemented in this PR #33052 won't work properly when the menu item created to display categories tree when the sub-category has image or description and one of the two settings below set to show:

  • Category Image set to Show
  • Or Subcategories Descriptions set to Show

If image or description is being show, button.nextElementSibling will point to wrong div tag (you can see it by reading the code at https://github.com/joomla/joomla-cms/blob/4.0-dev/components/com_content/tmpl/categories/default_items.php#L34-L53

This PRs solve it by adding an attribute to the button to allow getting ID of the category and use it to get the right div which contains children categories of that category

I also made small modification to build/media_source/com_categories/joomla.asset.json to define preset so that we can call usePreset to load both JS and CSS in a single line of code.

Testing Instructions

  1. Setup categories and sub-categories for articles. Please remember to enter description for these categories
  2. Create a menu item to link to List All Categories in an Article Category Tree menu item type of com_content. In the menu item parameters, look at Category tab, set :
  • Empty Categories: Show
  • Subcategories Descriptions: Show
  1. Before patch:
  • Accordion on categories page does not work properly.
  1. After patch: According on works properly. To apply patch, please update your installation to the update package generated by this PR https://ci.joomla.org/artifacts/joomla/joomla-cms/4.0-dev/35093/downloads/46491/Joomla_4.0.0-rc7-dev+pr.35093-Development-Update_Package.zip

@joomla-cms-bot joomla-cms-bot added NPM Resource Changed This Pull Request can't be tested by Patchtester PR-4.0-dev labels Aug 11, 2021
@RickR2H
Copy link
Copy Markdown
Member

RickR2H commented Aug 12, 2021

When I apply the patch I get an error:

The requested page can't be found.
There is no "com_categories.shared-categories-accordion" asset of a "preset" type in the registry.

@joomdonation
Copy link
Copy Markdown
Contributor Author

Thanks @RickR2H. This changes JS file, so I think the easiest way to test is update your installation to update package generated by this PR https://ci.joomla.org/artifacts/joomla/joomla-cms/4.0-dev/35093/downloads/46491/Joomla_4.0.0-rc7-dev+pr.35093-Development-Update_Package.zip (or run npm command, but to be honest, I haven't tried that method myself)

@RickR2H
Copy link
Copy Markdown
Member

RickR2H commented Aug 12, 2021

I have tested this item ✅ successfully on d0786f2

Patch works! Had to run "npm ci" again after applying the patch.
Not the nicest layout as the category image id displayed after the toggler. But this is something for a new PR I guess...?


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/35093.

@joomdonation
Copy link
Copy Markdown
Contributor Author

Not the nicest layout as the category image id displayed after the toggler. But this is something for a new PR I guess...?

Yes. I do not have good frontend skill to make it nicer, so I just fix the js bugs here. Thanks for testing :).

@chmst
Copy link
Copy Markdown
Contributor

chmst commented Aug 12, 2021

@RickR2H how did you get an image? I see the description but no image.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/35093.

@RickR2H
Copy link
Copy Markdown
Member

RickR2H commented Aug 12, 2021

@chmst simply add an image to the dedicated category image field. Just edit the category and you'll find it 😉

@ChristineWk
Copy link
Copy Markdown

I have tested this item ✅ successfully on d0786f2


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/35093.

@ChristineWk
Copy link
Copy Markdown

result

screen shot 2021-08-12 at 21 54 19


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/35093.

@RickR2H
Copy link
Copy Markdown
Member

RickR2H commented Aug 13, 2021

As soon as this PR gets merged I'll try to take a look to fix the layout.

@joomdonation
Copy link
Copy Markdown
Contributor Author

Thanks @RickR2H . We should also do the same fix for categories view of com_contact and com_newsfeeds to (the layout and logic is the same)

@RickR2H
Copy link
Copy Markdown
Member

RickR2H commented Aug 13, 2021

@joomdonation look like a nice side project 😉

@joomdonation
Copy link
Copy Markdown
Contributor Author

RTC. Hope maintainer will merge it so that we can work on the layout fixes and apply the same fix for other components.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/35093.

@joomla-cms-bot joomla-cms-bot added the RTC This Pull Request is Ready To Commit label Aug 13, 2021
@wilsonge wilsonge merged commit 72e78f4 into joomla:4.0-dev Aug 13, 2021
@wilsonge
Copy link
Copy Markdown
Contributor

Thanks!

@joomla-cms-bot joomla-cms-bot removed the RTC This Pull Request is Ready To Commit label Aug 13, 2021
@joomdonation
Copy link
Copy Markdown
Contributor Author

@RickR2H This PR is now merged. Could you please help making the categories view nicer :) ?

@zero-24 zero-24 added this to the Joomla 4.0 milestone Aug 13, 2021
@joomdonation joomdonation deleted the fix_categories_accordion branch August 14, 2021 09:49
@RickR2H
Copy link
Copy Markdown
Member

RickR2H commented Aug 14, 2021

@joomdonation layout change added and ready for testing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

NPM Resource Changed This Pull Request can't be tested by Patchtester

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants