mirror of
https://github.com/TandoorRecipes/recipes.git
synced 2026-01-02 12:49:02 -05:00
playing with plugins
This commit is contained in:
39
vue3/src/components/inputs/BaseUnitSelect.vue
Normal file
39
vue3/src/components/inputs/BaseUnitSelect.vue
Normal file
@@ -0,0 +1,39 @@
|
||||
<template>
|
||||
<v-select :label="$t('BaseUnit')" :hint="$t('BaseUnitHelp')" :items="BASE_UNITS" v-model="model"></v-select>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
|
||||
import {useI18n} from "vue-i18n";
|
||||
|
||||
const {t} = useI18n()
|
||||
|
||||
const model = defineModel()
|
||||
|
||||
const BASE_UNITS = [
|
||||
{value: "g", title: t("g")},
|
||||
{value: "kg", title: t("kg")},
|
||||
{value: "ounce", title: t("ounce")},
|
||||
{value: "pound", title: t("pound")},
|
||||
{value: "ml", title: t("ml")},
|
||||
{value: "l", title: t("l")},
|
||||
{value: "fluid_ounce", title: t("fluid_ounce")},
|
||||
{value: "us_cup", title: t("us_cup")},
|
||||
{value: "pint", title: t("pint")},
|
||||
{value: "quart", title: t("quart")},
|
||||
{value: "gallon", title: t("gallon")},
|
||||
{value: "tbsp", title: t("tbsp")},
|
||||
{value: "tsp", title: t("tsp")},
|
||||
{value: "imperial_fluid_ounce", title: t("imperial_fluid_ounce")},
|
||||
{value: "imperial_pint", title: t("imperial_pint")},
|
||||
{value: "imperial_quart", title: t("imperial_quart")},
|
||||
{value: "imperial_gallon", title: t("imperial_gallon")},
|
||||
{value: "imperial_tbsp", title: t("imperial_tbsp")},
|
||||
{value: "imperial_tsp", title: t("imperial_tsp")},
|
||||
]
|
||||
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
@@ -39,6 +39,11 @@
|
||||
<model-select :label="$t('Unit')" v-model="editingObj.convertedUnit" model="Unit"></model-select>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row>
|
||||
<v-col>
|
||||
<v-text-field :label="$t('Open_Data_Slug')" :hint="$t('open_data_help_text')" persistent-hint v-model="editingObj.openDataSlug" disabled></v-text-field>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-form>
|
||||
</v-card-text>
|
||||
</model-editor-base>
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
<v-text-field :label="$t('Name')" v-model="editingObj.name"></v-text-field>
|
||||
<v-text-field :label="$t('Plural')" v-model="editingObj.pluralName"></v-text-field>
|
||||
<v-textarea :label="$t('Description')" v-model="editingObj.description"></v-textarea>
|
||||
<v-select :label="$t('BaseUnit')" :hint="$t('BaseUnitHelp')" :items="BASE_UNITS" v-model="editingObj.baseUnit"></v-select>
|
||||
<base-unit-select v-model="editingObj.baseUnit"></base-unit-select>
|
||||
<v-text-field :label="$t('Open_Data_Slug')" :hint="$t('open_data_help_text')" persistent-hint v-model="editingObj.openDataSlug" disabled></v-text-field>
|
||||
</v-form>
|
||||
</v-card-text>
|
||||
@@ -29,6 +29,7 @@ import {Unit} from "@/openapi";
|
||||
import ModelEditorBase from "@/components/model_editors/ModelEditorBase.vue";
|
||||
import {useModelEditorFunctions} from "@/composables/useModelEditorFunctions";
|
||||
import {useI18n} from "vue-i18n";
|
||||
import BaseUnitSelect from "@/components/inputs/BaseUnitSelect.vue";
|
||||
|
||||
const {t} = useI18n()
|
||||
|
||||
@@ -51,27 +52,7 @@ watch([() => props.item, () => props.itemId], () => {
|
||||
|
||||
// object specific data (for selects/display)
|
||||
|
||||
const BASE_UNITS = [
|
||||
{value: "g", title: t("g")},
|
||||
{value: "kg", title: t("kg")},
|
||||
{value: "ounce", title: t("ounce")},
|
||||
{value: "pound", title: t("pound")},
|
||||
{value: "ml", title: t("ml")},
|
||||
{value: "l", title: t("l")},
|
||||
{value: "fluid_ounce", title: t("fluid_ounce")},
|
||||
{value: "us_cup", title: t("us_cup")},
|
||||
{value: "pint", title: t("pint")},
|
||||
{value: "quart", title: t("quart")},
|
||||
{value: "gallon", title: t("gallon")},
|
||||
{value: "tbsp", title: t("tbsp")},
|
||||
{value: "tsp", title: t("tsp")},
|
||||
{value: "imperial_fluid_ounce", title: t("imperial_fluid_ounce")},
|
||||
{value: "imperial_pint", title: t("imperial_pint")},
|
||||
{value: "imperial_quart", title: t("imperial_quart")},
|
||||
{value: "imperial_gallon", title: t("imperial_gallon")},
|
||||
{value: "imperial_tbsp", title: t("imperial_tbsp")},
|
||||
{value: "imperial_tsp", title: t("imperial_tsp")},
|
||||
]
|
||||
|
||||
|
||||
onMounted(() => {
|
||||
initializeEditor()
|
||||
|
||||
Reference in New Issue
Block a user