Add tests for existence of property in addLinkWithLabel and addLink macros

This commit is contained in:
ryounes 2011-05-25 19:47:18 +00:00
parent 054b1a9ac1
commit a220c5cba6

View file

@ -81,15 +81,17 @@ Assumes property is non-null. -->
we need to also show the property label. If no label is specified, the property we need to also show the property label. If no label is specified, the property
name will be used as the label. --> name will be used as the label. -->
<#macro addLinkWithLabel property editable label="${property.name?capitalize}" extraParams=""> <#macro addLinkWithLabel property editable label="${property.name?capitalize}" extraParams="">
<#if property?has_content>
<#local addLink><@addLink property editable label extraParams /></#local> <#local addLink><@addLink property editable label extraParams /></#local>
<#local verboseDisplay><@verboseDisplay property /></#local> <#local verboseDisplay><@verboseDisplay property /></#local>
<#if addLink?has_content || verboseDisplay?has_content> <#if addLink?has_content || verboseDisplay?has_content>
<h2 id="${property.localName}">${label} ${addLink!} ${verboseDisplay!}</h2> <h2 id="${property.localName}">${label} ${addLink!} ${verboseDisplay!}</h2>
</#if> </#if>
</#if>
</#macro> </#macro>
<#macro addLink property editable label="${property.name}" extraParams=""> <#macro addLink property editable label="${property.name}" extraParams="">
<#if editable> <#if property?has_content && editable>
<#local url = property.addUrl> <#local url = property.addUrl>
<#if url?has_content> <#if url?has_content>
<@showAddLink property.localName label addParamsToEditUrl(url, extraParams) /> <@showAddLink property.localName label addParamsToEditUrl(url, extraParams) />
@ -208,7 +210,7 @@ name will be used as the label. -->
Note that this macro has a side-effect in the call to propertyGroups.pullProperty(). Note that this macro has a side-effect in the call to propertyGroups.pullProperty().
--> -->
<#macro image individual propertyGroups namespaces editable showPlaceholder="never" placeholder=""> <#macro image individual propertyGroups namespaces editable showPlaceholder="never" placeholder="">
<#local mainImage = propertyGroups.pullProperty("${namespaces.vitroPublic}mainImage")!> <#local mainImage = propertyGroups.pullProperty("${namespaces.vitroPublic}fake")!>
<#local extraParams = ""> <#local extraParams = "">
<#if placeholder?has_content> <#if placeholder?has_content>
<#local extraParams = { "placeholder" : placeholder } > <#local extraParams = { "placeholder" : placeholder } >