mirror of
https://github.com/TandoorRecipes/recipes.git
synced 2026-01-02 12:49:02 -05:00
Add option to space to enable plural name usage
* Add option to space to enable usage of plural name for food and unit per space * Respect option per space to use the plural name
This commit is contained in:
@@ -204,7 +204,7 @@
|
||||
v-if="!import_multiple">
|
||||
|
||||
<recipe-card :recipe="recipe_json" :detailed="false"
|
||||
:show_context_menu="false"
|
||||
:show_context_menu="false" :use_plural="use_plural"
|
||||
></recipe-card>
|
||||
</b-col>
|
||||
<b-col>
|
||||
@@ -461,6 +461,7 @@ export default {
|
||||
recent_urls: [],
|
||||
source_data: '',
|
||||
recipe_json: undefined,
|
||||
use_plural: false,
|
||||
// recipe_html: undefined,
|
||||
// recipe_tree: undefined,
|
||||
recipe_images: [],
|
||||
@@ -490,6 +491,10 @@ export default {
|
||||
this.INTEGRATIONS.forEach((int) => {
|
||||
int.icon = this.getRandomFoodIcon()
|
||||
})
|
||||
let apiClient = new ApiApiFactory()
|
||||
apiClient.retrieveSpace(window.ACTIVE_SPACE_ID).then(r => {
|
||||
this.use_plural = r.data.use_plural
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
/**
|
||||
|
||||
@@ -42,6 +42,7 @@
|
||||
<!-- model isn't paginated and loads in one API call -->
|
||||
<div v-if="!paginated">
|
||||
<generic-horizontal-card v-for="i in items_left" v-bind:key="i.id" :item="i"
|
||||
:use_plural="use_plural"
|
||||
:model="this_model" @item-action="startAction($event, 'left')"
|
||||
@finish-action="finishAction"/>
|
||||
</div>
|
||||
@@ -51,6 +52,7 @@
|
||||
<template v-slot:cards>
|
||||
<generic-horizontal-card v-for="i in items_left" v-bind:key="i.id" :item="i"
|
||||
:model="this_model"
|
||||
:use_plural="use_plural"
|
||||
@item-action="startAction($event, 'left')"
|
||||
@finish-action="finishAction"/>
|
||||
</template>
|
||||
@@ -62,6 +64,7 @@
|
||||
<template v-slot:cards>
|
||||
<generic-horizontal-card v-for="i in items_right" v-bind:key="i.id" :item="i"
|
||||
:model="this_model"
|
||||
:use_plural="use_plural"
|
||||
@item-action="startAction($event, 'right')"
|
||||
@finish-action="finishAction"/>
|
||||
</template>
|
||||
@@ -120,6 +123,7 @@ export default {
|
||||
show_split: false,
|
||||
paginated: false,
|
||||
header_component_name: undefined,
|
||||
use_plural: false,
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
@@ -145,6 +149,17 @@ export default {
|
||||
}
|
||||
})
|
||||
this.$i18n.locale = window.CUSTOM_LOCALE
|
||||
let apiClient = new ApiApiFactory()
|
||||
apiClient.retrieveSpace(window.ACTIVE_SPACE_ID).then(r => {
|
||||
this.use_plural = r.data.use_plural
|
||||
if (!this.use_plural && this.this_model !== null && this.this_model.create.params[0] !== null && this.this_model.create.params[0].includes('plural_name')) {
|
||||
let index = this.this_model.create.params[0].indexOf('plural_name')
|
||||
if (index > -1){
|
||||
this.this_model.create.params[0].splice(index, 1)
|
||||
}
|
||||
delete this.this_model.create.form.plural_name
|
||||
}
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
// this.genericAPI inherited from ApiMixin
|
||||
|
||||
@@ -572,33 +572,36 @@
|
||||
{{ $t("Enable_Amount") }}
|
||||
</button>
|
||||
|
||||
<button type="button" class="dropdown-item"
|
||||
v-if="!ingredient.always_use_plural_unit"
|
||||
@click="ingredient.always_use_plural_unit = true">
|
||||
<i class="fas fa-filter fa-fw"></i>
|
||||
{{ $t("Use_Plural_Unit_Always") }}
|
||||
</button>
|
||||
<template v-if="use_plural">
|
||||
<button type="button" class="dropdown-item"
|
||||
v-if="!ingredient.always_use_plural_unit"
|
||||
@click="ingredient.always_use_plural_unit = true">
|
||||
<i class="fas fa-filter fa-fw"></i>
|
||||
{{ $t("Use_Plural_Unit_Always") }}
|
||||
</button>
|
||||
|
||||
<button type="button" class="dropdown-item"
|
||||
v-if="ingredient.always_use_plural_unit"
|
||||
@click="ingredient.always_use_plural_unit = false">
|
||||
<i class="fas fa-filter fa-fw"></i>
|
||||
{{ $t("Use_Plural_Unit_Simple") }}
|
||||
</button>
|
||||
<button type="button" class="dropdown-item"
|
||||
v-if="ingredient.always_use_plural_unit"
|
||||
@click="ingredient.always_use_plural_unit = false">
|
||||
<i class="fas fa-filter fa-fw"></i>
|
||||
{{ $t("Use_Plural_Unit_Simple") }}
|
||||
</button>
|
||||
|
||||
<button type="button" class="dropdown-item"
|
||||
v-if="!ingredient.always_use_plural_food"
|
||||
@click="ingredient.always_use_plural_food = true">
|
||||
<i class="fas fa-filter fa-fw"></i>
|
||||
{{ $t("Use_Plural_Food_Always") }}
|
||||
</button>
|
||||
<button type="button" class="dropdown-item"
|
||||
v-if="!ingredient.always_use_plural_food"
|
||||
@click="ingredient.always_use_plural_food = true">
|
||||
<i class="fas fa-filter fa-fw"></i>
|
||||
{{ $t("Use_Plural_Food_Always") }}
|
||||
</button>
|
||||
|
||||
<button type="button" class="dropdown-item"
|
||||
v-if="ingredient.always_use_plural_food"
|
||||
@click="ingredient.always_use_plural_food = false">
|
||||
<i class="fas fa-filter fa-fw"></i>
|
||||
{{ $t("Use_Plural_Food_Simple") }}
|
||||
</button>
|
||||
<button type="button" class="dropdown-item"
|
||||
v-if="ingredient.always_use_plural_food"
|
||||
@click="ingredient.always_use_plural_food = false">
|
||||
<i class="fas fa-filter fa-fw"></i>
|
||||
{{ $t("Use_Plural_Food_Simple") }}
|
||||
</button>
|
||||
</template>
|
||||
|
||||
<button type="button" class="dropdown-item"
|
||||
@click="copyTemplateReference(index, ingredient)">
|
||||
<i class="fas fa-code"></i>
|
||||
@@ -821,6 +824,7 @@ export default {
|
||||
paste_step: undefined,
|
||||
show_file_create: false,
|
||||
step_for_file_create: undefined,
|
||||
use_plural: false,
|
||||
additional_visible: false,
|
||||
create_food: undefined,
|
||||
md_editor_toolbars: {
|
||||
@@ -868,6 +872,10 @@ export default {
|
||||
this.searchRecipes("")
|
||||
|
||||
this.$i18n.locale = window.CUSTOM_LOCALE
|
||||
let apiClient = new ApiApiFactory()
|
||||
apiClient.retrieveSpace(window.ACTIVE_SPACE_ID).then(r => {
|
||||
this.use_plural = r.data.use_plural
|
||||
})
|
||||
},
|
||||
created() {
|
||||
window.addEventListener("keydown", this.keyboardListener)
|
||||
|
||||
@@ -839,13 +839,16 @@
|
||||
v-for="m in meal_plans"
|
||||
:recipe="m.recipe"
|
||||
:meal_plan="m"
|
||||
:use_plural="use_plural"
|
||||
:footer_text="m.meal_type_name"
|
||||
footer_icon="far fa-calendar-alt"
|
||||
></recipe-card>
|
||||
</template>
|
||||
<recipe-card v-for="r in recipes" v-bind:key="r.id" :recipe="r"
|
||||
:footer_text="isRecentOrNew(r)[0]"
|
||||
:footer_icon="isRecentOrNew(r)[1]"></recipe-card>
|
||||
:footer_icon="isRecentOrNew(r)[1]"
|
||||
:use_plural="use_plural">
|
||||
</recipe-card>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -913,6 +916,7 @@ import LoadingSpinner from "@/components/LoadingSpinner" // TODO: is this deprec
|
||||
import RecipeCard from "@/components/RecipeCard"
|
||||
import GenericMultiselect from "@/components/GenericMultiselect"
|
||||
import RecipeSwitcher from "@/components/Buttons/RecipeSwitcher"
|
||||
import { ApiApiFactory } from "@/utils/openapi/api"
|
||||
|
||||
Vue.use(VueCookies)
|
||||
Vue.use(BootstrapVue)
|
||||
@@ -933,7 +937,7 @@ export default {
|
||||
meal_plans: [],
|
||||
last_viewed_recipes: [],
|
||||
sortMenu: false,
|
||||
|
||||
use_plural: false,
|
||||
search: {
|
||||
advanced_search_visible: false,
|
||||
explain_visible: false,
|
||||
@@ -1160,6 +1164,10 @@ export default {
|
||||
this.loadMealPlan()
|
||||
this.refreshData(false)
|
||||
})
|
||||
let apiClient = new ApiApiFactory()
|
||||
apiClient.retrieveSpace(window.ACTIVE_SPACE_ID).then(r => {
|
||||
this.use_plural = r.data.use_plural
|
||||
})
|
||||
this.$i18n.locale = window.CUSTOM_LOCALE
|
||||
this.debug = localStorage.getItem("DEBUG") == "True" || false
|
||||
},
|
||||
|
||||
@@ -151,6 +151,9 @@
|
||||
<b-form-checkbox v-model="space.show_facet_count"> Facet Count</b-form-checkbox>
|
||||
<span class="text-muted small">{{ $t('facet_count_info') }}</span><br/>
|
||||
|
||||
<b-form-checkbox v-model="space.use_plural">Use Plural form</b-form-checkbox>
|
||||
<span class="text-muted small">{{ $t('plural_usage_info') }}</span><br/>
|
||||
|
||||
<label>{{ $t('FoodInherit') }}</label>
|
||||
<generic-multiselect :initial_selection="space.food_inherit"
|
||||
:model="Models.FOOD_INHERIT_FIELDS"
|
||||
@@ -225,7 +228,7 @@ export default {
|
||||
this.$i18n.locale = window.CUSTOM_LOCALE
|
||||
|
||||
let apiFactory = new ApiApiFactory()
|
||||
apiFactory.retrieveSpace(this.ACTIVE_SPACE_ID).then(r => {
|
||||
apiFactory.retrieveSpace(window.ACTIVE_SPACE_ID).then(r => {
|
||||
this.space = r.data
|
||||
})
|
||||
apiFactory.listUserSpaces().then(r => {
|
||||
@@ -249,7 +252,7 @@ export default {
|
||||
},
|
||||
updateSpace: function () {
|
||||
let apiFactory = new ApiApiFactory()
|
||||
apiFactory.partialUpdateSpace(this.ACTIVE_SPACE_ID, this.space).then(r => {
|
||||
apiFactory.partialUpdateSpace(window.ACTIVE_SPACE_ID, this.space).then(r => {
|
||||
StandardToasts.makeStandardToast(this, StandardToasts.SUCCESS_UPDATE)
|
||||
}).catch(err => {
|
||||
StandardToasts.makeStandardToast(this, StandardToasts.FAIL_UPDATE, err)
|
||||
|
||||
Reference in New Issue
Block a user