Skip to content

Commit

Permalink
background property exist
Browse files Browse the repository at this point in the history
  • Loading branch information
rdebleu committed Aug 14, 2023
1 parent fc29d79 commit 6cd41b9
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
include:
- php: '8.1'
moodle-branch: 'MOODLE_402_STABLE'
database: pgsql
database: 'pgsql'
- php: '8.2'
moodle-branch: 'master'
database: 'pgsql'
Expand Down Expand Up @@ -96,7 +96,7 @@ jobs:
run: moodle-plugin-ci --ansi savepoints

- name: grunt
if: ${{ always() }}
if: ${{ matrix.moodle-branch == 'MOODLE_402_STABLE'}}
run: moodle-plugin-ci --ansi grunt

- name: mustache
Expand Down
12 changes: 8 additions & 4 deletions classes/output/renderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,15 +78,19 @@ public function render_content($widget) {
$format = course_get_format($course);
$options = (object) $format->get_format_options();
$str = '.masonry-brick {';
$str .= 'background-color:' . $options->backcolor . ' !important;';
$str .= 'border: ' . trim($options->borderwidth) . 'px solid '. $options->bordercolor . ' !important;}';
if (property_exists($options, 'backcolor')) {
$str .= 'background-color:' . $options->backcolor . ' !important;';
$str .= 'border: ' . trim($options->borderwidth) . 'px solid '. $options->bordercolor . ' !important;}';
}
$moduleinfo = $format->get_modinfo();
$sections = array_keys($moduleinfo->get_sections());
foreach ($sections as $section) {
$options = (object) $format->get_format_options($section);
// Give a backgroun color.
$str .= '#section-' . $section . ' {';
$str .= 'background-color:' . $options->backcolor . ' !important;} ';
if (property_exists($options, 'backcolor')) {
// Give a background color.
$str .= 'background-color:' . $options->backcolor . ' !important;} ';
}
// Hide collapse.
$str .= '#collapssesection' . $section . '{display: none !important;} ';
}
Expand Down
2 changes: 1 addition & 1 deletion tests/masonry_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ public function test_renderer() {
false,
['name' => 'course_format_masonry', 'fullpath' => '/course/format/masonry/format.js',
'requires' => ['base', 'node', 'transition', 'event', 'io-base', 'moodle-core-io']]);
$renderer = new \format_masonry\output\renderer($page, null);
$renderer = new \format_masonry\output\renderer($PAGE, null);
$modinfo = get_fast_modinfo($this->course);
$section = $modinfo->get_section_info(1);
$this->assertStringContainsString('Topic 1', $renderer->section_title($section, $this->course));
Expand Down

0 comments on commit 6cd41b9

Please sign in to comment.