[MAGNOLIA-2053] Possibilty to treat specified startLevel and endLevel as relative to active page Created: 10/Feb/08  Updated: 23/Jan/13  Resolved: 11/Sep/08

Status: Closed
Project: Magnolia
Component/s: taglibs
Affects Version/s: 3.5.4
Fix Version/s: 3.6.2, 3.6.3

Type: Improvement Priority: Minor
Reporter: Ryan Gardner Assignee: Magnolia International
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: Text File AddRelativeModeToSimpleNav.patch     Text File levelhandling2_.patch    
Template:
Patch included:
Yes
Acceptance criteria:
Empty
Task DoD:
[ ]* Doc/release notes changes? Comment present?
[ ]* Downstream builds green?
[ ]* Solution information and context easily available?
[ ]* Tests
[ ]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Date of First Response:

 Description   

In some cases, it is desirable to have a SimpleNavigation that always shows the children of a given page, or that always shows the siblings of a given page. SimpleNavigation currently specifies the startLevel and endLevel in absolute terms.

The attached patch adds an optional attribute to the SimpleNavigation tag that allows you to specifiy the way the levels are handled. I called it "levelHandlingMode" for lack of a better name, and when it is set to "relative" the behavior is changed slightly. At the start of the doEndTag, it does this:

if (this.levelHandlingMode.equals(LEVEL_MODE_RELATIVE)) {
this.startLevel += activePageLevel;
this.endLevel += activePageLevel;
}

This simple change at the beginning of the doEndTag will allow you to specify negative values for the start value or end value, and have it work appropriately.

I've tested it for the use case that I wanted it to work for, and it works properly... and, most importantly, it doesn't break any existing functionality.



 Comments   
Comment by Ryan Gardner [ 03/Sep/08 ]

Updated the patch to work against the 3.6.2 trunk version. Also added in the ability to set the anchorID of it. (I had these two split out into two separate patches, but it was difficult to work with two changesets so I just spat out one patch.)

Comment by Ryan Gardner [ 03/Sep/08 ]

changed the name of the "levelHandlingMode" to "levelResolvingMethod" to make it more clear what it did - and updated it to apply to the latest trunk .

This one also includes a patch to set the anchor ID to optionally be set to the page name.

Comment by Magnolia International [ 03/Sep/08 ]

About your naming nightmares: how about having a relative or relativeLevels boolean instead ?

Should we ignore the initial patch or apply both ?

Comment by Ryan Gardner [ 03/Sep/08 ]

Ignore the initial patch - it wont apply without a lot of work. (It can be deleted if you wish)

Yes, relative would work - making it a boolean.

Comment by Magnolia International [ 11/Sep/08 ]

Patch applied, thanks !
(I renamed the new attribute to "relativeLevels" and made it a simpler boolean)

Generated at Mon Feb 12 03:32:56 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.