list view
This commit is contained in:
		
							parent
							
								
									5de1736347
								
							
						
					
					
						commit
						58eb50dfb2
					
				
					 12 changed files with 232 additions and 37 deletions
				
			
		|  | @ -301,6 +301,7 @@ def get_search_core(): | ||||||
|         limit = int(limit) |         limit = int(limit) | ||||||
|         limit = min(100, limit) |         limit = min(100, limit) | ||||||
|     else: |     else: | ||||||
|  |         # Note to self: also apply to search.html template url builder. | ||||||
|         limit = 50 |         limit = 50 | ||||||
| 
 | 
 | ||||||
|     # OFFSET |     # OFFSET | ||||||
|  | @ -400,9 +401,8 @@ def get_search_core(): | ||||||
|     else: |     else: | ||||||
|         prev_page_url = None |         prev_page_url = None | ||||||
| 
 | 
 | ||||||
|     search_kwargs['extension'] = extension_string |     view = request.args.get('view', 'grid') | ||||||
|     search_kwargs['extension_not'] = extension_not_string |     search_kwargs['view'] = view | ||||||
|     search_kwargs['mimetype'] = mimetype_string |  | ||||||
| 
 | 
 | ||||||
|     final_results = { |     final_results = { | ||||||
|         'next_page_url': next_page_url, |         'next_page_url': next_page_url, | ||||||
|  |  | ||||||
|  | @ -50,6 +50,7 @@ def edit_params(original, modifications): | ||||||
|         return '' |         return '' | ||||||
|     new_params = ['%s=%s' % (k, v) for (k, v) in new_params.items() if v] |     new_params = ['%s=%s' % (k, v) for (k, v) in new_params.items() if v] | ||||||
|     new_params = '&'.join(new_params) |     new_params = '&'.join(new_params) | ||||||
|  |     if new_params: | ||||||
|         new_params = '?' + new_params |         new_params = '?' + new_params | ||||||
|     return new_params |     return new_params | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -26,7 +26,7 @@ def photo(p, include_albums=True, include_tags=True): | ||||||
|         'bytes': p.bytes, |         'bytes': p.bytes, | ||||||
|         'duration_str': helpers.seconds_to_hms(p.duration) if p.duration is not None else None, |         'duration_str': helpers.seconds_to_hms(p.duration) if p.duration is not None else None, | ||||||
|         'duration': p.duration, |         'duration': p.duration, | ||||||
|         'bytestring': p.bytestring(), |         'bytes_str': p.bytestring(), | ||||||
|         'has_thumbnail': bool(p.thumbnail), |         'has_thumbnail': bool(p.thumbnail), | ||||||
|         'created': p.created, |         'created': p.created, | ||||||
|         'filename': p.basename, |         'filename': p.basename, | ||||||
|  |  | ||||||
|  | @ -746,6 +746,7 @@ class PDBPhotoMixin: | ||||||
|         Returns the Photo object. |         Returns the Photo object. | ||||||
|         ''' |         ''' | ||||||
|         filename = os.path.abspath(filename) |         filename = os.path.abspath(filename) | ||||||
|  |         assert os.path.isfile(filename) | ||||||
|         if not allow_duplicates: |         if not allow_duplicates: | ||||||
|             try: |             try: | ||||||
|                 existing = self.get_photo_by_path(filename) |                 existing = self.get_photo_by_path(filename) | ||||||
|  |  | ||||||
							
								
								
									
										
											BIN
										
									
								
								etiquette/static/Highlander_Normal.ttf
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								etiquette/static/Highlander_Normal.ttf
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								etiquette/static/basic_thumbnails/archive.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								etiquette/static/basic_thumbnails/archive.png
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| After Width: | Height: | Size: 49 KiB | 
							
								
								
									
										151
									
								
								etiquette/static/basic_thumbnails/archive.svg
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										151
									
								
								etiquette/static/basic_thumbnails/archive.svg
									
									
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,151 @@ | ||||||
|  | <?xml version="1.0" encoding="UTF-8" standalone="no"?> | ||||||
|  | <svg | ||||||
|  |    xmlns:dc="http://purl.org/dc/elements/1.1/" | ||||||
|  |    xmlns:cc="http://creativecommons.org/ns#" | ||||||
|  |    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" | ||||||
|  |    xmlns:svg="http://www.w3.org/2000/svg" | ||||||
|  |    xmlns="http://www.w3.org/2000/svg" | ||||||
|  |    xmlns:xlink="http://www.w3.org/1999/xlink" | ||||||
|  |    version="1.1" | ||||||
|  |    id="svg2" | ||||||
|  |    viewBox="0 0 640.00003 640" | ||||||
|  |    height="640" | ||||||
|  |    width="640"> | ||||||
|  |   <defs | ||||||
|  |      id="defs4"> | ||||||
|  |     <linearGradient | ||||||
|  |        id="linearGradient4595"> | ||||||
|  |       <stop | ||||||
|  |          id="stop4597" | ||||||
|  |          offset="0" | ||||||
|  |          style="stop-color:#a5640f;stop-opacity:1" /> | ||||||
|  |       <stop | ||||||
|  |          style="stop-color:#e98e16;stop-opacity:1" | ||||||
|  |          offset="0.69265634" | ||||||
|  |          id="stop4603" /> | ||||||
|  |       <stop | ||||||
|  |          id="stop4599" | ||||||
|  |          offset="1" | ||||||
|  |          style="stop-color:#ca8224;stop-opacity:1" /> | ||||||
|  |     </linearGradient> | ||||||
|  |     <linearGradient | ||||||
|  |        id="linearGradient4160"> | ||||||
|  |       <stop | ||||||
|  |          id="stop4162" | ||||||
|  |          offset="0" | ||||||
|  |          style="stop-color:#414141;stop-opacity:1" /> | ||||||
|  |       <stop | ||||||
|  |          style="stop-color:#a5a5a5;stop-opacity:1" | ||||||
|  |          offset="0.44465271" | ||||||
|  |          id="stop4172" /> | ||||||
|  |       <stop | ||||||
|  |          style="stop-color:#cccccc;stop-opacity:1" | ||||||
|  |          offset="0.51481694" | ||||||
|  |          id="stop4168" /> | ||||||
|  |       <stop | ||||||
|  |          id="stop4164" | ||||||
|  |          offset="1" | ||||||
|  |          style="stop-color:#ffffff;stop-opacity:1" /> | ||||||
|  |     </linearGradient> | ||||||
|  |     <linearGradient | ||||||
|  |        gradientUnits="userSpaceOnUse" | ||||||
|  |        y2="742.12012" | ||||||
|  |        x2="213.38019" | ||||||
|  |        y1="950.68616" | ||||||
|  |        x1="218.28458" | ||||||
|  |        id="linearGradient4166" | ||||||
|  |        xlink:href="#linearGradient4160" /> | ||||||
|  |     <linearGradient | ||||||
|  |        gradientTransform="matrix(0.81873789,0,0,0.81873789,82.235775,82.734315)" | ||||||
|  |        y2="66.04393" | ||||||
|  |        x2="274.98886" | ||||||
|  |        y1="446.46738" | ||||||
|  |        x1="462.34656" | ||||||
|  |        gradientUnits="userSpaceOnUse" | ||||||
|  |        id="linearGradient4605" | ||||||
|  |        xlink:href="#linearGradient4595" /> | ||||||
|  |     <linearGradient | ||||||
|  |        gradientTransform="matrix(0.81873789,0,0,0.81873789,72.235775,88.734315)" | ||||||
|  |        y2="66.04393" | ||||||
|  |        x2="274.98886" | ||||||
|  |        y1="446.46738" | ||||||
|  |        x1="462.34656" | ||||||
|  |        gradientUnits="userSpaceOnUse" | ||||||
|  |        id="linearGradient4607" | ||||||
|  |        xlink:href="#linearGradient4595" /> | ||||||
|  |     <linearGradient | ||||||
|  |        gradientTransform="matrix(0.81873789,0,0,0.81873789,55.235775,96.734315)" | ||||||
|  |        y2="66.04393" | ||||||
|  |        x2="274.98886" | ||||||
|  |        y1="446.46738" | ||||||
|  |        x1="462.34656" | ||||||
|  |        gradientUnits="userSpaceOnUse" | ||||||
|  |        id="linearGradient4609" | ||||||
|  |        xlink:href="#linearGradient4595" /> | ||||||
|  |     <linearGradient | ||||||
|  |        gradientTransform="matrix(0.81873789,0,0,0.81873789,43.235775,105.73431)" | ||||||
|  |        y2="66.04393" | ||||||
|  |        x2="274.98886" | ||||||
|  |        y1="446.46738" | ||||||
|  |        x1="462.34656" | ||||||
|  |        gradientUnits="userSpaceOnUse" | ||||||
|  |        id="linearGradient4611" | ||||||
|  |        xlink:href="#linearGradient4595" /> | ||||||
|  |   </defs> | ||||||
|  |   <metadata | ||||||
|  |      id="metadata7"> | ||||||
|  |     <rdf:RDF> | ||||||
|  |       <cc:Work | ||||||
|  |          rdf:about=""> | ||||||
|  |         <dc:format>image/svg+xml</dc:format> | ||||||
|  |         <dc:type | ||||||
|  |            rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> | ||||||
|  |         <dc:title></dc:title> | ||||||
|  |       </cc:Work> | ||||||
|  |     </rdf:RDF> | ||||||
|  |   </metadata> | ||||||
|  |   <g | ||||||
|  |      transform="translate(-80,-40)" | ||||||
|  |      id="g4356"> | ||||||
|  |     <path | ||||||
|  |        style="opacity:1;fill:#a5640f;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:15;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" | ||||||
|  |        d="m -282.12619,-37.396101 161.219,0 c 70.095718,0 82.024958,7.47508 82.024958,82.02461 l 0,243.244521 -325.269138,0 0,-243.244521 c 0,-70.04039 13.13251,-82.02461 82.02518,-82.02461 z" | ||||||
|  |        id="rect4275" /> | ||||||
|  |     <path | ||||||
|  |        id="path4278" | ||||||
|  |        d="m -275.81763,-24.668179 148.60186,0 c 64.609968,0 75.605616,6.890074 75.605616,75.605293 l 0,202.062886 c 0,18.12283 -1.812465,22.14511 -19.389846,22.14511 l -260.27953,0 c -16.24739,0 -20.14392,-2.24968 -20.14392,-16.27566 l 0,-207.932336 c 0,-64.558968 12.10475,-75.605293 75.60582,-75.605293 z" | ||||||
|  |        style="opacity:1;fill:#f4d090;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:15;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" /> | ||||||
|  |   </g> | ||||||
|  |   <path | ||||||
|  |      style="opacity:1;fill:url(#linearGradient4605);fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:10;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" | ||||||
|  |      d="m 423.81474,84.095875 c -5.43789,0.0167 -9.86029,0.8948 -13.43881,2.8304 -1.76685,0.95569 -163.67879,70.141055 -165.05589,71.635595 -10.7294,6.39798 -13.52037,23.00701 -13.52037,55.58463 l 0,199.15319 214.2071,48.19999 155.47184,-83.62205 0,-199.1532 c 0,-61.03652 -2.75883,-57.41461 -45.10509,-66.94339 L 450.20305,87.890535 c -10.7244,-2.41321 -19.39672,-3.81614 -26.3883,-3.79466 z" | ||||||
|  |      id="path4487" /> | ||||||
|  |   <path | ||||||
|  |      id="path4489" | ||||||
|  |      d="m 289.97255,170.50036 97.86176,22.02065 c 42.5489,9.57425 49.79008,16.84482 49.79008,73.10457 l 0,165.43655 c 0,14.83785 -1.19358,17.86245 -12.76918,15.25774 L 253.44811,407.7502 c -10.69972,-2.40762 -13.26578,-4.82694 -13.26578,-16.31054 l 0,-170.24208 c 0,-52.85688 7.97158,-60.10716 49.79022,-50.69722 z" | ||||||
|  |      style="opacity:1;fill:#f4d090;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:5;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" /> | ||||||
|  |   <path | ||||||
|  |      id="path4329" | ||||||
|  |      d="m 222.8007,176.51673 c -5.43789,0.0167 -9.86029,0.89479 -13.43881,2.8304 -1.76685,0.95569 -15.23912,7.4636 -16.61622,8.95814 -10.7294,6.39798 -13.52037,23.00701 -13.52037,55.58463 l 0,199.15319 214.2071,48.19999 15.9446,-8.57596 0,-199.15319 c 0,-61.03653 -7.85598,-68.92486 -54.01752,-79.31203 L 249.18901,180.31138 c -10.7244,-2.41318 -19.39673,-3.81614 -26.38831,-3.79465 z" | ||||||
|  |      style="opacity:1;fill:url(#linearGradient4607);fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:10;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" /> | ||||||
|  |   <path | ||||||
|  |      style="opacity:1;fill:#f4d090;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:5;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" | ||||||
|  |      d="m 237.39818,200.24376 97.86176,22.02065 c 42.5489,9.57425 49.79008,16.84482 49.79008,73.10457 l 0,165.43655 c 0,14.83785 -1.19359,17.86245 -12.76918,15.25773 L 200.87374,437.4936 c -10.69972,-2.40763 -13.26578,-4.82694 -13.26578,-16.31054 l 0,-170.24209 c 0,-52.85687 7.97158,-60.10715 49.79022,-50.69721 z" | ||||||
|  |      id="path4321" /> | ||||||
|  |   <path | ||||||
|  |      style="opacity:1;fill:url(#linearGradient4609);fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:10;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" | ||||||
|  |      d="m 151.76607,206.78516 c -5.4379,0.0167 -9.86029,0.8948 -13.43882,2.8304 -1.76685,0.95569 -15.23911,7.4636 -16.61622,8.95814 -10.7294,6.39799 -13.52036,23.00702 -13.52036,55.58463 l 0,199.1532 214.20709,48.19999 15.9446,-8.57596 0,-199.1532 c 0,-61.03652 -7.85598,-68.92486 -54.01751,-79.31203 L 178.15437,210.57981 c -10.7244,-2.41318 -19.39673,-3.81613 -26.3883,-3.79465 z" | ||||||
|  |      id="path4344" /> | ||||||
|  |   <path | ||||||
|  |      id="path4346" | ||||||
|  |      d="m 166.36354,230.51219 97.86177,22.02065 c 42.54889,9.57425 49.79008,16.84482 49.79008,73.10458 l 0,165.43654 c 0,14.83785 -1.1936,17.86246 -12.76919,15.25774 L 129.8391,467.76203 c -10.69971,-2.40762 -13.26578,-4.82693 -13.26578,-16.31054 l 0,-170.24208 c 0,-52.85688 7.97159,-60.10716 49.79022,-50.69722 z" | ||||||
|  |      style="opacity:1;fill:#f4d090;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:5;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" /> | ||||||
|  |   <path | ||||||
|  |      id="path4350" | ||||||
|  |      d="m 82.096785,240.89008 c -5.43789,0.0167 -9.86029,0.8948 -13.43881,2.8304 -1.76685,0.95569 -15.23912,7.4636 -16.61622,8.95814 -10.72941,6.39799 -13.52037,23.00702 -13.52037,55.58463 l 0,199.15319 214.207095,48.2 15.9446,-8.57596 0,-199.1532 c 0,-61.03652 -7.85599,-68.92486 -54.01752,-79.31203 L 108.48509,244.68473 C 97.760695,242.27155 89.088365,240.8686 82.096785,240.89008 Z" | ||||||
|  |      style="opacity:1;fill:url(#linearGradient4611);fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:10;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" /> | ||||||
|  |   <path | ||||||
|  |      style="opacity:1;fill:#f4d090;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:5;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" | ||||||
|  |      d="m 96.694255,264.61711 97.861765,22.02065 c 42.54889,9.57425 49.79008,16.84482 49.79008,73.10458 l 0,165.43654 c 0,14.83785 -1.1936,17.86245 -12.76918,15.25774 L 60.169825,501.86695 c -10.69972,-2.40762 -13.26578,-4.82694 -13.26578,-16.31054 l 0,-170.24208 c 0,-52.85688 7.97158,-60.10716 49.79021,-50.69722 z" | ||||||
|  |      id="path4352" /> | ||||||
|  | </svg> | ||||||
| After Width: | Height: | Size: 8.9 KiB | 
|  | @ -82,7 +82,14 @@ li | ||||||
|     border-right: 2px solid #ffacac; |     border-right: 2px solid #ffacac; | ||||||
|     border-bottom: 2px solid #ffacac; |     border-bottom: 2px solid #ffacac; | ||||||
| } | } | ||||||
| .photo_galleryview | .photo_card_list | ||||||
|  | { | ||||||
|  |     background-color: #ffffd4; | ||||||
|  |     display: block; | ||||||
|  |     padding: 4px; | ||||||
|  |     margin: 8px; | ||||||
|  | } | ||||||
|  | .photo_card_grid | ||||||
| { | { | ||||||
|     vertical-align: middle; |     vertical-align: middle; | ||||||
|     position: relative; |     position: relative; | ||||||
|  | @ -96,7 +103,7 @@ li | ||||||
|     margin: 8px; |     margin: 8px; | ||||||
|     border-radius: 8px; |     border-radius: 8px; | ||||||
| } | } | ||||||
| .photo_galleryview_thumb | .photo_card_grid_thumb | ||||||
| { | { | ||||||
|     display:flex; |     display:flex; | ||||||
|     flex-direction: column; |     flex-direction: column; | ||||||
|  | @ -106,7 +113,7 @@ li | ||||||
|     width:  100%; |     width:  100%; | ||||||
|     height: 150px; |     height: 150px; | ||||||
| } | } | ||||||
| .photo_galleryview_thumb a | .photo_card_grid_thumb a | ||||||
| { | { | ||||||
|     display:flex; |     display:flex; | ||||||
|     flex-direction: column; |     flex-direction: column; | ||||||
|  | @ -116,13 +123,13 @@ li | ||||||
|     width: 100%; |     width: 100%; | ||||||
|     height: 150px; |     height: 150px; | ||||||
| } | } | ||||||
| .photo_galleryview_thumb img | .photo_card_grid_thumb img | ||||||
| { | { | ||||||
|     max-width: 100%; |     max-width: 100%; | ||||||
|     max-height: 100%; |     max-height: 100%; | ||||||
|     height: auto; |     height: auto; | ||||||
| } | } | ||||||
| .photo_galleryview_info | .photo_card_grid_info | ||||||
| { | { | ||||||
|     position: absolute; |     position: absolute; | ||||||
|     top: 160px; |     top: 160px; | ||||||
|  | @ -131,23 +138,23 @@ li | ||||||
|     right: 8px; |     right: 8px; | ||||||
|     font-size: 0.8em; |     font-size: 0.8em; | ||||||
| } | } | ||||||
| .photo_galleryview_info a | .photo_card_grid_info a | ||||||
| { | { | ||||||
|     position: absolute; |     position: absolute; | ||||||
|     max-height: 30px; |     max-height: 30px; | ||||||
|     overflow: hidden; |     overflow: hidden; | ||||||
| } | } | ||||||
| .photo_galleryview_info a:hover | .photo_card_grid_info a:hover | ||||||
| { | { | ||||||
|     max-height: 100%; |     max-height: 100%; | ||||||
| } | } | ||||||
| .photo_galleryview_file_metadata | .photo_card_grid_file_metadata | ||||||
| { | { | ||||||
|     position: absolute; |     position: absolute; | ||||||
|     bottom: 0; |     bottom: 0; | ||||||
|     right: 0; |     right: 0; | ||||||
| } | } | ||||||
| .photo_galleryview_tags | .photo_card_grid_tags | ||||||
| { | { | ||||||
|     position: absolute; |     position: absolute; | ||||||
|     bottom: 0; |     bottom: 0; | ||||||
|  | @ -175,3 +182,8 @@ li | ||||||
| { | { | ||||||
|     background-color: #faa; |     background-color: #faa; | ||||||
| } | } | ||||||
|  | 
 | ||||||
|  | @font-face { | ||||||
|  |     font-family: 'Highlander'; | ||||||
|  |     src: url('/static/Highlander_Normal.ttf'); | ||||||
|  | } | ||||||
|  | @ -1,7 +1,7 @@ | ||||||
| <!DOCTYPE html5> | <!DOCTYPE html5> | ||||||
| <html> | <html> | ||||||
| <head> | <head> | ||||||
|     {% import "photo_object.html" as photo_object %} |     {% import "photo_card.html" as photo_card %} | ||||||
|     {% import "header.html" as header %} |     {% import "header.html" as header %} | ||||||
|     <title>Album {{album["title"]}}</title> |     <title>Album {{album["title"]}}</title> | ||||||
|     <meta charset="UTF-8"> |     <meta charset="UTF-8"> | ||||||
|  | @ -44,7 +44,7 @@ | ||||||
|     <h3>Photos</h3> |     <h3>Photos</h3> | ||||||
|     <ul> |     <ul> | ||||||
|         {% for photo in photos %} |         {% for photo in photos %} | ||||||
|         {{photo_object.galleryview(photo)}} |         {{photo_card.create_photo_card(photo)}} | ||||||
|         {% endfor %} |         {% endfor %} | ||||||
|     </ul> |     </ul> | ||||||
|     {% endif %} |     {% endif %} | ||||||
|  |  | ||||||
|  | @ -42,7 +42,7 @@ | ||||||
|     flex: 1; |     flex: 1; | ||||||
|     background-color: rgba(0, 0, 0, 0.1); |     background-color: rgba(0, 0, 0, 0.1); | ||||||
| } | } | ||||||
| .photo_object | .photo_viewer | ||||||
| { | { | ||||||
|     display: flex; |     display: flex; | ||||||
|     flex: 1; |     flex: 1; | ||||||
|  | @ -52,10 +52,8 @@ | ||||||
|     height: 100%; |     height: 100%; | ||||||
|     width: 100%; |     width: 100%; | ||||||
| } | } | ||||||
| .photo_object a | .photo_viewer a | ||||||
| { | { | ||||||
|     height: 100%; |  | ||||||
|     width: 100%; |  | ||||||
|     display: flex; |     display: flex; | ||||||
|     justify-content: center; |     justify-content: center; | ||||||
|     align-items: center; |     align-items: center; | ||||||
|  | @ -69,16 +67,16 @@ | ||||||
|     align-items: center; |     align-items: center; | ||||||
|     background-repeat: no-repeat; |     background-repeat: no-repeat; | ||||||
| } | } | ||||||
| .photo_object img | .photo_viewer img | ||||||
| { | { | ||||||
|     max-height: 100%; |     max-height: 100%; | ||||||
|     max-width: 100%; |     max-width: 100%; | ||||||
| } | } | ||||||
| .photo_object audio | .photo_viewer audio | ||||||
| { | { | ||||||
|     width: 100%; |     width: 100%; | ||||||
| } | } | ||||||
| .photo_object video | .photo_viewer video | ||||||
| { | { | ||||||
|     max-width: 100%; |     max-width: 100%; | ||||||
|     max-height: 100%; |     max-height: 100%; | ||||||
|  | @ -112,7 +110,7 @@ | ||||||
|         {% if photo["width"] %} |         {% if photo["width"] %} | ||||||
|             <li>Dimensions: {{photo["width"]}}x{{photo["height"]}} px</li> |             <li>Dimensions: {{photo["width"]}}x{{photo["height"]}} px</li> | ||||||
|             <li>Aspect ratio: {{photo["ratio"]}}</li> |             <li>Aspect ratio: {{photo["ratio"]}}</li> | ||||||
|             <li>Size: {{photo["bytestring"]}}</li> |             <li>Size: {{photo["bytes_str"]}}</li> | ||||||
|         {% endif %} |         {% endif %} | ||||||
|         {% if photo["duration"] %} |         {% if photo["duration"] %} | ||||||
|             <li>Duration: {{photo["duration_str"]}}</li> |             <li>Duration: {{photo["duration_str"]}}</li> | ||||||
|  | @ -137,7 +135,7 @@ | ||||||
| 
 | 
 | ||||||
| <div id="right"> | <div id="right"> | ||||||
|     <!-- THE PHOTO ITSELF --> |     <!-- THE PHOTO ITSELF --> | ||||||
|     <div class="photo_object"> |     <div class="photo_viewer"> | ||||||
|         {% if mimetype == "image" %} |         {% if mimetype == "image" %} | ||||||
|         <div id="photo_img_holder"><img id="photo_img" src="{{link}}" onclick="toggle_hoverzoom()" onload="this.style.opacity=0.99"></div> |         <div id="photo_img_holder"><img id="photo_img" src="{{link}}" onclick="toggle_hoverzoom()" onload="this.style.opacity=0.99"></div> | ||||||
|         <!-- <img src="{{link}}"> --> |         <!-- <img src="{{link}}"> --> | ||||||
|  |  | ||||||
|  | @ -4,11 +4,24 @@ | ||||||
|         "txt": "txt", |         "txt": "txt", | ||||||
|         "svg": "svg", |         "svg": "svg", | ||||||
|         "video": "video", |         "video": "video", | ||||||
|  | 
 | ||||||
|  |         "7z": "archive", | ||||||
|  |         "gz": "archive", | ||||||
|  |         "rar": "archive", | ||||||
|  |         "tar": "archive", | ||||||
|  |         "zip": "archive", | ||||||
|     } |     } | ||||||
| %} | %} | ||||||
| {% macro galleryview(photo) %} | {% macro create_photo_card(photo, view="grid") %} | ||||||
| <div class="photo_galleryview"> | 
 | ||||||
