Skip to content
Snippets Groups Projects
Commit 9005e413 authored by Marius Dumitru Florea's avatar Marius Dumitru Florea
Browse files

XWIKI-17357: User Directory livetable cannot be customized anymore

* Overwrite the AjaxSaveAndContinue behavior only when the inplace editing is on.
* Trigger the xwiki:dom:updated after the preview is updated.
parent 2f142928
No related branches found
No related tags found
No related merge requests found
......@@ -598,8 +598,8 @@
// we can't use yet because it's not implemented on IE11 which we still have to support.
var actionButtonsWrapper = editContent.nextAll('.sticky-buttons-wrapper');
if (actionButtonsWrapper.length === 0) {
actionButtonsWrapper = $('<div class="sticky-buttons-wrapper col-xs-12"><div class="sticky-buttons"/></div>')
.insertAfter(editContent);
actionButtonsWrapper = $('<div class="sticky-buttons-wrapper col-xs-12">' +
'<div class="inplace-editing-buttons sticky-buttons"/></div>').insertAfter(editContent);
var actionButtons = actionButtonsWrapper.children('.sticky-buttons').data('xwikiDocument', xwikiDocument)
.toggle(!!xwikiDocument);
return loadActionButtons(actionButtons);
......@@ -733,7 +733,7 @@
// Override the EditActions.notify() function in order to pass a fake form in the event parameters.
var originalNotify = XWiki.actionButtons.EditActions.prototype.notify;
XWiki.actionButtons.EditActions.prototype.notify = function(originalEvent, action, params) {
if (params) {
if (params && $(originalEvent.element()).closest('.inplace-editing-buttons').length > 0) {
// actionButtons.js expects a form so we use a fake form. Refactoring actionButtons.js is too dangerous ATM.
// Note that we do this only when the event has parameters because we want to exclude the cancel event for which
// actionButtons.js changes the window location if a form is specified, and we want to prevent that.
......@@ -744,13 +744,22 @@
};
var overrideAjaxSaveAndContinue = function() {
var originalAjaxSaveAndContinue = $.extend({}, XWiki.actionButtons.AjaxSaveAndContinue.prototype);
$.extend(XWiki.actionButtons.AjaxSaveAndContinue.prototype, {
reloadEditor: function() {
$(document).trigger('xwiki:actions:reload');
if ($('.inplace-editing-buttons').is(':visible')) {
$(document).trigger('xwiki:actions:reload');
} else {
return originalAjaxSaveAndContinue.reloadEditor.apply(this, arguments);
}
},
maybeRedirect: function() {
// Never redirect when leaving the edit mode because we're already in view mode.
return false;
if ($('.inplace-editing-buttons').is(':visible')) {
// Never redirect when leaving the edit mode because we're already in view mode.
return false;
} else {
return originalAjaxSaveAndContinue.maybeRedirect.apply(this, arguments);
}
}
});
};
......
......@@ -469,6 +469,7 @@
$.get(url, data).done(function(html) {
var newLiveTableContainer = $('<div/>').html(html).find('.xwiki-livetable-container');
oldLiveTableContainer.replaceWith(newLiveTableContainer);
$(document).trigger('xwiki:dom:updated', {elements: newLiveTableContainer.toArray()});
});
});
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment