Mercurial > libervia-templates
changeset 296:fbea1b9a558f
bulma: new search box, used in blog for now
author | Goffi <goffi@goffi.org> |
---|---|
date | Thu, 10 Dec 2020 11:29:04 +0100 |
parents | 1de599c5a68f |
children | 0657982e81af |
files | sat_templates/templates/bulma/blog/articles.html sat_templates/templates/bulma/input/field.html sat_templates/templates/bulma/input/form.html sat_templates/templates/bulma/input/textbox.html |
diffstat | 4 files changed, 29 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/sat_templates/templates/bulma/blog/articles.html Fri Nov 27 12:24:03 2020 +0100 +++ b/sat_templates/templates/bulma/blog/articles.html Thu Dec 10 11:29:04 2020 +0100 @@ -5,6 +5,7 @@ {% import 'components/avatar.html' as avatar with context %} {% import 'blog/macros.html' as blog with context %} {% import 'input/navigation.html' as navigation with context %} +{% import 'input/textbox.html' as textbox with context %} {%- block title scoped -%} {%- if blog_page -%} @@ -23,6 +24,15 @@ {% if blog_items['items'] %} <div class="container mt-4"> + <nav class="level mb-4"> + <div class="level-left"> + </div> + <div class="level-right"> + <div class="level-item"> + {{ textbox.search() }} + </div> + </div> + </nav> <div id="blog_items" class="columns"> <div class="column"> {{ blog.show_items(blog_items['items'], expanded=single) }}
--- a/sat_templates/templates/bulma/input/field.html Fri Nov 27 12:24:03 2020 +0100 +++ b/sat_templates/templates/bulma/input/field.html Thu Dec 10 11:29:04 2020 +0100 @@ -27,6 +27,9 @@ {% if help %} <p class="help">{{help}}</p> {% endif %} + {% if caller %} + {{ caller() }} + {% endif %} </div> {% endmacro %} @@ -67,7 +70,7 @@ {% endmacro %} {% macro text(name, label="", value=none, class='', placeholder=none, required=false, pattern=none, title=none, autocomplete=none, icon_left=none, icon_right=none) %} - {{ field("text", name=name, label=label, value=value, class=class, required=required, icon_left=icon_left, icon_right=icon_right, attrs={'placeholder': placeholder, 'pattern': pattern, 'title': title, 'autocomplete': autocomplete}) }} + {{ field("text", name=name, label=label, value=value, class=class, required=required, icon_left=icon_left, icon_right=icon_right, attrs={'placeholder': placeholder, 'pattern': pattern, 'title': title, 'autocomplete': autocomplete}, caller=caller) }} {% endmacro %} {% macro password(name, label="", value=none, required=false, minlength=none, icon_left=none, icon_right=none) %}
--- a/sat_templates/templates/bulma/input/form.html Fri Nov 27 12:24:03 2020 +0100 +++ b/sat_templates/templates/bulma/input/form.html Thu Dec 10 11:29:04 2020 +0100 @@ -1,8 +1,8 @@ -{% macro form(action='', class=none, id=none) %} -<form method="post" action="{{action}}" {{ {'id': id, 'class': class}|xmlattr }} {{kwargs|xmlattr}} > - {% if csrf_token is defined %} - <input type="hidden" name="csrf_token" value="{{csrf_token}}"> - {% endif %} - {{ caller() }} -</form> +{% macro form(action='', class=none, id=none, method="post", use_csrf_token=true) %} + <form method="{{method}}" action="{{action}}" {{ {'id': id, 'class': class}|xmlattr }} {{kwargs|xmlattr}} > + {% if csrf_token is defined and use_csrf_token %} + <input type="hidden" name="csrf_token" value="{{csrf_token}}"> + {% endif %} + {{ caller() }} + </form> {% endmacro %}
--- a/sat_templates/templates/bulma/input/textbox.html Fri Nov 27 12:24:03 2020 +0100 +++ b/sat_templates/templates/bulma/input/textbox.html Thu Dec 10 11:29:04 2020 +0100 @@ -77,3 +77,11 @@ </div> {% endif %} {% endmacro %} + +{% macro search() %} + {% call form.form(method="get", use_csrf_token=false) %} + {% call field.text("search", class="has-addons", required=true, icon_left="search") %} + {{ field.submit(_("Search")) }} + {% endcall %} + {% endcall %} +{% endmacro %}