Skip to content

Commit 8c70c73

Browse files
authored
Merge pull request #13 from JaneliaSciComp/t3-website-improvements
Ongoing T3 website improvements
2 parents 8f7be5e + 56c6396 commit 8c70c73

18 files changed

Lines changed: 471 additions & 320 deletions

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ __pycache__
1212
# Data
1313
data
1414
.zarrcade*
15+
static/ext
1516

1617
# Zarrcade databases
1718
*.db

docs/Configuration.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ All of the possible collection settings are listed below.
1818
* `static` - treat paths as relative to the `./static` folder
1919
* `absolute` - treat paths as absolute
2020
* `relative` - uses paths relative to the `data_url`
21-
`title_column_name`: The name of the column in the annotations table that contains the title of the image. This is used to display the title of the image in the image gallery and other places. It may contain HTML markup, such as colors and links.
21+
`title_column_name`: *(DEPRECATED: Use `title_template` instead)* The name of the column in the annotations table that contains the title of the image. This is used to display the title of the image in the image gallery and other places. It may contain HTML markup, such as colors and links.
22+
`title_template`: String template for building image titles. Can contain references to any column name using curly braces (e.g., `{column_name}`) and can include HTML markup such as `<font>` tags. For example: `<font color="red">{Line}</font> - {Marker}`. If both `title_template` and `title_column_name` are provided, `title_template` takes precedence.
2223
`filters`: A list of filters to apply to the images. Filters are used to select a subset of the images in the service. Each filter is a dictionary with the following keys:
2324
* `column_name`: The name of the column in the image annotation table.
2425
* `data_type`: The type of the data in the column. This can be `string` or `csv`. When `csv`, the filter will be a dropdown with one option per unique value in each CSV value. Default: `string`.

docs/Deployment.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ The following configuration options are available:
1010

1111
`collection`: Single collection mode. If this collection name is specified, the index page will redirect directly to this collection, and no other collection may be selected.
1212

13+
`header_left_logo_url`: URL or path to the logo image displayed on the left side of the header. Can be a relative path (e.g., `/static/logo.png`) or absolute URL. Default: `/static/zarrcade.png`
14+
15+
`header_right_logo_url`: URL or path to the logo image displayed on the right side of the header. Can be a relative path (e.g., `/static/logo.png`) or absolute URL. Default: `/static/white_janelia_logo.png`
16+
1317
`log_level`: The logging level to use for the Zarrcade service. This can be `DEBUG`, `INFO`, `WARNING`, `ERROR`, or `CRITICAL`. Default: `INFO`
1418

1519
`base_url`: The base URL for the Zarrcade service. This is used to generate URLs for the images and other resources in the service. It's required when using the build-in file proxy. Default: `http://127.0.0.1:8000/`
@@ -21,7 +25,10 @@ The following configuration options are available:
2125
Example `settings.yaml` file:
2226

2327
```yaml
24-
title: Zarrcade
28+
title: Zarrcade
29+
30+
header_left_logo_url: /static/zarrcade.png
31+
header_right_logo_url: /static/white_janelia_logo.png
2532

2633
log_level: INFO
2734

5.75 KB
Loading

static/functions.js

Lines changed: 42 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,49 @@
1+
// Dark mode functionality
2+
function initTheme() {
3+
const savedTheme = localStorage.getItem('theme');
4+
const systemPrefersDark = window.matchMedia('(prefers-color-scheme: dark)').matches;
5+
const theme = savedTheme || (systemPrefersDark ? 'dark' : 'light');
6+
7+
document.documentElement.setAttribute('data-theme', theme);
8+
const toggle = document.getElementById('theme-toggle');
9+
if (toggle) {
10+
toggle.checked = theme === 'dark';
11+
}
12+
}
13+
14+
function toggleTheme() {
15+
const currentTheme = document.documentElement.getAttribute('data-theme');
16+
const newTheme = currentTheme === 'dark' ? 'light' : 'dark';
17+
18+
document.documentElement.setAttribute('data-theme', newTheme);
19+
localStorage.setItem('theme', newTheme);
20+
}
21+
22+
// Listen for system theme changes
23+
window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', (e) => {
24+
if (!localStorage.getItem('theme')) {
25+
document.documentElement.setAttribute('data-theme', e.matches ? 'dark' : 'light');
26+
const toggle = document.getElementById('theme-toggle');
27+
if (toggle) {
28+
toggle.checked = e.matches;
29+
}
30+
}
31+
});
32+
33+
// Initialize theme on page load
34+
if (document.readyState === 'loading') {
35+
document.addEventListener('DOMContentLoaded', initTheme);
36+
} else {
37+
initTheme();
38+
}
39+
140
function showCopied(node) {
241
const copied = "Copied!"
3-
let tooltip = node.querySelector(".tooltiptext")
4-
let curr = tooltip.textContent
5-
tooltip.textContent = copied
42+
let curr = node.getAttribute("data-tooltip")
43+
node.setAttribute("data-tooltip", copied)
644
if (curr != copied) {
745
setTimeout(function() {
8-
tooltip.textContent = curr
46+
node.setAttribute("data-tooltip", curr)
947
}, 1000)
1048
}
1149
}

0 commit comments

Comments
 (0)