From d216dd4c74a289e80668c550dd46e7b48bc696f3 Mon Sep 17 00:00:00 2001 From: FreneticScribbler Date: Mon, 6 Apr 2020 03:15:43 +0100 Subject: [PATCH] Versioning template improvements //TODO Rather than have seperate asset templates, convert 'id' into a template variable --- assets/templates/asset_detail.html | 2 +- assets/templates/asset_list.html | 13 ++-- versioning/templates/activity_table.html | 45 ++---------- .../templates/asset_activity_table.html | 69 ++----------------- .../templates/asset_version_history.html | 58 ++-------------- .../partials/activity_table_body.html | 37 ++++++++++ .../templates/partials/last_edited_asset.html | 5 ++ .../partials/version_history_table.html | 29 ++++++++ versioning/templates/version_history.html | 36 +--------- versioning/templates/version_scripts.html | 13 ++-- 10 files changed, 96 insertions(+), 211 deletions(-) create mode 100644 versioning/templates/partials/activity_table_body.html create mode 100644 versioning/templates/partials/last_edited_asset.html create mode 100644 versioning/templates/partials/version_history_table.html diff --git a/assets/templates/asset_detail.html b/assets/templates/asset_detail.html index 34d47af9..798ab68e 100644 --- a/assets/templates/asset_detail.html +++ b/assets/templates/asset_detail.html @@ -30,5 +30,5 @@
{% include 'partials/asset_buttons.html' %}
-{% include 'partials/last_edited.html' with target="asset_history" %} +{% include 'partials/last_edited_asset.html' with target="asset_history" %} {% endblock %} diff --git a/assets/templates/asset_list.html b/assets/templates/asset_list.html index 480421cd..687e6339 100644 --- a/assets/templates/asset_list.html +++ b/assets/templates/asset_list.html @@ -15,11 +15,8 @@ {% endblock %} {% block content %} - - -
+

Asset List

+
{% render_field form.query|add_class:'form-control' placeholder='Search by Asset ID/Desc/Serial' style="width: 250px"%} @@ -27,14 +24,14 @@
-
+
- {% render_field form.category|attr:'multiple'|add_class:'form-control custom-select selectpicker col-xs' data-none-selected-text="Categories" data-header="Categories" data-actions-box="true" %} + {% render_field form.category|attr:'multiple'|add_class:'form-control custom-select selectpicker col-sm' data-none-selected-text="Categories" data-header="Categories" data-actions-box="true" %}
- {% render_field form.status|attr:'multiple'|add_class:'form-control custom-select selectpicker col-xs' data-none-selected-text="Statuses" data-header="Statuses" data-actions-box="true" %} + {% render_field form.status|attr:'multiple'|add_class:'form-control custom-select selectpicker col-sm' data-none-selected-text="Statuses" data-header="Statuses" data-actions-box="true" %}
diff --git a/versioning/templates/activity_table.html b/versioning/templates/activity_table.html index ab0262bc..d63e5329 100644 --- a/versioning/templates/activity_table.html +++ b/versioning/templates/activity_table.html @@ -10,45 +10,8 @@ {% block content %}
-
-
-

Rigboard Activity Stream

-
-
- {% paginator %} -
- - - - - - - - - - - - {% for version in object_list %} - - - - - - - - - - {% endfor %} - -
DateObjectVersion IDUserChanges
{{ version.revision.date_created }}{{version.changes.new|to_class_name}} {{ version.changes.new.pk|stringformat:"05d" }}{{ version.pk }}|{{ version.revision.pk }}{{ version.revision.user.name }} - {% if version.changes.old == None %} - {{version.changes.new|to_class_name}} Created - {% else %} - {% include 'version_changes.html' %} - {% endif %} -
- -
- {% paginator %} -
+

Rigboard Activity Stream

