From 8842d50c723f219285b951394551fd5106addc52 Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Tue, 18 Jun 2019 22:49:43 +1000 Subject: [PATCH] Replace a whole bunch o' drop-down options with pretty buttons --- InvenTree/part/templates/part/detail.html | 61 +------------------- InvenTree/part/templates/part/part_base.html | 58 ++++++++++++++++++- 2 files changed, 56 insertions(+), 63 deletions(-) diff --git a/InvenTree/part/templates/part/detail.html b/InvenTree/part/templates/part/detail.html index fe07954a5a..ef47e70515 100644 --- a/InvenTree/part/templates/part/detail.html +++ b/InvenTree/part/templates/part/detail.html @@ -4,31 +4,6 @@ {% include 'part/tabs.html' with tab='detail' %} -
-
-
-
-
- - -
-
-
-

Part Details

@@ -194,31 +169,6 @@ }, ); }); - - $("#duplicate-part").click(function() { - launchModalForm( - "{% url 'part-duplicate' part.id %}", - { - follow: true, - } - ); - }); - - $("#order-part").click(function() { - launchModalForm("/order/purchase-order/order-parts/", { - data: { - part: {{ part.id }}, - }, - }); - }); - - $("#edit-part").click(function() { - launchModalForm( - "{% url 'part-edit' part.id %}", - { - reload: true, - }); - }); $('#activate-part').click(function() { showQuestionDialog( @@ -264,14 +214,5 @@ } ); }); - - - $('#delete-part').click(function() { - launchModalForm( - "{% url 'part-delete' part.id %}", - { - redirect: {% if part.category %}"{% url 'category-detail' part.category.id %}"{% else %}"{% url 'part-index' %}"{% endif %} - }); - }); - + {% endblock %} diff --git a/InvenTree/part/templates/part/part_base.html b/InvenTree/part/templates/part/part_base.html index 92dccbcae1..3377c730a5 100644 --- a/InvenTree/part/templates/part/part_base.html +++ b/InvenTree/part/templates/part/part_base.html @@ -46,9 +46,27 @@ {% if part.is_template == False %} {% include "qr_button.html" %} + {% if part.active %} + {% if part.purchaseable %} + + {% endif %} + {% endif %} + {% endif %} + + + {% if not part.active %} + {% endif %}

@@ -170,9 +188,6 @@ }); }); - $('#toggle-starred').click(function() { - }); - $("#part-thumb").click(function() { launchModalForm( "{% url 'part-image' part.id %}", @@ -182,4 +197,41 @@ ); }); + $("#part-edit").click(function() { + launchModalForm( + "{% url 'part-edit' part.id %}", + { + reload: true, + } + ); + }); + + $("#part-order").click(function() { + launchModalForm("/order/purchase-order/order-parts/", { + data: { + part: {{ part.id }}, + }, + }); + }); + + $("#part-duplicate").click(function() { + launchModalForm( + "{% url 'part-duplicate' part.id %}", + { + follow: true, + } + ); + }); + + {% if not part.active %} + $("#part-delete").click(function() { + launchModalForm( + "{% url 'part-delete' part.id %}", + { + redirect: {% if part.category %}"{% url 'category-detail' part.category.id %}"{% else %}"{% url 'part-index' %}"{% endif %} + } + ); + }); + {% endif %} + {% endblock %} \ No newline at end of file