diff --git a/data/themes/gadjo/static/js/publik.js b/data/themes/gadjo/static/js/publik.js index 49de4bac..474d1cee 100644 --- a/data/themes/gadjo/static/js/publik.js +++ b/data/themes/gadjo/static/js/publik.js @@ -26,25 +26,13 @@ $(function() { if (service.data === undefined || service.data.length == 0) { return; } - if (service.service_id == 'wcs' && service.uniq === false) { - /* as wcs comes with many menu entries, if it's not the only instance - * in the environment, we only insert all the items if it's the - * currently active site. - */ - var that_hostname = $('').attr('href', service.backoffice_menu_url)[0].hostname; - var this_hostname = window.location.hostname; - if (that_hostname != this_hostname) { - more_entries.push({ - title: service.title, - url: service.data[0].url}); - return; - } - } $(service.data).each(function(idx, element) { var li = $('
  • ' + element.label + '
  • ').appendTo(menu_links); $(li).find('a').attr('href', element.url); if (element.icon !== undefined) { $(li).find('a').addClass('icon-' + element.icon); + } else if (element.slug !== undefined) { + $(li).find('a').addClass('icon-' + element.slug); } if (window.location.href.indexOf(element.url) == 0) { $(li).addClass('active'); @@ -63,12 +51,25 @@ $(function() { COMBO_KNOWN_SERVICES = JSON.parse(window.sessionStorage.hobo_environment); create_menu_items(); } else { + var this_hostname = window.location.hostname; $(COMBO_KNOWN_SERVICES).each(function(index, element) { if (element.backoffice_menu_url === null) { element.data = Array(); check_all_done(); return; } + if (element.service_id === 'wcs' && element.uniq === false) { + /* as wcs comes with many menu entries, if it's not the only instance + * in the environment, we simply skip it if it's not the active site. + */ + var that_hostname = $('').attr('href', element.backoffice_menu_url)[0].hostname; + if (that_hostname != this_hostname) { + element.data = Array(); + check_all_done(); + return; + } + } + $.ajax({url: element.backoffice_menu_url, xhrFields: { withCredentials: true }, async: true,