From 79607581ed98857a3f08b7e18375edc320be4996 Mon Sep 17 00:00:00 2001 From: ryounes Date: Tue, 21 Jun 2011 19:04:01 +0000 Subject: [PATCH] Menu management templates --- .../freemarker/IndividualController.java | 1 + .../body/individual/individual-menu.ftl | 35 +++++++++++-------- .../individual/individual-menu-properties.ftl | 24 ------------- .../partials/individual/lib-properties.ftl | 20 +---------- 4 files changed, 23 insertions(+), 57 deletions(-) delete mode 100644 webapp/web/templates/freemarker/body/partials/individual/individual-menu-properties.ftl diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/freemarker/IndividualController.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/freemarker/IndividualController.java index 90228cecc..57ed0b27e 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/freemarker/IndividualController.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/freemarker/IndividualController.java @@ -78,6 +78,7 @@ public class IndividualController extends FreemarkerHttpServlet { private static final String INCLUDE_ALL = "all"; private static final Map namespaces = new HashMap() {{ + put("display", VitroVocabulary.DISPLAY); put("vitro", VitroVocabulary.vitroURI); put("vitroPublic", VitroVocabulary.VITRO_PUBLIC); }}; diff --git a/webapp/web/templates/freemarker/body/individual/individual-menu.ftl b/webapp/web/templates/freemarker/body/individual/individual-menu.ftl index 302e452b8..d3c3860ee 100644 --- a/webapp/web/templates/freemarker/body/individual/individual-menu.ftl +++ b/webapp/web/templates/freemarker/body/individual/individual-menu.ftl @@ -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"> - - - - -<#assign nameForOtherGroup = "other"> <#-- used by both individual-propertyGroupMenu.ftl and individual-properties.ftl --> -

Menu management

-<#-- 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 />
+ + +
<#-- remove this once styles are applied --> + +<#-- Link to add a new menu item --> +<#if editable> + <#assign addUrl = hasElement.addUrl> + <#if addUrl?has_content> + Add menu item + + + +<#-- Remove unneeded scripts and stylesheets --> ${stylesheets.add('', '')} diff --git a/webapp/web/templates/freemarker/body/partials/individual/individual-menu-properties.ftl b/webapp/web/templates/freemarker/body/partials/individual/individual-menu-properties.ftl deleted file mode 100644 index 06870cc31..000000000 --- a/webapp/web/templates/freemarker/body/partials/individual/individual-menu-properties.ftl +++ /dev/null @@ -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> -

${groupName?capitalize}

- - - <#-- 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 /> -
<#--remove break--> - <@p.addLink property editable /> - - - \ No newline at end of file diff --git a/webapp/web/templates/freemarker/body/partials/individual/lib-properties.ftl b/webapp/web/templates/freemarker/body/partials/individual/lib-properties.ftl index 89d82af59..47f27fff0 100644 --- a/webapp/web/templates/freemarker/body/partials/individual/lib-properties.ftl +++ b/webapp/web/templates/freemarker/body/partials/individual/lib-properties.ftl @@ -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}"> - <#else> <@propertyListItem property statement editable><#include "${template}"> - @@ -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) /> - + <@showAddLink property.localName label addParamsToEditUrl(url, extraParams) /> @@ -249,12 +240,3 @@ name will be used as the label. --> <@editingLinks "label" label editable /> -<#-- Add menu item button --> -<#macro showAddMenuItemLink propertyLocalName label url> - Add menu item - - -<#-- List menu items --> -<#macro menuItem property statement editable > - Position | <#nested> | <@editingLinks "${property.localName}" statement editable/>
-