mirror of
https://github.com/moodle/moodle.git
synced 2025-01-18 05:58:34 +01:00
Merge branch 'MDL-61061_hideif_group' of git://github.com/davosmith/moodle
This commit is contained in:
commit
168fc2d9ec
@ -282,6 +282,8 @@ if (typeof M.form.dependencyManager === 'undefined') {
|
||||
var els = this.elementsByName(name, true);
|
||||
els.each(function(node) {
|
||||
var e = node.ancestor('.fitem', true);
|
||||
var label = null,
|
||||
id = null;
|
||||
if (e) {
|
||||
// Cope with differences between clean and boost themes.
|
||||
if (e.hasClass('fitem_fgroup')) {
|
||||
@ -298,6 +300,22 @@ if (typeof M.form.dependencyManager === 'undefined') {
|
||||
e.setStyles({
|
||||
display: (hidden) ? 'none' : ''
|
||||
});
|
||||
|
||||
// Hide/unhide the label as well.
|
||||
id = node.get('id');
|
||||
if (id) {
|
||||
label = Y.all('label[for="' + id + '"]');
|
||||
if (label) {
|
||||
if (hidden) {
|
||||
label.setAttribute('hidden', 'hidden');
|
||||
} else {
|
||||
label.removeAttribute('hidden');
|
||||
}
|
||||
label.setStyles({
|
||||
display: (hidden) ? 'none' : ''
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
|
@ -2837,13 +2837,13 @@ class MoodleQuickForm_Renderer extends HTML_QuickForm_Renderer_Tableless{
|
||||
// switch next two lines for ol li containers for form items.
|
||||
// $this->_elementTemplates=array('default'=>"\n\t\t".'<li class="fitem"><label>{label}{help}<!-- BEGIN required -->{req}<!-- END required --></label><div class="qfelement<!-- BEGIN error --> error<!-- END error --> {typeclass}"><!-- BEGIN error --><span class="error">{error}</span><br /><!-- END error -->{element}</div></li>');
|
||||
$this->_elementTemplates = array(
|
||||
'default' => "\n\t\t".'<div id="{id}" class="fitem {advanced}<!-- BEGIN required --> required<!-- END required --> fitem_{typeclass} {emptylabel} {class}" {aria-live}><div class="fitemtitle"><label>{label}<!-- BEGIN required -->{req}<!-- END required -->{advancedimg} </label>{help}</div><div class="felement {typeclass}<!-- BEGIN error --> error<!-- END error -->" data-fieldtype="{type}"><!-- BEGIN error --><span class="error" tabindex="0">{error}</span><br /><!-- END error -->{element}</div></div>',
|
||||
'default' => "\n\t\t".'<div id="{id}" class="fitem {advanced}<!-- BEGIN required --> required<!-- END required --> fitem_{typeclass} {emptylabel} {class}" {aria-live} {groupname}><div class="fitemtitle"><label>{label}<!-- BEGIN required -->{req}<!-- END required -->{advancedimg} </label>{help}</div><div class="felement {typeclass}<!-- BEGIN error --> error<!-- END error -->" data-fieldtype="{type}"><!-- BEGIN error --><span class="error" tabindex="0">{error}</span><br /><!-- END error -->{element}</div></div>',
|
||||
|
||||
'actionbuttons' => "\n\t\t".'<div id="{id}" class="fitem fitem_actionbuttons fitem_{typeclass} {class}"><div class="felement {typeclass}" data-fieldtype="{type}">{element}</div></div>',
|
||||
'actionbuttons' => "\n\t\t".'<div id="{id}" class="fitem fitem_actionbuttons fitem_{typeclass} {class}" {groupname}><div class="felement {typeclass}" data-fieldtype="{type}">{element}</div></div>',
|
||||
|
||||
'fieldset' => "\n\t\t".'<div id="{id}" class="fitem {advanced} {class}<!-- BEGIN required --> required<!-- END required --> fitem_{typeclass} {emptylabel}"><div class="fitemtitle"><div class="fgrouplabel"><label>{label}<!-- BEGIN required -->{req}<!-- END required -->{advancedimg} </label>{help}</div></div><fieldset class="felement {typeclass}<!-- BEGIN error --> error<!-- END error -->" data-fieldtype="{type}"><!-- BEGIN error --><span class="error" tabindex="0">{error}</span><br /><!-- END error -->{element}</fieldset></div>',
|
||||
'fieldset' => "\n\t\t".'<div id="{id}" class="fitem {advanced} {class}<!-- BEGIN required --> required<!-- END required --> fitem_{typeclass} {emptylabel}" {groupname}><div class="fitemtitle"><div class="fgrouplabel"><label>{label}<!-- BEGIN required -->{req}<!-- END required -->{advancedimg} </label>{help}</div></div><fieldset class="felement {typeclass}<!-- BEGIN error --> error<!-- END error -->" data-fieldtype="{type}"><!-- BEGIN error --><span class="error" tabindex="0">{error}</span><br /><!-- END error -->{element}</fieldset></div>',
|
||||
|
||||
'static' => "\n\t\t".'<div id="{id}" class="fitem {advanced} {emptylabel} {class}"><div class="fitemtitle"><div class="fstaticlabel">{label}<!-- BEGIN required -->{req}<!-- END required -->{advancedimg} {help}</div></div><div class="felement fstatic <!-- BEGIN error --> error<!-- END error -->" data-fieldtype="static"><!-- BEGIN error --><span class="error" tabindex="0">{error}</span><br /><!-- END error -->{element}</div></div>',
|
||||
'static' => "\n\t\t".'<div id="{id}" class="fitem {advanced} {emptylabel} {class}" {groupname}><div class="fitemtitle"><div class="fstaticlabel">{label}<!-- BEGIN required -->{req}<!-- END required -->{advancedimg} {help}</div></div><div class="felement fstatic <!-- BEGIN error --> error<!-- END error -->" data-fieldtype="static"><!-- BEGIN error --><span class="error" tabindex="0">{error}</span><br /><!-- END error -->{element}</div></div>',
|
||||
|
||||
'warning' => "\n\t\t".'<div id="{id}" class="fitem {advanced} {emptylabel} {class}">{element}</div>',
|
||||
|
||||
@ -2966,6 +2966,7 @@ class MoodleQuickForm_Renderer extends HTML_QuickForm_Renderer_Tableless{
|
||||
}
|
||||
$html = str_replace('{id}', $group->getAttribute('id'), $html);
|
||||
$html = str_replace('{name}', $group->getName(), $html);
|
||||
$html = str_replace('{groupname}', 'data-groupname="'.$group->getName().'"', $html);
|
||||
$html = str_replace('{typeclass}', 'fgroup', $html);
|
||||
$html = str_replace('{type}', 'group', $html);
|
||||
$html = str_replace('{class}', $group->getAttribute('class'), $html);
|
||||
@ -3033,6 +3034,7 @@ class MoodleQuickForm_Renderer extends HTML_QuickForm_Renderer_Tableless{
|
||||
$html = str_replace('{typeclass}', 'f' . $element->getType(), $html);
|
||||
$html = str_replace('{type}', $element->getType(), $html);
|
||||
$html = str_replace('{name}', $element->getName(), $html);
|
||||
$html = str_replace('{groupname}', '', $html);
|
||||
$html = str_replace('{class}', $element->getAttribute('class'), $html);
|
||||
$emptylabel = '';
|
||||
if ($element->getLabel() == '') {
|
||||
|
Loading…
x
Reference in New Issue
Block a user