formuláře vzhled jako tabulky
This commit is contained in:
		
							parent
							
								
									572ed79615
								
							
						
					
					
						commit
						57dae38cf9
					
				
					 5 changed files with 169 additions and 130 deletions
				
			
		|  | @ -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(){ | ||||||
|  |  | ||||||
|  | @ -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> | ||||||
|      Přihlašovací údaje | 
 | ||||||
|      </li><li> |      <h4> | ||||||
|  |       Přihlašovací údaje | ||||||
|  |      </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> | ||||||
|        Bydliště | 
 | ||||||
|      </li><li> |     <h4> | ||||||
|  |       Bydliště | ||||||
|  |     </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 %} | ||||||
| 
 |  | ||||||
|  |  | ||||||
|  | @ -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 %} | ||||||
| 
 |  | ||||||
|  |  | ||||||
|  | @ -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> |  | ||||||
|      Přihlašovací údaje |  | ||||||
|      </li> |  | ||||||
|      <li> |  | ||||||
|        {% include "seminar/prihlaska_field.html" with field=form.username %} |  | ||||||
|      </li> |  | ||||||
|      <li> |  | ||||||
|        {% include "seminar/prihlaska_field.html" with field=form.password %} |  | ||||||
|      </li> |  | ||||||
|      <li> |  | ||||||
|        {% include "seminar/prihlaska_field.html" with field=form.password_check %} |  | ||||||
|      </li> |  | ||||||
|      <li> |  | ||||||
|      Osobní údaje |  | ||||||
|      </li> |  | ||||||
|      <li> |  | ||||||
|        {% include "seminar/prihlaska_field.html" with field=form.jmeno %} |  | ||||||
|      </li> |  | ||||||
|      <li> |  | ||||||
|        {% include "seminar/prihlaska_field.html" with field=form.prijmeni %} |  | ||||||
|      </li> |  | ||||||
|      <li> |  | ||||||
|        {% include "seminar/prihlaska_field.html" with field=form.pohlavi_muz%} |  | ||||||
|      </li> |  | ||||||
|      <li> |  | ||||||
|        {% include "seminar/prihlaska_field.html" with field=form.email %} |  | ||||||
|      </li> |  | ||||||
|      <li> |  | ||||||
|        {% include "seminar/prihlaska_field.html" with field=form.telefon %} |  | ||||||
|      </li> |  | ||||||
|      <li> |  | ||||||
|        {% include "seminar/prihlaska_field.html" with field=form.datum_narozeni %} |  | ||||||
|      </li> |  | ||||||
|      <li> |  | ||||||
|        <hr> |  | ||||||
|        Bydliště |  | ||||||
|      </li> |  | ||||||
|      <li> |  | ||||||
|        {% include "seminar/prihlaska_field.html" with field=form.ulice %} |  | ||||||
|      </li> |  | ||||||
|      <li> |  | ||||||
|        {% include "seminar/prihlaska_field.html" with field=form.mesto %} |  | ||||||
|      </li> |  | ||||||
|      <li> |  | ||||||
|        {% include "seminar/prihlaska_field.html" with field=form.psc %} |  | ||||||
|      </li> |  | ||||||
|      <li> |  | ||||||
|        {% include "seminar/prihlaska_field.html" with field=form.stat %} |  | ||||||
|      </li> |  | ||||||
|      <li id="id_li_stat_text"> |  | ||||||
|        {% include "seminar/prihlaska_field.html" with field=form.stat_text %} |  | ||||||
|      </li> |  | ||||||
| 
 | 
 | ||||||
|      <li> | 
 | ||||||
|        <hr> | <hr> | ||||||
|        {% include "seminar/prihlaska_field.html" with field=form.skola %} |          <h4> | ||||||
|      </li> |           Přihlašovací údaje | ||||||
|      <li> |          </h4> | ||||||
|        <button id="id_skola_text_button" type="button">Škola není v seznamu</button> |          <table class="form"> | ||||||
|      </li> |            {% include "seminar/prihlaska_field.html" with field=form.username %} | ||||||
|      <li id="id_li_skola_nazev"> |            {% include "seminar/prihlaska_field.html" with field=form.password %} | ||||||
|        Vyplň prosím celý název a adresu školy.<br>  |            {% include "seminar/prihlaska_field.html" with field=form.password_check %} | ||||||
|        {% include "seminar/prihlaska_field.html" with field=form.skola_nazev %} |          </table> | ||||||
|      </li> | 
 | ||||||
|      <li id="id_li_skola_adresa"> | <hr> | ||||||
|        {% include "seminar/prihlaska_field.html" with field=form.skola_adresa %} | 
 | ||||||