|     <div class="photo_galleryview_thumb"> | {% if view == "list" %} | ||||||
|  | <div class="photo_card_list"> | ||||||
|  |     <a target="_blank" href="/photo/{{photo["id"]}}">{{photo["filename"]}}</a> | ||||||
|  | </div> | ||||||
|  | 
 | ||||||
|  | {% else %} | ||||||
|  | <div class="photo_card_grid"> | ||||||
|  |     <div class="photo_card_grid_thumb"> | ||||||
|         <a target="_blank" href="/photo/{{photo["id"]}}"> |         <a target="_blank" href="/photo/{{photo["id"]}}"> | ||||||
|             <img height="150" |             <img height="150" | ||||||
|         {% if photo["has_thumbnail"] %} |         {% if photo["has_thumbnail"] %} | ||||||
|  | @ -23,18 +36,18 @@ | ||||||
|         {% endif %} |         {% endif %} | ||||||
|         </a> |         </a> | ||||||
|     </div> |     </div> | ||||||
|     <div class="photo_galleryview_info"> |     <div class="photo_card_grid_info"> | ||||||
|         <a target="_blank" href="/photo/{{photo["id"]}}">{{photo["filename"]}}</a> |         <a target="_blank" href="/photo/{{photo["id"]}}">{{photo["filename"]}}</a> | ||||||
|         <span class="photo_galleryview_file_metadata"> |         <span class="photo_card_grid_file_metadata"> | ||||||
|         {% if photo["width"] %} |         {% if photo["width"] %} | ||||||
|             {{photo["width"]}}x{{photo["height"]}}, |             {{photo["width"]}}x{{photo["height"]}}, | ||||||
|         {% endif %} |         {% endif %} | ||||||
|         {% if photo["duration"] %} |         {% if photo["duration"] %} | ||||||
|             {{photo["duration_str"]}}, |             {{photo["duration_str"]}}, | ||||||
|         {% endif %} |         {% endif %} | ||||||
|         {{photo["bytestring"]}} |         {{photo["bytes_str"]}} | ||||||
|         </span> |         </span> | ||||||
|         <span class="photo_galleryview_tags"> |         <span class="photo_card_grid_tags"> | ||||||
|             {% if photo["tags"] %} |             {% if photo["tags"] %} | ||||||
|             {% set tags=[] %} |             {% set tags=[] %} | ||||||
|             {% for tag in photo["tags"] %} |             {% for tag in photo["tags"] %} | ||||||
|  | @ -45,4 +58,5 @@ | ||||||
|         </span> |         </span> | ||||||
|     </div> |     </div> | ||||||
| </div> | </div> | ||||||
|  | {% endif %} | ||||||
| {% endmacro %} | {% endmacro %} | ||||||
|  | @ -1,7 +1,7 @@ | ||||||
| <!DOCTYPE html5> | <!DOCTYPE html5> | ||||||
| <html> | <html> | ||||||
| <head> | <head> | ||||||
|     {% import "photo_object.html" as photo_object %} |     {% import "photo_card.html" as photo_card %} | ||||||
|     {% import "header.html" as header %} |     {% import "header.html" as header %} | ||||||
|     <title>Search</title> |     <title>Search</title> | ||||||
|     <meta charset="UTF-8"> |     <meta charset="UTF-8"> | ||||||
|  | @ -16,7 +16,6 @@ form | ||||||
|     flex-direction: column; |     flex-direction: column; | ||||||
|     justify-content: center; |     justify-content: center; | ||||||
| } | } | ||||||
| 
 |  | ||||||
