-
Notifications
You must be signed in to change notification settings - Fork 1
Draft: refactor: make app branding customizable #1333
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
20f7cb7
d465cdb
2918f4d
fc5c68c
0b4ed49
be9873b
855bb8c
70066c3
fd4d43d
9c9f0c0
f0e6b81
4e772e3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,67 @@ | ||
| <!-- | ||
| SPDX-FileCopyrightText: Copyright (C) 2025 Opal Health Informatics Group at the Research Institute of the McGill University Health Centre <john.kildea@mcgill.ca> | ||
|
|
||
| SPDX-License-Identifier: Apache-2.0 | ||
| --> | ||
|
|
||
| # Branding Setup Guide | ||
|
|
||
| This project has been configured by default with assets that reflect Opal's visual branding and identity. | ||
| However, these assets can be replaced to configure the app with your own organization's branding. | ||
| To customize the app's branding, follow the steps below. | ||
|
|
||
| ## Images and Logos | ||
|
|
||
| All customizable images in the app are listed in the file [branding.constants.js](/src/js/constants/branding.constants.js). | ||
| The keys in this file (e.g. `init-logo`) can be used to search for the location of each image in the app code. | ||
| You won't need to edit the source, but this can be useful to locate each image in the app. | ||
|
|
||
| To replace an image with your own branded version, upload your new image to `src/img/branding/custom`. | ||
|
|
||
| Replace the value of `src` in [branding.constants.js](/src/js/constants/branding.constants.js) with the path to your new image. | ||
| Note that webpack has been configured to access the `src/img` directory from the root, simply as `img`. | ||
| To avoid additional changes to webpack, all image paths should begin with `img`. | ||
|
|
||
| ```javascript | ||
| 'init-logo': { | ||
| src: 'img/branding/custom/my-logo.png', | ||
| }, | ||
| ``` | ||
|
|
||
| ### CSS | ||
|
|
||
| New images can be configured by overriding their CSS styles. | ||
|
|
||
| To customize an image using CSS, create a CSS file in `src/css/branding/custom/`. | ||
| Add an `@import` statement at the end of `src/css/branding.css` to link this file into the project. | ||
|
|
||
| New CSS files should apply styles to an image's id. Ids are defined in [branding.constants.js](/src/js/constants/branding.constants.js). | ||
|
|
||
| In the following example, basic styles continue to apply to the logo; | ||
| only the width is overridden by the new style sheet. | ||
|
|
||
| Basic CSS (`src/css/branding/opal/init-logo.css`) | ||
| ```css | ||
| #init-logo { | ||
| max-height: 50%; | ||
| object-fit: contain; | ||
| width: 60%; | ||
| z-index: 2; | ||
| } | ||
| ``` | ||
|
|
||
| Overriding CSS (`src/css/branding/custom/init-logo.css`) | ||
| ```css | ||
| #init-logo { | ||
| width: 90%; | ||
| } | ||
| ``` | ||
|
|
||
| Import (`src/css/branding.css`) | ||
| ```css | ||
| @import url('branding/opal/init-logo.css'); | ||
| /* ... */ | ||
|
|
||
| /* IMPORT CUSTOM BRANDING CSS FILES HERE */ | ||
| @import url('branding/custom/init-logo.css'); | ||
| ``` |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| /* | ||
| * SPDX-FileCopyrightText: Copyright (C) 2025 Opal Health Informatics Group at the Research Institute of the McGill University Health Centre <john.kildea@mcgill.ca> | ||
| * | ||
| * SPDX-License-Identifier: Apache-2.0 | ||
| */ | ||
|
|
||
| @import url('branding/opal/init-background.css'); | ||
| @import url('branding/opal/init-logo.css'); | ||
|
|
||
| /* IMPORT CUSTOM BRANDING CSS FILES HERE */ |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| <!-- | ||
| SPDX-FileCopyrightText: Copyright (C) 2025 Opal Health Informatics Group at the Research Institute of the McGill University Health Centre <john.kildea@mcgill.ca> | ||
|
|
||
| SPDX-License-Identifier: Apache-2.0 | ||
| --> | ||
|
|
||
| # Custom Branding CSS | ||
|
|
||
| Branding images specific to your organization can be configured here via CSS files that will override their default styles. | ||
|
|
||
| See the [Branding Setup Guide](/docs/setup/branding.md) for instructions on creating and applying these CSS overrides. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| /* | ||
| * SPDX-FileCopyrightText: Copyright (C) 2025 Opal Health Informatics Group at the Research Institute of the McGill University Health Centre <john.kildea@mcgill.ca> | ||
| * | ||
| * SPDX-License-Identifier: Apache-2.0 | ||
| */ | ||
|
|
||
| #init-background { | ||
| height: 100%; | ||
| object-fit: cover; | ||
| width: 100%; | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| /* | ||
| * SPDX-FileCopyrightText: Copyright (C) 2025 Opal Health Informatics Group at the Research Institute of the McGill University Health Centre <john.kildea@mcgill.ca> | ||
| * | ||
| * SPDX-License-Identifier: Apache-2.0 | ||
| */ | ||
|
|
||
| #init-logo { | ||
| max-height: 50%; | ||
| object-fit: contain; | ||
| width: 60%; | ||
| z-index: 2; | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| <!-- | ||
| SPDX-FileCopyrightText: Copyright (C) 2025 Opal Health Informatics Group at the Research Institute of the McGill University Health Centre <john.kildea@mcgill.ca> | ||
|
|
||
| SPDX-License-Identifier: Apache-2.0 | ||
| --> | ||
|
|
||
| # Custom Branding Images | ||
|
|
||
| Branding images specific to your organization can be added here to customize the app's look and feel. | ||
|
|
||
| See the [Branding Setup Guide](/docs/setup/branding.md) for instructions on linking these assets to the app's UI. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| // SPDX-FileCopyrightText: Copyright (C) 2025 Opal Health Informatics Group at the Research Institute of the McGill University Health Centre <john.kildea@mcgill.ca> | ||
| // | ||
| // SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| // For more information on this file, see `docs/setup/branding.md`. | ||
|
|
||
| (function () { | ||
| 'use strict'; | ||
|
|
||
| angular | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In GitLab by @AntonGladyr on Feb 4, 2025, 11:01 EST: Have you considered an option of adding a
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In GitLab by @staceybeard on Feb 5, 2025, 10:25 EST: I like the idea, I didn't think of that. I'll try it out and see how it goes. |
||
| .module('OpalApp') | ||
| .constant('Branding', { | ||
| // INIT PAGE | ||
| 'init-background': { | ||
| id: 'init-background', | ||
| src: 'img/branding/opal/init-background.jpg', | ||
| }, | ||
| 'init-logo': { | ||
| id: 'init-logo', | ||
| src: 'img/branding/opal/Opal_Name_Logo_Transparent.png', | ||
| }, | ||
| }); | ||
| })(); | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| // SPDX-FileCopyrightText: Copyright (C) 2025 Opal Health Informatics Group at the Research Institute of the McGill University Health Centre <john.kildea@mcgill.ca> | ||
| // | ||
| // SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| (function () { | ||
| 'use strict'; | ||
|
|
||
| angular | ||
| .module('OpalApp') | ||
| .filter('brandingId', BrandingId); | ||
|
|
||
| BrandingId.$inject = ['Branding']; | ||
|
|
||
| function BrandingId(Branding) { | ||
| return (keyword) => { | ||
| let id = Branding[keyword]?.id; | ||
| if (!id) throw `Branding id not configured for resource '${keyword}'`; | ||
| return id; | ||
| } | ||
| } | ||
| })(); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| // SPDX-FileCopyrightText: Copyright (C) 2025 Opal Health Informatics Group at the Research Institute of the McGill University Health Centre <john.kildea@mcgill.ca> | ||
| // | ||
| // SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| (function () { | ||
| 'use strict'; | ||
|
|
||
| angular | ||
| .module('OpalApp') | ||
| .filter('brandingSrc', BrandingSrc); | ||
|
|
||
| BrandingSrc.$inject = ['Branding']; | ||
|
|
||
| function BrandingSrc(Branding) { | ||
| return (keyword) => { | ||
| let src = Branding[keyword]?.src; | ||
| if (!src) throw `Branding source not configured for resource '${keyword}'`; | ||
| return src; | ||
| } | ||
| } | ||
| })(); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,18 +6,14 @@ | |
|
|
||
| <ons-page id="popoverLanguage" ng-controller="InitScreenController as init"> | ||
|
|
||
| <!-- NETWORK BANNER --> | ||
| <!-- Style the network banner to make it overlap the picture-logo --> | ||
|
Comment on lines
+9
to
+10
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In GitLab by @staceybeard on Feb 3, 2025, 15:28 EST: I know this strategy for getting the ids into the views is a bit redundant (could just hard-code them), but I wanted to make it clear that the ids are linked to the branding, so developers don't change them without realizing the impact. |
||
| <network-banner style="position:absolute; top:0; left:0; z-index:9999"></network-banner> | ||
|
|
||
| <!-- IMAGE HEADER --> | ||
| <div style="position: relative; height: 40%"> | ||
| <div style="z-index:2;width:100%" align="center"> | ||
| <!-- Style on network banner used to make it overlap the picture-logo instead of push it down. --> | ||
| <network-banner style="position:absolute; top:0; left:0; z-index:9999"></network-banner> | ||
| <div style="position: absolute; top: 50%;transform: translateY(-50%);" align="center"> | ||
| <img src="img/Opal_Name_Logo_Transparent.png" style="width:75%;height:auto"> | ||
| </div> | ||
| </div> | ||
| <div style="height: 100%"> | ||
| <img id="init-background" src="img/opal-init-photo.jpg" style="width: 100%; height: 100%; object-fit: cover"> | ||
| </div> | ||
| <div id="init-header"> | ||
| <img id="{{ 'init-logo' | brandingId }}" class="center-horizontal-vertical" ng-src="{{ 'init-logo' | brandingSrc }}"> | ||
| <img id="{{ 'init-background' | brandingId }}" ng-src="{{ 'init-background' | brandingSrc }}"> | ||
| </div> | ||
|
|
||
| <!-- LIST OF BUTTONS --> | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In GitLab by @staceybeard on Feb 4, 2025, 10:00 EST:
TODO: add copyright headers to new files
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In GitLab by @staceybeard on Feb 4, 2025, 10:38 EST:
Also update REUSE.toml (moved images).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In GitLab by @staceybeard on Mar 25, 2025, 11:00 EDT:
Done