Skip to content

Commit 9fc47f9

Browse files
authored
Merge pull request #4 from MREYE-LUMC/crnh/mdr-message
Add MDR message
2 parents 2da38fe + 8900cfd commit 9fc47f9

File tree

8 files changed

+97
-3
lines changed

8 files changed

+97
-3
lines changed

LICENSE.txt

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2025 Jan-Willem Beenakker and the MReye research group
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@ Demos are built using [Shiny for Python](https://shiny.posit.co/py/) and embedde
1818
> ```powershell
1919
> winget install astral-sh.uv
2020
> ```
21+
> On Linux and MacOS, use
22+
>
23+
> ```bash
24+
> curl -LsSf https://astral.sh/uv/install.sh | sh
25+
> ```
2126
2227
1. Clone this repository or open it in a Codespace
2328
2. Install the dependencies:
@@ -32,13 +37,33 @@ Demos are built using [Shiny for Python](https://shiny.posit.co/py/) and embedde
3237
The preview will be updated automatically as you make changes.
3338
5. Push your changes. They will be automatically deployed to GitHub Pages.
3439
40+
## MDR message
41+
42+
Every demo must warn the user that these demos are not intended for medical use.
43+
To do this, add the following to the demo's frontmatter:
44+
45+
```markdown
46+
---
47+
# Other frontmatter
48+
49+
format:
50+
html:
51+
include-after-body: ../_includes/mdr-modal.html # Note: this path is relative to the demo's folder
52+
---
53+
```
54+
55+
3556
## Editable demos
3657

3758
URLs to demos that can be edited on <shinylive.io> are automatically generated when rendering the website.
3859
To enable this feature for a demo, add the following to the demo's frontmatter:
3960

40-
```yaml
61+
```markdown
62+
---
63+
# Other frontmatter
64+
4165
editable: true
66+
---
4267
```
4368

4469
This will create an additional html file named `edit.html` in the demo's folder.

_includes/mdr-modal.html

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<div class="modal fade" id="mdr-modal" data-bs-backdrop="static" data-bs-keyboard="false" tabindex="-1"
2+
aria-labelledby="mdr-modal-label" aria-hidden="true">
3+
<div class="modal-dialog modal-dialog-centered">
4+
<div class="modal-content">
5+
<div class="modal-header">
6+
<h5 class="modal-title fs-5" id="mdr-modal-label">Terms of Use</h5>
7+
</div>
8+
<div class="modal-body">
9+
<p>
10+
This app is intended solely for research or education and not for medical or clinical diagnostics.
11+
By using this app, you acknowledge that there is <strong>no</strong> warranty for this software and
12+
that you use it <strong>at your own risk</strong>.
13+
</p>
14+
<p>
15+
The full terms and conditions are available <a
16+
href="https://github.com/MREYE-LUMC/demos/blob/main/LICENSE.txt">here</a>.
17+
</p>
18+
</div>
19+
<div class="modal-footer">
20+
<button type="button" id="dismiss-mdr-modal" class="btn btn-primary" data-bs-dismiss="modal">I
21+
Agree</button>
22+
</div>
23+
</div>
24+
</div>
25+
</div>
26+
27+
<script src="/_includes/mdr.js" defer></script>

_includes/mdr.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
(function () {
2+
const sessionStorageKey = 'shown-mdr-modal-' + window.location.pathname;
3+
4+
document.addEventListener('DOMContentLoaded', function () {
5+
if (sessionStorage.getItem(sessionStorageKey) != 'true') {
6+
let mdrModal = new bootstrap.Modal(document.getElementById('mdr-modal'));
7+
mdrModal.show();
8+
}
9+
});
10+
11+
document.getElementById('dismiss-mdr-modal').addEventListener('click', function () {
12+
sessionStorage.setItem(sessionStorageKey, 'true');
13+
});
14+
})();

_quarto.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ project:
33
pre-render: python _scripts/generate-edit-url.py
44
resources:
55
- "edit.html"
6+
- "_includes/mdr.js"
67

78
website:
89
title: "MReye demos"

index.qmd

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
---
22
title: "MReye Demos"
3-
filters:
4-
- shinylive
53
---
64

75
Welcome to our demo website!

paros/index.qmd

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ filters:
44
- shinylive
55

66
editable: true
7+
8+
format:
9+
html:
10+
include-after-body: ../_includes/mdr-modal.html
711
---
812

913
This integration demonstrates how PAROS can be used to calculate the central magnification of a fundus image. More information can be found at our [GitHub repository](https://github.com/MREYE-LUMC/PAROS).

visisipy/index.qmd

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ filters:
44
- shinylive
55

66
editable: true
7+
8+
format:
9+
html:
10+
include-after-body: ../_includes/mdr-modal.html
711
---
812

913
This is a demonstration of [visisipy](https://visisipy.readthedocs.io), our Python library for visual optics simulations.

0 commit comments

Comments
 (0)