| #error_message_area | #error_message_area | ||||||
| { | { | ||||||
|     display: flex; |     display: flex; | ||||||
|  | @ -47,6 +46,11 @@ form | ||||||
|     flex: 1; |     flex: 1; | ||||||
|     width: auto; |     width: auto; | ||||||
| } | } | ||||||
|  | .prev_next_holder | ||||||
|  | { | ||||||
|  |     /* Makes div match size of content */ | ||||||
|  |     overflow: auto; | ||||||
|  | } | ||||||
| .prev_page | .prev_page | ||||||
| { | { | ||||||
|     float: left; |     float: left; | ||||||
|  | @ -215,6 +219,10 @@ form | ||||||
|                 <option value="yes"{%if search_kwargs['has_tags'] == True %}selected{%endif%}>Tagged only</option> |                 <option value="yes"{%if search_kwargs['has_tags'] == True %}selected{%endif%}>Tagged only</option> | ||||||
|                 <option value="no" {%if search_kwargs['has_tags'] == False %}selected{%endif%}>Untagged only</option> |                 <option value="no" {%if search_kwargs['has_tags'] == False %}selected{%endif%}>Untagged only</option> | ||||||
|             </select> |             </select> | ||||||
|  |             <select name="view" class="basic_param"> | ||||||
|  |                 <option value="grid" {%if search_kwargs['view'] == "grid" %}selected{%endif%}>Grid</option> | ||||||
|  |                 <option value="list" {%if search_kwargs['view'] == "list" %}selected{%endif%}>List</option> | ||||||
|  |             </select> | ||||||
|             <button type="submit" id="search_go_button" value="">Search</button> |             <button type="submit" id="search_go_button" value="">Search</button> | ||||||
|         </form> |         </form> | ||||||
|         {% if total_tags %} |         {% if total_tags %} | ||||||
|  | @ -230,7 +238,7 @@ form | ||||||
|         <p>You got {{photos|length}} items</p><br> |         <p>You got {{photos|length}} items</p><br> | ||||||
|         {{prev_next_buttons()}} |         {{prev_next_buttons()}} | ||||||
|         {% for photo in photos %} |         {% for photo in photos %} | ||||||
|         {{photo_object.galleryview(photo)}} |         {{photo_card.create_photo_card(photo, view=search_kwargs["view"])}} | ||||||
|         {% endfor %} |         {% endfor %} | ||||||
|         {{prev_next_buttons()}} |         {{prev_next_buttons()}} | ||||||
|     </div> |     </div> | ||||||
|  | @ -240,6 +248,10 @@ form | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| <script type="text/javascript"> | <script type="text/javascript"> | ||||||
|  | PARAM_DEFAULTS = { | ||||||
|  |     'limit': 50, | ||||||
|  |     'view': 'grid', | ||||||
|  | } | ||||||
| function add_searchtag(box, value, inputted_list, li_class) | function add_searchtag(box, value, inputted_list, li_class) | ||||||
| { | { | ||||||
|     /* |     /* | ||||||
|  | @ -391,6 +403,11 @@ function submit_search() | ||||||
|         var value = box.value; |         var value = box.value; | ||||||
|         value = value.split("&").join("%26"); |         value = value.split("&").join("%26"); | ||||||
|         console.log(value); |         console.log(value); | ||||||
|  |         if (PARAM_DEFAULTS[boxname] == value) | ||||||
|  |         { | ||||||
|  |             // Don't clutter url with default values. | ||||||
|  |             continue; | ||||||
|  |         } | ||||||
|         if (boxname == "has_tags" && has_tag_params && value == "no") |         if (boxname == "has_tags" && has_tag_params && value == "no") | ||||||
|         { |         { | ||||||
|             /* |             /* | ||||||
|  | @ -416,12 +433,13 @@ function submit_search() | ||||||
|         orderby_params.push(column + "-" + sorter); |         orderby_params.push(column + "-" + sorter); | ||||||
|     } |     } | ||||||
|     orderby_params = orderby_params.join(","); |     orderby_params = orderby_params.join(","); | ||||||
|     if (orderby_params) |     if (orderby_params && orderby_params != "created-desc") | ||||||
|     { |     { | ||||||
|  |         // Don't clutter url with default of created-desc | ||||||
|         parameters.push("orderby=" + orderby_params); |         parameters.push("orderby=" + orderby_params); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     if (parameters) |     if (parameters.length > 0) | ||||||
|     { |     { | ||||||
|         parameters = parameters.join("&"); |         parameters = parameters.join("&"); | ||||||
|         parameters = "?" + parameters; |         parameters = "?" + parameters; | ||||||
|  |  | ||||||
		Loading…
	
		Reference in a new issue