Skip to content

Commit

Permalink
Merge branch 'MDL-70094-master' of https://github.com/SangNguyen2601/…
Browse files Browse the repository at this point in the history
  • Loading branch information
junpataleta committed Nov 19, 2020
2 parents 0c556af + 3965270 commit 1ce1060
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
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
This files describes API changes in core libraries and APIs,
information provided here is intended especially for developers.

=== 4.0 ===
* 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.10 ===
* PHPUnit has been upgraded to 8.5. That comes with a few changes:
- Breaking change: All the "template methods" (setUp(), tearDown()...) now require to return void. This implies
Expand Down
11 changes: 8 additions & 3 deletions lib/weblib.php
Original file line number Diff line number Diff line change
Expand Up @@ -2441,9 +2441,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 @@ -2463,8 +2465,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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
Expand Up @@ -15820,6 +15820,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
Original file line number Diff line number Diff line change
Expand Up @@ -16041,6 +16041,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 1ce1060

Please sign in to comment.