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",
|
"weightage",
|
||||||
"slideshow",
|
"slideshow",
|
||||||
"website_image",
|
"website_image",
|
||||||
|
"website_image_alt",
|
||||||
"thumbnail",
|
"thumbnail",
|
||||||
"cb72",
|
"cb72",
|
||||||
"website_warehouse",
|
"website_warehouse",
|
||||||
@ -1054,15 +1055,21 @@
|
|||||||
"fieldtype": "Data",
|
"fieldtype": "Data",
|
||||||
"label": "Default Manufacturer Part No",
|
"label": "Default Manufacturer Part No",
|
||||||
"read_only": 1
|
"read_only": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldname": "website_image_alt",
|
||||||
|
"fieldtype": "Data",
|
||||||
|
"label": "Image Description"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"has_web_view": 1,
|
"has_web_view": 1,
|
||||||
"icon": "fa fa-tag",
|
"icon": "fa fa-tag",
|
||||||
"idx": 2,
|
"idx": 2,
|
||||||
"image_field": "image",
|
"image_field": "image",
|
||||||
|
"index_web_pages_for_search": 1,
|
||||||
"links": [],
|
"links": [],
|
||||||
"max_attachments": 1,
|
"max_attachments": 1,
|
||||||
"modified": "2020-07-31 21:21:10.956453",
|
"modified": "2020-08-07 14:24:58.384992",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Stock",
|
"module": "Stock",
|
||||||
"name": "Item",
|
"name": "Item",
|
||||||
@ -1124,4 +1131,4 @@
|
|||||||
"sort_order": "DESC",
|
"sort_order": "DESC",
|
||||||
"title_field": "item_name",
|
"title_field": "item_name",
|
||||||
"track_changes": 1
|
"track_changes": 1
|
||||||
}
|
}
|
||||||
|
|||||||
@ -343,7 +343,7 @@ class Item(WebsiteGenerator):
|
|||||||
if variant:
|
if variant:
|
||||||
context.variant = frappe.get_doc("Item", 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"):
|
"website_specifications"):
|
||||||
if context.variant.get(fieldname):
|
if context.variant.get(fieldname):
|
||||||
value = context.variant.get(fieldname)
|
value = context.variant.get(fieldname)
|
||||||
|
|||||||
@ -23,7 +23,7 @@
|
|||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
{% else %}
|
{% 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 %}
|
{% endif %}
|
||||||
|
|
||||||
<!-- Simple image preview -->
|
<!-- Simple image preview -->
|
||||||
|
|||||||
@ -7,9 +7,9 @@
|
|||||||
</div>
|
</div>
|
||||||
{% endmacro %}
|
{% 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;">
|
<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>
|
</div>
|
||||||
{% endmacro %}
|
{% endmacro %}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user