From 9953ac0dc159122173a582ef428943d44d5fbd4d Mon Sep 17 00:00:00 2001 From: FreneticScribbler Date: Wed, 18 Dec 2019 13:16:54 +0000 Subject: [PATCH] FIX: Asset history table 'branding' --- assets/templates/asset_activity_table.html | 92 +++++++++++++++++++++ assets/templates/asset_version_history.html | 68 +++++++++++++++ assets/views.py | 13 ++- 3 files changed, 171 insertions(+), 2 deletions(-) create mode 100644 assets/templates/asset_activity_table.html create mode 100644 assets/templates/asset_version_history.html diff --git a/assets/templates/asset_activity_table.html b/assets/templates/asset_activity_table.html new file mode 100644 index 00000000..166a4417 --- /dev/null +++ b/assets/templates/asset_activity_table.html @@ -0,0 +1,92 @@ +{% extends request.is_ajax|yesno:"base_ajax.html,base_assets.html" %} +{% load static %} +{% load paginator from filters %} +{% load to_class_name from filters %} + +{% block title %}Asset Activity Stream{% endblock %} + +{# TODO: Find a way to reduce code duplication...can't just include the content because of the IDs... #} + +{% block js %} + + + + +{% endblock %} + +{% block content %} +
+
+
+

Asset Activity Stream

+
+
{% paginator %}
+
+
+ + + + + + + + + + + + + + {% for version in object_list %} + + + + + + + + + + + {% endfor %} + + +
DateObjectVersion IDUserChangesComment
{{ version.revision.date_created }}{{version.changes.new|to_class_name}} {{ version.changes.new.asset_id }}{{ version.pk }}|{{ version.revision.pk }}{{ version.revision.user.name }} + {% if version.changes.old == None %} + {{version.changes.new|to_class_name}} Created + {% else %} + {% include 'RIGS/version_changes.html' %} + {% endif %} {{ version.changes.revision.comment }}
+ +
+
{% paginator %}
+
+{% endblock %} diff --git a/assets/templates/asset_version_history.html b/assets/templates/asset_version_history.html new file mode 100644 index 00000000..cefcd5d0 --- /dev/null +++ b/assets/templates/asset_version_history.html @@ -0,0 +1,68 @@ +{% extends request.is_ajax|yesno:"base_ajax.html,base_assets.html" %} +{% load to_class_name from filters %} +{% load paginator from filters %} +{% load static %} + +{% block title %}{{object|to_class_name}} {{ object.asset_id }} - Revision History{% endblock %} + +{% block js %} + + + +{% endblock %} + +{% block content %} +
+
+ +
{% paginator %}
+
+
+ + + + + + + + + + + + {% for version in object_list %} + + + + + + + + + + + {% endfor %} + + +
DateVersion IDUserChangesComment
{{ version.revision.date_created }}{{ version.pk }}|{{ version.revision.pk }}{{ version.revision.user.name }} + {% if version.changes.old is None %} + {{object|to_class_name}} Created + {% else %} + {% include 'RIGS/version_changes.html' %} + {% endif %} + + {{ version.revision.comment }} +
+
+
{% paginator %}
+
+{% endblock %} diff --git a/assets/views.py b/assets/views.py index 879be3ce..731f6c36 100644 --- a/assets/views.py +++ b/assets/views.py @@ -208,7 +208,16 @@ class SupplierUpdate(generic.UpdateView): template_name = 'supplier_update.html' -class AssetVersionHistory(AssetIDUrlMixin, versioning.VersionHistory): +class AssetVersionHistory(versioning.VersionHistory): + template_name = "asset_version_history.html" + + def get_queryset(self, **kwargs): + thisModel = self.kwargs['model'] + + versions = versioning.RIGSVersion.objects.all() + + return versions + def get_context_data(self, **kwargs): thisModel = self.kwargs['model'] context = super(versioning.VersionHistory, self).get_context_data(**kwargs) @@ -225,7 +234,7 @@ class AssetVersionHistory(AssetIDUrlMixin, versioning.VersionHistory): class ActivityTable(generic.ListView): model = versioning.RIGSVersion - template_name = "RIGS/activity_table.html" + template_name = "asset_activity_table.html" paginate_by = 25 def get_queryset(self):