Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[4.0] Diff View in Template Manager is broken #25323

Closed
astridx opened this issue Jun 25, 2019 · 18 comments
Closed

[4.0] Diff View in Template Manager is broken #25323

astridx opened this issue Jun 25, 2019 · 18 comments

Comments

@astridx
Copy link
Contributor

astridx commented Jun 25, 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)

@astridx astridx changed the title [4.0] [4.0] Diff View in Template Manager is broken. Jun 25, 2019
@ghost ghost added the J4 Issue label Jun 25, 2019
@richard67
Copy link
Member

richard67 commented Jun 25, 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?

@ghazal
Copy link
Contributor

ghazal commented Jun 25, 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.

@richard67
Copy link
Member

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.

@richard67
Copy link
Member

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

@richard67
Copy link
Member

@SharkyKZ Could that be related to PR #24639 ?

@SharkyKZ
Copy link
Contributor

@richard67 No, that's not related.

@SharkyKZ
Copy link
Contributor

My guess it's to do with #24463.

@richard67
Copy link
Member

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

@richard67
Copy link
Member

@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.

@brianteeman
Copy link
Contributor

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

@ghost ghost changed the title [4.0] Diff View in Template Manager is broken. [4.0] Diff View in Template Manager is broken Jun 26, 2019
@richard67
Copy link
Member

@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.

@dgrammatiko
Copy link
Contributor

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...

@richard67
Copy link
Member

@dgrammatiko This explains a lot. Thanks for helping.

@dgrammatiko
Copy link
Contributor

@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

@richard67
Copy link
Member

@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.

@Harmageddon
Copy link
Contributor

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

@joomla-cms-bot
Copy link

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

@alikon
Copy link
Contributor

alikon commented Sep 19, 2019

please test #26359


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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

9 participants