Better handle of data view when missing info

Also data update
This commit is contained in:
Théo Marchal 2021-02-11 14:12:57 +01:00
parent 408825f004
commit f27d1a8dad
5 changed files with 65 additions and 23 deletions

File diff suppressed because one or more lines are too long

View File

@ -51,6 +51,7 @@
<li><span class="title">lieu :</span><span class="content place">&nbsp;</span></li> <li><span class="title">lieu :</span><span class="content place">&nbsp;</span></li>
<li><span class="title">état photo :</span><span class="content photo">&nbsp;</span></li> <li><span class="title">état photo :</span><span class="content photo">&nbsp;</span></li>
<li><span class="title">aide requise :</span><span class="content help">&nbsp;</span></li> <li><span class="title">aide requise :</span><span class="content help">&nbsp;</span></li>
<li><span class="title">tags :</span><span class="content tag">&nbsp;</span></li>
<li><span class="title">commentaire :</span><span class="content comment"> </span></li> <li><span class="title">commentaire :</span><span class="content comment"> </span></li>
<li><span class="content original"><a href="photos/paintings/original/42.jpg">photo originale ⭧</a></span></li> <li><span class="content original"><a href="photos/paintings/original/42.jpg">photo originale ⭧</a></span></li>
</ul> </ul>

View File

