From 3ad80a9cf6367ee36e299db89407b2f348cae149 Mon Sep 17 00:00:00 2001 From: Graham Triggs Date: Mon, 2 Oct 2017 18:23:49 +0100 Subject: [PATCH] Consolidate local overrides of messages and styles in "local" subdirectory. Allows customisation without creating a new thmee. --- .../mannlib/vitro/webapp/i18n/VitroResourceBundle.java | 2 +- installer/webapp/src/main/webapp/local/css/local.css | 5 +++++ installer/webapp/src/main/webapp/local/i18n/all.properties | 5 +++++ installer/webapp/src/main/webapp/local/readme | 1 + webapp/src/main/webapp/local/css/local.css | 5 +++++ webapp/src/main/webapp/local/i18n/all.properties | 5 +++++ webapp/src/main/webapp/themes/vitro/css/screen.css | 3 ++- 7 files changed, 24 insertions(+), 2 deletions(-) create mode 100644 installer/webapp/src/main/webapp/local/css/local.css create mode 100644 installer/webapp/src/main/webapp/local/i18n/all.properties create mode 100644 installer/webapp/src/main/webapp/local/readme create mode 100644 webapp/src/main/webapp/local/css/local.css create mode 100644 webapp/src/main/webapp/local/i18n/all.properties diff --git a/api/src/main/java/edu/cornell/mannlib/vitro/webapp/i18n/VitroResourceBundle.java b/api/src/main/java/edu/cornell/mannlib/vitro/webapp/i18n/VitroResourceBundle.java index 5fa5e217d..0ec5fa7b9 100644 --- a/api/src/main/java/edu/cornell/mannlib/vitro/webapp/i18n/VitroResourceBundle.java +++ b/api/src/main/java/edu/cornell/mannlib/vitro/webapp/i18n/VitroResourceBundle.java @@ -143,7 +143,7 @@ public class VitroResourceBundle extends ResourceBundle { if (props == null) { throw new FileNotFoundException("Property file not found at '" + defaultsPath + "' or '" + propertiesPath + "'"); } - props = loadProperties(props, locateFile(joinPath(appI18nPath, "local_" + resourceName))); + props = loadProperties(props, locateFile(joinPath("/local/i18n/", resourceName))); return props; } diff --git a/installer/webapp/src/main/webapp/local/css/local.css b/installer/webapp/src/main/webapp/local/css/local.css new file mode 100644 index 000000000..4a441c963 --- /dev/null +++ b/installer/webapp/src/main/webapp/local/css/local.css @@ -0,0 +1,5 @@ +/* + Override theme CSS styles by placing them in this file + + Note - all themes must include <../../..>/local/css/local.css as the last import. +*/ \ No newline at end of file diff --git a/installer/webapp/src/main/webapp/local/i18n/all.properties b/installer/webapp/src/main/webapp/local/i18n/all.properties new file mode 100644 index 000000000..3f232df8a --- /dev/null +++ b/installer/webapp/src/main/webapp/local/i18n/all.properties @@ -0,0 +1,5 @@ +# +# Local customisations override any provided messages +# +# Default (English) +# diff --git a/installer/webapp/src/main/webapp/local/readme b/installer/webapp/src/main/webapp/local/readme new file mode 100644 index 000000000..b73c7d8d5 --- /dev/null +++ b/installer/webapp/src/main/webapp/local/readme @@ -0,0 +1 @@ +You can override messages and CSS by placing local rules and text in the files here. \ No newline at end of file diff --git a/webapp/src/main/webapp/local/css/local.css b/webapp/src/main/webapp/local/css/local.css new file mode 100644 index 000000000..4a441c963 --- /dev/null +++ b/webapp/src/main/webapp/local/css/local.css @@ -0,0 +1,5 @@ +/* + Override theme CSS styles by placing them in this file + + Note - all themes must include <../../..>/local/css/local.css as the last import. +*/ \ No newline at end of file diff --git a/webapp/src/main/webapp/local/i18n/all.properties b/webapp/src/main/webapp/local/i18n/all.properties new file mode 100644 index 000000000..3f232df8a --- /dev/null +++ b/webapp/src/main/webapp/local/i18n/all.properties @@ -0,0 +1,5 @@ +# +# Local customisations override any provided messages +# +# Default (English) +# diff --git a/webapp/src/main/webapp/themes/vitro/css/screen.css b/webapp/src/main/webapp/themes/vitro/css/screen.css index 10ae2bbfa..63af944c0 100644 --- a/webapp/src/main/webapp/themes/vitro/css/screen.css +++ b/webapp/src/main/webapp/themes/vitro/css/screen.css @@ -23,4 +23,5 @@ VIVO wilma theme: screen styles @charset "UTF-8"; @import url("reset.css"); -@import url("vitroTheme.css"); \ No newline at end of file +@import url("vitroTheme.css"); +@import url("../../../local/css/local.css"); \ No newline at end of file