Conflicting Files NPM Resource Changed ? Success

User tests: Successful: Unsuccessful:

avatar amitranjan2
amitranjan2
20 Jan 2019

Pull Request for Issue #23540

Summary of Changes

Added data-toggle and data-target

Testing Instructions

Navigate to following page from the admin page
Menus >> Main Menu >> Home

Open module assignment tab

try to click item

Expected result

Modal open to edit

Actual result

Modal not opening

Documentation Changes Required

No

avatar amitranjan2 amitranjan2 - open - 20 Jan 2019
avatar amitranjan2 amitranjan2 - change - 20 Jan 2019
Status New Pending
avatar amitranjan2 amitranjan2 - change - 20 Jan 2019
Labels Added: ?
avatar joomla-cms-bot joomla-cms-bot - change - 20 Jan 2019
Category Administration com_menus JavaScript Repository
avatar amitranjan2
amitranjan2 - comment - 20 Jan 2019

@dgrammatiko Please review.

185fd57 21 Jan 2019 avatar amitranjan2 fix
b2f0ae0 21 Jan 2019 avatar amitranjan2 add
avatar infograf768
infograf768 - comment - 21 Jan 2019

Partially successful.
Although we now get the modal, Saving (or Save and Close) does not save the modifications of the module.

TypeError: c.contents is not a function admin-item-edit_modules.min.js:1:1867

debug on
TypeError: iframe.contents is not a function admin-item-edit_modules.js:89:13

avatar amitranjan2
amitranjan2 - comment - 21 Jan 2019

ok thanks, I will fix

avatar mvanvu
mvanvu - comment - 21 Jan 2019

/build/media_src/com_menus/js/admin-item-edit_modules.es6.js line 75
iFrame.setAttribute('class', 'class="iframe jviewport-height70"'); is that right?

OR this should be iFrame.setAttribute('class', 'iframe jviewport-height70'); ?

avatar dgrammatiko
dgrammatiko - comment - 21 Jan 2019

@amitranjan2 can you please use the event listener? There was a reason I did it like that in the first place: https://github.com/joomla/joomla-cms/blob/4.0-dev/build/media/legacy/js/bootstrap-init.js#L97

So your code essentially will never work...

avatar dgrammatiko
dgrammatiko - comment - 21 Jan 2019

Although we now get the modal, Saving (or Save and Close) does not save the modifications of the module.

@infograf768 please test:
#23600

avatar amitranjan2
amitranjan2 - comment - 21 Jan 2019

`

@amitranjan2 can you please use the event listener? There was a reason I did it like that in the first place: https://github.com/joomla/joomla-cms/blob/4.0-dev/build/media/legacy/js/bootstrap-init.js#L97

So your code essentially will never work...`

