From aca3c8fce7f38f77f653967fae15e5af518e13bb Mon Sep 17 00:00:00 2001 From: marination Date: Tue, 8 Jun 2021 19:40:26 +0530 Subject: [PATCH] fix: Font size, empty image styles, and minor cleanup - some frappe css font variables weren't loading, remove dependency - fixed fallback display for missing images in views - py code cleanup (minor) --- erpnext/e_commerce/product_grid.js | 12 +++-- erpnext/e_commerce/product_list.js | 13 +++-- erpnext/e_commerce/product_search.js | 6 ++- erpnext/patches/v13_0/create_website_items.py | 4 +- erpnext/public/scss/shopping_cart.scss | 49 ++++++++++++++----- .../generators/item/item_add_to_cart.html | 2 +- .../generators/item/item_inquiry.html | 8 +-- erpnext/templates/generators/item_group.html | 5 +- .../templates/includes/cart/address_card.html | 2 +- .../templates/includes/cart/cart_address.html | 15 +++--- erpnext/templates/includes/macros.html | 39 +++++++-------- erpnext/templates/pages/cart.html | 10 ++-- erpnext/templates/pages/product_search.py | 2 +- erpnext/www/all-products/index.html | 5 +- 14 files changed, 104 insertions(+), 68 deletions(-) diff --git a/erpnext/e_commerce/product_grid.js b/erpnext/e_commerce/product_grid.js index bd7a568ac0..c0e5ffa845 100644 --- a/erpnext/e_commerce/product_grid.js +++ b/erpnext/e_commerce/product_grid.js @@ -47,11 +47,13 @@ erpnext.ProductGrid = class { `; } else { return ` - -
- ${ frappe.get_abbr(title) } -
-
+
+ +
+ ${ frappe.get_abbr(title) } +
+
+
`; } } diff --git a/erpnext/e_commerce/product_list.js b/erpnext/e_commerce/product_list.js index d5ba6f5b29..6c7d7ff7dc 100644 --- a/erpnext/e_commerce/product_list.js +++ b/erpnext/e_commerce/product_list.js @@ -48,11 +48,14 @@ erpnext.ProductList = class { `; } else { return ` - -
- ${ frappe.get_abbr(title) } -
-
+
+ +
+ ${ frappe.get_abbr(title) } +
+
+
`; } } diff --git a/erpnext/e_commerce/product_search.js b/erpnext/e_commerce/product_search.js index 037878b63c..e537688199 100644 --- a/erpnext/e_commerce/product_search.js +++ b/erpnext/e_commerce/product_search.js @@ -179,7 +179,11 @@ erpnext.ProductSearch = class { let html = ""; recents.forEach((key) => { - html += ``; + html += ` + + `; }); this.recents_container.html(html); diff --git a/erpnext/patches/v13_0/create_website_items.py b/erpnext/patches/v13_0/create_website_items.py index 78e9dda42a..a8bdc5c263 100644 --- a/erpnext/patches/v13_0/create_website_items.py +++ b/erpnext/patches/v13_0/create_website_items.py @@ -1,6 +1,4 @@ -from __future__ import unicode_literals import frappe - from erpnext.e_commerce.doctype.website_item.website_item import make_website_item def execute(): @@ -48,7 +46,7 @@ def execute(): website_item.ranking = item.get("weightage") for field in web_fields_to_map: website_item.update({field: item.get(field)}) - website_item.save() + website_item.save() # move Website Item Group & Website Specification table to Website Item for doctype in ("Website Item Group", "Item Website Specification"): diff --git a/erpnext/public/scss/shopping_cart.scss b/erpnext/public/scss/shopping_cart.scss index 48eb6dc540..b14743b833 100644 --- a/erpnext/public/scss/shopping_cart.scss +++ b/erpnext/public/scss/shopping_cart.scss @@ -100,6 +100,17 @@ body.product-page { color: var(--gray-500); } + .no-image-list { + @include flex(flex, center, center, null); + height: 150px; + background: var(--gray-100); + border-radius: var(--border-radius); + font-size: 2rem; + color: var(--gray-500); + margin-top: 15px; + margin-bottom: 15px; + } + .product-title { font-size: 14px; color: var(--gray-800); @@ -198,7 +209,7 @@ body.product-page { max-width: 50%; .btn-add-to-cart { - font-size: var(--text-base); + font-size: 14px; } } @@ -211,7 +222,7 @@ body.product-page { max-width: 90% !important; .btn-add-to-cart { - font-size: var(--text-base); + font-size: 14px; } } } @@ -294,7 +305,7 @@ body.product-page { .formatted-price { color: var(--text-muted); - font-size: var(--text-base); + font-size: 14px; } } @@ -420,7 +431,7 @@ body.product-page { } .total-discount { - font-size: var(--text-base); + font-size: 14px; color: var(--primary-color) !important; } @@ -466,23 +477,23 @@ body.product-page { .cart-items { .item-title { - font-size: var(--text-base); + font-size: 14px; font-weight: 500; color: var(--text-color); } .item-subtitle { color: var(--text-muted); - font-size: var(--text-md); + font-size: 13px; } .item-subtotal { - font-size: var(--text-base); + font-size: 14px; font-weight: 500; } .sm-item-subtotal { - font-size: var(--text-base); + font-size: 14px; font-weight: 500; display: none; @@ -492,7 +503,7 @@ body.product-page { } .item-rate { - font-size: var(--text-md); + font-size: 13px; color: var(--text-muted); } @@ -568,7 +579,7 @@ body.product-page { .cart-qty { height: 28px; - font-size: var(--text-md); + font-size: 13px; } } @@ -593,7 +604,7 @@ body.product-page { .address-card { .card-title { - font-size: var(--text-base); + font-size: 14px; font-weight: 500; } @@ -602,12 +613,12 @@ body.product-page { } .card-text { - font-size: var(--text-md); + font-size: 13px; color: var(--gray-700); } .card-link { - font-size: var(--text-md); + font-size: 13px; svg use { stroke: var(--blue-500); @@ -717,6 +728,7 @@ body.product-page { color: var(--primary-color); background-color: transparent; border: 1px solid var(--blue-500); + font-size: 13px; &:hover { background-color: var(--primary-color); @@ -728,6 +740,7 @@ body.product-page { background-color: var(--dark-green-400); color: white; border: 2px solid var(--green-300); + font-size: 13px; &:hover { color: white; @@ -739,6 +752,7 @@ body.product-page { background-color: white; border: 1px solid var(--blue-500); --icon-stroke: var(--blue-500); + font-size: 14px; &:hover { background-color: var(--blue-500); @@ -750,6 +764,7 @@ body.product-page { .remove-wish { background-color: var(--gray-200); position: absolute; + cursor: pointer; top:10px; right: 20px; border-radius: 50%; @@ -877,3 +892,11 @@ body.product-page { .brand-line { color: gray; } + +.btn-next, .btn-prev { + font-size: 14px; +} + +.font-md { + font-size: 14px !important; +} diff --git a/erpnext/templates/generators/item/item_add_to_cart.html b/erpnext/templates/generators/item/item_add_to_cart.html index d42453dacd..d3bc097d8e 100644 --- a/erpnext/templates/generators/item/item_add_to_cart.html +++ b/erpnext/templates/generators/item/item_add_to_cart.html @@ -79,7 +79,7 @@ {% if product_info.price and (cart_settings.allow_items_not_in_stock or product_info.in_stock) %}