Merge pull request #22945 from scmmishra/item-image-alt
feat: allow Item image alt
This commit is contained in:
commit
93df724dc1
@ -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 Description"
|
||||
}
|
||||
],
|
||||
"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",
|
||||
@ -1124,4 +1131,4 @@
|
||||
"sort_order": "DESC",
|
||||
"title_field": "item_name",
|
||||
"track_changes": 1
|
||||
}
|
||||
}
|
||||
|
@ -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)
|
||||
|
@ -23,7 +23,7 @@
|
||||
})
|
||||
</script>
|
||||
{% 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 %}
|
||||
|
||||
<!-- Simple image preview -->
|
||||
|
@ -7,9 +7,9 @@
|
||||
</div>
|
||||
{% endmacro %}
|
||||
|
||||
{% macro product_image(website_image, css_class="") %}
|
||||
{% macro product_image(website_image, css_class="", alt="") %}
|
||||
<div class="border text-center rounded h-100 {{ css_class }}" style="overflow: hidden;">
|
||||
<img itemprop="image" class="website-image h-100 w-100" src="{{ frappe.utils.quoted(website_image or 'no-image.jpg') | abs_url }}">
|
||||
<img itemprop="image" class="website-image h-100 w-100" alt="{{ alt }}" src="{{ frappe.utils.quoted(website_image or 'no-image.jpg') | abs_url }}">
|
||||
</div>
|
||||
{% endmacro %}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user