diff --git a/resource/js/docready.js b/resource/js/docready.js index 67cea9374..5d5df796c 100644 --- a/resource/js/docready.js +++ b/resource/js/docready.js @@ -275,7 +275,19 @@ $(function() { // DOCUMENT READY updateJsonLD(data); updateTitle(data); updateTopbarLang(data); - makeCallbacks(data); + // ajaxing the concept mapping properties on the concept page + var $conceptAppendix = $('.concept-appendix'); + if ($conceptAppendix.length) { + var concept = { + uri: $conceptAppendix.data('concept-uri'), + type: $conceptAppendix.data('concept-type') + }; + + // Defined in scripts.js. Will load the mapping properties via Ajax request to JSKOS REST service, and render them. + loadMappingProperties(concept, lang, $conceptAppendix, data); + } else { + makeCallbacks(data); + } // take the content language buttons from the response $('.header-float .dropdown-menu').empty().append($('.header-float .dropdown-menu', data).html()); } @@ -1097,7 +1109,7 @@ $(function() { // DOCUMENT READY }; // Defined in scripts.js. Will load the mapping properties via Ajax request to JSKOS REST service, and render them. - loadMappingProperties(concept, lang, $conceptAppendix); + loadMappingProperties(concept, lang, $conceptAppendix, null); } else { makeCallbacks(); } diff --git a/resource/js/scripts.js b/resource/js/scripts.js index eec0a6372..9f96160e9 100644 --- a/resource/js/scripts.js +++ b/resource/js/scripts.js @@ -366,9 +366,11 @@ function renderPropertyMappings(concept, contentLang, properties) { * template is comprised of another template, for concept mapping property values. * * @param concept dictionary/object populated with data from the Concept object - * @param htmlElement HTML (a div) parent object. Initially hidden. + * @param contentLang language to display content + * @param $htmlElement HTML (a div) parent object (initially hidden) + * @param conceptData concept page data returned via ajax, passed to makeCallback only */ -function loadMappingProperties(concept, contentLang, $htmlElement) { +function loadMappingProperties(concept, contentLang, $htmlElement, conceptData) { // display with the spinner $htmlElement .removeClass('hidden') @@ -422,7 +424,7 @@ function loadMappingProperties(concept, contentLang, $htmlElement) { console.log("Error retrieving mapping properties for [" + $htmlElement.data('concept-uri') + "]: " + data.responseText); }, complete: function() { - makeCallbacks(); + makeCallbacks(conceptData); } }); }