diff --git a/apis_ontology/static/scripts/show_popup.js b/apis_ontology/static/scripts/show_popup.js
new file mode 100644
index 0000000..ff63d4e
--- /dev/null
+++ b/apis_ontology/static/scripts/show_popup.js
@@ -0,0 +1,17 @@
+function showPopup(recordId, renderStyle) {
+ renderStyle = "tei";
+ fetch(`/apis/excerpts/${recordId}/${renderStyle}`)
+ .then(response => response.text())
+ .then(data => {
+ // Display the data in the popup
+ document.getElementById('popupContent').innerHTML = data;
+ document.getElementById('popupModal').style.display = 'block';
+ })
+ .catch(error => {
+ console.error('Error fetching dynamic content:', error);
+ });
+}
+
+function closePopup() {
+ document.getElementById('popupModal').style.display = 'none';
+}
diff --git a/apis_ontology/tables.py b/apis_ontology/tables.py
index 1f76c5a..f2da236 100644
--- a/apis_ontology/tables.py
+++ b/apis_ontology/tables.py
@@ -153,22 +153,8 @@ def render_tei_refs(self, value):
links = []
for xml_id in xml_ids:
true_id = xml_id.replace('"', "").replace("xml:id=", "").strip()
- excerpt_xml = "" # Fallback blank excerpt
- try:
- excerpt_xml = Excerpts.objects.get(xml_id=true_id).xml_content
-
- except Excerpts.DoesNotExist:
- logger.error(
- "Could not find excerpt with id %s in the database.", true_id
- )
- except Exception as e:
- logger.error(repr(e))
- encoded_excerpt_xml = escape(
- excerpt_xml.replace("'", "\\'").replace("\n", "")
- )
- # Append the link with the onclick event
links.append(
- f'{true_id}'
+ f"""{true_id}"""
)
return mark_safe("
".join(links))
diff --git a/apis_ontology/templates/apis_core/apis_entities/abstractentity_detail.html b/apis_ontology/templates/apis_core/apis_entities/abstractentity_detail.html
index 891171a..eb9a585 100644
--- a/apis_ontology/templates/apis_core/apis_entities/abstractentity_detail.html
+++ b/apis_ontology/templates/apis_core/apis_entities/abstractentity_detail.html
@@ -11,6 +11,8 @@
{% endblock col-zero %}
{% block col-one %}
+{% include "excerpts/popup.html" %}
+