J4 Issue ?
avatar astridx
astridx
25 Jun 2019

Steps to reproduce the issue

  1. Open Template Manager
  2. Click on an override-file. Perhaps you have to create an override first.
  3. Activate diff-view

Expected result

You see the diff-view

Actual result

No diff-view is opened.

Additional comments

See #21851 for more information about diff-view

Templates  Customise  Cassiopeia    test   Administration(1)

avatar astridx astridx - open - 25 Jun 2019
avatar joomla-cms-bot joomla-cms-bot - change - 25 Jun 2019
Labels Added: ?
avatar joomla-cms-bot joomla-cms-bot - labeled - 25 Jun 2019
avatar astridx astridx - change - 25 Jun 2019
Title
[4.0]
[4.0] Diff View in Template Manager is broken.
avatar astridx astridx - edited - 25 Jun 2019
avatar astridx astridx - change - 25 Jun 2019
The description was changed
avatar astridx astridx - edited - 25 Jun 2019
avatar franz-wohlkoenig franz-wohlkoenig - change - 25 Jun 2019
Labels Added: J4 Issue
avatar franz-wohlkoenig franz-wohlkoenig - labeled - 25 Jun 2019
avatar richard67
richard67 - comment - 25 Jun 2019

When opening the edit view, a javascript error is reported for the editor (codemirror), and then the loading of the js file is aborted, see following screen shot:
Unbenannt

In English: 1. script media/vendor/codemirror/mode/text/x-php/text/x-php.min.js has been loaded even if its MIME type is not valid for javascript, and 2. Loading failed for the same script.

Maybe that's related to this issue?

avatar franz-wohlkoenig franz-wohlkoenig - change - 25 Jun 2019
Status New Discussion
avatar ghazal
ghazal - comment - 25 Jun 2019

Issue and JS error confirmed.
Today's build.


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

avatar richard67
richard67 - comment - 25 Jun 2019

The js error happens only when editing a file from an override. When editing any other file not belonging to any override, the js errro doesn't happen. So it seems really to be related to the override management.

avatar richard67
richard67 - comment - 25 Jun 2019

No idea what that could be. I think it needs a js expert. Maybe @dgrammatiko can help?

avatar richard67
richard67 - comment - 25 Jun 2019

@SharkyKZ Could that be related to PR #24639 ?

avatar SharkyKZ
SharkyKZ - comment - 26 Jun 2019

@richard67 No, that's not related.

avatar SharkyKZ
SharkyKZ - comment - 26 Jun 2019

My guess it's to do with #24463.

avatar richard67
richard67 - comment - 26 Jun 2019

That could be. I will check details later after work.

avatar richard67
richard67 - comment - 26 Jun 2019

@brianteeman Could you have a look on this issue? I think it really can have something to do with the new switchers from PR #24463 , like Sharky supposes, because that diff view for override files in the template manager contains switchers, too, and those seem still be the old ones.

avatar brianteeman
brianteeman - comment - 26 Jun 2019

Not able to test right now. the template_overrides table never gets updated

I doubt very much it is anything to do with the switcher code as that is pure css. But you can test it yourself by deleting the class=switcher for two fields in administrator\components\com_templates\forms\source.xml

avatar franz-wohlkoenig franz-wohlkoenig - change - 26 Jun 2019
Title
[4.0] Diff View in Template Manager is broken.
[4.0] Diff View in Template Manager is broken
avatar franz-wohlkoenig franz-wohlkoenig - edited - 26 Jun 2019
avatar richard67
richard67 - comment - 26 Jun 2019

@brianteeman Thanks, I've tried that, removing class from the 2 switchers, and as you supposed that did not help. It seems the js of that diff view is either broken or not loaded at all. Maybe something to do with the codemirror editors in that view? Do you know who can help here further? I first thought some selector in js may fail because of changed classes, that's why I thought it could be related to your changes.

avatar dgrammatiko
dgrammatiko - comment - 27 Jun 2019

FWIW the js of that diff view was depending on 2 events emitted by the old switcher. Those events do NOT exist any more, therefore, the script doesn't do anything anymore...

avatar richard67
richard67 - comment - 27 Jun 2019

@dgrammatiko This explains a lot. Thanks for helping.

avatar dgrammatiko
dgrammatiko - comment - 27 Jun 2019

@richard67 I can also describe a possible solution:

  • Add an on click attribute on the form of that view, eg onclick="Joomla.switchDifState()"
  • add a simple iife on the top of the js file on that view something like:
((Joomla) => {
  Joomla.switchDifState = (event) {
    if (event.target.checked) {
      event.target.dispatchEvent(new CustomEvent('theNameOfTheExistingEventForOn'));
    } else {
      event.target.dispatchEvent(new CustomEvent('theNameOfTheExistingEventForOff'));
    }
})(Joomla);
  • The code might need some tweaks...
  • This approach expects that the new switch element has a functional code for the onclick event
avatar richard67
richard67 - comment - 27 Jun 2019

@dgrammatiko Thanks. I'll try to find some time on weekend. But if someone who is more familiar with js and events finds time before, I would not be unhappy.

avatar Harmageddon
Harmageddon - comment - 19 Sep 2019

I'd propose #26359 as a fix. Please have a look there!

avatar joomla-cms-bot joomla-cms-bot - change - 19 Sep 2019
Closed_By alikon joomla-cms-bot
avatar joomla-cms-bot joomla-cms-bot - close - 19 Sep 2019
avatar alikon alikon - change - 19 Sep 2019
Status Discussion Closed
Closed_Date 0000-00-00 00:00:00 2019-09-19 18:32:16
Closed_By alikon
avatar joomla-cms-bot
joomla-cms-bot - comment - 19 Sep 2019

Set to "closed" on behalf of @alikon by The JTracker Application at issues.joomla.org/joomla-cms/25323

avatar alikon
alikon - comment - 19 Sep 2019

please test #26359


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

Add a Comment

Login with GitHub to post a comment