+ {% include 'partials/activity_table_body.html' %} + {% paginator %} +
{% endblock %} diff --git a/versioning/templates/asset_activity_table.html b/versioning/templates/asset_activity_table.html index d9c43541..ed937234 100644 --- a/versioning/templates/asset_activity_table.html +++ b/versioning/templates/asset_activity_table.html @@ -1,76 +1,17 @@ {% 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 %} - - - - +{% include 'version_scripts.html' %} {% 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|default:version.changes.new.pk }}{{ 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 %}
-
+

Asset Activity Stream

+ {% include 'partials/activity_table_body.html' %} +
{% paginator %}
+ {% endblock %} diff --git a/versioning/templates/asset_version_history.html b/versioning/templates/asset_version_history.html index 89223294..2ab68f78 100644 --- a/versioning/templates/asset_version_history.html +++ b/versioning/templates/asset_version_history.html @@ -6,63 +6,13 @@ {% block title %}{{object|to_class_name}} {{ object.asset_id }} - Revision History{% endblock %} {% block js %} - - - +{% include 'version_scripts.html' %} {% 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 %}
+

{{object|to_class_name}} {{ object.asset_id|default:object.pk }} - Revision History

+ {% include 'partials/version_history_table.html' %} +
{% paginator %}
{% endblock %} diff --git a/versioning/templates/partials/activity_table_body.html b/versioning/templates/partials/activity_table_body.html new file mode 100644 index 00000000..751c7b69 --- /dev/null +++ b/versioning/templates/partials/activity_table_body.html @@ -0,0 +1,37 @@ +{% load to_class_name from filters %} +
+ + + + + + + + + + + + {% for version in object_list %} + + + + + + + + {% endfor %} + +
DateObjectVersion IDUserChanges
{{ version.revision.date_created }}{{version.changes.new|to_class_name}} + {% if version.changes.new.asset_id %} + {{ version.changes.new.asset_id }} + {% else %} + {{ version.changes.new.pk|stringformat:"05d" }} + {% endif %} + {{ version.pk }}|{{ version.revision.pk }}{{ version.revision.user.name|default:"System" }} + {% if version.changes.old == None %} + {{version.changes.new|to_class_name}} Created + {% else %} + {% include 'version_changes.html' %} + {% endif %} +
+
diff --git a/versioning/templates/partials/last_edited_asset.html b/versioning/templates/partials/last_edited_asset.html new file mode 100644 index 00000000..c1489e65 --- /dev/null +++ b/versioning/templates/partials/last_edited_asset.html @@ -0,0 +1,5 @@ + diff --git a/versioning/templates/partials/version_history_table.html b/versioning/templates/partials/version_history_table.html new file mode 100644 index 00000000..96fe6780 --- /dev/null +++ b/versioning/templates/partials/version_history_table.html @@ -0,0 +1,29 @@ +{% load to_class_name from filters %} +
+ + + + + + + {% for version in object_list %} + + + + + + + {% endfor %} + +
Date + Version ID + User + Changes +
{{ 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 'version_changes.html' %} + {% endif %} +
+
diff --git a/versioning/templates/version_history.html b/versioning/templates/version_history.html index 0625e309..98a40fc4 100644 --- a/versioning/templates/version_history.html +++ b/versioning/templates/version_history.html @@ -10,40 +10,8 @@ {% block content %}
- -
{% paginator %}
-
- - - - - - - - - - - {% for version in object_list %} - - - - - - - {% endfor %} - -
DateVersion IDUserChanges
{{ 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 'version_changes.html' %} - {% endif %} -
-
+

{{object|to_class_name}} {{ object.pk|stringformat:"05d" }} - Revision History

+ {% include 'partials/version_history_table.html' %}
{% paginator %}
{% endblock %} diff --git a/versioning/templates/version_scripts.html b/versioning/templates/version_scripts.html index c5602e20..f3524d71 100644 --- a/versioning/templates/version_scripts.html +++ b/versioning/templates/version_scripts.html @@ -1,4 +1,4 @@ -{% load static %} +{% load static %} @@ -6,15 +6,10 @@ $(function () { $('[data-toggle="tooltip"]').tooltip(); }); + var whiteList = $.fn.tooltip.Constructor.Default.whiteList + whiteList.ins = [] + whiteList.del = [] $(function() { $('[data-toggle="popover"]').popover({whiteList: whiteList}); }); - \ No newline at end of file