From d9c7142529721fbf40228dd767c2725f7f3b14be Mon Sep 17 00:00:00 2001 From: Myriam Delaruelle <myriam.delaruelle@univ-lorraine.fr> Date: Thu, 29 Jun 2023 16:06:08 +0200 Subject: [PATCH] Fix description course --- amd/build/header.js | 53 +++++++++++++++---------- styles.css | 2 +- templates/courseformat/content.mustache | 1 + 3 files changed, 33 insertions(+), 23 deletions(-) diff --git a/amd/build/header.js b/amd/build/header.js index 17658a0..0d34f75 100644 --- a/amd/build/header.js +++ b/amd/build/header.js @@ -27,29 +27,38 @@ define(['jquery', 'core/ajax', 'core/str'], return{ registerHeader:function(){ - $("#button-collapse").click(function(){ - if($("#summary-wrapper").hasClass('collapsed')){ - $("#summary-wrapper").animate({ "max-height": '13rem' }, "slow" ); - var message=str.get_string('displayInfos', 'format_iena'); - $.when(message).done(function(localizedEditString) { - $("#button-collapse").text(localizedEditString); - }); + var heightWrapper= $("#summary-wrapper").css("height"); + console.log(heightWrapper); + if(parseInt(heightWrapper, 10) >= 144){ + $("#button-collapse").click(function(){ + if($("#summary-wrapper").hasClass('collapsed')){ + $("#summary-wrapper").animate({ "max-height": '144px' }, "slow" ); + var message=str.get_string('displayInfos', 'format_iena'); + $.when(message).done(function(localizedEditString) { + $("#button-collapse").text(localizedEditString); + }); - } - else{ - var height= $("#summary-collapse").css("height"); - $("#summary-wrapper").animate({ "max-height": height }, "slow" ); - var message=str.get_string('hideInfos', 'format_iena'); - $.when(message).done(function(localizedEditString) { - $("#button-collapse").text(localizedEditString); - }); - - - } - $("#summary-wrapper").toggleClass("collapsed"); - - - }) + } + else{ + + var height= $("#summary-collapse").css("height"); + $("#summary-wrapper").animate({ "max-height": height }, "slow" ); + var message=str.get_string('hideInfos', 'format_iena'); + $.when(message).done(function(localizedEditString) { + $("#button-collapse").text(localizedEditString); + }); + + + } + $("#summary-wrapper").toggleClass("collapsed"); + + + }) + } + else{ + $("#button-collapse").hide(); + } + } diff --git a/styles.css b/styles.css index 5b44819..bc671b4 100644 --- a/styles.css +++ b/styles.css @@ -658,7 +658,7 @@ ul.nav.navbar-nav.ml-auto { #summary-wrapper{ padding-left: 1px; display: block; - max-height: 13rem; + max-height: 144px; height: auto; overflow: hidden; margin-bottom: 5px; diff --git a/templates/courseformat/content.mustache b/templates/courseformat/content.mustache index 62f6e2b..3c35596 100644 --- a/templates/courseformat/content.mustache +++ b/templates/courseformat/content.mustache @@ -240,6 +240,7 @@ <h3> {{# str }} aboutcourse, format_iena {{/ str}} </h3> + <div class=" my-3" data-for="sectioninfo" style="border-bottom: 1px solid #d1d1d1;"></div> <div id="summary-wrapper"> <div id="summary-collapse" aria-expanded="false">{{{ summary }}}</div> </div> -- GitLab