Browse Source

Simplificação da tela de pesquisa de Matéria Legislativa (#3662)

pull/3668/head
cristian-longhi 1 year ago
committed by GitHub
parent
commit
1fb50d5dfb
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 38
      sapl/materia/forms.py
  2. 17
      sapl/templates/materia/materialegislativa_filter.html

38
sapl/materia/forms.py

@ -2,7 +2,7 @@ import logging
import os import os
from crispy_forms.bootstrap import Alert, InlineRadios from crispy_forms.bootstrap import Alert, InlineRadios
from crispy_forms.layout import (Button, Field, Fieldset, HTML, Layout, Row) from crispy_forms.layout import (Button, Field, Fieldset, HTML, Layout, Row, Div)
from django import forms from django import forms
from django.contrib.contenttypes.models import ContentType from django.contrib.contenttypes.models import ContentType
from django.core.exceptions import ObjectDoesNotExist, ValidationError from django.core.exceptions import ObjectDoesNotExist, ValidationError
@ -1120,22 +1120,38 @@ class MateriaLegislativaFilterSet(django_filters.FilterSet):
self.form.helper = SaplFormHelper() self.form.helper = SaplFormHelper()
self.form.helper.form_method = 'GET' self.form.helper.form_method = 'GET'
self.form.helper.layout = Layout( self.form.helper.layout = Layout(
Div(
Fieldset(_('Pesquisa Básica'), Fieldset(_('Pesquisa Básica'),
row1, row2), row1, row2,
HTML(autor_label),
HTML(autor_modal),
row4,
),
Button('btn_pesquisa_avancada', 'Pesquisa Avançada >>>',
css_id='btn_pesquisa_avancada_id',
css_class='btn btn-dark',
onClick="pesquisaAvancada()",
style='margin-bottom: 2vh;font-weight: bold'
),
Fieldset(_('Como listar os resultados da pesquisa'), Fieldset(_('Como listar os resultados da pesquisa'),
row8 row8,
css_class='pesquisa_avancada',
style='display: none;',
), ),
Fieldset(_('Origem externa'), Fieldset(_('Origem externa'),
row10, row11 row10, row11,
css_class='pesquisa_avancada',
style='display: none;',
), ),
Fieldset(_('Pesquisa Avançada'), Fieldset(_('Mais Opções de Pesquisa...'),
row3, row3,
HTML(autor_label), row6, row7, row9,
HTML(autor_modal), css_class='pesquisa_avancada',
row4, row6, row7, row9, style='display: none;'
form_actions(label=_('Pesquisar'))) ),
) form_actions(label=_('Pesquisar')),
)
)
@property @property
def qs(self): def qs(self):

17
sapl/templates/materia/materialegislativa_filter.html

@ -200,3 +200,20 @@
{% endblock detail_content %} {% endblock detail_content %}
{% block table_content %} {% block table_content %}
{% endblock table_content %} {% endblock table_content %}
{% block extra_js %}
<script type="text/javascript" >
function pesquisaAvancada(){
$('.pesquisa_avancada').toggle();
var id_btn = "#btn_pesquisa_avancada_id";
if ($(id_btn).val().endsWith('>>>')){
$(id_btn).val($(id_btn).val().replace('>>>', '<<<'))
}else{
$(id_btn).val($(id_btn).val().replace('<<<', '>>>'))
}
};
</script>
{% endblock extra_js %}

Loading…
Cancel
Save