From 239b351367ebadf80f1462aff45e8a634903324b Mon Sep 17 00:00:00 2001 From: Kanchan Chauhan Date: Mon, 2 May 2016 11:43:44 +0530 Subject: [PATCH] New look to the website --- .../doctype/sales_invoice/sales_invoice.py | 9 +- .../homepage_featured_product.json | 2 +- erpnext/projects/doctype/project/project.py | 3 +- erpnext/public/css/website.css | 103 +++++++++++++- erpnext/public/js/shopping_cart.js | 30 ++-- erpnext/public/less/website.less | 130 +++++++++++++++++- .../setup/doctype/item_group/item_group.py | 2 +- erpnext/shopping_cart/cart.py | 17 ++- .../doctype/delivery_note/delivery_note.py | 9 +- erpnext/stock/doctype/item/item.py | 3 +- erpnext/support/doctype/issue/issue.py | 5 +- erpnext/templates/generators/item.html | 10 +- erpnext/templates/generators/item_group.html | 5 +- erpnext/templates/includes/cart.css | 32 ----- erpnext/templates/includes/cart.js | 19 +++ .../templates/includes/cart/cart_address.html | 7 +- .../includes/cart/cart_dropdown.html | 26 ++++ .../templates/includes/cart/cart_items.html | 47 ++++--- erpnext/templates/includes/issue_row.html | 8 +- erpnext/templates/includes/macros.html | 3 +- .../includes/navbar/navbar_items.html | 12 ++ .../includes/order/order_macros.html | 17 ++- .../templates/includes/products_as_grid.html | 6 +- erpnext/templates/includes/projects.css | 5 +- .../templates/includes/transaction_row.html | 16 +-- erpnext/templates/pages/cart.html | 106 +++++++------- erpnext/templates/pages/home.html | 40 +++--- erpnext/templates/pages/home.py | 35 +---- erpnext/templates/pages/order.html | 3 + erpnext/templates/pages/projects.html | 29 ++-- erpnext/templates/pages/projects.py | 4 +- erpnext/utilities/doctype/address/address.py | 3 +- 32 files changed, 508 insertions(+), 238 deletions(-) create mode 100644 erpnext/templates/includes/cart/cart_dropdown.html create mode 100644 erpnext/templates/includes/navbar/navbar_items.html diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py index c241288d0e..3120e73176 100644 --- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py +++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py @@ -667,9 +667,12 @@ class SalesInvoice(SellingController): def get_list_context(context=None): from erpnext.controllers.website_list_for_contact import get_list_context list_context = get_list_context(context) - list_context["title"] = _("My Invoices") - list_context["show_sidebar"] = True - list_context["show_search"] = True + list_context.update({ + 'show_sidebar': True, + 'show_search': True, + 'no_breadcrumbs': True, + 'title': _('Invoices'), + }) return list_context @frappe.whitelist() diff --git a/erpnext/portal/doctype/homepage_featured_product/homepage_featured_product.json b/erpnext/portal/doctype/homepage_featured_product/homepage_featured_product.json index fe93098d12..81c75c648d 100644 --- a/erpnext/portal/doctype/homepage_featured_product/homepage_featured_product.json +++ b/erpnext/portal/doctype/homepage_featured_product/homepage_featured_product.json @@ -257,7 +257,7 @@ "issingle": 0, "istable": 1, "max_attachments": 0, - "modified": "2016-04-22 05:57:06.261401", + "modified": "2016-04-25 15:51:52.811124", "modified_by": "Administrator", "module": "Portal", "name": "Homepage Featured Product", diff --git a/erpnext/projects/doctype/project/project.py b/erpnext/projects/doctype/project/project.py index 2cca7e2dc9..4f78a592d1 100644 --- a/erpnext/projects/doctype/project/project.py +++ b/erpnext/projects/doctype/project/project.py @@ -174,7 +174,8 @@ def get_list_context(context=None): return { "show_sidebar": True, "show_search": True, - "title": _("My Projects"), + 'no_breadcrumbs': True, + "title": _("Projects"), "get_list": get_project_list, "row_template": "templates/includes/projects/project_row.html" } diff --git a/erpnext/public/css/website.css b/erpnext/public/css/website.css index 25d08f615f..8566c5cbc2 100644 --- a/erpnext/public/css/website.css +++ b/erpnext/public/css/website.css @@ -80,7 +80,6 @@ background-color: #fafbfc; } .transaction-list-item .indicator { - font-size: inherit; font-weight: inherit; color: #8D99A6; margin-left: -15px; @@ -126,6 +125,75 @@ border-top: 1px solid #d1d8dd; padding-top: 15px; } +.cart-container { + margin: 50px 0px; +} +.cart-container .cart-item-header .h6 { + padding: 7px 15px; +} +.cart-container .cart-items { + margin: 30px 0px 0px; +} +.cart-container .cart-item-table { + margin: 0px -15px; +} +.cart-container .cart-item-header { + border-bottom: 1px solid #d1d8dd; +} +.cart-container .cart-image-col { + padding-right: 0px; +} +.cart-container .cart-image { + max-width: 55px; + max-height: 55px; + margin-top: -5px; +} +.cart-container .cart-taxes { + margin-top: 30px; +} +.cart-container .cart-taxes .row { + margin-top: 15px; +} +.cart-container .tax-grand-total-row { + border-top: 1px solid #d1d8dd; + padding-top: 15px; +} +.cart-container .cart-addresses { + margin-top: 50px; +} +.cart-items .cart-dropdown, +.item_name_dropdown { + display: none; +} +.cart-dropdown-container { + width: 350px; + padding: 15px; +} +.cart-dropdown-container .item-price { + display: block !important; + padding-bottom: 10px; +} +.cart-dropdown-container .cart-item-header { + border-bottom: 1px solid #d1d8dd; +} +.cart-dropdown-container .cart-items .cart-dropdown { + display: block; + margin-top: 15px; +} +.cart-dropdown-container .item_name_dropdown { + display: block; +} +.cart-dropdown-container .item-description, +.cart-dropdown-container .cart-items .checkout, +.cart-dropdown-container .item_name_and_description { + display: none; +} +.cart-dropdown-container .checkout-btn { + margin: 15px; +} +.cart-dropdown-container .col-name-description { + margin-bottom: 8px; +} .product-list-link .row { border-bottom: 1px solid #EBEFF2; } @@ -147,3 +215,36 @@ max-width: 350px; } } +.item-group-content { + margin-top: 30px; +} +.product-image-img { + border: 1px solid #EBEFF2; + border-radius: 3px; +} +.product-text { + border-top: 1px solid #EBEFF2; + padding: 15px; + word-wrap: break-word; + height: 75px; +} +.product-image-wrapper { + padding-bottom: 30px; +} +.featured-product-heading, +.all-products { + text-transform: uppercase; + letter-spacing: 0.5px; + font-size: 12px; + font-weight: 500; +} +.all-products { + font-weight: 300; + padding-left: 25px; + padding-right: 25px; + padding-top: 10px; + padding-bottom: 10px; +} +.homepage-tagline { + font-size: 40px !important; +} diff --git a/erpnext/public/js/shopping_cart.js b/erpnext/public/js/shopping_cart.js index a3f7d3f0c6..c09e3838d2 100644 --- a/erpnext/public/js/shopping_cart.js +++ b/erpnext/public/js/shopping_cart.js @@ -12,6 +12,19 @@ frappe.ready(function() { } // update login shopping_cart.set_cart_count(); + + $(".shopping-cart").on('shown.bs.dropdown', function() { + if (!$('.shopping-cart-menu .cart-container').length) { + return frappe.call({ + method: 'erpnext.shopping_cart.cart.get_shopping_cart_menu', + callback: function(r) { + if (r.message) { + $('.shopping-cart-menu').html(r.message); + } + } + }); + } + }); }); $.extend(shopping_cart, { @@ -32,7 +45,11 @@ $.extend(shopping_cart, { }, btn: opts.btn, callback: function(r) { - shopping_cart.set_cart_count(); + shopping_cart.set_cart_count(); + if (r.message.shopping_cart_menu) { + $('.shopping-cart-menu').html(r.message.shopping_cart_menu); + } + if(opts.callback) opts.callback(r); } @@ -43,14 +60,9 @@ $.extend(shopping_cart, { set_cart_count: function() { var cart_count = getCookie("cart_count"); - if($(".cart-icon").length == 0) { - $('
\ - \ - Cart\ - 5\ -
').appendTo($('.shopping-cart')) - } + if(cart_count) { + $(".shopping-cart").toggle(true); + } var $cart = $('.cart-icon'); var $badge = $cart.find("#cart-count"); diff --git a/erpnext/public/less/website.less b/erpnext/public/less/website.less index 0246caccd5..894340e9b5 100644 --- a/erpnext/public/less/website.less +++ b/erpnext/public/less/website.less @@ -94,7 +94,6 @@ } .indicator { - font-size: inherit; font-weight: inherit; color: @text-muted; margin-left: -15px; @@ -161,6 +160,95 @@ } } +.cart-container { + margin: 50px 0px; + + .cart-item-header .h6 { + padding: 7px 15px; + } + + .cart-items { + margin: 30px 0px 0px; + } + + .cart-item-table { + margin: 0px -15px; + } + + .cart-item-header { + border-bottom: 1px solid #d1d8dd; + } + + .cart-image-col { + padding-right: 0px; + } + + .cart-image { + max-width: 55px; + max-height: 55px; + margin-top: -5px; + } + + .cart-taxes { + margin-top: 30px; + + .row { + margin-top: 15px; + } + } + + .tax-grand-total-row { + border-top: 1px solid @border-color; + padding-top: 15px; + } + + .cart-addresses { + margin-top: 50px; + } +} + +.cart-items .cart-dropdown, +.item_name_dropdown { + display:none; + +} +.cart-dropdown-container { + width: 350px; + padding: 15px; + + .item-price { + display: block !important; + padding-bottom: 10px; + } + + .cart-item-header { + border-bottom: 1px solid #d1d8dd; + } + + .cart-items .cart-dropdown { + display:block; + margin-top:15px; + } + + .item_name_dropdown { + display:block; + } + + .item-description, + .cart-items .checkout, + .item_name_and_description { + display: none; + } + + .checkout-btn { + margin:15px; + } + .col-name-description { + margin-bottom:8px; + } + +} + .product-list-link { .row { border-bottom: 1px solid @light-border-color; @@ -189,3 +277,43 @@ max-width: 350px; } } + +.item-group-content { + margin-top: 30px; +} + +.product-image-img { + border: 1px solid @light-border-color; + border-radius: 3px; +} + +.product-text { + border-top: 1px solid @light-border-color; + padding: 15px; + word-wrap: break-word; + height: 75px; +} + +.product-image-wrapper { + padding-bottom: 30px; +} + + +.featured-product-heading, .all-products { + text-transform: uppercase; + letter-spacing: 0.5px; + font-size: 12px; + font-weight: 500; +} + +.all-products { + font-weight: 300; + padding-left: 25px; + padding-right: 25px; + padding-top: 10px; + padding-bottom: 10px; +} + +.homepage-tagline { + font-size:40px !important; +} \ No newline at end of file diff --git a/erpnext/setup/doctype/item_group/item_group.py b/erpnext/setup/doctype/item_group/item_group.py index 4b26cfc347..d7dae6809a 100644 --- a/erpnext/setup/doctype/item_group/item_group.py +++ b/erpnext/setup/doctype/item_group/item_group.py @@ -58,7 +58,7 @@ class ItemGroup(NestedSet, WebsiteGenerator): if start < 0: start = 0 context.update({ - "items": get_product_list_for_group(product_group = self.name, start=start, limit=24, search=frappe.form_dict.get("q")), + "items": get_product_list_for_group(product_group = self.name, start=start, limit=24, search=frappe.form_dict.get("search")), "parent_groups": get_parent_item_groups(self.name), "title": self.name, "products_as_list": cint(frappe.db.get_single_value('Website Settings', 'products_as_list')) diff --git a/erpnext/shopping_cart/cart.py b/erpnext/shopping_cart/cart.py index 2c3257e694..c85dd8f6c0 100644 --- a/erpnext/shopping_cart/cart.py +++ b/erpnext/shopping_cart/cart.py @@ -92,8 +92,9 @@ def update_cart(item_code, qty, with_items=False): set_cart_count(quotation) - if with_items: - context = get_cart_quotation(quotation) + context = get_cart_quotation(quotation) + + if cint(with_items): return { "items": frappe.render_template("templates/includes/cart/cart_items.html", context), @@ -101,7 +102,17 @@ def update_cart(item_code, qty, with_items=False): context), } else: - return quotation.name + return { + 'name': quotation.name, + 'shopping_cart_menu': get_shopping_cart_menu(context) + } + +@frappe.whitelist() +def get_shopping_cart_menu(context=None): + if not context: + context = get_cart_quotation() + + return frappe.render_template('templates/includes/cart/cart_dropdown.html', context) @frappe.whitelist() def update_cart_address(address_fieldname, address_name): diff --git a/erpnext/stock/doctype/delivery_note/delivery_note.py b/erpnext/stock/doctype/delivery_note/delivery_note.py index 79a4ea6146..6c6a3b3c97 100644 --- a/erpnext/stock/doctype/delivery_note/delivery_note.py +++ b/erpnext/stock/doctype/delivery_note/delivery_note.py @@ -329,9 +329,12 @@ def update_billed_amount_based_on_so(so_detail, update_modified=True): def get_list_context(context=None): from erpnext.controllers.website_list_for_contact import get_list_context list_context = get_list_context(context) - list_context["title"] = _("My Shipments") - list_context["show_sidebar"] = True - list_context["show_search"] = True + list_context.update({ + 'show_sidebar': True, + 'show_search': True, + 'no_breadcrumbs': True, + 'title': _('Shipments'), + }) return list_context def get_invoiced_qty_map(delivery_note): diff --git a/erpnext/stock/doctype/item/item.py b/erpnext/stock/doctype/item/item.py index 114bbabc6e..de40a20667 100644 --- a/erpnext/stock/doctype/item/item.py +++ b/erpnext/stock/doctype/item/item.py @@ -147,7 +147,8 @@ class Item(WebsiteGenerator): file = frappe.get_all("File", filters={ "file_url": self.website_image }, fields=["name", "is_private"], order_by="is_private asc", limit_page_length=1) - + + if file: file = file[0] diff --git a/erpnext/support/doctype/issue/issue.py b/erpnext/support/doctype/issue/issue.py index fcc1edf71e..ab8e6d8a97 100644 --- a/erpnext/support/doctype/issue/issue.py +++ b/erpnext/support/doctype/issue/issue.py @@ -55,11 +55,12 @@ class Issue(Document): def get_list_context(context=None): return { - "title": _("My Issues"), + "title": _("Issues"), "get_list": get_issue_list, "row_template": "templates/includes/issue_row.html", "show_sidebar": True, - "show_search": True + "show_search": True, + 'no_breadcrumbs': True } def get_issue_list(doctype, txt, filters, limit_start, limit_page_length=20): diff --git a/erpnext/templates/generators/item.html b/erpnext/templates/generators/item.html index dabbf48082..e074fa3cfa 100644 --- a/erpnext/templates/generators/item.html +++ b/erpnext/templates/generators/item.html @@ -52,8 +52,10 @@
-

-
+
+

+
+
-

{{ _("DESCRIPTION") }}

+
{{ _("Description") }}
{{ web_long_description or description or _("No description given") }}
@@ -81,7 +83,7 @@ {% if website_specifications -%}
-

{{ _("SPECIFICATIONS") }}

+
{{ _("Specifications") }}
{% for d in website_specifications -%} diff --git a/erpnext/templates/generators/item_group.html b/erpnext/templates/generators/item_group.html index d01426373b..b9926d6433 100644 --- a/erpnext/templates/generators/item_group.html +++ b/erpnext/templates/generators/item_group.html @@ -1,8 +1,5 @@ {% extends "templates/web.html" %} -{#{% block header_actions %} -{% include 'templates/includes/product_search_box.html' %} -{% endblock %}#} {% block header %}

{{ _("Products") }}

{% endblock %} {% block breadcrumbs %}