diff --git a/erpnext/hub_node/__init__.py b/erpnext/hub_node/__init__.py index c8e40eb8e81..5c86bb927c1 100644 --- a/erpnext/hub_node/__init__.py +++ b/erpnext/hub_node/__init__.py @@ -34,9 +34,14 @@ def get_list(doctype, start=0, limit=20, fields=["*"], filters="{}", order_by=No #### LOCAL ITEMS @frappe.whitelist() def get_valid_items(search_value=''): - items = frappe.get_list('Item', fields=["*"], filters={ - 'item_name': ['like', '%' + search_value + '%'] - }) + items = frappe.get_list( + 'Item', fields=["*"], + filters={ + 'item_name': ['like', '%' + search_value + '%'], + 'publish_in_hub': 0 + }, + order_by="modified desc" + ) valid_items = filter(lambda x: x.image and x.description, items) @@ -52,9 +57,6 @@ def publish_selected_items(items_to_publish, items_to_unpublish): for item_code in json.loads(items_to_publish): frappe.db.set_value('Item', item_code, 'publish_in_hub', 1) - for item_code in json.loads(items_to_unpublish): - frappe.db.set_value('Item', item_code, 'publish_in_hub', 0) - hub_settings = frappe.get_doc('Hub Settings') hub_settings.sync() diff --git a/erpnext/public/js/hub/hub_listing.js b/erpnext/public/js/hub/hub_listing.js index eb558067841..6d0f3e96ac5 100644 --- a/erpnext/public/js/hub/hub_listing.js +++ b/erpnext/public/js/hub/hub_listing.js @@ -137,11 +137,14 @@ erpnext.hub.Marketplace = class Marketplace { this.subpages.register = new erpnext.hub.Register(this.$body); } + if (route[1] === 'profile' && !this.subpages.profile) { + this.subpages.profile = new erpnext.hub.Profile(this.$body, this.hub_settings); + } + if (route[1] === 'publish' && !this.subpages.publish) { this.subpages.publish = new erpnext.hub.Publish(this.$body); } - if (!Object.keys(this.subpages).includes(route[1])) { frappe.show_not_found(); return; @@ -572,6 +575,51 @@ erpnext.hub.Register = class Register extends SubPage { } } +erpnext.hub.Profile = class Profile extends SubPage { + constructor(parent, profile_data) { + super(parent); + this.profile_data = profile_data; + } + + make_wrapper() { + super.make_wrapper(); + const profile_html = `
${'where'}${'dot_spacer'}${'when'}
+${'rating_html'}${'rating_count'}
+${'description'}
+ ` : __('No description') + } +