2021-06-11 02:32:03 +00:00
|
|
|
<template>
|
|
|
|
<v-toolbar
|
|
|
|
rounded
|
|
|
|
height="0"
|
|
|
|
class="fixed-bar mt-0"
|
|
|
|
color="rgb(255, 0, 0, 0.0)"
|
|
|
|
flat
|
|
|
|
style="z-index: 2; position: sticky"
|
|
|
|
:class="{ 'fixed-bar-mobile': $vuetify.breakpoint.xs }"
|
|
|
|
>
|
2021-08-02 03:24:47 +00:00
|
|
|
<BaseDialog
|
|
|
|
ref="deleteRecipieConfirm"
|
2021-06-11 02:32:03 +00:00
|
|
|
:title="$t('recipe.delete-recipe')"
|
|
|
|
color="error"
|
2021-06-17 02:55:32 +00:00
|
|
|
:icon="$globals.icons.alertCircle"
|
2021-08-02 03:24:47 +00:00
|
|
|
@confirm="emitDelete()"
|
|
|
|
>
|
2021-08-03 06:15:11 +00:00
|
|
|
<v-card-text>
|
|
|
|
{{ $t("recipe.delete-confirmation") }}
|
|
|
|
</v-card-text>
|
2021-08-02 03:24:47 +00:00
|
|
|
</BaseDialog>
|
|
|
|
|
2021-06-11 02:32:03 +00:00
|
|
|
<v-spacer></v-spacer>
|
2021-06-11 20:15:15 +00:00
|
|
|
<div v-if="!value" class="custom-btn-group ma-1">
|
2021-08-02 03:24:47 +00:00
|
|
|
<RecipeFavoriteBadge v-if="loggedIn" class="mx-1" color="info" button-style :slug="slug" show-always />
|
2021-06-12 06:59:14 +00:00
|
|
|
<v-tooltip bottom color="info">
|
2021-08-02 03:24:47 +00:00
|
|
|
<template #activator="{ on, attrs }">
|
2021-06-21 23:25:37 +00:00
|
|
|
<v-btn
|
|
|
|
v-if="loggedIn"
|
|
|
|
fab
|
|
|
|
small
|
|
|
|
class="mx-1"
|
|
|
|
color="info"
|
|
|
|
v-bind="attrs"
|
|
|
|
v-on="on"
|
|
|
|
@click="$emit('input', true)"
|
|
|
|
>
|
2021-06-12 06:59:14 +00:00
|
|
|
<v-icon> {{ $globals.icons.edit }} </v-icon>
|
|
|
|
</v-btn>
|
|
|
|
</template>
|
|
|
|
<span>{{ $t("general.edit") }}</span>
|
|
|
|
</v-tooltip>
|
2021-08-02 03:24:47 +00:00
|
|
|
<RecipeContextMenu
|
2021-06-21 23:25:37 +00:00
|
|
|
show-print
|
2021-06-11 02:32:03 +00:00
|
|
|
:menu-top="false"
|
|
|
|
:slug="slug"
|
|
|
|
:name="name"
|
2021-06-17 02:55:32 +00:00
|
|
|
:menu-icon="$globals.icons.mdiDotsHorizontal"
|
2021-06-11 02:32:03 +00:00
|
|
|
fab
|
|
|
|
color="info"
|
|
|
|
:card-menu="false"
|
|
|
|
/>
|
|
|
|
</div>
|
2021-06-11 20:15:15 +00:00
|
|
|
<div v-if="value" class="custom-btn-group mb-">
|
2021-06-11 02:32:03 +00:00
|
|
|
<v-btn
|
|
|
|
v-for="(btn, index) in editorButtons"
|
|
|
|
:key="index"
|
|
|
|
:fab="$vuetify.breakpoint.xs"
|
|
|
|
:small="$vuetify.breakpoint.xs"
|
|
|
|
class="mx-1"
|
|
|
|
:color="btn.color"
|
|
|
|
@click="emitHandler(btn.event)"
|
|
|
|
>
|
|
|
|
<v-icon :left="!$vuetify.breakpoint.xs">{{ btn.icon }}</v-icon>
|
|
|
|
{{ $vuetify.breakpoint.xs ? "" : btn.text }}
|
|
|
|
</v-btn>
|
|
|
|
</div>
|
|
|
|
</v-toolbar>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2021-08-02 03:24:47 +00:00
|
|
|
import RecipeContextMenu from "./RecipeContextMenu.vue";
|
|
|
|
import RecipeFavoriteBadge from "./RecipeFavoriteBadge.vue";
|
2021-07-09 22:33:23 +00:00
|
|
|
|
2021-06-11 02:32:03 +00:00
|
|
|
const SAVE_EVENT = "save";
|
|
|
|
const DELETE_EVENT = "delete";
|
|
|
|
const CLOSE_EVENT = "close";
|
|
|
|
const JSON_EVENT = "json";
|
|
|
|
|
|
|
|
export default {
|
2021-08-02 03:24:47 +00:00
|
|
|
components: { RecipeContextMenu, RecipeFavoriteBadge },
|
2021-06-11 02:32:03 +00:00
|
|
|
props: {
|
|
|
|
slug: {
|
2021-08-02 03:24:47 +00:00
|
|
|
required: true,
|
2021-06-11 02:32:03 +00:00
|
|
|
type: String,
|
|
|
|
},
|
|
|
|
name: {
|
2021-08-02 03:24:47 +00:00
|
|
|
required: true,
|
2021-06-11 02:32:03 +00:00
|
|
|
type: String,
|
|
|
|
},
|
2021-06-11 20:15:15 +00:00
|
|
|
value: {
|
|
|
|
type: Boolean,
|
|
|
|
default: false,
|
|
|
|
},
|
2021-06-21 23:25:37 +00:00
|
|
|
loggedIn: {
|
|
|
|
type: Boolean,
|
|
|
|
default: false,
|
|
|
|
},
|
2021-06-11 02:32:03 +00:00
|
|
|
},
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
edit: false,
|
|
|
|
};
|
|
|
|
},
|
2021-06-17 02:55:32 +00:00
|
|
|
|
2021-06-16 18:30:57 +00:00
|
|
|
computed: {
|
2021-06-17 02:55:32 +00:00
|
|
|
editorButtons() {
|
|
|
|
return [
|
|
|
|
{
|
|
|
|
text: this.$t("general.delete"),
|
|
|
|
icon: this.$globals.icons.delete,
|
|
|
|
event: DELETE_EVENT,
|
|
|
|
color: "error",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
text: this.$t("general.json"),
|
|
|
|
icon: this.$globals.icons.codeBraces,
|
|
|
|
event: JSON_EVENT,
|
|
|
|
color: "accent",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
text: this.$t("general.close"),
|
|
|
|
icon: this.$globals.icons.close,
|
|
|
|
event: CLOSE_EVENT,
|
|
|
|
color: "",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
text: this.$t("general.save"),
|
|
|
|
icon: this.$globals.icons.save,
|
|
|
|
event: SAVE_EVENT,
|
|
|
|
color: "success",
|
|
|
|
},
|
|
|
|
];
|
|
|
|
},
|
2021-06-16 18:30:57 +00:00
|
|
|
},
|
2021-06-11 02:32:03 +00:00
|
|
|
methods: {
|
|
|
|
emitHandler(event) {
|
|
|
|
switch (event) {
|
|
|
|
case CLOSE_EVENT:
|
|
|
|
this.$emit(CLOSE_EVENT);
|
2021-06-11 20:15:15 +00:00
|
|
|
this.$emit("input", false);
|
2021-06-11 02:32:03 +00:00
|
|
|
break;
|
|
|
|
case SAVE_EVENT:
|
|
|
|
this.$emit(SAVE_EVENT);
|
|
|
|
break;
|
|
|
|
case JSON_EVENT:
|
|
|
|
this.$emit(JSON_EVENT);
|
|
|
|
break;
|
|
|
|
case DELETE_EVENT:
|
|
|
|
this.$refs.deleteRecipieConfirm.open();
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
},
|
|
|
|
emitDelete() {
|
|
|
|
this.$emit(DELETE_EVENT);
|
2021-06-11 20:15:15 +00:00
|
|
|
this.$emit("input", false);
|
2021-06-11 02:32:03 +00:00
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style scoped>
|
|
|
|
.custom-btn-group {
|
|
|
|
flex: 0, 1, auto;
|
|
|
|
display: inline-flex;
|
|
|
|
}
|
|
|
|
|
|
|
|
.vertical {
|
|
|
|
flex-direction: column !important;
|
|
|
|
}
|
|
|
|
|
|
|
|
.sticky {
|
|
|
|
margin-left: auto;
|
|
|
|
position: fixed !important;
|
|
|
|
margin-top: 4.25rem;
|
|
|
|
}
|
|
|
|
|
|
|
|
.fixed-bar {
|
|
|
|
position: sticky;
|
|
|
|
position: -webkit-sticky; /* for Safari */
|
|
|
|
top: 4.5em;
|
|
|
|
z-index: 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
.fixed-bar-mobile {
|
|
|
|
top: 1.5em !important;
|
|
|
|
}
|
2021-08-02 03:24:47 +00:00
|
|
|
</style>
|