Skip to content

Commit

Permalink
MDL-77275 mod_data: Template reset button changes
Browse files Browse the repository at this point in the history
* Remove the reset button in the sticky footer (template page)
* Add the reset button action in the Action menu
  • Loading branch information
Laurent David committed Mar 13, 2023
1 parent 5e1df25 commit 301c56a
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 17 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.

12 changes: 7 additions & 5 deletions mod/data/amd/src/templateseditor.js
Expand Up @@ -42,9 +42,9 @@ prefetchStrings('core', [
*/
const selectors = {
toggleTemplateEditor: 'input[name="useeditor"]',
resetTemplateAction: '[data-action="resettemplate"]',
resetTemplate: 'input[name="defaultform"]',
resetAllTemplates: 'input[name="resetall"]',
resetButton: 'input[name="resetbutton"]',
resetAllCheck: 'input[name="resetallcheck"]',
editForm: '#edittemplateform',
};
Expand All @@ -62,15 +62,17 @@ const registerEventListeners = (instanceId, mode) => {

const registerResetButton = (mode) => {
const editForm = document.querySelector(selectors.editForm);
const resetButton = document.querySelector(selectors.resetButton);
const resetTemplate = document.querySelector(selectors.resetTemplate);
const resetAllTemplates = document.querySelector(selectors.resetAllTemplates);
const resetTemplateAction = document.querySelector(selectors.resetTemplateAction);

if (!resetButton || !resetTemplate || !editForm) {
if (!resetTemplateAction || !resetTemplate || !editForm) {
return;
}

resetButton.addEventListener('click', async(event) => {
prefetchStrings('mod_data', [
mode
]);
resetTemplateAction.addEventListener('click', async(event) => {
event.preventDefault();
const params = {
resetallname: "resetallcheck",
Expand Down

0 comments on commit 301c56a

Please sign in to comment.