Skip to content

Commit

Permalink
Merge pull request #106 from mebis-lp/MBS-9292-Fix-intro-layout
Browse files Browse the repository at this point in the history
MBS-9292: Fix intro layout
  • Loading branch information
PhMemmel authored Aug 27, 2024
2 parents 59e2af3 + 6bf8c50 commit 179eae6
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 6 deletions.
12 changes: 10 additions & 2 deletions lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -235,15 +235,23 @@ function learningmap_cm_info_view(cm_info $cm): void {
);
}

$contentbeforemap = $groupdropdown . $intro;
$hascontentbeforemap = !empty($contentbeforemap);

$mapcontainer = $OUTPUT->render_from_template(
'mod_learningmap/rendercontainer',
['cmId' => $cm->id, 'enableLiveUpdater' => true]
[
'cmId' => $cm->id,
'enableLiveUpdater' => true,
'contentbeforemap' => $contentbeforemap,
'hascontentbeforemap' => $hascontentbeforemap,
]
);

$cm->set_custom_cmlist_item(true);
}

$cm->set_content($groupdropdown . $intro . $mapcontainer, true);
$cm->set_content($mapcontainer, true);
}

/**
Expand Down
4 changes: 4 additions & 0 deletions styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -140,3 +140,7 @@
.learningmap-backlink {
padding-top: 1rem;
}

.learningmap-container {
width: 100%;
}
15 changes: 12 additions & 3 deletions templates/rendercontainer.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,20 @@
Example context (json):
{
"cmId": "123",
"enableLiveUpdater": true
"enableLiveUpdater": true,
"contentbeforemap": "<p>Some content before the map</p>",
"hascontentbeforemap": true
}
}}
<div id="learningmap-render-container-{{cmId}}" class="learningmap-render-container">
{{> mod_learningmap/loadingplaceholder}}
<div class="learningmap-container">
{{#hascontentbeforemap}}
<div class="learningmap-content-before-map">
{{{contentbeforemap}}}
</div>
{{/hascontentbeforemap}}
<div id="learningmap-render-container-{{cmId}}" class="learningmap-render-container">
{{> mod_learningmap/loadingplaceholder}}
</div>
</div>
{{#js}}
require(['mod_learningmap/renderer'], function(renderer) {
Expand Down
2 changes: 1 addition & 1 deletion view.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@

echo $OUTPUT->render_from_template(
'mod_learningmap/rendercontainer',
['cmId' => $id, 'enableLiveUpdater' => false]
['cmId' => $id, 'enableLiveUpdater' => false, 'contentbeforemap' => '', 'hascontentbeforemap' => false]
);

echo $OUTPUT->footer();

0 comments on commit 179eae6

Please sign in to comment.