Mercurial > libervia-templates
annotate sat_templates/templates/bulma/input/textbox.html @ 325:8c779fb46384
bulma (components/block): interests_grid is more customisable:
- new `delete_icon` argument can be set to `false` if delete icon is not desired
- the macro can now be called, the caller then get 2 arguments: part to customise and
current interest. Part to customise can be:
* `header-title`: markup to put in the title
* `content`: car content (replaces the default `interest.name`)
author | Goffi <goffi@goffi.org> |
---|---|
date | Sat, 01 May 2021 18:44:47 +0200 |
parents | fbea1b9a558f |
children |
rev | line source |
---|---|
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) }} | |
251 | 20 {{ extra_content }} |
21 <article class="media px-4 py-3"> | |
230 | 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")) %} | |
250
e0a30db831a1
bulma (input/textbox): fixed unregular spaces use
Goffi <goffi@goffi.org>
parents:
230
diff
changeset
|
47 {{ textbox(service, node, action=action, placeholder=placeholder, type="comment") }} |
230 | 48 {% endmacro %} |
49 | |
50 {% macro comment(service, node, action='', placeholder=_("Your comment"), class='box--medium') %} | |
250
e0a30db831a1
bulma (input/textbox): fixed unregular spaces use
Goffi <goffi@goffi.org>
parents:
230
diff
changeset
|
51 {{ textbox(service, node, action=action, placeholder=placeholder, type="comment", class=class) }} |
230 | 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 %} | |
296
fbea1b9a558f
bulma: new search box, used in blog for now
Goffi <goffi@goffi.org>
parents:
251
diff
changeset
|
80 |
fbea1b9a558f
bulma: new search box, used in blog for now
Goffi <goffi@goffi.org>
parents:
251
diff
changeset
|
81 {% macro search() %} |
fbea1b9a558f
bulma: new search box, used in blog for now
Goffi <goffi@goffi.org>
parents:
251
diff
changeset
|
82 {% call form.form(method="get", use_csrf_token=false) %} |
fbea1b9a558f
bulma: new search box, used in blog for now
Goffi <goffi@goffi.org>
parents:
251
diff
changeset
|
83 {% call field.text("search", class="has-addons", required=true, icon_left="search") %} |
fbea1b9a558f
bulma: new search box, used in blog for now
Goffi <goffi@goffi.org>
parents:
251
diff
changeset
|
84 {{ field.submit(_("Search")) }} |
fbea1b9a558f
bulma: new search box, used in blog for now
Goffi <goffi@goffi.org>
parents:
251
diff
changeset
|
85 {% endcall %} |
fbea1b9a558f
bulma: new search box, used in blog for now
Goffi <goffi@goffi.org>
parents:
251
diff
changeset
|
86 {% endcall %} |
fbea1b9a558f
bulma: new search box, used in blog for now
Goffi <goffi@goffi.org>
parents:
251
diff
changeset
|
87 {% endmacro %} |