NIHVIVO-1957 Pass placeholder image from template to ImageUploadController
This commit is contained in:
parent
52856261ce
commit
f0fe94bdd0
2 changed files with 61 additions and 37 deletions
|
@ -35,12 +35,12 @@
|
|||
|
||||
<#macro objectProperty property editable template=property.template>
|
||||
<#if property.collatedBySubclass> <#-- collated -->
|
||||
<@p.collatedObjectPropertyList property editable template />
|
||||
<@collatedObjectPropertyList property editable template />
|
||||
<#else> <#-- uncollated -->
|
||||
<#-- We pass property.statements and property.template even though we are also
|
||||
passing property, because objecctPropertyList can get other values, and
|
||||
doesn't necessarily use property.statements and property.template -->
|
||||
<@p.objectPropertyList property editable property.statements template />
|
||||
<@objectPropertyList property editable property.statements template />
|
||||
</#if>
|
||||
</#macro>
|
||||
|
||||
|
@ -67,7 +67,7 @@ Assumes property is non-null. -->
|
|||
<#local localName = property.localName>
|
||||
<h2 id="${localName}">${property.name?capitalize} <@addLink property editable /> <@verboseDisplay property /></h2>
|
||||
<ul id="individual-${localName}" role="list">
|
||||
<@p.objectProperty property editable />
|
||||
<@objectProperty property editable />
|
||||
</ul>
|
||||
</#macro>
|
||||
|
||||
|
@ -80,22 +80,35 @@ Assumes property is non-null. -->
|
|||
<#-- Some properties usually display without a label. But if there's an add link,
|
||||
we need to also show the property label. If no label is specified, the property
|
||||
name will be used as the label. -->
|
||||
<#macro addLinkWithLabel property editable label="${property.name?capitalize}">
|
||||
<#local addLink><@addLink property editable label /></#local>
|
||||
<#macro addLinkWithLabel property editable label="${property.name?capitalize}" extraParams="">
|
||||
<#local addLink><@addLink property editable label extraParams /></#local>
|
||||
<#if addLink?has_content>
|
||||
<h2 id="${property.localName}">${label} ${addLink} <@verboseDisplay property /></h2>
|
||||
</#if>
|
||||
</#macro>
|
||||
|
||||
<#macro addLink property editable label="${property.name}">
|
||||
<#macro addLink property editable label="${property.name}" extraParams="">
|
||||
<#if editable>
|
||||
<#local url = property.addUrl>
|
||||
<#if url?has_content>
|
||||
<a class="add-${property.localName}" href="${url}" title="Add new ${label?lower_case} entry"><img class="add-individual" src="${urls.images}/individual/addIcon.gif" alt="add" /></a>
|
||||
<@showAddLink property.localName label addParamsToEditUrl(url, extraParams) />
|
||||
</#if>
|
||||
</#if>
|
||||
</#macro>
|
||||
|
||||
<#function addParamsToEditUrl url extraParams="">
|
||||
<#if extraParams?is_hash_ex>
|
||||
<#list extraParams?keys as key>
|
||||
<#local url = "${url}&${key}=${extraParams[key]?url}">
|
||||
</#list>
|
||||
</#if>
|
||||
<#return url>
|
||||
</#function>
|
||||
|
||||
<#macro showAddLink propertyLocalName label url>
|
||||
<a class="add-${propertyLocalName}" href="${url}" title="Add new ${label?lower_case} entry"><img class="add-individual" src="${urls.images}/individual/addIcon.gif" alt="add" /></a>
|
||||
</#macro>
|
||||
|
||||
<#macro propertyLabel property label="${property.name?capitalize}">
|
||||
<h2 id="${property.localName}">${label} <@verboseDisplay property /></h2>
|
||||
</#macro>
|
||||
|
@ -107,27 +120,35 @@ name will be used as the label. -->
|
|||
</li>
|
||||
</#macro>
|
||||
|
||||
<#macro editingLinks propertyLocalName statement editable>
|
||||
<#macro editingLinks propertyLocalName statement editable extraParams="">
|
||||
<#if editable>
|
||||
<@editLink propertyLocalName statement />
|
||||
<@deleteLink propertyLocalName statement />
|
||||
<@editLink propertyLocalName statement extraParams />
|
||||
<@deleteLink propertyLocalName statement extraParams />
|
||||
</#if>
|
||||
</#macro>
|
||||
|
||||
<#macro editLink propertyLocalName statement>
|
||||
<#macro editLink propertyLocalName statement extraParams="">
|
||||
<#local url = statement.editUrl>
|
||||
<#if url?has_content>
|
||||
<a class="edit-${propertyLocalName}" href="${url}" title="edit this entry"><img class="edit-individual" src="${urls.images}/individual/editIcon.gif" alt="edit" /></a>
|
||||
<@showEditLink propertyLocalName addParamsToEditUrl(url, extraParams) />
|
||||
</#if>
|
||||
</#macro>
|
||||
|
||||
<#macro deleteLink propertyLocalName statement>
|
||||
<#macro showEditLink propertyLocalName url>
|
||||
<a class="edit-${propertyLocalName}" href="${url}" title="edit this entry"><img class="edit-individual" src="${urls.images}/individual/editIcon.gif" alt="edit" /></a>
|
||||
</#macro>
|
||||
|
||||
<#macro deleteLink propertyLocalName statement extraParams="">
|
||||
<#local url = statement.deleteUrl>
|
||||
<#if url?has_content>
|
||||
<a class="delete-${propertyLocalName}" href="${url}" title="delete this entry"><img class="delete-individual" src="${urls.images}/individual/deleteIcon.gif" alt="delete" /></a>
|
||||
<@showDeleteLink propertyLocalName addParamsToEditUrl(url, extraParams) />
|
||||
</#if>
|
||||
</#macro>
|
||||
|
||||
<#macro showDeleteLink propertyLocalName url>
|
||||
<a class="delete-${propertyLocalName}" href="${url}" title="delete this entry"><img class="delete-individual" src="${urls.images}/individual/deleteIcon.gif" alt="delete" /></a>
|
||||
</#macro>
|
||||
|
||||
<#macro verboseDisplay property>
|
||||
<#local verboseDisplay = property.verboseDisplay!>
|
||||
<#if verboseDisplay?has_content>
|
||||
|
@ -188,14 +209,18 @@ name will be used as the label. -->
|
|||
-->
|
||||
<#macro image individual propertyGroups namespaces editable showPlaceholder="never" placeholder="">
|
||||
<#local mainImage = propertyGroups.getPropertyAndRemoveFromList("${namespaces.vitroPublic}mainImage")!>
|
||||
<#local extraParams = "">
|
||||
<#if placeholder?has_content>
|
||||
<#local extraParams = { "placeholder" : placeholder } >
|
||||
</#if>
|
||||
<#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).
|
||||
If there's a mainImage statement but no thumbnail image, treat it as if there is no image. -->
|
||||
<#if (mainImage.statements)?has_content && thumbUrl?has_content>
|
||||
<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.first editable />
|
||||
<@editingLinks "${mainImage.localName}" mainImage.first editable extraParams />
|
||||
<#else>
|
||||
<#local imageLabel><@p.addLinkWithLabel mainImage editable "Photo" /></#local>
|
||||
<#local imageLabel><@addLinkWithLabel mainImage editable "Photo" extraParams /></#local>
|
||||
${imageLabel}
|
||||
<#if placeholder?has_content>
|
||||
<#if showPlaceholder == "always" || (showPlaceholder="with_add_link" && imageLabel?has_content)>
|
||||
|
@ -209,5 +234,5 @@ name will be used as the label. -->
|
|||
<#macro label individual editable>
|
||||
<#local label = individual.nameStatement>
|
||||
${label.value}
|
||||
<@p.editingLinks "label" label editable />
|
||||
<@editingLinks "label" label editable />
|
||||
</#macro>
|
Loading…
Add table
Add a link
Reference in a new issue