summaryrefslogtreecommitdiff
path: root/ishtar_common
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2017-11-10 18:46:14 +0100
committerÉtienne Loks <etienne.loks@iggdrasil.net>2017-11-10 18:46:14 +0100
commitdf8b3fb3b3ad19c95c026839b35d1220b40ccece (patch)
tree62c17e2510ebeb661d3a486991a71eb841865a73 /ishtar_common
parent1a39ea814072d06e821c695063e2b95db206b460 (diff)
downloadIshtar-df8b3fb3b3ad19c95c026839b35d1220b40ccece.tar.bz2
Ishtar-df8b3fb3b3ad19c95c026839b35d1220b40ccece.zip
UI: search layout
Diffstat (limited to 'ishtar_common')
-rw-r--r--ishtar_common/static/media/styles.css6
-rw-r--r--ishtar_common/templates/blocks/JQueryJqGrid.html8
-rw-r--r--ishtar_common/templates/blocks/bs_form_snippet.html30
-rw-r--r--ishtar_common/templates/ishtar/wizard/search.html2
-rw-r--r--ishtar_common/widgets.py5
5 files changed, 38 insertions, 13 deletions
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 %}
-<button id='search_{{name}}' class='submit ui-widget-header'>{% trans "Search" %}</button>
+<p class="text-center">
+
+<button id='search_{{name}}' class='btn btn-primary btn-block'>
+ {% trans "Search" %}</button>
{% if url_new %}
<p><a href="#" onclick="open_window('{{url_new}}');">{{new_message}}</a></p>
{% endif %}
-<h4>{% trans "Search and select an item" %}</h4>
+<h4 class="text-center">{% trans "Search and select an item" %}</h4>
<h5 id="pinned_search_{{name}}">
<i class="fa fa-thumb-tack"></i> &nbsp;
<strong>{% trans "Pinned search:" %}</strong>
<em><span id="pinned_search_content_{{name}}"></span></em>
</h5>
+</p>
<table id='grid_{{name}}' class='jqgrid'></table>
<div id='pager_{{name}}'></div>
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}}
</div>
{%endif%}
+{% for hidden in form.hidden_fields %}
+{{field}}{% if field.errors %}<div class="invalid-feedback">
+ {{ field.errors }}
+</div>{% endif %}
+{% endfor %}
+{% for field in form.visible_fields %}
+{% if search and forloop.counter0 == 10 %}
+</div>
+<p class="text-center">
+ <a class="btn btn-secondary btn-sm" data-toggle="collapse" href="#tail-form"
+ aria-expanded="false" aria-controls="tail-form">
+ {% trans "Show / hide advanced search" %}</a>
+</p>
+<div class="collapse" id="tail-form">
+ <div class="card card-body">
+ <div class="form-row">
+{% endif %}
-{% for field in form %}
-{% if not field.is_hidden %}
{% if forloop.counter0|divisibleby:2 %}
{% if forloop.counter0 %}
</div>{% endif %}
@@ -29,12 +44,11 @@
</div>
{% endif %}
</div>
-{% else %}{{field}}
-{% if field.errors %}<div class="invalid-feedback">
- {{ field.errors }}
-</div>{% endif %}
-{% endif %}
-{% if forloop.counter0.last%}
+{% if forloop.last %}
+{% if search and forloop.counter0 >= 10 %}
+ </div>
</div>
{% endif %}
+</div>
+{% 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 @@
<tr class='modify'><td colspan="2"><button name="formset_modify" value="{{wizard.steps.current}}">{% trans "Add/Modify" %}</button></td></tr></li>
</table>
{% else %}
-<div class='form'>
+<div class='form search'>
{{ wizard.form.as_p }}
</div>
{% 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()