Aspoň nějaká forma prokliku na jiný ročník
This commit is contained in:
		
							parent
							
								
									24841a2e29
								
							
						
					
					
						commit
						c400b72481
					
				
					 2 changed files with 21 additions and 0 deletions
				
			
		|  | @ -13,6 +13,10 @@ Do: {{ filtr.reseni_do }} | ||||||
| <input type=submit value="→"> | <input type=submit value="→"> | ||||||
| </form> | </form> | ||||||
| 
 | 
 | ||||||
|  | <form onsubmit="javascript:jiny_rocnik_redir(); return false;"> | ||||||
|  | 	<input type=number max="{{ aktualni_rocnik.rocnik }}" min=1 id=jiny_rocnik placeholder="Jiný ročník"> | ||||||
|  | 	<input type=submit value="Přejdi"> | ||||||
|  | </form> | ||||||
| <table class="dosla_reseni"> | <table class="dosla_reseni"> | ||||||
| 	<tr> | 	<tr> | ||||||
| 		<td></td> {# Prázdná buňka v levém horním rohu #} | 		<td></td> {# Prázdná buňka v levém horním rohu #} | ||||||
|  | @ -43,3 +47,18 @@ Do: {{ filtr.reseni_do }} | ||||||
| </table> | </table> | ||||||
| 
 | 
 | ||||||
| {% endblock %} | {% endblock %} | ||||||
|  | 
 | ||||||
|  | {% block script %} | ||||||
|  | <script type=text/javascript> | ||||||
|  | 	// Nemůže se to jmenovat jen "jiny_rocnik", protože se to přepíše: https://trackjs.com/blog/when-form-submit-is-not-a-function/ | ||||||
|  | 	function jiny_rocnik_redir() { | ||||||
|  | 		let rocnik = document.getElementById("jiny_rocnik").value; | ||||||
|  | 		var redirect = undefined; | ||||||
|  | 		if (rocnik == '') | ||||||
|  | 			redirect = '/org/reseni/'; | ||||||
|  | 		else | ||||||
|  | 			redirect = '/org/reseni/rocnik/'+rocnik+'/'; | ||||||
|  | 		location.assign(redirect); | ||||||
|  | 	} | ||||||
|  | </script> | ||||||
|  | {% endblock %} | ||||||
|  |  | ||||||
|  | @ -151,6 +151,8 @@ class TabulkaOdevzdanychReseniView(ListView): | ||||||
| 		ctx['filtr'] = FiltrForm(initial=self.request.GET, rocnik=self.aktualni_rocnik) | 		ctx['filtr'] = FiltrForm(initial=self.request.GET, rocnik=self.aktualni_rocnik) | ||||||
| 		# Pro použití hacku na automatické {{form.media}} v template: | 		# Pro použití hacku na automatické {{form.media}} v template: | ||||||
| 		ctx['form'] = ctx['filtr'] | 		ctx['form'] = ctx['filtr'] | ||||||
|  | 		# Pro maximum v přesměrovátku ročníků | ||||||
|  | 		ctx['aktualni_rocnik'] = m.Nastaveni.get_solo().aktualni_rocnik | ||||||
| 
 | 
 | ||||||
| 		return ctx | 		return ctx | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
		Reference in a new issue
	
	 Pavel "LEdoian" Turinsky
						Pavel "LEdoian" Turinsky