Skip to content

Commit

Permalink
Comment out logic for handling Supra-polities with multiple Seshat ID…
Browse files Browse the repository at this point in the history
…s in map functions and world map template
  • Loading branch information
edwardchalstrey1 committed Jan 22, 2025
1 parent 2d0c9d6 commit d687448
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 34 deletions.
26 changes: 15 additions & 11 deletions seshat/apps/core/static/core/js/map_functions.js
Original file line number Diff line number Diff line change
Expand Up @@ -379,17 +379,21 @@ function updateLegend() {
if (shape.seshat_id in seshat_id_page_id) {
var polityId = seshat_id_page_id[shape.seshat_id]['id'];
shape_name_col_dict['link'] = '<a href="/core/polity/' + polityId + '" target="_blank">' + shape.name + '</a>';
} else if (shape.seshat_id.includes(';')) {
var polityIds = shape.seshat_id.split(';');
var polityLinks = [];
polityIds.forEach(function (polityId) {
if (polityId in seshat_id_page_id) {
polityLinks.push('<a href="/core/polity/' + seshat_id_page_id
[polityId]['id'] + '" target="_blank">' + polityId + '</a>');
}
}
);
shape_name_col_dict['link'] = shape.name + '; ' + polityLinks.join('; ');

// This code is commented out because Supra-polities from the Cliopatria GeoJSON with multiple Seshat IDs are not currently being loaded into the database

// } else if (shape.seshat_id.includes(';')) {
// var polityIds = shape.seshat_id.split(';');
// var polityLinks = [];
// polityIds.forEach(function (polityId) {
// if (polityId in seshat_id_page_id) {
// polityLinks.push('<a href="/core/polity/' + seshat_id_page_id
// [polityId]['id'] + '" target="_blank">' + polityId + '</a>');
// }
// }
// );
// shape_name_col_dict['link'] = shape.name + '; ' + polityLinks.join('; ');

} else {
shape_name_col_dict['link'] = shape.name;
}
Expand Down
50 changes: 27 additions & 23 deletions seshat/apps/core/templates/core/world_map.html
Original file line number Diff line number Diff line change
Expand Up @@ -1090,31 +1090,35 @@ <h2>🎉 Welcome to the Seshat World Map! 🎉</h2>
</tr>
`;
}
} else if (shape.seshat_id.includes(';')) {
var polityIds = shape.seshat_id.split(';');
var polityLinks = '';
for (var i = 0; i < polityIds.length; i++) {
if (polityIds[i] in seshat_id_page_id) {
var polityId = seshat_id_page_id[polityIds[i]]['id'];
longName = seshat_id_page_id[polityIds[i]]['long_name'];
if (longName == '') {
longName = '[Page empty]'
}
if (selectedMap == 'cesium') {
polityLinks = polityLinks + `${longName} (${polityIds[i]})<br>`;
} else {
polityLinks = polityLinks + `<a href="/core/polity/${polityId}" target="_blank">${longName} (${polityIds[i]})</a><br>`;
}
}
}
popupContent = popupContent + `
<tr>
<td>Seshat pages</td>
<td>${polityLinks}</td>
</tr>
`;
}

// This code is commented out because Supra-polities from the Cliopatria GeoJSON with multiple Seshat IDs are not currently being loaded into the database

// } else if (shape.seshat_id.includes(';')) {
// var polityIds = shape.seshat_id.split(';');
// var polityLinks = '';
// for (var i = 0; i < polityIds.length; i++) {
// if (polityIds[i] in seshat_id_page_id) {
// var polityId = seshat_id_page_id[polityIds[i]]['id'];
// longName = seshat_id_page_id[polityIds[i]]['long_name'];
// if (longName == '') {
// longName = '[Page empty]'
// }
// if (selectedMap == 'cesium') {
// polityLinks = polityLinks + `${longName} (${polityIds[i]})<br>`;
// } else {
// polityLinks = polityLinks + `<a href="/core/polity/${polityId}" target="_blank">${longName} (${polityIds[i]})</a><br>`;
// }
// }
// }
// popupContent = popupContent + `
// <tr>
// <td>Seshat pages</td>
// <td>${polityLinks}</td>
// </tr>
// `;
// }

let wiki_page = 'https://en.wikipedia.org/wiki/' + shape.wikipedia_name.replace(/ /g, '_');
popupContent = popupContent + `
<tr>
Expand Down

0 comments on commit d687448

Please sign in to comment.