Uploaded image for project: 'Magnolia'
  1. Magnolia
  2. MAGNOLIA-2072

Add ability for SimpleNavigation to set an ID on the anchortag that it creates

    XMLWordPrintable

Details

    • Improvement
    • Resolution: Won't Do
    • Minor
    • None
    • 3.5.4
    • taglibs
    • None

    Description

      For certain javascript uses, it becomes trivial to add functionality to an anchor if it has a known ID applied to it.

      Here is a snippet of some simple prototype-based javascript code that relies on the anchor having a known ID, and other elements having known ID's that are set based on the pageName:

      Having an ID makes it possible to find the element almost instantly. Assigning the IDs in the jsp with the el makes it very simple to maintain the connection between the javascript and the page elements.

      Event.observe('${childPages.name}', 'mouseover', function(event) {
      $$('.${navigationStyles}').invoke('removeClassName', 'active').invoke('addClassName', 'hidden');
      $('${childPages.name}_navItems').addClassName('${visibleMenuState}');
      $('${childPages.name}_navItems').removeClassName('hidden');

      The use case this was created for was that I built a two-level tab navigation panel... and needed a way for the tabs to swap out the content of the second-level that was below it. (Doing it via CSS would be possible, but undesireable for the simple fact that the smaller navigation below it is relatively thin, and using a CSS:hover attribute causes the rollover to cease the second you leave the element... using javascript allows you to use a small timeout before hiding the rollover - plus - it's easier to build it in javascript if you have tag liibraries and the EL doing the heavy lifting for you )

      Currently, the only option for setting the ID is specifying it to be "pageName" - like this:

      <cmsu:simpleNavigation startLevel="0" endLevel="1" wrapperElement="span" anchorTextID="pageName"/>

      If other unique ID-naming schemes were desired, they could be added in the future with relative ease.

      Checklists

        Acceptance criteria

        Attachments

          Activity

            People

              fgiust Fabrizio Giustina
              ryangardner Ryan Gardner
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Checklists

                  Task DoD