No Code Attached Yet
avatar joomlafun
joomlafun
20 Apr 2024

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

Votes

# of Users Experiencing Issue
1/1
Average Importance Score
3.00

avatar joomlafun joomlafun - open - 20 Apr 2024
avatar joomlafun joomlafun - change - 20 Apr 2024
Labels Removed: ?
avatar joomla-cms-bot joomla-cms-bot - change - 20 Apr 2024
Labels Added: No Code Attached Yet
avatar joomla-cms-bot joomla-cms-bot - labeled - 20 Apr 2024
avatar brianteeman
brianteeman - comment - 20 Apr 2024

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

avatar joomlafun
joomlafun - comment - 21 Apr 2024

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

avatar brianteeman
brianteeman - comment - 29 Apr 2024

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

avatar joomlafun
joomlafun - comment - 3 May 2024

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

avatar brianteeman
brianteeman - comment - 3 May 2024

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.

avatar joomlafun
joomlafun - comment - 3 May 2024

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.

avatar brianteeman
brianteeman - comment - 3 May 2024

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.

avatar joomlafun joomlafun - change - 5 May 2024
Status New Closed
Closed_Date 0000-00-00 00:00:00 2024-05-05 19:32:52
Closed_By joomlafun
avatar joomlafun joomlafun - close - 5 May 2024
avatar joomlafun
joomlafun - comment - 5 May 2024

@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

Add a Comment

Login with GitHub to post a comment