From bc3be635aee75517e2f275eec7c401b7cd09acfb Mon Sep 17 00:00:00 2001 From: Oliver Date: Wed, 6 Oct 2021 21:03:40 +1100 Subject: [PATCH] Reset modal image when a new image is uploaded --- InvenTree/company/templates/company/company_base.html | 6 ++++++ InvenTree/part/templates/part/part_base.html | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/InvenTree/company/templates/company/company_base.html b/InvenTree/company/templates/company/company_base.html index e4ca64b32e..b05a21304d 100644 --- a/InvenTree/company/templates/company/company_base.html +++ b/InvenTree/company/templates/company/company_base.html @@ -158,6 +158,12 @@ function reloadImage(data) { if (data.image) { $('#company-image').attr('src', data.image); + + // Reset the "modal image" view + $('#company-image').click(function() { + showModalImage(data.image); + }); + } else { location.reload(); } diff --git a/InvenTree/part/templates/part/part_base.html b/InvenTree/part/templates/part/part_base.html index a81f918013..c1542ac13b 100644 --- a/InvenTree/part/templates/part/part_base.html +++ b/InvenTree/part/templates/part/part_base.html @@ -328,6 +328,12 @@ // If image / thumbnail data present, live update if (data.image) { $('#part-image').attr('src', data.image); + + // Reset the "modal image" view + $('#part-thumb').click(function() { + showModalImage(data.image); + }); + } else { // Otherwise, reload the page location.reload();