Skip to content

Commit

Permalink
MDL-63187 tool_dataprivacy: Fix delete button text
Browse files Browse the repository at this point in the history
* No need to add the purpose/category name for the delete button itself
* Fix delete confirmation lang strings.
* Add button titles to Add purpose/category buttons so they can be
  clicked on when running Behat tests.
  • Loading branch information
junpataleta committed Aug 23, 2018
1 parent 8987e22 commit f423dd8
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 14 deletions.
2 changes: 1 addition & 1 deletion admin/tool/dataprivacy/amd/build/categoriesactions.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 admin/tool/dataprivacy/amd/build/purposesactions.min.js

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

9 changes: 6 additions & 3 deletions admin/tool/dataprivacy/amd/src/categoriesactions.js
Expand Up @@ -58,25 +58,28 @@ function($, Ajax, Notification, Str, ModalFactory, ModalEvents) {
var stringkeys = [
{
key: 'deletecategory',
component: 'tool_dataprivacy',
param: categoryname
component: 'tool_dataprivacy'
},
{
key: 'deletecategorytext',
component: 'tool_dataprivacy',
param: categoryname
},
{
key: 'delete'
}
];

Str.get_strings(stringkeys).then(function(langStrings) {
var title = langStrings[0];
var confirmMessage = langStrings[1];
var buttonText = langStrings[2];
return ModalFactory.create({
title: title,
body: confirmMessage,
type: ModalFactory.types.SAVE_CANCEL
}).then(function(modal) {
modal.setSaveButtonText(title);
modal.setSaveButtonText(buttonText);

// Handle save event.
modal.getRoot().on(ModalEvents.save, function() {
Expand Down
9 changes: 6 additions & 3 deletions admin/tool/dataprivacy/amd/src/purposesactions.js
Expand Up @@ -58,25 +58,28 @@ function($, Ajax, Notification, Str, ModalFactory, ModalEvents) {
var stringkeys = [
{
key: 'deletepurpose',
component: 'tool_dataprivacy',
param: purposename
component: 'tool_dataprivacy'
},
{
key: 'deletepurposetext',
component: 'tool_dataprivacy',
param: purposename
},
{
key: 'delete'
}
];

Str.get_strings(stringkeys).then(function(langStrings) {
var title = langStrings[0];
var confirmMessage = langStrings[1];
var buttonText = langStrings[2];
return ModalFactory.create({
title: title,
body: confirmMessage,
type: ModalFactory.types.SAVE_CANCEL
}).then(function(modal) {
modal.setSaveButtonText(title);
modal.setSaveButtonText(buttonText);

// Handle save event.
modal.getRoot().on(ModalEvents.save, function() {
Expand Down
8 changes: 4 additions & 4 deletions admin/tool/dataprivacy/lang/en/tool_dataprivacy.php
Expand Up @@ -77,11 +77,11 @@
$string['daterequested'] = 'Date requested';
$string['daterequesteddetail'] = 'Date requested:';
$string['defaultsinfo'] = 'Default categories and purposes are applied to all newly created instances.';
$string['deletecategory'] = 'Delete "{$a}" category';
$string['deletecategorytext'] = 'Are you sure you want to delete "{$a}" category?';
$string['deletecategory'] = 'Delete category';
$string['deletecategorytext'] = 'Are you sure you want to delete the category "{$a}"?';
$string['deleteexpiredcontextstask'] = 'Delete expired contexts';
$string['deletepurpose'] = 'Delete "{$a}" purpose';
$string['deletepurposetext'] = 'Are you sure you want to delete "{$a}" purpose?';
$string['deletepurpose'] = 'Delete purpose';
$string['deletepurposetext'] = 'Are you sure you want to delete the purpose "{$a}"?';
$string['defaultssaved'] = 'Defaults saved';
$string['deny'] = 'Deny';
$string['denyrequest'] = 'Deny request';
Expand Down
2 changes: 1 addition & 1 deletion admin/tool/dataprivacy/templates/categories.mustache
Expand Up @@ -53,7 +53,7 @@
<div data-region="categories" class="m-t-3 m-b-1">
<h3>{{#str}}categories, tool_dataprivacy{{/str}}</h3>
<div class="m-y-1">
<button class="btn btn-secondary" data-add-element="category">
<button class="btn btn-secondary" data-add-element="category" title="{{#str}}addcategory, tool_dataprivacy{{/str}}">
{{#pix}}t/add, moodle, {{#str}}addcategory, tool_dataprivacy{{/str}}{{/pix}}
</button>
</div>
Expand Down
2 changes: 1 addition & 1 deletion admin/tool/dataprivacy/templates/purposes.mustache
Expand Up @@ -60,7 +60,7 @@
<div data-region="purposes" class="m-t-3 m-b-1">
<h3>{{#str}}purposes, tool_dataprivacy{{/str}}</h3>
<div class="m-y-1">
<button class="btn btn-secondary" data-add-element="purpose">
<button class="btn btn-secondary" data-add-element="purpose" title="{{#str}}addpurpose, tool_dataprivacy{{/str}}">
{{#pix}}t/add, moodle, {{#str}}addpurpose, tool_dataprivacy{{/str}}{{/pix}}
</button>
</div>
Expand Down

0 comments on commit f423dd8

Please sign in to comment.