MDL-62550 core_privacy: remove theme specific js from retention js
authorJake Dallimore <jake@moodle.com>
Wed, 9 Jan 2019 03:00:43 +0000 (11:00 +0800)
committerJake Dallimore <jake@moodle.com>
Wed, 9 Jan 2019 03:34:28 +0000 (11:34 +0800)
Now that we've fixed the element ids, we no longer need a selector for
each theme. The same selector will work for all themes, whether they be
bs2 or b24 based.

admin/tool/dataprivacy/amd/build/effective_retention_period.min.js
admin/tool/dataprivacy/amd/src/effective_retention_period.js

index 48f7d3c..1fba508 100644 (file)
Binary files a/admin/tool/dataprivacy/amd/build/effective_retention_period.min.js and b/admin/tool/dataprivacy/amd/build/effective_retention_period.min.js differ
index 8d587ca..7e3a102 100644 (file)
@@ -26,8 +26,7 @@ define(['jquery'],
 
         var SELECTORS = {
             PURPOSE_SELECT: '#id_purposeid',
 
         var SELECTORS = {
             PURPOSE_SELECT: '#id_purposeid',
-            RETENTION_FIELD_BOOST: '#id_error_retention_current',
-            RETENTION_FIELD_CLEAN: '#fitem_id_retention_current [data-fieldtype=static]',
+            RETENTION_FIELD: '#fitem_id_retention_current [data-fieldtype=static]',
         };
 
         /**
         };
 
         /**
@@ -65,18 +64,7 @@ define(['jquery'],
             $(SELECTORS.PURPOSE_SELECT).on('change', function(ev) {
                 var selected = $(ev.currentTarget).val();
                 var selectedPurpose = this.purposeRetentionPeriods[selected];
             $(SELECTORS.PURPOSE_SELECT).on('change', function(ev) {
                 var selected = $(ev.currentTarget).val();
                 var selectedPurpose = this.purposeRetentionPeriods[selected];
-
-                var cleanSelector = $(SELECTORS.RETENTION_FIELD_CLEAN);
-                if (cleanSelector.length > 0) {
-                    cleanSelector.text(selectedPurpose);
-                } else {
-                    var boostSelector = $(SELECTORS.RETENTION_FIELD_BOOST);
-                    var retentionField = boostSelector.siblings();
-                    if (retentionField.length > 0) {
-                        retentionField.text(selectedPurpose);
-                    }
-                }
-
+                $(SELECTORS.RETENTION_FIELD).text(selectedPurpose);
             }.bind(this));
         };
 
             }.bind(this));
         };