Update to Drupal 8.0.0 beta 14. For more information, see https://drupal.org/node/2544542
This commit is contained in:
parent
3b2511d96d
commit
81ccda77eb
2155 changed files with 54307 additions and 46870 deletions
|
@ -79,7 +79,8 @@
|
|||
// asynchronously.
|
||||
Drupal.toolbar.setSubtrees.done(function (subtrees) {
|
||||
menuModel.set('subtrees', subtrees);
|
||||
localStorage.setItem('Drupal.toolbar.subtrees', JSON.stringify(subtrees));
|
||||
var theme = drupalSettings.ajaxPageState.theme;
|
||||
localStorage.setItem('Drupal.toolbar.subtrees.' + theme, JSON.stringify(subtrees));
|
||||
// Indicate on the toolbarModel that subtrees are now loaded.
|
||||
model.set('areSubtreesLoaded', true);
|
||||
});
|
||||
|
@ -233,4 +234,15 @@
|
|||
'</div></div>';
|
||||
};
|
||||
|
||||
/**
|
||||
* Ajax command to set the toolbar subtrees.
|
||||
*
|
||||
* @param {Drupal.Ajax} ajax
|
||||
* @param {object} response
|
||||
* @param {number} [status]
|
||||
*/
|
||||
Drupal.AjaxCommands.prototype.setToolbarSubtrees = function (ajax, response, status) {
|
||||
Drupal.toolbar.setSubtrees.resolve(response.subtrees);
|
||||
};
|
||||
|
||||
}(jQuery, Drupal, drupalSettings));
|
||||
|
|
|
@ -249,7 +249,8 @@
|
|||
},
|
||||
|
||||
/**
|
||||
* Calls the endpoint URI that will return rendered subtrees with JSONP.
|
||||
* Calls the endpoint URI that builds an AJAX command with the rendered
|
||||
* subtrees.
|
||||
*
|
||||
* The rendered admin menu subtrees HTML is cached on the client in
|
||||
* localStorage until the cache of the admin menu subtrees on the server-
|
||||
|
@ -267,10 +268,10 @@
|
|||
// (3) The orientation of the tray is vertical.
|
||||
if (!this.model.get('areSubtreesLoaded') && typeof $activeTab.data('drupal-subtrees') !== 'undefined' && orientation === 'vertical') {
|
||||
var subtreesHash = drupalSettings.toolbar.subtreesHash;
|
||||
var langcode = drupalSettings.toolbar.langcode;
|
||||
var endpoint = Drupal.url('toolbar/subtrees/' + subtreesHash + '/' + langcode);
|
||||
var cachedSubtreesHash = localStorage.getItem('Drupal.toolbar.subtreesHash');
|
||||
var cachedSubtrees = JSON.parse(localStorage.getItem('Drupal.toolbar.subtrees'));
|
||||
var theme = drupalSettings.ajaxPageState.theme;
|
||||
var endpoint = Drupal.url('toolbar/subtrees/' + subtreesHash);
|
||||
var cachedSubtreesHash = localStorage.getItem('Drupal.toolbar.subtreesHash.' + theme);
|
||||
var cachedSubtrees = JSON.parse(localStorage.getItem('Drupal.toolbar.subtrees.' + theme));
|
||||
var isVertical = this.model.get('orientation') === 'vertical';
|
||||
// If we have the subtrees in localStorage and the subtree hash has not
|
||||
// changed, then use the cached data.
|
||||
|
@ -281,13 +282,13 @@
|
|||
// toolbar is vertical.
|
||||
else if (isVertical) {
|
||||
// Remove the cached menu information.
|
||||
localStorage.removeItem('Drupal.toolbar.subtreesHash');
|
||||
localStorage.removeItem('Drupal.toolbar.subtrees');
|
||||
// The response from the server will call the resolve method of the
|
||||
localStorage.removeItem('Drupal.toolbar.subtreesHash.' + theme);
|
||||
localStorage.removeItem('Drupal.toolbar.subtrees.' + theme);
|
||||
// The AJAX response's command will trigger the resolve method of the
|
||||
// Drupal.toolbar.setSubtrees Promise.
|
||||
$.ajax(endpoint);
|
||||
Drupal.ajax({url: endpoint}).execute();
|
||||
// Cache the hash for the subtrees locally.
|
||||
localStorage.setItem('Drupal.toolbar.subtreesHash', subtreesHash);
|
||||
localStorage.setItem('Drupal.toolbar.subtreesHash.' + theme, subtreesHash);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Reference in a new issue