');
function warnNoPicture() {
- li.addClass('warning');
- link.text('no picture for node ' + node._id);
+ let card_icon = $('
');
+ card_icon.html('
');
+ thumbnail_container.append(card_icon);
}
if (!node.picture) {
warnNoPicture();
- return li;
+ } else {
+ // TODO: show 'loading' thingy
+ $.get('/api/files/' + node.picture)
+ .fail(function(error) {
+ let msg = xhrErrorResponseMessage(error);
+ console.log(msg);
+ })
+ .done(function(resp) {
+ // Render the picture if it has the proper size.
+ var show_variation = null;
+ if (typeof resp.variations != 'undefined') {
+ for (variation of resp.variations) {
+ if (variation.size != 'm') continue;
+ show_variation = variation;
+ break;
+ }
+ }
+
+ if (show_variation == null) {
+ warnNoPicture();
+ return;
+ }
+
+ let img = $('
')
+ .attr('alt', node.name)
+ .attr('src', variation.link)
+ .attr('width', variation.width)
+ .attr('height', variation.height);
+ thumbnail_container.append(img);
+ });
}
- // TODO: show 'loading' thingy
- $.get('/api/files/' + node.picture)
- .fail(function(error) {
- let msg = xhrErrorResponseMessage(error);
- li.addClass('error').text(msg);
- })
- .done(function(resp) {
- // Render the picture if it has the proper size.
- var show_variation = null;
- if (typeof resp.variations != 'undefined') {
- for (variation of resp.variations) {
- if (variation.size != 'm') continue;
- show_variation = variation;
- break;
- }
- }
+ card.append(thumbnail_container);
- if (show_variation == null) {
- warnNoPicture();
- return;
- }
+ /* Card body for title and meta info. */
+ let card_body = $('');
+ let card_title = $('