[hub] hide Contact Seller and Save Item in read-only
diff --git a/erpnext/public/js/hub/components/DetailView.vue b/erpnext/public/js/hub/components/DetailView.vue
index 70ec94c..2f1a941 100644
--- a/erpnext/public/js/hub/components/DetailView.vue
+++ b/erpnext/public/js/hub/components/DetailView.vue
@@ -38,7 +38,7 @@
</div>
</div>
- <div v-if="menu_items" class="col-md-1">
+ <div v-if="menu_items && menu_items.length" class="col-md-1">
<div class="dropdown pull-right hub-item-dropdown">
<a class="dropdown-toggle btn btn-xs btn-default" data-toggle="dropdown">
<span class="caret"></span>
diff --git a/erpnext/public/js/hub/pages/Item.vue b/erpnext/public/js/hub/pages/Item.vue
index 272be58..446327a 100644
--- a/erpnext/public/js/hub/pages/Item.vue
+++ b/erpnext/public/js/hub/pages/Item.vue
@@ -19,7 +19,7 @@
:value="item_views_and_ratings"
></detail-header-item>
- <button slot="detail-header-item"
+ <button v-if="primary_action" slot="detail-header-item"
class="btn btn-primary btn-sm margin-top"
@click="primary_action.action"
>
@@ -56,7 +56,7 @@
menu_items: [
{
label: __('Save Item'),
- condition: !this.is_own_item,
+ condition: hub.is_user_registered() && !this.is_own_item,
action: this.add_to_saved_items
},
{
@@ -66,12 +66,12 @@
},
{
label: __('Edit Details'),
- condition: this.is_own_item,
+ condition: hub.is_user_registered() && this.is_own_item,
action: this.edit_details
},
{
label: __('Unpublish Item'),
- condition: this.is_own_item,
+ condition: hub.is_user_registered() && this.is_own_item,
action: this.unpublish_item
}
]
@@ -125,9 +125,13 @@
},
primary_action() {
- return {
- label: __('Contact Seller'),
- action: this.contact_seller.bind(this)
+ if (hub.is_user_registered()) {
+ return {
+ label: __('Contact Seller'),
+ action: this.contact_seller.bind(this)
+ }
+ } else {
+ return undefined;
}
}
},