? NPM Resource Changed Pending

User tests: Successful: Unsuccessful:

avatar dgrammatiko
dgrammatiko
21 Aug 2021

Pull Request for Issue # .

Summary of Changes

  • Change the move to top button to use Intersection observer instead onScroll event (perf)
  • move the .js to the build folder and convert it to ES20xx
  • use type=module for the script

IntersectionObserver Refs:

Testing Instructions

Fetch the PR
run npm install
Check that the Cassiopeia move to the top button still works as expected

Actual result BEFORE applying this Pull Request

Expected result AFTER applying this Pull Request

Documentation Changes Required

No this is just a rewrite of the script with modern JS, the functionality is the same

@wilsonge the js file although it's in the media folder IS NOT OVERRIDDABLE but it's just a step towards converting the Cassiopeia to parent template (eg supporting child templates)

avatar dgrammatiko dgrammatiko - open - 21 Aug 2021
avatar dgrammatiko dgrammatiko - change - 21 Aug 2021
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 21 Aug 2021
Category JavaScript Repository NPM Change Front End Templates (site)
avatar dgrammatiko dgrammatiko - change - 21 Aug 2021
The description was changed
avatar dgrammatiko dgrammatiko - edited - 21 Aug 2021
avatar dgrammatiko dgrammatiko - change - 21 Aug 2021
Labels Added: ? NPM Resource Changed
avatar dgrammatiko dgrammatiko - change - 21 Aug 2021
Title
Move JS file to the build folder
[4] Move JS file to the build folder
avatar dgrammatiko dgrammatiko - edited - 21 Aug 2021
avatar dgrammatiko dgrammatiko - change - 21 Aug 2021
Labels Added: ?
Removed: ?
avatar richard67
richard67 - comment - 21 Aug 2021

I'll care later with another PR for the files deletion on update in script.php if this PR gets merged, so no need to do it here. PR is fine as is regarding that.

avatar dgrammatiko
dgrammatiko - comment - 21 Aug 2021

@HLeithner care to explain why the thumbs down?

avatar HLeithner
HLeithner - comment - 21 Aug 2021

I think it's wrong to split the template folder across the cms, it's already hard for new developer to create a template and it doesn't makes it easier.

Also I think making core templates a parent template would make us problems at a later point in time. because it means we can never remove it. Beside that we have no b/c promise on templates which makes it useless to create a child of it.

Beside that based on our B/C policy it says all JS functions and classes are covered, I might be wrong but I think you change them in this pr. (don't know why the JS B/C policy is more strict then all others in the cms).

avatar dgrammatiko
dgrammatiko - comment - 21 Aug 2021

it's already hard for new developer to create a template

So it's fine to use ES5 javascript...

because it means we can never remove it

False assumption. You can't also uninstall a template in use right now. But uninstalling all child tmpls then you can uninstall the parent

Beside that based on our B/C policy it says all JS functions and classes are covered,

There's NO B/C break here, I just wrote the same thing with modern code...

avatar HLeithner
HLeithner - comment - 21 Aug 2021

don't care if es5 (no idea why we ship it) or es6, it's about the fact that it's hard for a beginner to understand joomla templates.
Why do I have some files in the media folder? I mean everything was in the templates folder the last 16 years and now I have to put something into another folder?! I simple can't copy paste a template without any benefit (or at least I don't see any).

It about we es core does remove the template like we remove j3 templates (which I think is wrong but nobody had the time or the willing to adapt it to j4).

avatar dgrammatiko
dgrammatiko - comment - 21 Aug 2021

It about we es core does remove the template like we remove j3 templates

Still, you can check if there are child templates and act accordingly, or do it the Jway and remove everything

Why do I have some files in the media folder?

Well, ALL other extensions have their static assets in the media folder. Also, this is about security, locking down everything apart from media/images and couple .php is way easier if ALL static files are in one place. This was explained time and time again...

I mean everything was in the templates folder the last 16 years and now I have to put something into another folder?

You can still do it the old way, it's not broken...

avatar brianteeman
brianteeman - comment - 21 Aug 2021

Parts of cassiopeia are already in the media folder - the horse has already bolted on that

(not commenting either way about if its good or bad)

avatar brianteeman
brianteeman - comment - 21 Aug 2021

It about we es core does remove the template like we remove j3 templates (which I think is wrong but nobody had the time or the willing to adapt it to j4).

I don't remember ever seeing an issue about that.

avatar HLeithner
HLeithner - comment - 21 Aug 2021

Parts of cassiopeia are already in the media folder - the horse has already bolted on that

(not commenting either way about if its good or bad)

