From d9e5bfd97110190fcb88d13946c017c454169f9d Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Thu, 15 Aug 2019 19:26:13 +1000 Subject: [PATCH 1/4] Use button row rather than drop-down for build display --- .../build/templates/build/build_base.html | 36 ++++++++++--------- InvenTree/build/templates/build/tabs.html | 2 +- 2 files changed, 20 insertions(+), 18 deletions(-) diff --git a/InvenTree/build/templates/build/build_base.html b/InvenTree/build/templates/build/build_base.html index b171f2c8aa..828bed1f77 100644 --- a/InvenTree/build/templates/build/build_base.html +++ b/InvenTree/build/templates/build/build_base.html @@ -23,6 +23,25 @@ InvenTree | Build - {{ build }}

Build Details

+ +

+

+
+ + {% if build.is_active %} + + + {% endif %} +
+
+

+ @@ -53,23 +72,6 @@ InvenTree | Build - {{ build }} -
-

-
- -
-

-

diff --git a/InvenTree/build/templates/build/tabs.html b/InvenTree/build/templates/build/tabs.html index 03b7172742..6f8ba4f355 100644 --- a/InvenTree/build/templates/build/tabs.html +++ b/InvenTree/build/templates/build/tabs.html @@ -3,6 +3,6 @@ Details - Parts + Assign Parts \ No newline at end of file From 03b7e3a815eeaf641e2eb11a17da08d1e47c5a06 Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Thu, 15 Aug 2019 19:34:55 +1000 Subject: [PATCH 2/4] Add view / template to delete a build --- InvenTree/build/templates/build/delete_build.html | 5 +++++ InvenTree/build/urls.py | 7 ++++--- InvenTree/build/views.py | 8 ++++++++ 3 files changed, 17 insertions(+), 3 deletions(-) create mode 100644 InvenTree/build/templates/build/delete_build.html diff --git a/InvenTree/build/templates/build/delete_build.html b/InvenTree/build/templates/build/delete_build.html new file mode 100644 index 0000000000..7c3298ba35 --- /dev/null +++ b/InvenTree/build/templates/build/delete_build.html @@ -0,0 +1,5 @@ +{% extends "modal_delete_form.html" %} + +{% block pre_form_content %} +Are you sure you want to delete this build? +{% endblock %} \ No newline at end of file diff --git a/InvenTree/build/urls.py b/InvenTree/build/urls.py index 3118bd6042..82b269b1b7 100644 --- a/InvenTree/build/urls.py +++ b/InvenTree/build/urls.py @@ -17,9 +17,10 @@ build_item_urls = [ ] build_detail_urls = [ - url(r'^edit/?', views.BuildUpdate.as_view(), name='build-edit'), - url(r'^allocate/?', views.BuildAllocate.as_view(), name='build-allocate'), - url(r'^cancel/?', views.BuildCancel.as_view(), name='build-cancel'), + url(r'^edit/', views.BuildUpdate.as_view(), name='build-edit'), + url(r'^allocate/', views.BuildAllocate.as_view(), name='build-allocate'), + url(r'^cancel/', views.BuildCancel.as_view(), name='build-cancel'), + url(r'^delete/', views.BuildDelete.as_view(), name='build-delete'), url(r'^complete/?', views.BuildComplete.as_view(), name='build-complete'), url(r'^auto-allocate/?', views.BuildAutoAllocate.as_view(), name='build-auto-allocate'), url(r'^unallocate/', views.BuildUnallocate.as_view(), name='build-unallocate'), diff --git a/InvenTree/build/views.py b/InvenTree/build/views.py index db276ed88d..eb267064b9 100644 --- a/InvenTree/build/views.py +++ b/InvenTree/build/views.py @@ -397,6 +397,14 @@ class BuildUpdate(AjaxUpdateView): } +class BuildDelete(AjaxDeleteView): + """ View to delete a build """ + + model = Build + ajax_template_name = 'build/delete_build.html' + ajax_form_title = 'Delete Build' + + class BuildItemDelete(AjaxDeleteView): """ View to 'unallocate' a BuildItem. Really we are deleting the BuildItem object from the database. From b8d7cefa95ff49878f295bb1074a23b35af79a92 Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Thu, 15 Aug 2019 19:35:12 +1000 Subject: [PATCH 3/4] Add button to delete a build (only if it has been cancelled) --- InvenTree/build/templates/build/build_base.html | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/InvenTree/build/templates/build/build_base.html b/InvenTree/build/templates/build/build_base.html index 828bed1f77..3e4ee98cd5 100644 --- a/InvenTree/build/templates/build/build_base.html +++ b/InvenTree/build/templates/build/build_base.html @@ -38,6 +38,11 @@ InvenTree | Build - {{ build }} {% endif %} + {% if build.status == BuildStatus.CANCELLED %} + + {% endif %}

@@ -111,5 +116,14 @@ InvenTree | Build - {{ build }} } ); }); + + $("#build-delete").on('click', function() { + launchModalForm( + "{% url 'build-delete' build.id %}", + { + redirect: "{% url 'build-index' %}", + } + ); + }); {% endblock %} \ No newline at end of file From 5501fecbc4c6a0b9a3f6bb82b1e54305b044ccca Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Thu, 15 Aug 2019 19:36:03 +1000 Subject: [PATCH 4/4] PEP --- InvenTree/build/urls.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/InvenTree/build/urls.py b/InvenTree/build/urls.py index 82b269b1b7..54f9f60983 100644 --- a/InvenTree/build/urls.py +++ b/InvenTree/build/urls.py @@ -20,7 +20,7 @@ build_detail_urls = [ url(r'^edit/', views.BuildUpdate.as_view(), name='build-edit'), url(r'^allocate/', views.BuildAllocate.as_view(), name='build-allocate'), url(r'^cancel/', views.BuildCancel.as_view(), name='build-cancel'), - url(r'^delete/', views.BuildDelete.as_view(), name='build-delete'), + url(r'^delete/', views.BuildDelete.as_view(), name='build-delete'), url(r'^complete/?', views.BuildComplete.as_view(), name='build-complete'), url(r'^auto-allocate/?', views.BuildAutoAllocate.as_view(), name='build-auto-allocate'), url(r'^unallocate/', views.BuildUnallocate.as_view(), name='build-unallocate'),
{{ build.title }}