@ -52,8 +52,8 @@ jQuery(document).ready(function($)
//dimensions.sort(); //dimensions.sort();
genres.sort(); genres.sort();
themes.sort(); themes.sort();
places.sort(); places.sort(Intl.Collator().compare);
tags.sort(); tags.sort(Intl.Collator().compare);
/*for (dimension of dimensions) /*for (dimension of dimensions)
{ {
@ -463,14 +463,27 @@ jQuery(document).ready(function($)
var idx = item.opts.fancyboxIndex - 1; // painting number var idx = item.opts.fancyboxIndex - 1; // painting number
if (item.opts.fancyboxIndex >= 1000) if (item.opts.fancyboxIndex >= 1000)
idx = item.opts.fancyboxIndex - 1000 + 383 - 1; // inédit: index starts at 1000 // 383: total number of paintings except inédit idx = item.opts.fancyboxIndex - 1000 + 383 - 1; // inédit: index starts at 1000 // 383: total number of paintings except inédit
return '\
<div id="info">\ function generateCartel()
<span class="info"><a href="painting.html?number=' + data[idx].number + '">&#8505;&#xFE0E;</span></a></span>\ {
<span class="title">' + data[idx].title + '</span><span class="year">' + (data[idx].month != '' ? data[idx].month + '&nbsp;' : '') + data[idx].year + '</span>\ cartel = '<div id="info"><span class="info">';
<span class="format">' + data[idx].paint + ' sur ' + data[idx].support + ' (' + data[idx].dimension + ')</span>\ cartel += '<a href="painting.html?number=' + data[idx].number + '">&#8505;&#xFE0E;</span></a></span>';
<span class="comment">' + data[idx].comment + '</span>\ cartel += '<span class="title">' + data[idx].title + '</span><span class="year">';
</div>\ if (data[idx].month != '—')
'; cartel += data[idx].month + '&nbsp;';
if (data[idx].year != '—')
cartel += data[idx].year;
cartel += '</span><span class="format">' + data[idx].paint + ' sur ' + data[idx].support.toLowerCase();
if (data[idx].dimension != '—')
cartel += ' (' + data[idx].dimension + ')';
cartel += '</span>';
if (data[idx].comment != '—')
cartel += '<span class="comment">' + data[idx].comment + '</span>';
cartel += '</div>';
return cartel;
}
return generateCartel();
} }
}); });
}); });

View File

@ -31,14 +31,26 @@ jQuery(document).ready(function($)
if (item.opts.fancyboxIndex >= 1000) if (item.opts.fancyboxIndex >= 1000)
idx = item.opts.fancyboxIndex - 1000 + 383 - 1; // inédit: index starts at 1000 // 383: total number of paintings except inédit idx = item.opts.fancyboxIndex - 1000 + 383 - 1; // inédit: index starts at 1000 // 383: total number of paintings except inédit
return '\ function generateCartel()
<div id="info">\ {
<span class="info"><a href="painting.html?number=' + data[idx].number + '">&#8505;&#xFE0E;</span></a></span>\ cartel = '<div id="info"><span class="info">';
<span class="title">' + data[idx].title + '</span><span class="year">' + (data[idx].month != '' ? data[idx].month + '&nbsp;' : '') + data[idx].year + '</span>\ cartel += '<a href="painting.html?number=' + data[idx].number + '">&#8505;&#xFE0E;</span></a></span>';
<span class="format">' + data[idx].paint + ' sur ' + data[idx].support.toLowerCase() + ' (' + data[idx].dimension + ')</span>\ cartel += '<span class="title">' + data[idx].title + '</span><span class="year">';
<span class="comment">' + data[idx].comment + '</span>\ if (data[idx].month != '—')
</div>\ cartel += data[idx].month + '&nbsp;';
'; if (data[idx].year != '—')
cartel += data[idx].year;
cartel += '</span><span class="format">' + data[idx].paint + ' sur ' + data[idx].support.toLowerCase();
if (data[idx].dimension != '—')
cartel += ' (' + data[idx].dimension + ')';
cartel += '</span>';
if (data[idx].comment != '—')
cartel += '<span class="comment">' + data[idx].comment + '</span>';
cartel += '</div>';
return cartel;
}
return generateCartel();
} }
}); });
}); });

View File

@ -38,6 +38,7 @@ jQuery(document).ready(function($)
$(".metadata .content.date").append(data[i].month + " " + data[i].year); $(".metadata .content.date").append(data[i].month + " " + data[i].year);
else else
$(".metadata .content.date").append(data[i].year); $(".metadata .content.date").append(data[i].year);
$(".metadata .content.dimension").append(data[i].dimension); $(".metadata .content.dimension").append(data[i].dimension);
$(".metadata .content.support").append(data[i].support); $(".metadata .content.support").append(data[i].support);
$(".metadata .content.genre").append(data[i].genre); $(".metadata .content.genre").append(data[i].genre);
@ -55,7 +56,15 @@ jQuery(document).ready(function($)
else else
$(".metadata .content.help").append("non"); $(".metadata .content.help").append("non");
if (data[i].tags != "—")
$(".metadata .content.tag").append(data[i].tags);
else
$(".metadata .content.tag").parent().css("display", "none");
if (data[i].comment != "—")
$(".metadata .content.comment").append(data[i].comment); $(".metadata .content.comment").append(data[i].comment);
else
$(".metadata .content.comment").parent().css("display", "none");
if (data[i].photo != "none") if (data[i].photo != "none")
$(".metadata .content.original a").attr("href", "photos/paintings/original/" + data[i].number + ".jpg"); $(".metadata .content.original a").attr("href", "photos/paintings/original/" + data[i].number + ".jpg");
@ -68,9 +77,16 @@ jQuery(document).ready(function($)
$("#info .year").append(data[i].month + " " + data[i].year); $("#info .year").append(data[i].month + " " + data[i].year);
else else
$("#info .year").append(data[i].year); $("#info .year").append(data[i].year);
format = data[i].paint + " sur " + data[i].support.toLowerCase(); format = data[i].paint + " sur " + data[i].support.toLowerCase();
if (data[i].dimension != "—")
format += " (" + data[i].dimension + ")"; format += " (" + data[i].dimension + ")";
$("#info .format").append(format); $("#info .format").append(format);
if (data[i].comment != "—")
$("#info .comment").prepend(data[i].comment); $("#info .comment").prepend(data[i].comment);
else
$("#info .comment").css("display", "none");
}); });
}); });