Package: collective.navigationtoggle
Table of contentsIntroductionWhen you will like this?What will changeDetailed documentationBasic configurationAdvanced configurationsStylesNot standard navigation (…or portlet… or whatever you want)Versions/DependenciesBrowsersPloneDependenciesCache controlsOther productsCreditsAuthorsChangelog1.0.3 (2020-05-05)1.0.2 (2014-07-17)1.0.1 (2013-01-24)1.0.0 (2013-01-15)0.4.0 (2012-11-15)0.3.0 (2011-06-07)0.2.1 (2010-07-09)0.2.0 (2010-04-11)0.1.0 (2010-04-06)IntroductionScope of this product is to make possible an expand/collapse feature in Plone navigation(s)
portlet without any modification to the navigation code itself, or any needs to override its features.This productis nota new navigation portlet, is just a JavaScript add-on that rely on native Plone’sjQuerysupport.More important: it is only focused to makesomenavigation links to be expandable.When you will like this?The collective.navigationtoggle is useful when your Plone site needs (not much) special handling of
navigation elements. Sometimes your site structure is someway like this:ROOT
|
|_ FolderWhatever
\_ NotImportantFolder
   |
   |_ ImportantFolder1
   ...
   \_ ImportantFolderNIf you configure your navigation portlet on the site root, users must click on theNotImportantFolderand reload the whole page to reach theImportantFolder’s section.
