On the quest to make Joomla! compatible with bootstrap 3 (or foundation) I encounter a problem (among others) on the front end: the rendered messages. Ok there is a solution: unset core.js and place a copy of the modified in the head, but wouldn’t be better if the javascript code that sets and destroys the messages been added with $doc->addScriptDeclaration(‘code’); on the layout view?
If the idea gets some I will provide the code
Thanks @mbabker for clarifying on the best way to override assets.
I guess I was doing it the old (wrong) way, again!
But, what I am asking, actually, is if it would be better to make core.js more modular with one solution putting the code to several scripts or inject the code directly in the respected layouts.
The later has one advantage for front end devs: in one file you make all the changes
e.g: on
https://github.com/joomla/joomla-cms/blob/staging/layouts/joomla/system/message.php
you can set the format of html code and adjust the javascript to produce that exact code!
There's a b/c issue with adding js into something that's override able (we had the same kind of issue in 2.5 and caption.js) but fwiw I agree with the principle.
One could maybe do it in the message JLayout. But that is quite a new file and most templates probably don't use it yet.
If you now remove the code from core.js and move it into the JLayout, it would break that functionality for more or less all existing sites.
Also you can't both leave it in core.js and add it to the JLayout because the duplicate code will probably clash.
So while the idea is good, I don't think we can do it in a B/C way.
Or do you see how it could be done?
Status | New | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2014-07-31 17:00:34 |
Status | Closed | ⇒ | New |
Labels |
Added:
?
|
Added the label
Milestone |
Added: |
Milestone |
Added: |
The entirety of core.js can be overridden with a template override too. Copy it from
media/system/js/core.js
totemplates/<template>/js/system/core.js
and you're all set (you'd need to do the same with the uncompressed file). Just one option to throw out there.