From 88b34740f6cff5e479194bef95841659c31af1b6 Mon Sep 17 00:00:00 2001 From: FreneticScribbler Date: Mon, 16 Mar 2020 21:45:04 +0000 Subject: [PATCH] Asset list/CRUD template updates --- RIGS/templates/rigboard.html | 2 +- assets/templates/asset_create.html | 60 ---------------- assets/templates/asset_detail.html | 34 +++++++++ assets/templates/asset_form.html | 70 +++++++++++++++++++ assets/templates/asset_list.html | 2 + assets/templates/asset_update.html | 70 ------------------- ...asset_form.html => asset_detail_form.html} | 6 +- assets/templates/partials/asset_picker.html | 17 +---- assets/templates/partials/cable_form.html | 6 +- assets/templates/partials/parent_form.html | 6 +- .../partials/purchasedetails_form.html | 23 +----- assets/views.py | 10 ++- templates/base_assets.html | 2 +- 13 files changed, 126 insertions(+), 182 deletions(-) delete mode 100644 assets/templates/asset_create.html create mode 100644 assets/templates/asset_detail.html create mode 100644 assets/templates/asset_form.html delete mode 100644 assets/templates/asset_update.html rename assets/templates/partials/{asset_form.html => asset_detail_form.html} (96%) diff --git a/RIGS/templates/rigboard.html b/RIGS/templates/rigboard.html index bb00eafc..9f91fe98 100644 --- a/RIGS/templates/rigboard.html +++ b/RIGS/templates/rigboard.html @@ -6,7 +6,7 @@

Rigboard

