From a8d353dab13653c1af63f7e23486615e17733bef Mon Sep 17 00:00:00 2001 From: nac26 Date: Tue, 8 Feb 2011 13:29:09 +0000 Subject: [PATCH] NIHVIVO-2006 Realized that I had introduced a bug in r7283 and was missing the closing for #classes-in-classgroup list items. IE was not a fan. Also removed labels since Raphael uses VML for graphing in IE and I wasn't reliably able to target and hide rvml:textpath. --- .../FreemarkerConfigurationLoader.java | 25 ++++++++++--------- webapp/web/js/browseClassGroups.js | 18 ++----------- 2 files changed, 15 insertions(+), 28 deletions(-) diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/freemarker/FreemarkerConfigurationLoader.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/freemarker/FreemarkerConfigurationLoader.java index 73657df64..07e37b30f 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/freemarker/FreemarkerConfigurationLoader.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/freemarker/FreemarkerConfigurationLoader.java @@ -58,11 +58,10 @@ public class FreemarkerConfigurationLoader { String themeDir = getThemeDir(vreq.getPortal()); return getConfigForTheme(themeDir); } - + protected String getThemeDir(Portal portal) { return portal.getThemeDir().replaceAll("/$", ""); } - protected Configuration getConfigForTheme(String themeDir) { @@ -96,10 +95,10 @@ public class FreemarkerConfigurationLoader { config.setTemplateUpdateDelay(0); // no template caching in development } else { int delay = 60; - log.debug("Setting Freemarker template cache update delay to " + delay + "."); + log.debug("Setting Freemarker template cache update delay to " + delay + "."); config.setTemplateUpdateDelay(delay); // in seconds; Freemarker default is 5 } - + // Specify how templates will see the data model. // The default wrapper exposes set methods unless exposure level is set. // By default we want to block exposure of set methods. @@ -126,15 +125,19 @@ public class FreemarkerConfigurationLoader { log.error("Error setting value for url_escaping_charset."); } - config.setTemplateLoader(getTemplateLoader(config, themeDir)); + // auto include setup.ftl which allows for globals to be easily defined in a template that's always included + // used primarily to setup ${bodyClasses} for now + config.addAutoInclude("pageSetup.ftl"); + + config.setTemplateLoader(getTemplateLoader(config, themeDir)); return config; } - + // Define template locations. Template loader will look first in the theme-specific // location, then in the vitro location. protected final TemplateLoader getTemplateLoader(Configuration config, String themeDir) { - + List loaders = new ArrayList(); MultiTemplateLoader mtl = null; try { @@ -145,7 +148,7 @@ public class FreemarkerConfigurationLoader { if (themeTemplateDir.exists()) { FileTemplateLoader themeFtl = new FileTemplateLoader(themeTemplateDir); loaders.add(themeFtl); - } + } // Vitro template loader String vitroTemplatePath = context.getRealPath("/templates/freemarker"); @@ -159,8 +162,6 @@ public class FreemarkerConfigurationLoader { } catch (IOException e) { log.error("Error creating template loaders"); } - return mtl; - + return mtl; } - -} +} \ No newline at end of file diff --git a/webapp/web/js/browseClassGroups.js b/webapp/web/js/browseClassGroups.js index aa88cccf7..4fc2922b9 100644 --- a/webapp/web/js/browseClassGroups.js +++ b/webapp/web/js/browseClassGroups.js @@ -41,12 +41,10 @@ var browseClassGroups = { $('ul#classes-in-classgroup li a').hover(function() { var classIndex = $('ul#classes-in-classgroup li a').index(this); $('#visual-graph svg path').eq(classIndex).attr('fill', '#ccc'); - $('#visual-graph svg text').eq(classIndex).toggle(); return false; }, function() { var classIndex = $('ul#classes-in-classgroup li a').index(this); $('#visual-graph svg path').eq(classIndex).attr('fill', '#999'); - $('#visual-graph svg text').eq(classIndex).toggle(); }) }, @@ -93,8 +91,7 @@ var browseClassGroups = { // Build the content of each list item, piecing together each component listItem = '
  • '; - listItem += ''+ name; - listItem += ' ('+ indivCount +')'; + listItem += ''+ name +''; listItem += '
  • '; // Add the list item to the array of classes @@ -156,14 +153,6 @@ var graphClassGroups = { var chart = r.g.hbarchart(0, 16, 300, height, [values], {type:"soft", singleColor:"#999"}); - // Add the class names as labels and then hide them - chart.label(labels, true); - // Getting a JS error in the console when trying to add the class - // "setting a property that has only a getter" - // $('svg text').addClass('hidden'); - // so using .hide() instead - $('svg text').hide(); - // Was unable to append within -- was always hidden and couldn't get it to display // so using jQuery click to add links $('rect').click(function() { @@ -185,20 +174,17 @@ var graphClassGroups = { // On hover // 1. Change bar color - // 2. Reveal label - // 3. Highlight class name in main list + // 2. Highlight class name in main list chart.hover(function() { this.bar.attr({fill: "#ccc"}); $('rect').hover(function() { var index = $('rect').index(this); - $('svg text').eq(index).show(); $('#classes-in-classgroup li a').eq(index).addClass('selected'); }) }, function() { this.bar.attr({fill: "#999"}); $('rect').hover(function() { var index = $('rect').index(this); - $('svg text').eq(index).hide(); $('#classes-in-classgroup li a').eq(index).removeClass('selected'); }) });