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.1] Child templates 2/2 [clean] #35998

Merged
merged 96 commits into from
Nov 30, 2021

Conversation

dgrammatiko
Copy link
Contributor

@dgrammatiko dgrammatiko commented Nov 9, 2021

Pull Request for Issue # .

Summary of Changes

  • Added functionality for the creation of a child template (for templates that support it). The name convention for the child template is [parent template]_[child template name] (eg for cassiopeia's child named temp the actual name will be cassiopeia_temp
  • Tweaked the language inclusions so children templates of the core get a correct translation (templates that have the language folder were already covered)
  • Tweaked the functionality for the preview thumb and preview images. Also added a fallback image if there's not an image in the template...
  • Tweaked the file editor so that folders could be created/deleted/renamed both on the template folder or the media folder
  • Tweaked the file editor so that files could be edited/created/deleted/renamed/uploaded/extracted both on the template folder or the media folder

Testing Instructions

  • Git fetch this PR, run npm

  • Try every functionality in the com_templates for both core templates

  • Install https://github.com/joomla/joomla-cms/files/7235154/cassy_1.0.0.zip (cassiopeia with a different name)

  • Try every functionality in the com_templates for the installed template

  • Also check (with tinymce as the editor) when editing an article that the editor.css (or .min.css if not in debug mode) is loaded from the /css folder of the template, if such file exists. (the path can be /templates/templateName/css/editor.[min.]CSS for existing templates or media/templates/site/templateName/css/editor.[min.]CSS for templates supporting children).

Actual result BEFORE applying this Pull Request

Expected result AFTER applying this Pull Request

Documentation Changes Required

Yes, this is the UI for the codename child template or whatever the project ends up naming the inheritable/extendable/... templates

@joomla-cms-bot joomla-cms-bot added NPM Resource Changed This Pull Request can't be tested by Patchtester PR-4.1-dev labels Nov 9, 2021
build/media_source/system/images/template_thumb.svg Outdated Show resolved Hide resolved
build/media_source/system/images/template_thumb.svg Outdated Show resolved Hide resolved
libraries/src/Installer/Installer.php Outdated Show resolved Hide resolved
@dgrammatiko
Copy link
Contributor Author

dgrammatiko commented Nov 13, 2021

@brianteeman do you know if the aria-setsize, aria-posinset and aria-level are fully supported/correctly calculated on all evergreen browsers? Ref: https://w3c.github.io/aria-practices/examples/treeview/treeview-1/treeview-1b.html

@brianteeman
Copy link
Contributor

Sorry I don't know. I will do some research tomorrow. Caveat a lot of the examples on that site are not very good

@dgrammatiko
Copy link
Contributor Author

Do you have a solid example for tree view? I use some of the links from w3c/aria#1311

@brianteeman
Copy link
Contributor

Not at my pc but the link I shared the other day in the media manager pr looked good

@dgrammatiko
Copy link
Contributor Author

Not at my pc but the link I shared the other day in the media manager pr looked good

It's sharing the same code as https://w3c.github.io/aria-practices/examples/treeview/treeview-1/treeview-1b.html
Anyways I will code something and we can improve/iterate...

@joomla-cms-bot joomla-cms-bot added the Language Change This is for Translators label Nov 17, 2021
@dgrammatiko dgrammatiko changed the title [4.1][WIP] Child templates 2/2 [clean] [4.1] Child templates 2/2 [clean] Nov 17, 2021
@richard67
Copy link
Member

2021-11-28_pr-35998

@dgrammatiko Looks ok to me. But can it be that more than one template style for a child template is not supported?

When I make the template style of the child template be the default, I get no CSS from the parent loaded.

2021-11-28_pr-35998_2

Backend template styles:

2021-11-28_pr-35998_3

@dgrammatiko
Copy link
Contributor Author

The names for your child templates are off, should be cassy_child* instead of cassy_cassy* Althought this shouldn't be the problem.

But can it be that more than one template style for a child template is not supported?

No, styles are just the JSON blob from the db so there shouldn't be a limit on the copies...

When I make the template style of the child template be the default, I get no CSS from the parent loaded.

Does the folders media/templates/site/cassy/... exist? This is weird...

@richard67
Copy link
Member

Does the folders media/templates/site/cassy/... exist? This is weird...

@dgrammatiko Yes, it exists. I've created another child with a more suitable name but that did not help.

Another thing I have noticed is that I can created new child templates, but I cannot delete them. Is that by design or will the delete come later with another PR?

@richard67
Copy link
Member

@dgrammatiko It seems it loads the template css files from the media/templates/site/cassy/css folder, but stuff from sub-folders "global", "system" and "vendor" is not included.

@richard67
Copy link
Member

@dgrammatiko It seems it loads the template css files from the media/templates/site/cassy/css folder, but stuff from sub-folders "global", "system" and "vendor" is not included.

P.S. Could that be an issue of the Cassy template?

@dgrammatiko
Copy link
Contributor Author

Another thing I have noticed is that I can created new child templates, but I cannot delete them. Is that by design or will the delete come later with another PR?

Actually, you can already, got to System->Extentions, select templates in the filters and then delete any child template (probably not the most intuitive workflow)...

By the way, can you remove all the preexisted templates and try again your tests, something seems awfully wrong but I can't pinpoint what it is...

@richard67
Copy link
Member

@dgrammatiko I've tried again from scratch with a new installation of this branch. This time only one language, no template style copies, nothing special. I only installed the Cassy template and made it's template style the default. That worked, i.e. frontend looked ok. Then I have created a child template named "Child_1", so the generated name at the end was "Cassy_cild_1"- That worked. But then I make the template style of this child be the default, the frontpage looks like in my screenshot, i.e. some but not all CSS seems not to be loaded.

@richard67
Copy link
Member

@dgrammatiko Is it possible to test with both PRs #35874 and this here together? Or do they conflict somehow?

@dgrammatiko
Copy link
Contributor Author

ut then I make the template style of this child be the default, the frontpage looks like in my screenshot, i.e. some but not all CSS seems not to be loaded.

Yeah there was something off in the cassy template, try this Cassy_new.zip

Is it possible to test with both PRs #35874 and this here together? Or do they conflict somehow?

I think there is nothing that conflicts, so they could be tested together. Remember to apply the db changes...

@richard67
Copy link
Member

richard67 commented Nov 28, 2021

@dgrammatiko I have just tested now with the both PR's merged together in a branch. I don't have the problem when creating a child template of the (now inheritable) Cassiopeia and then make the template style of that child be the default.

So it either is an issue with Cassy or it needs both PR's together.

@richard67
Copy link
Member

I have tested this item ✅ successfully on 7a95857

Template manager works well with inheritable and not inheritable templates and with child templates of inheritable templates.

The right editor.css is included when editing with TinyMCE in backend, regardless if the default template style is one of an inheritable or a not inheritable template or the child template of an inheritable template.

I've tested this PR alone with the core templates being not inheritable and the inheritable Cassy template installed (fixed version), and I also have texted it in combination with PR #35874 so the core templates were inheritable.

Both worked.

If there are minor glitches which I've missed in my tests, I think they can be fixed later.


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

@chmst
Copy link
Contributor

chmst commented Nov 28, 2021

I have tested this item ✅ successfully on 7a95857

Did all what I can imagine for child template and using templates and template styles - all went well.


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

@joomla-cms-bot joomla-cms-bot removed this from the Joomla 4.1 milestone Nov 28, 2021
@richard67
Copy link
Member

RTC


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

@joomla-cms-bot joomla-cms-bot added the RTC This Pull Request is Ready To Commit label Nov 28, 2021
@richard67 richard67 added this to the Joomla 4.1 milestone Nov 28, 2021
@richard67
Copy link
Member

I've added back the previous test results in the issue tracker since the last commit was just the removal of an obsolete "use" statement.

// Issue warning notice if the file is not found (but pass name to $content_css anyway to avoid TinyMCE error
if (!file_exists($templates_path . '/' . $template . '/css/' . $content_css_custom))
{
$msg = sprintf(Text::_('PLG_TINY_ERR_CUSTOMCSSFILENOTPRESENT'), $content_css_custom);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove language string?

@bembelimen bembelimen merged commit 3ff973c into joomla:4.1-dev Nov 30, 2021
@joomla-cms-bot joomla-cms-bot removed the RTC This Pull Request is Ready To Commit label Nov 30, 2021
@bembelimen
Copy link
Contributor

Thank you!

@dgrammatiko dgrammatiko deleted the 4.1-dev-com_templates_clean branch November 30, 2021 10:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Language Change This is for Translators NPM Resource Changed This Pull Request can't be tested by Patchtester
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants