Merge branch 'hub-redesign' of https://github.com/frappe/erpnext into hub-redesign

This commit is contained in:
Faris Ansari 2018-08-30 14:36:14 +05:30
commit 6b695d32b2
5 changed files with 37 additions and 42 deletions

View File

@ -1,35 +1,3 @@
frappe.ui.form.on("Hub Settings", {
onload_post_render: function(frm) {
if(frm.get_field("unregister_from_hub").$input)
frm.get_field("unregister_from_hub").$input.addClass("btn-danger");
},
hub_user_email: function(frm) {
if(frm.doc.hub_user_email){
frm.set_value("hub_user_name", frappe.user.full_name(frm.doc.hub_user_email));
}
},
call_register: (frm) => {
this.frm.call({
doc: this.frm.doc,
method: "register",
args: {},
freeze: true,
callback: function(r) {},
onerror: function() {
frappe.msgprint(__("Wrong Password"));
frm.set_value("enabled", 0);
}
});
},
unregister_from_hub: (frm) => {
frappe.verify_password(() => {
var d = frappe.confirm(__('Are you sure you want to unregister?'), () => {
frm.call('unregister');
}, () => {}, __('Confirm Action'));
d.get_primary_btn().addClass("btn-danger");
});
},
onload_post_render: function() {},
});

View File

@ -3,8 +3,9 @@
<empty-state
v-if="items.length === 0"
:message="empty_state_message"
:action="empty_state_action"
:bordered="true"
:height="80"
:height="empty_state_height"
/>
<item-card
v-for="item in items"
@ -36,6 +37,7 @@ export default {
editable: Boolean,
empty_state_message: String,
empty_state_action: Object,
empty_state_height: Number,
empty_state_bordered: Boolean
},

View File

@ -13,7 +13,7 @@
<section-header>
<h4>{{ section.title }}</h4>
<p :data-route="'marketplace/category/' + section.title">{{ 'See All' }}</p>
<p v-if="section.expandable" :data-route="'marketplace/category/' + section.title">{{ 'See All' }}</p>
</section-header>
<item-cards-container
@ -71,6 +71,7 @@ export default {
this.sections.push({
title: __(category),
expandable: true,
items
});
});

View File

@ -72,13 +72,11 @@ export default {
item_id_fieldname: 'item_code',
// Constants
// TODO: multiline translations don't work
page_title: __('Publish Products'),
search_placeholder: __('Search Items ...'),
empty_state_message: __(`No Items selected yet.
Browse and click on products below to publish.`),
valid_products_instruction: __(`Only products with an image, description
and category can be published. Please update them if an item in your
inventory does not appear.`),
empty_state_message: __(`No Items selected yet. Browse and click on products below to publish.`),
valid_products_instruction: __(`Only products with an image and description can be published. Please update them if an item in your inventory does not appear.`),
last_sync_message: (hub.settings.last_sync_datetime)
? __(`Last sync was
<a href="#marketplace/profile">

View File

@ -3,7 +3,23 @@
class="marketplace-page"
:data-page-name="page_name"
>
<h5>{{ page_title }}</h5>
<section-header>
<div>
<h5>{{ page_title }}</h5>
<p v-if="items.length"
class="text-muted margin-bottom">
{{ published_items_message }}
</p>
</div>
<button v-if="items.length"
class="btn btn-default btn-xs publish-items"
v-route="'marketplace/publish'"
>
<span>{{ publish_button_text }}</span>
</button>
</section-header>
<item-cards-container
:container_name="page_title"
@ -11,6 +27,7 @@
:item_id_fieldname="item_id_fieldname"
:on_click="go_to_item_details_page"
:empty_state_message="empty_state_message"
:empty_state_action="publish_page_action"
>
</item-cards-container>
</div>
@ -25,8 +42,17 @@ export default {
items: [],
item_id_fieldname: 'name',
publish_page_action: {
label: __('Publish Your First Items'),
on_click: () => {
frappe.set_route(`marketplace/home`);
}
},
// Constants
page_title: __('Published Products'),
page_title: __('Published Items'),
publish_button_text: __('Publish More Items'),
published_items_message: __('You can publish upto 200 items.'),
// TODO: Add empty state action
empty_state_message: __(`You haven't published any products yet. Publish.`)
};