diff options
| -rw-r--r-- | ishtar_common/static/media/styles.css | 6 | ||||
| -rw-r--r-- | ishtar_common/templates/blocks/JQueryJqGrid.html | 8 | ||||
| -rw-r--r-- | ishtar_common/templates/blocks/bs_form_snippet.html | 30 | ||||
| -rw-r--r-- | ishtar_common/templates/ishtar/wizard/search.html | 2 | ||||
| -rw-r--r-- | ishtar_common/widgets.py | 5 | 
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>        <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() | 
