Merge branch 'hub-redesign' of https://github.com/frappe/erpnext into hub-redesign
diff --git a/erpnext/public/js/hub/components/item_card.js b/erpnext/public/js/hub/components/item_card.js
index fdf2690..41ab33a 100644
--- a/erpnext/public/js/hub/components/item_card.js
+++ b/erpnext/public/js/hub/components/item_card.js
@@ -7,7 +7,7 @@
const content = strip_html(message.content)
// route
- item.route = `marketplace/buying/${item.hub_item_code}`
+ item.route = `marketplace/buying/${item.name}`
const item_html = `
<div class="col-md-7">
@@ -38,7 +38,7 @@
// 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 448c24a..49a6656 100644
--- a/erpnext/public/js/hub/pages/BuyingMessages.vue
+++ b/erpnext/public/js/hub/pages/BuyingMessages.vue
@@ -45,8 +45,8 @@
}
},
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)
@@ -66,21 +66,21 @@
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 5a23870..2ffbcf3 100644
--- a/erpnext/public/js/hub/pages/Category.vue
+++ b/erpnext/public/js/hub/pages/Category.vue
@@ -24,7 +24,7 @@
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.`)
@@ -50,8 +50,8 @@
})
},
- 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 7019a62..bba2e1d 100644
--- a/erpnext/public/js/hub/pages/Home.vue
+++ b/erpnext/public/js/hub/pages/Home.vue
@@ -32,7 +32,7 @@
data() {
return {
page_name: frappe.get_route()[1],
- item_id_fieldname: 'hub_item_code',
+ item_id_fieldname: 'name',
search_value: '',
sections: [],
@@ -78,8 +78,8 @@
})
},
- 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 80fe8c0..561dab2 100644
--- a/erpnext/public/js/hub/pages/PublishedProducts.vue
+++ b/erpnext/public/js/hub/pages/PublishedProducts.vue
@@ -23,7 +23,7 @@
return {
page_name: frappe.get_route()[1],
items: [],
- item_id_fieldname: 'hub_item_code',
+ item_id_fieldname: 'name',
// Constants
page_title: __('Published Products'),
@@ -46,8 +46,8 @@
})
},
- 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 dd8b026..d55e9dc 100644
--- a/erpnext/public/js/hub/pages/SavedProducts.vue
+++ b/erpnext/public/js/hub/pages/SavedProducts.vue
@@ -25,7 +25,7 @@
return {
page_name: frappe.get_route()[1],
items: [],
- item_id_fieldname: 'hub_item_code',
+ item_id_fieldname: 'name',
// Constants
page_title: __('Saved Products'),
@@ -49,23 +49,23 @@
})
},
- 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(__(`<span>${hub_item_code} removed.
+ alert = frappe.show_alert(__(`<span>${hub_item_name} removed.
<a href="#" data-action="undo-remove"><b>Undo</b></a></span>`),
grace_period/1000,
{
@@ -73,19 +73,19 @@
}
);
- 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(() => {
@@ -97,9 +97,9 @@
},
// 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 fc4aff8..809f8c2 100644
--- a/erpnext/public/js/hub/pages/Search.vue
+++ b/erpnext/public/js/hub/pages/Search.vue
@@ -31,7 +31,7 @@
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 ...'),
@@ -61,8 +61,8 @@
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 9fa2042..86d75b8 100644
--- a/erpnext/public/js/hub/pages/Seller.vue
+++ b/erpnext/public/js/hub/pages/Seller.vue
@@ -45,7 +45,7 @@
profile: null,
items:[],
- item_id_fieldname: 'hub_item_code',
+ item_id_fieldname: 'name',
title: null,
image: null,
@@ -94,8 +94,8 @@
});
},
- 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 f15d1be..c77f57b 100644
--- a/erpnext/public/js/hub/pages/item.js
+++ b/erpnext/public/js/hub/pages/item.js
@@ -6,11 +6,11 @@
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 @@
}
- 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 @@
$(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 @@
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 @@
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 @@
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(() => {});
}