Skip to content
Snippets Groups Projects
Commit 0682d865 authored by Myriam Delaruelle's avatar Myriam Delaruelle
Browse files

Fixed matrix, icons, deleting link

parent 4ccf1253
No related branches found
No related tags found
No related merge requests found
......@@ -203,6 +203,7 @@
$moduleI->get_ressource_by_id($key);
//var_dump($moduleI);
$module_matrix->moduleid=$moduleI->id;
$module_matrix->name=$moduleI->name;
$module_matrix->link=$moduleI->link;
$module_competencies = $competency_instance->get_competencies_by_moduleID($key);
......
......@@ -108,18 +108,38 @@ function filter() {
function showFilter(obj){
var p = obj.parentNode;
function showFilter(obj, pencil){
/*var p = obj.parentNode.parentNode;
var c = p.children;
if (c[2].dataset.edit == 'editOn') {
obj.parentNode.parentNode.children[2].setAttribute("style", "display:inline");
c[0].setAttribute("style", "display:inline");
c[1].setAttribute("style", "display:none");
c[2].dataset.edit = 'editOff';
} else {
obj.parentNode.setAttribute("style", "display:none");
c[0].setAttribute("style", "display:none");
c[1].setAttribute("style", "display:inline");
c[2].dataset.edit = 'editOn';
}*/
console.log(pencil);
if(pencil==true){
$("#"+obj).find(".iena-select").hide();
$("#"+obj).find(".iena-matrix-icons").show();
$("#"+obj).find(".module-outcome").show();
//$(pencil).data('edit', 'editOff');
}
else{
$("#"+obj).find(".iena-select").show();
$("#"+obj).find(".iena-matrix-icons").hide();
$("#"+obj).find(".module-outcome").hide();
//$(pencil).data('edit', 'editOn');
}
}
......@@ -188,21 +208,19 @@ function addActivities(url, idcourse){
function supprimer_lien(obj) {
var res = window.confirm('Etes-vous sûr de vouloir supprimer le lien entre cette activité et cette compétence ?');
if (res) {
var t = obj.parentNode;
var p = t.parentNode;
var c = p.children;
c[0].setAttribute("style", "display:none");
c[1].setAttribute("style", "display:none");
c[2].setAttribute("style", "display:inline");
console.log(obj);
var div_id = c[0].id;
var string=obj.split('-');
var module_id=string[0].substring(8);
var competency_id=string[1].substring(10);
var cell=$("#"+obj);
var module_id = div_id.split('-')[0];
module_id = module_id.replace ( /[^\d.]/g, '' );
var competency_id = div_id.split('-')[1];
competency_id = competency_id.replace ( /[^\d.]/g, '' );
//cell.find(".iena-select").hide();
cell.find(".iena-matrix-icons > .fa-trash").hide();
cell.find(".module-outcome").hide();
var url = window.location.href;
......@@ -219,7 +237,8 @@ function supprimer_lien(obj) {
contentType: 'application/x-www-form-urlencoded',
success: function (data, status) {
if (status == "success") {
//changeColor(p);
$("#divmodule"+module_id+"-competency"+competency_id+" p").html("");
$("#divmodule"+module_id+"-competency"+competency_id).hide();
}
},
error: function (xhr, status, error) {
......@@ -254,11 +273,14 @@ function supprimer_lien_cpt(cpt_id) {
});
}
}
function select_value(){
}
//Edite le lien entre compétence et activité dans la matrice
function select_update(obj){
var t = obj.parentNode;
console.log(obj);
/*var t = obj.parentNode;
var p = t.parentNode;
var c = p.children;
......@@ -266,20 +288,24 @@ function select_update(obj){
c[1].setAttribute("style", "display:none");
c[2].setAttribute("style", "display:inline");
c[2].dataset.edit = 'editOff';
c[2].dataset.edit = 'editOff';*/
var select=$("#"+obj);
var choix_ruleoutcome=select.val();
var tab0_elem = c[1].children;
var select = tab0_elem[0];
var choix_ruleoutcome =select.value;
var string=obj.split('-');
var module_id=string[0].substring(9);
var competency_id=string[1].substring(10);
var select_id =select.id;
var cell=$("#tdmodule"+module_id+"-competency"+competency_id);
console.log(cell);
var div_form=cell.find(".iena-select");
console.log(div_form);
var module_id = select_id.split('-')[0];
module_id = module_id.replace ( /[^\d.]/g, '' );
cell.find(".iena-select").hide();
cell.find(".iena-matrix-icons").show();
var competency_id = select_id.split('-')[1];
competency_id = competency_id.replace ( /[^\d.]/g, '' );
var url = window.location.href;
......@@ -301,8 +327,14 @@ function select_update(obj){
/*if (!(switchColor.trim() == "update")){
changeColor(p);
}*/
var div_id = c[0].id;
document.getElementById(div_id).firstChild.nextSibling.textContent = renderer;
//var div_id = c[0].id;
//document.getElementById(div_id).firstChild.nextSibling.textContent = renderer;
$("#divmodule"+module_id+"-competency"+competency_id+" p").html(renderer);
$("#divmodule"+module_id+"-competency"+competency_id).show();
//cell.find(".iena-matrix-icons > .fa-times").data("edit", "editOff");
cell.find(".iena-matrix-icons > .fa-trash").show();
//cell.find(".module-outcome").show();
}
},
......
......@@ -240,10 +240,32 @@ table.dataTable{
position: relative;
}
.dataTable thead th i{
.dataTable thead th i.fa-trash{
top: 8px;
right: 0;
position: absolute;
}
.dataTable tbody tr td span p, .iena-matrix-icons{
display: inline-block;
}
.iena-matrix-icons i, .dataTable .text-success i{
margin-right: 0;
}
.dataTables_scroll .dataTable td{
height: 42.2px;
}
.dataTable i{
cursor: pointer;
}
.dataTables_scroll .dataTable td:not(:first-child), .dataTables_scroll .dataTable th:not(:first-child){
min-width: 355px;
}
......@@ -32,37 +32,38 @@
<tr>
<td><a href="{{link}}">{{name}}</a></td>
{{#mcompetencies}}
<td class="text-success" align=right>
<td class="text-success" align=right id="tdmodule{{moduleid}}-competency{{id}}">
{{#module_ruleoutcomestring}}
<span style="display:inline" id="divmodule{{moduleid}}-competency{{id}}">
<p style="margin:0">{{module_ruleoutcomestring}}</p>
{{#edit}}
<i class="icon fa fa-trash fa-fw" style="color:#dc493a" onclick='supprimer_lien(this)'></i>
{{/edit}}
</span>
<span style="display:inline" class="module-outcome" id="divmodule{{moduleid}}-competency{{id}}">
<p style="margin:0">{{module_ruleoutcomestring}}</p>
</span>
{{/module_ruleoutcomestring}}
{{^module_ruleoutcomestring}}
<span style="display:none" id="divmodule{{moduleid}}-competency{{id}}">
<p style="margin:0">{{module_ruleoutcomestring}}</p>
{{#edit}}
<i class="icon fa fa-trash fa-fw " style="color:#dc493a" onclick='supprimer_lien(this)'></i>
{{/edit}}
</span>
<span style="display:none" id="divmodule{{moduleid}}-competency{{id}}">
<p style="margin:0"></p>
</span>
{{/module_ruleoutcomestring}}
{{#edit}}
<div style="display:none">
<select id="selmodule{{moduleid}}-competence{{id}}"">
<div style="display:none" class="iena-select">
<select id="selmodule{{moduleid}}-competency{{id}}">
<option value="0">{{# str }} nothing, block_competency_iena{{/ str }}</option>
<option value="1">{{# str }} add_proof, block_competency_iena{{/ str }}</option>
<option value="2">{{# str }} send_valide, block_competency_iena{{/ str }}</option>
<option value="3">{{# str }} mark_ok_competency, block_competency_iena{{/ str }}</option>
</select>
<i class="fa fa-check icon-green-iena" onclick='select_update(this)'></i>
<i class="fa fa-check icon-green-iena" onclick='select_update("selmodule{{moduleid}}-competency{{id}}")'></i>
<i class="icon fa fa-times fa-fw" style="color:rgb(33, 37, 41)" data-edit='editOn' onclick='showFilter("tdmodule{{moduleid}}-competency{{id}}", true)'></i>
</div>
<div class="iena-matrix-icons">
<i class="icon fa fa-pencil fa-fw" style="color:rgb(33, 37, 41)" data-edit='editOff' onclick='showFilter("tdmodule{{moduleid}}-competency{{id}}", false)'></i>
{{#module_ruleoutcomestring}}
<i class="icon fa fa-trash fa-fw " style="color:#dc493a;" onclick='supprimer_lien("tdmodule{{moduleid}}-competency{{id}}")'></i>
{{/module_ruleoutcomestring}}
{{^module_ruleoutcomestring}}
<i class="icon fa fa-trash fa-fw " style="color:#dc493a;display:none" onclick='supprimer_lien("tdmodule{{moduleid}}-competency{{id}}")'></i>
{{/module_ruleoutcomestring}}
</div>
<i class="icon fa fa-pencil fa-fw" style="color:rgb(33, 37, 41)" data-edit='editOff' onclick='showFilter(this)'></i>
{{/edit}}
</td>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment