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

Options for exclude module from child page #43597

Conversation

carlitorweb
Copy link
Member

@carlitorweb carlitorweb commented Jun 2, 2024

Pull Request for #42385

Summary of Changes

Move the assignment of modules from #__module_menu to the new menu_assignment in #__modules. Now the menu assignment section for a module will have 2 new options for exlude child pages. For joomla updates there wil not be any visual change, since all assigned modules in #__module_menu will be copy to menu_assignment.

Testing Instructions

Preparation steps

  • This pull request make some changes in the database, you will need to update an existing joomla site with the prebuilt package. The faster way, just copy the sentences and execute it directly in your sql client (just do not forget to adjust the prefix #_). Minimum you need execute the follow:
ALTER TABLE `#__modules` ADD COLUMN `menu_assignment` text;
  • Apply the patch if you did not used the prebuilt package update

Administrator -> Site Modules

  • The column "Pages", need have the exact same values you have before. If you only executed the minimum sql sentence, then will show for all modules "None" and that is expected.
  • Filter by some Menu Item
  • Order by pages in asc/desc
  • Create/Delete a module
  • Batch a module. In both case (move/copy) check the assigned menu items stay in their position.

Administrator -> Site Modules -> Edit a module

  • Go to the tab Menu Assignment and choose a module assigment option. Save and check these options remain as you edited.
  • Save and close. Repeat Administrator -> Site Modules test

Administrator -> Menus -> Edit a menu item

  • Go to the tab Module Assignment and check the Display column show the correct tag about what module is assignment or not to the menu.
  • Turn on/off the Unassigned Modules toggle and check the module hide or shown according with yoru selection.
  • Delete a menu item (make sure first is assigned to a module). Open the module and check the menu assignment is working. If you ca also in the #__modules table, search the menu_assignment value for this module and check the menu item id you just deleted, do not show up inside the assigned menu item array.

Frontend

  • Check if the current modules you have are working as before.
  • Edit a module and set as menu assignment one of the two new values, On all pages except those selected (do not include child pages) or Only on the pages selected (do not include child pages) . One way to test it, first assign a menu item to a parent category. Create a new category as child of this one. Then create a article inside this child category. Go to the frontend and check the module show up inside the parent category view, but not in the child category view or the article view.

Actual result BEFORE applying this Pull Request

All work as expected

Expected result AFTER applying this Pull Request

All work as expected. But now you can choose that do not render a module in child pages.

Link to documentations

Please select:

  • Documentation link for docs.joomla.org: Chunk4x:Menu Assignment
  • No documentation changes for manual.joomla.org needed

@joomla-cms-bot joomla-cms-bot added Language Change This is for Translators PR-5.2-dev labels Jun 2, 2024
@richard67
Copy link
Member

@carlitorweb If you want to add a new column to the modules table you also have to modify the CREATE TABLE statements in the base.sql files for new installations here https://github.com/joomla/joomla-cms/blob/5.2-dev/installation/sql/mysql/base.sql#L587 amd here https://github.com/joomla/joomla-cms/blob/5.2-dev/installation/sql/postgresql/base.sql#L611 . Please do it like it is for other columns of type text in the particular file. It does not need to specify NULL DEFAULT NULL for them.

carlitorweb and others added 9 commits June 2, 2024 10:23
…4-06-01.sql

Co-authored-by: Richard Fath <richard67@users.noreply.github.com>
…0-2024-06-01.sql

Co-authored-by: Richard Fath <richard67@users.noreply.github.com>
Co-authored-by: Richard Fath <richard67@users.noreply.github.com>
Co-authored-by: Richard Fath <richard67@users.noreply.github.com>
@carlitorweb
Copy link
Member Author

@richard67 is possible for you give me any hint of why the drone is failing?

@brianteeman
Copy link
Contributor

In your PR you are deleting the file cypress.config.dist.js - put that file back and the tests will run

@carlitorweb
Copy link
Member Author

In your PR you are deleting the file cypress.config.dist.js - put that file back and the tests will run

Thank 🤦

@carlitorweb carlitorweb marked this pull request as ready for review June 9, 2024 18:36
@RickR2H
Copy link
Member

RickR2H commented Jun 28, 2024

I have tested this item ✅ successfully on 6d9530f

Thanks. Great idea!


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

@Hackwar Hackwar added the b/c break This item changes the behavior in an incompatible why. HEADS UP label Jul 27, 2024
@Hackwar
Copy link
Member

Hackwar commented Jul 27, 2024

This is a b/c break and can not be merged into 5.x. you will have to rebase this to 6.0. regardless of that, I don't think this is a good idea. Your check if you are on the page you want to be is extremely sketchy and will not work for a very large number of websites. Just checking on view and id is nowhere near reliable. Besides that, it is an anti-pattern to store this in a JSON. It prevents us from doing joins on the data.

@carlitorweb
Copy link
Member Author

carlitorweb commented Jul 31, 2024

Got it

@carlitorweb carlitorweb deleted the issues-42385-exclude-module-article-page branch July 31, 2024 16:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
b/c break This item changes the behavior in an incompatible why. HEADS UP Language Change This is for Translators PR-5.2-dev Unit/System Tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants