From ea1ad872dec9d6beeafe6ccd4264132f5865079e Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Fri, 10 Nov 2017 18:46:14 +0100 Subject: UI: search layout --- ishtar_common/static/media/styles.css | 6 +++++ ishtar_common/templates/blocks/JQueryJqGrid.html | 8 ++++-- .../templates/blocks/bs_form_snippet.html | 30 ++++++++++++++++------ ishtar_common/templates/ishtar/wizard/search.html | 2 +- ishtar_common/widgets.py | 5 ++-- 5 files changed, 38 insertions(+), 13 deletions(-) (limited to 'ishtar_common') diff --git a/ishtar_common/static/media/styles.css b/ishtar_common/static/media/styles.css index cd76e35c1..070194cb1 100644 --- a/ishtar_common/static/media/styles.css +++ b/ishtar_common/static/media/styles.css @@ -2,6 +2,12 @@ display: none; } + +.search .form-group { + margin-bottom: 0.2rem; + font-size: 0.9em; +} + div.nav-button{ cursor:pointer; width:15px; diff --git a/ishtar_common/templates/blocks/JQueryJqGrid.html b/ishtar_common/templates/blocks/JQueryJqGrid.html index 1768ab427..f9548a743 100644 --- a/ishtar_common/templates/blocks/JQueryJqGrid.html +++ b/ishtar_common/templates/blocks/JQueryJqGrid.html @@ -1,18 +1,22 @@ {% load i18n %} - +

+ + {% if url_new %}

{{new_message}}

{% endif %} -

{% trans "Search and select an item" %}

+

{% trans "Search and select an item" %}

  {% trans "Pinned search:" %}
+

diff --git a/ishtar_common/templates/blocks/bs_form_snippet.html b/ishtar_common/templates/blocks/bs_form_snippet.html index 8aa6a5333..f413fd860 100644 --- a/ishtar_common/templates/blocks/bs_form_snippet.html +++ b/ishtar_common/templates/blocks/bs_form_snippet.html @@ -4,9 +4,24 @@ {{form.non_field_errors}} {%endif%} +{% for hidden in form.hidden_fields %} +{{field}}{% if field.errors %}
+ {{ field.errors }} +
{% endif %} +{% endfor %} +{% for field in form.visible_fields %} +{% if search and forloop.counter0 == 10 %} + +

+ +

+
+
+
+{% endif %} -{% for field in form %} -{% if not field.is_hidden %} {% if forloop.counter0|divisibleby:2 %} {% if forloop.counter0 %}
{% endif %} @@ -29,12 +44,11 @@
{% endif %}
-{% else %}{{field}} -{% if field.errors %}
- {{ field.errors }} -
{% endif %} -{% endif %} -{% if forloop.counter0.last%} +{% if forloop.last %} +{% if search and forloop.counter0 >= 10 %} + {% endif %} + +{% endif %} {% endfor %} diff --git a/ishtar_common/templates/ishtar/wizard/search.html b/ishtar_common/templates/ishtar/wizard/search.html index 89ce860d4..7b8f142e4 100644 --- a/ishtar_common/templates/ishtar/wizard/search.html +++ b/ishtar_common/templates/ishtar/wizard/search.html @@ -26,7 +26,7 @@ {% else %} -
+ {% endif %} diff --git a/ishtar_common/widgets.py b/ishtar_common/widgets.py index 1ddabe7c7..323a2e547 100644 --- a/ishtar_common/widgets.py +++ b/ishtar_common/widgets.py @@ -754,9 +754,10 @@ class JQueryJqGrid(forms.RadioSelect): return jq_col_names, extra_cols def render(self, name, value, attrs=None, renderer=None): - t = loader.get_template('blocks/form_flex_snippet.html') + # t = loader.get_template('blocks/form_flex_snippet.html') + t = loader.get_template('blocks/bs_form_snippet.html') form = self.form() - rendered = t.render({'form': form, 'flex': True}) + rendered = t.render({'form': form, 'search': True}) dct = {} if self.new: model_name = self.associated_model._meta.object_name.lower() -- cgit v1.2.3