| 1 | {# display a blog item which can be expanded/retracted by clicking on it |
| 2 | |
| 3 | if the locale differs from item language, it will be totally reduced, and will need a click to be displayed |
| 4 | |
| 5 | @variable item(data_object.BlogItem): item to display |
| 6 | @variable identities(data_object.Identities): identities which can be used to display info on item author |
| 7 | @variable dates_format(unicode): format of the date to use (see date_fmt filter) |
| 8 | #} |
| 9 | |
| 10 | {% block item %} |
| 11 | |
| 12 | {% set item_level = (item_level or 0) + 1 %} |
| 13 | |
| 14 | {% if item.language and locale and locale.language != item.language %} |
| 15 | {# we may display items in different language in a specific way #} |
| 16 | {% set other_lang = " other_lang" if expanded else " other_lang state_init" %} |
| 17 | {% endif %} |
| 18 | <article id="{{item.id}}" class="blog-item media px-4 py-3" > |
| 19 | {% if identities is defined %} |
| 20 | {% if avatar is defined %} |
| 21 | <div class="media-left"> |
| 22 | {{ avatar.avatar(item.author_jid) }} |
| 23 | </div> |
| 24 | {% endif %} |
| 25 | {% endif %} |
| 26 | <div class="media-content"> |
| 27 | {% set title = item.title_xhtml|safe or item.title%} |
| 28 | {% set item_http_uri = items_http_uri.get(item.id) if items_http_uri is defined else none %} |
| 29 | {% if title %} |
| 30 | <h4 class="title is-4"> |
| 31 | {% if item_http_uri %} |
| 32 | <a href="{{item_http_uri}}" class="has-text-black">{{title}}</a> |
| 33 | {% else %} |
| 34 | {{title}} |
| 35 | {% endif %} |
| 36 | </h4> |
| 37 | {% endif %} |
| 38 | <div class="content"> |
| 39 | <p class="subtitle is-6 has-text-grey"> |
| 40 | {% set published = item.published|date_fmt(fmt=dates_format) %} |
| 41 | {% if Identities is defined %} |
| 42 | <strong>{{identities[item.author_jid].nicknames[0] if identities[item.author_jid].nicknames else item.author}}</strong> |
| 43 | {% else %} |
| 44 | <strong>{{item.author}}</strong> |
| 45 | {% endif %} |
| 46 | {% if item_http_uri %} |
| 47 | <small><a href="{{item_http_uri}}" class="has-text-black">{{published}}</a></small> |
| 48 | {% else %} |
| 49 | <small>{{published}}</small> |
| 50 | {% endif %} |
| 51 | {% if item.tags %} |
| 52 | <small class="labels"> |
| 53 | {% if tags_http_uri is defined %} |
| 54 | {% for tag in item.tags %} |
| 55 | <a href="{{tags_http_uri[tag]}}"><span class="tag is-rounded">{{tag}}</span></a> |
| 56 | {% endfor %} |
| 57 | {% else %} |
| 58 | {% for tag in item.tags %} |
| 59 | <span class="tag">{{tag}}</span> |
| 60 | {% endfor %} |
| 61 | {% endif %} |
| 62 | </small> |
| 63 | {% endif %} |
| 64 | </p> |
| 65 | {% if item.content_xhtml is defined %} |
| 66 | {{item.content_xhtml|safe}} |
| 67 | {% else %} |
| 68 | <p class="is-text-content"> |
| 69 | {{- item.content|urlize -}} |
| 70 | </p> |
| 71 | {% endif %} |
| 72 | |
| 73 | <div class="blog-item-footer"></div> |
| 74 | |
| 75 | {# Actions #} |
| 76 | <div class="level mb-0 mt-1"> |
| 77 | <div class="level-left"> |
| 78 | <div class="level-item"> |
| 79 | {# |
| 80 | <button |
| 81 | class="button is-small is-text has-text-grey is-rounded mr-2" |
| 82 | aria-label="{% trans %}Reply{% endtrans %}" |
| 83 | > |
| 84 | {{ icon('reply', cls='icon is-small') }} |
| 85 | </button> |
| 86 | #} |
| 87 | |
| 88 | <button |
| 89 | class="reaction-button button is-small is-text has-text-grey is-rounded mr-2" |
| 90 | aria-label="{% trans %}React{% endtrans %}" |
| 91 | > |
| 92 | {{ icon('regular face-smile', cls='icon is-small') }} |
| 93 | </button> |
| 94 | |
| 95 | <button |
| 96 | class="button is-small is-text has-text-grey is-rounded mr-2" |
| 97 | aria-label="{% trans %}Mark the post as noticed{% endtrans %}" |
| 98 | > |
| 99 | {{ icon('star', cls='icon is-small') }} |
| 100 | </button> |
| 101 | |
| 102 | <button |
| 103 | class="button is-small is-text has-text-grey is-rounded" |
| 104 | aria-label="{% trans %}More options{% endtrans %}" |
| 105 | > |
| 106 | {{ icon('ellipsis', cls='icon is-small') }} |
| 107 | </button> |
| 108 | </div> |
| 109 | </div> |
| 110 | </div> |
| 111 | |
| 112 | {# comments #} |
| 113 | {% for comments_data in item.comments %} |
| 114 | {% if "items" in comment_data %} |
| 115 | {% for item in comments_data['items'] %} |
| 116 | {% include 'blog/item.html' %} |
| 117 | {% endfor %} |
| 118 | {% endif %} |
| 119 | {% if allow_commenting and item_level == 1 %} |
| 120 | <div class="comment_post"> |
| 121 | {{- textbox.comment(service=comments_data.service, node=comments_data.node) -}} |
| 122 | </div> |
| 123 | {% endif %} |
| 124 | {% endfor %} |
| 125 | |
| 126 | </div> |
| 127 | </div> |
| 128 | </article> |
| 129 | |
| 130 | {% endblock item %} |