mirror of
https://github.com/moodle/moodle.git
synced 2025-04-21 00:12:56 +02:00
Fixed up styles for simple boxes see MDL-8101
This commit is contained in:
parent
4a384c5bbe
commit
8f36e33ec3
@ -836,14 +836,25 @@ function print_simple_box_start($align='', $width='', $color='', $padding=5, $cl
|
||||
|
||||
$output = '';
|
||||
|
||||
$divclasses = $class.' '.$class.'content';
|
||||
$divclasses = 'box '.$class.' '.$class.'content';
|
||||
$divstyles = '';
|
||||
|
||||
if ($align) {
|
||||
$divclasses .= ' boxalign'.$align; // Implement alignment using a class
|
||||
}
|
||||
if ($width) { // Hopefully we can eliminate these in calls to this function (inline styles are bad)
|
||||
$divstyles .= ' width:'.$width.';';
|
||||
if (substr($width, -1, 1) == '%') { // Width is a % value
|
||||
$width = (int) substr($width, 0, -1); // Extract just the number
|
||||
if ($width < 40) {
|
||||
$divclasses .= ' boxwidthnarrow'; // Approx 30% depending on theme
|
||||
} else if ($width > 60) {
|
||||
$divclasses .= ' boxwidthwide'; // Approx 80% depending on theme
|
||||
} else {
|
||||
$divclasses .= ' boxwidthnormal'; // Approx 50% depending on theme
|
||||
}
|
||||
} else {
|
||||
$divstyles .= ' width:'.$width.';'; // Last resort
|
||||
}
|
||||
}
|
||||
if ($color) { // Hopefully we can eliminate these in calls to this function (inline styles are bad)
|
||||
$divstyles .= ' background:'.$color.';';
|
||||
|
@ -2864,7 +2864,7 @@ function print_box_start($classes='generalbox', $ids='', $return=false) {
|
||||
$ids = ' id="'.$ids.'"';
|
||||
}
|
||||
|
||||
$output .= '<div'.$ids.' class="'.$classes.'">';
|
||||
$output .= '<div'.$ids.' class="box '.$classes.'">';
|
||||
|
||||
if ($return) {
|
||||
return $output;
|
||||
|
Loading…
x
Reference in New Issue
Block a user