dnnsoftware / Dnn.Platform

DNN (formerly DotNetNuke) is the leading open source web content management platform (CMS) in the Microsoft ecosystem.
https://dnncommunity.org/
MIT License
1.03k stars 752 forks source link

[Enhancement]: confirmation message before saving a template #6161

Open warkhos opened 1 week ago

warkhos commented 1 week ago

Is there an existing issue for this?

Description of problem

I was able to identify that when you try to save a page as a template and you assigned a name that it's already been used for an existent template, after you hit save it'll overwrite the existent template with no confirmation message or warning.

Description of solution

I think of two possible solutions:

1) include a text prior to save the new template like "IMPORTANT:..." this message should indicate that if you use the name for an existent template it'll automatically overwrite the existent template file and the older version will be lost.

2) when the user click on "save" in order to create the new page template file, run through the existent templates filename in the folder and make sure there is no existent templates with the same filename; if the search results shows an existent template already using the name, the system could display a confirmation/warning message asking the user if they want to overwrite the existent template file.

Description of alternatives considered

n/a

Anything else?

n/a

Do you be plan to contribute code for this enhancement?

Would you be interested in sponsoring this enhancement?

Code of Conduct

jeremy-farrance commented 4 days ago

Since detecting on the front-end that a matching filename already exists on the backend would require a round trip to the server and a UI confirmation feels awkward (is there already a pattern like this elsewhere in the PersonaBar?), I think a simpler to implement (third) solution is to:

  1. on save, (backend, server-side) check if the filename already exists, and if it does, simply add a number to the end of the filename. This would need to loop...

As an example, I am trying to save "Provider-Profile" and there are already two files in /Templates named:

So we end up saving with the name Provider-Profile-2.page.template

If there is some agreement here, I may be able to implement this one upcoming weekend.

warkhos commented 3 days ago

Jeremy that sounds so much better. I'm okay with this solution.