Skip to content

Commit 2609ed2

Browse files
committed
Cleanup of popup Reference Guide HTML
1 parent 0a9b96c commit 2609ed2

File tree

2 files changed

+40
-42
lines changed

2 files changed

+40
-42
lines changed

lib/DataHarmonizer.js

+39-41
Original file line numberDiff line numberDiff line change
@@ -1106,7 +1106,7 @@ class DataHarmonizer {
11061106
let row_html = '';
11071107
for (const section of this.sections) {
11081108
row_html += `<tr class="section">
1109-
<td colspan="${this.columnHelpEntries.length}"><h3>${
1109+
<td colspan="${this.columnHelpEntries.length-1}"><h3>${
11101110
section.title || section.name
11111111
}</h3></td>
11121112
</tr>
@@ -1118,7 +1118,7 @@ class DataHarmonizer {
11181118

11191119
row_html += '<tr>';
11201120
if (this.columnHelpEntries.includes('column')) {
1121-
row_html += `<td class="label">${slot_dict.title}<br/>${slot_uri}</td>`;
1121+
row_html += `<td class="label">${slot_dict.title}<br>${slot_uri}</td>`;
11221122
}
11231123
if (this.columnHelpEntries.includes('description')) {
11241124
row_html += `<td>${slot_dict.description}</td>`;
@@ -1143,7 +1143,7 @@ class DataHarmonizer {
11431143
let title = enumeration.title != enumeration.name ? enumeration.title : '';
11441144
enum_html += `<tr class="section">
11451145
<td colspan="2" id="${enumeration.name}">${enumeration.name}</td>
1146-
<td colspan="2">(${title})<br/>${this.renderSemanticID(enumeration.enum_uri)}</td>
1146+
<td colspan="2" style="font-size:1.2rem;">"${title}"<br>${this.renderSemanticID(enumeration.enum_uri)}</td>
11471147
</tr>`;
11481148

11491149
for (const item_key in enumeration.permissible_values) {
@@ -1158,33 +1158,34 @@ class DataHarmonizer {
11581158
}
11591159
}
11601160

1161-
11621161
var win = window.open(
11631162
'',
11641163
'Reference',
1165-
'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=1000,height=600'
1164+
'toolbar=no,location=yes,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=1000,height=600'
11661165
);
11671166

1168-
win.document.head.innerHTML = `
1169-
<meta charset="utf-8">
1170-
<title>${i18next.t('reference_guide_title')} "${
1167+
win.document.open(); // For reloads
1168+
win.document.write(`<!DOCTYPE html>
1169+
<html lang="en">
1170+
<head>
1171+
<meta charset="utf-8">
1172+
<title>${i18next.t('reference_guide_title')} "${
11711173
schema_template.title || schema_template.name
11721174
}" template</title>
1173-
<meta name="description" content="${schema_template.description || ''}">
1174-
<style>${style}</style>
1175-
`;
1176-
1177-
win.document.body.innerHTML = `
1178-
<div>
1175+
<meta name="description" content="${schema_template.description || ''}">
1176+
<style>${style}</style>
1177+
</head>
1178+
<body>
1179+
<div>
11791180
<h2>${i18next.t('reference_guide_title')} "${
11801181
schema_template.title || schema_template.name
11811182
}" template</h2>
1182-
<hr size="2"/>
1183+
<hr/>
11831184
<p>${schema_template.description || ''}</p>
11841185
11851186
<table>
1186-
<thead>
1187-
<tr>
1187+
<thead>
1188+
<tr>
11881189
${
11891190
this.columnHelpEntries.includes('column')
11901191
? `<th class="label">${i18next.t('help-sidebar__column')}</th>`
@@ -1212,28 +1213,25 @@ class DataHarmonizer {
12121213
? `<th class="data_status">${i18next.t('help-sidebar__menus')}</th>`
12131214
: ''
12141215
}
1215-
</tr>
1216-
</thead>
1217-
<tbody>
1218-
${row_html}
1219-
</tbody>
1220-
</table>
1216+
</tr>
1217+
</thead>
1218+
<tbody>
1219+
${row_html}
1220+
</tbody>
1221+
</table>
12211222
</div>
1222-
1223-
<div>
1224-
<table>
1225-
<thead>
1226-
<tr class="section">
1227-
<td colspan="4"><h3>${i18next.t('help-picklists')}</h3>
1228-
</td>
1229-
</tr>
1230-
</thead>
1231-
<tbody>${enum_html}</tbody>
1232-
</table>
1233-
</div>
1234-
</body>
1235-
</html>
1236-
`;
1223+
<div>
1224+
<table>
1225+
<thead>
1226+
<tr class="section">
1227+
<th colspan="4">${i18next.t('help-picklists')}</th>
1228+
</tr>
1229+
</thead>
1230+
<tbody>${enum_html}</tbody>
1231+
</table>
1232+
</div>
1233+
</body>
1234+
</html>`);
12371235
return false;
12381236
}
12391237

@@ -1518,8 +1516,8 @@ class DataHarmonizer {
15181516
// Close current dialog and switch to error message
15191517
//$('specify-headers-modal').modal('hide');
15201518
//$('#unmapped-headers-modal').modal('hide');
1521-
const errMsg = `The template for the loaded file has a configuration error:<br/>
1522-
<strong>${parent.title}</strong><br/>
1519+
const errMsg = `The template for the loaded file has a configuration error:<br>
1520+
<strong>${parent.title}</strong><br>
15231521
This is a field that has no parent, or a section that has no fields.`;
15241522
$('#unmapped-headers-list').html(errMsg);
15251523
$('#unmapped-headers-modal').modal('show');
@@ -2030,7 +2028,7 @@ class DataHarmonizer {
20302028
if (field.sources && field.sources.length) {
20312029
let menus = [];
20322030
for (const item of field.sources) {
2033-
menus.push('<a href="#'+ item + '" target="_self">' + item +'</a>');
2031+
menus.push('<a href="#'+ item + '" target="Reference">' + item +'</a>');
20342032
}
20352033
guide.menus = '<ul><li>' + menus.join('</li><li>') + '</li></ul>';
20362034
/*

lib/toolbar.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@
181181
>
182182
<a
183183
class="dropdown-item"
184-
target="_blank"
184+
target="Reference"
185185
href=""
186186
id="help_reference"
187187
data-i18n="help_reference"

0 commit comments

Comments
 (0)