mirror of
https://github.com/TandoorRecipes/recipes.git
synced 2026-01-09 16:18:00 -05:00
add ignore_shopping && additional help
This commit is contained in:
58
vue/src/components/Badges/Help.vue
Normal file
58
vue/src/components/Badges/Help.vue
Normal file
@@ -0,0 +1,58 @@
|
||||
<template>
|
||||
<span><i class="mx-1 far fa-question-circle text-muted" @click="this_help.show = !this_help.show" /></span>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import Vue from "vue"
|
||||
import VueCookies from "vue-cookies"
|
||||
Vue.use(VueCookies)
|
||||
let HELP_COOKIE_NAME = "help_settings"
|
||||
|
||||
export default {
|
||||
name: "HelpBadge",
|
||||
props: {
|
||||
component: { type: String, required: true },
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
help: {},
|
||||
|
||||
default: {
|
||||
show: true,
|
||||
},
|
||||
this_help: undefined,
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.$nextTick(function () {
|
||||
if (this.$cookies.isKey(HELP_COOKIE_NAME)) {
|
||||
this.help = Object.assign({}, this.help, this.$cookies.get(HELP_COOKIE_NAME))
|
||||
}
|
||||
this.this_help = Object.assign({}, this.default, this.help?.[this.component])
|
||||
})
|
||||
},
|
||||
watch: {
|
||||
help: {
|
||||
handler() {
|
||||
this.$cookies.set(HELP_COOKIE_NAME, this.help)
|
||||
},
|
||||
deep: true,
|
||||
},
|
||||
this_help: {
|
||||
handler() {
|
||||
this.help[this.component] = Object.assign({}, this.this_help)
|
||||
this.$cookies.set(HELP_COOKIE_NAME, this.help)
|
||||
},
|
||||
deep: true,
|
||||
},
|
||||
"this_help.show": function () {
|
||||
if (this.this_help.show) {
|
||||
this.$emit("show")
|
||||
} else {
|
||||
this.$emit("hide")
|
||||
}
|
||||
},
|
||||
},
|
||||
methods: {},
|
||||
}
|
||||
</script>
|
||||
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<span>
|
||||
<span v-if="!item.ignore_shopping">
|
||||
<b-button class="btn text-decoration-none px-1 border-0" variant="link" :id="`shopping${item.id}`" @click="addShopping()">
|
||||
<i
|
||||
class="fas"
|
||||
|
||||
Reference in New Issue
Block a user