aggiunta possibilità di filtering
This commit is contained in:
parent
e6e52c4243
commit
d079a84ea6
|
|
@ -920,7 +920,7 @@ $(document).ready(function() {
|
|||
return text;
|
||||
}
|
||||
}
|
||||
|
||||
var noteAdded;
|
||||
jQuery(document).delegate(' .showcomments', 'click', function() {
|
||||
var cid = $(this).attr('id');
|
||||
if (!hasCommentsJson(cid)) {
|
||||
|
|
@ -961,19 +961,29 @@ $(document).ready(function() {
|
|||
} else {
|
||||
versText = ", Verso " + gruppoVersi;
|
||||
}
|
||||
|
||||
currentGroup = createNoteGroup(cantica, getRoman(parcid[2]), versText, k, commentsSQL[k].length)
|
||||
var queryComment = false;
|
||||
if (parcid[0] == "CommentoQuery") {
|
||||
queryComment = true;
|
||||
}
|
||||
currentGroup = createNoteGroup(cantica, getRoman(parcid[2]), versText, k, commentsSQL[k].length, queryComment)
|
||||
noteAdded = false;
|
||||
commentsSQL[k].forEach(function(value, i) {
|
||||
currentGroup.append(createNoteEntry(value, k, i))
|
||||
currentGroup.append(createNoteEntry(value, k, i, queryComment))
|
||||
});
|
||||
if (queryComment){ //Nik changes
|
||||
if (noteAdded){
|
||||
commentArea.append(currentGroup);
|
||||
}
|
||||
}else{
|
||||
commentArea.append(currentGroup);
|
||||
}
|
||||
}
|
||||
$('#tab-list #vis0-tab').tab('show')
|
||||
})
|
||||
|
||||
})
|
||||
|
||||
function createNoteGroup(cantica, canto, versi, id, len) {
|
||||
function createNoteGroup(cantica, canto, versi, id, len, queryComment) {
|
||||
var noteGroupCard = $('<div class="card card-body noteCardGroup well well-sm mx-1 my-2 p-0" id="noteGroupCard' + id + '">');
|
||||
var commentHeader = $('<div class="d-flex align-content-start flex-nowrap text-muted" id="commentoGruppoVersi' + id + '">')
|
||||
var rigaNota = $('<div class="p-0 m-0">');
|
||||
|
|
@ -985,26 +995,51 @@ $(document).ready(function() {
|
|||
if (len > 1) {
|
||||
var commentiSP = " commenti su "
|
||||
} else {
|
||||
var commentiSP = " commento su "
|
||||
var commentiSP = " commento su " // Nik riferimenti modificare con funzione successiva
|
||||
}
|
||||
//noteGroupCard.append('<h6 class="card-title m-2 text-warning">' + cantica + ", Canto " + canto + versi + "</h6>");
|
||||
rigaNota.append('<h6 class="card-title m-2 text-warning"><span class="badge badge-warning badge-pill mx-1">' + len + "</span>" + commentiSP + cantica + ", Canto " + canto + versi + "</h6>");
|
||||
rigaNota.appendTo(commentHeader);
|
||||
if (queryComment) {
|
||||
var filterButton = $('<button />'); // Nik da migliorare
|
||||
filterButton.attr('id', 'filterRiferimentiOn_' + id + '_' + canto)
|
||||
filterButton.attr('class', 'btn btn-sm btn-outline-primary showQueryComments border-0 rounded text-primary px-1 pt-1 pb-0 ml-1');
|
||||
var filterIcon = '<ion-icon name="funnel"></ion-icon>';
|
||||
var filterIcon1 = '<ion-icon name="funnel-outline"></ion-icon>';
|
||||
var filterButton1 = $('<button />'); // Nik da migliorare
|
||||
filterButton1.attr('id', 'filterRiferimentiOff_' + id + '_' + canto)
|
||||
filterButton1.attr('class', 'btn btn-sm btn-outline-primary showQueryComments border-0 rounded text-primary px-1 pt-1 pb-0 ml-1');
|
||||
filterButton1.append(filterIcon1)
|
||||
filterButton1.css('display', 'none');
|
||||
filterButton.append(filterIcon)
|
||||
filterButton.appendTo(commentHeader)
|
||||
filterButton1.appendTo(commentHeader)
|
||||
} else {
|
||||
$('#'+'filterRiferimentiOn_' + id + '_' + canto).remove()
|
||||
$('#'+'filterRiferimentiOff_' + id + '_' + canto).remove()
|
||||
}
|
||||
|
||||
buttons.appendTo(commentHeader);
|
||||
commentHeader.appendTo(noteGroupCard);
|
||||
|
||||
return noteGroupCard;
|
||||
}
|
||||
|
||||
function createNoteEntry(comments, id, pos) {
|
||||
function createNoteEntry(comments, id, pos, queryComment) {
|
||||
const tmplistaidcomm = getListaIdCommenti()
|
||||
var idref = comments.Id
|
||||
if(tmplistaidcomm.length && tmplistaidcomm.includes(idref)){
|
||||
var noteCard = $('<div class="card card-body border-success well well-sm mx-1 mb-1 mt-0 p-0" id="noteCard' + id + '_' + pos +'"'+ ' name= "'+idref+'">');
|
||||
}
|
||||
else
|
||||
var noteCard = $('<div class="card card-body well well-sm mx-1 mb-1 mt-0 p-0 border-lida08" id="noteCard' + id + '_' + pos +'"'+ ' name= "'+idref+'">');
|
||||
|
||||
if (tmplistaidcomm.length && tmplistaidcomm.includes(idref)) { // Nik riferimenti
|
||||
var noteCard = $('<div class="card card-body bg-light border-success well well-sm mx-1 mb-1 mt-0 p-0" id="noteCard' + id + '_' + pos + '"' + ' name= "' + idref + '">');
|
||||
noteAdded = true;
|
||||
}
|
||||
else { //Nik changes
|
||||
var noteCard = $('<div class="card card-body well well-sm mx-1 mb-1 mt-0 p-0 border-lida08" id="noteCard' + id + '_' + pos + '"' + ' name= "' + idref + '">');
|
||||
if (queryComment){
|
||||
noteCard.css("display", "none");
|
||||
}
|
||||
|
||||
}
|
||||
var collapseCardBody = $('<div class="card-body px-0 py-1 mx-3 my-0 border-top rounded" >');
|
||||
var divCampiSingoli = $('<div class="d-flex align-content-start flex-wrap text-muted">');
|
||||
//createNoteHeader(noteCard, comments, id, pos, cantica, parcid, saveVersoCitazione);
|
||||
|
|
@ -1482,7 +1517,7 @@ $(document).ready(function() {
|
|||
const tmplistaidcomm = getListaIdCommenti()
|
||||
for (var idco of tmplistaidcomm) {
|
||||
//$('[name="' + cantica + 'Canto ' + k + '"]')
|
||||
$('[name="' + idco + '"]').removeClass('border-success ')
|
||||
$('[name="' + idco + '"]').removeClass('border-success ') // Nik riferimenti
|
||||
}
|
||||
cleanListaRis()
|
||||
drawMinimap(cantoDisplayed, true)
|
||||
|
|
|
|||
|
|
@ -95,7 +95,7 @@ export function getListaRis() {
|
|||
return listaidversi;
|
||||
}
|
||||
export function getListaIdCommenti() {
|
||||
return listaidcommenti;
|
||||
return listaidcommenti; // Nik riferimenti
|
||||
}
|
||||
export function cleanListaRis() {
|
||||
listaidversi = [];
|
||||
|
|
@ -266,8 +266,20 @@ export async function queryRiferimenti(filtro, cid) {
|
|||
//console.log(myveid)
|
||||
listaidversi.push(myveid)
|
||||
listaidcommenti.push(tmpvi.IdRiferimento)
|
||||
if (cid.includes(cantica) && numcid == canto)
|
||||
$(myveid).addClass("mark ")
|
||||
if (cid.includes(cantica) && numcid == canto){
|
||||
var multiButton = $('<button />');
|
||||
multiButton.attr('id','CommentoQuery_'+ i + '_' + canto + '_' + tmpvi.Verso.split('-')[0])
|
||||
multiButton.attr('class', 'btn btn-sm btn-outline-primary showcomments bg-light border-0 rounded text-primary px-1 pt-1 pb-0 ml-1');
|
||||
var commentIcon = '<ion-icon name="document-attach"></ion-icon>';
|
||||
multiButton.append (commentIcon)
|
||||
var idButton = null;
|
||||
idButton = $('#'+ 'CommentoQuery_'+ i + '_' + canto + '_' + tmpvi.Verso.split('-')[0]);
|
||||
if (idButton [0] == null){
|
||||
$(myveid).append(multiButton);
|
||||
}
|
||||
$(myveid).addClass("mark ") // Nik Riferimenti
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -68,7 +68,6 @@ $(document).ready(function() {
|
|||
setStyle(newStyle);
|
||||
});
|
||||
$('#btnParentesi').on('click', function() {
|
||||
var fava = $("#parentesiAperta1");
|
||||
$("#parentesiAperta1").attr('style', "display: d-flex;");
|
||||
$("#parentesiChiusa2").attr('style', "display: d-flex;");
|
||||
});
|
||||
|
|
@ -166,6 +165,7 @@ $(document).ready(function() {
|
|||
});
|
||||
if (tabID == 0) {
|
||||
tabID++;
|
||||
// Fake Nik Parentesi
|
||||
$('#sortable0').append('<h3 class="text-primary " id="parentesiAperta1" style="display: none;">(<br></h3>');
|
||||
|
||||
addGramCla("#sortable0", 1, tabID, 1);
|
||||
|
|
@ -1159,6 +1159,8 @@ $(document).ready(function() {
|
|||
$(sortableId).append(boolCond)
|
||||
$(sortableId).append($(cloneLI)[0]);
|
||||
if (tabID == 2){
|
||||
// Fake Nik Parentesi
|
||||
|
||||
$(sortableId).append('<h3 class="text-primary " id="parentesiChiusa2" style="display: none;">)<br></h3>');
|
||||
}
|
||||
if (toExpand == 1) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue