From 783b039eb1195fd010e3a05e9d6d5ea313f90c24 Mon Sep 17 00:00:00 2001 From: Matthias Date: Sun, 9 May 2021 14:28:46 +0200 Subject: [PATCH 1/4] initial functionality for #997 --- InvenTree/InvenTree/static/css/inventree.css | 14 +++++++++++++- InvenTree/InvenTree/static/script/clipboard.min.js | 7 +++++++ .../InvenTree/static/script/inventree/inventree.js | 7 +++++++ InvenTree/templates/base.html | 3 +++ InvenTree/templates/clipboard.html | 3 +++ 5 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 InvenTree/InvenTree/static/script/clipboard.min.js create mode 100644 InvenTree/templates/clipboard.html diff --git a/InvenTree/InvenTree/static/css/inventree.css b/InvenTree/InvenTree/static/css/inventree.css index e7b8aeb71e..d90b29afc2 100644 --- a/InvenTree/InvenTree/static/css/inventree.css +++ b/InvenTree/InvenTree/static/css/inventree.css @@ -936,4 +936,16 @@ input[type="submit"] { input[type="date"].form-control, input[type="time"].form-control, input[type="datetime-local"].form-control, input[type="month"].form-control { line-height: unset; -} \ No newline at end of file +} + +.clip-btn { + font-size: 10px; + padding: 0px 6px; + color: var(--label-grey); + background: none; +} + +.clip-btn:hover { + padding: 6px 6px; + background: var(--label-grey); +} diff --git a/InvenTree/InvenTree/static/script/clipboard.min.js b/InvenTree/InvenTree/static/script/clipboard.min.js new file mode 100644 index 0000000000..95f55d7b0c --- /dev/null +++ b/InvenTree/InvenTree/static/script/clipboard.min.js @@ -0,0 +1,7 @@ +/*! + * clipboard.js v2.0.8 + * https://clipboardjs.com/ + * + * Licensed MIT © Zeno Rocha + */ +!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.ClipboardJS=e():t.ClipboardJS=e()}(this,function(){return n={134:function(t,e,n){"use strict";n.d(e,{default:function(){return r}});var e=n(279),i=n.n(e),e=n(370),a=n.n(e),e=n(817),o=n.n(e);function c(t){return(c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function u(t,e){for(var n=0;n + + + diff --git a/InvenTree/templates/clipboard.html b/InvenTree/templates/clipboard.html new file mode 100644 index 0000000000..e40c57a370 --- /dev/null +++ b/InvenTree/templates/clipboard.html @@ -0,0 +1,3 @@ + + + \ No newline at end of file From 9f6f69a8154176d519ef29bf0644aae108274176 Mon Sep 17 00:00:00 2001 From: Matthias Date: Sun, 9 May 2021 14:29:35 +0200 Subject: [PATCH 2/4] rename for shorter inclusion str --- InvenTree/templates/{clipboard.html => clip.html} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename InvenTree/templates/{clipboard.html => clip.html} (100%) diff --git a/InvenTree/templates/clipboard.html b/InvenTree/templates/clip.html similarity index 100% rename from InvenTree/templates/clipboard.html rename to InvenTree/templates/clip.html From d38c1f6c0b6c651ab6591cee5c130e24067f2747 Mon Sep 17 00:00:00 2001 From: Matthias Date: Sun, 9 May 2021 14:30:39 +0200 Subject: [PATCH 3/4] sample implementation --- InvenTree/part/templates/part/detail.html | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/InvenTree/part/templates/part/detail.html b/InvenTree/part/templates/part/detail.html index 589e4f2533..9df2f9d542 100644 --- a/InvenTree/part/templates/part/detail.html +++ b/InvenTree/part/templates/part/detail.html @@ -20,20 +20,20 @@ {% trans "Part name" %} - {{ part.name }} + {{ part.name }}{% include "clip.html"%} {% if part.IPN %} {% trans "IPN" %} - {{ part.IPN }} + {{ part.IPN }}{% include "clip.html"%} {% endif %} {% if part.revision %} {% trans "Revision" %} - {{ part.revision }} + {{ part.revision }}{% include "clip.html"%} {% endif %} {% if part.trackable %} @@ -42,7 +42,7 @@ {% trans "Latest Serial Number" %} {% if part.getLatestSerialNumber %} - {{ part.getLatestSerialNumber }} + {{ part.getLatestSerialNumber }}{% include "clip.html"%} {% else %} {% trans "No serial numbers recorded" %} {% endif %} @@ -52,7 +52,7 @@ {% trans "Description" %} - {{ part.description }} + {{ part.description }}{% include "clip.html"%} {% if part.variant_of %} @@ -96,7 +96,7 @@ {% trans "Default Supplier" %} - {{ part.default_supplier.supplier.name }} | {{ part.default_supplier.SKU }} + {{ part.default_supplier.supplier.name }} | {{ part.default_supplier.SKU }}{% include "clip.html"%} {% endif %} From fc83458bdb192fafa0d758cbb82acedd3d974d33 Mon Sep 17 00:00:00 2001 From: Matthias Date: Mon, 10 May 2021 07:53:58 +0200 Subject: [PATCH 4/4] changes as suggested by @SchrodingersGat --- InvenTree/InvenTree/static/css/inventree.css | 1 - InvenTree/templates/clip.html | 4 +++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/InvenTree/InvenTree/static/css/inventree.css b/InvenTree/InvenTree/static/css/inventree.css index d90b29afc2..26720f360f 100644 --- a/InvenTree/InvenTree/static/css/inventree.css +++ b/InvenTree/InvenTree/static/css/inventree.css @@ -946,6 +946,5 @@ input[type="date"].form-control, input[type="time"].form-control, input[type="da } .clip-btn:hover { - padding: 6px 6px; background: var(--label-grey); } diff --git a/InvenTree/templates/clip.html b/InvenTree/templates/clip.html index e40c57a370..a56ece838c 100644 --- a/InvenTree/templates/clip.html +++ b/InvenTree/templates/clip.html @@ -1,3 +1,5 @@ +{% load i18n %} + - + \ No newline at end of file