Dnn.Platform icon indicating copy to clipboard operation
Dnn.Platform copied to clipboard

[Enhancement]: confirmation message before saving a template

Open warkhos opened this issue 1 year ago • 2 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues

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?

  • [ ] Yes

Would you be interested in sponsoring this enhancement?

  • [ ] Yes

Code of Conduct

  • [X] I agree to follow this project's Code of Conduct

warkhos avatar Oct 14 '24 21:10 warkhos

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:

  • Provider-Profile.page.template
  • Provider-Profile-1.page.template ^^

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.

jeremy-farrance avatar Oct 22 '24 03:10 jeremy-farrance

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

warkhos avatar Oct 22 '24 12:10 warkhos