import { NodesFactoryInterface } from './nodes' import { thenLoadImage } from './utils'; class Posts extends NodesFactoryInterface { static create$item(post) { let content = []; let $title = $('
') .addClass('display-4 text-uppercase font-weight-bold') .text(post.name); content.push($title); let $text = $('
') .addClass('lead') .text(post['pretty_created']); content.push($text); let $jumbotron = $('') .addClass('jumbotron text-white jumbotron-overlay') .attr('href', '/nodes/' + post._id + '/redir') .append( $('
') .addClass('container') .append( $('
') .addClass('row') .append( $('
') .addClass('col-md-9') .append(content) ) ) ); thenLoadImage(post.picture, 'l') .then((img)=>{ $jumbotron.attr('style', 'background-image: url(' + img.link + ');') }) .fail((error)=>{ let msg = xhrErrorResponseMessage(error); console.log(msg || error); }) let $post = $('
') .addClass('expand-image-links imgs-fluid') .append( $jumbotron, $('
') .addClass('node-details-description mx-auto py-5') .html(post['properties']['_content_html']) ); return $post; } } export { Posts };