diff --git a/admin/templates/admin_users.html b/admin/templates/admin_users.html index 37fbf96..92bcf7a 100644 --- a/admin/templates/admin_users.html +++ b/admin/templates/admin_users.html @@ -1,15 +1,18 @@ {% extends "base.html" %} {% load i18n %} +{% block actions %} + + + + {% translate "New user" %} + +{% endblock %} + + {% block content %} -
-
-

{{ subtitle }}

-
-
- {% translate "Add new user" %} -
-
+

{{ subtitle }}

+
diff --git a/dashboard/static/css/dashboard.css b/dashboard/static/css/dashboard.css index 7f2f108..6033408 100644 --- a/dashboard/static/css/dashboard.css +++ b/dashboard/static/css/dashboard.css @@ -174,3 +174,15 @@ h3 { .btn-orange { background-color: #f5b587; } + +/* Clase para botones con funcionalidad no implementados */ +.btn-todo { + background-color: #6c757d; + color: #fff; /* texto en blanco*/ + opacity: 0.65; + cursor: not-allowed; + +.btn-todo:disabled { + pointer-events: none; + } +} diff --git a/dashboard/templates/base.html b/dashboard/templates/base.html index 40e6658..591cbbc 100644 --- a/dashboard/templates/base.html +++ b/dashboard/templates/base.html @@ -63,15 +63,23 @@ - +
+ {% block actions %} + {% endblock %} +
{% block content %} {% endblock content %} @@ -218,6 +230,15 @@ + + + {% block extrascript %}{% endblock %} {% endblock %} diff --git a/dashboard/templates/unassigned_devices.html b/dashboard/templates/unassigned_devices.html index d54e450..303bb82 100644 --- a/dashboard/templates/unassigned_devices.html +++ b/dashboard/templates/unassigned_devices.html @@ -2,31 +2,28 @@ {% load i18n %} {% load paginacion %} - -{% block content %} -
-
-

{{ subtitle }}

-
-
+{% block actions %} {% if lot %} {% trans 'Documents' %} {% endif %} - + {% trans 'Exports' %} {% if lot %} - + {% trans 'Annotations' %} {% endif %} -
-
+ +{% endblock%} + +{% block content %} +

{{ subtitle }}

@@ -79,7 +76,7 @@ {% endfor %} - +
diff --git a/device/templates/details.html b/device/templates/details.html index c5934cd..38af77e 100644 --- a/device/templates/details.html +++ b/device/templates/details.html @@ -241,7 +241,7 @@ {% for snap in object.evidences %} - {{ snap.uuid }} + {{ snap.uuid|truncatechars:7|upper }} {% if snap.did_document %} diff --git a/evidence/templates/ev_details.html b/evidence/templates/ev_details.html index 563ca92..4200fe4 100644 --- a/evidence/templates/ev_details.html +++ b/evidence/templates/ev_details.html @@ -1,5 +1,13 @@ {% extends "base.html" %} {% load i18n %} +{% block actions %} + + + {% trans "Download File" %} + + + +{% endblock %} {% block content %}
@@ -8,20 +16,57 @@
+{% load django_bootstrap5 %} +
+ {% csrf_token %} + + {% if form2.errors %} + + {% endif %} + + +
+ + + +
+ + +
+
@@ -35,26 +80,28 @@ - {% trans "Type" %} + {% trans "Algorithm" %} - {% trans "Identificator" %} + {% trans "Device ID" %} - {% trans "Data" %} + {% trans "Date" %} {% for snap in object.annotations %} - + {% if snap.type == 0 %} + {{ snap.key }} - {{ snap.value }} + {{ snap.value|truncatechars:7|upper }} + {{ dev.shortid }} @@ -69,6 +116,7 @@
+
{% load django_bootstrap5 %}
@@ -90,7 +138,7 @@
{% if form.tag.value %}
@@ -103,6 +151,7 @@
+ {% endblock %} {% block extrascript %} diff --git a/evidence/templates/ev_eraseserver.html b/evidence/templates/ev_eraseserver.html deleted file mode 100644 index db7faaf..0000000 --- a/evidence/templates/ev_eraseserver.html +++ /dev/null @@ -1,61 +0,0 @@ -{% extends "base.html" %} -{% load i18n %} - -{% block content %} -
-
-

{{ object.id }}

-
-
- -
-
- -
-
-
- -
- - {% load django_bootstrap5 %} -
-
- {% csrf_token %} - {% if form.errors %} - - {% endif %} - {% bootstrap_form form %} -
- -
-
-
-
-
-{% endblock %} diff --git a/evidence/urls.py b/evidence/urls.py index 9a4e2a2..87ccdd5 100644 --- a/evidence/urls.py +++ b/evidence/urls.py @@ -18,7 +18,6 @@ urlpatterns = [ path("upload", views.UploadView.as_view(), name="upload"), path("import", views.ImportView.as_view(), name="import"), path("", views.EvidenceView.as_view(), name="details"), - path("/eraseserver", views.EraseServerView.as_view(), name="erase_server"), path("/download", views.DownloadEvidenceView.as_view(), name="download"), path('annotation//del', views.AnnotationDeleteView.as_view(), name='delete_annotation'), ] diff --git a/evidence/views.py b/evidence/views.py index c2868b2..f38ee7e 100644 --- a/evidence/views.py +++ b/evidence/views.py @@ -102,6 +102,7 @@ class EvidenceView(DashboardView, FormView): context = super().get_context_data(**kwargs) context.update({ 'object': self.object, + 'form2': EraseServerForm(**self.get_form_kwargs(), data=self.request.POST or None), }) return context @@ -112,6 +113,23 @@ class EvidenceView(DashboardView, FormView): kwargs['user'] = self.request.user return kwargs + def post(self, request, *args, **kwargs): + form1 = self.get_form() + #Empty param @initial makes it work, but i doubt it is the correct logic + form2 = EraseServerForm(request.POST, user=self.request.user, initial={}, uuid=self.kwargs.get('pk')) + + if "submit_form1" in request.POST and form1.is_valid(): + return self.form_valid(form1) + elif "submit_form2" in request.POST and form2.is_valid(): + return self.form2_valid(form2) + + return self.form_invalid(form1, form2) + + def form2_valid(self, form): + form.save(self.request.user) + response = super().form_valid(form) + return response + def form_valid(self, form): form.save(self.request.user) response = super().form_valid(form) @@ -166,48 +184,3 @@ class AnnotationDeleteView(DashboardView, DeleteView): return redirect(url_name, **kwargs_view) - - -class EraseServerView(DashboardView, FormView): - template_name = "ev_eraseserver.html" - section = "evidences" - title = _("Evidences") - breadcrumb = "Evidences / Details" - success_url = reverse_lazy('evidence:list') - form_class = EraseServerForm - - def get(self, request, *args, **kwargs): - self.pk = kwargs['pk'] - self.object = Evidence(self.pk) - if self.object.owner != self.request.user.institution: - raise Http403 - - self.object.get_annotations() - return super().get(request, *args, **kwargs) - - def get_context_data(self, **kwargs): - context = super().get_context_data(**kwargs) - context.update({ - 'object': self.object, - }) - return context - - def get_form_kwargs(self): - self.pk = self.kwargs.get('pk') - kwargs = super().get_form_kwargs() - kwargs['uuid'] = self.pk - kwargs['user'] = self.request.user - return kwargs - - def form_valid(self, form): - form.save(self.request.user) - response = super().form_valid(form) - return response - - def form_invalid(self, form): - response = super().form_invalid(form) - return response - - def get_success_url(self): - success_url = reverse_lazy('evidence:details', args=[self.pk]) - return success_url diff --git a/lot/templates/lots.html b/lot/templates/lots.html index 2aa866d..23c3d83 100644 --- a/lot/templates/lots.html +++ b/lot/templates/lots.html @@ -1,28 +1,29 @@ {% extends "base.html" %} {% load i18n %} -{% block content %} -
-
-

{{ subtitle }}

-
- -
+{% endblock %} + +{% block content %} +