NIHVIVO-1332 Editing links for vitro:primaryLink and vitro:additionalLink properties
This commit is contained in:
parent
981aff8ac4
commit
dbbe25b65c
13 changed files with 190 additions and 70 deletions
|
@ -6,10 +6,24 @@
|
|||
will use the vivo core ontology links property, eliminating the need for special handling.
|
||||
-->
|
||||
|
||||
<nav role="navigation">
|
||||
<ul id ="individual-urls" role="list">
|
||||
<#list individual.links as link>
|
||||
<li role="listitem"><a href="${link.url}">${link.anchor}</a></li>
|
||||
</#list>
|
||||
</ul>
|
||||
</nav>
|
||||
<#assign vitroNs = "http://vitro.mannlib.cornell.edu/ns/vitro/0.7#">
|
||||
<#assign primaryLink = propertyGroups.getPropertyAndRemoveFromList("${vitroNs}primaryLink")!>
|
||||
<#assign additionalLinks = propertyGroups.getPropertyAndRemoveFromList("${vitroNs}additionalLink")!>
|
||||
<#assign linkListClass = linkListClass!"individual-urls">
|
||||
|
||||
<#if (primaryLink?has_content || additionalLinks?has_content)> <#-- true when the property is in the list, even if not populated (when editing) -->
|
||||
<nav role="navigation">
|
||||
<@p.addLinkWithLabel primaryLink editing "Primary Web Page" />
|
||||
<#if primaryLink.statements?has_content> <#-- if there are any statements -->
|
||||
<ul class="${linkListClass}" id="links-primary" role="list">
|
||||
<@p.objectPropertyList primaryLink.statements primaryLink.template editing />
|
||||
</ul>
|
||||
</#if>
|
||||
<@p.addLinkWithLabel additionalLinks editing "Additional Web Pages" />
|
||||
<#if additionalLinks.statements?has_content> <#-- if there are any statements -->
|
||||
<ul class="${linkListClass}" id="links-additional" role="list">
|
||||
<@p.objectPropertyList additionalLinks.statements additionalLinks.template editing />
|
||||
</ul>
|
||||
</#if>
|
||||
</nav>
|
||||
</#if>
|
|
@ -33,11 +33,12 @@
|
|||
</#macro>
|
||||
|
||||
<#-- Some properties usually display without a label. But if there's an add link,
|
||||
we need to also show the property label. -->
|
||||
<#macro addLinkWithLabel property showEditingLinks>
|
||||
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 showEditingLinks label="${property.name?capitalize}">
|
||||
<#local addLink><@addLink property showEditingLinks /></#local>
|
||||
<#if addLink?has_content>
|
||||
<h3>${property.name?capitalize} ${addLink}</h3>
|
||||
<h3>${label} ${addLink}</h3>
|
||||
</#if>
|
||||
</#macro>
|
||||
|
||||
|
@ -77,5 +78,3 @@ we need to also show the property label. -->
|
|||
<a href="${url}" title="delete this relationship"><img class="delete-individual" src="${urls.images}/individual/deleteIcon.gif" alt="delete" /></a>
|
||||
</#if>
|
||||
</#macro>
|
||||
|
||||
<#-- Macros for specific properties -->
|
|
@ -0,0 +1,15 @@
|
|||
<#-- $This file is distributed under the terms of the license in /doc/license.txt$ -->
|
||||
|
||||
<#-- Template for vitro:primaryLink and vitro:additionalLink -->
|
||||
|
||||
<#assign linkText>
|
||||
<#if statement.anchor??>${statement.anchor}
|
||||
<#else>${statement.linkName} (no anchor text provided for link)
|
||||
</#if>
|
||||
</#assign>
|
||||
|
||||
<#if statement.url??>
|
||||
<a href="${statement.url}">${linkText}</a>
|
||||
<#else>
|
||||
<a href="${profileUrl(statement.link)}">${linkText}</a> (no url provided for link)
|
||||
</#if>
|
Loading…
Add table
Add a link
Reference in a new issue