MDL-76974 javascript: convert remaining uses of old preferences API.
Implement component preference definition callbacks, update JS code to use the `core_user/repository` module instead of the now deprecated API.
This commit is contained in:
@@ -160,7 +160,9 @@ M.util.CollapsibleRegion = function(Y, id, userpref, strtooltip) {
|
||||
animation.set('reverse', this.div.hasClass('collapsed'));
|
||||
// Update the user preference.
|
||||
if (this.userpref) {
|
||||
M.util.set_user_preference(this.userpref, !this.div.hasClass('collapsed'));
|
||||
require(['core_user/repository'], function(UserRepository) {
|
||||
UserRepository.setUserPreference(this.userpref, !this.div.hasClass('collapsed'));
|
||||
}.bind(this));
|
||||
}
|
||||
animation.run();
|
||||
}, this, animation);
|
||||
@@ -577,7 +579,9 @@ M.util.init_block_hider = function(Y, config) {
|
||||
}
|
||||
},
|
||||
updateState : function(e, hide) {
|
||||
M.util.set_user_preference(this.get('preference'), hide);
|
||||
require(['core_user/repository'], function(UserRepository) {
|
||||
UserRepository.setUserPreference(this.get('preference'), hide);
|
||||
}.bind(this));
|
||||
if (hide) {
|
||||
this.get('block').addClass('hidden');
|
||||
this.get('block').one('.block-hider-show').focus();
|
||||
|
||||
Reference in New Issue
Block a user