Commit 26759436 authored by Myriam Delaruelle's avatar Myriam Delaruelle
Browse files

display/hide course infos but with jquery

parent 6675e556
......@@ -16,53 +16,51 @@
/**
* Handle add/remove competency links.
*
* @module tool_lp/competencies
* @package tool_lp
* @copyright 2015 Damyon Wiese <damyon@moodle.com>
* @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'],
function($, notification, ajax, templates, str, Picker, dragdrop, Pending) {
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);
});
/**
* 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);
})
}
}
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");
})
}
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();
});
(function() {
// inclus nul part.
})()
\ No newline at end of file
......@@ -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";
......@@ -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";
......@@ -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;
}*/;
......
......@@ -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
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment