From 09e46a4e5fd4bb8d9ef994fed8bd8c08783dcdf4 Mon Sep 17 00:00:00 2001 From: Prateeksha Singh Date: Wed, 30 May 2018 15:12:20 +0530 Subject: [PATCH] Hub fixes (#14281) * [hub] remove list freeze * [hub] fix svg in icon * [hub] implement route options in hub list view --- erpnext/public/images/hub_logo.svg | 119 ++++++++++++++++++++++----- erpnext/public/js/hub/hub_factory.js | 11 ++- erpnext/public/js/hub/hub_listing.js | 32 +++---- 3 files changed, 119 insertions(+), 43 deletions(-) diff --git a/erpnext/public/images/hub_logo.svg b/erpnext/public/images/hub_logo.svg index 1612c6da11..4af482176e 100644 --- a/erpnext/public/images/hub_logo.svg +++ b/erpnext/public/images/hub_logo.svg @@ -1,37 +1,112 @@ + + + + viewBox="0 0 87.312496 91.397155" + version="1.1" + id="svg4635" + inkscape:version="0.92.2 5c3e80d, 2017-08-06" + sodipodi:docname="hub-logo.svg" + inkscape:export-filename="/home/raghu/Desktop/hub-logo.png" + inkscape:export-xdpi="95.878258" + inkscape:export-ydpi="95.878258"> + + + + + + image/svg+xml + + + + + + + + + + + + + + + inkscape:label="Layer 1" + inkscape:groupmode="layer" + id="layer1" + transform="translate(121.51931,-138.66452)"> + id="rect828" + width="87.3125" + height="87.3125" + x="-121.51931" + y="142.74918" + ry="13.229166" /> + id="path830" + inkscape:connector-curvature="0" /> + id="path832" + inkscape:connector-curvature="0" /> + style="opacity:1;vector-effect:none;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:0.79375005;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:normal" + inkscape:connector-curvature="0" /> + id="path838" + inkscape:connector-curvature="0" /> diff --git a/erpnext/public/js/hub/hub_factory.js b/erpnext/public/js/hub/hub_factory.js index 01f55a3c6c..6451e1d6a9 100644 --- a/erpnext/public/js/hub/hub_factory.js +++ b/erpnext/public/js/hub/hub_factory.js @@ -35,7 +35,7 @@ frappe.views.HubFactory = frappe.views.Factory.extend({ }); } }); - } else { + } else if (!route[3]){ frappe.require(assets['Form'], () => { erpnext.hub.pages[page_name] = new erpnext.hub[page+'Page']({ unique_id: route[2], @@ -44,6 +44,15 @@ frappe.views.HubFactory = frappe.views.Factory.extend({ hub_settings: this.hub_settings }); }); + } else { + frappe.require(assets['List'], () => { + frappe.route_options = {}; + frappe.route_options["company_name"] = route[2] + erpnext.hub.pages[page_name] = new erpnext.hub['ItemListing']({ + parent: this.make_page(true, page_name), + hub_settings: this.hub_settings + }); + }); } window.hub_page = erpnext.hub.pages[page_name]; } else { diff --git a/erpnext/public/js/hub/hub_listing.js b/erpnext/public/js/hub/hub_listing.js index a979d287e6..237efe614e 100644 --- a/erpnext/public/js/hub/hub_listing.js +++ b/erpnext/public/js/hub/hub_listing.js @@ -58,12 +58,7 @@ erpnext.hub.HubListing = class HubListing extends frappe.views.BaseList { label: __('Favourites'), action: () => frappe.set_route('Hub', 'Favourites'), standard: true - }, - // { - // label: __('Toggle Sidebar'), - // action: () => this.toggle_side_bar(), - // standard: true - // } + } ]; return items; @@ -85,7 +80,15 @@ erpnext.hub.HubListing = class HubListing extends frappe.views.BaseList { }); } - setup_view() { } + setup_view() { + if(frappe.route_options){ + const filters = []; + for (let field in frappe.route_options) { + var value = frappe.route_options[field]; + this.page.fields_dict[field].set_value(value); + } + } + } get_args() { return { @@ -110,18 +113,7 @@ erpnext.hub.HubListing = class HubListing extends frappe.views.BaseList { this.data_dict = {}; } - freeze(toggle) { - // if(!this.$freeze) return; - // this.$freeze.toggle(toggle); - // if (this.$freeze.find('.image-view-container').length) return; - - // const html = Array.from(new Array(4)).map(d => this.card_html({ - // name: 'Loading...', - // item_name: 'Loading...' - // })).join(''); - - // this.$freeze.html(`
${html}
`); - } + freeze(toggle) { } render() { this.data_dict = {}; @@ -529,7 +521,7 @@ erpnext.hub.ItemListing = class ItemListing extends erpnext.hub.HubListing { (${reviewLength})
-

${ company_name }

+

${ company_name }