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..81bd9da 100644 --- a/templates/rendercontainer.mustache +++ b/templates/rendercontainer.mustache @@ -32,11 +32,20 @@ Example context (json): { "cmId": "123", - "enableLiveUpdater": true + "enableLiveUpdater": true, + "contentbeforemap": "

Some content before the map

", + "hascontentbeforemap": true } }} -
- {{> mod_learningmap/loadingplaceholder}} +
+ {{#hascontentbeforemap}} +
+ {{{contentbeforemap}}} +
+ {{/hascontentbeforemap}} +
+ {{> mod_learningmap/loadingplaceholder}} +
{{#js}} require(['mod_learningmap/renderer'], function(renderer) { diff --git a/view.php b/view.php index 3382dc9..3777e74 100644 --- a/view.php +++ b/view.php @@ -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();