modxcms / revolution

MODX Revolution - Content Management Framework
https://modx.com/
GNU General Public License v2.0
1.36k stars 529 forks source link

Conflicting automatic template assignment settings #16363

Open Ruslan-Aleev opened 1 year ago

Ruslan-Aleev commented 1 year ago

Bug report

Summary

MODX has a new feature - template picker with preview. This is enabled by default and is set by the system setting enable_template_picker_in_tree. BUT MODX also has settings for automatic template assignment - automatic_template_assignment. So, these settings contradict each other.

Why do I need to look at the template picker window and select a template every time I create a resource, if I have already set the template assignment in the automatic_template_assignment setting?

I propose to remove the enable_template_picker_in_tree setting, and make the template picker an option in automatic_template_assignment, now there are system, parent and sibling options, and it will become system, parent, sibling and picker.

As a result, there will be no conflicting and extra settings.

Environment

MODX 3.x

JoshuaLuckers commented 1 year ago

The system setting automatic_template_assignment is used to determine the template that should be selected/used by default when creating a new resource. It doesn't restrict you from selecting another template.

The system setting enable_template_picker_in_tree is a restricting (should you be able to pick a template yes/no). What template the template picker selects by default depends on automatic_template_assignment. If that's not the case it's a bug in my opinion.

Ruslan-Aleev commented 1 year ago

The system setting automatic_template_assignment is used to determine the template that should be selected/used by default when creating a new resource. It doesn't restrict you from selecting another template.

Yes, that's understandable. But if I set the setting, then it's easier for me to change the template for some resources than to select the template in the window every time.

What template the template picker selects by default depends on automatic_template_assignment. If that's not the case it's a bug in my opinion.

Yes, it is also an option for the picker to take into account the automatic_template_assignment setting. Now the setting is not taken into account in picker.

JoshuaLuckers commented 1 year ago

To me the template picker behaves as expected, it not taking into account the automatic_template_assigment setting is a bug.

But others should chime in as well so we can decide if this is actual a bug/feature in regards of how the template picker should work.

smg6511 commented 1 year ago

I can confirm that the template picker does not pick up the automatic assignments. I'd say that it should, as the picker is just a shortcut for previewing and specifying a Resource’s template ahead of editing its content.

Honestly though, I’ve found the template picker to be of limited usefulness and maybe, as @Ruslan-Aleev alludes to, it’s just an unnecessary extra step in creating a Resource. As the whole point of this feature seems to be the preview image, the move to make would have been to incorporate the preview image into the Quick Create Resource panel and perhaps make that preview available in the main editing page as well.

Ruslan-Aleev commented 1 year ago

Related with https://github.com/modxcms/revolution/issues/15933

smg6511 commented 1 year ago

@Mark-H - Judging by your comments from #15933, you favor the template picker feature and maybe even use it. Given that, would you agree that it should respect/reflect the automatic_template_assignment / default_template settings? Anyone else looking at this thread, please chime in ... I don't want to embark on a fix that is not in fact a fix for users who find the template picker useful ;-)

Mark-H commented 1 year ago

Yes, the new resource window (which is more than just a template picker - it also sets resource type and the title, which saves 2 refreshes when changing those without the new resource window) should ideally default to whatever those settings indicate should be used.

smg6511 commented 7 months ago

Ok, then I'll look at fixing the issue at hand.

For the future, it might be worthwhile to rethink this workflow though. Now we have three avenues one can take to create a new Resource (quick create, template picker [when active], or the standard full create-edit), although only two of these are available at any given time. We can keep this down to two avenues and remove the extra template picker workflow by:

Ruslan-Aleev commented 3 months ago

I also found a bug in the template picker - when creating a resource through it, the uniqueness of the aliases of the resources is NOT checked.

modxcommunity commented 2 months ago

This issue has been mentioned on MODX Community. There might be relevant details there:

https://community.modx.com/t/form-customization-issue-on-modx-3-0-5-pl/8013/3