mirror of
https://github.com/moodle/moodle.git
synced 2025-04-21 00:12:56 +02:00
MDL-72737 theme_boost: update for section header styles
This commit is contained in:
parent
9cd77c4130
commit
2faf5e8e48
@ -16,12 +16,12 @@ Feature: Purge caches
|
||||
Scenario: Purge selected caches
|
||||
Given I should not see "Selected caches were purged"
|
||||
When I set the field "Themes" to "1"
|
||||
And I press "Purge selected caches"
|
||||
And I click on "Purge selected caches" "button" in the "#fitem_id_purgeselectedcaches" "css_element"
|
||||
Then I should see "The selected caches were purged"
|
||||
|
||||
Scenario: Purge selected caches without selecting any caches
|
||||
Given I should not see "Select one or more caches to purge"
|
||||
When I press "Purge selected caches"
|
||||
And I click on "Purge selected caches" "button" in the "#fitem_id_purgeselectedcaches" "css_element"
|
||||
Then I should not see "The selected caches were purged"
|
||||
And I should see "Select one or more caches to purge"
|
||||
|
||||
|
@ -30,6 +30,7 @@ Feature: Edit completion settings of an activity
|
||||
When I am on the TestPage "Page Activity editing" page
|
||||
And I expand all fieldsets
|
||||
And I press "Unlock completion options"
|
||||
And I expand all fieldsets
|
||||
Then I should see "Completion options unlocked"
|
||||
And I set the field "Completion tracking" to "Students can manually mark the activity as completed"
|
||||
And I press "Save and display"
|
||||
|
@ -172,8 +172,8 @@ Feature: Collapse course sections
|
||||
When I navigate to "Settings" in current page administration
|
||||
And I expand all fieldsets
|
||||
And I set the following fields to these values:
|
||||
| Format | Weekly format |
|
||||
| Course layout | Show one section per page |
|
||||
| Format | Weekly format |
|
||||
And I press "Save and display"
|
||||
And "[data-toggle=collapse]" "css_element" should not exist in the "region-main" "region"
|
||||
And I click on "8 May - 14 May" "link" in the "region-main" "region"
|
||||
|
@ -80,7 +80,6 @@ function atto_h5p_strings_for_js() {
|
||||
);
|
||||
|
||||
$PAGE->requires->strings_for_js($strings, 'atto_h5p');
|
||||
$PAGE->requires->strings_for_js(['expand', 'collapse'], 'moodle');
|
||||
$PAGE->requires->js(autoloader::get_h5p_core_library_url('js/h5p-resizer.js'));
|
||||
}
|
||||
|
||||
|
||||
|
@ -93,9 +93,29 @@ var CSS = {
|
||||
'{{/if}}' +
|
||||
'</div>' +
|
||||
'{{#if canUpload}}' +
|
||||
'<fieldset class="collapsible {{#if collapseOptions}}collapsed{{/if}}" id="{{elementid}}_h5poptions">' +
|
||||
'<legend class="ftoggler">{{get_string "h5poptions" component}}</legend>' +
|
||||
'<div class="fcontainer">' +
|
||||
'<fieldset class="mt-2 collapsible" id="{{elementid}}_h5poptions">' +
|
||||
'<legend class="d-flex align-items-center px-1">' +
|
||||
'<div class="position-relative d-flex ftoggler align-items-center position-relative mr-1">' +
|
||||
'<a role="button" data-toggle="collapse" href="#h5poptions"' +
|
||||
'aria-expanded="{{#if showOptions}}true{{/if}}{{^if showOptions}}false{{/if}}"' +
|
||||
'aria-controls="h5poptions"' +
|
||||
'class="btn btn-icon mr-1 icons-collapse-expand stretched-link fheader collapsed">' +
|
||||
'<span class="expanded-icon icon-no-margin p-2"' +
|
||||
'title="{{get_string "collapse" "moodle"}}">' +
|
||||
'<i class="icon fa fa-chevron-down fa-fw " aria-hidden="true"></i>' +
|
||||
'</span>' +
|
||||
'<span class="collapsed-icon icon-no-margin p-2"' +
|
||||
'title="{{get_string "expand" "moodle"}}">' +
|
||||
'<i class="icon fa fa-chevron-right fa-fw " aria-hidden="true"></i>' +
|
||||
'</span>' +
|
||||
'<span class="sr-only">{{get_string "h5poptions" component}}</span>' +
|
||||
'</a>' +
|
||||
'<h3 class="d-flex align-self-stretch align-items-center mb-0" aria-hidden="true">' +
|
||||
'{{get_string "h5poptions" component}}' +
|
||||
'</h3>' +
|
||||
'</div>' +
|
||||
'</legend>' +
|
||||
'<div id="h5poptions" class="fcontainer collapseable collapse px-1 {{#if showOptions}}show{{/if}}">' +
|
||||
'<div class="form-check">' +
|
||||
'<input type="checkbox" {{optionDownloadButton}} ' +
|
||||
'class="form-check-input {{CSS.OPTION_DOWNLOAD_BUTTON}}"' +
|
||||
@ -311,7 +331,7 @@ Y.namespace('M.atto_h5p').Button = Y.Base.create('button', Y.M.editor_atto.Edito
|
||||
optionDownloadButton,
|
||||
optionEmbedButton,
|
||||
optionCopyrightButton,
|
||||
collapseOptions = true;
|
||||
showOptions = false;
|
||||
|
||||
if (this._H5PDiv) {
|
||||
var H5PURL = this._H5PDiv.get('innerHTML');
|
||||
@ -323,17 +343,17 @@ Y.namespace('M.atto_h5p').Button = Y.Base.create('button', Y.M.editor_atto.Edito
|
||||
if (parameters) {
|
||||
if (parameters.match(/export=1/)) {
|
||||
optionDownloadButton = 'checked';
|
||||
collapseOptions = false;
|
||||
showOptions = true;
|
||||
}
|
||||
|
||||
if (parameters.match(/embed=1/)) {
|
||||
optionEmbedButton = 'checked';
|
||||
collapseOptions = false;
|
||||
showOptions = true;
|
||||
}
|
||||
|
||||
if (parameters.match(/copyright=1/)) {
|
||||
optionCopyrightButton = 'checked';
|
||||
collapseOptions = false;
|
||||
showOptions = true;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@ -349,7 +369,7 @@ Y.namespace('M.atto_h5p').Button = Y.Base.create('button', Y.M.editor_atto.Edito
|
||||
canUpload: permissions.canUpload,
|
||||
canEmbed: permissions.canEmbed,
|
||||
canUploadAndEmbed: permissions.canUploadAndEmbed,
|
||||
collapseOptions: collapseOptions,
|
||||
showOptions: showOptions,
|
||||
fileURL: fileURL,
|
||||
optionDownloadButton: optionDownloadButton,
|
||||
optionEmbedButton: optionEmbedButton,
|
||||
|
File diff suppressed because one or more lines are too long
@ -93,9 +93,29 @@ var CSS = {
|
||||
'{{/if}}' +
|
||||
'</div>' +
|
||||
'{{#if canUpload}}' +
|
||||
'<fieldset class="collapsible {{#if collapseOptions}}collapsed{{/if}}" id="{{elementid}}_h5poptions">' +
|
||||
'<legend class="ftoggler">{{get_string "h5poptions" component}}</legend>' +
|
||||
'<div class="fcontainer">' +
|
||||
'<fieldset class="mt-2 collapsible" id="{{elementid}}_h5poptions">' +
|
||||
'<legend class="d-flex align-items-center px-1">' +
|
||||
'<div class="position-relative d-flex ftoggler align-items-center position-relative mr-1">' +
|
||||
'<a role="button" data-toggle="collapse" href="#h5poptions"' +
|
||||
'aria-expanded="{{#if showOptions}}true{{/if}}{{^if showOptions}}false{{/if}}"' +
|
||||
'aria-controls="h5poptions"' +
|
||||
'class="btn btn-icon mr-1 icons-collapse-expand stretched-link fheader collapsed">' +
|
||||
'<span class="expanded-icon icon-no-margin p-2"' +
|
||||
'title="{{get_string "collapse" "moodle"}}">' +
|
||||
'<i class="icon fa fa-chevron-down fa-fw " aria-hidden="true"></i>' +
|
||||
'</span>' +
|
||||
'<span class="collapsed-icon icon-no-margin p-2"' +
|
||||
'title="{{get_string "expand" "moodle"}}">' +
|
||||
'<i class="icon fa fa-chevron-right fa-fw " aria-hidden="true"></i>' +
|
||||
'</span>' +
|
||||
'<span class="sr-only">{{get_string "h5poptions" component}}</span>' +
|
||||
'</a>' +
|
||||
'<h3 class="d-flex align-self-stretch align-items-center mb-0" aria-hidden="true">' +
|
||||
'{{get_string "h5poptions" component}}' +
|
||||
'</h3>' +
|
||||
'</div>' +
|
||||
'</legend>' +
|
||||
'<div id="h5poptions" class="fcontainer collapseable collapse px-1 {{#if showOptions}}show{{/if}}">' +
|
||||
'<div class="form-check">' +
|
||||
'<input type="checkbox" {{optionDownloadButton}} ' +
|
||||
'class="form-check-input {{CSS.OPTION_DOWNLOAD_BUTTON}}"' +
|
||||
@ -311,7 +331,7 @@ Y.namespace('M.atto_h5p').Button = Y.Base.create('button', Y.M.editor_atto.Edito
|
||||
optionDownloadButton,
|
||||
optionEmbedButton,
|
||||
optionCopyrightButton,
|
||||
collapseOptions = true;
|
||||
showOptions = false;
|
||||
|
||||
if (this._H5PDiv) {
|
||||
var H5PURL = this._H5PDiv.get('innerHTML');
|
||||
@ -323,17 +343,17 @@ Y.namespace('M.atto_h5p').Button = Y.Base.create('button', Y.M.editor_atto.Edito
|
||||
if (parameters) {
|
||||
if (parameters.match(/export=1/)) {
|
||||
optionDownloadButton = 'checked';
|
||||
collapseOptions = false;
|
||||
showOptions = true;
|
||||
}
|
||||
|
||||
if (parameters.match(/embed=1/)) {
|
||||
optionEmbedButton = 'checked';
|
||||
collapseOptions = false;
|
||||
showOptions = true;
|
||||
}
|
||||
|
||||
if (parameters.match(/copyright=1/)) {
|
||||
optionCopyrightButton = 'checked';
|
||||
collapseOptions = false;
|
||||
showOptions = true;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@ -349,7 +369,7 @@ Y.namespace('M.atto_h5p').Button = Y.Base.create('button', Y.M.editor_atto.Edito
|
||||
canUpload: permissions.canUpload,
|
||||
canEmbed: permissions.canEmbed,
|
||||
canUploadAndEmbed: permissions.canUploadAndEmbed,
|
||||
collapseOptions: collapseOptions,
|
||||
showOptions: showOptions,
|
||||
fileURL: fileURL,
|
||||
optionDownloadButton: optionDownloadButton,
|
||||
optionEmbedButton: optionEmbedButton,
|
||||
|
@ -91,9 +91,29 @@ var CSS = {
|
||||
'{{/if}}' +
|
||||
'</div>' +
|
||||
'{{#if canUpload}}' +
|
||||
'<fieldset class="collapsible {{#if collapseOptions}}collapsed{{/if}}" id="{{elementid}}_h5poptions">' +
|
||||
'<legend class="ftoggler">{{get_string "h5poptions" component}}</legend>' +
|
||||
'<div class="fcontainer">' +
|
||||
'<fieldset class="mt-2 collapsible" id="{{elementid}}_h5poptions">' +
|
||||
'<legend class="d-flex align-items-center px-1">' +
|
||||
'<div class="position-relative d-flex ftoggler align-items-center position-relative mr-1">' +
|
||||
'<a role="button" data-toggle="collapse" href="#h5poptions"' +
|
||||
'aria-expanded="{{#if showOptions}}true{{/if}}{{^if showOptions}}false{{/if}}"' +
|
||||
'aria-controls="h5poptions"' +
|
||||
'class="btn btn-icon mr-1 icons-collapse-expand stretched-link fheader collapsed">' +
|
||||
'<span class="expanded-icon icon-no-margin p-2"' +
|
||||
'title="{{get_string "collapse" "moodle"}}">' +
|
||||
'<i class="icon fa fa-chevron-down fa-fw " aria-hidden="true"></i>' +
|
||||
'</span>' +
|
||||
'<span class="collapsed-icon icon-no-margin p-2"' +
|
||||
'title="{{get_string "expand" "moodle"}}">' +
|
||||
'<i class="icon fa fa-chevron-right fa-fw " aria-hidden="true"></i>' +
|
||||
'</span>' +
|
||||
'<span class="sr-only">{{get_string "h5poptions" component}}</span>' +
|
||||
'</a>' +
|
||||
'<h3 class="d-flex align-self-stretch align-items-center mb-0" aria-hidden="true">' +
|
||||
'{{get_string "h5poptions" component}}' +
|
||||
'</h3>' +
|
||||
'</div>' +
|
||||
'</legend>' +
|
||||
'<div id="h5poptions" class="fcontainer collapseable collapse px-1 {{#if showOptions}}show{{/if}}">' +
|
||||
'<div class="form-check">' +
|
||||
'<input type="checkbox" {{optionDownloadButton}} ' +
|
||||
'class="form-check-input {{CSS.OPTION_DOWNLOAD_BUTTON}}"' +
|
||||
@ -309,7 +329,7 @@ Y.namespace('M.atto_h5p').Button = Y.Base.create('button', Y.M.editor_atto.Edito
|
||||
optionDownloadButton,
|
||||
optionEmbedButton,
|
||||
optionCopyrightButton,
|
||||
collapseOptions = true;
|
||||
showOptions = false;
|
||||
|
||||
if (this._H5PDiv) {
|
||||
var H5PURL = this._H5PDiv.get('innerHTML');
|
||||
@ -321,17 +341,17 @@ Y.namespace('M.atto_h5p').Button = Y.Base.create('button', Y.M.editor_atto.Edito
|
||||
if (parameters) {
|
||||
if (parameters.match(/export=1/)) {
|
||||
optionDownloadButton = 'checked';
|
||||
collapseOptions = false;
|
||||
showOptions = true;
|
||||
}
|
||||
|
||||
if (parameters.match(/embed=1/)) {
|
||||
optionEmbedButton = 'checked';
|
||||
collapseOptions = false;
|
||||
showOptions = true;
|
||||
}
|
||||
|
||||
if (parameters.match(/copyright=1/)) {
|
||||
optionCopyrightButton = 'checked';
|
||||
collapseOptions = false;
|
||||
showOptions = true;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@ -347,7 +367,7 @@ Y.namespace('M.atto_h5p').Button = Y.Base.create('button', Y.M.editor_atto.Edito
|
||||
canUpload: permissions.canUpload,
|
||||
canEmbed: permissions.canEmbed,
|
||||
canUploadAndEmbed: permissions.canUploadAndEmbed,
|
||||
collapseOptions: collapseOptions,
|
||||
showOptions: showOptions,
|
||||
fileURL: fileURL,
|
||||
optionDownloadButton: optionDownloadButton,
|
||||
optionEmbedButton: optionEmbedButton,
|
||||
|
@ -80,6 +80,7 @@ function atto_media_strings_for_js() {
|
||||
'videowidth',
|
||||
'width'),
|
||||
'atto_media');
|
||||
$PAGE->requires->strings_for_js(array('expand', 'collapse'), 'moodle');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -162,22 +162,22 @@ var COMPONENTNAME = 'atto_media',
|
||||
' addcomponentlabel="addsource" multisource="true" addsourcehelp=helpStrings.addsource}}' +
|
||||
'<fieldset class="collapsible collapsed" id="{{elementid}}_video-display-options">' +
|
||||
'<input name="mform_isexpanded_{{elementid}}_video-display-options" type="hidden">' +
|
||||
'<legend class="ftoggler">{{get_string "displayoptions" component}}</legend>' +
|
||||
'<div class="fcontainer">' +
|
||||
'{{renderPartial "form_components.section" context=this id="vdisplayoptions" name="displayoptions"}}' +
|
||||
'<div id="vdisplayoptions" class="fcontainer collapseable collapse px-1">' +
|
||||
'{{renderPartial "form_components.display_options" context=this id=CSS.VIDEO mediatype_video=true}}' +
|
||||
'</div>' +
|
||||
'</fieldset>' +
|
||||
'<fieldset class="collapsible collapsed" id="{{elementid}}_video-advanced-settings">' +
|
||||
'<input name="mform_isexpanded_{{elementid}}_video-advanced-settings" type="hidden">' +
|
||||
'<legend class="ftoggler">{{get_string "advancedsettings" component}}</legend>' +
|
||||
'<div class="fcontainer">' +
|
||||
'{{renderPartial "form_components.section" context=this id="vadvancedsettings" name="advancedsettings"}}' +
|
||||
'<div id="vadvancedsettings" class="fcontainer collapseable collapse px-1">' +
|
||||
'{{renderPartial "form_components.advanced_settings" context=this id=CSS.VIDEO}}' +
|
||||
'</div>' +
|
||||
'</fieldset>' +
|
||||
'<fieldset class="collapsible collapsed" id="{{elementid}}_video-tracks">' +
|
||||
'<input name="mform_isexpanded_{{elementid}}_video-tracks" type="hidden">' +
|
||||
'<legend class="ftoggler">{{get_string "tracks" component}} {{{helpStrings.tracks}}}</legend>' +
|
||||
'<div class="fcontainer">' +
|
||||
'{{renderPartial "form_components.section" context=this id="vtracks" name="tracks" help=helpStrings.tracks}}' +
|
||||
'<div id="vtracks" class="fcontainer collapseable collapse px-1">' +
|
||||
'{{renderPartial "form_components.track_tabs" context=this id=CSS.VIDEO}}' +
|
||||
'</div>' +
|
||||
'</fieldset>',
|
||||
@ -186,22 +186,22 @@ var COMPONENTNAME = 'atto_media',
|
||||
' addcomponentlabel="addsource" multisource="true" addsourcehelp=helpStrings.addsource}}' +
|
||||
'<fieldset class="collapsible collapsed" id="{{elementid}}_audio-display-options">' +
|
||||
'<input name="mform_isexpanded_{{elementid}}_audio-display-options" type="hidden">' +
|
||||
'<legend class="ftoggler">{{get_string "displayoptions" component}}</legend>' +
|
||||
'<div class="fcontainer">' +
|
||||
'{{renderPartial "form_components.section" context=this id="adisplayoptions" name="displayoptions"}}' +
|
||||
'<div id="adisplayoptions" class="fcontainer collapseable collapse px-1">' +
|
||||
'{{renderPartial "form_components.display_options" context=this id=CSS.AUDIO}}' +
|
||||
'</div>' +
|
||||
'</fieldset>' +
|
||||
'<fieldset class="collapsible collapsed" id="{{elementid}}_audio-advanced-settings">' +
|
||||
'<input name="mform_isexpanded_{{elementid}}_audio-advanced-settings" type="hidden">' +
|
||||
'<legend class="ftoggler">{{get_string "advancedsettings" component}}</legend>' +
|
||||
'<div class="fcontainer">' +
|
||||
'{{renderPartial "form_components.section" context=this id="aadvancedsettings" name="advancedsettings"}}' +
|
||||
'<div id="aadvancedsettings" class="fcontainer collapseable collapse px-1">' +
|
||||
'{{renderPartial "form_components.advanced_settings" context=this id=CSS.AUDIO}}' +
|
||||
'</div>' +
|
||||
'</fieldset>' +
|
||||
'<fieldset class="collapsible collapsed" id="{{elementid}}_audio-tracks">' +
|
||||
'<input name="mform_isexpanded_{{elementid}}_audio-tracks" type="hidden">' +
|
||||
'<legend class="ftoggler">{{get_string "tracks" component}} {{{helpStrings.tracks}}}</legend>' +
|
||||
'<div class="fcontainer">' +
|
||||
'{{renderPartial "form_components.section" context=this id="atracks" name="tracks" help=helpStrings.tracks}}' +
|
||||
'<div id="atracks" class="fcontainer collapseable collapse px-1">' +
|
||||
'{{renderPartial "form_components.track_tabs" context=this id=CSS.AUDIO}}' +
|
||||
'</div>' +
|
||||
'</fieldset>'
|
||||
@ -383,7 +383,27 @@ var COMPONENTNAME = 'atto_media',
|
||||
'<label class="form-check-label">{{get_string "default" component}}</label>' +
|
||||
'</div>' +
|
||||
'{{renderPartial "form_components.add_component" context=this label=addcomponentlabel}}' +
|
||||
'</div>'
|
||||
'</div>',
|
||||
SECTION: '' +
|
||||
'<legend class="d-flex align-items-center px-1">' +
|
||||
'<div class="position-relative d-flex ftoggler align-items-center position-relative mr-1">' +
|
||||
'<a role="button" data-toggle="collapse" href="#{{id}}" aria-expanded="false"' +
|
||||
'aria-controls="{{id}}"' +
|
||||
'class="btn btn-icon mr-1 icons-collapse-expand stretched-link fheader collapsed">' +
|
||||
'<span class="expanded-icon icon-no-margin p-2" title="{{get_string "collapse" "moodle"}}">' +
|
||||
'<i class="icon fa fa-chevron-down fa-fw " aria-hidden="true"></i>' +
|
||||
'</span>' +
|
||||
'<span class="collapsed-icon icon-no-margin p-2" title="{{get_string "expand" "moodle"}}">' +
|
||||
'<i class="icon fa fa-chevron-right fa-fw " aria-hidden="true"></i>' +
|
||||
'</span>' +
|
||||
'<span class="sr-only">{{get_string name component}}</span>' +
|
||||
'</a>' +
|
||||
'<h3 class="d-flex align-self-stretch align-items-center mb-0" aria-hidden="true">' +
|
||||
'{{get_string name component}}' +
|
||||
'</h3>' +
|
||||
'</div>' +
|
||||
'{{#help}}{{{../help}}}{{/help}}' +
|
||||
'</legend>'
|
||||
},
|
||||
HTML_MEDIA: {
|
||||
VIDEO: '' +
|
||||
|
File diff suppressed because one or more lines are too long
@ -162,22 +162,22 @@ var COMPONENTNAME = 'atto_media',
|
||||
' addcomponentlabel="addsource" multisource="true" addsourcehelp=helpStrings.addsource}}' +
|
||||
'<fieldset class="collapsible collapsed" id="{{elementid}}_video-display-options">' +
|
||||
'<input name="mform_isexpanded_{{elementid}}_video-display-options" type="hidden">' +
|
||||
'<legend class="ftoggler">{{get_string "displayoptions" component}}</legend>' +
|
||||
'<div class="fcontainer">' +
|
||||
'{{renderPartial "form_components.section" context=this id="vdisplayoptions" name="displayoptions"}}' +
|
||||
'<div id="vdisplayoptions" class="fcontainer collapseable collapse px-1">' +
|
||||
'{{renderPartial "form_components.display_options" context=this id=CSS.VIDEO mediatype_video=true}}' +
|
||||
'</div>' +
|
||||
'</fieldset>' +
|
||||
'<fieldset class="collapsible collapsed" id="{{elementid}}_video-advanced-settings">' +
|
||||
'<input name="mform_isexpanded_{{elementid}}_video-advanced-settings" type="hidden">' +
|
||||
'<legend class="ftoggler">{{get_string "advancedsettings" component}}</legend>' +
|
||||
'<div class="fcontainer">' +
|
||||
'{{renderPartial "form_components.section" context=this id="vadvancedsettings" name="advancedsettings"}}' +
|
||||
'<div id="vadvancedsettings" class="fcontainer collapseable collapse px-1">' +
|
||||
'{{renderPartial "form_components.advanced_settings" context=this id=CSS.VIDEO}}' +
|
||||
'</div>' +
|
||||
'</fieldset>' +
|
||||
'<fieldset class="collapsible collapsed" id="{{elementid}}_video-tracks">' +
|
||||
'<input name="mform_isexpanded_{{elementid}}_video-tracks" type="hidden">' +
|
||||
'<legend class="ftoggler">{{get_string "tracks" component}} {{{helpStrings.tracks}}}</legend>' +
|
||||
'<div class="fcontainer">' +
|
||||
'{{renderPartial "form_components.section" context=this id="vtracks" name="tracks" help=helpStrings.tracks}}' +
|
||||
'<div id="vtracks" class="fcontainer collapseable collapse px-1">' +
|
||||
'{{renderPartial "form_components.track_tabs" context=this id=CSS.VIDEO}}' +
|
||||
'</div>' +
|
||||
'</fieldset>',
|
||||
@ -186,22 +186,22 @@ var COMPONENTNAME = 'atto_media',
|
||||
' addcomponentlabel="addsource" multisource="true" addsourcehelp=helpStrings.addsource}}' +
|
||||
'<fieldset class="collapsible collapsed" id="{{elementid}}_audio-display-options">' +
|
||||
'<input name="mform_isexpanded_{{elementid}}_audio-display-options" type="hidden">' +
|
||||
'<legend class="ftoggler">{{get_string "displayoptions" component}}</legend>' +
|
||||
'<div class="fcontainer">' +
|
||||
'{{renderPartial "form_components.section" context=this id="adisplayoptions" name="displayoptions"}}' +
|
||||
'<div id="adisplayoptions" class="fcontainer collapseable collapse px-1">' +
|
||||
'{{renderPartial "form_components.display_options" context=this id=CSS.AUDIO}}' +
|
||||
'</div>' +
|
||||
'</fieldset>' +
|
||||
'<fieldset class="collapsible collapsed" id="{{elementid}}_audio-advanced-settings">' +
|
||||
'<input name="mform_isexpanded_{{elementid}}_audio-advanced-settings" type="hidden">' +
|
||||
'<legend class="ftoggler">{{get_string "advancedsettings" component}}</legend>' +
|
||||
'<div class="fcontainer">' +
|
||||
'{{renderPartial "form_components.section" context=this id="aadvancedsettings" name="advancedsettings"}}' +
|
||||
'<div id="aadvancedsettings" class="fcontainer collapseable collapse px-1">' +
|
||||
'{{renderPartial "form_components.advanced_settings" context=this id=CSS.AUDIO}}' +
|
||||
'</div>' +
|
||||
'</fieldset>' +
|
||||
'<fieldset class="collapsible collapsed" id="{{elementid}}_audio-tracks">' +
|
||||
'<input name="mform_isexpanded_{{elementid}}_audio-tracks" type="hidden">' +
|
||||
'<legend class="ftoggler">{{get_string "tracks" component}} {{{helpStrings.tracks}}}</legend>' +
|
||||
'<div class="fcontainer">' +
|
||||
'{{renderPartial "form_components.section" context=this id="atracks" name="tracks" help=helpStrings.tracks}}' +
|
||||
'<div id="atracks" class="fcontainer collapseable collapse px-1">' +
|
||||
'{{renderPartial "form_components.track_tabs" context=this id=CSS.AUDIO}}' +
|
||||
'</div>' +
|
||||
'</fieldset>'
|
||||
@ -383,7 +383,27 @@ var COMPONENTNAME = 'atto_media',
|
||||
'<label class="form-check-label">{{get_string "default" component}}</label>' +
|
||||
'</div>' +
|
||||
'{{renderPartial "form_components.add_component" context=this label=addcomponentlabel}}' +
|
||||
'</div>'
|
||||
'</div>',
|
||||
SECTION: '' +
|
||||
'<legend class="d-flex align-items-center px-1">' +
|
||||
'<div class="position-relative d-flex ftoggler align-items-center position-relative mr-1">' +
|
||||
'<a role="button" data-toggle="collapse" href="#{{id}}" aria-expanded="false"' +
|
||||
'aria-controls="{{id}}"' +
|
||||
'class="btn btn-icon mr-1 icons-collapse-expand stretched-link fheader collapsed">' +
|
||||
'<span class="expanded-icon icon-no-margin p-2" title="{{get_string "collapse" "moodle"}}">' +
|
||||
'<i class="icon fa fa-chevron-down fa-fw " aria-hidden="true"></i>' +
|
||||
'</span>' +
|
||||
'<span class="collapsed-icon icon-no-margin p-2" title="{{get_string "expand" "moodle"}}">' +
|
||||
'<i class="icon fa fa-chevron-right fa-fw " aria-hidden="true"></i>' +
|
||||
'</span>' +
|
||||
'<span class="sr-only">{{get_string name component}}</span>' +
|
||||
'</a>' +
|
||||
'<h3 class="d-flex align-self-stretch align-items-center mb-0" aria-hidden="true">' +
|
||||
'{{get_string name component}}' +
|
||||
'</h3>' +
|
||||
'</div>' +
|
||||
'{{#help}}{{{../help}}}{{/help}}' +
|
||||
'</legend>'
|
||||
},
|
||||
HTML_MEDIA: {
|
||||
VIDEO: '' +
|
||||
|
@ -160,22 +160,22 @@ var COMPONENTNAME = 'atto_media',
|
||||
' addcomponentlabel="addsource" multisource="true" addsourcehelp=helpStrings.addsource}}' +
|
||||
'<fieldset class="collapsible collapsed" id="{{elementid}}_video-display-options">' +
|
||||
'<input name="mform_isexpanded_{{elementid}}_video-display-options" type="hidden">' +
|
||||
'<legend class="ftoggler">{{get_string "displayoptions" component}}</legend>' +
|
||||
'<div class="fcontainer">' +
|
||||
'{{renderPartial "form_components.section" context=this id="vdisplayoptions" name="displayoptions"}}' +
|
||||
'<div id="vdisplayoptions" class="fcontainer collapseable collapse px-1">' +
|
||||
'{{renderPartial "form_components.display_options" context=this id=CSS.VIDEO mediatype_video=true}}' +
|
||||
'</div>' +
|
||||
'</fieldset>' +
|
||||
'<fieldset class="collapsible collapsed" id="{{elementid}}_video-advanced-settings">' +
|
||||
'<input name="mform_isexpanded_{{elementid}}_video-advanced-settings" type="hidden">' +
|
||||
'<legend class="ftoggler">{{get_string "advancedsettings" component}}</legend>' +
|
||||
'<div class="fcontainer">' +
|
||||
'{{renderPartial "form_components.section" context=this id="vadvancedsettings" name="advancedsettings"}}' +
|
||||
'<div id="vadvancedsettings" class="fcontainer collapseable collapse px-1">' +
|
||||
'{{renderPartial "form_components.advanced_settings" context=this id=CSS.VIDEO}}' +
|
||||
'</div>' +
|
||||
'</fieldset>' +
|
||||
'<fieldset class="collapsible collapsed" id="{{elementid}}_video-tracks">' +
|
||||
'<input name="mform_isexpanded_{{elementid}}_video-tracks" type="hidden">' +
|
||||
'<legend class="ftoggler">{{get_string "tracks" component}} {{{helpStrings.tracks}}}</legend>' +
|
||||
'<div class="fcontainer">' +
|
||||
'{{renderPartial "form_components.section" context=this id="vtracks" name="tracks" help=helpStrings.tracks}}' +
|
||||
'<div id="vtracks" class="fcontainer collapseable collapse px-1">' +
|
||||
'{{renderPartial "form_components.track_tabs" context=this id=CSS.VIDEO}}' +
|
||||
'</div>' +
|
||||
'</fieldset>',
|
||||
@ -184,22 +184,22 @@ var COMPONENTNAME = 'atto_media',
|
||||
' addcomponentlabel="addsource" multisource="true" addsourcehelp=helpStrings.addsource}}' +
|
||||
'<fieldset class="collapsible collapsed" id="{{elementid}}_audio-display-options">' +
|
||||
'<input name="mform_isexpanded_{{elementid}}_audio-display-options" type="hidden">' +
|
||||
'<legend class="ftoggler">{{get_string "displayoptions" component}}</legend>' +
|
||||
'<div class="fcontainer">' +
|
||||
'{{renderPartial "form_components.section" context=this id="adisplayoptions" name="displayoptions"}}' +
|
||||
'<div id="adisplayoptions" class="fcontainer collapseable collapse px-1">' +
|
||||
'{{renderPartial "form_components.display_options" context=this id=CSS.AUDIO}}' +
|
||||
'</div>' +
|
||||
'</fieldset>' +
|
||||
'<fieldset class="collapsible collapsed" id="{{elementid}}_audio-advanced-settings">' +
|
||||
'<input name="mform_isexpanded_{{elementid}}_audio-advanced-settings" type="hidden">' +
|
||||
'<legend class="ftoggler">{{get_string "advancedsettings" component}}</legend>' +
|
||||
'<div class="fcontainer">' +
|
||||
'{{renderPartial "form_components.section" context=this id="aadvancedsettings" name="advancedsettings"}}' +
|
||||
'<div id="aadvancedsettings" class="fcontainer collapseable collapse px-1">' +
|
||||
'{{renderPartial "form_components.advanced_settings" context=this id=CSS.AUDIO}}' +
|
||||
'</div>' +
|
||||
'</fieldset>' +
|
||||
'<fieldset class="collapsible collapsed" id="{{elementid}}_audio-tracks">' +
|
||||
'<input name="mform_isexpanded_{{elementid}}_audio-tracks" type="hidden">' +
|
||||
'<legend class="ftoggler">{{get_string "tracks" component}} {{{helpStrings.tracks}}}</legend>' +
|
||||
'<div class="fcontainer">' +
|
||||
'{{renderPartial "form_components.section" context=this id="atracks" name="tracks" help=helpStrings.tracks}}' +
|
||||
'<div id="atracks" class="fcontainer collapseable collapse px-1">' +
|
||||
'{{renderPartial "form_components.track_tabs" context=this id=CSS.AUDIO}}' +
|
||||
'</div>' +
|
||||
'</fieldset>'
|
||||
@ -381,7 +381,27 @@ var COMPONENTNAME = 'atto_media',
|
||||
'<label class="form-check-label">{{get_string "default" component}}</label>' +
|
||||
'</div>' +
|
||||
'{{renderPartial "form_components.add_component" context=this label=addcomponentlabel}}' +
|
||||
'</div>'
|
||||
'</div>',
|
||||
SECTION: '' +
|
||||
'<legend class="d-flex align-items-center px-1">' +
|
||||
'<div class="position-relative d-flex ftoggler align-items-center position-relative mr-1">' +
|
||||
'<a role="button" data-toggle="collapse" href="#{{id}}" aria-expanded="false"' +
|
||||
'aria-controls="{{id}}"' +
|
||||
'class="btn btn-icon mr-1 icons-collapse-expand stretched-link fheader collapsed">' +
|
||||
'<span class="expanded-icon icon-no-margin p-2" title="{{get_string "collapse" "moodle"}}">' +
|
||||
'<i class="icon fa fa-chevron-down fa-fw " aria-hidden="true"></i>' +
|
||||
'</span>' +
|
||||
'<span class="collapsed-icon icon-no-margin p-2" title="{{get_string "expand" "moodle"}}">' +
|
||||
'<i class="icon fa fa-chevron-right fa-fw " aria-hidden="true"></i>' +
|
||||
'</span>' +
|
||||
'<span class="sr-only">{{get_string name component}}</span>' +
|
||||
'</a>' +
|
||||
'<h3 class="d-flex align-self-stretch align-items-center mb-0" aria-hidden="true">' +
|
||||
'{{get_string name component}}' +
|
||||
'</h3>' +
|
||||
'</div>' +
|
||||
'{{#help}}{{{../help}}}{{/help}}' +
|
||||
'</legend>'
|
||||
},
|
||||
HTML_MEDIA: {
|
||||
VIDEO: '' +
|
||||
|
2
lib/form/amd/build/collapsesections.min.js
vendored
Normal file
2
lib/form/amd/build/collapsesections.min.js
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
define ("core_form/collapsesections",["exports","jquery","core/pending"],function(a,b,c){"use strict";Object.defineProperty(a,"__esModule",{value:!0});a.init=void 0;b=d(b);c=d(c);function d(a){return a&&a.__esModule?a:{default:a}}var e={FORMCONTAINER:".fcontainer"},f={SHOW:"show",COLLAPSED:"collapsed"},g=function(a){var d=new c.default("core_form/collapsesections"),g=document.querySelector(a);g.addEventListener("click",function(){var a="hide";if(g.classList.contains(f.COLLAPSED)){a="show"}document.querySelectorAll(e.FORMCONTAINER).forEach(function(c){(0,b.default)(c).collapse(a)})});(0,b.default)(e.FORMCONTAINER).on("hidden.bs.collapse",function(){var a=!0;(0,b.default)(e.FORMCONTAINER).each(function(b,c){if(c.classList.contains(f.SHOW)){a=!1}});if(a){g.classList.add(f.COLLAPSED)}});(0,b.default)(e.FORMCONTAINER).on("shown.bs.collapse",function(){var a=!0;(0,b.default)(e.FORMCONTAINER).each(function(b,c){if(!c.classList.contains(f.SHOW)){a=!1}});if(a){g.classList.remove(f.COLLAPSED)}});d.resolve()};a.init=g});
|
||||
//# sourceMappingURL=collapsesections.min.js.map
|
1
lib/form/amd/build/collapsesections.min.js.map
Normal file
1
lib/form/amd/build/collapsesections.min.js.map
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../src/collapsesections.js"],"names":["SELECTORS","FORMCONTAINER","CLASSES","SHOW","COLLAPSED","init","collapsesections","pendingPromise","Pending","collapsemenu","document","querySelector","addEventListener","action","classList","contains","querySelectorAll","forEach","collapsecontainer","collapse","on","allcollapsed","each","_","add","allexpanded","remove","resolve"],"mappings":"qKAwBA,OACA,O,sDAEMA,CAAAA,CAAS,CAAG,CACdC,aAAa,CAAE,aADD,C,CAIZC,CAAO,CAAG,CACZC,IAAI,CAAE,MADM,CAEZC,SAAS,CAAE,WAFC,C,CAUHC,CAAI,CAAG,SAAAC,CAAgB,CAAI,IAE9BC,CAAAA,CAAc,CAAG,GAAIC,UAAJ,CAAY,4BAAZ,CAFa,CAG9BC,CAAY,CAAGC,QAAQ,CAACC,aAAT,CAAuBL,CAAvB,CAHe,CAIpCG,CAAY,CAACG,gBAAb,CAA8B,OAA9B,CAAuC,UAAM,CACzC,GAAIC,CAAAA,CAAM,CAAG,MAAb,CACA,GAAIJ,CAAY,CAACK,SAAb,CAAuBC,QAAvB,CAAgCb,CAAO,CAACE,SAAxC,CAAJ,CAAwD,CACpDS,CAAM,CAAG,MACZ,CAEDH,QAAQ,CAACM,gBAAT,CAA0BhB,CAAS,CAACC,aAApC,EAAmDgB,OAAnD,CAA2D,SAACC,CAAD,CAAuB,CAC9E,cAAEA,CAAF,EAAqBC,QAArB,CAA8BN,CAA9B,CACH,CAFD,CAGH,CATD,EAUA,cAAEb,CAAS,CAACC,aAAZ,EAA2BmB,EAA3B,CAA8B,oBAA9B,CAAoD,UAAM,CACtD,GAAIC,CAAAA,CAAY,GAAhB,CACA,cAAErB,CAAS,CAACC,aAAZ,EAA2BqB,IAA3B,CAAgC,SAACC,CAAD,CAAIL,CAAJ,CAA0B,CACtD,GAAIA,CAAiB,CAACJ,SAAlB,CAA4BC,QAA5B,CAAqCb,CAAO,CAACC,IAA7C,CAAJ,CAAwD,CACpDkB,CAAY,GACf,CACJ,CAJD,EAKA,GAAIA,CAAJ,CAAkB,CACdZ,CAAY,CAACK,SAAb,CAAuBU,GAAvB,CAA2BtB,CAAO,CAACE,SAAnC,CACH,CACJ,CAVD,EAWA,cAAEJ,CAAS,CAACC,aAAZ,EAA2BmB,EAA3B,CAA8B,mBAA9B,CAAmD,UAAM,CACrD,GAAIK,CAAAA,CAAW,GAAf,CACA,cAAEzB,CAAS,CAACC,aAAZ,EAA2BqB,IAA3B,CAAgC,SAACC,CAAD,CAAIL,CAAJ,CAA0B,CACtD,GAAI,CAACA,CAAiB,CAACJ,SAAlB,CAA4BC,QAA5B,CAAqCb,CAAO,CAACC,IAA7C,CAAL,CAAyD,CACrDsB,CAAW,GACd,CACJ,CAJD,EAMA,GAAIA,CAAJ,CAAiB,CACbhB,CAAY,CAACK,SAAb,CAAuBY,MAAvB,CAA8BxB,CAAO,CAACE,SAAtC,CACH,CACJ,CAXD,EAYAG,CAAc,CAACoB,OAAf,EACH,C","sourcesContent":["// This file is part of Moodle - http://moodle.org/\n//\n// Moodle is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// Moodle is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with Moodle. If not, see <http://www.gnu.org/licenses/>.\n\n/**\n * Collapse or expand all form sections on clicking the expand all / collapse al link.\n *\n * @module core_form/collapsesections\n * @copyright 2021 Bas Brands\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n * @since 4.0\n */\n\nimport $ from 'jquery';\nimport Pending from 'core/pending';\n\nconst SELECTORS = {\n FORMCONTAINER: '.fcontainer',\n};\n\nconst CLASSES = {\n SHOW: 'show',\n COLLAPSED: 'collapsed'\n};\n\n/**\n * Initialises the form section collapse / expand action.\n *\n * @param {string} collapsesections the collapse/expand link id.\n */\nexport const init = collapsesections => {\n // All jQuery in this code can be replaced when MDL-79179 is integrated.\n const pendingPromise = new Pending('core_form/collapsesections');\n const collapsemenu = document.querySelector(collapsesections);\n collapsemenu.addEventListener('click', () => {\n let action = 'hide';\n if (collapsemenu.classList.contains(CLASSES.COLLAPSED)) {\n action = 'show';\n }\n\n document.querySelectorAll(SELECTORS.FORMCONTAINER).forEach((collapsecontainer) => {\n $(collapsecontainer).collapse(action);\n });\n });\n $(SELECTORS.FORMCONTAINER).on('hidden.bs.collapse', () => {\n let allcollapsed = true;\n $(SELECTORS.FORMCONTAINER).each((_, collapsecontainer) => {\n if (collapsecontainer.classList.contains(CLASSES.SHOW)) {\n allcollapsed = false;\n }\n });\n if (allcollapsed) {\n collapsemenu.classList.add(CLASSES.COLLAPSED);\n }\n });\n $(SELECTORS.FORMCONTAINER).on('shown.bs.collapse', () => {\n var allexpanded = true;\n $(SELECTORS.FORMCONTAINER).each((_, collapsecontainer) => {\n if (!collapsecontainer.classList.contains(CLASSES.SHOW)) {\n allexpanded = false;\n }\n });\n\n if (allexpanded) {\n collapsemenu.classList.remove(CLASSES.COLLAPSED);\n }\n });\n pendingPromise.resolve();\n};\n"],"file":"collapsesections.min.js"}
|
80
lib/form/amd/src/collapsesections.js
Normal file
80
lib/form/amd/src/collapsesections.js
Normal file
@ -0,0 +1,80 @@
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Collapse or expand all form sections on clicking the expand all / collapse al link.
|
||||
*
|
||||
* @module core_form/collapsesections
|
||||
* @copyright 2021 Bas Brands
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
* @since 4.0
|
||||
*/
|
||||
|
||||
import $ from 'jquery';
|
||||
import Pending from 'core/pending';
|
||||
|
||||
const SELECTORS = {
|
||||
FORMCONTAINER: '.fcontainer',
|
||||
};
|
||||
|
||||
const CLASSES = {
|
||||
SHOW: 'show',
|
||||
COLLAPSED: 'collapsed'
|
||||
};
|
||||
|
||||
/**
|
||||
* Initialises the form section collapse / expand action.
|
||||
*
|
||||
* @param {string} collapsesections the collapse/expand link id.
|
||||
*/
|
||||
export const init = collapsesections => {
|
||||
// All jQuery in this code can be replaced when MDL-79179 is integrated.
|
||||
const pendingPromise = new Pending('core_form/collapsesections');
|
||||
const collapsemenu = document.querySelector(collapsesections);
|
||||
collapsemenu.addEventListener('click', () => {
|
||||
let action = 'hide';
|
||||
if (collapsemenu.classList.contains(CLASSES.COLLAPSED)) {
|
||||
action = 'show';
|
||||
}
|
||||
|
||||
document.querySelectorAll(SELECTORS.FORMCONTAINER).forEach((collapsecontainer) => {
|
||||
$(collapsecontainer).collapse(action);
|
||||
});
|
||||
});
|
||||
$(SELECTORS.FORMCONTAINER).on('hidden.bs.collapse', () => {
|
||||
let allcollapsed = true;
|
||||
$(SELECTORS.FORMCONTAINER).each((_, collapsecontainer) => {
|
||||
if (collapsecontainer.classList.contains(CLASSES.SHOW)) {
|
||||
allcollapsed = false;
|
||||
}
|
||||
});
|
||||
if (allcollapsed) {
|
||||
collapsemenu.classList.add(CLASSES.COLLAPSED);
|
||||
}
|
||||
});
|
||||
$(SELECTORS.FORMCONTAINER).on('shown.bs.collapse', () => {
|
||||
var allexpanded = true;
|
||||
$(SELECTORS.FORMCONTAINER).each((_, collapsecontainer) => {
|
||||
if (!collapsecontainer.classList.contains(CLASSES.SHOW)) {
|
||||
allexpanded = false;
|
||||
}
|
||||
});
|
||||
|
||||
if (allexpanded) {
|
||||
collapsemenu.classList.remove(CLASSES.COLLAPSED);
|
||||
}
|
||||
});
|
||||
pendingPromise.resolve();
|
||||
};
|
@ -69,7 +69,6 @@ class MoodleQuickForm_header extends HTML_QuickForm_header
|
||||
*/
|
||||
function accept(&$renderer, $required=false, $error=null)
|
||||
{
|
||||
$this->_text .= $this->getHelpButton();
|
||||
$renderer->renderHeader($this);
|
||||
}
|
||||
|
||||
@ -81,4 +80,4 @@ class MoodleQuickForm_header extends HTML_QuickForm_header
|
||||
function getHelpButton(){
|
||||
return $this->_helpbutton;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
36
lib/form/templates/collapsesections.mustache
Normal file
36
lib/form/templates/collapsesections.mustache
Normal file
@ -0,0 +1,36 @@
|
||||
{{!
|
||||
This file is part of Moodle - http://moodle.org/
|
||||
|
||||
Moodle is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Moodle is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
}}
|
||||
{{!
|
||||
@template core_form/collapsesections
|
||||
|
||||
Renders a form section header
|
||||
|
||||
Example context (json):
|
||||
{
|
||||
}
|
||||
}}
|
||||
<div class="collapsible-actions">
|
||||
<a id="collapsesections{{uniqid}}" href="#" aria-expanded="true" class="collapseexpand collapsemenu collapsed">
|
||||
<span class="collapseall">{{#str}}collapseall{{/str}}</span>
|
||||
<span class="expandall">{{#str}}expandall{{/str}}</span>
|
||||
</a>
|
||||
</div>
|
||||
{{#js}}
|
||||
require(['core_form/collapsesections'], function(Collapsesections) {
|
||||
Collapsesections.init('#collapsesections{{uniqid}}');
|
||||
});
|
||||
{{/js}}
|
59
lib/form/templates/element-header.mustache
Normal file
59
lib/form/templates/element-header.mustache
Normal file
@ -0,0 +1,59 @@
|
||||
{{!
|
||||
This file is part of Moodle - http://moodle.org/
|
||||
|
||||
Moodle is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Moodle is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
}}
|
||||
{{!
|
||||
@template core_form/element-header
|
||||
|
||||
Renders a form section header
|
||||
|
||||
Example context (json):
|
||||
{
|
||||
"id": "id_general",
|
||||
"header": "General",
|
||||
"collapsed": 0,
|
||||
"collapseable": 1,
|
||||
"helpbutton": "Help"
|
||||
}
|
||||
}}
|
||||
{{#collapseable}}
|
||||
<legend class="d-flex align-items-center">
|
||||
<div class="position-relative d-flex ftoggler align-items-center position-relative mr-1">
|
||||
<a data-toggle="collapse"
|
||||
href="#{{id}}container"
|
||||
role="button"
|
||||
aria-expanded="{{#collapsed}}false{{/collapsed}}{{^collapsed}}true{{/collapsed}}"
|
||||
aria-controls="{{id}}container"
|
||||
class="btn btn-icon mr-1 icons-collapse-expand stretched-link fheader {{#collapsed}}collapsed{{/collapsed}}"
|
||||
>
|
||||
<span class="expanded-icon icon-no-margin p-2" title="{{#str}} collapse, core {{/str}}">
|
||||
{{#pix}} t/expandedchevron, core {{/pix}}
|
||||
</span>
|
||||
<span class="collapsed-icon icon-no-margin p-2" title="{{#str}} expand, core {{/str}}">
|
||||
{{#pix}} t/collapsedchevron, core {{/pix}}
|
||||
</span>
|
||||
<span class="sr-only">{{{header}}}</span>
|
||||
</a>
|
||||
<h3 class="d-flex align-self-stretch align-items-center mb-0" aria-hidden="true">
|
||||
{{{header}}}
|
||||
</h3>
|
||||
</div>
|
||||
{{{helpbutton}}}
|
||||
</legend>
|
||||
{{/collapseable}}
|
||||
{{^collapseable}}
|
||||
<legend>{{{header}}}</legend>
|
||||
{{/collapseable}}
|
||||
<div id="{{id}}container" class="fcontainer {{#collapseable}}collapseable collapse {{/collapseable}} {{^collapsed}}show{{/collapsed}}">
|
@ -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('<a href="#"></a>');
|
||||
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('<a href="#"></a>');
|
||||
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.
|
||||
*
|
||||
|
@ -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('<a href="#"></a>')).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('<a href="#"></a>');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"]});
|
||||
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"]});
|
@ -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('<a href="#"></a>');
|
||||
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('<a href="#"></a>');
|
||||
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.
|
||||
*
|
||||
|
118
lib/form/yui/src/shortforms/js/shortforms.js
vendored
118
lib/form/yui/src/shortforms/js/shortforms.js
vendored
@ -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('<a href="#"></a>');
|
||||
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('<a href="#"></a>');
|
||||
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.
|
||||
*
|
||||
|
@ -3022,10 +3022,6 @@ class MoodleQuickForm_Renderer extends HTML_QuickForm_Renderer_Tableless{
|
||||
*/
|
||||
var $_openHiddenFieldsetTemplate = "\n\t<fieldset class=\"hidden\"><div>";
|
||||
|
||||
/** @var string Header Template string */
|
||||
var $_headerTemplate =
|
||||
"\n\t\t<legend class=\"ftoggler\">{header}</legend>\n\t\t<div class=\"fcontainer clearfix\">\n\t\t";
|
||||
|
||||
/** @var string Template used when opening a fieldset */
|
||||
var $_openFieldsetTemplate = "\n\t<fieldset class=\"{classes}\" {id}>";
|
||||
|
||||
@ -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++;
|
||||
}
|
||||
|
||||
|
@ -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,
|
||||
|
@ -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.
|
||||
|
@ -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"
|
||||
|
@ -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']);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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;
|
||||
|
@ -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 {
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user