diff options
Diffstat (limited to 'ishtar_common')
| -rw-r--r-- | ishtar_common/forms.py | 4 | ||||
| -rw-r--r-- | ishtar_common/static/media/styles.css | 4 | ||||
| -rw-r--r-- | ishtar_common/templates/blocks/bs_form_snippet.html | 47 | 
3 files changed, 47 insertions, 8 deletions
| 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 @@  </div>{% endif %}  {% endfor %}  {% for field in form.visible_fields %} -{% if search and forloop.counter0 == 10 %} +{% if search and forloop.counter0 == 0 %} + +<div class="form-row"> +    <div class="form-group col-lg"> +        <div class="input-group"> +          <span class="input-group-addon"> +              <i class="fa fa-search" aria-hidden="true"></i></span> +              {{field|safe}} +        </div> +        {% if field.errors %}<div class="invalid-feedback"> +        {{ field.errors }} +    </div>{% endif %} +        {% if field.help_text %} +        <small><a data-toggle="collapse" href="#{{field.auto_id}}_help" +                  aria-expanded="false" aria-controls="{{field.auto_id}}_help"> +            {% trans 'help'%}</a></small> +        <div class="collapse" id="{{field.auto_id}}_help"> +            <div class="card card-body"> +                {{field.help_text}} +            </div> +        </div> +        {% endif %} +    </div> +</div> +{% else %} + +{% if search and forloop.counter0 == 1 %} +</div> +<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 "Criteria search" %}</a> +    </p>  </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 %} -{% if forloop.counter0|divisibleby:2 %} +{% if search and forloop.counter0|divisibleby:2 or search and forloop.counter1|divisibleby:2 %}  {% if forloop.counter0 %}    </div>{% endif %}    <div class="form-row">  {% endif %} + +      <div class="form-group col-lg-6">        {{ field.label_tag }}        {{field|safe}} @@ -45,10 +75,11 @@        {% endif %}      </div>  {% if forloop.last %} -{% if search and forloop.counter0 >= 10 %} +{% if search and forloop.counter0 >= 1 %}      </div>    </div>  {% endif %}  </div>  {% endif %} +{% endif %}  {% endfor %} | 