The site at theNotImportantFolderlevel is not useful… maybe you only give afolder_listingview
or a default page that only say “Welcome to an important area of the site, please visit the subsection
you are looking for…”.For the user experience the first click is only a waste of time.What you are looking for can be a client side effect that expand/collapse the folder in the navigation.
TheNotImportantFolderitself is not seen as a real content in your information architecture.What will changeMake possible that special navigation links will no more move the user to the target section but simply
shows in the navigation itself all subsections (so the navigation seems like the user really moved to
the target folder).A second click will collapse the section.Default page in a folder, elements marked with “Exclude from navigation” and unwanted
type from themetaTypesNotToListproperty will be excluded.The script try to simulate best at possible a normal portlet navigation behavior.The code keeps in mindgraceful degradation. Browser without JavaScript enabled will simply use basic
Plone navigation features.Detailed documentationBasic configurationIn your Plone configuration panel you’ll find the new “Navigation Toggle settings”.From this section you can configure a lot of advanced options, mainly you need to configure:Link selectorsA set of URL path suffix like/foo1/foo2of anhrefattribute for a link.
With this example a link like this will behit:<a href="http://plonehost/plone/foo1/foo2">Commonly only link inside navigation portlet are checked (see the “Toggle container classes”).You can also provide here a complex jQuery expression, for example:li.navTreeItem aIf you don’t directly provide a selector that match an HTML <A> element, you still need to query for somethinginsidethat kind of node, for example:li.navTreeItem a.contenttype-folder spanIn the last example above, only a click of the navigation entry text will trigger the expand/collapse features,
while clicking on the icon will keep the default browser behavior.Animation delayThe product can enable for you a graphical effect when you expand/collapse items. This is disabled by
default.To enable it you must change this value to something higher that 0. The value you put there is the time
(in millisecond) used for theslideDownandslideUpjQuery’s effect.Simply put it to 0 again (the default) to disable effect.Advanced configurationsCacheCheck it to perform client side cache of the AJAX request.
If disabled a request to the server will be performed for every click on navigations.Toggle container classesA set of CSS classes that mark you navigation elements.
Only links inside elements with one of those classes are “toggleable”.Note that this option is ignored for “Links selectors” entries where you used a jQuery
expression and not a URL path.HTML list typeThe type of HTML container element to looks for.HTML list itemThe type of HTML item element to be generated.StylesThis products dynamically adds two new possible CSS classes to<li>elements that contains links that match
the configuration.Class “cnavClosed” is added when a special navigation elements is shown on the page and when you close
a subtree.
When a subsection is open, the class “cnavOpen” is added to the same element.The generated substructure is a copy of the main structure given by Plone, but a “cnavGenerated” class is
added to it.You can (but this product doesn’t) rely on those classes to give additional styles effects in your
Plone theme.Not standard navigation (…or portlet… or whatever you want)This productsmayalso works on non-standard navigation HTML structure (as the generations on subelement
is done cloning existing node from the same navigation portlet) but some assumptions are done.As the code works almost client side, you can also use it in portlets that are not standard navigation.
Theoretically you can use it with something that is not even a portlet!Versions/DependenciesBrowsersFirefox 16 (…probably a new major version will be released while I’m typing this line…)Google Chrome 23 (…same as above…)Opera 12Safari 5.1Internet Explorer 8, 9PlonePlone 3.3 (classic Plone theme)Plone 4.2 (classic Plone theme and Sunburst)Plone 4.3 (classic Plone theme and Sunburst)Dependenciessimplejson(if using Plone 3)jQuery 1.3 or betterplone.app.registryCache controlsToggle configuration are stored in a JavaScript file that your browser and Ploneportal_javascripttool
will probably cache.When changing configuration you can use the “Save and invalidate JS cache” button.Other productsIf you need a complete expand/collapse navigation feature this product is not for you; so take a
look at:collective.portlet.exploreSolgema.NavigationPortletCreditsDeveloped with the support of:S. Anna Hospital, FerraraAzienda USL FerraraAll of them supports thePloneGov initiative.AuthorsThis product was developed by RedTurtle Technology team.Special thanks to Yang Hong for massive bug fixing.Changelog1.0.3 (2020-05-05)added Transifex.net service integration to manage the translation process [macagua]added Spanish translation [macagua]updated gettext files support [macagua]1.0.2 (2014-07-17)fixed a bug in @@query-subelements when using the product in a Plone site that’s inside
another folder (filesystem, for example) [mpampols]fixed a bug that badly put rules inside the generatedcollective.navigationtoggle.rules.jsif they contains a quote char [keul]1.0.1 (2013-01-24)use the object’s id as the fallback title for expanded item
(close#6) [yangh]1.0.0 (2013-01-15)fixed a bug when used with containers with spaces inside the id
(close#2) [keul]file icon of generated elements where not handled in the right way
(close#3) [keul]added a way to invalidate JS cache
(close#1) [keul]now general selectors can match also elements that are not <a>, but
link’s contents
(close#4) [keul]now checking thetypesUseViewActionInListingsconfiguration
(close#5) [keul]0.4.0 (2012-11-15)added a product’s browser layer
[keul]provided an own configuration panel
[keul]added all remaining configutation in Plone UI
[keul]toggleContainerClassnow istoggleContainerClasses(can be used for a set of classes)
[keul]added i18n support and italian translation
[keul]changes AJAX calling context, now always calling portal root URL
[keul]added tests (both Plone and JavaScript)
[keul]0.3.0 (2011-06-07)you can now use more generaljQuery selectorinstead of simple URL path [keul]do not show types that are in list of unwanted types in navigation [keul]collective.navigationtoggle.txtwas empty [keul]JSLint cleanup [keul]code is more general, and new properties likestoggleContainerClass,listTypeandlistItemhas been added.
The code now can be used to simulate navigators also with not portlet navigator
structures [keul]added the uninstall GS step [keul]fixed thesimplejsondependency correctly, only if with Python < 2.6 [keul]links selectors can be added through Plone UI [keul]0.2.1 (2010-07-09)fixed a bug when fast double-click on opened elements (close#1) [keul]much better Sunburst support (and other themes, in general), now checking also for “contenttype-xx”
and “state-xx” CSS classes on links [keul]0.2.0 (2010-04-11)query_subelement view documentation was incomplete [keul]when querying empty folder, do not prevent (in facts: simulate) browser default action [keul]prevent browser cache (mainly know Internet Explorer problem) [keul]do not always display the content’s image icon (sometimes users don’t see them in navigation) [keul]now every element node cache its subtree, so AJAX call is performed only once (can be disabled) [keul]added dependency on simplejson for formatting server responses [keul]added minimal Plone 4.0 compatibility (UI result is not perfect) [keul]added a simple slide up/down effect (disabled by default) [keul]0.1.0 (2010-04-06)initial release