Yes i tried with modal.addEventListener('show.bs.modal', (ev) => {} but its not executing when the modal is open.
Can you please give me example?
@dgrammatiko

avatar dgrammatiko
dgrammatiko - comment - 22 Jan 2019

@amitranjan2 here is some code, admin-item-edit_modules.es6.js:

/**
 * @copyright  Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved.
 * @license    GNU General Public License version 2 or later; see LICENSE.txt
 */

Joomla = window.Joomla || {};

(() => {
  'use strict';

  const options = Joomla.getOptions('menus-edit-modules');

  if (options) {
    window.viewLevels = options.viewLevels;
    window.menuId = parseInt(options.itemId, 10);
  }

  document.addEventListener('DOMContentLoaded', () => {
    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');
    const published0 = document.getElementById('jform_toggle_modules_published0');
    const linkElements = [].slice.call(document.getElementsByClassName('module-edit-link'));
    const elements = [].slice.call(document.querySelectorAll('#moduleEditModal .modal-footer .btn'));

    if (assigned1) {
      assigned1.addEventListener('click', () => {
        const list = [].slice.call(document.querySelectorAll('tr.no'));

        list.forEach((item) => {
          item.style.display = 'table-row';
        });
      });
    }

    if (assigned0) {
      assigned0.addEventListener('click', () => {
        const list = [].slice.call(document.querySelectorAll('tr.no'));

        list.forEach((item) => {
          item.style.display = 'none';
        });
      });
    }

    if (published1) {
      published1.addEventListener('click', () => {
        const list = [].slice.call(document.querySelectorAll('.table tr.unpublished'));

        list.forEach((item) => {
          item.style.display = 'table-row';
        });
      });
    }

    if (published0) {
      published0.addEventListener('click', () => {
        const list = [].slice.call(document.querySelectorAll('.table tr.unpublished'));

        list.forEach((item) => {
          item.style.display = 'none';
        });
      });
    }

    if (linkElements.length) {
      linkElements.forEach((linkElement) => {
        linkElement.addEventListener('click', (event) => {
          debugger;
          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');

          iFrame.src = link;
          iFrame.setAttribute('class', 'class="iframe jviewport-height70"');
          body.innerHTML = '';
          body.appendChild(iFrame);

          modal.open();
        });
      });
    }

    if (elements.length) {
      elements.forEach((element) => {
        element.addEventListener('click', (event) => {
          const target = event.target.getAttribute('data-target');

          if (target) {
            const iframe = document.querySelector('#moduleEditModal iframe');
            const iframeDocument = iframe.contentDocument || iframe.contentWindow.document;
            iframeDocument.querySelector(target).click();
          }
        });
      });
    }
  });
})();

Also admin-module-edit.es6.js line 18:

          const updPosition = document.getElementById('jform_position').value;

Also please remove all the changes in the markup:

					data-toggle="modal"
						data-target="#moduleEditModal"

This is coupling things to Bootstrap and we don't want that!!!

avatar amitranjan2
amitranjan2 - comment - 22 Jan 2019

thanks, I will update.
@dgrammatiko

avatar joomla-cms-bot joomla-cms-bot - change - 24 Jan 2019
Category Administration com_menus JavaScript Repository JavaScript Repository
0812718 24 Jan 2019 avatar amitranjan2 fix
834c904 24 Jan 2019 avatar amitranjan2 fix
688ef09 24 Jan 2019 avatar amitranjan2 space
ba1717e 25 Jan 2019 avatar amitranjan2 fix
avatar amitranjan2
amitranjan2 - comment - 25 Jan 2019

please test this @Quy

avatar amitranjan2
amitranjan2 - comment - 28 Jan 2019

@infograf768 Please review this
I think now it's working fine.
opening as well as saving both, working fine

avatar franz-wohlkoenig franz-wohlkoenig - change - 19 Apr 2019
Title
[Fix] [4.0] Non-clickable module in a menu item
[4.0] Non-clickable module in a menu item
avatar franz-wohlkoenig franz-wohlkoenig - change - 19 Apr 2019
Title
[Fix] [4.0] Non-clickable module in a menu item
[4.0] Non-clickable module in a menu item
avatar franz-wohlkoenig franz-wohlkoenig - edited - 19 Apr 2019
avatar joomla-cms-bot joomla-cms-bot - change - 19 Apr 2019
Category JavaScript Repository JavaScript Repository NPM Change
avatar franz-wohlkoenig
franz-wohlkoenig - comment - 2 Sep 2019

Please resolve conflicting files so this PR can get tested at Worldwide Pizza, Bugs & Fun, October 19th

avatar amitranjan2 amitranjan2 - change - 12 Sep 2019
Labels Added: Conflicting Files
avatar ttplpoojak ttplpoojak - test_item - 19 Oct 2019 - Tested successfully
avatar ttplpoojak
ttplpoojak - comment - 19 Oct 2019

I have tested this item successfully on 64e2b30


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/23609.

avatar Nilesh5995 Nilesh5995 - test_item - 2 Nov 2019 - Tested successfully
avatar Nilesh5995
Nilesh5995 - comment - 2 Nov 2019

I have tested this item successfully on 64e2b30


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/23609.

avatar alikon
alikon - comment - 2 Nov 2019

@amitranjan2 can you solve conflict please

avatar KishoriBKarale KishoriBKarale - test_item - 2 Nov 2019 - Tested successfully
avatar KishoriBKarale
KishoriBKarale - comment - 2 Nov 2019

I have tested this item successfully on 64e2b30


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/23609.

avatar pdavila2709
pdavila2709 - comment - 15 Nov 2019

I can not apply the patch with the Joomla Patch Tester. This is the message:

Error: The file marked for modification does not exist: build/media_src/com_menus/js/admin-item-edit_modules.es6.js


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/23609.

avatar pdavila2709
pdavila2709 - comment - 15 Nov 2019

I can not apply the patch with the Joomla Patch Tester. This is the message:

Error: The file marked for modification does not exist: build/media_src/com_menus/js/admin-item-edit_modules.es6.js


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/23609.

avatar infograf768
infograf768 - comment - 16 Nov 2019

@amitranjan2 please solve conflicts

avatar Quy Quy - edited - 9 Jan 2020
avatar Quy Quy - close - 9 Jan 2020
avatar Quy Quy - change - 9 Jan 2020
Status Pending Closed
Closed_Date 0000-00-00 00:00:00 2020-01-09 19:16:04
Closed_By Quy
avatar Quy
Quy - comment - 9 Jan 2020

Replaced with PR #27455


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/23609.

Add a Comment

Login with GitHub to post a comment