Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion docs/_includes/doi-template/tabs.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,16 @@
<section class="panel" id="panel-meta" role="tabpanel" aria-labelledby="tab-meta">
{% assign deprecated_items = page.deprecated_items | strip %}
<section class="schema-section">
<h3>Schema</h3>
<div class="schema-heading">
<h3>Schema</h3>
</div>
<div class="schema-type-legend" aria-label="Schema type legend">
<strong>Types:</strong>
<span><i class="fa-solid fa-font" aria-hidden="true"></i> Text field</span>
<span><i class="fa-solid fa-circle-nodes" aria-hidden="true"></i> Allowable value</span>
<span><i class="fa-solid fa-circle-dot" aria-hidden="true"></i> Radio</span>
<span><i class="fa-solid fa-hashtag" aria-hidden="true"></i> Numeric</span>
</div>
<div class="schema-wrap">
<div class="scroll">
<div class="markdown-content">{{ page.schema_items | strip | markdownify }}</div>
Expand Down
19 changes: 19 additions & 0 deletions docs/css/doi-template.css
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,25 @@ h1 {
margin-top: 22px;
}

.schema-heading {
display: block;
}

.schema-type-legend {
display: flex;
flex-wrap: wrap;
align-items: center;
gap: 5px 14px;
margin: 0 0 8px;
color: #4c566a;
font-size: 12px;
}

.schema-type-legend i {
width: 14px;
text-align: center;
}

.schema-section,
.deprecated-section {
margin-top: 0;
Expand Down
48 changes: 47 additions & 1 deletion docs/css/hm-code.css
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,13 @@ pre code {
max-width: 95% !important;
}

/* Keep assay names comfortably readable on the metadata index. */
.assay-metadata-index th:first-child,
.assay-metadata-index td:first-child {
width: 24%;
min-width: 13rem;
}

/* inline code badges inside table cells */
.altStyle .requiredNote {
font-size: 0.75rem;
Expand All @@ -47,6 +54,45 @@ pre code {
padding-bottom: 0;
}

.schema-type-legend {
width: fit-content;
margin: 0 0 0.65rem auto;
font-size: 0.75rem;
color: #444a65;
}

.schema-type-legend summary {
cursor: pointer;
font-weight: 600;
margin: 0;
padding: 0;
background: transparent;
color: #2a6fb8;
}

.schema-type-legend ul {
display: flex;
flex-wrap: wrap;
gap: 0.4rem 1rem;
margin: 0.45rem 0 0;
padding: 0.55rem 0.7rem;
list-style: none;
border: 1px solid #c4c8dc;
border-radius: 4px;
background: #f7f8fc;
}

.schema-type-legend li {
display: inline-flex;
align-items: center;
gap: 0.35rem;
}

.schema-type-legend .fa-solid {
width: 1rem;
text-align: center;
}

.altStyle table thead th {
background: linear-gradient(rgb(88, 94, 122), rgb(68, 74, 101)) !important;
color: #fff;
Expand Down Expand Up @@ -262,4 +308,4 @@ table.hmTable {
.c-header__main {
max-width: 87% !important;
}
}
}
41 changes: 41 additions & 0 deletions docs/js/alt-collapse.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,45 @@
return (text || '').replace(/\s+/g, ' ').trim();
}

function setupSchemaTypeLegend() {
var firstTable = document.querySelector('.altStyle table');
if (!firstTable || !firstTable.querySelector('td:nth-child(2) .fa-solid')) return;
if (document.querySelector('.schema-type-legend')) return;

var schemaTypes = [
{ icon: 'fa-font', label: 'Text field' },
{ icon: 'fa-hashtag', label: 'Numeric' },
{ icon: 'fa-circle-nodes', label: 'Allowable value' },
{ icon: 'fa-calendar', label: 'Date/time' },
{ icon: 'fa-circle-dot', label: 'Radio' }
];
var typesOnPage = schemaTypes.filter(function(type) {
return document.querySelector('.altStyle table td:nth-child(2) .' + type.icon);
});

var legend = document.createElement('details');
legend.className = 'schema-type-legend';

var summary = document.createElement('summary');
summary.textContent = 'Schema type legend';
legend.appendChild(summary);

var list = document.createElement('ul');
list.setAttribute('aria-label', 'Schema types');
typesOnPage.forEach(function(type) {
var item = document.createElement('li');
var icon = document.createElement('i');
icon.className = 'fa-solid ' + type.icon;
icon.setAttribute('aria-hidden', 'true');
item.appendChild(icon);
item.appendChild(document.createTextNode(type.label));
list.appendChild(item);
});
legend.appendChild(list);

firstTable.parentNode.insertBefore(legend, firstTable);
}

function getUsableCellWidth(cell, extraPx) {
var rect = cell.getBoundingClientRect();
var cs = window.getComputedStyle(cell);
Expand Down Expand Up @@ -360,6 +399,8 @@
return;
}

setupSchemaTypeLegend();

// Description: 3rd column (index 2) — hard clamp to 2 lines using text replacement + inline suffix
setupDescriptionInlineClamp();

Expand Down
Loading