230
|
1 {% import 'input/form.html' as form with context %} |
|
2 {% import 'input/field.html' as field with context %} |
|
3 |
|
4 {% macro head(service, node, type="textbox") %} |
|
5 {# include data needed to identify the node to use for commenting #} |
|
6 <input type="hidden" name="type" value="{{type}}"> |
|
7 <input type="hidden" name="service" value="{{service}}"> |
|
8 <input type="hidden" name="node" value="{{node}}"> |
|
9 {% endmacro %} |
|
10 |
|
11 {% macro textbox(service, node, action='', placeholder='', |
|
12 submit_label=_("Send"), type="textbox", |
|
13 class='', ta_class='') %} |
|
14 {# generic content area for comments/blog posts/etc. |
|
15 Only a body by default, but new elements can be |
|
16 added by using this macro with call #} |
|
17 {% set extra_content = caller() if caller is defined else '' %} |
|
18 {% call form.form(action=action, class="textbox " + class) %} |
|
19 {{ head(service, node, type) }} |
|
20 {{ extra_content }} |
|
21 <article class="media"> |
|
22 {% if identities is defined and own_jid is defined %} |
|
23 {% if avatar is defined %} |
|
24 <div class="media-left"> |
|
25 {{ avatar.avatar(own_jid.userhost()) }} |
|
26 </div> |
|
27 {% endif %} |
|
28 {% endif %} |
|
29 <div class="media-content"> |
|
30 {{ field.textarea("body", placeholder=placeholder, required=True) }} |
|
31 <nav class="level"> |
|
32 <div class="level-left"> |
|
33 <div class="level-item"> |
|
34 {{ field.submit() }} |
|
35 </div> |
|
36 </div> |
|
37 </nav> |
|
38 </div> |
|
39 </article> |
|
40 {# {{ field.textarea("body", placeholder=placeholder, required=True, |
|
41 class=ta_class) }} |
|
42 {{ submit(label=submit_label) }} #} |
|
43 {% endcall %} |
|
44 {% endmacro %} |
|
45 |
|
46 {% macro blog_text(service, node, action='', placeholder=_("Your comment")) %} |
|
47 {{ textbox(service, node, action=action, placeholder=placeholder, type="comment") }} |
|
48 {% endmacro %} |
|
49 |
|
50 {% macro comment(service, node, action='', placeholder=_("Your comment"), class='box--medium') %} |
|
51 {{ textbox(service, node, action=action, placeholder=placeholder, type="comment", class=class) }} |
|
52 {% endmacro %} |
|
53 |
|
54 {% macro comment_or_login(service, node, action='', placeholder=none) %} |
|
55 {# show comment form a a message asking to log in |
|
56 login is checked using profile #} |
|
57 {% if profile %} |
|
58 {% if placeholder is none %} |
|
59 {{ comment(service, node, action) }} |
|
60 {% else %} |
|
61 {{ comment(service, node, action, placeholder=placeholder) }} |
|
62 {% endif %} |
|
63 {% else %} |
|
64 <div class="container"> |
|
65 <article class="message"> |
|
66 <div class="message-body"> |
|
67 <p>{% trans %}You are not logged. You need to log in to comment.{% endtrans %}</p> |
|
68 {% if login_url is defined %} |
|
69 <p class="log_in_url"> |
|
70 {% trans link_start=('<a href="',login_url,'">')|join|safe, link_end='</a>'|safe %} |
|
71 To log in {{link_start}}follow this link{{link_end}} |
|
72 {% endtrans %} |
|
73 </p> |
|
74 {% endif %} |
|
75 </div> |
|
76 </article> |
|
77 </div> |
|
78 {% endif %} |
|
79 {% endmacro %} |