|      </li> |         <h4> | ||||||
|      <li> |          Osobní údaje | ||||||
|        {% include "seminar/prihlaska_field.html" with field=form.rok_maturity %} |         </h4> | ||||||
|      </li> |           <table class="form"> | ||||||
|      <li> |             {% include "seminar/prihlaska_field.html" with field=form.jmeno %} | ||||||
|        {% include "seminar/prihlaska_field.html" with field=form.zasilat %} |             {% include "seminar/prihlaska_field.html" with field=form.prijmeni %} | ||||||
|      </li> |             {% include "seminar/prihlaska_field.html" with field=form.pohlavi_muz%} | ||||||
|      <li> |             {% include "seminar/prihlaska_field.html" with field=form.email %} | ||||||
|        {% include "seminar/gdpr.html" %} |             {% include "seminar/prihlaska_field.html" with field=form.telefon %} | ||||||
|        {% include "seminar/prihlaska_field.html" with field=form.gdpr %} |             {% include "seminar/prihlaska_field.html" with field=form.datum_narozeni %} | ||||||
|      </li> |          </table> | ||||||
|      <li> | 
 | ||||||
|        {% include "seminar/prihlaska_field.html" with field=form.spam %} | <hr> | ||||||
|      </li> | 
 | ||||||
| </ul> |         <h4> | ||||||
|  |           Bydliště | ||||||
|  |         </h4> | ||||||
|  |           <table class="form"> | ||||||
|  |            {% include "seminar/prihlaska_field.html" with field=form.ulice %} | ||||||
|  |            {% include "seminar/prihlaska_field.html" with field=form.mesto %} | ||||||
|  |            {% include "seminar/prihlaska_field.html" with field=form.psc %} | ||||||
|  |            {% include "seminar/prihlaska_field.html" with field=form.stat %} | ||||||
|  |            {% include "seminar/prihlaska_field.html" with field=form.stat_text id="id_li_stat_text"%} | ||||||
|  |          </table> | ||||||
|  | 
 | ||||||
|  | <hr> | ||||||
|  | 
 | ||||||
|  |         <h4> | ||||||
|  |          Škola | ||||||
|  |         </h4> | ||||||
|  |          <table class="form"> | ||||||
|  |            {% include "seminar/prihlaska_field.html" with field=form.skola %} | ||||||
|  |            <tr><td colspan="2" ><button id="id_skola_text_button" type="button">Škola není v seznamu</button></td></tr> | ||||||
|  |            <tr><td id="id_li_skola_vypln" colspan="2">Vyplň prosím celý název a adresu školy.</td></tr> | ||||||
|  |            {% include "seminar/prihlaska_field.html" with field=form.skola_nazev id="id_li_skola_nazev" %} | ||||||
|  |            {% include "seminar/prihlaska_field.html" with field=form.skola_adresa id="id_li_skola_adresa" %} | ||||||
|  |            {% include "seminar/prihlaska_field.html" with field=form.rok_maturity %} | ||||||
|  |          </table> | ||||||
|  | 
 | ||||||
|  | <hr> | ||||||
|  | 
 | ||||||
|  |         <h4> | ||||||
|  |          Pošta | ||||||
|  |         </h4> | ||||||
|  |          <table class="form"> | ||||||
|  |            {% include "seminar/prihlaska_field.html" with field=form.zasilat %} | ||||||
|  |          </table> | ||||||
|  |  <hr> | ||||||
|  | 
 | ||||||
|  |          <h4> | ||||||
|  |           GDPR | ||||||
|  |          </h4> | ||||||
|  |           {% include "seminar/gdpr.html" %} | ||||||
|  |           <table class="form"> | ||||||
|  |             {% include "seminar/prihlaska_field.html" with field=form.gdpr %} | ||||||
|  |           </table> | ||||||
|  | 
 | ||||||
|  | <hr> | ||||||
|  | 
 | ||||||
|  |         <h4> | ||||||
|  |          Zasílání propagačních materiálů | ||||||
|  |         </h4> | ||||||
|  |          <table class="form"> | ||||||
|  |            {% include "seminar/prihlaska_field.html" with field=form.spam %} | ||||||
|  |          </table> | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | <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 %} | ||||||
| 
 |  | ||||||
|  |  | ||||||
|  | @ -1,4 +1,23 @@ | ||||||
|        <label class="field-label{% if field.field.required %} field-required{% endif %}" for="{{ field.id_for_label }}">{{ field.label }}:</label> | 
 | ||||||
|        {{field}} | <tr id="{{ id }}" > | ||||||
|        {% 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 %} |     <label class="field-label{% if field.field.required %} field-required{% endif %}" for="{{ field.id_for_label }}"> | ||||||
|  |       {{ field.label }}: | ||||||
|  |     </label> | ||||||
|  |   </td> | ||||||
|  |   <td> | ||||||
|  |     {{ field }} | ||||||
|  |   </td> | ||||||
|  | </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…
	
		Reference in a new issue
	
	 Kateřina Čížková
						Kateřina Čížková