Let caller control whether Login and Feedback menu items are shown

This commit is contained in:
Lance Edgar 2020-02-10 16:30:38 -06:00
parent e131305902
commit 3d89cffa65

View file

@ -1,10 +1,11 @@
<template>
<section>
<nav class="level is-mobile">
<div class="level-item">
<b-dropdown v-if="user"
aria-role="list">
<div v-if="user"
class="level-item">
<b-dropdown aria-role="list">
<button class="button is-primary"
:class="{'is-danger': user_is_root}"
slot="trigger">
@ -41,9 +42,11 @@
</b-dropdown-item>
</b-dropdown>
</div>
<b-button v-if="!user"
type="is-primary"
<div v-if="!user && showLoginButton"
class="level-item">
<b-button type="is-primary"
tag="router-link" to="/login">
<b-icon icon="fas fa-user"></b-icon>
<span>Login</span>
@ -51,10 +54,13 @@
</div>
<div class="level-item">
{{ title }}
<slot name="header">
{{ title }}
</slot>
</div>
<div class="level-item">
<div v-if="shouldShowFeedback"
class="level-item">
<byjove-feedback :url="feedbackUrl"></byjove-feedback>
</div>
</nav>
@ -80,6 +86,18 @@ export default {
type: String,
default: '/api/stop-root',
},
showLoginButton: {
type: Boolean,
default: true,
},
allowFeedback: {
type: Boolean,
default: null,
},
allowAnonymousFeedback: {
type: Boolean,
default: true,
},
},
components: {
ByjoveFeedback,
@ -98,6 +116,15 @@ export default {
user_is_root: function() {
return this.$store.state.user_is_root
},
shouldShowFeedback: function() {
if (this.allowFeedback !== null) {
return this.allowFeedback
}
if (!this.allowAnonymousFeedback && !this.user) {
return false
}
return true
},
},
methods: {
becomeRoot() {