| 
									
										
										
										
											2021-06-10 18:32:03 -08: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" | 
					
						
							|  |  |  |   > | 
					
						
							| 
									
										
										
										
											2021-08-01 19:24:47 -08:00
										 |  |  |     <BaseDialog | 
					
						
							| 
									
										
										
										
											2021-11-25 14:17:02 -09:00
										 |  |  |       v-model="deleteDialog" | 
					
						
							| 
									
										
										
										
											2021-06-10 18:32:03 -08:00
										 |  |  |       :title="$t('recipe.delete-recipe')" | 
					
						
							|  |  |  |       color="error" | 
					
						
							| 
									
										
										
										
											2021-06-16 18:55:32 -08:00
										 |  |  |       :icon="$globals.icons.alertCircle" | 
					
						
							| 
									
										
										
										
											2021-08-01 19:24:47 -08:00
										 |  |  |       @confirm="emitDelete()" | 
					
						
							|  |  |  |     > | 
					
						
							| 
									
										
										
										
											2021-08-02 22:15:11 -08:00
										 |  |  |       <v-card-text> | 
					
						
							|  |  |  |         {{ $t("recipe.delete-confirmation") }} | 
					
						
							|  |  |  |       </v-card-text> | 
					
						
							| 
									
										
										
										
											2021-08-01 19:24:47 -08:00
										 |  |  |     </BaseDialog> | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-06-10 18:32:03 -08:00
										 |  |  |     <v-spacer></v-spacer> | 
					
						
							| 
									
										
										
										
											2021-06-11 12:15:15 -08:00
										 |  |  |     <div v-if="!value" class="custom-btn-group ma-1"> | 
					
						
							| 
									
										
										
										
											2021-08-01 19:24:47 -08:00
										 |  |  |       <RecipeFavoriteBadge v-if="loggedIn" class="mx-1" color="info" button-style :slug="slug" show-always /> | 
					
						
							| 
									
										
										
										
											2021-12-11 19:12:08 -09:00
										 |  |  |       <v-tooltip v-if="!locked" bottom color="info"> | 
					
						
							| 
									
										
										
										
											2021-08-01 19:24:47 -08:00
										 |  |  |         <template #activator="{ on, attrs }"> | 
					
						
							| 
									
										
										
										
											2022-07-10 06:28:34 +02:00
										 |  |  |           <v-btn fab small class="mx-1" color="info" v-bind="attrs" v-on="on" @click="$emit('edit', true)"> | 
					
						
							| 
									
										
										
										
											2021-06-12 14:59:14 +08:00
										 |  |  |             <v-icon> {{ $globals.icons.edit }} </v-icon> | 
					
						
							|  |  |  |           </v-btn> | 
					
						
							|  |  |  |         </template> | 
					
						
							|  |  |  |         <span>{{ $t("general.edit") }}</span> | 
					
						
							|  |  |  |       </v-tooltip> | 
					
						
							| 
									
										
										
										
											2021-12-11 19:12:08 -09:00
										 |  |  |       <v-tooltip v-else bottom color="info"> | 
					
						
							|  |  |  |         <template #activator="{ on, attrs }"> | 
					
						
							| 
									
										
										
										
											2022-02-13 12:23:42 -09:00
										 |  |  |           <v-btn fab small class="mx-1" color="info" v-bind="attrs" v-on="on"> | 
					
						
							| 
									
										
										
										
											2021-12-11 19:12:08 -09:00
										 |  |  |             <v-icon> {{ $globals.icons.lock }} </v-icon> | 
					
						
							|  |  |  |           </v-btn> | 
					
						
							|  |  |  |         </template> | 
					
						
							|  |  |  |         <span> Locked by Owner </span> | 
					
						
							|  |  |  |       </v-tooltip> | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-02-23 15:04:45 -09:00
										 |  |  |       <ClientOnly> | 
					
						
							|  |  |  |         <RecipeContextMenu | 
					
						
							|  |  |  |           show-print | 
					
						
							|  |  |  |           :menu-top="false" | 
					
						
							|  |  |  |           :name="name" | 
					
						
							|  |  |  |           :slug="slug" | 
					
						
							|  |  |  |           :menu-icon="$globals.icons.mdiDotsHorizontal" | 
					
						
							|  |  |  |           fab | 
					
						
							|  |  |  |           color="info" | 
					
						
							|  |  |  |           :card-menu="false" | 
					
						
							|  |  |  |           :recipe-id="recipeId" | 
					
						
							|  |  |  |           :use-items="{ | 
					
						
							|  |  |  |             delete: false, | 
					
						
							|  |  |  |             edit: false, | 
					
						
							|  |  |  |             download: true, | 
					
						
							|  |  |  |             mealplanner: true, | 
					
						
							|  |  |  |             shoppingList: true, | 
					
						
							|  |  |  |             print: true, | 
					
						
							|  |  |  |             share: true, | 
					
						
							|  |  |  |           }" | 
					
						
							|  |  |  |           @print="$emit('print')" | 
					
						
							|  |  |  |         /> | 
					
						
							|  |  |  |       </ClientOnly> | 
					
						
							| 
									
										
										
										
											2021-06-10 18:32:03 -08:00
										 |  |  |     </div> | 
					
						
							| 
									
										
										
										
											2021-06-11 12:15:15 -08:00
										 |  |  |     <div v-if="value" class="custom-btn-group mb-"> | 
					
						
							| 
									
										
										
										
											2021-06-10 18:32:03 -08: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> | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-01-09 07:15:23 +01:00
										 |  |  | <script lang="ts"> | 
					
						
							| 
									
										
										
										
											2022-02-13 12:23:42 -09:00
										 |  |  | import { defineComponent, ref, useContext } from "@nuxtjs/composition-api"; | 
					
						
							| 
									
										
										
										
											2021-08-01 19:24:47 -08:00
										 |  |  | import RecipeContextMenu from "./RecipeContextMenu.vue"; | 
					
						
							|  |  |  | import RecipeFavoriteBadge from "./RecipeFavoriteBadge.vue"; | 
					
						
							| 
									
										
										
										
											2021-07-09 14:33:23 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-06-10 18:32:03 -08:00
										 |  |  | const SAVE_EVENT = "save"; | 
					
						
							|  |  |  | const DELETE_EVENT = "delete"; | 
					
						
							|  |  |  | const CLOSE_EVENT = "close"; | 
					
						
							|  |  |  | const JSON_EVENT = "json"; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-01-09 07:15:23 +01:00
										 |  |  | export default defineComponent({ | 
					
						
							| 
									
										
										
										
											2021-08-01 19:24:47 -08:00
										 |  |  |   components: { RecipeContextMenu, RecipeFavoriteBadge }, | 
					
						
							| 
									
										
										
										
											2021-06-10 18:32:03 -08:00
										 |  |  |   props: { | 
					
						
							|  |  |  |     slug: { | 
					
						
							| 
									
										
										
										
											2021-08-01 19:24:47 -08:00
										 |  |  |       required: true, | 
					
						
							| 
									
										
										
										
											2021-06-10 18:32:03 -08:00
										 |  |  |       type: String, | 
					
						
							|  |  |  |     }, | 
					
						
							|  |  |  |     name: { | 
					
						
							| 
									
										
										
										
											2021-08-01 19:24:47 -08:00
										 |  |  |       required: true, | 
					
						
							| 
									
										
										
										
											2021-06-10 18:32:03 -08:00
										 |  |  |       type: String, | 
					
						
							|  |  |  |     }, | 
					
						
							| 
									
										
										
										
											2021-06-11 12:15:15 -08:00
										 |  |  |     value: { | 
					
						
							|  |  |  |       type: Boolean, | 
					
						
							|  |  |  |       default: false, | 
					
						
							|  |  |  |     }, | 
					
						
							| 
									
										
										
										
											2021-06-21 16:25:37 -07:00
										 |  |  |     loggedIn: { | 
					
						
							|  |  |  |       type: Boolean, | 
					
						
							|  |  |  |       default: false, | 
					
						
							|  |  |  |     }, | 
					
						
							| 
									
										
										
										
											2021-11-05 21:29:15 -08:00
										 |  |  |     recipeId: { | 
					
						
							|  |  |  |       required: true, | 
					
						
							| 
									
										
										
										
											2022-02-13 12:23:42 -09:00
										 |  |  |       type: String, | 
					
						
							| 
									
										
										
										
											2021-11-05 21:29:15 -08:00
										 |  |  |     }, | 
					
						
							| 
									
										
										
										
											2021-12-11 19:12:08 -09:00
										 |  |  |     locked: { | 
					
						
							|  |  |  |       type: Boolean, | 
					
						
							|  |  |  |       default: false, | 
					
						
							|  |  |  |     }, | 
					
						
							| 
									
										
										
										
											2021-06-10 18:32:03 -08:00
										 |  |  |   }, | 
					
						
							| 
									
										
										
										
											2022-01-09 07:15:23 +01:00
										 |  |  |   setup(_, context) { | 
					
						
							|  |  |  |     const deleteDialog = ref(false); | 
					
						
							| 
									
										
										
										
											2021-06-16 18:55:32 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-01-09 07:15:23 +01:00
										 |  |  |     const { i18n, $globals } = useContext(); | 
					
						
							|  |  |  |     const editorButtons = [ | 
					
						
							|  |  |  |       { | 
					
						
							|  |  |  |         text: i18n.t("general.delete"), | 
					
						
							|  |  |  |         icon: $globals.icons.delete, | 
					
						
							|  |  |  |         event: DELETE_EVENT, | 
					
						
							|  |  |  |         color: "error", | 
					
						
							|  |  |  |       }, | 
					
						
							|  |  |  |       { | 
					
						
							|  |  |  |         text: i18n.t("general.json"), | 
					
						
							|  |  |  |         icon: $globals.icons.codeBraces, | 
					
						
							|  |  |  |         event: JSON_EVENT, | 
					
						
							|  |  |  |         color: "accent", | 
					
						
							|  |  |  |       }, | 
					
						
							|  |  |  |       { | 
					
						
							|  |  |  |         text: i18n.t("general.close"), | 
					
						
							|  |  |  |         icon: $globals.icons.close, | 
					
						
							|  |  |  |         event: CLOSE_EVENT, | 
					
						
							|  |  |  |         color: "", | 
					
						
							|  |  |  |       }, | 
					
						
							|  |  |  |       { | 
					
						
							|  |  |  |         text: i18n.t("general.save"), | 
					
						
							|  |  |  |         icon: $globals.icons.save, | 
					
						
							|  |  |  |         event: SAVE_EVENT, | 
					
						
							|  |  |  |         color: "success", | 
					
						
							|  |  |  |       }, | 
					
						
							|  |  |  |     ]; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     function emitHandler(event: string) { | 
					
						
							| 
									
										
										
										
											2021-06-10 18:32:03 -08:00
										 |  |  |       switch (event) { | 
					
						
							|  |  |  |         case CLOSE_EVENT: | 
					
						
							| 
									
										
										
										
											2022-01-09 07:15:23 +01:00
										 |  |  |           context.emit(CLOSE_EVENT); | 
					
						
							|  |  |  |           context.emit("input", false); | 
					
						
							| 
									
										
										
										
											2021-06-10 18:32:03 -08:00
										 |  |  |           break; | 
					
						
							|  |  |  |         case SAVE_EVENT: | 
					
						
							| 
									
										
										
										
											2022-01-09 07:15:23 +01:00
										 |  |  |           context.emit(SAVE_EVENT); | 
					
						
							| 
									
										
										
										
											2021-06-10 18:32:03 -08:00
										 |  |  |           break; | 
					
						
							|  |  |  |         case JSON_EVENT: | 
					
						
							| 
									
										
										
										
											2022-01-09 07:15:23 +01:00
										 |  |  |           context.emit(JSON_EVENT); | 
					
						
							| 
									
										
										
										
											2021-06-10 18:32:03 -08:00
										 |  |  |           break; | 
					
						
							|  |  |  |         case DELETE_EVENT: | 
					
						
							| 
									
										
										
										
											2022-01-09 07:15:23 +01:00
										 |  |  |           deleteDialog.value = true; | 
					
						
							| 
									
										
										
										
											2021-06-10 18:32:03 -08:00
										 |  |  |           break; | 
					
						
							|  |  |  |         default: | 
					
						
							|  |  |  |           break; | 
					
						
							|  |  |  |       } | 
					
						
							| 
									
										
										
										
											2022-01-09 07:15:23 +01:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     function emitDelete() { | 
					
						
							|  |  |  |       context.emit(DELETE_EVENT); | 
					
						
							|  |  |  |       context.emit("input", false); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     return { | 
					
						
							|  |  |  |       deleteDialog, | 
					
						
							|  |  |  |       editorButtons, | 
					
						
							|  |  |  |       emitHandler, | 
					
						
							|  |  |  |       emitDelete, | 
					
						
							| 
									
										
										
										
											2022-02-13 12:23:42 -09:00
										 |  |  |     }; | 
					
						
							| 
									
										
										
										
											2021-06-10 18:32:03 -08:00
										 |  |  |   }, | 
					
						
							| 
									
										
										
										
											2022-01-09 07:15:23 +01:00
										 |  |  | }); | 
					
						
							| 
									
										
										
										
											2021-06-10 18:32:03 -08: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-01 19:24:47 -08:00
										 |  |  | </style> |