{% if perms.RIGS.add_event %} - New + New {% endif %}
{% include 'event_table.html' %} diff --git a/assets/templates/asset_create.html b/assets/templates/asset_create.html deleted file mode 100644 index 14b4b66a..00000000 --- a/assets/templates/asset_create.html +++ /dev/null @@ -1,60 +0,0 @@ -{% extends 'base_assets.html' %} -{% load widget_tweaks %} -{% block title %}Asset {{ object.asset_id }}{% endblock %} - -{% block content %} - - -{% if duplicate %} -
- {% else %} - - {% endif %} - {% include 'form_errors.html' %} - {% csrf_token %} - -
-
- {% include 'partials/asset_form.html' %} -
-
-
-
- {% include 'partials/purchasedetails_form.html' %} -
- -
- {% include 'partials/parent_form.html' %} -
-
-
-
- {% include 'partials/asset_buttons.html' %} -
-
-
- - {% endblock %} - - {% block js%} - - {%endblock%} diff --git a/assets/templates/asset_detail.html b/assets/templates/asset_detail.html new file mode 100644 index 00000000..34d47af9 --- /dev/null +++ b/assets/templates/asset_detail.html @@ -0,0 +1,34 @@ +{% extends 'base_assets.html' %} +{% load widget_tweaks %} +{% block title %}Asset {{ object.asset_id }}{% endblock %} + +{% block content %} + + + +
+
+ {% include 'partials/asset_detail_form.html' %} +
+
+
+ {% if perms.assets.asset_finance %} +
+ {% include 'partials/purchasedetails_form.html' %} +
+ {% endif %} +
+ {% include 'partials/cable_form.html' %} +
+
+ {% include 'partials/parent_form.html' %} +
+
+
+
+ {% include 'partials/asset_buttons.html' %} +
+{% include 'partials/last_edited.html' with target="asset_history" %} +{% endblock %} diff --git a/assets/templates/asset_form.html b/assets/templates/asset_form.html new file mode 100644 index 00000000..4797d327 --- /dev/null +++ b/assets/templates/asset_form.html @@ -0,0 +1,70 @@ +{% extends 'base_assets.html' %} +{% load widget_tweaks %} +{% load static %} + +{% block title %}Asset {{ object.asset_id }}{% endblock %} + +{% block css %} + + +{% endblock %} + +{% block js %} + + + + +{% endblock %} + +{% block content %} + +{% if duplicate %} +
+{% else %} + +{% endif %} + {% include 'form_errors.html' %} + {% csrf_token %} + +
+
+ {% include 'partials/asset_detail_form.html' %} +
+
+
+
+ {% include 'partials/purchasedetails_form.html' %} +
+ +
+ {% include 'partials/parent_form.html' %} +
+
+
+
+ {% include 'partials/asset_buttons.html' %} +
+
+
+{% endblock %} diff --git a/assets/templates/asset_list.html b/assets/templates/asset_list.html index b4fbf3ce..6c04b56d 100644 --- a/assets/templates/asset_list.html +++ b/assets/templates/asset_list.html @@ -41,6 +41,8 @@
+New + diff --git a/assets/templates/asset_update.html b/assets/templates/asset_update.html deleted file mode 100644 index 4f576130..00000000 --- a/assets/templates/asset_update.html +++ /dev/null @@ -1,70 +0,0 @@ -{% extends 'base_assets.html' %} -{% load widget_tweaks %} -{% block title %}Asset {{ object.asset_id }}{% endblock %} - -{% block content %} - - - - {% include 'form_errors.html' %} - {% csrf_token %} - -
-
- {% include 'partials/asset_form.html' %} -
-
-
- {% if perms.assets.asset_finance %} -
- {% include 'partials/purchasedetails_form.html' %} -
- {%endif%} - -
- {% include 'partials/parent_form.html' %} -
-
-
-
- {% include 'partials/asset_buttons.html' %} -
- - -{% if not edit and perms.assets.view_asset %} - -{% endif %} - -{% endblock %} - -{% block js%} -{% if edit %} - -{% endif %} -{% endblock %} diff --git a/assets/templates/partials/asset_form.html b/assets/templates/partials/asset_detail_form.html similarity index 96% rename from assets/templates/partials/asset_form.html rename to assets/templates/partials/asset_detail_form.html index 45424992..cb55e677 100644 --- a/assets/templates/partials/asset_form.html +++ b/assets/templates/partials/asset_detail_form.html @@ -1,9 +1,9 @@ {% load widget_tweaks %} -
-
+
+
Asset Details
-
+
{% if create or edit or duplicate %}
diff --git a/assets/templates/partials/asset_picker.html b/assets/templates/partials/asset_picker.html index fd63fe86..5e9e076f 100644 --- a/assets/templates/partials/asset_picker.html +++ b/assets/templates/partials/asset_picker.html @@ -3,20 +3,7 @@ {% endif %} - -{% load static %} -{% block css %} - - -{% endblock %} - -{% block preload_js %} - - -{% endblock %} - {% block js %} -{{ js.super }} -{% endblock js %} \ No newline at end of file +{% endblock js %} diff --git a/assets/templates/partials/cable_form.html b/assets/templates/partials/cable_form.html index e5deb006..8b15ef09 100644 --- a/assets/templates/partials/cable_form.html +++ b/assets/templates/partials/cable_form.html @@ -1,9 +1,9 @@ {% load widget_tweaks %} -
-
+
+
Cable Details
-
+
{% if create or edit or duplicate %}
diff --git a/assets/templates/partials/parent_form.html b/assets/templates/partials/parent_form.html index f252db36..f2c54def 100644 --- a/assets/templates/partials/parent_form.html +++ b/assets/templates/partials/parent_form.html @@ -1,9 +1,9 @@ {% load widget_tweaks %} -
-
+
+
Collection Details
-
+
{% if create or edit or duplicate %}
diff --git a/assets/templates/partials/purchasedetails_form.html b/assets/templates/partials/purchasedetails_form.html index a19dfa1f..9cbe9a60 100644 --- a/assets/templates/partials/purchasedetails_form.html +++ b/assets/templates/partials/purchasedetails_form.html @@ -1,26 +1,9 @@ {% load widget_tweaks %} -{% load static %} - - -{% block css %} - - -{% endblock %} - -{% block preload_js %} - - -{% endblock %} - -{% block js %} - -{% endblock %} - -
-
+
+
Purchase Details
-
+
{% if create or edit or duplicate %}
diff --git a/assets/views.py b/assets/views.py index 29eaa7aa..b113a901 100644 --- a/assets/views.py +++ b/assets/views.py @@ -93,17 +93,17 @@ class AssetIDUrlMixin: class AssetDetail(LoginRequiredMixin, AssetIDUrlMixin, generic.DetailView): model = models.Asset - template_name = 'asset_update.html' + template_name = 'asset_detail.html' class AssetEdit(LoginRequiredMixin, AssetIDUrlMixin, generic.UpdateView): - template_name = 'asset_update.html' + template_name = 'asset_form.html' model = models.Asset form_class = forms.AssetForm def get_context_data(self, **kwargs): context = super().get_context_data(**kwargs) - context['edit'] = True + context["edit"] = True context["connectors"] = models.Connector.objects.all() return context @@ -113,7 +113,7 @@ class AssetEdit(LoginRequiredMixin, AssetIDUrlMixin, generic.UpdateView): class AssetCreate(LoginRequiredMixin, generic.CreateView): - template_name = 'asset_create.html' + template_name = 'asset_form.html' model = models.Asset form_class = forms.AssetForm @@ -141,8 +141,6 @@ class DuplicateMixin: class AssetDuplicate(DuplicateMixin, AssetIDUrlMixin, AssetCreate): - model = models.Asset - def get_context_data(self, **kwargs): context = super().get_context_data(**kwargs) context["create"] = None diff --git a/templates/base_assets.html b/templates/base_assets.html index fe27ddb3..cafc762b 100644 --- a/templates/base_assets.html +++ b/templates/base_assets.html @@ -1,7 +1,7 @@ {% extends 'base.html' %} {% block extrahead %} - + {% endblock %} {% block titleheader %}