Browse Source

Melhorias na interface de convite de eventos

pull/159/head
Sesostris Vieira 3 years ago
parent
commit
eeb0974c29
  1. 25
      sigi/apps/eventos/templates/eventos/convida_casa.html
  2. 47
      sigi/apps/eventos/templates/eventos/evento.html
  3. 8
      sigi/apps/home/views.py
  4. 9
      sigi/static/js/search.js

25
sigi/apps/eventos/templates/eventos/convida_casa.html

@ -47,7 +47,13 @@
<div class="col s12">
<div class="card">
<div class="card-content">
<span class="card-title">{% trans "Dados do contato Interlegis" %}</span>
<span class="card-title">
{% trans "Dados do contato Interlegis" %}
<a href="#" id="copiar-presidente" class="waves-effect waves-light btn-small light-green accent-1 right">
<i class="material-icons left">content_copy</i>
{% trans "Copiar dados do presidente" %}
</a>
</span>
{{ form_contato }}
</div>
</div>
@ -73,3 +79,20 @@
</div>
</form>
{% endblock %}
{% block footer %}
{{ block.super }}
<script>
$(document).ready(function() {
$("#copiar-presidente").click(function(event) {
event.preventDefault();
var dados = {{% for field in form_presidente %}
{{ field.name }}: $("#{{ field.id_for_label }}").val(),{% endfor %}
};
{% for field in form_contato %}
$("#{{ field.id_for_label }}").val(dados.{{ field.name }});
{% endfor %}
})
})
</script>
{% endblock %}

47
sigi/apps/eventos/templates/eventos/evento.html

@ -10,11 +10,41 @@
padding-left: 15px;
font-weight: bold;
}
#content {
display: block !important;
}
.tab-panel {
background-color: #fff;
height: 100%;
}
.tab-content {
padding: 10px 24px;
height: 100%;
overflow-y: auto;
scrollbar-width: thin;
}
.tab-content::-webkit-scrollbar {
width: 3px;
background-color: #fff;
}
.tab-content::-webkit-scrollbar-track {
-webkit-box-shadow: inset 0 0 2px #fff;
background-color: #fff;
border-radius: 10px;
}
.tab-content::-webkit-scrollbar-thumb {
border-radius: 10px;
-webkit-box-shadow: inset 0 0 2px var(--main-hover-color);
background-color: var(--main-hover-color);
}
</style>
{% endblock %}
{% block content %}
{{ block.super }}
<div class="">
<div class="row">
<div class="col s12">
<h4>{{ evento.nome }}</h4>
@ -29,8 +59,8 @@
</ul>
</div>
<div id="base" class="col s12">
<div class="card">
<div class="card-content">
<div class="tab-panel">
<div class="tab-content">
<table class="responsive-table striped">
{% for field_name in fields %}
<tr>
@ -43,8 +73,8 @@
</div>
</div>
<div id="convites" class="col s12">
<div class="card">
<div class="card-content">
<div class="tab-panel">
<div class="tab-content">
<div class="input-field">
<input id="search-text" class="search-text" type="text" data-source="{% url 'openmapsearch' %}"
data-param="q" />
@ -77,8 +107,8 @@
</div>
</div>
<div id="anexos" class="col s12">
<div class="card">
<div class="card-content">
<div class="tab-panel">
<div class="tab-content">
{% if anexos.count == 0 %}
<span class="card-title">{% trans "Nenhum anexo registrado" %}</span>
{% else %}
@ -113,8 +143,7 @@
</tbody>
</table>
{% endif %}
</div>
</div>
<div>
</div>
</div>
</div>

8
sigi/apps/home/views.py

@ -208,12 +208,16 @@ def openmapsearch(request):
tipo__legislativo=True, search_text__icontains=to_ascii(q)
)[:10]
dados = dados.values(
"id", "nome", "municipio__latitude", "municipio__longitude"
"id",
"nome",
"municipio__uf__sigla",
"municipio__latitude",
"municipio__longitude",
)
dados = [
{
"id": d["id"],
"label": d["nome"],
"label": f"{d['nome']} - {d['municipio__uf__sigla']}",
"lat": d["municipio__latitude"],
"lng": d["municipio__longitude"],
}

9
sigi/static/js/search.js

@ -12,17 +12,16 @@ $(document).ready(function () {
query_param[param_name] = term;
if (term.length < 3) {
$resultbox.html("");
$resultbox.empty();
$resultbox.addClass("hide");
return;
}
$.get(url, query_param, function (data) {
$resultbox.html("");
$resultbox.empty();
for (i in data) {
var plain = JSON.stringify(data[i]);
var $item = $(`<a href="#" class="search-result-item" data-retrieved='${plain}'></a>`);
$item.html(data[i].label);
var $item = $(`<a href="#" class="search-result-item" data-retrieved='${plain}'>${data[i].label}</a>`);
$resultbox.append($item);
}
$resultbox.removeClass("hide");
@ -31,7 +30,7 @@ $(document).ready(function () {
var plain = $(this).attr("data-retrieved");
var obj = JSON.parse(plain);
$this.val(obj.label);
$resultbox.html("").addClass("hide");
$resultbox.empty().addClass("hide");
callback(obj);
});
});

Loading…
Cancel
Save