comparison sat_templates/templates/default/input/textbox.html @ 164:e9f0a4215e46

multi-sites handling (moved templates to "templates" sub-directory) + noscript styles handling.
author Goffi <goffi@goffi.org>
date Mon, 10 Sep 2018 08:53:33 +0200
parents sat_templates/default/input/textbox.html@b84d20af0ed3
children 178f55b825b7
comparison
equal deleted inserted replaced
163:33f67228686a 164:e9f0a4215e46
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 submit(label=_("Send")) %}
12 <input type="submit" value="{{label}}">
13 {% endmacro %}
14
15 {% macro textbox(service, node, action='', placeholder='',
16 submit_label=_("Send"), type="textbox",
17 class='', ta_class='') %}
18 {# generic content area for comments/blog posts/etc.
19 Only a body by default, but new elements can be
20 added by using this macro with call #}
21 {% set extra_content = caller() if caller is defined else '' %}
22 {% call form.form(action=action, class="textbox " + class) %}
23 {{ head(service, node, type) }}
24 {{ extra_content }}
25 {{ field.textarea("body", placeholder=placeholder, required=True,
26 class=ta_class) }}
27 {{ submit(label=submit_label) }}
28 {% endcall %}
29 {% endmacro %}
30
31 {% macro blog_text(service, node, action='', placeholder=_("Your comment")) %}
32 {{ textbox(service, node, action=action, placeholder=placeholder, type="comment") }}
33 {% endmacro %}
34
35 {% macro comment(service, node, action='', placeholder=_("Your comment"), class='box--medium') %}
36 {{ textbox(service, node, action=action, placeholder=placeholder, type="comment", class=class) }}
37 {% endmacro %}
38
39 {% macro comment_or_login(service, node, action='', placeholder=none) %}
40 {# show comment form a a message asking to log in
41 login is checked using profile #}
42 {% if profile %}
43 {% if placeholder is none %}
44 {{ comment(service, node, action) }}
45 {% else %}
46 {{ comment(service, node, action, placeholder=placeholder) }}
47 {% endif %}
48 {% else %}
49 <div class="log_request">
50 <p class="not_logged">{% trans %}You are not logged. You need to log in to comment.{% endtrans %}</p>
51 {% if login_url is defined %}
52 <p class="log_in_url">
53 {% trans link_start=('<a href="',login_url,'">')|join|safe, link_end='</a>'|safe %}
54 To log in {{link_start}}follow this link{{link_end}}
55 {% endtrans %}
56 </p>
57 {% endif %}
58 </div>
59 {% endif %}
60 {% endmacro %}