comparison sat_templates/default/input/textbox.html @ 147:33c7ce833d3f

install: setup.py fix + moved "default" dir in a "sat_templates" dir: the merge request at https://bugs.goffi.org/mr/view/3 was a good basis, but not fully working ("default" dir was removed), this patch fixes it, and do some improvments: - moved "default" in "sat_templates" dir, which correspond to the python module, so it can be found easily from python - added VERSION, and mercurial hash detection, in the same way as for Cagou and backend - slight modification of classifiers - replaces tabs coming from MR by spaces
author Goffi <goffi@goffi.org>
date Sat, 02 Jun 2018 17:25:43 +0200
parents default/input/textbox.html@da8f1ba9034d
children b84d20af0ed3
comparison
equal deleted inserted replaced
146:7dc00829c32f 147:33c7ce833d3f
1 {% import 'input/form.html' as form with context %}
2 {% import 'input/field.html' as field %}
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 submit(label=_("Send")) %}
12 <input type="submit" value="{{label}}">
13 {% endmacro %}
14
15 {% macro textbox(service, node, action='', placeholder='', submit_label=_("Send"), type="textbox") %}
16 {# generic content area for comments/blog posts/etc. Only a body by default, but new elements can be
17 added by using this macro with call #}
18 {% set extra_content = caller() if caller is defined else '' %}
19 {% call form.form(action=action, class="textbox") %}
20 {{ head(service, node, type) }}
21 {{ extra_content }}
22 {{ field.textarea("body", placeholder=placeholder, required=True) }}
23 {{ submit(label=submit_label) }}
24 {% endcall %}
25 {% endmacro %}
26
27 {% macro comment(service, node, action='', placeholder=_("Your comment")) %}
28 {{ textbox(service, node, action=action, placeholder=placeholder, type="comment") }}
29 {% endmacro %}
30
31 {% macro comment_or_login(service, node, action='', placeholder=none) %}
32 {# show comment form a a message asking to log in
33 login is checked using profile #}
34 {% if profile %}
35 {% if placeholder is none %}
36 {{ comment(service, node, action) }}
37 {% else %}
38 {{ comment(service, node, action, placeholder=placeholder) }}
39 {% endif %}
40 {% else %}
41 <div class="log_request">
42 <p class="not_logged">{% trans %}You are not logged. You need to log in to comment.{% endtrans %}</p>
43 {% if login_url is defined %}
44 <p class="log_in_url">
45 {% trans link_start=('<a href="',login_url,'">')|join|safe, link_end='</a>'|safe %}
46 To log in {{link_start}}follow this link{{link_end}}
47 {% endtrans %}
48 </p>
49 {% endif %}
50 </div>
51 {% endif %}
52 {% endmacro %}