diff --git a/erpnext/public/js/hub/marketplace.js b/erpnext/public/js/hub/marketplace.js index 78cf8468e7..a230c2ca08 100644 --- a/erpnext/public/js/hub/marketplace.js +++ b/erpnext/public/js/hub/marketplace.js @@ -105,7 +105,6 @@ erpnext.hub.Marketplace = class Marketplace { make_body() { this.$body = this.$parent.find('.layout-main-section'); - this.$body.on('seller-registered', () => { this.registered = 1; this.make_sidebar_nav_buttons(); @@ -138,6 +137,10 @@ erpnext.hub.Marketplace = class Marketplace { this.subpages.favourites = new erpnext.hub.Favourites(this.$body); } + if (route[1] === 'search' && route[2] && !this.subpages.search) { + this.subpages.search = new erpnext.hub.SearchPage(this.$body); + } + if (route[1] === 'category' && route[2] && !this.subpages.category) { this.subpages.category = new erpnext.hub.Category(this.$body); } @@ -182,6 +185,16 @@ class SubPage { constructor(parent, options) { this.$parent = $(parent); this.make_wrapper(options); + + // handle broken images after every render + if (this.render) { + this._render = this.render.bind(this); + + this.render = (...args) => { + this._render(...args); + frappe.dom.handle_broken_images(this.$wrapper); + } + } } make_wrapper() { @@ -203,7 +216,10 @@ class SubPage { erpnext.hub.Home = class Home extends SubPage { make_wrapper() { super.make_wrapper(); - this.make_search_bar(); + + make_search_bar(this.$wrapper, keyword => { + frappe.set_route('marketplace', 'search', keyword); + }); } refresh() { @@ -222,26 +238,9 @@ erpnext.hub.Home = class Home extends SubPage { return hub.call('get_data_for_homepage'); } - make_search_bar() { - const $search = $(` -