From dc7e8e6a264279ddd88f1eed7fbff9e9b84672e0 Mon Sep 17 00:00:00 2001 From: Suraj Shetty Date: Mon, 27 Aug 2018 14:11:48 +0530 Subject: [PATCH] Replace hub_item_code -> hub_item_name --- erpnext/public/js/hub/components/item_card.js | 4 ++-- .../public/js/hub/pages/BuyingMessages.vue | 14 +++++------ erpnext/public/js/hub/pages/Category.vue | 6 ++--- erpnext/public/js/hub/pages/Home.vue | 6 ++--- .../public/js/hub/pages/PublishedProducts.vue | 6 ++--- erpnext/public/js/hub/pages/SavedProducts.vue | 24 +++++++++---------- erpnext/public/js/hub/pages/Search.vue | 6 ++--- erpnext/public/js/hub/pages/Seller.vue | 6 ++--- erpnext/public/js/hub/pages/item.js | 18 +++++++------- 9 files changed, 45 insertions(+), 45 deletions(-) diff --git a/erpnext/public/js/hub/components/item_card.js b/erpnext/public/js/hub/components/item_card.js index fdf2690be8..41ab33aaf9 100644 --- a/erpnext/public/js/hub/components/item_card.js +++ b/erpnext/public/js/hub/components/item_card.js @@ -7,7 +7,7 @@ function get_buying_item_message_card_html(item) { const content = strip_html(message.content) // route - item.route = `marketplace/buying/${item.hub_item_code}` + item.route = `marketplace/buying/${item.name}` const item_html = `
@@ -38,7 +38,7 @@ function get_selling_item_message_card_html(item) { // route if (!item.route) { - item.route = `marketplace/item/${item.hub_item_code}` + item.route = `marketplace/item/${item.name}` } let received_messages = ''; diff --git a/erpnext/public/js/hub/pages/BuyingMessages.vue b/erpnext/public/js/hub/pages/BuyingMessages.vue index 63a746a459..6f1a4c5569 100644 --- a/erpnext/public/js/hub/pages/BuyingMessages.vue +++ b/erpnext/public/js/hub/pages/BuyingMessages.vue @@ -47,8 +47,8 @@ export default { } }, created() { - const hub_item_code = this.get_hub_item_code(); - this.get_item_details(hub_item_code) + const hub_item_name = this.get_hub_item_name(); + this.get_item_details(hub_item_name) .then(item_details => { this.item_details = item_details; this.get_messages(item_details) @@ -68,21 +68,21 @@ export default { hub.call('send_message', { from_seller: hub.settings.company_email, to_seller: this.item_details.hub_seller, - hub_item: this.item_details.hub_item_code, + hub_item: this.item_details.name, message }); }, - get_item_details(hub_item_code) { - return hub.call('get_item_details', { hub_item_code }) + get_item_details(hub_item_name) { + return hub.call('get_item_details', { hub_item_name }) }, get_messages() { if (!this.item_details) return []; return hub.call('get_messages', { against_seller: this.item_details.hub_seller, - against_item: this.item_details.hub_item_code + against_item: this.item_details.name }); }, - get_hub_item_code() { + get_hub_item_name() { return frappe.get_route()[2]; } } diff --git a/erpnext/public/js/hub/pages/Category.vue b/erpnext/public/js/hub/pages/Category.vue index 2a521f4025..c11972dea1 100644 --- a/erpnext/public/js/hub/pages/Category.vue +++ b/erpnext/public/js/hub/pages/Category.vue @@ -29,7 +29,7 @@ export default { page_name: frappe.get_route()[1], category: frappe.get_route()[2], items: [], - item_id_fieldname: 'hub_item_code', + item_id_fieldname: 'name', // Constants empty_state_message: __(`No products in this category yet.`) @@ -55,8 +55,8 @@ export default { }) }, - go_to_item_details_page(hub_item_code) { - frappe.set_route(`marketplace/item/${hub_item_code}`); + go_to_item_details_page(hub_item_name) { + frappe.set_route(`marketplace/item/${hub_item_name}`); } } } diff --git a/erpnext/public/js/hub/pages/Home.vue b/erpnext/public/js/hub/pages/Home.vue index 1d1973caf9..d09058d77e 100644 --- a/erpnext/public/js/hub/pages/Home.vue +++ b/erpnext/public/js/hub/pages/Home.vue @@ -41,7 +41,7 @@ export default { data() { return { page_name: frappe.get_route()[1], - item_id_fieldname: 'hub_item_code', + item_id_fieldname: 'name', search_value: '', sections: [], @@ -87,8 +87,8 @@ export default { }) }, - go_to_item_details_page(hub_item_code) { - frappe.set_route(`marketplace/item/${hub_item_code}`); + go_to_item_details_page(hub_item_name) { + frappe.set_route(`marketplace/item/${hub_item_name}`); }, set_search_route() { diff --git a/erpnext/public/js/hub/pages/PublishedProducts.vue b/erpnext/public/js/hub/pages/PublishedProducts.vue index db9057da49..586d7019cc 100644 --- a/erpnext/public/js/hub/pages/PublishedProducts.vue +++ b/erpnext/public/js/hub/pages/PublishedProducts.vue @@ -28,7 +28,7 @@ export default { return { page_name: frappe.get_route()[1], items: [], - item_id_fieldname: 'hub_item_code', + item_id_fieldname: 'name', // Constants page_title: __('Published Products'), @@ -51,8 +51,8 @@ export default { }) }, - go_to_item_details_page(hub_item_code) { - frappe.set_route(`marketplace/item/${hub_item_code}`); + go_to_item_details_page(hub_item_name) { + frappe.set_route(`marketplace/item/${hub_item_name}`); } } } diff --git a/erpnext/public/js/hub/pages/SavedProducts.vue b/erpnext/public/js/hub/pages/SavedProducts.vue index f113a20c27..e83bfd593a 100644 --- a/erpnext/public/js/hub/pages/SavedProducts.vue +++ b/erpnext/public/js/hub/pages/SavedProducts.vue @@ -27,7 +27,7 @@ export default { return { page_name: frappe.get_route()[1], items: [], - item_id_fieldname: 'hub_item_code', + item_id_fieldname: 'name', // Constants page_title: __('Saved Products'), @@ -54,23 +54,23 @@ export default { }) }, - go_to_item_details_page(hub_item_code) { - frappe.set_route(`marketplace/item/${hub_item_code}`); + go_to_item_details_page(hub_item_name) { + frappe.set_route(`marketplace/item/${hub_item_name}`); }, - on_item_remove(hub_item_code) { + on_item_remove(hub_item_name) { const grace_period = 5000; let reverted = false; let alert; const undo_remove = () => { - this.toggle_item(hub_item_code);; + this.toggle_item(hub_item_name);; reverted = true; alert.hide(); return false; } - alert = frappe.show_alert(__(`${hub_item_code} removed. + alert = frappe.show_alert(__(`${hub_item_name} removed. Undo`), grace_period/1000, { @@ -78,19 +78,19 @@ export default { } ); - this.toggle_item(hub_item_code, false); + this.toggle_item(hub_item_name, false); setTimeout(() => { if(!reverted) { - this.remove_item_from_saved_products(hub_item_code); + this.remove_item_from_saved_products(hub_item_name); } }, grace_period); }, - remove_item_from_saved_products(hub_item_code) { + remove_item_from_saved_products(hub_item_name) { erpnext.hub.trigger('action:item_favourite'); hub.call('remove_item_from_seller_favourites', { - hub_item_code, + hub_item_name, hub_seller: hub.settings.company_email }) .then(() => { @@ -102,9 +102,9 @@ export default { }, // By default show - toggle_item(hub_item_code, show=true) { + toggle_item(hub_item_name, show=true) { this.items = this.items.map(item => { - if(item.hub_item_code === hub_item_code) { + if(item.name === hub_item_name) { item.seen = show; } return item; diff --git a/erpnext/public/js/hub/pages/Search.vue b/erpnext/public/js/hub/pages/Search.vue index a7fbffcbfd..b9ddc0d399 100644 --- a/erpnext/public/js/hub/pages/Search.vue +++ b/erpnext/public/js/hub/pages/Search.vue @@ -38,7 +38,7 @@ export default { page_name: frappe.get_route()[1], items: [], search_value: frappe.get_route()[2], - item_id_fieldname: 'hub_item_code', + item_id_fieldname: 'name', // Constants search_placeholder: __('Search for anything ...'), @@ -68,8 +68,8 @@ export default { this.get_items(); }, - go_to_item_details_page(hub_item_code) { - frappe.set_route(`marketplace/item/${hub_item_code}`); + go_to_item_details_page(hub_item_name) { + frappe.set_route(`marketplace/item/${hub_item_name}`); } } } diff --git a/erpnext/public/js/hub/pages/Seller.vue b/erpnext/public/js/hub/pages/Seller.vue index 5a35812ccb..04c9de1c49 100644 --- a/erpnext/public/js/hub/pages/Seller.vue +++ b/erpnext/public/js/hub/pages/Seller.vue @@ -43,7 +43,7 @@ export default { profile: null, items:[], - item_id_fieldname: 'hub_item_code', + item_id_fieldname: 'name', title: null, subtitles: [], @@ -89,8 +89,8 @@ export default { }); }, - go_to_item_details_page(hub_item_code) { - frappe.set_route(`marketplace/item/${hub_item_code}`); + go_to_item_details_page(hub_item_name) { + frappe.set_route(`marketplace/item/${hub_item_name}`); } } } diff --git a/erpnext/public/js/hub/pages/item.js b/erpnext/public/js/hub/pages/item.js index f15d1be635..c77f57bad1 100644 --- a/erpnext/public/js/hub/pages/item.js +++ b/erpnext/public/js/hub/pages/item.js @@ -6,11 +6,11 @@ import { get_review_html } from '../components/reviews'; erpnext.hub.Item = class Item extends SubPage { refresh() { this.show_skeleton(); - this.hub_item_code = frappe.get_route()[2]; + this.hub_item_name = frappe.get_route()[2]; this.own_item = false; - this.get_item(this.hub_item_code) + this.get_item(this.hub_item_name) .then(item => { this.own_item = item.hub_seller === hub.settings.company_email; this.item = item; @@ -24,9 +24,9 @@ erpnext.hub.Item = class Item extends SubPage { } - get_item(hub_item_code) { + get_item(hub_item_name) { return hub.call('get_item_details', { - hub_item_code + hub_item_name }); } @@ -72,7 +72,7 @@ erpnext.hub.Item = class Item extends SubPage { $(favourite_button).addClass('disabled'); hub.call('add_item_to_seller_favourites', { - hub_item_code: this.hub_item_code, + hub_item_name: this.hub_item_name, hub_seller: hub.settings.company_email }) .then(() => { @@ -108,12 +108,12 @@ erpnext.hub.Item = class Item extends SubPage { hub.call('send_message', { from_seller: hub.settings.company_email, to_seller: this.item.hub_seller, - hub_item: this.item.hub_item_code, + hub_item: this.item.hub_item_name, message }) .then(() => { d.hide(); - frappe.set_route('marketplace', 'buy', this.item.hub_item_code); + frappe.set_route('marketplace', 'buy', this.item.hub_item_name); erpnext.hub.trigger('action:send_message') }); } @@ -145,7 +145,7 @@ erpnext.hub.Item = class Item extends SubPage { values.username = frappe.session.user_fullname; hub.call('add_item_review', { - hub_item_code: this.hub_item_code, + hub_item_name: this.hub_item_name, review: JSON.stringify(values) }) .then(this.push_review_in_review_area.bind(this)); @@ -162,7 +162,7 @@ erpnext.hub.Item = class Item extends SubPage { get_reviews() { - return hub.call('get_item_reviews', { hub_item_code: this.hub_item_code }).catch(() => {}); + return hub.call('get_item_reviews', { hub_item_name: this.hub_item_name }).catch(() => {}); }