NIHVIVO-1895 Show placeholder image for non-person individual when displaying an add link for an image

This commit is contained in:
rjy7 2011-01-25 17:32:45 +00:00
parent 9ceb990c9d
commit f243f48b3b
2 changed files with 14 additions and 5 deletions

View file

@ -5,7 +5,12 @@
<section id="individual-intro" class="vcard" role="region">
<#-- Image -->
<@p.imageLinks individual propertyGroups namespaces editable />
<@p.imageLinks individual=individual
propertyGroups=propertyGroups
namespaces=namespaces
editable=editable
showPlaceholder="with_add_link"
placeholder="${urls.images}/placeholders/person.thumbnail.jpg" />
<section id="individual-info" role="region">
<#if individual.showAdminPanel>

View file

@ -118,7 +118,8 @@ name will be used as the label. -->
</#macro>
<#-- Main image links -->
<#macro imageLinks individual propertyGroups namespaces editable placeholderImage="">
<#-- Values for showPlaceholderImage: "always", "never", "with_add_link" -->
<#macro imageLinks individual propertyGroups namespaces editable showPlaceholder="never" placeholder="">
<#local mainImage = propertyGroups.getPropertyAndRemoveFromList("${namespaces.vitroPublic}mainImage")!>
<#local thumbUrl = individual.thumbUrl!>
<#-- Don't assume that if the mainImage property is populated, there is a thumbnail image (though that is the general case).
@ -127,9 +128,12 @@ name will be used as the label. -->
<a href="${individual.imageUrl}"><img class="individual-photo" src="${thumbUrl}" title="click to view larger image" alt="${individual.name}" width="160" /></a>
<@p.editingLinks "${mainImage.localName}" mainImage.statements[0] editable />
<#else>
<@p.addLinkWithLabel mainImage editable "Photo" />
<#if placeholderImage?has_content>
<img class="individual-photo" src="${placeholderImage}" title = "no image" alt="placeholder image" width="160" />
<#local imageLabel><@p.addLinkWithLabel mainImage editable "Photo" /></#local>
${imageLabel}
<#if placeholder?has_content>
<#if showPlaceholder == "always" || (showPlaceholder="with_add_link" && imageLabel?has_content)>
<img class="individual-photo" src="${placeholder}" title = "no image" alt="placeholder image" width="160" />
</#if>
</#if>
</#if>
</#macro>