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
22
webapp/web/config/listViewConfig-vitroLink.xml
Normal file
22
webapp/web/config/listViewConfig-vitroLink.xml
Normal file
|
@ -0,0 +1,22 @@
|
|||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<!-- $This file is distributed under the terms of the license in /doc/license.txt$ -->
|
||||
|
||||
<!-- Default list view config file for collated object properties
|
||||
|
||||
See guidelines in vitro/doc/list_view_configuration_guidelines.txt -->
|
||||
|
||||
<list-view-config>
|
||||
<query>
|
||||
PREFIX vitro: <http://vitro.mannlib.cornell.edu/ns/vitro/0.7#>
|
||||
PREFIX afn: <http://jena.hpl.hp.com/ARQ/function#>
|
||||
|
||||
SELECT ?link (afn:localname(?link) AS ?linkName) ?anchor ?url WHERE {
|
||||
GRAPH ?g1 { ?subject ?property ?link }
|
||||
OPTIONAL { GRAPH ?g2 { ?link vitro:linkAnchor ?anchor } }
|
||||
OPTIONAL { GRAPH ?g3 { ?link vitro:linkURL ?url } }
|
||||
OPTIONAL { GRAPH ?g4 { ?link vitro:linkDisplayRank ?rank } }
|
||||
} ORDER BY ?rank
|
||||
</query>
|
||||
|
||||
<template>propStatement-vitroLink.ftl</template>
|
||||
</list-view-config>
|
|
@ -161,27 +161,27 @@ ul#individual-phone li:first-child{
|
|||
.icon-phone, .icon-email{
|
||||
padding-right: 5px;
|
||||
}
|
||||
ul#individual-urls{
|
||||
ul.individual-urls{
|
||||
list-style-type: circle;
|
||||
margin-left: 10px;
|
||||
float: left;
|
||||
margin-bottom: 30px;
|
||||
}
|
||||
ul#individual-urls li{
|
||||
ul.individual-urls li{
|
||||
font-size: .875em;
|
||||
line-height: 1.2em;
|
||||
}
|
||||
ul#individual-urls li a{
|
||||
ul.individual-urls li a{
|
||||
color: #2485ae;
|
||||
}
|
||||
ul#individual-urls-people{
|
||||
ul.individual-urls-people{
|
||||
clear: both;
|
||||
margin-top: 20px;
|
||||
list-style: none;
|
||||
list-style-type: circle;
|
||||
padding-left: 24px;
|
||||
}
|
||||
ul#individual-urls-people li{
|
||||
ul.individual-urls-people li{
|
||||
font-size: .875em;
|
||||
line-height: 1.2em;
|
||||
}
|
||||
|
|
|
@ -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