feature/90-implement-public-website-for-device #17
|
@ -1,4 +1,4 @@
|
|||
{% extends "base.html" %}
|
||||
{% extends 'base.html' %}
|
||||
{% load i18n %}
|
||||
|
||||
{% block content %}
|
||||
|
@ -30,13 +30,12 @@
|
|||
<button class="nav-link" data-bs-toggle="tab" data-bs-target="#evidences">Evidences</button>
|
||||
</li>
|
||||
<li class="nav-items">
|
||||
<a class="nav-link" href="">Web</a>
|
||||
<a class="nav-link" href="{% url 'device:device_web' object.id %}">Web</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="tab-content pt-2">
|
||||
|
||||
<div class="tab-pane fade show active" id="details">
|
||||
<h5 class="card-title">Details</h5>
|
||||
<div class="row mb-3">
|
||||
|
@ -53,23 +52,23 @@
|
|||
{% for k, v in object.last_user_evidence %}
|
||||
<div class="row">
|
||||
<div class="col-lg-3 col-md-4 label">{{ k }}</div>
|
||||
<div class="col-lg-9 col-md-8">{{ v|default:"" }}</div>
|
||||
<div class="col-lg-9 col-md-8">{{ v|default:'' }}</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
{% else %}
|
||||
<div class="row">
|
||||
<div class="col-lg-3 col-md-4 label">Manufacturer</div>
|
||||
<div class="col-lg-9 col-md-8">{{ object.manufacturer|default:"" }}</div>
|
||||
<div class="col-lg-9 col-md-8">{{ object.manufacturer|default:'' }}</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-3 col-md-4 label">Model</div>
|
||||
<div class="col-lg-9 col-md-8">{{ object.model|default:"" }}</div>
|
||||
<div class="col-lg-9 col-md-8">{{ object.model|default:'' }}</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-3 col-md-4 label">Serial Number</div>
|
||||
<div class="col-lg-9 col-md-8">{{ object.last_evidence.doc.device.serialNumber|default:"" }}</div>
|
||||
<div class="col-lg-9 col-md-8">{{ object.last_evidence.doc.device.serialNumber|default:'' }}</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
<div class="row">
|
||||
|
@ -77,7 +76,7 @@
|
|||
</div>
|
||||
{% for chid in object.hids %}
|
||||
<div class="row">
|
||||
<div class="col">{{ chid |default:"" }}</div>
|
||||
<div class="col">{{ chid|default:'' }}</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
@ -112,12 +111,10 @@
|
|||
<td></td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="tab-pane fade profile-overview" id="lots">
|
||||
{% for tag in lot_tags %}
|
||||
<h5 class="card-title">{{ tag }}</h5>
|
||||
|
@ -137,7 +134,6 @@
|
|||
<div class="tab-pane fade profile-overview" id="documents">
|
||||
<div class="btn-group dropdown ml-1 mt-1" uib-dropdown="">
|
||||
<a href="{% url 'device:add_document' object.pk %}" class="btn btn-primary">
|
||||
|
||||
<i class="bi bi-plus"></i>
|
||||
Add new document
|
||||
<span class="caret"></span>
|
||||
|
@ -165,7 +161,6 @@
|
|||
<td></td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
@ -184,8 +179,7 @@
|
|||
{{ c.model }}<br />
|
||||
{{ c.serialNumber }}<br />
|
||||
</p>
|
||||
<small class="text-muted">
|
||||
</small>
|
||||
<small class="text-muted"></small>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
@ -203,8 +197,7 @@
|
|||
<p class="mb-1">
|
||||
<a href="{% url 'evidence:details' snap.uuid %}">{{ snap.uuid }}</a>
|
||||
</p>
|
||||
<small class="text-muted">
|
||||
</small>
|
||||
<small class="text-muted"></small>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
|
|
@ -0,0 +1,81 @@
|
|||
{% extends 'base.html' %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
<h1>{{ title }}</h1>
|
||||
|
||||
<h5 class="card-title">Details</h5>
|
||||
<div class="row mb-3">
|
||||
<div class="col-lg-3 col-md-4 label">Phid</div>
|
||||
<div class="col-lg-9 col-md-8">{{ object.id }}</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-3 col-md-4 label">Type</div>
|
||||
<div class="col-lg-9 col-md-8">{{ object.type }}</div>
|
||||
</div>
|
||||
|
||||
{% if object.is_websnapshot %}
|
||||
{% for k, v in object.last_user_evidence %}
|
||||
<div class="row">
|
||||
<div class="col-lg-3 col-md-4 label">{{ k }}</div>
|
||||
<div class="col-lg-9 col-md-8">{{ v|default:'' }}</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
{% else %}
|
||||
<div class="row">
|
||||
<div class="col-lg-3 col-md-4 label">Manufacturer</div>
|
||||
<div class="col-lg-9 col-md-8">{{ object.manufacturer|default:'' }}</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-3 col-md-4 label">Model</div>
|
||||
<div class="col-lg-9 col-md-8">{{ object.model|default:'' }}</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-3 col-md-4 label">Serial Number</div>
|
||||
<div class="col-lg-9 col-md-8">{{ object.last_evidence.doc.device.serialNumber|default:'' }}</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
<div class="row">
|
||||
<div class="col-lg-3 col-md-4 label">Identifiers</div>
|
||||
</div>
|
||||
{% for chid in object.hids %}
|
||||
<div class="row">
|
||||
<div class="col">{{ chid|default:'' }}</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
|
||||
|
||||
{% comment %} <h2>User Anotations</h2> {% endcomment %}
|
||||
|
||||
<h2>Components</h2>
|
||||
<ul>
|
||||
{% for c in object.last_evidence.doc.components %}
|
||||
<div class="list-group-item">
|
||||
<div class="d-flex w-100 justify-content-between">
|
||||
<h5 class="mb-1">{{ c.type }}</h5>
|
||||
<small class="text-muted">{{ evidence.created }}</small>
|
||||
</div>
|
||||
<p class="mb-1">
|
||||
{{ c.manufacturer }}<br />
|
||||
{{ c.model }}<br />
|
||||
{{ c.serialNumber }}<br />
|
||||
</p>
|
||||
<small class="text-muted"></small>
|
||||
</div>
|
||||
{% endfor %}
|
||||
|
||||
|
||||
|
||||
<h2>Last Evidence Snapshot</h2>
|
||||
<p>{{ snapshot }}</p>
|
||||
|
||||
{% comment %} <h2>Lot Tags</h2>
|
||||
<ul>
|
||||
{% for tag in lot_tags %}
|
||||
<li>{{ tag.name }}</li>
|
||||
{% endfor %}
|
||||
</ul> {% endcomment %}
|
||||
{% endblock %}
|
|
@ -9,4 +9,6 @@ urlpatterns = [
|
|||
path("<str:pk>/", views.DetailsView.as_view(), name="details"),
|
||||
path("<str:pk>/annotation/add", views.AddAnnotationView.as_view(), name="add_annotation"),
|
||||
path("<str:pk>/document/add", views.AddDocumentView.as_view(), name="add_document"),
|
||||
path("<str:pk>/web/", views.DeviceWebView.as_view(), name="device_web"),
|
||||
|
||||
]
|
||||
|
|
|
@ -101,6 +101,29 @@ class DetailsView(DashboardView, TemplateView):
|
|||
return context
|
||||
|
||||
|
||||
class DeviceWebView(DashboardView, TemplateView):
|
||||
template_name = "device_web.html"
|
||||
title = _("Device Web")
|
||||
breadcrumb = "Device / Web"
|
||||
model = Annotation
|
||||
|
||||
def get(self, request, *args, **kwargs):
|
||||
self.pk = kwargs['pk']
|
||||
self.object = Device(id=self.pk)
|
||||
return super().get(request, *args, **kwargs)
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
context = super().get_context_data(**kwargs)
|
||||
self.object.initial()
|
||||
lot_tags = LotTag.objects.filter(owner=self.request.user.institution)
|
||||
context.update({
|
||||
'object': self.object,
|
||||
'snapshot': self.object.get_last_evidence(),
|
||||
'lot_tags': lot_tags,
|
||||
})
|
||||
return context
|
||||
|
||||
|
||||
class AddAnnotationView(DashboardView, CreateView):
|
||||
template_name = "new_annotation.html"
|
||||
title = _("New annotation")
|
||||
|
|
Loading…
Reference in New Issue