fix: CMD-162 disable 2nd-level CMS breadcrumbs #838
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
Disable 2nd-level breadcrumbs (because they always redirects to 3rd-level).
Details
TL;DR: Server-side menu node properties to programmatically disable links (remove
href
) are blank, so we use JavaScript to force-disable 2nd-level breadcrumbs. The styles merely tweak disabled breadcrumb appearance.In Django CMS, a page added such that it appears in the navigation. On that page, the page will appear in the breadcrumbs as text, not a link, because it is the current page. Server-side code performs that. A parent page can be added such that it appears in the navigation as a dropdown link. The link only opens the menu of child pages; it does not navigate user to a page. Server-side code performs that. If one visits a child page, the parent page will appear in the breadcrumbs as a link. Clicking that link will take user to the parent page. Server-side code performs that. Because the page is not intended to be navigated to — and only was able to be navigated to via link after breadcrumbs were added — CMS admin has always left such pages blank or (more commonly) made them redirect to the most relevant child page. Server-side code allows that. To avoid user clicking such a parent page in the breadcrumbs, we would set the
href
to blank, but attempts to do this server-side fail because useful menu props are blank. So we use JavaScript to force-remove thehref
value. We add styles to tweak the appearance of a disabled breadcrumb link.Related
Changes
To breadcrumbs template:
Testing
E.g. Home > Fruit > Tropical > Bananas.
UI
before.mov
after.mov