[hub] hide Contact Seller and Save Item in read-only

This commit is contained in:
Prateeksha Singh 2018-09-03 17:49:11 +05:30
parent ad6948844e
commit 6ba9b3f4de
2 changed files with 12 additions and 8 deletions

View File

@ -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>

View File

@ -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 @@ export default {
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 @@ export default {
},
{
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 @@ export default {
},
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;
}
}
},