From ba4c4f107ed1756759696334acf97cb54df20e3d Mon Sep 17 00:00:00 2001 From: Shivam Mishra Date: Fri, 7 Aug 2020 14:34:28 +0530 Subject: [PATCH 1/4] feat: add image alt field in items --- erpnext/stock/doctype/item/item.json | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/erpnext/stock/doctype/item/item.json b/erpnext/stock/doctype/item/item.json index 45526a3910..f4c7376439 100644 --- a/erpnext/stock/doctype/item/item.json +++ b/erpnext/stock/doctype/item/item.json @@ -123,6 +123,7 @@ "weightage", "slideshow", "website_image", + "website_image_alt", "thumbnail", "cb72", "website_warehouse", @@ -1054,15 +1055,21 @@ "fieldtype": "Data", "label": "Default Manufacturer Part No", "read_only": 1 + }, + { + "fieldname": "website_image_alt", + "fieldtype": "Data", + "label": "Image Alt Text" } ], "has_web_view": 1, "icon": "fa fa-tag", "idx": 2, "image_field": "image", + "index_web_pages_for_search": 1, "links": [], "max_attachments": 1, - "modified": "2020-07-31 21:21:10.956453", + "modified": "2020-08-07 14:24:58.384992", "modified_by": "Administrator", "module": "Stock", "name": "Item", From a0954e66a8844ac0367e5f34c78a83a4796fe1ab Mon Sep 17 00:00:00 2001 From: Shivam Mishra Date: Fri, 7 Aug 2020 14:34:54 +0530 Subject: [PATCH 2/4] feat: add image alt argument for product_image macros --- erpnext/templates/includes/macros.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/erpnext/templates/includes/macros.html b/erpnext/templates/includes/macros.html index 3c82e90cc0..ea6b00fc58 100644 --- a/erpnext/templates/includes/macros.html +++ b/erpnext/templates/includes/macros.html @@ -7,9 +7,9 @@ {% endmacro %} -{% macro product_image(website_image, css_class="") %} +{% macro product_image(website_image, css_class="", alt="") %}
- + {{ alt }}
{% endmacro %} From b1f885912193cdfd57853c0cf84256f7a2b3e575 Mon Sep 17 00:00:00 2001 From: Shivam Mishra Date: Fri, 7 Aug 2020 14:38:40 +0530 Subject: [PATCH 3/4] feat: add alt value in product page --- erpnext/stock/doctype/item/item.py | 2 +- erpnext/templates/generators/item/item_image.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/erpnext/stock/doctype/item/item.py b/erpnext/stock/doctype/item/item.py index d7b43bf399..d209f48353 100644 --- a/erpnext/stock/doctype/item/item.py +++ b/erpnext/stock/doctype/item/item.py @@ -343,7 +343,7 @@ class Item(WebsiteGenerator): if variant: context.variant = frappe.get_doc("Item", variant) - for fieldname in ("website_image", "web_long_description", "description", + for fieldname in ("website_image", "website_image_alt", "web_long_description", "description", "website_specifications"): if context.variant.get(fieldname): value = context.variant.get(fieldname) diff --git a/erpnext/templates/generators/item/item_image.html b/erpnext/templates/generators/item/item_image.html index 0dd4c3505e..5d46a45053 100644 --- a/erpnext/templates/generators/item/item_image.html +++ b/erpnext/templates/generators/item/item_image.html @@ -23,7 +23,7 @@ }) {% else %} -{{ product_image(website_image or image or 'no-image.jpg') }} +{{ product_image(website_image or image or 'no-image.jpg', alt=website_image_alt or item_name) }} {% endif %} From ded9f41cce70321b7c425ba31effd93a47c62edd Mon Sep 17 00:00:00 2001 From: Shivam Mishra Date: Mon, 10 Aug 2020 12:45:07 +0530 Subject: [PATCH 4/4] refactor: update confusing label --- erpnext/stock/doctype/item/item.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/erpnext/stock/doctype/item/item.json b/erpnext/stock/doctype/item/item.json index f4c7376439..d07b3dc4fe 100644 --- a/erpnext/stock/doctype/item/item.json +++ b/erpnext/stock/doctype/item/item.json @@ -1059,7 +1059,7 @@ { "fieldname": "website_image_alt", "fieldtype": "Data", - "label": "Image Alt Text" + "label": "Image Description" } ], "has_web_view": 1, @@ -1131,4 +1131,4 @@ "sort_order": "DESC", "title_field": "item_name", "track_changes": 1 -} \ No newline at end of file +}