Browse Source

formuláře vzhled jako tabulky

middleware_test
Kateřina Čížková 5 years ago
parent
commit
57dae38cf9
  1. 10
      seminar/static/seminar/prihlaska.js
  2. 85
      seminar/templates/seminar/edit.html
  3. 7
      seminar/templates/seminar/login.html
  4. 118
      seminar/templates/seminar/prihlaska.html
  5. 25
      seminar/templates/seminar/prihlaska_field.html

10
seminar/static/seminar/prihlaska.js

@ -3,7 +3,7 @@ function addrCountryChanged(){
var stat_text = document.getElementById('id_li_stat_text'); var stat_text = document.getElementById('id_li_stat_text');
var stat = stat_select[stat_select.selectedIndex].value; var stat = stat_select[stat_select.selectedIndex].value;
if (stat === "other"){ if (stat === "other"){
stat_text.style.display="block"; stat_text.style.display="revert";
} else { } else {
stat_text.style.display="none"; stat_text.style.display="none";
$('#id_stat_text').val(""); $('#id_stat_text').val("");
@ -12,18 +12,22 @@ function addrCountryChanged(){
function hideSchoolTextfields(){ function hideSchoolTextfields(){
var skola_nazev = document.getElementById('id_li_skola_nazev'); var skola_nazev = document.getElementById('id_li_skola_nazev');
var skola_adresa = document.getElementById('id_li_skola_adresa'); var skola_adresa = document.getElementById('id_li_skola_adresa');
var skola_vypln = document.getElementById('id_li_skola_vypln');
skola_nazev.style.display="none"; skola_nazev.style.display="none";
skola_adresa.style.display="none"; skola_adresa.style.display="none";
skola_vypln.style.display="none";
} }
function schoolNotInList(){ function schoolNotInList(){
var skola_nazev = document.getElementById('id_li_skola_nazev'); var skola_nazev = document.getElementById('id_li_skola_nazev');
var skola_adresa = document.getElementById('id_li_skola_adresa'); var skola_adresa = document.getElementById('id_li_skola_adresa');
var skola_vypln = document.getElementById('id_li_skola_vypln');
// FIXME nefunguje a nevim proc (TypeError: $(...).select2 is not a function) // FIXME nefunguje a nevim proc (TypeError: $(...).select2 is not a function)
//var skola_select = $('#id_skola').select2(); //var skola_select = $('#id_skola').select2();
//skola_select.val(null).trigger('change'); //skola_select.val(null).trigger('change');
skola_nazev.style.display="block"; skola_vypln.style.display="revert";
skola_adresa.style.display="block"; skola_nazev.style.display="revert";
skola_adresa.style.display="revert";
} }
document.addEventListener("DOMContentLoaded", function(){ document.addEventListener("DOMContentLoaded", function(){

85
seminar/templates/seminar/edit.html

@ -15,59 +15,77 @@
<form action="{% url 'seminar_resitel_edit' %}" method="post"> <form action="{% url 'seminar_resitel_edit' %}" method="post">
{% csrf_token %} {% csrf_token %}
{{form.non_field_errors}} {{form.non_field_errors}}
<ul class="form">
<li> <hr>
<h4>
Přihlašovací údaje Přihlašovací údaje
</li><li> </h4>
<table class="form">
{% include "seminar/prihlaska_field.html" with field=form.username %} {% include "seminar/prihlaska_field.html" with field=form.username %}
</li><li> </table>
<hr>
<h4>
Osobní údaje Osobní údaje
</li><li> </h4>
<table class="form">
{% include "seminar/prihlaska_field.html" with field=form.jmeno %} {% include "seminar/prihlaska_field.html" with field=form.jmeno %}
</li><li>
{% include "seminar/prihlaska_field.html" with field=form.prijmeni %} {% include "seminar/prihlaska_field.html" with field=form.prijmeni %}
</li><li>
{% include "seminar/prihlaska_field.html" with field=form.pohlavi_muz%} {% include "seminar/prihlaska_field.html" with field=form.pohlavi_muz%}
</li><li>
{% include "seminar/prihlaska_field.html" with field=form.email %} {% include "seminar/prihlaska_field.html" with field=form.email %}
</li><li>
{% include "seminar/prihlaska_field.html" with field=form.telefon %} {% include "seminar/prihlaska_field.html" with field=form.telefon %}
</li><li>
{% include "seminar/prihlaska_field.html" with field=form.datum_narozeni %} {% include "seminar/prihlaska_field.html" with field=form.datum_narozeni %}
</li><li> </table>
<hr> <hr>
<h4>
Bydliště Bydliště
</li><li> </h4>
<table class="form">
{% include "seminar/prihlaska_field.html" with field=form.ulice %} {% include "seminar/prihlaska_field.html" with field=form.ulice %}
</li><li>
{% include "seminar/prihlaska_field.html" with field=form.mesto %} {% include "seminar/prihlaska_field.html" with field=form.mesto %}
</li><li>
{% include "seminar/prihlaska_field.html" with field=form.psc %} {% include "seminar/prihlaska_field.html" with field=form.psc %}
</li><li>
{% include "seminar/prihlaska_field.html" with field=form.stat %} {% include "seminar/prihlaska_field.html" with field=form.stat %}
</li> {% include "seminar/prihlaska_field.html" with field=form.stat_text id="id_li_stat_text"%}
<li id="id_li_stat_text"> </table>
{% include "seminar/prihlaska_field.html" with field=form.stat_text %}
</li><li>
<hr> <hr>
<h4>
Škola
</h4>
<table class="form">
{% include "seminar/prihlaska_field.html" with field=form.skola %} {% include "seminar/prihlaska_field.html" with field=form.skola %}
</li><li> <tr><td colspan="2" ><button id="id_skola_text_button" type="button">Škola není v seznamu</button></td></tr>
<button id="id_skola_text_button" type="button">Škola není v seznamu</button> <tr><td id="id_li_skola_vypln" colspan="2">Vyplň prosím celý název a adresu školy.</td></tr>
</li> {% include "seminar/prihlaska_field.html" with field=form.skola_nazev id="id_li_skola_nazev" %}
<li id="id_li_skola_nazev"> {% include "seminar/prihlaska_field.html" with field=form.skola_adresa id="id_li_skola_adresa" %}
Vyplň prosím celý název a adresu školy.<br>
{% include "seminar/prihlaska_field.html" with field=form.skola_nazev %}
</li>
<li id="id_li_skola_adresa">
{% include "seminar/prihlaska_field.html" with field=form.skola_adresa %}
</li><li>
{% include "seminar/prihlaska_field.html" with field=form.rok_maturity %} {% include "seminar/prihlaska_field.html" with field=form.rok_maturity %}
</li><li> </table>
<hr>
<h4>
Pošta
</h4>
<table class="form">
{% include "seminar/prihlaska_field.html" with field=form.zasilat %} {% include "seminar/prihlaska_field.html" with field=form.zasilat %}
</li><li> </table>
<hr>
<h4>
Zasílání propagačních materiálů
</h4>
<table class="form">
{% include "seminar/prihlaska_field.html" with field=form.spam %} {% include "seminar/prihlaska_field.html" with field=form.spam %}
</li> </table>
</ul>
<hr>
<input type="submit" value="Změnit"> <input type="submit" value="Změnit">
</form> </form>
<script> <script>
@ -75,4 +93,3 @@ $("#id_stat").on("change",addrCountryChanged);
$("#id_skola_text_button").on("click",schoolNotInList); $("#id_skola_text_button").on("click",schoolNotInList);
</script> </script>
{% endblock %} {% endblock %}

7
seminar/templates/seminar/login.html

@ -10,9 +10,9 @@
</h1> </h1>
<form action="{% url 'login' %}" method="post"> <form action="{% url 'login' %}" method="post">
{% csrf_token %} {% csrf_token %}
<ul class="form"> <table class="form">
{{ form.as_ul }} {{ form.as_table }}
</ul> </table>
{# Django si posílá jméno další stránky jako obsah formuláře a výchozí hodnota (mi přišlo, že) nejde změnit... #} {# Django si posílá jméno další stránky jako obsah formuláře a výchozí hodnota (mi přišlo, že) nejde změnit... #}
<input type="hidden" name='next' value="{{ next }}"> <input type="hidden" name='next' value="{{ next }}">
<input type="submit" value="Přihlásit"> <input type="submit" value="Přihlásit">
@ -23,4 +23,3 @@
{% endblock %} {% endblock %}

118
seminar/templates/seminar/prihlaska.html

@ -14,92 +14,93 @@
{% endblock %}{% endblock %} {% endblock %}{% endblock %}
</h1> </h1>
<form action="{% url 'seminar_prihlaska' %}" method="post"> <form action="{% url 'seminar_prihlaska' %}" method="post">
{% csrf_token %} {% csrf_token %}
{{form.non_field_errors}} {{form.non_field_errors}}
<ul class="form">
<li>
<hr>
<h4>
Přihlašovací údaje Přihlašovací údaje
</li> </h4>
<li> <table class="form">
{% include "seminar/prihlaska_field.html" with field=form.username %} {% include "seminar/prihlaska_field.html" with field=form.username %}
</li>
<li>
{% include "seminar/prihlaska_field.html" with field=form.password %} {% include "seminar/prihlaska_field.html" with field=form.password %}
</li>
<li>
{% include "seminar/prihlaska_field.html" with field=form.password_check %} {% include "seminar/prihlaska_field.html" with field=form.password_check %}
</li> </table>
<li>
<hr>
<h4>
Osobní údaje Osobní údaje
</li> </h4>
<li> <table class="form">
{% include "seminar/prihlaska_field.html" with field=form.jmeno %} {% include "seminar/prihlaska_field.html" with field=form.jmeno %}
</li>
<li>
{% include "seminar/prihlaska_field.html" with field=form.prijmeni %} {% include "seminar/prihlaska_field.html" with field=form.prijmeni %}
</li>
<li>
{% include "seminar/prihlaska_field.html" with field=form.pohlavi_muz%} {% include "seminar/prihlaska_field.html" with field=form.pohlavi_muz%}
</li>
<li>
{% include "seminar/prihlaska_field.html" with field=form.email %} {% include "seminar/prihlaska_field.html" with field=form.email %}
</li>
<li>
{% include "seminar/prihlaska_field.html" with field=form.telefon %} {% include "seminar/prihlaska_field.html" with field=form.telefon %}
</li>
<li>
{% include "seminar/prihlaska_field.html" with field=form.datum_narozeni %} {% include "seminar/prihlaska_field.html" with field=form.datum_narozeni %}
</li> </table>
<li>
<hr> <hr>
<h4>
Bydliště Bydliště
</li> </h4>
<li> <table class="form">
{% include "seminar/prihlaska_field.html" with field=form.ulice %} {% include "seminar/prihlaska_field.html" with field=form.ulice %}
</li>
<li>
{% include "seminar/prihlaska_field.html" with field=form.mesto %} {% include "seminar/prihlaska_field.html" with field=form.mesto %}
</li>
<li>
{% include "seminar/prihlaska_field.html" with field=form.psc %} {% include "seminar/prihlaska_field.html" with field=form.psc %}
</li>
<li>
{% include "seminar/prihlaska_field.html" with field=form.stat %} {% include "seminar/prihlaska_field.html" with field=form.stat %}
</li> {% include "seminar/prihlaska_field.html" with field=form.stat_text id="id_li_stat_text"%}
<li id="id_li_stat_text"> </table>
{% include "seminar/prihlaska_field.html" with field=form.stat_text %}
</li>
<li>
<hr> <hr>
<h4>
Škola
</h4>
<table class="form">
{% include "seminar/prihlaska_field.html" with field=form.skola %} {% include "seminar/prihlaska_field.html" with field=form.skola %}
</li> <tr><td colspan="2" ><button id="id_skola_text_button" type="button">Škola není v seznamu</button></td></tr>
<li> <tr><td id="id_li_skola_vypln" colspan="2">Vyplň prosím celý název a adresu školy.</td></tr>
<button id="id_skola_text_button" type="button">Škola není v seznamu</button> {% include "seminar/prihlaska_field.html" with field=form.skola_nazev id="id_li_skola_nazev" %}
</li> {% include "seminar/prihlaska_field.html" with field=form.skola_adresa id="id_li_skola_adresa" %}
<li id="id_li_skola_nazev">
Vyplň prosím celý název a adresu školy.<br>
{% include "seminar/prihlaska_field.html" with field=form.skola_nazev %}
</li>
<li id="id_li_skola_adresa">
{% include "seminar/prihlaska_field.html" with field=form.skola_adresa %}
</li>
<li>
{% include "seminar/prihlaska_field.html" with field=form.rok_maturity %} {% include "seminar/prihlaska_field.html" with field=form.rok_maturity %}
</li> </table>
<li>
<hr>
<h4>
Pošta
</h4>
<table class="form">
{% include "seminar/prihlaska_field.html" with field=form.zasilat %} {% include "seminar/prihlaska_field.html" with field=form.zasilat %}
</li> </table>
<li> <hr>
<h4>
GDPR
</h4>
{% include "seminar/gdpr.html" %} {% include "seminar/gdpr.html" %}
<table class="form">
{% include "seminar/prihlaska_field.html" with field=form.gdpr %} {% include "seminar/prihlaska_field.html" with field=form.gdpr %}
</li> </table>
<li>
<hr>
<h4>
Zasílání propagačních materiálů
</h4>
<table class="form">
{% include "seminar/prihlaska_field.html" with field=form.spam %} {% include "seminar/prihlaska_field.html" with field=form.spam %}
</li> </table>
</ul>
<hr>
<input type="submit" value="Odeslat"> <input type="submit" value="Odeslat">
</form> </form>
<script> <script>
@ -109,4 +110,3 @@ $("#id_skola_text_button").on("click",schoolNotInList);
{% endblock %} {% endblock %}

25
seminar/templates/seminar/prihlaska_field.html

@ -1,4 +1,23 @@
<label class="field-label{% if field.field.required %} field-required{% endif %}" for="{{ field.id_for_label }}">{{ field.label }}:</label>
<tr id="{{ id }}" >
<td>
<label class="field-label{% if field.field.required %} field-required{% endif %}" for="{{ field.id_for_label }}">
{{ field.label }}:
</label>
</td>
<td>
{{ field }} {{ field }}
{% if field.help_text %}<span class="field-helptext">{{ field.help_text|safe }}</span>{% endif %} </td>
{% if field.errors %}<span class="field-error">{{ field.errors }}</span>{% endif %} </tr>
{% if field.help_text %}
<tr>
<td colspan="2"><span class="field-helptext">{{ field.help_text|safe }}</span></td>
</tr>
{% endif %}
{% if field.errors %}
<tr>
<td colspan="2"><span class="field-error">{{ field.errors }}</span></td>
</tr>
{% endif %}

Loading…
Cancel
Save