diff --git a/amd/build/header.js b/amd/build/header.js new file mode 100644 index 0000000000000000000000000000000000000000..ef5d2533217da6850d40f69c25a07d62888904da --- /dev/null +++ b/amd/build/header.js @@ -0,0 +1,66 @@ +// This file is part of Moodle - http://moodle.org/ +// +// Moodle is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Moodle is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Moodle. If not, see <http://www.gnu.org/licenses/>. + +/** + * Handle add/remove competency links. + * + * @module format_iena/suivi + * @package format_iena + * @copyright 2021 Myriam Delaruelle + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ +define(['jquery', 'core/ajax', 'core/str'], + function($, ajax, str) { + + return{ + + registerHeader:function(){ + $("#button-collapse").click(function(){ + if($("#summary-wrapper").hasClass('collapsed')){ + $("#summary-wrapper").animate({ "max-height": '7rem' }, "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"); + + + }) + + } + + + + + } + + + + + + +}); diff --git a/amd/src/suivi.js b/amd/src/suivi.js deleted file mode 100644 index fd6876501f81f10be807131c8fa18760b538e979..0000000000000000000000000000000000000000 --- a/amd/src/suivi.js +++ /dev/null @@ -1,68 +0,0 @@ -// This file is part of Moodle - http://moodle.org/ -// -// Moodle is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// Moodle is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with Moodle. If not, see <http://www.gnu.org/licenses/>. - -/** - * Handle add/remove competency links. - * - * @module tool_lp/competencies - * @package tool_lp - * @copyright 2015 Damyon Wiese <damyon@moodle.com> - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - */ -define(['jquery'], - function($, notification, ajax, templates, str, Picker, dragdrop, Pending) { - - - - /** - * Pick a competency - * - * @method pickCompetency - * @return {Promise} - */ - - function registerSelectAll(){ - $('#iena-select-all').on('click', function(e){ - console.log("on sélectionne tout"); - select_all_studs(e); - - }) - } - - function select_all_studs(e) { - //e.preventDefault(); - console.log("this one src"); - var counter = 0; - var checks = document.querySelectorAll("#table-body tr"); - for (var i = 0; i < checks.length; i++) { - if ( checks[i].style.display != "none" || data.all_selected ) { - var box = checks[i].querySelector("input[type='checkbox']"); - box.checked = !data.all_selected; - counter++; - } - } - if ( counter > 0 ) { - - - data.all_selected = !data.all_selected; - } - } - - - console.log("on passe par ici"); - //registerSelectAll(); - - -}); diff --git a/js/param_section.js b/js/param_section.js deleted file mode 100644 index dcb89787cc582657b3ddb1525195663ff63e69b4..0000000000000000000000000000000000000000 --- a/js/param_section.js +++ /dev/null @@ -1,5 +0,0 @@ -(function() { - -// inclus nul part. - -})() \ No newline at end of file diff --git a/lang/en/format_iena.php b/lang/en/format_iena.php index c100569a822ed06eccce976a9442df8afdd85846..1a7ce582aaea2fe9dbda760e3ae7cf9999a395a9 100644 --- a/lang/en/format_iena.php +++ b/lang/en/format_iena.php @@ -93,5 +93,7 @@ By definition an unnamed section is displayed as <strong>section [N]</strong>.'; $string['display_course_infos']="Show/hide course information"; $string['my_progress']="My progress in the course: "; $string['table_progress']="Tracking"; + $string['displayInfos']="Display course informations"; + $string['hideInfos']="Hide course informations"; diff --git a/lang/fr/format_iena.php b/lang/fr/format_iena.php index 68c8d34b78fce0b47185b9c6ece5b9fa08697a89..a4cf6401d66023f36e39c27f1bc6fec226181697 100644 --- a/lang/fr/format_iena.php +++ b/lang/fr/format_iena.php @@ -93,5 +93,7 @@ By definition an unnamed section is displayed as <strong>section [N]</strong>.'; $string['display_course_infos']="Afficher/Masquer les informations du cours"; $string['my_progress']="Ma progression dans le cours : "; $string['table_progress']="Suivi des étudiants"; + $string['displayInfos']="Afficher les infos du cours"; + $string['hideInfos']="Masquer les infos du cours"; diff --git a/styles.css b/styles.css index ee99dfa6142053d75572667ef0c52ce8059fe4da..89b9d7cedacea1569e4b51f0e86356d65cbc0493 100644 --- a/styles.css +++ b/styles.css @@ -576,19 +576,31 @@ ul.nav.navbar-nav.ml-auto { } - #title-summary-iena{ - padding-left: 0; + #summary-wrapper{ + padding-left: 1px; + display: block; + max-height: 7rem; + height: auto; + overflow: hidden; + margin-bottom: 5px; } -#title-summary-iena #summary-collapse.collapse:not(.show) { +/*#title-summary-iena #summary-collapse.collapse:not(.show) { display: block; - height: 7rem; + max-height: 7rem; + height: auto; overflow: hidden; + } #title-summary-iena #summary-collapse.collapsing { - height: 4rem; -} + height: auto; + max-height: 100rem; + -webkit-transition: max-height .35s ease; + -o-transition: max-height .35s ease; + transition: max-height .35s ease; + transition: max-height 1s ease; +}*/; diff --git a/templates/course-header.mustache b/templates/course-header.mustache index f7605b08657cbc8da81b12cebbf9c550085d818d..00e6e704508477e8ffa6840a00f676bf20985934 100644 --- a/templates/course-header.mustache +++ b/templates/course-header.mustache @@ -68,8 +68,17 @@ <h3> {{# str }} aboutcourse, format_iena {{/ str}} </h3> - <div class="collapse" id="summary-collapse" aria-expanded="false">{{{ summary }}}</div> - <a role="button" class="collapsed" data-toggle="collapse" href="#summary-collapse" aria-expanded="false" aria-controls="summary-collapse">Afficher / Masquer les infos du cours</a> + <div id="summary-wrapper"> + <div id="summary-collapse" aria-expanded="false">{{{ summary }}}</div> + </div> + <a role="button" href="#" onclick="return false" id="button-collapse" aria-expanded="false" aria-controls="summary-collapse">{{# str }} displayInfos, format_iena {{/ str}}</a> </div> </div> -</div> \ No newline at end of file +</div> + +{{#js}} +require(['format_iena/header'], function(module) { + module.registerHeader(); + +}); +{{/js}} \ No newline at end of file