@@ -81,6 +81,13 @@ <h4>{% trans %}Assets{% endtrans %}</h4>
8181 </ div >
8282 </ div >
8383 < div class ="col-md-6 col-sm-12 ">
84+ {% if linked_data and linked_data.get('context') | length %}
85+ < div class ="text-end mb-2 ">
86+ < a href ="# " class ="btn btn-primary " id ="semantic-lookup-btn " data-target ="#item-properties-table ">
87+ {% trans %}Semantic lookup{% endtrans %}
88+ </ a >
89+ </ div >
90+ {% endif %}
8491 < table class ="table table-striped table-bordered object-table " id ="item-properties-table ">
8592 < thead >
8693 < tr >
@@ -139,19 +146,22 @@ <h4>{% trans %}Assets{% endtrans %}</h4>
139146 < script src ="
https://cdn.jsdelivr.net/npm/[email protected] /dist/rdflib.min.js "
> </ script > 140147 < script src ="https://github.com/avillar/jsonld-ui-utils/releases/latest/download/jsonld-ui-utils.min.js "> </ script >
141148 < script >
142- const rootElem = document . getElementById ( 'item-properties-table' ) ;
143- if ( rootElem ) {
144- const linkedDataConfig = { { linked_data | tojson } }
145- const options = { } ;
146- if ( linkedDataConfig . fallback_sparql_endpoint ) {
147- options . fallbackSparqlEndpoint = linkedDataConfig . fallback_sparql_endpoint ;
148- }
149- const context = { '@context' : linkedDataConfig [ 'context' ] } ;
150- jsonldUIUtils . loadContext ( context )
151- . then ( loadedContext => {
152- jsonldUIUtils . augment ( rootElem , loadedContext , options ) ;
153- } ) ;
154- }
149+ document . getElementById ( 'semantic-lookup-btn' ) . addEventListener ( 'click' , function ( e ) {
150+ e . target . style . display = 'none' ;
151+ var rootElem = document . getElementById ( 'item-properties-table' ) ;
152+ if ( rootElem ) {
153+ var linkedDataConfig = { { linked_data | tojson } }
154+ var options = { } ;
155+ if ( linkedDataConfig . fallback_sparql_endpoint ) {
156+ options . fallbackSparqlEndpoint = linkedDataConfig . fallback_sparql_endpoint ;
157+ }
158+ var context = { '@context' : linkedDataConfig [ 'context' ] } ;
159+ jsonldUIUtils . loadContext ( context )
160+ . then ( loadedContext => {
161+ jsonldUIUtils . augment ( rootElem , loadedContext , options ) ;
162+ } ) ;
163+ }
164+ } ) ;
155165 </ script >
156166 {% endif %}
157167{% endblock %}
0 commit comments