diff --git a/lib/form/yui/build/moodle-form-shortforms/moodle-form-shortforms-debug.js b/lib/form/yui/build/moodle-form-shortforms/moodle-form-shortforms-debug.js
index 8bc8b847089..86476b2688b 100644
--- a/lib/form/yui/build/moodle-form-shortforms/moodle-form-shortforms-debug.js
+++ b/lib/form/yui/build/moodle-form-shortforms/moodle-form-shortforms-debug.js
@@ -18,7 +18,6 @@ function SHORTFORMS() {
}
var SELECTORS = {
- COLLAPSEEXPAND: '.collapsible-actions .collapseexpand',
COLLAPSED: '.collapsed',
FIELDSETCOLLAPSIBLE: 'fieldset.collapsible',
FIELDSETLEGENDLINK: 'fieldset.collapsible .fheader',
@@ -62,77 +61,19 @@ Y.extend(SHORTFORMS, Y.Base, {
* @protected
*/
initializer: function() {
- var form = Y.one('#' + this.get('formid')),
- fieldlist,
- btn,
- link,
- idlist;
+ var form = Y.one('#' + this.get('formid'));
if (!form) {
Y.log('Could not locate the form', 'warn', 'moodle-form-shortforms');
return;
}
// Stores the form in the object.
this.form = form;
- // Look through collapsible fieldset divs.
- fieldlist = form.all(SELECTORS.FIELDSETCOLLAPSIBLE);
- fieldlist.each(this.process_fieldset, this);
// Subscribe collapsible fieldsets and buttons to click events.
form.delegate('click', this.switch_state, SELECTORS.FIELDSETLEGENDLINK, this);
- form.delegate('key', this.switch_state, 'down:enter,32', SELECTORS.FIELDSETLEGENDLINK, this);
// Handle event, when there's an error in collapsed section.
Y.Global.on(M.core.globalEvents.FORM_ERROR, this.expand_fieldset, this);
-
- // Make the collapse/expand a link.
- btn = form.one(SELECTORS.COLLAPSEEXPAND);
- if (btn) {
- link = Y.Node.create('
');
- link.setHTML(btn.getHTML());
- link.setAttribute('class', btn.getAttribute('class'));
- link.setAttribute('role', 'button');
-
- // Get list of IDs controlled by this button to set the aria-controls attribute.
- idlist = [];
- form.all(SELECTORS.FIELDSETLEGENDLINK).each(function(node) {
- idlist[idlist.length] = node.generateID();
- });
- link.setAttribute('aria-controls', idlist.join(' '));
-
- // Placing the button and binding the event.
- link.on('click', this.set_state_all, this, true);
- link.on('key', this.set_state_all, 'down:enter,32', this, true);
- btn.replace(link);
- this.update_btns(form);
- }
- },
-
- /**
- * Process the supplied fieldset to add appropriate links, and ARIA
- * roles.
- *
- * @method process_fieldset
- * @param {Node} fieldset The Node relating to the fieldset to add collapsing to.
- * @chainable
- */
- process_fieldset: function(fieldset) {
- // Get legend element.
- var legendelement = fieldset.one(SELECTORS.LEGENDFTOGGLER);
-
- // Turn headers to links for accessibility.
- var headerlink = Y.Node.create('
');
- headerlink.addClass(CSS.FHEADER);
- headerlink.appendChild(legendelement.get('firstChild'));
- headerlink.setAttribute('role', 'button');
- headerlink.setAttribute('aria-controls', fieldset.generateID());
- if (legendelement.ancestor(SELECTORS.COLLAPSED)) {
- headerlink.setAttribute('aria-expanded', 'false');
- } else {
- headerlink.setAttribute('aria-expanded', 'true');
- }
- legendelement.prepend(headerlink);
-
- return this;
},
/**
@@ -167,22 +108,6 @@ Y.extend(SHORTFORMS, Y.Base, {
return this;
},
- /**
- * Set the state for all fieldsets in the form.
- *
- * @method set_state_all
- * @param {EventFacade} e
- */
- set_state_all: function(e) {
- e.preventDefault();
- var collapsed = e.target.hasClass(CSS.COLLAPSEALL),
- fieldlist = this.form.all(SELECTORS.FIELDSETCOLLAPSIBLE);
- fieldlist.each(function(node) {
- this.set_state(node, collapsed);
- }, this);
- this.update_btns();
- },
-
/**
* Toggle the state for the fieldset that was clicked.
*
@@ -193,49 +118,8 @@ Y.extend(SHORTFORMS, Y.Base, {
e.preventDefault();
var fieldset = e.target.ancestor(SELECTORS.FIELDSETCOLLAPSIBLE);
this.set_state(fieldset, !fieldset.hasClass(CSS.COLLAPSED));
- this.update_btns();
},
- /**
- * Update the Expand/Collapse all buttons as required.
- *
- * @method update_btns
- * @chainable
- */
- update_btns: function() {
- var btn,
- collapsed = 0,
- expandbtn = false,
- fieldlist;
-
- btn = this.form.one(SELECTORS.COLLAPSEEXPAND);
- if (!btn) {
- return this;
- }
-
- // Counting the number of collapsed sections.
- fieldlist = this.form.all(SELECTORS.FIELDSETCOLLAPSIBLE);
- fieldlist.each(function(node) {
- if (node.hasClass(CSS.COLLAPSED)) {
- collapsed++;
- }
- });
-
- if (collapsed !== 0) {
- expandbtn = true;
- }
-
- // Updating the button.
- if (expandbtn) {
- btn.removeClass(CSS.COLLAPSEALL);
- btn.setHTML(M.util.get_string('expandall', 'moodle'));
- } else {
- btn.addClass(CSS.COLLAPSEALL);
- btn.setHTML(M.util.get_string('collapseall', 'moodle'));
- }
-
- return this;
- },
/**
* Expand the fieldset, which contains an error.
*
diff --git a/lib/form/yui/build/moodle-form-shortforms/moodle-form-shortforms-min.js b/lib/form/yui/build/moodle-form-shortforms/moodle-form-shortforms-min.js
index 7d5ac195d06..8d7a6615134 100644
--- a/lib/form/yui/build/moodle-form-shortforms/moodle-form-shortforms-min.js
+++ b/lib/form/yui/build/moodle-form-shortforms/moodle-form-shortforms-min.js
@@ -1 +1 @@
-YUI.add("moodle-form-shortforms",function(r,e){function t(){t.superclass.constructor.apply(this,arguments)}var o=".collapsible-actions .collapseexpand",a=".collapsed",i="fieldset.collapsible",l="fieldset.collapsible .fheader",n=".fheader",d="legend.ftoggler",c="collapse-all",f="collapsed",h="fheader",s={formid:{value:null}};r.extend(t,r.Base,{form:null,initializer:function(){var e,t,s,a=r.one("#"+this.get("formid"));a&&((this.form=a).all(i).each(this.process_fieldset,this),a.delegate("click",this.switch_state,l,this),a.delegate("key",this.switch_state,"down:enter,32",l,this),r.Global.on(M.core.globalEvents.FORM_ERROR,this.expand_fieldset,this),(e=a.one(o))&&((t=r.Node.create('
')).setHTML(e.getHTML()),t.setAttribute("class",e.getAttribute("class")),t.setAttribute("role","button"),s=[],a.all(l).each(function(e){s[s.length]=e.generateID()}),t.setAttribute("aria-controls",s.join(" ")),t.on("click",this.set_state_all,this,!0),t.on("key",this.set_state_all,"down:enter,32",this,!0),e.replace(t),this.update_btns(a)))},process_fieldset:function(e){var t=e.one(d),s=r.Node.create('
');return s.addClass(h),s.appendChild(t.get("firstChild")),s.setAttribute("role","button"),s.setAttribute("aria-controls",e.generateID()),t.ancestor(a)?s.setAttribute("aria-expanded","false"):s.setAttribute("aria-expanded","true"),t.prepend(s),this},set_state:function(e,t){var s=e.one(n);return t?(e.addClass(f),s&&s.setAttribute("aria-expanded","false")):(e.removeClass(f),s&&s.setAttribute("aria-expanded","true")),(s=this.form.one("input[name=mform_isexpanded_"+e.get("id")+"]"))&&s.set("value",t?0:1),this},set_state_all:function(e){e.preventDefault();var t=e.target.hasClass(c);this.form.all(i).each(function(e){this.set_state(e,t)},this),this.update_btns()},switch_state:function(e){e.preventDefault();e=e.target.ancestor(i);this.set_state(e,!e.hasClass(f)),this.update_btns()},update_btns:function(){var t=0,e=!1,s=this.form.one(o);return s&&(this.form.all(i).each(function(e){e.hasClass(f)&&t++}),(e=0!==t?!0:e)?(s.removeClass(c),s.setHTML(M.util.get_string("expandall","moodle"))):(s.addClass(c),s.setHTML(M.util.get_string("collapseall","moodle")))),this},expand_fieldset:function(e){var t;e.stopPropagation(),e.formid===this.form.getAttribute("id")&&(t=r.one("#"+e.elementid).ancestor("fieldset"))&&this.set_state(t,!1)}},{NAME:"moodle-form-shortforms",ATTRS:s}),M.form=M.form||{},M.form.shortforms=M.form.shortforms||function(e){return new t(e)}},"@VERSION@",{requires:["node","base","selector-css3","moodle-core-event"]});
\ No newline at end of file
+YUI.add("moodle-form-shortforms",function(t,e){function s(){s.superclass.constructor.apply(this,arguments)}var o="fieldset.collapsible",r="fieldset.collapsible .fheader",i=".fheader",a="collapsed",n={formid:{value:null}};t.extend(s,t.Base,{form:null,initializer:function(){var e=t.one("#"+this.get("formid"));e&&((this.form=e).delegate("click",this.switch_state,r,this),t.Global.on(M.core.globalEvents.FORM_ERROR,this.expand_fieldset,this))},set_state:function(e,t){var s=e.one(i);return t?(e.addClass(a),s&&s.setAttribute("aria-expanded","false")):(e.removeClass(a),s&&s.setAttribute("aria-expanded","true")),(s=this.form.one("input[name=mform_isexpanded_"+e.get("id")+"]"))&&s.set("value",t?0:1),this},switch_state:function(e){e.preventDefault();e=e.target.ancestor(o);this.set_state(e,!e.hasClass(a))},expand_fieldset:function(e){e.stopPropagation(),e.formid===this.form.getAttribute("id")&&(e=t.one("#"+e.elementid).ancestor("fieldset"))&&this.set_state(e,!1)}},{NAME:"moodle-form-shortforms",ATTRS:n}),M.form=M.form||{},M.form.shortforms=M.form.shortforms||function(e){return new s(e)}},"@VERSION@",{requires:["node","base","selector-css3","moodle-core-event"]});
\ No newline at end of file
diff --git a/lib/form/yui/build/moodle-form-shortforms/moodle-form-shortforms.js b/lib/form/yui/build/moodle-form-shortforms/moodle-form-shortforms.js
index 29292a33efa..b581418d2c2 100644
--- a/lib/form/yui/build/moodle-form-shortforms/moodle-form-shortforms.js
+++ b/lib/form/yui/build/moodle-form-shortforms/moodle-form-shortforms.js
@@ -18,7 +18,6 @@ function SHORTFORMS() {
}
var SELECTORS = {
- COLLAPSEEXPAND: '.collapsible-actions .collapseexpand',
COLLAPSED: '.collapsed',
FIELDSETCOLLAPSIBLE: 'fieldset.collapsible',
FIELDSETLEGENDLINK: 'fieldset.collapsible .fheader',
@@ -62,76 +61,18 @@ Y.extend(SHORTFORMS, Y.Base, {
* @protected
*/
initializer: function() {
- var form = Y.one('#' + this.get('formid')),
- fieldlist,
- btn,
- link,
- idlist;
+ var form = Y.one('#' + this.get('formid'));
if (!form) {
return;
}
// Stores the form in the object.
this.form = form;
- // Look through collapsible fieldset divs.
- fieldlist = form.all(SELECTORS.FIELDSETCOLLAPSIBLE);
- fieldlist.each(this.process_fieldset, this);
// Subscribe collapsible fieldsets and buttons to click events.
form.delegate('click', this.switch_state, SELECTORS.FIELDSETLEGENDLINK, this);
- form.delegate('key', this.switch_state, 'down:enter,32', SELECTORS.FIELDSETLEGENDLINK, this);
// Handle event, when there's an error in collapsed section.
Y.Global.on(M.core.globalEvents.FORM_ERROR, this.expand_fieldset, this);
-
- // Make the collapse/expand a link.
- btn = form.one(SELECTORS.COLLAPSEEXPAND);
- if (btn) {
- link = Y.Node.create('
');
- link.setHTML(btn.getHTML());
- link.setAttribute('class', btn.getAttribute('class'));
- link.setAttribute('role', 'button');
-
- // Get list of IDs controlled by this button to set the aria-controls attribute.
- idlist = [];
- form.all(SELECTORS.FIELDSETLEGENDLINK).each(function(node) {
- idlist[idlist.length] = node.generateID();
- });
- link.setAttribute('aria-controls', idlist.join(' '));
-
- // Placing the button and binding the event.
- link.on('click', this.set_state_all, this, true);
- link.on('key', this.set_state_all, 'down:enter,32', this, true);
- btn.replace(link);
- this.update_btns(form);
- }
- },
-
- /**
- * Process the supplied fieldset to add appropriate links, and ARIA
- * roles.
- *
- * @method process_fieldset
- * @param {Node} fieldset The Node relating to the fieldset to add collapsing to.
- * @chainable
- */
- process_fieldset: function(fieldset) {
- // Get legend element.
- var legendelement = fieldset.one(SELECTORS.LEGENDFTOGGLER);
-
- // Turn headers to links for accessibility.
- var headerlink = Y.Node.create('
');
- headerlink.addClass(CSS.FHEADER);
- headerlink.appendChild(legendelement.get('firstChild'));
- headerlink.setAttribute('role', 'button');
- headerlink.setAttribute('aria-controls', fieldset.generateID());
- if (legendelement.ancestor(SELECTORS.COLLAPSED)) {
- headerlink.setAttribute('aria-expanded', 'false');
- } else {
- headerlink.setAttribute('aria-expanded', 'true');
- }
- legendelement.prepend(headerlink);
-
- return this;
},
/**
@@ -164,22 +105,6 @@ Y.extend(SHORTFORMS, Y.Base, {
return this;
},
- /**
- * Set the state for all fieldsets in the form.
- *
- * @method set_state_all
- * @param {EventFacade} e
- */
- set_state_all: function(e) {
- e.preventDefault();
- var collapsed = e.target.hasClass(CSS.COLLAPSEALL),
- fieldlist = this.form.all(SELECTORS.FIELDSETCOLLAPSIBLE);
- fieldlist.each(function(node) {
- this.set_state(node, collapsed);
- }, this);
- this.update_btns();
- },
-
/**
* Toggle the state for the fieldset that was clicked.
*
@@ -190,49 +115,8 @@ Y.extend(SHORTFORMS, Y.Base, {
e.preventDefault();
var fieldset = e.target.ancestor(SELECTORS.FIELDSETCOLLAPSIBLE);
this.set_state(fieldset, !fieldset.hasClass(CSS.COLLAPSED));
- this.update_btns();
},
- /**
- * Update the Expand/Collapse all buttons as required.
- *
- * @method update_btns
- * @chainable
- */
- update_btns: function() {
- var btn,
- collapsed = 0,
- expandbtn = false,
- fieldlist;
-
- btn = this.form.one(SELECTORS.COLLAPSEEXPAND);
- if (!btn) {
- return this;
- }
-
- // Counting the number of collapsed sections.
- fieldlist = this.form.all(SELECTORS.FIELDSETCOLLAPSIBLE);
- fieldlist.each(function(node) {
- if (node.hasClass(CSS.COLLAPSED)) {
- collapsed++;
- }
- });
-
- if (collapsed !== 0) {
- expandbtn = true;
- }
-
- // Updating the button.
- if (expandbtn) {
- btn.removeClass(CSS.COLLAPSEALL);
- btn.setHTML(M.util.get_string('expandall', 'moodle'));
- } else {
- btn.addClass(CSS.COLLAPSEALL);
- btn.setHTML(M.util.get_string('collapseall', 'moodle'));
- }
-
- return this;
- },
/**
* Expand the fieldset, which contains an error.
*
diff --git a/lib/form/yui/src/shortforms/js/shortforms.js b/lib/form/yui/src/shortforms/js/shortforms.js
index 032b1d2a482..08916b81ca4 100644
--- a/lib/form/yui/src/shortforms/js/shortforms.js
+++ b/lib/form/yui/src/shortforms/js/shortforms.js
@@ -16,7 +16,6 @@ function SHORTFORMS() {
}
var SELECTORS = {
- COLLAPSEEXPAND: '.collapsible-actions .collapseexpand',
COLLAPSED: '.collapsed',
FIELDSETCOLLAPSIBLE: 'fieldset.collapsible',
FIELDSETLEGENDLINK: 'fieldset.collapsible .fheader',
@@ -60,77 +59,19 @@ Y.extend(SHORTFORMS, Y.Base, {
* @protected
*/
initializer: function() {
- var form = Y.one('#' + this.get('formid')),
- fieldlist,
- btn,
- link,
- idlist;
+ var form = Y.one('#' + this.get('formid'));
if (!form) {
Y.log('Could not locate the form', 'warn', 'moodle-form-shortforms');
return;
}
// Stores the form in the object.
this.form = form;
- // Look through collapsible fieldset divs.
- fieldlist = form.all(SELECTORS.FIELDSETCOLLAPSIBLE);
- fieldlist.each(this.process_fieldset, this);
// Subscribe collapsible fieldsets and buttons to click events.
form.delegate('click', this.switch_state, SELECTORS.FIELDSETLEGENDLINK, this);
- form.delegate('key', this.switch_state, 'down:enter,32', SELECTORS.FIELDSETLEGENDLINK, this);
// Handle event, when there's an error in collapsed section.
Y.Global.on(M.core.globalEvents.FORM_ERROR, this.expand_fieldset, this);
-
- // Make the collapse/expand a link.
- btn = form.one(SELECTORS.COLLAPSEEXPAND);
- if (btn) {
- link = Y.Node.create('
');
- link.setHTML(btn.getHTML());
- link.setAttribute('class', btn.getAttribute('class'));
- link.setAttribute('role', 'button');
-
- // Get list of IDs controlled by this button to set the aria-controls attribute.
- idlist = [];
- form.all(SELECTORS.FIELDSETLEGENDLINK).each(function(node) {
- idlist[idlist.length] = node.generateID();
- });
- link.setAttribute('aria-controls', idlist.join(' '));
-
- // Placing the button and binding the event.
- link.on('click', this.set_state_all, this, true);
- link.on('key', this.set_state_all, 'down:enter,32', this, true);
- btn.replace(link);
- this.update_btns(form);
- }
- },
-
- /**
- * Process the supplied fieldset to add appropriate links, and ARIA
- * roles.
- *
- * @method process_fieldset
- * @param {Node} fieldset The Node relating to the fieldset to add collapsing to.
- * @chainable
- */
- process_fieldset: function(fieldset) {
- // Get legend element.
- var legendelement = fieldset.one(SELECTORS.LEGENDFTOGGLER);
-
- // Turn headers to links for accessibility.
- var headerlink = Y.Node.create('
');
- headerlink.addClass(CSS.FHEADER);
- headerlink.appendChild(legendelement.get('firstChild'));
- headerlink.setAttribute('role', 'button');
- headerlink.setAttribute('aria-controls', fieldset.generateID());
- if (legendelement.ancestor(SELECTORS.COLLAPSED)) {
- headerlink.setAttribute('aria-expanded', 'false');
- } else {
- headerlink.setAttribute('aria-expanded', 'true');
- }
- legendelement.prepend(headerlink);
-
- return this;
},
/**
@@ -165,22 +106,6 @@ Y.extend(SHORTFORMS, Y.Base, {
return this;
},
- /**
- * Set the state for all fieldsets in the form.
- *
- * @method set_state_all
- * @param {EventFacade} e
- */
- set_state_all: function(e) {
- e.preventDefault();
- var collapsed = e.target.hasClass(CSS.COLLAPSEALL),
- fieldlist = this.form.all(SELECTORS.FIELDSETCOLLAPSIBLE);
- fieldlist.each(function(node) {
- this.set_state(node, collapsed);
- }, this);
- this.update_btns();
- },
-
/**
* Toggle the state for the fieldset that was clicked.
*
@@ -191,49 +116,8 @@ Y.extend(SHORTFORMS, Y.Base, {
e.preventDefault();
var fieldset = e.target.ancestor(SELECTORS.FIELDSETCOLLAPSIBLE);
this.set_state(fieldset, !fieldset.hasClass(CSS.COLLAPSED));
- this.update_btns();
},
- /**
- * Update the Expand/Collapse all buttons as required.
- *
- * @method update_btns
- * @chainable
- */
- update_btns: function() {
- var btn,
- collapsed = 0,
- expandbtn = false,
- fieldlist;
-
- btn = this.form.one(SELECTORS.COLLAPSEEXPAND);
- if (!btn) {
- return this;
- }
-
- // Counting the number of collapsed sections.
- fieldlist = this.form.all(SELECTORS.FIELDSETCOLLAPSIBLE);
- fieldlist.each(function(node) {
- if (node.hasClass(CSS.COLLAPSED)) {
- collapsed++;
- }
- });
-
- if (collapsed !== 0) {
- expandbtn = true;
- }
-
- // Updating the button.
- if (expandbtn) {
- btn.removeClass(CSS.COLLAPSEALL);
- btn.setHTML(M.util.get_string('expandall', 'moodle'));
- } else {
- btn.addClass(CSS.COLLAPSEALL);
- btn.setHTML(M.util.get_string('collapseall', 'moodle'));
- }
-
- return this;
- },
/**
* Expand the fieldset, which contains an error.
*
diff --git a/lib/formslib.php b/lib/formslib.php
index 3467779d0c4..7f5228987af 100644
--- a/lib/formslib.php
+++ b/lib/formslib.php
@@ -3022,10 +3022,6 @@ class MoodleQuickForm_Renderer extends HTML_QuickForm_Renderer_Tableless{
*/
var $_openHiddenFieldsetTemplate = "\n\t
";
- /** @var string Header Template string */
- var $_headerTemplate =
- "\n\t\t
{header} \n\t\t
\n\t\t";
-
/** @var string Template used when opening a fieldset */
var $_openFieldsetTemplate = "\n\t
";
@@ -3122,7 +3118,7 @@ class MoodleQuickForm_Renderer extends HTML_QuickForm_Renderer_Tableless{
* @param MoodleQuickForm $form reference of the form
*/
function startForm(&$form){
- global $PAGE;
+ global $PAGE, $OUTPUT;
$this->_reqHTML = $form->getReqHTML();
$this->_elementTemplates = str_replace('{req}', $this->_reqHTML, $this->_elementTemplates);
$this->_advancedHTML = $form->getAdvancedHTML();
@@ -3144,8 +3140,7 @@ class MoodleQuickForm_Renderer extends HTML_QuickForm_Renderer_Tableless{
}
if (!empty($this->_collapsibleElements)) {
if (count($this->_collapsibleElements) > 1) {
- $this->_collapseButtons = $this->_collapseButtonsTemplate;
- $this->_collapseButtons = str_replace('{strexpandall}', get_string('expandall'), $this->_collapseButtons);
+ $this->_collapseButtons = $OUTPUT->render_from_template('core_form/collapsesections', (object)[]);
}
$PAGE->requires->yui_module('moodle-form-shortforms', 'M.form.shortforms', array(array('formid' => $formid)));
}
@@ -3327,18 +3322,29 @@ class MoodleQuickForm_Renderer extends HTML_QuickForm_Renderer_Tableless{
* @global moodle_page $PAGE
*/
function renderHeader(&$header) {
- global $PAGE;
+ global $PAGE, $OUTPUT;
$header->_generateId();
$name = $header->getName();
+ $collapsed = $collapseable = '';
+ if (isset($this->_collapsibleElements[$header->getName()])) {
+ $collapseable = true;
+ $collapsed = $this->_collapsibleElements[$header->getName()];
+ }
+
$id = empty($name) ? '' : ' id="' . $header->getAttribute('id') . '"';
- if (is_null($header->_text)) {
- $header_html = '';
- } elseif (!empty($name) && isset($this->_templates[$name])) {
- $header_html = str_replace('{header}', $header->toHtml(), $this->_templates[$name]);
+ if (!empty($name) && isset($this->_templates[$name])) {
+ $headerhtml = str_replace('{header}', $header->toHtml(), $this->_templates[$name]);
} else {
- $header_html = str_replace('{header}', $header->toHtml(), $this->_headerTemplate);
+ $headerhtml = $OUTPUT->render_from_template('core_form/element-header',
+ (object)[
+ 'header' => $header->toHtml(),
+ 'id' => $header->getAttribute('id'),
+ 'collapseable' => $collapseable,
+ 'collapsed' => $collapsed,
+ 'helpbutton' => $header->getHelpButton(),
+ ]);
}
if ($this->_fieldsetsOpen > 0) {
@@ -3363,7 +3369,7 @@ class MoodleQuickForm_Renderer extends HTML_QuickForm_Renderer_Tableless{
$openFieldsetTemplate = str_replace('{id}', $id, $this->_openFieldsetTemplate);
$openFieldsetTemplate = str_replace('{classes}', join(' ', $fieldsetclasses), $openFieldsetTemplate);
- $this->_html .= $openFieldsetTemplate . $header_html;
+ $this->_html .= $openFieldsetTemplate . $headerhtml;
$this->_fieldsetsOpen++;
}
diff --git a/lib/tests/behat/behat_forms.php b/lib/tests/behat/behat_forms.php
index 2a3689819fb..915088d022f 100644
--- a/lib/tests/behat/behat_forms.php
+++ b/lib/tests/behat/behat_forms.php
@@ -143,18 +143,19 @@ class behat_forms extends behat_base {
// We already know that we waited for the DOM and the JS to be loaded, even the editor
// so, we will use the reduced timeout as it is a common task and we should save time.
try {
-
+ $this->wait_for_pending_js();
// Expand all fieldsets link - which will only be there if there is more than one collapsible section.
$expandallxpath = "//div[@class='collapsible-actions']" .
- "//a[contains(concat(' ', @class, ' '), ' collapseexpand ')]" .
- "[not(contains(concat(' ', @class, ' '), ' collapse-all '))]";
+ "//a[contains(concat(' ', @class, ' '), ' collapsed ')]" .
+ "//span[contains(concat(' ', @class, ' '), ' expandall ')]";
// Else, look for the first expand fieldset link.
$expandonlysection = "//legend[@class='ftoggler']" .
- "//a[contains(concat(' ', @class, ' '), ' fheader ') and @aria-expanded = 'false']";
+ "//a[contains(concat(' ', @class, ' '), ' icons-collapse-expand ') and @aria-expanded = 'false']";
$collapseexpandlink = $this->find('xpath', $expandallxpath . '|' . $expandonlysection,
false, false, behat_base::get_reduced_timeout());
$collapseexpandlink->click();
+ $this->wait_for_pending_js();
} catch (ElementNotFoundException $e) {
// The behat_base::find() method throws an exception if there are no elements,
diff --git a/mod/wiki/tests/behat/wiki_activity_completion.feature b/mod/wiki/tests/behat/wiki_activity_completion.feature
index 4a48dc9452a..07f6fcc2142 100644
--- a/mod/wiki/tests/behat/wiki_activity_completion.feature
+++ b/mod/wiki/tests/behat/wiki_activity_completion.feature
@@ -52,6 +52,7 @@ Feature: View activity completion information in the Wiki activity
And I am on the "Music history" "wiki activity editing" page
And I expand all fieldsets
And I press "Unlock completion options"
+ And I expand all fieldsets
And I set the field "Completion tracking" to "Students can manually mark the activity as completed"
And I press "Save and display"
# Teacher view.
diff --git a/report/outline/tests/behat/filter.feature b/report/outline/tests/behat/filter.feature
index 5cde5088c38..62acb65e051 100644
--- a/report/outline/tests/behat/filter.feature
+++ b/report/outline/tests/behat/filter.feature
@@ -54,7 +54,7 @@ Feature: Filter an outline report
| filterstartdate[day] | 12 |
| filterstartdate[month] | June |
| filterstartdate[year] | 2017 |
- And I press "Filter"
+ And I click on "Filter" "button" in the "#fgroup_id_buttonar" "css_element"
Then I should see "1 views by 1 users" in the "Book name" "table_row"
And I should see "1 views by 1 users" in the "Forum name" "table_row"
@@ -87,6 +87,6 @@ Feature: Filter an outline report
| filterenddate[day] | 11 |
| filterenddate[month] | June |
| filterenddate[year] | 2017 |
- And I press "Filter"
+ And I click on "Filter" "button" in the "#fgroup_id_buttonar" "css_element"
Then I should see "1 views by 1 users" in the "Book name" "table_row"
And I should not see "views by" in the "Forum name" "table_row"
diff --git a/search/tests/behat/behat_search.php b/search/tests/behat/behat_search.php
index a96536ac1a3..7699408069c 100644
--- a/search/tests/behat/behat_search.php
+++ b/search/tests/behat/behat_search.php
@@ -51,7 +51,8 @@ class behat_search extends behat_base {
$this->execute('behat_forms::i_set_the_field_to', ['q', $query]);
// Submit the form.
- $this->execute_script('return document.querySelector(".searchform-navbar").submit();');
+ $this->execute("behat_general::i_click_on_in_the",
+ [get_string('search', 'core'), 'button', '#usernavigation', 'css_element']);
}
/**
diff --git a/theme/boost/scss/moodle/core.scss b/theme/boost/scss/moodle/core.scss
index 9ae4d4cff94..3f081d84476 100644
--- a/theme/boost/scss/moodle/core.scss
+++ b/theme/boost/scss/moodle/core.scss
@@ -319,19 +319,6 @@ a.autolink.glossary:hover {
display: block;
}
-.collapsible-actions .collapseexpand {
- padding-left: 20px;
- background: url([[pix:t/collapsed]]) 2px center no-repeat;
-}
-/*rtl:raw:
-.collapsible-actions .collapseexpand {
- background: url([[pix:t/collapsed_rtl]]) right center no-repeat;
-}
-*/
-.collapsible-actions .collapse-all {
- background-image: url([[pix:t/expanded]]);
-}
-
.yui-overlay .yui-widget-bd {
background-color: #ffee69;
border: 1px solid #a6982b;
diff --git a/theme/boost/scss/moodle/forms.scss b/theme/boost/scss/moodle/forms.scss
index bca4d68d48a..857c558ff07 100644
--- a/theme/boost/scss/moodle/forms.scss
+++ b/theme/boost/scss/moodle/forms.scss
@@ -58,10 +58,6 @@
width: auto;
}
-.jsenabled .mform .collapsed .fcontainer {
- display: none;
-}
-
#adminsettings .error {
color: $danger;
}
@@ -290,7 +286,7 @@ fieldset.coursesearchbox label {
overflow: auto;
margin: $dropdown-spacer 0 0;
padding: $dropdown-padding-y 0;
- z-index: 1;
+ z-index: 2;
}
.form-autocomplete-suggestions li {
@@ -441,23 +437,13 @@ textarea[data-auto-rows] {
flex-grow: 1;
}
-@include media-breakpoint-up(sm) {
- .mform fieldset.collapsible legend a.fheader {
- padding: 0 5px 0 ($spacer * 1.5);
- background: url([[pix:t/expanded]]) 0 center no-repeat;
- }
-
- .mform fieldset.collapsed legend a.fheader {
- /*rtl:raw:
- background-image: url([[pix:t/collapsed_rtl]]);
- */
- /*rtl:remove*/
- background-image: url([[pix:t/collapsed]]);
- }
- .mform fieldset.collapsible .col-form-label {
+@include media-breakpoint-up(md) {
+ .mform fieldset .fcontainer.collapseable .col-form-label {
padding-left: ($spacer * 2.5);
}
+}
+@include media-breakpoint-up(sm) {
.mform {
.form-inline {
.fdefaultcustom {
@@ -469,6 +455,26 @@ textarea[data-auto-rows] {
}
}
+.collapsemenu {
+ .collapseall {
+ display: block;
+ }
+
+ .expandall {
+ display: none;
+ }
+
+ &.collapsed {
+ .collapseall {
+ display: none;
+ }
+
+ .expandall {
+ display: block;
+ }
+ }
+}
+
// Form inset on the left/right.
// Used to display an icon/button within the form control.
.input-group {
diff --git a/theme/boost/style/moodle.css b/theme/boost/style/moodle.css
index b9ffcd2abda..e96824292d0 100644
--- a/theme/boost/style/moodle.css
+++ b/theme/boost/style/moodle.css
@@ -10133,18 +10133,6 @@ a.autolink.glossary:hover {
.jsenabled .collapsible-actions {
display: block; }
-.collapsible-actions .collapseexpand {
- padding-left: 20px;
- background: url([[pix:t/collapsed]]) 2px center no-repeat; }
-
-/*rtl:raw:
-.collapsible-actions .collapseexpand {
- background: url([[pix:t/collapsed_rtl]]) right center no-repeat;
-}
-*/
-.collapsible-actions .collapse-all {
- background-image: url([[pix:t/expanded]]); }
-
.yui-overlay .yui-widget-bd {
background-color: #ffee69;
border: 1px solid #a6982b;
@@ -17282,9 +17270,6 @@ body.path-question-type .mform fieldset.hidden {
#adminsettings .form-control[size] {
width: auto; }
-.jsenabled .mform .collapsed .fcontainer {
- display: none; }
-
#adminsettings .error {
color: #ca3120; }
@@ -17467,7 +17452,7 @@ fieldset.coursesearchbox label {
overflow: auto;
margin: 0.125rem 0 0;
padding: 0.5rem 0;
- z-index: 1; }
+ z-index: 2; }
.form-autocomplete-suggestions li {
list-style-type: none;
@@ -17576,21 +17561,26 @@ textarea[data-auto-rows] {
[data-fieldtype="editor"] > div {
flex-grow: 1; }
+@media (min-width: 768px) {
+ .mform fieldset .fcontainer.collapseable .col-form-label {
+ padding-left: 2.5rem; } }
+
@media (min-width: 576px) {
- .mform fieldset.collapsible legend a.fheader {
- padding: 0 5px 0 1.5rem;
- background: url([[pix:t/expanded]]) 0 center no-repeat; }
- .mform fieldset.collapsed legend a.fheader {
- /*rtl:raw:
- background-image: url([[pix:t/collapsed_rtl]]);
- */
- /*rtl:remove*/
- background-image: url([[pix:t/collapsed]]); }
- .mform fieldset.collapsible .col-form-label {
- padding-left: 2.5rem; }
.mform .form-inline .fdefaultcustom label {
justify-content: initial; } }
+.collapsemenu .collapseall {
+ display: block; }
+
+.collapsemenu .expandall {
+ display: none; }
+
+.collapsemenu.collapsed .collapseall {
+ display: none; }
+
+.collapsemenu.collapsed .expandall {
+ display: block; }
+
.input-group.form-inset .form-inset-item {
position: absolute;
padding-top: calc(0.375rem + 1px);
diff --git a/theme/classic/style/moodle.css b/theme/classic/style/moodle.css
index 0b074281110..d956b1ec87f 100644
--- a/theme/classic/style/moodle.css
+++ b/theme/classic/style/moodle.css
@@ -10133,18 +10133,6 @@ a.autolink.glossary:hover {
.jsenabled .collapsible-actions {
display: block; }
-.collapsible-actions .collapseexpand {
- padding-left: 20px;
- background: url([[pix:t/collapsed]]) 2px center no-repeat; }
-
-/*rtl:raw:
-.collapsible-actions .collapseexpand {
- background: url([[pix:t/collapsed_rtl]]) right center no-repeat;
-}
-*/
-.collapsible-actions .collapse-all {
- background-image: url([[pix:t/expanded]]); }
-
.yui-overlay .yui-widget-bd {
background-color: #ffee69;
border: 1px solid #a6982b;
@@ -17282,9 +17270,6 @@ body.path-question-type .mform fieldset.hidden {
#adminsettings .form-control[size] {
width: auto; }
-.jsenabled .mform .collapsed .fcontainer {
- display: none; }
-
#adminsettings .error {
color: #ca3120; }
@@ -17467,7 +17452,7 @@ fieldset.coursesearchbox label {
overflow: auto;
margin: 0.125rem 0 0;
padding: 0.5rem 0;
- z-index: 1; }
+ z-index: 2; }
.form-autocomplete-suggestions li {
list-style-type: none;
@@ -17576,21 +17561,26 @@ textarea[data-auto-rows] {
[data-fieldtype="editor"] > div {
flex-grow: 1; }
+@media (min-width: 768px) {
+ .mform fieldset .fcontainer.collapseable .col-form-label {
+ padding-left: 2.5rem; } }
+
@media (min-width: 576px) {
- .mform fieldset.collapsible legend a.fheader {
- padding: 0 5px 0 1.5rem;
- background: url([[pix:t/expanded]]) 0 center no-repeat; }
- .mform fieldset.collapsed legend a.fheader {
- /*rtl:raw:
- background-image: url([[pix:t/collapsed_rtl]]);
- */
- /*rtl:remove*/
- background-image: url([[pix:t/collapsed]]); }
- .mform fieldset.collapsible .col-form-label {
- padding-left: 2.5rem; }
.mform .form-inline .fdefaultcustom label {
justify-content: initial; } }
+.collapsemenu .collapseall {
+ display: block; }
+
+.collapsemenu .expandall {
+ display: none; }
+
+.collapsemenu.collapsed .collapseall {
+ display: none; }
+
+.collapsemenu.collapsed .expandall {
+ display: block; }
+
.input-group.form-inset .form-inset-item {
position: absolute;
padding-top: calc(0.375rem + 1px);