diff --git a/frappe/website/web_template/section_with_cards/section_with_cards.html b/frappe/website/web_template/section_with_cards/section_with_cards.html index 647923c9b1..d0eb164288 100644 --- a/frappe/website/web_template/section_with_cards/section_with_cards.html +++ b/frappe/website/web_template/section_with_cards/section_with_cards.html @@ -1,4 +1,4 @@ -{%- macro card(title, content, url) -%} +{%- macro card(title, content, url, image) -%} {%- set col_classes = resolve_class({ 'col-12 col-sm-6 col-lg-3': card_size == 'Small', 'col-12 col-sm-6 col-lg-4': card_size == 'Medium', @@ -11,6 +11,12 @@ }) -%}
+ {%- if image -%} + {{ frappe.render_template('templates/includes/image_with_blur.html', { + "src": image, + "class": ["card-img-top"] + }) }} + {%- endif -%}

{{ title or '' }}

{{ content or '' }}

@@ -34,8 +40,9 @@ {%- set title = values['card_' + index + '_title'] -%} {%- set content = values['card_' + index + '_content'] -%} {%- set url = values['card_' + index + '_url'] -%} + {%- set image = values['card_' + index + '_image'] -%} {%- if title -%} - {{ card(title, content, url) }} + {{ card(title, content, url, image) }} {%- endif -%} {%- endfor -%}
diff --git a/frappe/website/web_template/section_with_cards/section_with_cards.json b/frappe/website/web_template/section_with_cards/section_with_cards.json index 7c2c256396..c891119f97 100644 --- a/frappe/website/web_template/section_with_cards/section_with_cards.json +++ b/frappe/website/web_template/section_with_cards/section_with_cards.json @@ -41,6 +41,12 @@ "label": "Content", "reqd": 0 }, + { + "fieldname": "card_1_image", + "fieldtype": "Attach Image", + "label": "Image", + "reqd": 0 + }, { "fieldname": "card_1_url", "fieldtype": "Data", @@ -65,6 +71,12 @@ "label": "Content", "reqd": 0 }, + { + "fieldname": "card_2_image", + "fieldtype": "Attach Image", + "label": "Image", + "reqd": 0 + }, { "fieldname": "card_2_url", "fieldtype": "Data", @@ -89,6 +101,12 @@ "label": "Content", "reqd": 0 }, + { + "fieldname": "card_3_image", + "fieldtype": "Attach Image", + "label": "Image", + "reqd": 0 + }, { "fieldname": "card_3_url", "fieldtype": "Data", @@ -113,6 +131,12 @@ "label": "Content", "reqd": 0 }, + { + "fieldname": "card_4_image", + "fieldtype": "Attach Image", + "label": "Image", + "reqd": 0 + }, { "fieldname": "card_4_url", "fieldtype": "Data", @@ -137,6 +161,12 @@ "label": "Content", "reqd": 0 }, + { + "fieldname": "card_5_image", + "fieldtype": "Attach Image", + "label": "Image", + "reqd": 0 + }, { "fieldname": "card_5_url", "fieldtype": "Data", @@ -161,6 +191,12 @@ "label": "Content", "reqd": 0 }, + { + "fieldname": "card_6_image", + "fieldtype": "Attach Image", + "label": "Image", + "reqd": 0 + }, { "fieldname": "card_6_url", "fieldtype": "Data", @@ -185,6 +221,12 @@ "label": "Content", "reqd": 0 }, + { + "fieldname": "card_7_image", + "fieldtype": "Attach Image", + "label": "Image", + "reqd": 0 + }, { "fieldname": "card_7_url", "fieldtype": "Data", @@ -209,6 +251,12 @@ "label": "Content", "reqd": 0 }, + { + "fieldname": "card_8_image", + "fieldtype": "Attach Image", + "label": "Image", + "reqd": 0 + }, { "fieldname": "card_8_url", "fieldtype": "Data", @@ -233,6 +281,12 @@ "label": "Content", "reqd": 0 }, + { + "fieldname": "card_9_image", + "fieldtype": "Attach Image", + "label": "Image", + "reqd": 0 + }, { "fieldname": "card_9_url", "fieldtype": "Data", @@ -241,7 +295,7 @@ } ], "idx": 0, - "modified": "2020-10-26 17:42:53.356024", + "modified": "2021-05-03 13:26:34.470232", "modified_by": "Administrator", "module": "Website", "name": "Section with Cards",