From e46bdb2d9ec4d220a27bf44cb3a71a60a60a7506 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Tue, 14 Nov 2017 17:48:20 +0100 Subject: UI: criteria search --- ishtar_common/forms.py | 4 ++ ishtar_common/static/media/styles.css | 4 ++ .../templates/blocks/bs_form_snippet.html | 47 ++++++++++++++++++---- 3 files changed, 47 insertions(+), 8 deletions(-) (limited to 'ishtar_common') diff --git a/ishtar_common/forms.py b/ishtar_common/forms.py index 4f59dbd6d..293193162 100644 --- a/ishtar_common/forms.py +++ b/ishtar_common/forms.py @@ -162,6 +162,10 @@ class TableSelect(forms.Form): # no field is required for search for k in self.fields: self.fields[k].required = False + cls = 'form-control' + if k == 'search_vector': + cls += " search-vector" + self.fields[k].widget.attrs['class'] = cls key = self.fields.keys()[0] self.fields[key].widget.attrs['autofocus'] = 'autofocus' diff --git a/ishtar_common/static/media/styles.css b/ishtar_common/static/media/styles.css index 070194cb1..1243a6440 100644 --- a/ishtar_common/static/media/styles.css +++ b/ishtar_common/static/media/styles.css @@ -45,6 +45,10 @@ div#foot{ padding: 0.2em; } +.search-vector{ + width: 100%; +} + /* à adapter */ #message, #message div{ diff --git a/ishtar_common/templates/blocks/bs_form_snippet.html b/ishtar_common/templates/blocks/bs_form_snippet.html index f413fd860..e89e12800 100644 --- a/ishtar_common/templates/blocks/bs_form_snippet.html +++ b/ishtar_common/templates/blocks/bs_form_snippet.html @@ -10,23 +10,53 @@ {% endif %} {% endfor %} {% for field in form.visible_fields %} -{% if search and forloop.counter0 == 10 %} +{% if search and forloop.counter0 == 0 %} + +
+
+
+ + + {{field|safe}} +
+ {% if field.errors %}
+ {{ field.errors }} +
{% endif %} + {% if field.help_text %} + +
+
+ {{field.help_text}} +
+
+ {% endif %} +
+
+{% else %} + +{% if search and forloop.counter0 == 1 %} + +
+

+ +

-

- -

{% endif %} -{% if forloop.counter0|divisibleby:2 %} +{% if search and forloop.counter0|divisibleby:2 or search and forloop.counter1|divisibleby:2 %} {% if forloop.counter0 %}
{% endif %}
{% endif %} + +
{{ field.label_tag }} {{field|safe}} @@ -45,10 +75,11 @@ {% endif %}
{% if forloop.last %} -{% if search and forloop.counter0 >= 10 %} +{% if search and forloop.counter0 >= 1 %}
{% endif %}
{% endif %} +{% endif %} {% endfor %} -- cgit v1.2.3