mirror of
				https://github.com/mealie-recipes/mealie.git
				synced 2025-10-31 02:03:35 -04:00 
			
		
		
		
	feat: add peak toggle for seeing original ingredient txt (#1111)
* add peak toggle for seeing original ingredient txt * add recent changes + format * cleanup search view * space out results
This commit is contained in:
		| @@ -1,3 +1,11 @@ | |||||||
|  | ## v1.0.0b - 2022-03-29 | ||||||
|  |  | ||||||
|  | - Mealie now stores the original text from parsed ingredients, with the ability to peak at the original text from a recipe. [@miroito](https://github.com/Miroito) | ||||||
|  | - Added some management / utility functions for administrators to manage data and cleanup artifacts from the file system. | ||||||
|  | - Fix clear url action in recipe creation [#1101](https://github.com/hay-kot/mealie/pull/1101) [@miroito](https://github.com/Miroito) | ||||||
|  | - Add group statistics calculations and data storage measurements | ||||||
|  |     - No hard limits are currently imposed on groups - though this may be implemented in the future. | ||||||
|  |  | ||||||
| ## v1.0.0b - 2022-03-25 | ## v1.0.0b - 2022-03-25 | ||||||
|  |  | ||||||
| - Mealie now packages the last git commit as the build ID | - Mealie now packages the last git commit as the build ID | ||||||
|   | |||||||
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							| @@ -12,11 +12,11 @@ | |||||||
|     item-text="name" |     item-text="name" | ||||||
|     persistent-hint |     persistent-hint | ||||||
|     multiple |     multiple | ||||||
|  |     :hide-details="hideDetails" | ||||||
|     :hint="hint" |     :hint="hint" | ||||||
|     :solo="solo" |     :solo="solo" | ||||||
|     :return-object="returnObject" |     :return-object="returnObject" | ||||||
|     :prepend-inner-icon="$globals.icons.tags" |     :prepend-inner-icon="$globals.icons.tags" | ||||||
|     :flat="flat" |  | ||||||
|     v-bind="$attrs" |     v-bind="$attrs" | ||||||
|     @input="emitChange" |     @input="emitChange" | ||||||
|   > |   > | ||||||
| @@ -36,7 +36,7 @@ | |||||||
|         {{ data.item.name || data.item }} |         {{ data.item.name || data.item }} | ||||||
|       </v-chip> |       </v-chip> | ||||||
|     </template> |     </template> | ||||||
|     <template #append-outer=""> |     <template #append-outer> | ||||||
|       <RecipeCategoryTagDialog v-if="showAdd" :tag-dialog="tagSelector" @created-item="pushToItem" /> |       <RecipeCategoryTagDialog v-if="showAdd" :tag-dialog="tagSelector" @created-item="pushToItem" /> | ||||||
|     </template> |     </template> | ||||||
|   </v-autocomplete> |   </v-autocomplete> | ||||||
| @@ -91,6 +91,10 @@ export default defineComponent({ | |||||||
|       type: Boolean, |       type: Boolean, | ||||||
|       default: true, |       default: true, | ||||||
|     }, |     }, | ||||||
|  |     hideDetails: { | ||||||
|  |       type: Boolean, | ||||||
|  |       default: false, | ||||||
|  |     }, | ||||||
|   }, |   }, | ||||||
|  |  | ||||||
|   setup(props, context) { |   setup(props, context) { | ||||||
| @@ -127,13 +131,6 @@ export default defineComponent({ | |||||||
|       } |       } | ||||||
|     }); |     }); | ||||||
|  |  | ||||||
|     const flat = computed(() => { |  | ||||||
|       if (state.selected) { |  | ||||||
|         return state.selected.length > 0 && props.solo; |  | ||||||
|       } |  | ||||||
|       return false; |  | ||||||
|     }); |  | ||||||
|  |  | ||||||
|     function emitChange() { |     function emitChange() { | ||||||
|       context.emit("input", state.selected); |       context.emit("input", state.selected); | ||||||
|     } |     } | ||||||
| @@ -158,7 +155,6 @@ export default defineComponent({ | |||||||
|       ...toRefs(state), |       ...toRefs(state), | ||||||
|       inputLabel, |       inputLabel, | ||||||
|       activeItems, |       activeItems, | ||||||
|       flat, |  | ||||||
|       emitChange, |       emitChange, | ||||||
|       removeByIndex, |       removeByIndex, | ||||||
|       pushToItem, |       pushToItem, | ||||||
|   | |||||||
| @@ -89,28 +89,34 @@ | |||||||
|           <v-icon v-if="disableAmount" slot="prepend" class="mr-n1" color="error" @click="$emit('delete')"> |           <v-icon v-if="disableAmount" slot="prepend" class="mr-n1" color="error" @click="$emit('delete')"> | ||||||
|             {{ $globals.icons.delete }} |             {{ $globals.icons.delete }} | ||||||
|           </v-icon> |           </v-icon> | ||||||
|           <template slot="append"> |  | ||||||
|             <v-tooltip top nudge-right="10"> |  | ||||||
|               <template #activator="{ on, attrs }"> |  | ||||||
|                 <v-btn icon small class="mt-n1" v-bind="attrs" v-on="on" @click="toggleTitle()"> |  | ||||||
|                   <v-icon>{{ showTitle || value.title ? $globals.icons.minus : $globals.icons.createAlt }}</v-icon> |  | ||||||
|                 </v-btn> |  | ||||||
|               </template> |  | ||||||
|               <span>{{ showTitle ? $t("recipe.remove-section") : $t("recipe.insert-section") }}</span> |  | ||||||
|             </v-tooltip> |  | ||||||
|           </template> |  | ||||||
|           <template slot="append-outer"> |           <template slot="append-outer"> | ||||||
|             <v-icon class="handle mt-1">{{ $globals.icons.arrowUpDown }}</v-icon> |             <BaseButtonGroup | ||||||
|  |               :large="false" | ||||||
|  |               class="handle my-auto" | ||||||
|  |               :buttons="[ | ||||||
|  |                 { | ||||||
|  |                   icon: $globals.icons.arrowUpDown, | ||||||
|  |                   text: '', | ||||||
|  |                   event: 'open', | ||||||
|  |                   children: contextMenuOptions, | ||||||
|  |                 }, | ||||||
|  |               ]" | ||||||
|  |               @toggle-section="toggleTitle" | ||||||
|  |               @toggle-original="toggleOriginalText" | ||||||
|  |             /> | ||||||
|           </template> |           </template> | ||||||
|         </v-text-field> |         </v-text-field> | ||||||
|       </v-col> |       </v-col> | ||||||
|     </v-row> |     </v-row> | ||||||
|  |     <p v-if="showOriginalText" class="text-caption">Original Text: {{ value.originalText }}</p> | ||||||
|  |  | ||||||
|     <v-divider v-if="!$vuetify.breakpoint.mdAndUp" class="my-4"></v-divider> |     <v-divider v-if="!$vuetify.breakpoint.mdAndUp" class="my-4"></v-divider> | ||||||
|   </div> |   </div> | ||||||
| </template> | </template> | ||||||
|  |  | ||||||
| <script lang="ts"> | <script lang="ts"> | ||||||
| import { defineComponent, reactive, ref, toRefs } from "@nuxtjs/composition-api"; | import { computed, defineComponent, reactive, ref, toRefs } from "@nuxtjs/composition-api"; | ||||||
| import { useFoods, useUnits } from "~/composables/recipes"; | import { useFoods, useUnits } from "~/composables/recipes"; | ||||||
| import { validators } from "~/composables/use-validators"; | import { validators } from "~/composables/use-validators"; | ||||||
| import { RecipeIngredient } from "~/types/api-types/recipe"; | import { RecipeIngredient } from "~/types/api-types/recipe"; | ||||||
| @@ -153,6 +159,7 @@ export default defineComponent({ | |||||||
|  |  | ||||||
|     const state = reactive({ |     const state = reactive({ | ||||||
|       showTitle: false, |       showTitle: false, | ||||||
|  |       showOriginalText: false, | ||||||
|     }); |     }); | ||||||
|  |  | ||||||
|     function toggleTitle() { |     function toggleTitle() { | ||||||
| @@ -165,6 +172,10 @@ export default defineComponent({ | |||||||
|       } |       } | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  |     function toggleOriginalText() { | ||||||
|  |       state.showOriginalText = !state.showOriginalText; | ||||||
|  |     } | ||||||
|  |  | ||||||
|     function handleUnitEnter() { |     function handleUnitEnter() { | ||||||
|       if (value.unit === undefined || value.unit === null || !value.unit.name.includes(unitSearch.value)) { |       if (value.unit === undefined || value.unit === null || !value.unit.name.includes(unitSearch.value)) { | ||||||
|         createAssignUnit(); |         createAssignUnit(); | ||||||
| @@ -177,7 +188,35 @@ export default defineComponent({ | |||||||
|       } |       } | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  |     const contextMenuOptions = computed(() => { | ||||||
|  |       const options = [ | ||||||
|  |         { | ||||||
|  |           text: "Toggle Section", | ||||||
|  |           event: "toggle-section", | ||||||
|  |         }, | ||||||
|  |       ]; | ||||||
|  |  | ||||||
|  |       // FUTURE: add option to parse a single ingredient | ||||||
|  |       // if (!value.food && !value.unit && value.note) { | ||||||
|  |       //   options.push({ | ||||||
|  |       //     text: "Parse Ingredient", | ||||||
|  |       //     event: "parse-ingredient", | ||||||
|  |       //   }); | ||||||
|  |       // } | ||||||
|  |  | ||||||
|  |       if (value.originalText) { | ||||||
|  |         options.push({ | ||||||
|  |           text: "See Original Text", | ||||||
|  |           event: "toggle-original", | ||||||
|  |         }); | ||||||
|  |       } | ||||||
|  |  | ||||||
|  |       return options; | ||||||
|  |     }); | ||||||
|  |  | ||||||
|     return { |     return { | ||||||
|  |       toggleOriginalText, | ||||||
|  |       contextMenuOptions, | ||||||
|       handleUnitEnter, |       handleUnitEnter, | ||||||
|       handleFoodEnter, |       handleFoodEnter, | ||||||
|       ...toRefs(state), |       ...toRefs(state), | ||||||
|   | |||||||
| @@ -122,7 +122,8 @@ | |||||||
|                     :buttons="[ |                     :buttons="[ | ||||||
|                       { |                       { | ||||||
|                         icon: $globals.icons.dotsVertical, |                         icon: $globals.icons.dotsVertical, | ||||||
|                         text: $t('general.delete'), |                         text: '', | ||||||
|  |                         event: 'open', | ||||||
|                         children: [ |                         children: [ | ||||||
|                           { |                           { | ||||||
|                             text: 'Toggle Section', |                             text: 'Toggle Section', | ||||||
| @@ -140,7 +141,7 @@ | |||||||
|                       }, |                       }, | ||||||
|                       { |                       { | ||||||
|                         icon: previewStates[index] ? $globals.icons.edit : $globals.icons.eye, |                         icon: previewStates[index] ? $globals.icons.edit : $globals.icons.eye, | ||||||
|                         text: previewStates[index] ? $t('general.edit') : 'Preview Markdown', |                         text: previewStates[index] ? $tc('general.edit') : 'Preview Markdown', | ||||||
|                         event: 'preview-step', |                         event: 'preview-step', | ||||||
|                       }, |                       }, | ||||||
|                     ]" |                     ]" | ||||||
|   | |||||||
| @@ -1,15 +1,13 @@ | |||||||
| <template> | <template> | ||||||
|   <v-toolbar dense flat> |   <div class="d-flex justify-center align-center"> | ||||||
|     <v-btn-toggle v-model="selected" tile group color="primary accent-3" mandatory @change="emitMulti"> |     <v-btn-toggle v-model="selected" tile group color="primary accent-3" mandatory @change="emitMulti"> | ||||||
|       <v-btn small :value="false"> |       <v-btn small :value="false"> | ||||||
|         {{ $t("search.include") }} |         {{ $t("search.include") }} | ||||||
|       </v-btn> |       </v-btn> | ||||||
|  |  | ||||||
|       <v-btn small :value="true"> |       <v-btn small :value="true"> | ||||||
|         {{ $t("search.exclude") }} |         {{ $t("search.exclude") }} | ||||||
|       </v-btn> |       </v-btn> | ||||||
|     </v-btn-toggle> |     </v-btn-toggle> | ||||||
|     <v-spacer></v-spacer> |  | ||||||
|     <v-btn-toggle v-model="match" tile group color="primary accent-3" mandatory @change="emitMulti"> |     <v-btn-toggle v-model="match" tile group color="primary accent-3" mandatory @change="emitMulti"> | ||||||
|       <v-btn small :value="false" class="text-uppercase"> |       <v-btn small :value="false" class="text-uppercase"> | ||||||
|         {{ $t("search.and") }} |         {{ $t("search.and") }} | ||||||
| @@ -18,7 +16,7 @@ | |||||||
|         {{ $t("search.or") }} |         {{ $t("search.or") }} | ||||||
|       </v-btn> |       </v-btn> | ||||||
|     </v-btn-toggle> |     </v-btn-toggle> | ||||||
|   </v-toolbar> |   </div> | ||||||
| </template> | </template> | ||||||
|  |  | ||||||
| <script lang="ts"> | <script lang="ts"> | ||||||
|   | |||||||
| @@ -3,7 +3,7 @@ | |||||||
|     <template v-for="btn in buttons"> |     <template v-for="btn in buttons"> | ||||||
|       <v-menu v-if="btn.children" :key="'menu-' + btn.event" active-class="pa-0" offset-x left> |       <v-menu v-if="btn.children" :key="'menu-' + btn.event" active-class="pa-0" offset-x left> | ||||||
|         <template #activator="{ on, attrs }"> |         <template #activator="{ on, attrs }"> | ||||||
|           <v-btn tile large icon v-bind="attrs" v-on="on"> |           <v-btn tile :large="large" icon v-bind="attrs" v-on="on"> | ||||||
|             <v-icon> |             <v-icon> | ||||||
|               {{ btn.icon }} |               {{ btn.icon }} | ||||||
|             </v-icon> |             </v-icon> | ||||||
| @@ -25,7 +25,7 @@ | |||||||
|         content-class="text-caption" |         content-class="text-caption" | ||||||
|       > |       > | ||||||
|         <template #activator="{ on, attrs }"> |         <template #activator="{ on, attrs }"> | ||||||
|           <v-btn tile large icon v-bind="attrs" @click="$emit(btn.event)" v-on="on"> |           <v-btn tile :large="large" icon v-bind="attrs" @click="$emit(btn.event)" v-on="on"> | ||||||
|             <v-icon> {{ btn.icon }} </v-icon> |             <v-icon> {{ btn.icon }} </v-icon> | ||||||
|           </v-btn> |           </v-btn> | ||||||
|         </template> |         </template> | ||||||
| @@ -39,7 +39,7 @@ | |||||||
| import { defineComponent } from "@nuxtjs/composition-api"; | import { defineComponent } from "@nuxtjs/composition-api"; | ||||||
|  |  | ||||||
| export interface ButtonOption { | export interface ButtonOption { | ||||||
|   icon: string; |   icon?: string; | ||||||
|   text: string; |   text: string; | ||||||
|   event: string; |   event: string; | ||||||
|   children?: ButtonOption[]; |   children?: ButtonOption[]; | ||||||
| @@ -51,6 +51,10 @@ export default defineComponent({ | |||||||
|       type: Array as () => ButtonOption[], |       type: Array as () => ButtonOption[], | ||||||
|       required: true, |       required: true, | ||||||
|     }, |     }, | ||||||
|  |     large: { | ||||||
|  |       type: Boolean, | ||||||
|  |       default: true, | ||||||
|  |     }, | ||||||
|   }, |   }, | ||||||
| }); | }); | ||||||
| </script> | </script> | ||||||
|   | |||||||
| @@ -34,46 +34,39 @@ | |||||||
|         <template #default="{ state }"> |         <template #default="{ state }"> | ||||||
|           <v-expand-transition> |           <v-expand-transition> | ||||||
|             <v-row v-show="state" dense class="my-0 dense flex-row align-center justify-space-around"> |             <v-row v-show="state" dense class="my-0 dense flex-row align-center justify-space-around"> | ||||||
|               <v-col> |               <v-col cols="12" class="d-flex flex-wrap flex-md-nowrap justify-center" style="gap: 0.8rem"> | ||||||
|                 <h3 class="pl-2 text-center headline"> |  | ||||||
|                   {{ $t("category.category-filter") }} |  | ||||||
|                 </h3> |  | ||||||
|                 <RecipeSearchFilterSelector class="mb-1" @update="updateCatParams" /> |  | ||||||
|                 <RecipeCategoryTagSelector |                 <RecipeCategoryTagSelector | ||||||
|                   v-model="includeCategories" |                   v-model="includeCategories" | ||||||
|  |                   hide-details | ||||||
|                   :solo="true" |                   :solo="true" | ||||||
|                   :dense="false" |                   :dense="false" | ||||||
|                   :return-object="false" |                   :return-object="false" | ||||||
|                 /> |                 /> | ||||||
|  |                 <RecipeSearchFilterSelector class="mb-1" @update="updateCatParams" /> | ||||||
|               </v-col> |               </v-col> | ||||||
|               <v-col> |               <v-col cols="12" class="d-flex flex-wrap flex-md-nowrap justify-center" style="gap: 0.8rem"> | ||||||
|                 <h3 class="pl-2 text-center headline"> |  | ||||||
|                   {{ $t("search.tag-filter") }} |  | ||||||
|                 </h3> |  | ||||||
|                 <RecipeSearchFilterSelector class="mb-1" @update="updateTagParams" /> |  | ||||||
|                 <RecipeCategoryTagSelector |                 <RecipeCategoryTagSelector | ||||||
|                   v-model="includeTags" |                   v-model="includeTags" | ||||||
|  |                   hide-details | ||||||
|                   :solo="true" |                   :solo="true" | ||||||
|                   :dense="false" |                   :dense="false" | ||||||
|                   :return-object="false" |                   :return-object="false" | ||||||
|                   :tag-selector="true" |                   :tag-selector="true" | ||||||
|                 /> |                 /> | ||||||
|  |                 <RecipeSearchFilterSelector class="mb-1" @update="updateTagParams" /> | ||||||
|               </v-col> |               </v-col> | ||||||
|               <v-col> |               <v-col cols="12" class="d-flex flex-wrap flex-md-nowrap justify-center" style="gap: 0.8rem"> | ||||||
|                 <h3 class="pl-2 text-center headline">Food Filter</h3> |  | ||||||
|                 <RecipeSearchFilterSelector class="mb-1" @update="updateFoodParams" /> |  | ||||||
|                 <v-autocomplete |                 <v-autocomplete | ||||||
|                   v-model="includeFoods" |                   v-model="includeFoods" | ||||||
|                   hide-details |  | ||||||
|                   chips |                   chips | ||||||
|  |                   hide-details | ||||||
|                   deletable-chips |                   deletable-chips | ||||||
|                   solo |                   solo | ||||||
|                   multiple |                   multiple | ||||||
|                   :items="foods || []" |                   :items="foods || []" | ||||||
|                   item-text="name" |                   item-text="name" | ||||||
|                   class="mx-1 py-0 mb-8" |  | ||||||
|                   :prepend-inner-icon="$globals.icons.foods" |                   :prepend-inner-icon="$globals.icons.foods" | ||||||
|                   label="Choose Food" |                   label="Foods" | ||||||
|                 > |                 > | ||||||
|                   <template #selection="data"> |                   <template #selection="data"> | ||||||
|                     <v-chip |                     <v-chip | ||||||
| @@ -90,16 +83,18 @@ | |||||||
|                     </v-chip> |                     </v-chip> | ||||||
|                   </template> |                   </template> | ||||||
|                 </v-autocomplete> |                 </v-autocomplete> | ||||||
|  |                 <RecipeSearchFilterSelector class="mb-1" @update="updateFoodParams" /> | ||||||
|               </v-col> |               </v-col> | ||||||
|             </v-row> |             </v-row> | ||||||
|           </v-expand-transition> |           </v-expand-transition> | ||||||
|         </template> |         </template> | ||||||
|       </ToggleState> |       </ToggleState> | ||||||
|     </v-container> |     </v-container> | ||||||
|     <v-container> |     <v-container class="px-0 mt-6"> | ||||||
|       <RecipeCardSection |       <RecipeCardSection | ||||||
|         class="mt-n5" |         class="mt-n5" | ||||||
|         :title-icon="$globals.icons.magnify" |         :icon="$globals.icons.search" | ||||||
|  |         title="Results" | ||||||
|         :recipes="showRecipes.slice(0, maxResults)" |         :recipes="showRecipes.slice(0, maxResults)" | ||||||
|         @sort="assignFuzzy" |         @sort="assignFuzzy" | ||||||
|       /> |       /> | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user