Línea 360... |
Línea 360... |
360 |
submitevent : null,
|
360 |
submitevent : null,
|
361 |
initializer : function() {
|
361 |
initializer : function() {
|
362 |
var i, m = this.get(MANIPULATOR);
|
362 |
var i, m = this.get(MANIPULATOR);
|
363 |
var element = Y.Node.create('<div class="popover popover-bottom"><div class="arrow"></div>' +
|
363 |
var element = Y.Node.create('<div class="popover popover-bottom"><div class="arrow"></div>' +
|
364 |
'<div class="header popover-title">' +
|
364 |
'<div class="header popover-title">' +
|
365 |
'<div role="button" class="close" aria-label="' +
|
365 |
'<div role="button" class="btn-close" aria-label="' +
|
366 |
M.util.get_string('closebuttontitle', 'moodle') + '">' +
|
366 |
M.util.get_string('closebuttontitle', 'moodle') + '">' +
|
367 |
'<span aria-hidden="true">×</span></div>' +
|
367 |
'</div>' +
|
368 |
'<h3>'+M.util.get_string('assignroles', 'role')+'</h3>' +
|
368 |
'<h3>'+M.util.get_string('assignroles', 'role')+'</h3>' +
|
369 |
'</div><div class="content popover-content' +
|
369 |
'</div><div class="content popover-content' +
|
370 |
' d-flex flex-wrap align-items-center mb-3"></div></div>');
|
370 |
' d-flex flex-wrap align-items-center mb-3"></div></div>');
|
371 |
var content = element.one('.content');
|
371 |
var content = element.one('.content');
|
372 |
var roles = m.get(ASSIGNABLEROLES);
|
372 |
var roles = m.get(ASSIGNABLEROLES);
|
373 |
for (i in roles) {
|
373 |
for (i in roles) {
|
374 |
var buttonid = 'add_assignable_role_' + roles[i].id;
|
374 |
var buttonid = 'add_assignable_role_' + roles[i].id;
|
375 |
var buttonhtml = '<input type="button" class="btn btn-secondary mr-1" value="' +
|
375 |
var buttonhtml = '<input type="button" class="btn btn-secondary me-1" value="' +
|
376 |
roles[i].name + '" id="' + buttonid + '" />';
|
376 |
roles[i].name + '" id="' + buttonid + '" />';
|
377 |
var button = Y.Node.create(buttonhtml);
|
377 |
var button = Y.Node.create(buttonhtml);
|
378 |
button.on('click', this.submit, this, roles[i].id);
|
378 |
button.on('click', this.submit, this, roles[i].id);
|
379 |
content.append(button);
|
379 |
content.append(button);
|
380 |
}
|
380 |
}
|
381 |
Y.one(document.body).append(element);
|
381 |
Y.one(document.body).append(element);
|
382 |
this.set('elementNode', element);
|
382 |
this.set('elementNode', element);
|
383 |
this.set('contentNode', content);
|
383 |
this.set('contentNode', content);
|
384 |
element.one('.header .close').on('click', this.hide, this);
|
384 |
element.one('.header .btn-close').on('click', this.hide, this);
|
385 |
},
|
385 |
},
|
386 |
display : function(user) {
|
386 |
display : function(user) {
|
387 |
var currentroles = user.get(CURRENTROLES), node = null;
|
387 |
var currentroles = user.get(CURRENTROLES), node = null;
|
388 |
for (var i in currentroles) {
|
388 |
for (var i in currentroles) {
|
389 |
if (currentroles[i] === true) {
|
389 |
if (currentroles[i] === true) {
|