MDL-70197 navigation: Remove old navigation elements and migrate behat
This commit is contained in:
@@ -38,7 +38,7 @@ let addBlockModal = null;
|
||||
* @method registerListenerEvents
|
||||
* @param {String} pageType The type of the page
|
||||
* @param {String} pageLayout The layout of the page
|
||||
* @param {String} addBlockUrl The add block URL
|
||||
* @param {String|null} addBlockUrl The add block URL
|
||||
*/
|
||||
const registerListenerEvents = (pageType, pageLayout, addBlockUrl) => {
|
||||
document.addEventListener('click', e => {
|
||||
@@ -46,6 +46,10 @@ const registerListenerEvents = (pageType, pageLayout, addBlockUrl) => {
|
||||
if (e.target.closest(SELECTORS.ADD_BLOCK)) {
|
||||
e.preventDefault();
|
||||
|
||||
if (addBlockUrl === null) {
|
||||
addBlockUrl = e.target.closest(SELECTORS.ADD_BLOCK).dataset.url;
|
||||
}
|
||||
|
||||
if (addBlockModal) { // The 'add block' modal has been already created.
|
||||
// Display the 'add block' modal.
|
||||
addBlockModal.show();
|
||||
@@ -128,8 +132,8 @@ const getAddableBlocks = async(pageType, pageLayout) => {
|
||||
* @method init
|
||||
* @param {String} pageType The type of the page
|
||||
* @param {String} pageLayout The layout of the page
|
||||
* @param {String} addBlockUrl The add block URL
|
||||
* @param {String|null} addBlockUrl The add block URL
|
||||
*/
|
||||
export const init = (pageType, pageLayout, addBlockUrl) => {
|
||||
export const init = (pageType, pageLayout, addBlockUrl = null) => {
|
||||
registerListenerEvents(pageType, pageLayout, addBlockUrl);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user