updated core from 8.4 to 8.5 : bug with login_destination

This commit is contained in:
Bachir Soussi Chiadmi
2018-03-13 14:01:21 +01:00
parent 0d78da249b
commit e668535a4e
3486 changed files with 89604 additions and 33283 deletions
@@ -92,13 +92,14 @@
const fieldModel = this.fieldModel;
// Generate a DOM-compatible ID for the form container DOM element.
const id = `quickedit-form-for-${fieldModel.id.replace(/[\/\[\]]/g, '_')}`;
const id = `quickedit-form-for-${fieldModel.id.replace(/[/[\]]/g, '_')}`;
// Render form container.
const $formContainer = this.$formContainer = $(Drupal.theme('quickeditFormContainer', {
const $formContainer = $(Drupal.theme('quickeditFormContainer', {
id,
loadingMsg: Drupal.t('Loading…'),
}));
this.$formContainer = $formContainer;
$formContainer
.find('.quickedit-form')
.addClass('quickedit-editable quickedit-highlighted quickedit-editing')
@@ -194,7 +195,7 @@
}
// Create an AJAX object for the form associated with the field.
var formSaveAjax = Drupal.quickedit.util.form.ajaxifySaving({
let formSaveAjax = Drupal.quickedit.util.form.ajaxifySaving({
nocssjs: false,
other_view_modes: fieldModel.findOtherViewModes(),
}, $submit);
@@ -57,12 +57,13 @@
loadForm: function loadForm() {
var fieldModel = this.fieldModel;
var id = 'quickedit-form-for-' + fieldModel.id.replace(/[\/\[\]]/g, '_');
var id = 'quickedit-form-for-' + fieldModel.id.replace(/[/[\]]/g, '_');
var $formContainer = this.$formContainer = $(Drupal.theme('quickeditFormContainer', {
var $formContainer = $(Drupal.theme('quickeditFormContainer', {
id: id,
loadingMsg: Drupal.t('Loading…')
}));
this.$formContainer = $formContainer;
$formContainer.find('.quickedit-form').addClass('quickedit-editable quickedit-highlighted quickedit-editing').attr('role', 'dialog');
if (this.$el.css('display') === 'inline') {
@@ -27,14 +27,9 @@
// Store the original value of this field. Necessary for reverting
// changes.
let $textElement;
const $fieldItems = this.$el.find('.quickedit-field');
if ($fieldItems.length) {
$textElement = this.$textElement = $fieldItems.eq(0);
}
else {
$textElement = this.$textElement = this.$el;
}
const $textElement = $fieldItems.length ? $fieldItems.eq(0) : this.$el;
this.$textElement = $textElement;
editorModel.set('originalValue', $.trim(this.$textElement.text()));
// Sets the state to 'changed' whenever the value changes.
@@ -15,13 +15,9 @@
var editorModel = this.model;
var fieldModel = this.fieldModel;
var $textElement = void 0;
var $fieldItems = this.$el.find('.quickedit-field');
if ($fieldItems.length) {
$textElement = this.$textElement = $fieldItems.eq(0);
} else {
$textElement = this.$textElement = this.$el;
}
var $textElement = $fieldItems.length ? $fieldItems.eq(0) : this.$el;
this.$textElement = $textElement;
editorModel.set('originalValue', $.trim(this.$textElement.text()));
var previousText = editorModel.get('originalValue');
@@ -189,9 +189,9 @@
this.set('isActive', true);
break;
case 'committing':
case 'committing': {
// The user indicated they want to save the entity.
var fields = this.get('fields');
const fields = this.get('fields');
// For fields that are in an active state, transition them to
// candidate.
fields.chain()
@@ -207,9 +207,10 @@
fieldModel.set('state', 'saving');
});
break;
}
case 'deactivating':
var changedFields = this.get('fields')
case 'deactivating': {
const changedFields = this.get('fields')
.filter(fieldModel => _.intersection([fieldModel.get('state')], ['changed', 'invalid']).length);
// If the entity contains unconfirmed or unsaved changes, return the
// entity to an opened state and ask the user if they would like to
@@ -250,6 +251,7 @@
});
}
break;
}
case 'closing':
// Set all fields to the 'inactive' state.
@@ -364,7 +366,7 @@
}
break;
case 'committing':
case 'committing': {
// If the field save returned a validation error, set the state of the
// entity back to 'opened'.
if (fieldState === 'invalid') {
@@ -380,7 +382,7 @@
// Attempt to save the entity. If the entity's fields are not yet all
// in a ready state, the save will not be processed.
var options = {
const options = {
'accept-field-states': Drupal.quickedit.app.readyFieldStates,
};
if (entityModel.set('isCommitting', true, options)) {
@@ -404,6 +406,7 @@
});
}
break;
}
case 'deactivating':
// When setting the entity to 'closing', require that all fieldModels
+69 -63
View File
@@ -69,48 +69,52 @@
break;
case 'committing':
var fields = this.get('fields');
{
var fields = this.get('fields');
fields.chain().filter(function (fieldModel) {
return _.intersection([fieldModel.get('state')], ['active']).length;
}).each(function (fieldModel) {
fieldModel.set('state', 'candidate');
});
fields.chain().filter(function (fieldModel) {
return _.intersection([fieldModel.get('state')], ['active']).length;
}).each(function (fieldModel) {
fieldModel.set('state', 'candidate');
});
fields.chain().filter(function (fieldModel) {
return _.intersection([fieldModel.get('state')], Drupal.quickedit.app.changedFieldStates).length;
}).each(function (fieldModel) {
fieldModel.set('state', 'saving');
});
break;
fields.chain().filter(function (fieldModel) {
return _.intersection([fieldModel.get('state')], Drupal.quickedit.app.changedFieldStates).length;
}).each(function (fieldModel) {
fieldModel.set('state', 'saving');
});
break;
}
case 'deactivating':
var changedFields = this.get('fields').filter(function (fieldModel) {
return _.intersection([fieldModel.get('state')], ['changed', 'invalid']).length;
});
if ((changedFields.length || this.get('fieldsInTempStore').length) && !options.saved && !options.confirmed) {
this.set('state', 'opened', { confirming: true });
_.defer(function () {
Drupal.quickedit.app.confirmEntityDeactivation(entityModel);
});
} else {
var invalidFields = this.get('fields').filter(function (fieldModel) {
return _.intersection([fieldModel.get('state')], ['invalid']).length;
{
var changedFields = this.get('fields').filter(function (fieldModel) {
return _.intersection([fieldModel.get('state')], ['changed', 'invalid']).length;
});
entityModel.set('reload', this.get('fieldsInTempStore').length || invalidFields.length);
if ((changedFields.length || this.get('fieldsInTempStore').length) && !options.saved && !options.confirmed) {
this.set('state', 'opened', { confirming: true });
entityModel.get('fields').each(function (fieldModel) {
if (_.intersection([fieldModel.get('state')], ['candidate', 'highlighted']).length) {
fieldModel.trigger('change:state', fieldModel, fieldModel.get('state'), options);
} else {
fieldModel.set('state', 'candidate', options);
}
});
_.defer(function () {
Drupal.quickedit.app.confirmEntityDeactivation(entityModel);
});
} else {
var invalidFields = this.get('fields').filter(function (fieldModel) {
return _.intersection([fieldModel.get('state')], ['invalid']).length;
});
entityModel.set('reload', this.get('fieldsInTempStore').length || invalidFields.length);
entityModel.get('fields').each(function (fieldModel) {
if (_.intersection([fieldModel.get('state')], ['candidate', 'highlighted']).length) {
fieldModel.trigger('change:state', fieldModel, fieldModel.get('state'), options);
} else {
fieldModel.set('state', 'candidate', options);
}
});
}
break;
}
break;
case 'closing':
options.reason = 'stop';
@@ -166,37 +170,39 @@
break;
case 'committing':
if (fieldState === 'invalid') {
_.defer(function () {
entityModel.set('state', 'opened', { reason: 'invalid' });
});
} else {
this._updateInTempStoreAttributes(entityModel, fieldModel);
{
if (fieldState === 'invalid') {
_.defer(function () {
entityModel.set('state', 'opened', { reason: 'invalid' });
});
} else {
this._updateInTempStoreAttributes(entityModel, fieldModel);
}
var options = {
'accept-field-states': Drupal.quickedit.app.readyFieldStates
};
if (entityModel.set('isCommitting', true, options)) {
entityModel.save({
success: function success() {
entityModel.set({
state: 'deactivating',
isCommitting: false
}, { saved: true });
},
error: function error() {
entityModel.set('isCommitting', false);
entityModel.set('state', 'opened', { reason: 'networkerror' });
var message = Drupal.t('Your changes to <q>@entity-title</q> could not be saved, either due to a website problem or a network connection problem.<br>Please try again.', { '@entity-title': entityModel.get('label') });
Drupal.quickedit.util.networkErrorModal(Drupal.t('Network problem!'), message);
}
});
}
break;
}
var options = {
'accept-field-states': Drupal.quickedit.app.readyFieldStates
};
if (entityModel.set('isCommitting', true, options)) {
entityModel.save({
success: function success() {
entityModel.set({
state: 'deactivating',
isCommitting: false
}, { saved: true });
},
error: function error() {
entityModel.set('isCommitting', false);
entityModel.set('state', 'opened', { reason: 'networkerror' });
var message = Drupal.t('Your changes to <q>@entity-title</q> could not be saved, either due to a website problem or a network connection problem.<br>Please try again.', { '@entity-title': entityModel.get('label') });
Drupal.quickedit.util.networkErrorModal(Drupal.t('Network problem!'), message);
}
});
}
break;
case 'deactivating':
_.defer(function () {
entityModel.set('state', 'closing', {
@@ -218,15 +218,8 @@
// different view mode).
.where({ logicalFieldID: currentField.get('logicalFieldID') })
.forEach((field) => {
// Ignore the current field.
if (field === currentField) {
}
// Also ignore other fields with the same view mode.
else if (field.get('fieldID') === currentField.get('fieldID')) {
}
else {
// Ignore the current field and other fields with the same view mode.
if (field !== currentField && field.get('fieldID') !== currentField.get('fieldID')) {
otherViewModes.push(field.getViewMode());
}
});
@@ -72,9 +72,9 @@
var currentField = this;
var otherViewModes = [];
Drupal.quickedit.collections.fields.where({ logicalFieldID: currentField.get('logicalFieldID') }).forEach(function (field) {
if (field === currentField) {} else if (field.get('fieldID') === currentField.get('fieldID')) {} else {
otherViewModes.push(field.getViewMode());
}
if (field !== currentField && field.get('fieldID') !== currentField.get('fieldID')) {
otherViewModes.push(field.getViewMode());
}
});
return otherViewModes;
}
+1 -1
View File
@@ -364,7 +364,7 @@
// If there are no elements returned from `entityElementSelector`
// throw an error. Check the browser console for this message.
if (!$entityElement.length) {
throw `Quick Edit could not associate the rendered entity field markup (with [data-quickedit-field-id="${fieldID}"]) with the corresponding rendered entity markup: no parent DOM node found with [data-quickedit-entity-id="${entityID}"]. This is typically caused by the theme's template for this entity type forgetting to print the attributes.`;
throw new Error(`Quick Edit could not associate the rendered entity field markup (with [data-quickedit-field-id="${fieldID}"]) with the corresponding rendered entity markup: no parent DOM node found with [data-quickedit-entity-id="${entityID}"]. This is typically caused by the theme's template for this entity type forgetting to print the attributes.`);
}
let entityElement = $(fieldElement).closest($entityElement);
+1 -1
View File
@@ -162,7 +162,7 @@
var $entityElement = $(entityElementSelector);
if (!$entityElement.length) {
throw 'Quick Edit could not associate the rendered entity field markup (with [data-quickedit-field-id="' + fieldID + '"]) with the corresponding rendered entity markup: no parent DOM node found with [data-quickedit-entity-id="' + entityID + '"]. This is typically caused by the theme\'s template for this entity type forgetting to print the attributes.';
throw new Error('Quick Edit could not associate the rendered entity field markup (with [data-quickedit-field-id="' + fieldID + '"]) with the corresponding rendered entity markup: no parent DOM node found with [data-quickedit-entity-id="' + entityID + '"]. This is typically caused by the theme\'s template for this entity type forgetting to print the attributes.');
}
var entityElement = $(fieldElement).closest($entityElement);
+4 -8
View File
@@ -144,14 +144,10 @@
// Attributes.
const attributes = [];
const attrMap = settings.buttons[i].attributes || {};
for (const attr in attrMap) {
if (attrMap.hasOwnProperty(attr)) {
attributes.push(attr + ((attrMap[attr]) ? `="${attrMap[attr]}"` : ''));
}
}
html += `<button type="${button.type}" class="${button.classes}"` + ` ${attributes.join(' ')}>`;
html += button.label;
html += '</button>';
Object.keys(attrMap).forEach((attr) => {
attributes.push(attr + ((attrMap[attr]) ? `="${attrMap[attr]}"` : ''));
});
html += `<button type="${button.type}" class="${button.classes}" ${attributes.join(' ')}>${button.label}</button>`;
}
return html;
};
+10 -9
View File
@@ -53,7 +53,8 @@
Drupal.theme.quickeditButtons = function (settings) {
var html = '';
for (var i = 0; i < settings.buttons.length; i++) {
var _loop = function _loop(i) {
var button = settings.buttons[i];
if (!button.hasOwnProperty('type')) {
button.type = 'button';
@@ -61,14 +62,14 @@
var attributes = [];
var attrMap = settings.buttons[i].attributes || {};
for (var attr in attrMap) {
if (attrMap.hasOwnProperty(attr)) {
attributes.push(attr + (attrMap[attr] ? '="' + attrMap[attr] + '"' : ''));
}
}
html += '<button type="' + button.type + '" class="' + button.classes + '"' + (' ' + attributes.join(' ') + '>');
html += button.label;
html += '</button>';
Object.keys(attrMap).forEach(function (attr) {
attributes.push(attr + (attrMap[attr] ? '="' + attrMap[attr] + '"' : ''));
});
html += '<button type="' + button.type + '" class="' + button.classes + '" ' + attributes.join(' ') + '>' + button.label + '</button>';
};
for (var i = 0; i < settings.buttons.length; i++) {
_loop(i);
}
return html;
};
+4 -4
View File
@@ -58,7 +58,7 @@
*/
Drupal.quickedit.util.networkErrorModal = function (title, message) {
const $message = $(`<div>${message}</div>`);
var networkErrorModal = Drupal.dialog($message.get(0), {
const networkErrorModal = Drupal.dialog($message.get(0), {
title,
dialogClass: 'quickedit-network-error',
buttons: [
@@ -181,11 +181,11 @@
* The HTTP status code.
*/
success(response, status) {
for (const i in response) {
if (response.hasOwnProperty(i) && response[i].command && this.commands[response[i].command]) {
Object.keys(response || {}).forEach((i) => {
if (response[i].command && this.commands[response[i].command]) {
this.commands[response[i].command](this, response[i], status);
}
}
});
},
base: $submit.attr('id'),
element: $submit[0],
+6 -4
View File
@@ -85,11 +85,13 @@
},
success: function success(response, status) {
for (var i in response) {
if (response.hasOwnProperty(i) && response[i].command && this.commands[response[i].command]) {
this.commands[response[i].command](this, response[i], status);
var _this = this;
Object.keys(response || {}).forEach(function (i) {
if (response[i].command && _this.commands[response[i].command]) {
_this.commands[response[i].command](_this, response[i], status);
}
}
});
},
base: $submit.attr('id'),
@@ -231,11 +231,9 @@
if (context && context.reason === 'mouseleave') {
accept = false;
}
else {
// Check whether the transition has been confirmed?
if (context && context.confirmed) {
accept = true;
}
// Check whether the transition has been confirmed?
else if (context && context.confirmed) {
accept = true;
}
}
}
+1 -3
View File
@@ -121,11 +121,9 @@
} else if ((from === 'changed' || from === 'invalid') && to === 'candidate') {
if (context && context.reason === 'mouseleave') {
accept = false;
} else {
if (context && context.confirmed) {
} else if (context && context.confirmed) {
accept = true;
}
}
}
}
}
@@ -118,13 +118,13 @@
// visible yet.
break;
case 'activating':
case 'activating': {
// The user has indicated he wants to do in-place editing: if
// something needs to be loaded (CSS/JavaScript/server data/…), then
// do so at this stage, and once the in-place editor is ready,
// set the 'active' state. A "loading" indicator will be shown in the
// UI for as long as the field remains in this state.
var loadDependencies = function (callback) {
const loadDependencies = function (callback) {
// Do the loading here.
callback();
};
@@ -132,6 +132,7 @@
fieldModel.set('state', 'active');
});
break;
}
case 'active':
// The user can now actually use the in-place editor.
@@ -184,7 +185,7 @@
save() {
const fieldModel = this.fieldModel;
const editorModel = this.model;
const backstageId = `quickedit_backstage-${this.fieldModel.id.replace(/[\/\[\]\_\s]/g, '-')}`;
const backstageId = `quickedit_backstage-${this.fieldModel.id.replace(/[/[\]_\s]/g, '-')}`;
function fillAndSubmitForm(value) {
const $form = $(`#${backstageId}`).find('form');
+10 -8
View File
@@ -38,13 +38,15 @@
break;
case 'activating':
var loadDependencies = function loadDependencies(callback) {
callback();
};
loadDependencies(function () {
fieldModel.set('state', 'active');
});
break;
{
var loadDependencies = function loadDependencies(callback) {
callback();
};
loadDependencies(function () {
fieldModel.set('state', 'active');
});
break;
}
case 'active':
break;
@@ -71,7 +73,7 @@
save: function save() {
var fieldModel = this.fieldModel;
var editorModel = this.model;
var backstageId = 'quickedit_backstage-' + this.fieldModel.id.replace(/[\/\[\]\_\s]/g, '-');
var backstageId = 'quickedit_backstage-' + this.fieldModel.id.replace(/[/[\]_\s]/g, '-');
function fillAndSubmitForm(value) {
var $form = $('#' + backstageId).find('form');
@@ -230,10 +230,10 @@
delay = 250;
break;
default:
var fieldModels = this.model.get('fields').models;
var topMostPosition = 1000000;
var topMostField = null;
default: {
const fieldModels = this.model.get('fields').models;
let topMostPosition = 1000000;
let topMostField = null;
// Position against the topmost field.
for (let i = 0; i < fieldModels.length; i++) {
const pos = fieldModels[i].get('el').getBoundingClientRect().top;
@@ -245,6 +245,7 @@
of = topMostField.get('el');
delay = 50;
break;
}
}
// Prepare to check the next possible element to position against.
check++;
@@ -295,7 +296,7 @@
suggested.top = fenceTop;
}
else if ((suggested.top + toolbarHeight) > (fenceTop + fenceHeight)) {
suggested.top = fenceTop + fenceHeight - toolbarHeight;
suggested.top = (fenceTop + fenceHeight) - toolbarHeight;
}
// Position the toolbar.
info.element.element.css({
@@ -142,20 +142,22 @@
break;
default:
var fieldModels = this.model.get('fields').models;
var topMostPosition = 1000000;
var topMostField = null;
{
var fieldModels = this.model.get('fields').models;
var topMostPosition = 1000000;
var topMostField = null;
for (var i = 0; i < fieldModels.length; i++) {
var pos = fieldModels[i].get('el').getBoundingClientRect().top;
if (pos < topMostPosition) {
topMostPosition = pos;
topMostField = fieldModels[i];
for (var i = 0; i < fieldModels.length; i++) {
var pos = fieldModels[i].get('el').getBoundingClientRect().top;
if (pos < topMostPosition) {
topMostPosition = pos;
topMostField = fieldModels[i];
}
}
of = topMostField.get('el');
delay = 50;
break;
}
of = topMostField.get('el');
delay = 50;
break;
}
check++;
@@ -47,7 +47,7 @@
this.$root = this.$el;
// Generate a DOM-compatible ID for the form container DOM element.
this._id = `quickedit-toolbar-for-${this.model.id.replace(/[\/\[\]]/g, '_')}`;
this._id = `quickedit-toolbar-for-${this.model.id.replace(/[/[\]]/g, '_')}`;
this.listenTo(this.model, 'change:state', this.stateChange);
},
@@ -19,7 +19,7 @@
this.$root = this.$el;
this._id = 'quickedit-toolbar-for-' + this.model.id.replace(/[\/\[\]]/g, '_');
this._id = 'quickedit-toolbar-for-' + this.model.id.replace(/[/[\]]/g, '_');
this.listenTo(this.model, 'change:state', this.stateChange);
},