Menu management templates
This commit is contained in:
parent
bfb26e31ea
commit
79607581ed
4 changed files with 23 additions and 57 deletions
|
@ -78,6 +78,7 @@ public class IndividualController extends FreemarkerHttpServlet {
|
|||
private static final String INCLUDE_ALL = "all";
|
||||
|
||||
private static final Map<String, String> namespaces = new HashMap<String, String>() {{
|
||||
put("display", VitroVocabulary.DISPLAY);
|
||||
put("vitro", VitroVocabulary.vitroURI);
|
||||
put("vitroPublic", VitroVocabulary.VITRO_PUBLIC);
|
||||
}};
|
||||
|
|
|
@ -1,25 +1,32 @@
|
|||
<#-- $This file is distributed under the terms of the license in /doc/license.txt$ -->
|
||||
|
||||
<#-- Default VIVO individual profile page template (extends individual.ftl in vitro) -->
|
||||
<#-- Menu management page (uses individual display mechanism) -->
|
||||
|
||||
<#import "lib-properties.ftl" as p>
|
||||
|
||||
<#include "individual-setup.ftl">
|
||||
|
||||
<#assign individualProductExtension>
|
||||
<#-- Include for any class specific template additions -->
|
||||
${classSpecificExtension!}
|
||||
|
||||
<#include "individual-overview.ftl">
|
||||
</section> <!-- #individual-info -->
|
||||
</section> <!-- #individual-intro -->
|
||||
</#assign>
|
||||
|
||||
<#assign nameForOtherGroup = "other"> <#-- used by both individual-propertyGroupMenu.ftl and individual-properties.ftl -->
|
||||
|
||||
<h3>Menu management</h3>
|
||||
|
||||
<#-- Menu Ontology properties -->
|
||||
<#include "individual-menu-properties.ftl">
|
||||
<#assign hasElement = propertyGroups.pullProperty("${namespaces.display}hasElement")>
|
||||
|
||||
<#-- List the menu items -->
|
||||
<#list hasElement.statements as statement>
|
||||
<#-- can we just provide the name of the template? -->
|
||||
Position | <#include "${hasElement.template}"> | <@p.editingLinks "hasElement" statement editable /> <br />
|
||||
</#list>
|
||||
|
||||
<br /> <#-- remove this once styles are applied -->
|
||||
|
||||
<#-- Link to add a new menu item -->
|
||||
<#if editable>
|
||||
<#assign addUrl = hasElement.addUrl>
|
||||
<#if addUrl?has_content>
|
||||
<a class="add-hasElement green button" href="${addUrl}" title="Add new menu item">Add menu item</a>
|
||||
</#if>
|
||||
</#if>
|
||||
|
||||
<#-- Remove unneeded scripts and stylesheets -->
|
||||
${stylesheets.add('<link rel="stylesheet" href="${urls.base}/css/individual/individual.css" />',
|
||||
'<link rel="stylesheet" href="${urls.base}/css/individual/individual-vivo.css" />')}
|
||||
|
||||
|
|
|
@ -1,24 +0,0 @@
|
|||
<#-- $This file is distributed under the terms of the license in /doc/license.txt$ -->
|
||||
|
||||
<#-- Template for menu management page -->
|
||||
|
||||
<#import "lib-properties.ftl" as p>
|
||||
|
||||
<#list propertyGroups.all as group>
|
||||
<#assign groupName = group.getName(nameForOtherGroup)>
|
||||
|
||||
<#-- Display the group heading -->
|
||||
<#if groupName?has_content>
|
||||
<h2 id="${groupName}">${groupName?capitalize}</h2>
|
||||
</#if>
|
||||
|
||||
<#-- List the menu items(properties) in the group -->
|
||||
<#list group.properties as property>
|
||||
<#if property.localName == "hasElement">
|
||||
<#-- List menu Items -->
|
||||
<@p.objectProperty property editable property.template />
|
||||
<br /><#--remove break-->
|
||||
<@p.addLink property editable />
|
||||
</#if>
|
||||
</#list>
|
||||
</#list>
|
|
@ -75,11 +75,7 @@ Assumes property is non-null. -->
|
|||
|
||||
<#macro objectPropertyList property editable statements=property.statements template=property.template>
|
||||
<#list statements as statement>
|
||||
<#if property.localName == "hasElement">
|
||||
<@menuItem property statement editable><#include "${template}"></@menuItem>
|
||||
<#else>
|
||||
<@propertyListItem property statement editable><#include "${template}"></@propertyListItem>
|
||||
</#if>
|
||||
</#list>
|
||||
</#macro>
|
||||
|
||||
|
@ -96,14 +92,9 @@ name will be used as the label. -->
|
|||
|
||||
<#macro addLink property editable label="${property.name}" extraParams="">
|
||||
<#if editable>
|
||||
<#--@dump var="property"/-->
|
||||
<#local url = property.addUrl>
|
||||
<#if url?has_content>
|
||||
<#if property.localName == "hasElement">
|
||||
<@showAddMenuItemLink property.localName label addParamsToEditUrl(url, extraParams) />
|
||||
<#else>
|
||||
<@showAddLink property.localName label addParamsToEditUrl(url, extraParams) />
|
||||
</#if>
|
||||
<@showAddLink property.localName label addParamsToEditUrl(url, extraParams) />
|
||||
</#if>
|
||||
</#if>
|
||||
</#macro>
|
||||
|
@ -249,12 +240,3 @@ name will be used as the label. -->
|
|||
<@editingLinks "label" label editable />
|
||||
</#macro>
|
||||
|
||||
<#-- Add menu item button -->
|
||||
<#macro showAddMenuItemLink propertyLocalName label url>
|
||||
<a class="add-${propertyLocalName} green button" href="${url}" title="Add new ${label?lower_case} entry">Add menu item</a>
|
||||
</#macro>
|
||||
|
||||
<#-- List menu items -->
|
||||
<#macro menuItem property statement editable >
|
||||
Position | <#nested> | <@editingLinks "${property.localName}" statement editable/> <br />
|
||||
</#macro>
|
||||
|
|
Loading…
Add table
Reference in a new issue