archiv ročníku vzhled
This commit is contained in:
		
							parent
							
								
									3b4daeb9a1
								
							
						
					
					
						commit
						0ac67f1a81
					
				
					 4 changed files with 86 additions and 96 deletions
				
			
		|  | @ -51,7 +51,10 @@ a:focus, a:hover, a:active { | |||
| 	color: #e84e10; | ||||
| 	text-decoration: none; | ||||
| } | ||||
| a:focus a:hover | ||||
| 
 | ||||
| img { | ||||
| 	filter: drop-shadow(0px 3px 3px rgba(0, 0, 0, 0.4)); | ||||
| } | ||||
| 
 | ||||
| h1 {	/*todo: odlišit 1 a 2 */ | ||||
| 	font-size: 200%; | ||||
|  | @ -594,6 +597,14 @@ div.org_pole, div.rocnik_pole { | |||
| 	text-align: center; | ||||
| } | ||||
| 
 | ||||
| div.cislo_pole { | ||||
| 	display: inline-block; | ||||
| 	width: 15%; | ||||
| 	min-width: 165px; | ||||
| 	text-align: center; | ||||
| 	padding: 10px; | ||||
| } | ||||
| 
 | ||||
| div.seznam_orgu h3 { | ||||
| 	text-align: center; | ||||
| 	margin-top: 10px; | ||||
|  | @ -623,6 +634,11 @@ div.org_email { | |||
| 	height: 298px; | ||||
| } | ||||
| 
 | ||||
| #archiv-rocnik.flip-card { | ||||
| 	width: 144px; | ||||
| 	height: 205px; | ||||
| } | ||||
| 
 | ||||
| /* This container is needed to position the front and back side */ | ||||
| .flip-card-inner { | ||||
|  position: relative; | ||||
|  | @ -654,16 +670,13 @@ div.org_email { | |||
| div.flip-card-foto img { | ||||
| 	width: 100%; | ||||
| 	height: 100%; | ||||
| 	filter: drop-shadow(0px 3px 3px rgba(0, 0, 0, 0.4)); /* FIXME:  obecně k obrázkům */ | ||||
| 
 | ||||
| } | ||||
| 
 | ||||
| /* Style the back side */ | ||||
| .flip-card-back { | ||||
|  /*background-color: #e84e10; | ||||
|  color: #fffbf6; | ||||
|  background-color: #fdedd5;*/ | ||||
|  background-color: #f9d59e; | ||||
|  color: black;/**/ | ||||
|  color: black; | ||||
|  transform: rotateY(180deg); | ||||
|  padding: 10px; | ||||
|  padding-top: 20px; | ||||
|  | @ -678,26 +691,35 @@ div.popis_rocniku { | |||
| } | ||||
| 
 | ||||
| 
 | ||||
| div.popis_rocniku a{ | ||||
| div.popis_rocniku a, div.cislo_odkazy a { | ||||
| 	font-weight: bold; | ||||
|   color: black; | ||||
| } | ||||
| 
 | ||||
| div.popis_rocniku a:hover{ | ||||
| div.popis_rocniku a:hover, | ||||
| div.cislo_odkazy a:hover { | ||||
| 	color: #6f2509; | ||||
| } | ||||
| 
 | ||||
| /* graf na úvodní stránce */ | ||||
| 
 | ||||
| a span.popup { | ||||
| 	position: absolute; | ||||
| 	visibility: hidden; | ||||
| div.cislo_odkazy ul { | ||||
| 		margin: 0px; | ||||
| 		padding: 0px; | ||||
| } | ||||
| 
 | ||||
| a span.popup:hover { | ||||
| 	visibility:visible; | ||||
| 	top:37px; left:37px; | ||||
| /* archiv ročník | ||||
| div.cisla-v-rocniku { | ||||
| 		font-weight: bold; | ||||
| 		color:  #6f2509; | ||||
| } | ||||
| 
 | ||||
| div.cislo-v-rocniku-blok { | ||||
| 	display: inline-block; | ||||
| 	width: 150px; | ||||
| 	height: 220px; | ||||
| 		text-align: center; | ||||
| }*/ | ||||
| 
 | ||||
| 
 | ||||
| /* galerie */ | ||||
| 
 | ||||
| /* velká fotka */ | ||||
|  |  | |||
|  | @ -40,7 +40,7 @@ | |||
|           {% for cislo in rocnik.cisla.all reversed %} | ||||
|           <li><a href='{{ cislo.verejne_url }}'>{{ cislo.poradi }}. číslo</a> {% if cislo.pdf %}(<a href='{{ cislo.pdf.url }}'>pdf</a>) {% endif %} | ||||
|           {% empty %} | ||||
|             --- | ||||
|           Žádná čísla k zobrazení | ||||
|           {% endfor %} | ||||
|           </ul> | ||||
|           <a href='{{ rocnik.verejne_url }}'>Výsledková listina</a> <!-- FIXME:  url výsledkovky--> | ||||
|  |  | |||
|  | @ -17,17 +17,49 @@ | |||
|     </ul> | ||||
|   {% endif %} | ||||
| 
 | ||||
|   <ul> | ||||
| <div class="cisla-v-rocniku"> | ||||
|   {% for c in rocnik.verejna_cisla %} | ||||
|   <li><a href="{{ c.verejne_url }}">Číslo {{ c.kod }}</a> | ||||
|       {% if c.pdf %} | ||||
|         (<a href='{{ c.pdf.url }}'>pdf</a>) | ||||
|       {% endif %} | ||||
|     <div class="cislo_pole"> | ||||
| 
 | ||||
|       <h6> Číslo {{ c.kod }}</h6> | ||||
| 
 | ||||
|       <div class="flip-card" id="archiv-rocnik"> | ||||
| 
 | ||||
|       <div class="flip-card-inner"> | ||||
|         <div class="flip-card-front"> | ||||
| 
 | ||||
|       <div class="flip-card-foto"> | ||||
|         {% if c.titulka_nahled %} | ||||
|       <img src="{{ c.titulka_nahled.url }}" alt=""> | ||||
|         <img src="{{ c.titulka_nahled.url }}" alt="{{ c.kod }}" height=180px> | ||||
|         {% else %} | ||||
|         <img src="" alt="no image" height=180px> | ||||
|         {% endif %} | ||||
|       </div> | ||||
| 
 | ||||
|       </div> | ||||
|        <div class="flip-card-back"> | ||||
| 
 | ||||
|          <div class="cislo_odkazy"> | ||||
|            <ul> | ||||
|              <li> | ||||
|                <a href="{{ c.verejne_url }}">archiv čísla</a> | ||||
|              </li> | ||||
|              {% if c.pdf %} | ||||
|              <li> | ||||
|                  <a href='{{ c.pdf.url }}'>pdf</a> | ||||
|              </li> | ||||
|              {% endif %} | ||||
|   {% endfor %} | ||||
|            </ul> | ||||
|          </div> | ||||
| 
 | ||||
| 
 | ||||
|       </div> | ||||
|       </div> | ||||
|       </div> | ||||
|       </div> | ||||
| 
 | ||||
|   {% endfor %} | ||||
| </div> | ||||
| 
 | ||||
|   {% if vysledkovka %} | ||||
|     {% if user.is_staff %} | ||||
|  |  | |||
|  | @ -308,81 +308,17 @@ class ArchivView(generic.ListView): | |||
| 	def get_context_data(self, **kwargs): | ||||
| 		context = super(ArchivView, self).get_context_data(**kwargs) | ||||
| 
 | ||||
| 		vyska = 594  # px | ||||
| 		sirka = 420  # px | ||||
| 
 | ||||
| 		# první číslo z každého ročníku | ||||
| 		cisla = Cislo.objects.filter(poradi=1) | ||||
| 
 | ||||
| 		# op == os.path, udělá z argumentů cestu | ||||
| 		png_dir = op.join(settings.MEDIA_ROOT, "cislo", "png") | ||||
| 
 | ||||
| 		# slovník {(ročník, url obrázku)} | ||||
| 		urls ={} | ||||
| 
 | ||||
| 		for i,c in enumerate(cisla): | ||||
| 				if not c.pdf: | ||||
| 					urls[c.rocnik] = op.join(settings.MEDIA_URL, "cislo", "png", "default.png") | ||||
| 		for i, c in enumerate(cisla): | ||||
| 			if c.titulka_nahled: | ||||
| 				urls[c.rocnik] = c.titulka_nahled.url | ||||
| 			else: | ||||
| 					filename = os.path.split(c.pdf.file.name)[1].split(".")[0] | ||||
| 					png_filename = "{}.png".format(filename) | ||||
| 
 | ||||
| 					# Pokud obrázek neexistuje nebo není aktuální, vytvoř jej | ||||
| 					png_path = op.join(png_dir, png_filename) | ||||
| 					if not op.exists(png_path) or \ | ||||
| 							op.getmtime(png_path) < op.getmtime(c.pdf.path): | ||||
| 
 | ||||
| 						subprocess.call([ | ||||
| 							"convert", | ||||
| 							"-density", "300x300", | ||||
| 							"-geometry", "{}x{}".format(vyska, sirka), | ||||
| 							"-background", "white", | ||||
| 							"-flatten", | ||||
| 							"{}[0]".format(c.pdf.path),  # titulní strana | ||||
| 							png_path | ||||
| 						]) | ||||
| 
 | ||||
| 					urls[c.rocnik] = op.join(settings.MEDIA_URL, "cislo", "png", png_filename) | ||||
| 				urls[c.rocnik] = op.join(settings.MEDIA_URL, "cislo", "png", "default.png") | ||||
| 
 | ||||
| 		context["object_list"] = urls | ||||
| 		 | ||||
| 		print(context) | ||||
| 
 | ||||
| 		# def spirala(urls, tags, idx): | ||||
| 		# 	"""Rekurzivně prochází urls a generuje strom elementů do tags""" | ||||
| 		# 	if idx >= len(urls): | ||||
| 		# 		return | ||||
| 
 | ||||
| 		# 	img_url, cislo = urls[idx] | ||||
| 		# 	tags.append( | ||||
| 		# 		"<div style='top:{}%;left:{}%;width:{}%;height:{}%;'>" | ||||
| 		# 		.format( | ||||
| 		# 			50 if idx % 4 == 2 else 0, | ||||
| 		# 			50 if idx % 4 == 1 else 0, | ||||
| 		# 			50 if idx % 2 == 1 else 100, | ||||
| 		# 			50 if idx > 0 and idx % 2 == 0 else 100 | ||||
| 		# 		) | ||||
| 		# 	) | ||||
| 		# 	tags.append("<a href='{}' title='{}'>".format( | ||||
| 		# 		cislo.verejne_url(), cislo.kod() | ||||
| 		# 	)) | ||||
| 		# 	tags.append( | ||||
| 		# 		"<img src='{}' style='top:{}%;left:{}%;width:{}%;height:{}%;'>" | ||||
| 		# 		.format( | ||||
| 		# 			img_url, | ||||
| 		# 			50 if idx % 4 == 3 else 0, | ||||
| 		# 			50 if idx % 4 == 2 else 0, | ||||
| 		# 			50 if idx % 2 == 0 else 100, | ||||
| 		# 			50 if idx % 2 == 1 else 100 | ||||
| 		# 		) | ||||
| 		# 	) | ||||
| 		# 	tags.append("</a>") | ||||
| 		# 	spirala(urls, tags, idx + 1) | ||||
| 		# 	tags.append("</div>") | ||||
| 		# spirala(urls, tags, 0) | ||||
| 
 | ||||
| 		# context["nahledy"] = "\n".join(tags) | ||||
| 		 | ||||
| 		return context | ||||
| 
 | ||||
| ### Výsledky | ||||
|  |  | |||
		Loading…
	
		Reference in a new issue
	
	 Kateřina Čížková
						Kateřina Čížková