MDL-63187 tool_dataprivacy: Fix delete button text
authorJun Pataleta <jun@moodle.com>
Mon, 20 Aug 2018 09:04:04 +0000 (17:04 +0800)
committerJun Pataleta <jun@moodle.com>
Tue, 21 Aug 2018 08:18:55 +0000 (16:18 +0800)
* 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.

admin/tool/dataprivacy/amd/build/categoriesactions.min.js
admin/tool/dataprivacy/amd/build/purposesactions.min.js
admin/tool/dataprivacy/amd/src/categoriesactions.js
admin/tool/dataprivacy/amd/src/purposesactions.js
admin/tool/dataprivacy/lang/en/tool_dataprivacy.php
admin/tool/dataprivacy/templates/categories.mustache
admin/tool/dataprivacy/templates/purposes.mustache

index 66e3b0a..cac33a4 100644 (file)
Binary files a/admin/tool/dataprivacy/amd/build/categoriesactions.min.js and b/admin/tool/dataprivacy/amd/build/categoriesactions.min.js differ
index 0b15981..33b773c 100644 (file)
Binary files a/admin/tool/dataprivacy/amd/build/purposesactions.min.js and b/admin/tool/dataprivacy/amd/build/purposesactions.min.js differ
index c40a1a7..6d05977 100644 (file)
@@ -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() {
index fd92141..05abf71 100644 (file)
@@ -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() {
index 3c1c31c..da31030 100644 (file)
@@ -77,11 +77,11 @@ $string['datecomment'] = '[{$a->date}]: ' . PHP_EOL . ' {$a->comment}';
 $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';
index 5bf63fb..ef31041 100644 (file)
@@ -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>
index 6e6c855..4461eab 100644 (file)
@@ -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>