mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-01 13:48:37 +02:00
BUGFIX Replaced logic for checking external URLs in CMS Menu with more stable jQuery Mobile codebase (fixes problems on IE not loading menu entries via ajax) (#7002)
This commit is contained in:
parent
58433d38ce
commit
c518a19ec2
@ -159,10 +159,10 @@
|
|||||||
self.submitForm_responseHandler(form, xmlhttp.responseText, status, xmlhttp, formData);
|
self.submitForm_responseHandler(form, xmlhttp.responseText, status, xmlhttp, formData);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Simulates a redirect on an ajax response - just exchange the URL without re-requesting it
|
// Simulates a redirect on an ajax response - just exchange the URL without re-requesting it.
|
||||||
if(window.History.enabled) {
|
if(window.History.enabled) {
|
||||||
var url = xmlhttp.getResponseHeader('X-ControllerURL');
|
var url = xmlhttp.getResponseHeader('X-ControllerURL');
|
||||||
if(url) window.history.replaceState({}, '', url);
|
if(url) window.History.replaceState({}, '', url);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Re-init tabs (in case the form tag itself is a tabset)
|
// Re-init tabs (in case the form tag itself is a tabset)
|
||||||
@ -287,7 +287,7 @@
|
|||||||
var url = $(node).find('a:first').attr('href');
|
var url = $(node).find('a:first').attr('href');
|
||||||
if(url && url != '#') {
|
if(url && url != '#') {
|
||||||
|
|
||||||
if($(node).find('a:first').is(':internal')) url = url = $.path.makeUrlAbsolute(url, $('base').attr('href'));
|
if($.path.isExternal($(node).find('a:first'))) url = url = $.path.makeUrlAbsolute(url, $('base').attr('href'));
|
||||||
// Reload only edit form if it exists (side-by-side view of tree and edit view), otherwise reload whole panel
|
// Reload only edit form if it exists (side-by-side view of tree and edit view), otherwise reload whole panel
|
||||||
if(container.find('.cms-edit-form').length) {
|
if(container.find('.cms-edit-form').length) {
|
||||||
url += '?cms-view-form=1';
|
url += '?cms-view-form=1';
|
||||||
|
@ -207,16 +207,16 @@
|
|||||||
onclick: function(e) {
|
onclick: function(e) {
|
||||||
// Only catch left clicks, in order to allow opening in tabs.
|
// Only catch left clicks, in order to allow opening in tabs.
|
||||||
// Ignore external links, fallback to standard link behaviour
|
// Ignore external links, fallback to standard link behaviour
|
||||||
if(e.which > 1 || this.is(':external')) return;
|
var isExternal = $.path.isExternal(this.attr('href'));
|
||||||
|
if(e.which > 1 || isExternal) return;
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
var item = this.getMenuItem();
|
var item = this.getMenuItem();
|
||||||
|
|
||||||
var url = this.attr('href');
|
var url = this.attr('href');
|
||||||
if(this.is(':internal')) url = $('base').attr('href') + url;
|
if(!isExternal) url = $('base').attr('href') + url;
|
||||||
|
|
||||||
var children = item.find('li');
|
var children = item.find('li');
|
||||||
|
|
||||||
if(children.length) {
|
if(children.length) {
|
||||||
children.first().find('a').click();
|
children.first().find('a').click();
|
||||||
} else {
|
} else {
|
||||||
@ -261,8 +261,4 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// Internal Helper
|
|
||||||
$.expr[':'].internal = function(obj){return obj.href.match(/^mailto\:/) || (obj.hostname == location.hostname);};
|
|
||||||
$.expr[':'].external = function(obj){return !$(obj).is(':internal');};
|
|
||||||
}(jQuery));
|
}(jQuery));
|
@ -232,8 +232,4 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
$.path = path;
|
$.path = path;
|
||||||
|
|
||||||
// Internal Helper
|
|
||||||
$.expr[':'].internal = function(obj){return obj.href.match(/^mailto\:/) || (obj.hostname == location.hostname);};
|
|
||||||
$.expr[':'].external = function(obj){return !$(obj).is(':internal')};
|
|
||||||
}(jQuery));
|
}(jQuery));
|
Loading…
Reference in New Issue
Block a user