mirror of
https://github.com/mealie-recipes/mealie.git
synced 2025-08-02 12:05:21 +02:00
fix: add locale and first day of week to all date pickers (#3303)
Some checks are pending
CodeQL / Analyze (javascript-typescript) (push) Waiting to run
CodeQL / Analyze (python) (push) Waiting to run
Docker Nightly Production / Backend Server Tests (push) Waiting to run
Docker Nightly Production / Frontend and End-to-End Tests (push) Waiting to run
Docker Nightly Production / Build Tagged Release (push) Blocked by required conditions
Docker Nightly Production / Notify Discord (push) Blocked by required conditions
Some checks are pending
CodeQL / Analyze (javascript-typescript) (push) Waiting to run
CodeQL / Analyze (python) (push) Waiting to run
Docker Nightly Production / Backend Server Tests (push) Waiting to run
Docker Nightly Production / Frontend and End-to-End Tests (push) Waiting to run
Docker Nightly Production / Build Tagged Release (push) Blocked by required conditions
Docker Nightly Production / Notify Discord (push) Blocked by required conditions
This commit is contained in:
parent
42523bbfc9
commit
5f5b06683a
5 changed files with 54 additions and 12 deletions
|
@ -59,7 +59,13 @@
|
||||||
v-on="on"
|
v-on="on"
|
||||||
></v-text-field>
|
></v-text-field>
|
||||||
</template>
|
</template>
|
||||||
<v-date-picker v-model="newMealdate" no-title @input="pickerMenu = false"></v-date-picker>
|
<v-date-picker
|
||||||
|
v-model="newMealdate"
|
||||||
|
no-title
|
||||||
|
:first-day-of-week="firstDayOfWeek"
|
||||||
|
:local="$i18n.locale"
|
||||||
|
@input="pickerMenu = false"
|
||||||
|
/>
|
||||||
</v-menu>
|
</v-menu>
|
||||||
<v-select
|
<v-select
|
||||||
v-model="newMealType"
|
v-model="newMealType"
|
||||||
|
@ -111,6 +117,7 @@ import RecipeDialogPrintPreferences from "./RecipeDialogPrintPreferences.vue";
|
||||||
import RecipeDialogShare from "./RecipeDialogShare.vue";
|
import RecipeDialogShare from "./RecipeDialogShare.vue";
|
||||||
import { useLoggedInState } from "~/composables/use-logged-in-state";
|
import { useLoggedInState } from "~/composables/use-logged-in-state";
|
||||||
import { useUserApi } from "~/composables/api";
|
import { useUserApi } from "~/composables/api";
|
||||||
|
import { useGroupSelf } from "~/composables/use-groups";
|
||||||
import { alert } from "~/composables/use-toast";
|
import { alert } from "~/composables/use-toast";
|
||||||
import { usePlanTypeOptions } from "~/composables/use-group-mealplan";
|
import { usePlanTypeOptions } from "~/composables/use-group-mealplan";
|
||||||
import { Recipe } from "~/lib/api/types/recipe";
|
import { Recipe } from "~/lib/api/types/recipe";
|
||||||
|
@ -224,11 +231,16 @@ export default defineComponent({
|
||||||
});
|
});
|
||||||
|
|
||||||
const { i18n, $auth, $globals } = useContext();
|
const { i18n, $auth, $globals } = useContext();
|
||||||
|
const { group } = useGroupSelf();
|
||||||
const { isOwnGroup } = useLoggedInState();
|
const { isOwnGroup } = useLoggedInState();
|
||||||
|
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const groupSlug = computed(() => route.value.params.groupSlug || $auth.user?.groupSlug || "");
|
const groupSlug = computed(() => route.value.params.groupSlug || $auth.user?.groupSlug || "");
|
||||||
|
|
||||||
|
const firstDayOfWeek = computed(() => {
|
||||||
|
return group.value?.preferences?.firstDayOfWeek || 0;
|
||||||
|
});
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
// Context Menu Setup
|
// Context Menu Setup
|
||||||
|
|
||||||
|
@ -432,6 +444,7 @@ export default defineComponent({
|
||||||
addRecipeToPlan,
|
addRecipeToPlan,
|
||||||
icon,
|
icon,
|
||||||
planTypeOptions,
|
planTypeOptions,
|
||||||
|
firstDayOfWeek,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
|
@ -22,7 +22,13 @@
|
||||||
v-on="on"
|
v-on="on"
|
||||||
></v-text-field>
|
></v-text-field>
|
||||||
</template>
|
</template>
|
||||||
<v-date-picker v-model="expirationDate" no-title @input="datePickerMenu = false"></v-date-picker>
|
<v-date-picker
|
||||||
|
v-model="expirationDate"
|
||||||
|
no-title
|
||||||
|
:first-day-of-week="firstDayOfWeek"
|
||||||
|
:local="$i18n.locale"
|
||||||
|
@input="datePickerMenu = false"
|
||||||
|
/>
|
||||||
</v-menu>
|
</v-menu>
|
||||||
</v-card-text>
|
</v-card-text>
|
||||||
<v-card-actions class="justify-end">
|
<v-card-actions class="justify-end">
|
||||||
|
@ -60,6 +66,7 @@ import { defineComponent, computed, toRefs, reactive, useContext, useRoute } fro
|
||||||
import { useClipboard, useShare, whenever } from "@vueuse/core";
|
import { useClipboard, useShare, whenever } from "@vueuse/core";
|
||||||
import { RecipeShareToken } from "~/lib/api/types/recipe";
|
import { RecipeShareToken } from "~/lib/api/types/recipe";
|
||||||
import { useUserApi } from "~/composables/api";
|
import { useUserApi } from "~/composables/api";
|
||||||
|
import { useGroupSelf } from "~/composables/use-groups";
|
||||||
import { alert } from "~/composables/use-toast";
|
import { alert } from "~/composables/use-toast";
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
|
@ -106,9 +113,14 @@ export default defineComponent({
|
||||||
);
|
);
|
||||||
|
|
||||||
const { $auth, i18n } = useContext();
|
const { $auth, i18n } = useContext();
|
||||||
|
const { group } = useGroupSelf();
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const groupSlug = computed(() => route.value.params.groupSlug || $auth.user?.groupSlug || "");
|
const groupSlug = computed(() => route.value.params.groupSlug || $auth.user?.groupSlug || "");
|
||||||
|
|
||||||
|
const firstDayOfWeek = computed(() => {
|
||||||
|
return group.value?.preferences?.firstDayOfWeek || 0;
|
||||||
|
});
|
||||||
|
|
||||||
// ============================================================
|
// ============================================================
|
||||||
// Token Actions
|
// Token Actions
|
||||||
|
|
||||||
|
@ -185,6 +197,7 @@ export default defineComponent({
|
||||||
dialog,
|
dialog,
|
||||||
createNewToken,
|
createNewToken,
|
||||||
deleteToken,
|
deleteToken,
|
||||||
|
firstDayOfWeek,
|
||||||
shareRecipe,
|
shareRecipe,
|
||||||
copyTokenLink,
|
copyTokenLink,
|
||||||
};
|
};
|
||||||
|
|
|
@ -41,6 +41,7 @@
|
||||||
<v-date-picker
|
<v-date-picker
|
||||||
v-model="newTimelineEventTimestamp"
|
v-model="newTimelineEventTimestamp"
|
||||||
no-title
|
no-title
|
||||||
|
:first-day-of-week="firstDayOfWeek"
|
||||||
:local="$i18n.locale"
|
:local="$i18n.locale"
|
||||||
@input="datePickerMenu = false"
|
@input="datePickerMenu = false"
|
||||||
/>
|
/>
|
||||||
|
@ -109,10 +110,11 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { defineComponent, reactive, ref, toRefs, useContext } from "@nuxtjs/composition-api";
|
import { computed, defineComponent, reactive, ref, toRefs, useContext } from "@nuxtjs/composition-api";
|
||||||
import { whenever } from "@vueuse/core";
|
import { whenever } from "@vueuse/core";
|
||||||
import { VForm } from "~/types/vuetify";
|
import { VForm } from "~/types/vuetify";
|
||||||
import { useUserApi } from "~/composables/api";
|
import { useUserApi } from "~/composables/api";
|
||||||
|
import { useGroupSelf } from "~/composables/use-groups";
|
||||||
import { Recipe, RecipeTimelineEventIn } from "~/lib/api/types/recipe";
|
import { Recipe, RecipeTimelineEventIn } from "~/lib/api/types/recipe";
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
|
@ -129,6 +131,7 @@ export default defineComponent({
|
||||||
setup(props, context) {
|
setup(props, context) {
|
||||||
const madeThisDialog = ref(false);
|
const madeThisDialog = ref(false);
|
||||||
const userApi = useUserApi();
|
const userApi = useUserApi();
|
||||||
|
const { group } = useGroupSelf();
|
||||||
const { $auth, i18n } = useContext();
|
const { $auth, i18n } = useContext();
|
||||||
const domMadeThisForm = ref<VForm>();
|
const domMadeThisForm = ref<VForm>();
|
||||||
const newTimelineEvent = ref<RecipeTimelineEventIn>({
|
const newTimelineEvent = ref<RecipeTimelineEventIn>({
|
||||||
|
@ -153,6 +156,10 @@ export default defineComponent({
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const firstDayOfWeek = computed(() => {
|
||||||
|
return group.value?.preferences?.firstDayOfWeek || 0;
|
||||||
|
});
|
||||||
|
|
||||||
function clearImage() {
|
function clearImage() {
|
||||||
newTimelineEventImage.value = undefined;
|
newTimelineEventImage.value = undefined;
|
||||||
newTimelineEventImageName.value = "";
|
newTimelineEventImageName.value = "";
|
||||||
|
@ -226,6 +233,7 @@ export default defineComponent({
|
||||||
...toRefs(state),
|
...toRefs(state),
|
||||||
domMadeThisForm,
|
domMadeThisForm,
|
||||||
madeThisDialog,
|
madeThisDialog,
|
||||||
|
firstDayOfWeek,
|
||||||
newTimelineEvent,
|
newTimelineEvent,
|
||||||
newTimelineEventImage,
|
newTimelineEventImage,
|
||||||
newTimelineEventImagePreviewUrl,
|
newTimelineEventImagePreviewUrl,
|
||||||
|
|
|
@ -16,7 +16,13 @@
|
||||||
{{ $d(weekRange.start, "short") }} - {{ $d(weekRange.end, "short") }}
|
{{ $d(weekRange.start, "short") }} - {{ $d(weekRange.end, "short") }}
|
||||||
</v-btn>
|
</v-btn>
|
||||||
</template>
|
</template>
|
||||||
<v-date-picker v-model="state.range" no-title range>
|
<v-date-picker
|
||||||
|
v-model="state.range"
|
||||||
|
no-title
|
||||||
|
range
|
||||||
|
:first-day-of-week="firstDayOfWeek"
|
||||||
|
:local="$i18n.locale"
|
||||||
|
>
|
||||||
<v-spacer></v-spacer>
|
<v-spacer></v-spacer>
|
||||||
<v-btn text color="primary" @click="state.picker = false">
|
<v-btn text color="primary" @click="state.picker = false">
|
||||||
{{ $t("general.ok") }}
|
{{ $t("general.ok") }}
|
||||||
|
@ -43,6 +49,7 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { computed, defineComponent, ref, useRoute, useRouter } from "@nuxtjs/composition-api";
|
import { computed, defineComponent, ref, useRoute, useRouter } from "@nuxtjs/composition-api";
|
||||||
import { isSameDay, addDays, parseISO } from "date-fns";
|
import { isSameDay, addDays, parseISO } from "date-fns";
|
||||||
|
import { useGroupSelf } from "~/composables/use-groups";
|
||||||
import { useMealplans } from "~/composables/use-group-mealplan";
|
import { useMealplans } from "~/composables/use-group-mealplan";
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
|
@ -50,6 +57,7 @@ export default defineComponent({
|
||||||
setup() {
|
setup() {
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
const { group } = useGroupSelf();
|
||||||
|
|
||||||
// Force to /view if current route is /planner
|
// Force to /view if current route is /planner
|
||||||
if (route.value.path === "/group/mealplan/planner") {
|
if (route.value.path === "/group/mealplan/planner") {
|
||||||
|
@ -72,6 +80,10 @@ export default defineComponent({
|
||||||
end: addDays(new Date(), 6),
|
end: addDays(new Date(), 6),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const firstDayOfWeek = computed(() => {
|
||||||
|
return group.value?.preferences?.firstDayOfWeek || 0;
|
||||||
|
});
|
||||||
|
|
||||||
const recipeSearchTerm = ref("");
|
const recipeSearchTerm = ref("");
|
||||||
|
|
||||||
const weekRange = computed(() => {
|
const weekRange = computed(() => {
|
||||||
|
@ -128,6 +140,7 @@ export default defineComponent({
|
||||||
actions,
|
actions,
|
||||||
mealsByDate,
|
mealsByDate,
|
||||||
weekRange,
|
weekRange,
|
||||||
|
firstDayOfWeek,
|
||||||
recipeSearchTerm,
|
recipeSearchTerm,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
|
@ -46,8 +46,9 @@
|
||||||
</template>
|
</template>
|
||||||
<v-date-picker
|
<v-date-picker
|
||||||
v-model="newMeal.date"
|
v-model="newMeal.date"
|
||||||
:first-day-of-week="firstDayOfWeek"
|
|
||||||
no-title
|
no-title
|
||||||
|
:first-day-of-week="firstDayOfWeek"
|
||||||
|
:local="$i18n.locale"
|
||||||
@input="state.pickerMenu = false"
|
@input="state.pickerMenu = false"
|
||||||
/>
|
/>
|
||||||
</v-menu>
|
</v-menu>
|
||||||
|
@ -256,13 +257,7 @@ export default defineComponent({
|
||||||
});
|
});
|
||||||
|
|
||||||
const firstDayOfWeek = computed(() => {
|
const firstDayOfWeek = computed(() => {
|
||||||
const pref = group.value?.preferences?.firstDayOfWeek;
|
return group.value?.preferences?.firstDayOfWeek || 0;
|
||||||
|
|
||||||
if (pref) {
|
|
||||||
return pref;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
});
|
});
|
||||||
|
|
||||||
function onMoveCallback(evt: SortableEvent) {
|
function onMoveCallback(evt: SortableEvent) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue