mirror of
				https://github.com/arcan1s/ahriman.git
				synced 2025-10-31 05:43:41 +00:00 
			
		
		
		
	better templating
This commit is contained in:
		| @ -3,118 +3,20 @@ | ||||
|     <head> | ||||
|         <title>{{ repository|e }}</title> | ||||
|  | ||||
|         <style> | ||||
|             :root { | ||||
|                 --color-building: 250, 255, 146; | ||||
|                 --color-failed: 255, 94, 94; | ||||
|                 --color-pending: 250, 255, 146; | ||||
|                 --color-success: 121, 255, 94; | ||||
|                 --color-unknown: 197, 197, 197; | ||||
|             } | ||||
|  | ||||
|             @keyframes blink-building { | ||||
|                 0% { background-color: rgba(var(--color-building), 1.0); } | ||||
|                 10% { background-color: rgba(var(--color-building), 0.9); } | ||||
|                 20% { background-color: rgba(var(--color-building), 0.8); } | ||||
|                 30% { background-color: rgba(var(--color-building), 0.7); } | ||||
|                 40% { background-color: rgba(var(--color-building), 0.6); } | ||||
|                 50% { background-color: rgba(var(--color-building), 0.5); } | ||||
|                 60% { background-color: rgba(var(--color-building), 0.4); } | ||||
|                 70% { background-color: rgba(var(--color-building), 0.3); } | ||||
|                 80% { background-color: rgba(var(--color-building), 0.2); } | ||||
|                 90% { background-color: rgba(var(--color-building), 0.1); } | ||||
|                 100% { background-color: rgba(var(--color-building), 0.0); } | ||||
|             } | ||||
|  | ||||
|             div.root { | ||||
|                 width: 70%; | ||||
|                 padding: 15px 15% 0; | ||||
|             } | ||||
|  | ||||
|             section.element { | ||||
|                 width: 100%; | ||||
|             } | ||||
|  | ||||
|             input, table { | ||||
|                 width: inherit; | ||||
|                 padding: 10px 0; | ||||
|             } | ||||
|  | ||||
|             th, td { | ||||
|                 padding: 5px; | ||||
|             } | ||||
|  | ||||
|             tr.package:nth-child(odd) { | ||||
|                 background-color: rgba(255, 255, 255, 1); | ||||
|             } | ||||
|  | ||||
|             tr.package:nth-child(even) { | ||||
|                 background-color: rgba(235, 235, 255, 1); | ||||
|             } | ||||
|  | ||||
|             tr.header, tr.package:hover { | ||||
|                 background-color: rgba(200, 200, 255, 1); | ||||
|             } | ||||
|  | ||||
|             td.package-unknown { | ||||
|                 background-color: rgba(var(--color-unknown), 1.0); | ||||
|             } | ||||
|             td.package-pending { | ||||
|                 background-color: rgba(var(--color-pending), 1.0); | ||||
|             } | ||||
|             td.package-building { | ||||
|                 background-color: rgba(var(--color-building), 1.0); | ||||
|                 animation-name: blink-building; | ||||
|                 animation-duration: 1s; | ||||
|                 animation-timing-function: linear; | ||||
|                 animation-iteration-count: infinite; | ||||
|                 animation-direction: alternate; | ||||
|             } | ||||
|             td.package-failed { | ||||
|                 background-color: rgba(var(--color-failed), 1.0); | ||||
|             } | ||||
|             td.package-success { | ||||
|                 background-color: rgba(var(--color-success), 1.0); | ||||
|             } | ||||
|         </style> | ||||
|  | ||||
|         <script src="https://www.kryogenix.org/code/browser/sorttable/sorttable.js"></script> | ||||
|         <script type="text/javascript"> | ||||
|             function searchInTable() { | ||||
|                 const input = document.getElementById("search"); | ||||
|                 const filter = input.value.toLowerCase(); | ||||
|                 const table = document.getElementById("builds"); | ||||
|                 const tr = table.getElementsByTagName("tr"); | ||||
|  | ||||
|                 // from 1 coz of header | ||||
|                 for (var i = 1; i < tr.length; i++) { | ||||
|                     let td = tr[i].getElementsByClassName("include-search"); | ||||
|                     let display = "none"; | ||||
|                     for (var j = 0; j < td.length; j++) { | ||||
|                         if (td[j].tagName.toLowerCase() === "td") { | ||||
|                             if (td[j].innerHTML.toLowerCase().indexOf(filter) > -1) { | ||||
|                                 display = ""; | ||||
|                                 break; | ||||
|                             } | ||||
|                         } | ||||
|                     } | ||||
|                     tr[i].style.display = display; | ||||
|                 } | ||||
|             } | ||||
|         </script> | ||||
|         {% include "style.jinja2" %} | ||||
|  | ||||
|         {% include "sorttable.jinja2" %} | ||||
|         {% include "search.jinja2" %} | ||||
|     </head> | ||||
|  | ||||
|     <body> | ||||
|         <div class="root"> | ||||
|             <h1>ahriman {{ version|e }}</h1> | ||||
|  | ||||
|             <section class="element"> | ||||
|                 <input type="search" id="search" onkeyup="searchInTable()" placeholder="search for package" title="search for package"/> | ||||
|             </section> | ||||
|             {% include "search-line.jinja2" %} | ||||
|  | ||||
|             <section class="element"> | ||||
|                 <table class="sortable" id="builds"> | ||||
|                 <table class="sortable search-table"> | ||||
|                     <tr class="header"> | ||||
|                         <th>package base</th> | ||||
|                         <th>packages</th> | ||||
| @ -126,7 +28,7 @@ | ||||
|  | ||||
|                     {% for package in packages %} | ||||
|                         <tr class="package"> | ||||
|                             <td class="package include-search"><a href="{{ package.web_url|e }}" title="{{ package.base|e }}">{{ package.base|e }}</a></td> | ||||
|                             <td class="include-search"><a href="{{ package.web_url|e }}" title="{{ package.base|e }}">{{ package.base|e }}</a></td> | ||||
|                             <td class="include-search">{{ package.packages|join("<br>"|safe) }}</td> | ||||
|                             <td>{{ package.version|e }}</td> | ||||
|                             <td>{{ architecture|e }}</td> | ||||
|  | ||||
| @ -2,31 +2,53 @@ | ||||
| <html lang="en"> | ||||
|     <head> | ||||
|         <title>{{ repository|e }}</title> | ||||
|  | ||||
|         {% include "style.jinja2" %} | ||||
|  | ||||
|         {% include "sorttable.jinja2" %} | ||||
|         {% include "search.jinja2" %} | ||||
|     </head> | ||||
|  | ||||
|     <body> | ||||
|         <h1>Archlinux custom repository</h1> | ||||
|         <div class="root"> | ||||
|             <h1>Archlinux user repository</h1> | ||||
|  | ||||
|         {% if pgp_key is not none %} | ||||
|             <p>This repository is signed with <a href="http://keys.gnupg.net/pks/lookup?search=0x{{ pgp_key|e }}" title="key search">{{ pgp_key|e }}</a>.</p> | ||||
|         {% endif %} | ||||
|             <section class="element"> | ||||
|                 {% if pgp_key is not none %} | ||||
|                     <p>This repository is signed with <a href="http://keys.gnupg.net/pks/lookup?search=0x{{ pgp_key|e }}&fingerprint=on&op=index" title="key search">{{ pgp_key|e }}</a> by default.</p> | ||||
|                 {% endif %} | ||||
|  | ||||
|         <code> | ||||
|             $ cat /etc/pacman.conf<br> | ||||
|             [{{ repository|e }}]<br> | ||||
|             Server = {{ link_path|e }}<br> | ||||
|             SigLevel = Database{% if has_repo_signed %}Required{% else %}Never{% endif %} Package{% if has_package_signed %}Required{% else %}Never{% endif %} TrustedOnly | ||||
|         </code> | ||||
|                 <code> | ||||
|                     $ cat /etc/pacman.conf<br> | ||||
|                     [{{ repository|e }}]<br> | ||||
|                     Server = {{ link_path|e }}<br> | ||||
|                     SigLevel = Database{% if has_repo_signed %}Required{% else %}Never{% endif %} Package{% if has_package_signed %}Required{% else %}Never{% endif %} TrustedOnly | ||||
|                 </code> | ||||
|             </section> | ||||
|  | ||||
|         <p>Packages:</p> | ||||
|         <ul> | ||||
|             {% for package, package_url in packages.items() %} | ||||
|                 <li><a href="{{ package_url|e }}" title="{{ package|e }}">{{ package|e }}</a></li> | ||||
|             {% endfor %} | ||||
|         </ul> | ||||
|             {% include "search-line.jinja2" %} | ||||
|  | ||||
|         {% if homepage is not none %} | ||||
|             <footer><a href="{{ homepage|e }}" title="homepage">Homepage</a></footer> | ||||
|         {% endif %} | ||||
|             <section class="element"> | ||||
|                 <table class="sortable search-table"> | ||||
|                     <tr class="header"> | ||||
|                         <th>package</th> | ||||
|                         <th>version</th> | ||||
|                         <th>architecture</th> | ||||
|                     </tr> | ||||
|  | ||||
|                     {% for package in packages %} | ||||
|                         <tr class="package"> | ||||
|                             <td class="include-search"><a href="{{ link_path|e }}/{{ package.filename|e }}" title="{{ package.name|e }}">{{ package.name|e }}</a></td> | ||||
|                             <td>{{ package.version|e }}</td> | ||||
|                             <td>{{ architecture|e }}</td> | ||||
|                         </tr> | ||||
|                     {% endfor %} | ||||
|                 </table> | ||||
|             </section> | ||||
|  | ||||
|             {% if homepage is not none %} | ||||
|                 <footer><a href="{{ homepage|e }}" title="homepage">Homepage</a></footer> | ||||
|             {% endif %} | ||||
|         </div> | ||||
|     </body> | ||||
| </html> | ||||
|  | ||||
							
								
								
									
										3
									
								
								package/share/ahriman/search-line.jinja2
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								package/share/ahriman/search-line.jinja2
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,3 @@ | ||||
| <section class="element"> | ||||
|     <input type="search" id="search" onkeyup="searchInTable()" placeholder="search for package" title="search for package"/> | ||||
| </section> | ||||
							
								
								
									
										25
									
								
								package/share/ahriman/search.jinja2
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										25
									
								
								package/share/ahriman/search.jinja2
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,25 @@ | ||||
| <script type="text/javascript"> | ||||
|     function searchInTable() { | ||||
|         const input = document.getElementById("search"); | ||||
|         const filter = input.value.toLowerCase(); | ||||
|         const tables = document.getElementsByClassName("search-table"); | ||||
|  | ||||
|         for (let i = 0; i < tables.length; i++) { | ||||
|             const tr = tables[i].getElementsByTagName("tr"); | ||||
|             // from 1 coz of header | ||||
|             for (let i = 1; i < tr.length; i++) { | ||||
|                 let td = tr[i].getElementsByClassName("include-search"); | ||||
|                 let display = "none"; | ||||
|                 for (let j = 0; j < td.length; j++) { | ||||
|                     if (td[j].tagName.toLowerCase() === "td") { | ||||
|                         if (td[j].innerHTML.toLowerCase().indexOf(filter) > -1) { | ||||
|                             display = ""; | ||||
|                             break; | ||||
|                         } | ||||
|                     } | ||||
|                 } | ||||
|                 tr[i].style.display = display; | ||||
|             } | ||||
|         } | ||||
|     } | ||||
| </script> | ||||
							
								
								
									
										1
									
								
								package/share/ahriman/sorttable.jinja2
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								package/share/ahriman/sorttable.jinja2
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1 @@ | ||||
| <script src="https://www.kryogenix.org/code/browser/sorttable/sorttable.js"></script> | ||||
							
								
								
									
										74
									
								
								package/share/ahriman/style.jinja2
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										74
									
								
								package/share/ahriman/style.jinja2
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,74 @@ | ||||
| <style> | ||||
|     :root { | ||||
|         --color-building: 250, 255, 146; | ||||
|         --color-failed: 255, 94, 94; | ||||
|         --color-pending: 250, 255, 146; | ||||
|         --color-success: 121, 255, 94; | ||||
|         --color-unknown: 197, 197, 197; | ||||
|     } | ||||
|  | ||||
|     @keyframes blink-building { | ||||
|         0% { background-color: rgba(var(--color-building), 1.0); } | ||||
|         10% { background-color: rgba(var(--color-building), 0.9); } | ||||
|         20% { background-color: rgba(var(--color-building), 0.8); } | ||||
|         30% { background-color: rgba(var(--color-building), 0.7); } | ||||
|         40% { background-color: rgba(var(--color-building), 0.6); } | ||||
|         50% { background-color: rgba(var(--color-building), 0.5); } | ||||
|         60% { background-color: rgba(var(--color-building), 0.4); } | ||||
|         70% { background-color: rgba(var(--color-building), 0.3); } | ||||
|         80% { background-color: rgba(var(--color-building), 0.2); } | ||||
|         90% { background-color: rgba(var(--color-building), 0.1); } | ||||
|         100% { background-color: rgba(var(--color-building), 0.0); } | ||||
|     } | ||||
|  | ||||
|     div.root { | ||||
|         width: 70%; | ||||
|         padding: 15px 15% 0; | ||||
|     } | ||||
|  | ||||
|     section.element { | ||||
|         width: 100%; | ||||
|         padding: 10px 0; | ||||
|     } | ||||
|  | ||||
|     code, input, table { | ||||
|         width: inherit; | ||||
|     } | ||||
|  | ||||
|     th, td { | ||||
|         padding: 5px; | ||||
|     } | ||||
|  | ||||
|     tr.package:nth-child(odd) { | ||||
|         background-color: rgba(255, 255, 255, 1); | ||||
|     } | ||||
|  | ||||
|     tr.package:nth-child(even) { | ||||
|         background-color: rgba(235, 235, 255, 1); | ||||
|     } | ||||
|  | ||||
|     tr.header, tr.package:hover { | ||||
|         background-color: rgba(200, 200, 255, 1); | ||||
|     } | ||||
|  | ||||
|     td.package-unknown { | ||||
|         background-color: rgba(var(--color-unknown), 1.0); | ||||
|     } | ||||
|     td.package-pending { | ||||
|         background-color: rgba(var(--color-pending), 1.0); | ||||
|     } | ||||
|     td.package-building { | ||||
|         background-color: rgba(var(--color-building), 1.0); | ||||
|         animation-name: blink-building; | ||||
|         animation-duration: 1s; | ||||
|         animation-timing-function: linear; | ||||
|         animation-iteration-count: infinite; | ||||
|         animation-direction: alternate; | ||||
|     } | ||||
|     td.package-failed { | ||||
|         background-color: rgba(var(--color-failed), 1.0); | ||||
|     } | ||||
|     td.package-success { | ||||
|         background-color: rgba(var(--color-success), 1.0); | ||||
|     } | ||||
| </style> | ||||
		Reference in New Issue
	
	Block a user