-
Notifications
You must be signed in to change notification settings - Fork 96
Seleciona tipo de votação para múltiplas matérias ao incluir na Ordem do Dia ou Expediente #3781
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
69efd85
4a8fb23
feeaeae
a4d88d9
bd3b81b
abbfa48
4ebc566
e5a8a85
d64eae0
f6106ff
3c0638b
4af561f
77e1034
d04a7e9
f92c461
9dcb30c
5664cf5
3661516
a49ae8c
41b5117
fe5628d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -32,6 +32,23 @@ | |||||||||||||||||||||||||
| <table class="table table-striped table-bordered"> | ||||||||||||||||||||||||||
| <thead class="thead-default"> | ||||||||||||||||||||||||||
| <tr><td><h3>{% trans "Matérias" %}</h3></td><td><h3>{% trans "Tipo de Votação" %}</h3></td></tr> | ||||||||||||||||||||||||||
| <tr> | ||||||||||||||||||||||||||
| <td> | ||||||||||||||||||||||||||
| <label for="id_check_all"> | ||||||||||||||||||||||||||
| <input type="checkbox" id="id_check_all" onchange="checkAll(this)" /> Marcar/Desmarcar Todos | ||||||||||||||||||||||||||
| </label> | ||||||||||||||||||||||||||
| </td> | ||||||||||||||||||||||||||
| <td> | ||||||||||||||||||||||||||
| <input type="radio" name="tipo_votacao_check_all" id="tipo_votacao_simb" value="1" onchange="marcaTipoVotacao()" > <label>Simbólica</label> | ||||||||||||||||||||||||||
| </br> | ||||||||||||||||||||||||||
| <input type="radio" name="tipo_votacao_check_all" id="tipo_votacao_nom" value="2" onchange="marcaTipoVotacao()" > <label>Nominal</label> | ||||||||||||||||||||||||||
| </br> | ||||||||||||||||||||||||||
| <input type="radio" name="tipo_votacao_check_all" id="tipo_votacao_secr" value="3" onchange="marcaTipoVotacao()" > <label>Secreta</label> | ||||||||||||||||||||||||||
| </br> | ||||||||||||||||||||||||||
| <input type="radio" name="tipo_votacao_check_all" id="tipo_votacao_leit" value="4" onchange="marcaTipoVotacao()" > <label>Leitura</label> | ||||||||||||||||||||||||||
| </br> | ||||||||||||||||||||||||||
| </td> | ||||||||||||||||||||||||||
| </tr> | ||||||||||||||||||||||||||
| </thead> | ||||||||||||||||||||||||||
| {% if paginator.count > 1 %} | ||||||||||||||||||||||||||
| <h3>{% blocktrans with paginator.count as total_materias %}Pesquisa concluída com sucesso! Foram encontradas {{ total_materias }} matérias.{% endblocktrans %}</h3> | ||||||||||||||||||||||||||
|
|
@@ -126,5 +143,22 @@ <h3>{% trans 'Pesquisa concluída com sucesso! Foi encontrada 1 matéria.'%}</h3 | |||||||||||||||||||||||||
| $(window).on('beforeunload', function() { | ||||||||||||||||||||||||||
| $("input[type=submit], input[type=button]").prop("disabled", "disabled") | ||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||
| function checkAll(elem) { | ||||||||||||||||||||||||||
| let checkboxes = document.getElementsByName('materia_id'); | ||||||||||||||||||||||||||
| for (let i = 0; i < checkboxes.length; i++) { | ||||||||||||||||||||||||||
| if (checkboxes[i].type == 'checkbox') | ||||||||||||||||||||||||||
| checkboxes[i].checked = elem.checked; | ||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||
|
||||||||||||||||||||||||||
| let checkboxes = document.getElementsByName('materia_id'); | |
| for (let i = 0; i < checkboxes.length; i++) { | |
| if (checkboxes[i].type == 'checkbox') | |
| checkboxes[i].checked = elem.checked; | |
| } | |
| $('input[name="materia_id"]:checkbox').prop('checked', elem.checked); |
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mesmo comentário acima, utilizar jQuery para deixar código mais conciso e legível.
| materias = document.getElementsByName('materia_id'); | |
| for (var i=0; i<materias.length;i++){ | |
| if ( materias[i].checked ){ | |
| var id_materia = "#tipo_votacao_" + materias[i].value + "_" + document.querySelector('input[name="tipo_votacao_check_all"]:checked').value; | |
| $(id_materia).prop('checked', true); | |
| } | |
| } | |
| $('input[name="materia_id"]:checked').each(function() { | |
| var tipoVotacao = $('input[name="tipo_votacao_check_all"]:checked').val(); | |
| var idMateria = "#tipo_votacao_" + $(this).val() + "_" + tipoVotacao; | |
| $(idMateria).prop('checked', true); | |
| }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Evitar esses campos hard coded no template. Definir como campos em form que a view renderiza via crispy form, por exemplo.