MDL-62550 core_privacy: remove theme specific js from retention js

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.
This commit is contained in:
Jake Dallimore 2019-01-09 11:00:43 +08:00
parent e6f068722d
commit 0dd2bca8ef
2 changed files with 3 additions and 15 deletions

View File

@ -1 +1 @@
define(["jquery"],function(a){var b={PURPOSE_SELECT:"#id_purposeid",RETENTION_FIELD_BOOST:"#id_error_retention_current",RETENTION_FIELD_CLEAN:"#fitem_id_retention_current [data-fieldtype=static]"},c=function(a){this.purposeRetentionPeriods=a,this.registerEventListeners()},d=function(){a(b.PURPOSE_SELECT).off("change")};return c.prototype.purposeRetentionPeriods=[],c.prototype.registerEventListeners=function(){a(b.PURPOSE_SELECT).on("change",function(c){var d=a(c.currentTarget).val(),e=this.purposeRetentionPeriods[d],f=a(b.RETENTION_FIELD_CLEAN);if(f.length>0)f.text(e);else{var g=a(b.RETENTION_FIELD_BOOST),h=g.siblings();h.length>0&&h.text(e)}}.bind(this))},{init:function(a){return d(),new c(a)}}});
define(["jquery"],function(a){var b={PURPOSE_SELECT:"#id_purposeid",RETENTION_FIELD:"#fitem_id_retention_current [data-fieldtype=static]"},c=function(a){this.purposeRetentionPeriods=a,this.registerEventListeners()},d=function(){a(b.PURPOSE_SELECT).off("change")};return c.prototype.purposeRetentionPeriods=[],c.prototype.registerEventListeners=function(){a(b.PURPOSE_SELECT).on("change",function(c){var d=a(c.currentTarget).val(),e=this.purposeRetentionPeriods[d];a(b.RETENTION_FIELD).text(e)}.bind(this))},{init:function(a){return d(),new c(a)}}});

View File

@ -26,8 +26,7 @@ define(['jquery'],
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];
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));
};