Make public web work for both legacy and new snapshot

This commit is contained in:
sergio_gimenez 2024-10-22 08:10:37 +02:00
parent 4c00ac8263
commit dc5671c97f
1 changed files with 173 additions and 153 deletions

View File

@ -1,14 +1,14 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>{{ title }} - {{ object.type }}</title>
<link href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap/5.1.3/css/bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.1/font/bootstrap-icons.css">
<link href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap/5.1.3/css/bootstrap.min.css" rel="stylesheet" />
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.1/font/bootstrap-icons.css" />
<style>
body {
font-size: .875rem;
font-size: 0.875rem;
background-color: #f8f9fa;
display: flex;
flex-direction: column;
@ -139,17 +139,35 @@
<h2 class="section-title mt-5">Components</h2>
<div class="row">
{% for c in object.last_evidence.doc.components %}
{% comment %}Iterates over legacy snapshot components{% endcomment %}
{% for component in object.last_evidence.doc.components %}
<div class="col-md-6 mb-3">
<div class="card component-card">
<div class="card-body">
<h5 class="card-title">{{ c.type }}</h5>
<h5 class="card-title">{{ component.type }}</h5>
<p class="card-text">
<strong>Manufacturer:</strong> {{ c.manufacturer }}<br>
<strong>Model:</strong> {{ c.model }}<br>
<strong>Serial Number:</strong> {{ c.serialNumber }}
<strong>Manufacturer:</strong> {{ component.manufacturer }}<br />
<strong>Model:</strong> {{ component.model }}<br />
<strong>Serial Number:</strong> {{ component.serialNumber }}
</p>
<small class="text-muted">{{ component.created }}</small>
</div>
</div>
</div>
{% endfor %}
{% comment %}Iterates over new snapshot components{% endcomment %}
{% for component in object.components %}
<div class="col-md-6 mb-3">
<div class="card component-card">
<div class="card-body">
<h5 class="card-title">{{ component.type }}</h5>
<p class="card-text">
{% for component_key, component_value in component.items %}
{% if component_key not in 'actions,type' %}
<strong>{{ component_key }}:</strong> {{ component_value }}<br />
{% endif %}
{% endfor %}
</p>
<small class="text-muted">{{ evidence.created }}</small>
</div>
</div>
</div>
@ -165,7 +183,9 @@
</div>
<footer>
<p>&copy; {% now "Y" %} eReuse. All rights reserved.</p>
<p>
&copy;{% now 'Y' %}eReuse. All rights reserved.
</p>
</footer>
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap/5.1.3/js/bootstrap.bundle.min.js"></script>