joomla-cms icon indicating copy to clipboard operation
joomla-cms copied to clipboard

atum user.js not loading

Open joomlafun opened this issue 10 months ago • 3 comments

Steps to reproduce the issue

In /media/templates/administrator/atum/js/ create user.js

Expected result

js loading in browser

Actual result

js not loading

System information (as much as possible)

Joomla 5.1 8.2.10-2ubuntu1

Additional comments

template.min.js does show; the user.js added to cassopia in front end works fine. user.css is loading properly so no double gzip compression issue

joomlafun avatar Apr 20 '24 13:04 joomlafun

unlike in cassiopeia there is no code in atum/joomla.asset.json to load any user.js

brianteeman avatar Apr 20 '24 14:04 brianteeman

@brianteeman it's a pity,For now I will add the js to the php view of the pages/modules I need it on.

Could this be a feature request?

joomlafun avatar Apr 21 '24 19:04 joomlafun

Can you epxlain more the use case for adding js to every page of the admin

brianteeman avatar Apr 29 '24 14:04 brianteeman

I would use it for Custom CSS display and communication :

-Custom pages : I want to hide certain content/options to site managers for a page or a module if there is a specific value in its DOM(the element can just be the value of the custom field from the page/module). Then JS would get this value and add a class to the page to hide items. -Custom communication : I want to communicate specific information to a site manager through a module using the before/after pseudoclass which would be added if JS spot the value of a custom field

I am sure that there are other cases where this would be useful as as you know you get the benefit of not having to update the extension/module files on each update.

I saw a few requests on forum and here also for this feature : https://joomla.stackexchange.com/questions/33016/adding-javascript-to-the-administrator-template

No worries if it does not get implemented though but to see if its worth it, maybe we need the opinion of more developers with their own case? And maybe also the security aspect could be evaluated because it is also an easy way to add JS everywhere in the admin section

joomlafun avatar May 03 '24 08:05 joomlafun

From the sound of it you should be adding the js with the module and then it is only loaded on the pages that uses the module. Adding it to the template itself as you request would add the script everywhere.

brianteeman avatar May 03 '24 11:05 brianteeman

Well, it is for a few different modules an 1 extension but I will create templates overrides.

I made this suggestion mostly because I thought that it would benefit other developers wanting to customize the admin interface easily.

joomlafun avatar May 03 '24 13:05 joomlafun

My point is that this is not the correct way to do it. You should not be loading javascript everywhere if it is not needed. That is what the web asset manager is for.

brianteeman avatar May 03 '24 17:05 brianteeman

@brianteeman I was not aware of the web asset manager. I will check it out, thank you. https://docs.joomla.org/J4.x:Web_Assets

joomlafun avatar May 05 '24 19:05 joomlafun