NIHVIVO-1176. Removed themeStylesheetDir from template model, and replaced with themeDir. Also modified stylesheet and script addFromTheme methods so the prepend only the theme directory; the specific stylesheet or css directory must be added to the path argument.
This commit is contained in:
parent
535691ee11
commit
5bc5c0b93c
12 changed files with 80 additions and 108 deletions
|
@ -351,10 +351,7 @@ public class FreemarkerHttpServlet extends VitroHttpServlet {
|
|||
|
||||
map.put("urls", getUrls(themeDir, urlBuilder));
|
||||
|
||||
// This value will be available to any template as a path for adding a new stylesheet.
|
||||
// It does not contain the context path, because the methods to generate the href
|
||||
// attribute from the string passed in by the template automatically add the context path.
|
||||
map.put("themeStylesheetDir", themeDir + "/css");
|
||||
map.put("themeDir", themeDir);
|
||||
|
||||
map.put("stylesheets", getStylesheetList(themeDir));
|
||||
map.put("scripts", getScriptList(themeDir));
|
||||
|
|
|
@ -40,7 +40,7 @@ public abstract class Files extends BaseTemplateModel {
|
|||
if (!path.startsWith("/")) {
|
||||
path = "/" + path;
|
||||
}
|
||||
path = themeDir + getThemeSubDir() + path;
|
||||
path = themeDir + path;
|
||||
add(path);
|
||||
}
|
||||
|
||||
|
@ -62,8 +62,7 @@ public abstract class Files extends BaseTemplateModel {
|
|||
public String dump() {
|
||||
return list.toString();
|
||||
}
|
||||
|
||||
protected abstract String getThemeSubDir();
|
||||
|
||||
protected abstract String getTag(String url);
|
||||
|
||||
}
|
||||
|
|
|
@ -3,8 +3,6 @@
|
|||
package edu.cornell.mannlib.vitro.webapp.web.templatemodels.files;
|
||||
|
||||
public class Scripts extends Files {
|
||||
|
||||
protected static final String THEME_SUBDIR = "/js";
|
||||
|
||||
public Scripts() { }
|
||||
|
||||
|
@ -15,8 +13,4 @@ public class Scripts extends Files {
|
|||
protected String getTag(String url) {
|
||||
return "<script type=\"text/javascript\" src=\"" + url + "\"></script>\n";
|
||||
}
|
||||
|
||||
protected String getThemeSubDir() {
|
||||
return THEME_SUBDIR;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,8 +3,6 @@
|
|||
package edu.cornell.mannlib.vitro.webapp.web.templatemodels.files;
|
||||
|
||||
public class Stylesheets extends Files {
|
||||
|
||||
protected static final String THEME_SUBDIR = "/css";
|
||||
|
||||
public Stylesheets() { }
|
||||
|
||||
|
@ -15,9 +13,5 @@ public class Stylesheets extends Files {
|
|||
protected String getTag(String url) {
|
||||
return "<link rel=\"stylesheet\" href=\"" + url + "\" />\n";
|
||||
}
|
||||
|
||||
protected String getThemeSubDir() {
|
||||
return THEME_SUBDIR;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue