publik.js: don't include any wcs if there is more than one (#7479)
This commit is contained in:
parent
f9819158f5
commit
a4211c2992
|
@ -38,25 +38,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 = $('<a>').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 = $('<li><a href="#">' + element.label + '</a></li>').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');
|
||||
|
@ -76,12 +64,25 @@ $(function() {
|
|||
$(document).trigger('publik:environment-loaded', {services: COMBO_KNOWN_SERVICES});
|
||||
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 = $('<a>').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,
|
||||
|
|
Loading…
Reference in New Issue