Mercurial > libervia-templates
annotate sat_templates/templates/default/input/textbox.html @ 245:10278ba367a2
bulma (photo/discover): design for the new theme + create button + delete button
author | Goffi <goffi@goffi.org> |
---|---|
date | Fri, 19 Jun 2020 17:57:13 +0200 |
parents | 178f55b825b7 |
children |
rev | line source |
---|---|
37
eb9a42fca6c8
input/form: added csrf_token hidden field if it is defined, and import form with context to get this variable
Goffi <goffi@goffi.org>
parents:
28
diff
changeset
|
1 {% import 'input/form.html' as form with context %} |
153
b84d20af0ed3
macros (field, form, textbox): general improvments:
Goffi <goffi@goffi.org>
parents:
147
diff
changeset
|
2 {% import 'input/field.html' as field with context %} |
10
8b5615a1bf3d
articles, input: use new embedding mechanism in articles + new macros to build forms and inputs
Goffi <goffi@goffi.org>
parents:
7
diff
changeset
|
3 |
116
da8f1ba9034d
input/comment: renamed "comment" library to "textbox", and made it more generic
Goffi <goffi@goffi.org>
parents:
51
diff
changeset
|
4 {% macro head(service, node, type="textbox") %} |
10
8b5615a1bf3d
articles, input: use new embedding mechanism in articles + new macros to build forms and inputs
Goffi <goffi@goffi.org>
parents:
7
diff
changeset
|
5 {# include data needed to identify the node to use for commenting #} |
116
da8f1ba9034d
input/comment: renamed "comment" library to "textbox", and made it more generic
Goffi <goffi@goffi.org>
parents:
51
diff
changeset
|
6 <input type="hidden" name="type" value="{{type}}"> |
7
f1c773126f23
input/comments: comments input macros, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
7 <input type="hidden" name="service" value="{{service}}"> |
f1c773126f23
input/comments: comments input macros, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
8 <input type="hidden" name="node" value="{{node}}"> |
10
8b5615a1bf3d
articles, input: use new embedding mechanism in articles + new macros to build forms and inputs
Goffi <goffi@goffi.org>
parents:
7
diff
changeset
|
9 {% endmacro %} |
8b5615a1bf3d
articles, input: use new embedding mechanism in articles + new macros to build forms and inputs
Goffi <goffi@goffi.org>
parents:
7
diff
changeset
|
10 |
116
da8f1ba9034d
input/comment: renamed "comment" library to "textbox", and made it more generic
Goffi <goffi@goffi.org>
parents:
51
diff
changeset
|
11 {% macro submit(label=_("Send")) %} |
166
178f55b825b7
small refactoring/redesign, better BEM integration:
Goffi <goffi@goffi.org>
parents:
164
diff
changeset
|
12 <input type="submit" class="btn" value="{{label}}"> |
7
f1c773126f23
input/comments: comments input macros, first draft
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
13 {% endmacro %} |
10
8b5615a1bf3d
articles, input: use new embedding mechanism in articles + new macros to build forms and inputs
Goffi <goffi@goffi.org>
parents:
7
diff
changeset
|
14 |
153
b84d20af0ed3
macros (field, form, textbox): general improvments:
Goffi <goffi@goffi.org>
parents:
147
diff
changeset
|
15 {% macro textbox(service, node, action='', placeholder='', |
b84d20af0ed3
macros (field, form, textbox): general improvments:
Goffi <goffi@goffi.org>
parents:
147
diff
changeset
|
16 submit_label=_("Send"), type="textbox", |
b84d20af0ed3
macros (field, form, textbox): general improvments:
Goffi <goffi@goffi.org>
parents:
147
diff
changeset
|
17 class='', ta_class='') %} |
b84d20af0ed3
macros (field, form, textbox): general improvments:
Goffi <goffi@goffi.org>
parents:
147
diff
changeset
|
18 {# generic content area for comments/blog posts/etc. |
b84d20af0ed3
macros (field, form, textbox): general improvments:
Goffi <goffi@goffi.org>
parents:
147
diff
changeset
|
19 Only a body by default, but new elements can be |
116
da8f1ba9034d
input/comment: renamed "comment" library to "textbox", and made it more generic
Goffi <goffi@goffi.org>
parents:
51
diff
changeset
|
20 added by using this macro with call #} |
da8f1ba9034d
input/comment: renamed "comment" library to "textbox", and made it more generic
Goffi <goffi@goffi.org>
parents:
51
diff
changeset
|
21 {% set extra_content = caller() if caller is defined else '' %} |
153
b84d20af0ed3
macros (field, form, textbox): general improvments:
Goffi <goffi@goffi.org>
parents:
147
diff
changeset
|
22 {% call form.form(action=action, class="textbox " + class) %} |
116
da8f1ba9034d
input/comment: renamed "comment" library to "textbox", and made it more generic
Goffi <goffi@goffi.org>
parents:
51
diff
changeset
|
23 {{ head(service, node, type) }} |
da8f1ba9034d
input/comment: renamed "comment" library to "textbox", and made it more generic
Goffi <goffi@goffi.org>
parents:
51
diff
changeset
|
24 {{ extra_content }} |
153
b84d20af0ed3
macros (field, form, textbox): general improvments:
Goffi <goffi@goffi.org>
parents:
147
diff
changeset
|
25 {{ field.textarea("body", placeholder=placeholder, required=True, |
b84d20af0ed3
macros (field, form, textbox): general improvments:
Goffi <goffi@goffi.org>
parents:
147
diff
changeset
|
26 class=ta_class) }} |
116
da8f1ba9034d
input/comment: renamed "comment" library to "textbox", and made it more generic
Goffi <goffi@goffi.org>
parents:
51
diff
changeset
|
27 {{ submit(label=submit_label) }} |
da8f1ba9034d
input/comment: renamed "comment" library to "textbox", and made it more generic
Goffi <goffi@goffi.org>
parents:
51
diff
changeset
|
28 {% endcall %} |
10
8b5615a1bf3d
articles, input: use new embedding mechanism in articles + new macros to build forms and inputs
Goffi <goffi@goffi.org>
parents:
7
diff
changeset
|
29 {% endmacro %} |
51
102356338118
input(comment): new macro comment_or_login:
Goffi <goffi@goffi.org>
parents:
37
diff
changeset
|
30 |
153
b84d20af0ed3
macros (field, form, textbox): general improvments:
Goffi <goffi@goffi.org>
parents:
147
diff
changeset
|
31 {% macro blog_text(service, node, action='', placeholder=_("Your comment")) %} |
116
da8f1ba9034d
input/comment: renamed "comment" library to "textbox", and made it more generic
Goffi <goffi@goffi.org>
parents:
51
diff
changeset
|
32 {{ textbox(service, node, action=action, placeholder=placeholder, type="comment") }} |
da8f1ba9034d
input/comment: renamed "comment" library to "textbox", and made it more generic
Goffi <goffi@goffi.org>
parents:
51
diff
changeset
|
33 {% endmacro %} |
da8f1ba9034d
input/comment: renamed "comment" library to "textbox", and made it more generic
Goffi <goffi@goffi.org>
parents:
51
diff
changeset
|
34 |
153
b84d20af0ed3
macros (field, form, textbox): general improvments:
Goffi <goffi@goffi.org>
parents:
147
diff
changeset
|
35 {% macro comment(service, node, action='', placeholder=_("Your comment"), class='box--medium') %} |
b84d20af0ed3
macros (field, form, textbox): general improvments:
Goffi <goffi@goffi.org>
parents:
147
diff
changeset
|
36 {{ textbox(service, node, action=action, placeholder=placeholder, type="comment", class=class) }} |
b84d20af0ed3
macros (field, form, textbox): general improvments:
Goffi <goffi@goffi.org>
parents:
147
diff
changeset
|
37 {% endmacro %} |
b84d20af0ed3
macros (field, form, textbox): general improvments:
Goffi <goffi@goffi.org>
parents:
147
diff
changeset
|
38 |
116
da8f1ba9034d
input/comment: renamed "comment" library to "textbox", and made it more generic
Goffi <goffi@goffi.org>
parents:
51
diff
changeset
|
39 {% macro comment_or_login(service, node, action='', placeholder=none) %} |
51
102356338118
input(comment): new macro comment_or_login:
Goffi <goffi@goffi.org>
parents:
37
diff
changeset
|
40 {# show comment form a a message asking to log in |
102356338118
input(comment): new macro comment_or_login:
Goffi <goffi@goffi.org>
parents:
37
diff
changeset
|
41 login is checked using profile #} |
102356338118
input(comment): new macro comment_or_login:
Goffi <goffi@goffi.org>
parents:
37
diff
changeset
|
42 {% if profile %} |
116
da8f1ba9034d
input/comment: renamed "comment" library to "textbox", and made it more generic
Goffi <goffi@goffi.org>
parents:
51
diff
changeset
|
43 {% if placeholder is none %} |
da8f1ba9034d
input/comment: renamed "comment" library to "textbox", and made it more generic
Goffi <goffi@goffi.org>
parents:
51
diff
changeset
|
44 {{ comment(service, node, action) }} |
da8f1ba9034d
input/comment: renamed "comment" library to "textbox", and made it more generic
Goffi <goffi@goffi.org>
parents:
51
diff
changeset
|
45 {% else %} |
da8f1ba9034d
input/comment: renamed "comment" library to "textbox", and made it more generic
Goffi <goffi@goffi.org>
parents:
51
diff
changeset
|
46 {{ comment(service, node, action, placeholder=placeholder) }} |
da8f1ba9034d
input/comment: renamed "comment" library to "textbox", and made it more generic
Goffi <goffi@goffi.org>
parents:
51
diff
changeset
|
47 {% endif %} |
51
102356338118
input(comment): new macro comment_or_login:
Goffi <goffi@goffi.org>
parents:
37
diff
changeset
|
48 {% else %} |
102356338118
input(comment): new macro comment_or_login:
Goffi <goffi@goffi.org>
parents:
37
diff
changeset
|
49 <div class="log_request"> |
102356338118
input(comment): new macro comment_or_login:
Goffi <goffi@goffi.org>
parents:
37
diff
changeset
|
50 <p class="not_logged">{% trans %}You are not logged. You need to log in to comment.{% endtrans %}</p> |
102356338118
input(comment): new macro comment_or_login:
Goffi <goffi@goffi.org>
parents:
37
diff
changeset
|
51 {% if login_url is defined %} |
102356338118
input(comment): new macro comment_or_login:
Goffi <goffi@goffi.org>
parents:
37
diff
changeset
|
52 <p class="log_in_url"> |
102356338118
input(comment): new macro comment_or_login:
Goffi <goffi@goffi.org>
parents:
37
diff
changeset
|
53 {% trans link_start=('<a href="',login_url,'">')|join|safe, link_end='</a>'|safe %} |
102356338118
input(comment): new macro comment_or_login:
Goffi <goffi@goffi.org>
parents:
37
diff
changeset
|
54 To log in {{link_start}}follow this link{{link_end}} |
102356338118
input(comment): new macro comment_or_login:
Goffi <goffi@goffi.org>
parents:
37
diff
changeset
|
55 {% endtrans %} |
102356338118
input(comment): new macro comment_or_login:
Goffi <goffi@goffi.org>
parents:
37
diff
changeset
|
56 </p> |
102356338118
input(comment): new macro comment_or_login:
Goffi <goffi@goffi.org>
parents:
37
diff
changeset
|
57 {% endif %} |
102356338118
input(comment): new macro comment_or_login:
Goffi <goffi@goffi.org>
parents:
37
diff
changeset
|
58 </div> |
102356338118
input(comment): new macro comment_or_login:
Goffi <goffi@goffi.org>
parents:
37
diff
changeset
|
59 {% endif %} |
102356338118
input(comment): new macro comment_or_login:
Goffi <goffi@goffi.org>
parents:
37
diff
changeset
|
60 {% endmacro %} |