From bad2e8bff16dc481cf7fd69cfb700aab22d1b218 Mon Sep 17 00:00:00 2001 From: Stefan Hanauska Date: Mon, 26 Aug 2024 21:51:46 +0200 Subject: [PATCH] MBS-9292: Fix intro layout --- lib.php | 12 ++++++++++-- styles.css | 4 ++++ templates/rendercontainer.mustache | 25 ++++++++++++++++++++++--- 3 files changed, 36 insertions(+), 5 deletions(-) diff --git a/lib.php b/lib.php index ee4dcbe..923ac50 100644 --- a/lib.php +++ b/lib.php @@ -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); } /** diff --git a/styles.css b/styles.css index 3bf416a..24d80c3 100644 --- a/styles.css +++ b/styles.css @@ -140,3 +140,7 @@ .learningmap-backlink { padding-top: 1rem; } + +.learningmap-container { + width: 100%; +} diff --git a/templates/rendercontainer.mustache b/templates/rendercontainer.mustache index 2fb3cc5..8215866 100644 --- a/templates/rendercontainer.mustache +++ b/templates/rendercontainer.mustache @@ -32,11 +32,30 @@ Example context (json): { "cmId": "123", - "enableLiveUpdater": true + "enableLiveUpdater": true, +<<<<<<< Updated upstream + "contentbeforemap": "

Some content before the map

" } }} -
- {{> mod_learningmap/loadingplaceholder}} +
+
+ {{{contentbeforemap}}} +
+======= + "contentbeforemap": "

Some content before the map

", + "hascontentbeforemap": true + } +}} +
+ {{#hascontentbeforemap}} +
+ {{{contentbeforemap}}} +
+ {{/hascontentbeforemap}} +>>>>>>> Stashed changes +
+ {{> mod_learningmap/loadingplaceholder}} +
{{#js}} require(['mod_learningmap/renderer'], function(renderer) {