Skip to content

Commit

Permalink
[4.0] Non-clickable module in a menu item (joomla#27455)
Browse files Browse the repository at this point in the history
* [4.0] Non-clickable module in a menu item

This is a replacement PR for joomla#23609 which resolves the merge conflicts

To test
npm i

Go the module assignment tab of any menu item
Click on the name of a module
A modal will open
Change the published state of the modal and save and close
Check that the module is now shown with the changed state
Check that there are no js errors in the console

* cs

Co-authored-by: infograf768 <infografjms@gmail.com>
  • Loading branch information
brianteeman and infograf768 committed Feb 4, 2020
1 parent 328d427 commit f08fe7d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
23 changes: 12 additions & 11 deletions build/media_source/com_menus/js/admin-item-edit_modules.es6.js
Expand Up @@ -15,7 +15,7 @@ Joomla = window.Joomla || {};
window.menuId = parseInt(options.itemId, 10);
}

const baseLink = 'index.php?option=com_modules&amp;client_id=0&amp;task=module.edit&amp;tmpl=component&amp;view=module&amp;layout=modal&amp;id=';
const baseLink = 'index.php?option=com_modules&client_id=0&task=module.edit&tmpl=component&view=module&layout=modal&id=';
const assigned1 = document.getElementById('jform_toggle_modules_assigned1');
const assigned0 = document.getElementById('jform_toggle_modules_assigned0');
const published1 = document.getElementById('jform_toggle_modules_published1');
Expand Down Expand Up @@ -66,17 +66,17 @@ Joomla = window.Joomla || {};
if (linkElements.length) {
linkElements.forEach((linkElement) => {
linkElement.addEventListener('click', (event) => {
const link = baseLink + event.target.getAttribute('data-moduleId');
const link = baseLink + event.target.getAttribute('data-module-id');
const modal = document.getElementById('moduleEditModal');
const body = modal.querySelector('.modal-body');
const iFrame = document.createElement('iframe');

modal.addEventListener('show.bs.modal', (ev) => {
const iFrame = document.createElement('iframe');
iFrame.src = link;
iFrame.setAttribute('class', 'class="iframe jviewport-height70"');
const body = ev.target.querySelector('.modal-body');
body.innerHTML = '';
body.appendChild(iFrame);
});
iFrame.src = link;
iFrame.setAttribute('class', 'class="iframe jviewport-height70"');
body.innerHTML = '';
body.appendChild(iFrame);

modal.open();
});
});
}
Expand All @@ -88,7 +88,8 @@ Joomla = window.Joomla || {};

if (target) {
const iframe = document.querySelector('#moduleEditModal iframe');
iframe.contents().querySelector(target).click();
const iframeDocument = iframe.contentDocument || iframe.contentWindow.document;
iframeDocument.querySelector(target).click();
}
});
});
Expand Down
3 changes: 1 addition & 2 deletions build/media_source/com_modules/js/admin-module-edit.es6.js
Expand Up @@ -15,8 +15,7 @@ Joomla = window.Joomla || {};

if (window.self !== window.top) {
if (window.parent.viewLevels) {
// @todo remove the chosen!!!
const updPosition = window.jQuery('#jform_position').chosen().val();
const updPosition = document.getElementById('jform_position').value;
const updTitle = document.getElementById('jform_title').value;
const updMenus = document.querySelector('#jform_assignment').value;
const updStatus = document.querySelector('#jform_published').value;
Expand Down

0 comments on commit f08fe7d

Please sign in to comment.