mirror of
https://github.com/TandoorRecipes/recipes.git
synced 2026-01-02 12:49:02 -05:00
support fraction display
This commit is contained in:
@@ -36,7 +36,7 @@
|
||||
<td style="width: 1%; text-wrap: nowrap" class="pa-0">
|
||||
<v-checkbox-btn v-model="i.checked" color="success" v-if="!i.isHeader"></v-checkbox-btn>
|
||||
</td>
|
||||
<td style="width: 1%; text-wrap: nowrap" class="pr-1">{{ i.amount * props.ingredientFactor }}</td>
|
||||
<td style="width: 1%; text-wrap: nowrap" class="pr-1" v-html="calculateFoodAmount(i.amount, props.ingredientFactor, useUserPreferenceStore().userSettings.useFractions)"></td>
|
||||
<td style="width: 1%; text-wrap: nowrap" class="pr-1">
|
||||
<template v-if="i.unit"> {{ i.unit.name }}</template>
|
||||
</td>
|
||||
@@ -59,6 +59,8 @@
|
||||
<script lang="ts" setup>
|
||||
import {Ingredient} from "@/openapi";
|
||||
import {computed} from "vue";
|
||||
import {calculateFoodAmount} from "../../utils/number_utils";
|
||||
import {useUserPreferenceStore} from "../../stores/UserPreferenceStore";
|
||||
|
||||
const ingredients = defineModel<Ingredient[]>({required: true})
|
||||
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
|
||||
<script lang="ts" setup>
|
||||
|
||||
import {useUserPreferenceStore} from "@/stores/UserPreferenceStore";
|
||||
|
||||
const props = defineProps({
|
||||
number: Number,
|
||||
factor: {
|
||||
@@ -22,6 +24,6 @@ import {calculateFoodAmount} from "@/utils/number_utils.ts";
|
||||
* @return {number | string}
|
||||
*/
|
||||
function calculateAmount(x) {
|
||||
return calculateFoodAmount(x, props.factor) // TODO reactive bind props
|
||||
return calculateFoodAmount(x, props.factor, useUserPreferenceStore().userSettings.useFractions)
|
||||
}
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user