Skip to content

Commit

Permalink
MDL-77276 mod_data: Update reset single template string
Browse files Browse the repository at this point in the history
When a single template is reset, the string displayed in the modal should
not reference to "all templates" to avoid confusion, as it was shown in the
original prototype for the 4.1 database project.
  • Loading branch information
sarjona committed Feb 24, 2023
1 parent 3312a68 commit a8bb233
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 8 deletions.
2 changes: 1 addition & 1 deletion mod/data/amd/build/templateseditor.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion mod/data/amd/build/templateseditor.min.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 7 additions & 4 deletions mod/data/amd/src/templateseditor.js
Expand Up @@ -30,7 +30,6 @@ import Templates from 'core/templates';
prefetchStrings('admin', ['confirmation']);
prefetchStrings('mod_data', [
'resettemplateconfirmtitle',
'resettemplateconfirm',
'enabletemplateeditorcheck',
'editorenable'
]);
Expand All @@ -57,11 +56,11 @@ const selectors = {
* @param {string} mode The template mode
*/
const registerEventListeners = (instanceId, mode) => {
registerResetButton();
registerResetButton(mode);
registerEditorToggler(instanceId, mode);
};

const registerResetButton = () => {
const registerResetButton = (mode) => {
const editForm = document.querySelector(selectors.editForm);
const resetButton = document.querySelector(selectors.resetButton);
const resetTemplate = document.querySelector(selectors.resetTemplate);
Expand All @@ -73,9 +72,13 @@ const registerResetButton = () => {

resetButton.addEventListener('click', async(event) => {
event.preventDefault();
const params = {
resetallname: "resetallcheck",
templatename: await getString(mode, 'mod_data'),
};
saveCancel(
getString('resettemplateconfirmtitle', 'mod_data'),
Templates.render('mod_data/template_editor_resetmodal', {resetallname: "resetallcheck"}),
Templates.render('mod_data/template_editor_resetmodal', params),
getString('reset', 'core'),
() => {
resetTemplate.value = "true";
Expand Down
2 changes: 1 addition & 1 deletion mod/data/lang/en/data.php
Expand Up @@ -397,7 +397,7 @@
$string['resetsettings'] = 'Reset filters';
$string['resettemplate'] = 'Reset template';
$string['resettemplateconfirmtitle'] = 'Reset template?';
$string['resettemplateconfirm'] = 'Resetting a template removes the existing preset and any customisations you have done to the template. You can\'t undo this action.';
$string['resettemplateconfirm'] = 'This will permanently remove the {$a} for your current preset.';
$string['resizingimages'] = 'Resizing image thumbnails...';
$string['rows'] = 'rows';
$string['rssglobaldisabled'] = 'Disabled. See site configuration variables.';
Expand Down

0 comments on commit a8bb233

Please sign in to comment.