Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge branch 'MDL-70094-39' of https://github.com/SangNguyen2601/moodle
… into MOODLE_39_STABLE
  • Loading branch information
junpataleta committed Nov 19, 2020
2 parents 76a830b + 2f9582d commit f66c4fa
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 6 deletions.
4 changes: 4 additions & 0 deletions lib/upgrade.txt
@@ -1,6 +1,10 @@
This files describes API changes in core libraries and APIs,
information provided here is intended especially for developers.

=== 3.9.4 ===
* New optional parameter $extracontent for print_collapsible_region_start(). This allows developers to add interactive HTML elements
(e.g. a help icon) after the collapsible region's toggle link.

=== 3.9.3 ===
* New DML function $DB->delete_records_subquery() to delete records based on a subquery in a way
that will work across databases.
Expand Down
11 changes: 8 additions & 3 deletions lib/weblib.php
Expand Up @@ -2436,9 +2436,11 @@ function print_collapsible_region($contents, $classes, $id, $caption, $userpref
* (May be blank if you do not wish the state to be persisted.
* @param boolean $default Initial collapsed state to use if the user_preference it not set.
* @param boolean $return if true, return the HTML as a string, rather than printing it.
* @param string $extracontent the extra content will show next to caption, eg.Help icon.
* @return string|void if $return is false, returns nothing, otherwise returns a string of HTML.
*/
function print_collapsible_region_start($classes, $id, $caption, $userpref = '', $default = false, $return = false) {
function print_collapsible_region_start($classes, $id, $caption, $userpref = '', $default = false, $return = false,
$extracontent = null) {
global $PAGE;

// Work out the initial state.
Expand All @@ -2458,8 +2460,11 @@ function print_collapsible_region_start($classes, $id, $caption, $userpref = '',
$output .= '<div id="' . $id . '" class="collapsibleregion ' . $classes . '">';
$output .= '<div id="' . $id . '_sizer">';
$output .= '<div id="' . $id . '_caption" class="collapsibleregioncaption">';
$output .= $caption . ' ';
$output .= '</div><div id="' . $id . '_inner" class="collapsibleregioninner">';
$output .= $caption . ' </div>';
if ($extracontent) {
$output .= html_writer::div($extracontent, 'collapsibleregionextracontent');
}
$output .= '<div id="' . $id . '_inner" class="collapsibleregioninner">';
$PAGE->requires->js_init_call('M.util.init_collapsible_region', array($id, $userpref, get_string('clicktohideshow')));

if ($return) {
Expand Down
5 changes: 2 additions & 3 deletions question/preview.php
Expand Up @@ -266,9 +266,8 @@
echo html_writer::end_tag('form');

// Output the technical info.
print_collapsible_region_start('', 'techinfo', get_string('technicalinfo', 'question') .
$OUTPUT->help_icon('technicalinfo', 'question'),
'core_question_preview_techinfo_collapsed', true);
print_collapsible_region_start('', 'techinfo', get_string('technicalinfo', 'question'),
'core_question_preview_techinfo_collapsed', true, false, $OUTPUT->help_icon('technicalinfo', 'question'));
foreach ($technical as $info) {
echo html_writer::tag('p', $info, array('class' => 'notifytiny'));
}
Expand Down
7 changes: 7 additions & 0 deletions theme/boost/scss/moodle/question.scss
Expand Up @@ -423,6 +423,13 @@ body.jsenabled .questionflag input[type=checkbox] {
margin: 1em 0;
}

#page-question-preview .collapsibleregion {
.collapsibleregioncaption,
.collapsibleregionextracontent {
display: inline-block;
}
}

// imported from quiz.css

#page-mod-quiz-edit ul.slots .activityinstance {
Expand Down
4 changes: 4 additions & 0 deletions theme/boost/style/moodle.css
Expand Up @@ -15771,6 +15771,10 @@ body.jsenabled .questionflag input[type=checkbox] {
#page-question-preview #techinfo {
margin: 1em 0; }

#page-question-preview .collapsibleregion .collapsibleregioncaption,
#page-question-preview .collapsibleregion .collapsibleregionextracontent {
display: inline-block; }

#page-mod-quiz-edit ul.slots .activityinstance > a {
display: flex;
max-width: 100%;
Expand Down
4 changes: 4 additions & 0 deletions theme/classic/style/moodle.css
Expand Up @@ -15993,6 +15993,10 @@ body.jsenabled .questionflag input[type=checkbox] {
#page-question-preview #techinfo {
margin: 1em 0; }

#page-question-preview .collapsibleregion .collapsibleregioncaption,
#page-question-preview .collapsibleregion .collapsibleregionextracontent {
display: inline-block; }

#page-mod-quiz-edit ul.slots .activityinstance > a {
display: flex;
max-width: 100%;
Expand Down

0 comments on commit f66c4fa

Please sign in to comment.