brotherton-erpnext/erpnext/public/js/hub/hub_factory.js

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

35 lines
831 B
JavaScript
Raw Normal View History

frappe.provide('erpnext.hub');
2017-12-10 16:32:41 +00:00
frappe.views.MarketplaceFactory = class MarketplaceFactory extends frappe.views.Factory {
show() {
is_marketplace_disabled()
.then(disabled => {
if (disabled) {
frappe.show_not_found('Marketplace');
return;
}
if (frappe.pages.marketplace) {
frappe.container.change_to('marketplace');
erpnext.hub.marketplace.refresh();
} else {
this.make('marketplace');
}
});
}
2017-12-10 16:32:41 +00:00
make(page_name) {
2021-05-07 09:23:42 +00:00
frappe.require('marketplace.bundle.js', () => {
erpnext.hub.marketplace = new erpnext.hub.Marketplace({
parent: this.make_page(true, page_name)
});
2018-02-15 04:47:07 +00:00
});
2018-07-25 11:21:01 +00:00
}
2018-08-29 08:57:47 +00:00
};
function is_marketplace_disabled() {
return frappe.call({
method: "erpnext.hub_node.doctype.marketplace_settings.marketplace_settings.is_marketplace_enabled"
}).then(r => r.message)
}