MDL-56987 bootstrapbase: Center align in page modals

This commit is contained in:
Damyon Wiese
2016-11-22 13:31:50 +08:00
parent cd4a6b8b0b
commit 95210c6650
3 changed files with 67 additions and 2 deletions
+41
View File
@@ -4922,6 +4922,47 @@ class core_renderer_maintenance extends core_renderer {
}
/**
* Overridden confirm message for upgrades.
*
* @param string $message The question to ask the user
* @param single_button|moodle_url|string $continue The single_button component representing the Continue answer.
* @param single_button|moodle_url|string $cancel The single_button component representing the Cancel answer.
* @return string HTML fragment
*/
public function confirm($message, $continue, $cancel) {
// We need plain styling of confirm boxes on upgrade because we don't know which stylesheet we have (it could be
// from any previous version of Moodle).
if ($continue instanceof single_button) {
$continue->primary = true;
} else if (is_string($continue)) {
$continue = new single_button(new moodle_url($continue), get_string('continue'), 'post', true);
} else if ($continue instanceof moodle_url) {
$continue = new single_button($continue, get_string('continue'), 'post', true);
} else {
throw new coding_exception('The continue param to $OUTPUT->confirm() must be either a URL' .
' (string/moodle_url) or a single_button instance.');
}
if ($cancel instanceof single_button) {
$output = '';
} else if (is_string($cancel)) {
$cancel = new single_button(new moodle_url($cancel), get_string('cancel'), 'get');
} else if ($cancel instanceof moodle_url) {
$cancel = new single_button($cancel, get_string('cancel'), 'get');
} else {
throw new coding_exception('The cancel param to $OUTPUT->confirm() must be either a URL' .
' (string/moodle_url) or a single_button instance.');
}
$output = $this->box_start('generalbox', 'notice');
$output .= html_writer::tag('h4', get_string('confirm'));
$output .= html_writer::tag('p', $message);
$output .= html_writer::tag('div', $this->render($continue) . $this->render($cancel), array('class' => 'buttons'));
$output .= $this->box_end();
return $output;
}
/**
* Does nothing. The maintenance renderer does not support JS.
*
+15 -1
View File
@@ -204,7 +204,21 @@ img.iconsmall {
.modal.modal-in-page {
position: static;
z-index: 0;
margin: 0;
margin: 0 auto 0 auto;
}
// We need to keep this rule because confirm messages during upgrade use it. We can never change it because we don't
// serve new stylesheets until after upgrade.
#page-admin-index #notice {
width: 60%;
min-width: 220px;
margin: auto;
.buttons {
padding-left: 0;
padding-right: 0;
text-align: center;
}
}
#page-admin-index .releasenoteslink,
+11 -1
View File
@@ -2789,7 +2789,17 @@ img.iconsmall {
.modal.modal-in-page {
position: static;
z-index: 0;
margin: 0;
margin: 0 auto 0 auto;
}
#page-admin-index #notice {
width: 60%;
min-width: 220px;
margin: auto;
}
#page-admin-index #notice .buttons {
padding-left: 0;
padding-right: 0;
text-align: center;
}
#page-admin-index .releasenoteslink,
#page-admin-index .adminwarning,