Freemarker macros for navigation data
git-svn-id: https://svn.libreccm.org/ccm/trunk@5838 8810af33-2d31-482b-a856-94f89814c4dfmaster
parent
2771e4e473
commit
42ef378bff
|
|
@ -5,7 +5,7 @@
|
|||
"ui": "http://www.arsdigita.com/ui/1.0"}
|
||||
>
|
||||
|
||||
<%--
|
||||
<#--
|
||||
Output all path tokens of the current category path. Provides the
|
||||
following parameters for nested content:
|
||||
|
||||
|
|
@ -14,7 +14,7 @@
|
|||
3: id
|
||||
|
||||
of the category.
|
||||
--%>
|
||||
-->
|
||||
<#macro categoryPath>
|
||||
|
||||
<#list model["/bebop:page/nav:categoryPath/nav:category"] as token>
|
||||
|
|
@ -23,14 +23,14 @@
|
|||
|
||||
</#macro>
|
||||
|
||||
<%--
|
||||
<#--
|
||||
Provides the following data about the current navigation instance to
|
||||
the nested content:
|
||||
|
||||
1. ID of the navigation menu from which the data was retrieved
|
||||
2. URL to the root of the navigation
|
||||
3. title of the navigation
|
||||
--%>
|
||||
-->
|
||||
<#macro navigationRoot navId="categoryMenu">
|
||||
|
||||
<#assign url=model["/bebop:page/nav:categoryMenu[@id='${navId}']/nav:category/@url"]>
|
||||
|
|
@ -40,43 +40,75 @@
|
|||
|
||||
</#macro>
|
||||
|
||||
<#--
|
||||
Checks if the a categoryMenu is available in the model and shows the
|
||||
nested content if one is available. The optional parameter
|
||||
menuId can be used to select a specific categoryMenu is used. If no value
|
||||
value the parameter is provided the default value "categoryMenu" is used.
|
||||
|
||||
The categories are passed to the nested content. To iterate over the
|
||||
categories the "categories" macro can be used.
|
||||
|
||||
-->
|
||||
<#macro categoryMenu menuId="categoryMenu">
|
||||
|
||||
<#if (model["/bebop:page/nav:categoryMenu[@id='${menuId}']"]?size > 0) >
|
||||
<#nested model["/bebop:page/nav:categoryMenu[@id='${menuId}']/nav:category/nav:category"]>
|
||||
</#if>
|
||||
|
||||
<#--
|
||||
<#assign categories=model["/bebop:page/nav:categoryMenu[@id='${menuId}']/nav:category/nav:category"]>
|
||||
|
||||
<#list categories as category>
|
||||
<#nested category["./@id"], category["./@url"], category["./@title"], category>
|
||||
</#list>
|
||||
-->
|
||||
|
||||
</#macro>
|
||||
|
||||
<#--
|
||||
Checks if an categoryHierachy is avialable in the model and shows the
|
||||
nested content if one is avialable. The optional parameter hierarchyId
|
||||
can be used to select a specific categoryHierarchy. If no value for the
|
||||
parameter is provided the default value "categoryNav" is used.
|
||||
-->
|
||||
<#macro categoryHierarchy hierarchyId="categoryNav">
|
||||
|
||||
<#if (model["/bebop:page/nav:categoryHierarchy[@id='${hierarchyId}']"]?size > 0)>
|
||||
<#nested model["/bebop:page/nav:categoryHierarchy[@id='${hierarchyId}']/nav:category"]>
|
||||
</#if>
|
||||
|
||||
<#--
|
||||
<#assign categories=model["/bebop:page/nav:categoryHierarchy[@id='${hierarchyId}']/nav:category"]>
|
||||
|
||||
<#list categories as category>
|
||||
<#nested category["./@id"], category["./@url"], category["./@title"], category>
|
||||
</#list>
|
||||
-->
|
||||
|
||||
</#macro>
|
||||
|
||||
<#--
|
||||
Iterates over the provided sequence of categories. For each category
|
||||
the following parameters are passed to the nested content:
|
||||
|
||||
1. ID of the category
|
||||
2. URL of the category
|
||||
3. Title of the category
|
||||
4. The category itself.
|
||||
-->
|
||||
<#macro categories categories>
|
||||
|
||||
<#list categories as category>
|
||||
<#nested category["./@id"], category["./@url"], category["./@title"], category>
|
||||
</#list>
|
||||
|
||||
</#macro>
|
||||
|
||||
<#macro ifHasSubCategories category>
|
||||
<#macro subCategories ofCategory>
|
||||
|
||||
<#if (category?size > 0)>
|
||||
|
||||
<#assign childs=category["./nav:category"]>
|
||||
|
||||
<#if (childs?size > 0)>
|
||||
<#nested>
|
||||
</#if>
|
||||
<#if (ofCategory["./nav:category"]?size > 0)>
|
||||
<#nested ofCategory["./nav:category"]>
|
||||
</#if>
|
||||
|
||||
</#macro>
|
||||
|
||||
<#macro subCategories ofCategory>
|
||||
|
||||
<#list ofCategory["./nav:category"] as category>
|
||||
<#nested category["./@id"], category["./@url"], category["./@title"], category["./nav:category"]>
|
||||
</#list>
|
||||
|
||||
</#macro>
|
||||
Loading…
Reference in New Issue