Doesn't matter, he asked me why I gave thumbsdown.
And a error can be reverted.

I think it's wrong to make the template more completed. Not more not less. It makes it harder for new people and for veterans.

I see no benefit also for security it doesn't matter because you can't looked down the template folder for the same reason none of our folders is locked down.

avatar HLeithner
HLeithner - comment - 21 Aug 2021

It about we es core does remove the template like we remove j3 templates (which I think is wrong but nobody had the time or the willing to adapt it to j4).

I don't remember ever seeing an issue about that.

So you think there are 0 people wondering why there template doesn't exists anymore after j4 upgrade?

avatar brianteeman
brianteeman - comment - 21 Aug 2021

It about we es core does remove the template like we remove j3 templates (which I think is wrong but nobody had the time or the willing to adapt it to j4).

I don't remember ever seeing an issue about that.

So you think there are 0 people wondering why there template doesn't exists anymore after j4 upgrade?

No I am simply saying that I don't remember seeing an issue about removing j3 templates OR an issue about converting protostar to J3

avatar RickR2H
RickR2H - comment - 22 Aug 2021

Never mind me asking... But, do we have child templates in J4???


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

avatar dgrammatiko
dgrammatiko - comment - 22 Aug 2021

But, do we have child templates in J4??

Partially. The fundamentals are already there since #30192 but the behaviour is not yet exposed to the UI, although there's already some work done here: #32896

avatar RickR2H
RickR2H - comment - 22 Aug 2021

@dgrammatiko Thanks for the feedback!


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

avatar RickR2H RickR2H - test_item - 22 Aug 2021 - Tested successfully
avatar RickR2H
RickR2H - comment - 22 Aug 2021

I have tested this item successfully on 2358d61

Tested the patch and it works. Maybe we need documentation changes as the /js folder is now missing in the Cassiopeia template. It now also needs to be created when we want to use the user.js file.


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

avatar dgrammatiko dgrammatiko - change - 28 Aug 2021
Labels Added: ?
Removed: ?
avatar dgrammatiko
dgrammatiko - comment - 10 Sep 2021

I think it's wrong to make the template more completed. Not more not less. It makes it harder for new people and for veterans.

@HLeithner you are totally wrong here. The only things that changed for supporting Child templates are:

  • Couple more lines in the XML (namely: namespace and inheritable)
  • The files portion of the XML shouldn't include the css/js/images/other static folders
  • the static folders should be inserted in a media section pointing in a path like templates/{administrator / site}/templateName
  • the static files should be stored in the media folder
  • All the overrides of the static files will work as before with only twist that the files should be placed in the media folder (see my previous 2 points)

ALL THESE COULD BE DONE IN THE BUILD STEP OF THE TEMPLATE. I will provide a simple one line command (npx convert-joomla-template) that will repackage an existing template to meet these requirements (moving folders to media and update the XML). Although most devs already have their own tools and this won't be a problem.
Also my work on the com_templates really makes all these changes completely transparent to non dev users.

So my question is then: why do you thing that the 15 years old way of doing templates cannot or should not be improved? (especially when the whole point is primary a security concern, templates should not be exposed as entry points in any website, actually Joomla's entry points should be: /index.php, /administrator/index.php, /administrator/com_joomlaupdate/restore.php, media, images. Everything else should not be exposed, security 101...)

avatar HLeithner
HLeithner - comment - 10 Sep 2021

@dgrammatiko you maybe be right with being more consistent and to remove the direct call to /templates/xxx.

I would really like to see a .htaccess with where only the mentioned core files are accessible (and core folders are forbidden) and can be moved out of of the public folder.

avatar dgrammatiko
dgrammatiko - comment - 10 Sep 2021

and can be moved out of of the public folder.

Baby steps...

avatar HLeithner
HLeithner - comment - 10 Sep 2021

and can be moved out of of the public folder.

Baby steps...

It's not about steps it's more about having a plan/big picture.

avatar dgrammatiko
dgrammatiko - comment - 28 Sep 2021

@HLeithner fwiw here's a tool for automating the conversion of the templates: https://github.com/dgrammatiko/convert-template

avatar dgrammatiko
dgrammatiko - comment - 6 Nov 2021

I'm closing this one as it will be fixed with #35874

avatar dgrammatiko dgrammatiko - change - 6 Nov 2021
Status Pending Closed
Closed_Date 0000-00-00 00:00:00 2021-11-06 17:12:58
Closed_By dgrammatiko
avatar dgrammatiko dgrammatiko - close - 6 Nov 2021

Add a Comment

Login with GitHub to post a comment