From 5513d73f02d9ac42155d2b90564e7bd60ff922ad Mon Sep 17 00:00:00 2001 From: David Lougheed Date: Wed, 11 Dec 2024 16:36:05 -0500 Subject: [PATCH 1/4] feat: support light/dark background branding https://redmine.c3g-app.sd4h.ca/issues/2273 --- docs/installation.md | 14 +++++++++--- docs/migrating_to_18.md | 9 ++++++++ ...nding.png => default.branding.lightbg.png} | Bin lib/public/docker-compose.public.yaml | 1 + py_bentoctl/other_helpers.py | 21 +++++++++++++----- 5 files changed, 36 insertions(+), 9 deletions(-) rename etc/{default.public.branding.png => default.branding.lightbg.png} (100%) diff --git a/docs/installation.md b/docs/installation.md index 6f9bc9e4..5742d604 100644 --- a/docs/installation.md +++ b/docs/installation.md @@ -325,10 +325,18 @@ value in the `BENTOV2_AUTH_CLIENT_ID` environment variable. On local instances, this is set to `local_bentov2` by default. -## 7. *Production only:* set up translations for Bento-Public +## 7. *Production only:* set up translations and branding -Now that Bento Public has been initialized by either `./bentoctl.bash init-all` or `./bentoctl.bash init-web public`, -adjust the default translation set as necessary: +Now that Bento Public and Web have been initialized by either `./bentoctl.bash init-all` or +`./bentoctl.bash init-web `, translation files and branding (logos) can be configured as necessary. + +**For branding (logos)**, copy files to the following paths: + +* A logo which works on dark backgrounds should be placed at `lib/public/branding.png` and `lib/web/branding.png`. +* A logo which works on light backgrounds should be placed at `lib/public/branding.lightbg.png`. This is primarily + useful for Beacon Network. + +**For translations** (which apply only to Bento Public), adjust the default translation set as necessary: ```js // lib/public/translations/.json diff --git a/docs/migrating_to_18.md b/docs/migrating_to_18.md index 338b456f..c6eec02d 100644 --- a/docs/migrating_to_18.md +++ b/docs/migrating_to_18.md @@ -1,3 +1,12 @@ # Migrating to Bento v18 TODO + +## TODO. Set up light and dark-background branding for Bento Public + +* Make sure `lib/public/branding.png` and `lib/web/branding.png` are images which work on dark backgrounds. +* **If you have a light-background logo to add:** put this file at `lib/public/branding.lightbg.png`. +* **If you do not have a light-background logo:** run `./bentoctl.bash init-web public` to copy the Bento logo to the + above location, or copy `branding.png` to `branding.lightbg.png` + +TODO diff --git a/etc/default.public.branding.png b/etc/default.branding.lightbg.png similarity index 100% rename from etc/default.public.branding.png rename to etc/default.branding.lightbg.png diff --git a/lib/public/docker-compose.public.yaml b/lib/public/docker-compose.public.yaml index 489b86d5..9d239f65 100644 --- a/lib/public/docker-compose.public.yaml +++ b/lib/public/docker-compose.public.yaml @@ -30,6 +30,7 @@ services: - ${PWD}/lib/public/fr_about.html:/bento-public/dist/public/fr_about.html:ro - ${PWD}/lib/public/branding.png:/bento-public/dist/public/assets/branding.png:ro + - ${PWD}/lib/public/branding.lightbg.png:/bento-public/dist/public/assets/branding.lightbg.png:ro healthcheck: test: [ "CMD", "curl", "http://localhost:${BENTO_PUBLIC_INTERNAL_PORT}/service-info" ] timeout: ${BENTO_HEALTHCHECK_TIMEOUT} diff --git a/py_bentoctl/other_helpers.py b/py_bentoctl/other_helpers.py index 0d4d87cf..e7622d4a 100644 --- a/py_bentoctl/other_helpers.py +++ b/py_bentoctl/other_helpers.py @@ -38,6 +38,7 @@ def init_web(service: str, force: bool): def _init_web_public(force: bool): root_path = pathlib.Path.cwd() + etc_path = root_path / "etc" # Init lib dir public_path = (root_path / "lib" / "public") @@ -46,33 +47,41 @@ def _init_web_public(force: bool): # About html page (English) _file_copy( - (root_path / "etc" / "default.en_about.html"), + (etc_path / "default.en_about.html"), (public_path / "en_about.html"), force=force, ) # About html page (French) _file_copy( - (root_path / "etc" / "default.fr_about.html"), + (etc_path / "default.fr_about.html"), (public_path / "fr_about.html"), force=force, ) # Branding image + # - dark background / default _file_copy( - (root_path / "etc" / "default.public.branding.png"), + (etc_path / "default.branding.png"), (public_path / "branding.png"), force=force, ) + # - light background + _file_copy( + (etc_path / "default.branding.lightbg.png"), + (public_path / "branding.lightbg.png"), + force=force, + ) + # English translations _file_copy( - (root_path / "etc" / "templates" / "translations" / "en.example.json"), + (etc_path / "templates" / "translations" / "en.example.json"), (translation_path / "en.json"), force=force, ) # French translations _file_copy( - (root_path / "etc" / "templates" / "translations" / "fr.example.json"), + (etc_path / "templates" / "translations" / "fr.example.json"), (translation_path / "fr.json"), force=force, ) @@ -99,7 +108,7 @@ def _init_web_private(force: bool): web_path = (root_path / "lib" / "web") web_path.mkdir(parents=True, exist_ok=True) - src_branding = (root_path / "etc" / "default.branding.png") + src_branding = (root_path / "etc" / "default.branding.darkbg.png") dst_branding = (web_path / "branding.png") if dst_branding.is_file(): From a3f1b20def231295e1b5992da34d0d5405521682 Mon Sep 17 00:00:00 2001 From: David Lougheed Date: Wed, 11 Dec 2024 16:43:03 -0500 Subject: [PATCH 2/4] docs: more work on v18 migration guide --- docs/migrating_to_18.md | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/docs/migrating_to_18.md b/docs/migrating_to_18.md index c6eec02d..d5d9c46c 100644 --- a/docs/migrating_to_18.md +++ b/docs/migrating_to_18.md @@ -2,11 +2,28 @@ TODO -## TODO. Set up light and dark-background branding for Bento Public + +## 1. Stop and update services + +```bash +./bentoctl.bash stop +./bentoctl.bash pull +``` + + +## 2. Set up light and dark-background branding for Bento Public * Make sure `lib/public/branding.png` and `lib/web/branding.png` are images which work on dark backgrounds. * **If you have a light-background logo to add:** put this file at `lib/public/branding.lightbg.png`. * **If you do not have a light-background logo:** run `./bentoctl.bash init-web public` to copy the Bento logo to the above location, or copy `branding.png` to `branding.lightbg.png` + TODO + + +## TODO. Restart services + +```bash + +``` From 8e42c56ef011393bfb55fb1f6621b3067bb89152 Mon Sep 17 00:00:00 2001 From: David Lougheed Date: Wed, 11 Dec 2024 16:43:22 -0500 Subject: [PATCH 3/4] docs: v18 migration guide work --- docs/migrating_to_18.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/migrating_to_18.md b/docs/migrating_to_18.md index d5d9c46c..ed5551c6 100644 --- a/docs/migrating_to_18.md +++ b/docs/migrating_to_18.md @@ -25,5 +25,5 @@ TODO ## TODO. Restart services ```bash - +./bentoctl.bash start ``` From e8def901fc60c3bb33e14e16e4375182a5f0d524 Mon Sep 17 00:00:00 2001 From: David Lougheed Date: Thu, 12 Dec 2024 10:37:44 -0500 Subject: [PATCH 4/4] public - bind lightbg branding in local mode --- docker-compose.local.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/docker-compose.local.yaml b/docker-compose.local.yaml index 5dbd201f..0147a093 100644 --- a/docker-compose.local.yaml +++ b/docker-compose.local.yaml @@ -19,6 +19,7 @@ services: - ${PWD}/lib/public/en_about.html:/bento-public/src/public/en_about.html - ${PWD}/lib/public/fr_about.html:/bento-public/src/public/fr_about.html - ${PWD}/lib/public/branding.png:/bento-public/src/public/assets/branding.png + - ${PWD}/lib/public/branding.lightbg.png:/bento-public/src/public/assets/branding.lightbg.png - ${PWD}/lib/public/translations/en.json:/bento-public/src/public/locales/en/translation_en.json - ${PWD}/lib/public/translations/fr.json:/bento-public/src/public/locales/fr/translation_fr.json environment: