Merge branch 'dev' of https://github.com/hay-kot/mealie into feature/authentication

This commit is contained in:
hay-kot 2021-02-24 16:55:15 -09:00
commit 5f3a7ac69a
23 changed files with 103 additions and 18 deletions

View file

@ -17,7 +17,7 @@
:src="getImage(meal.slug)"
@click="openSearch(index)"
></v-img>
<v-card-title class="my-n3 mb-n6">{{ meal.dateText }}</v-card-title>
<v-card-title class="my-n3 mb-n6">{{ $d( new Date(meal.date), 'short' ) }}</v-card-title>
<v-card-subtitle> {{ meal.name }}</v-card-subtitle>
</v-card>
</v-hover>

View file

@ -69,16 +69,14 @@
<MealPlanCard v-model="meals" />
</v-card-text>
<v-row align="center" justify="end">
<v-card-actions>
<v-btn color="success" @click="random" v-if="meals[1]" text>
<v-card-actions class="mr-5">
<v-btn color="success" @click="random" v-if="meals.length > 0" text>
{{ $t("general.random") }}
</v-btn>
<v-btn color="success" @click="save" text>
<v-btn color="success" @click="save" text :disabled="meals.length == 0">
{{ $t("general.save") }}
</v-btn>
<v-spacer></v-spacer>
<v-btn icon @click="show = !show"> </v-btn>
</v-card-actions>
</v-row>
</v-card>
@ -136,7 +134,7 @@ export default {
let dateDif = (endDate - startDate) / (1000 * 3600 * 24) + 1;
if (dateDif <= 1) {
if (dateDif < 1) {
return null;
}

View file

@ -3,12 +3,8 @@ import VueI18n from "vue-i18n";
Vue.use(VueI18n);
function loadLocaleMessages() {
const locales = require.context(
"./locales",
true,
/[A-Za-z0-9-_,\s]+\.json$/i
);
function parseLocaleFiles(locales) {
const messages = {};
locales.keys().forEach(key => {
const matched = key.match(/([A-Za-z0-9-_]+)\./i);
@ -20,8 +16,28 @@ function loadLocaleMessages() {
return messages;
}
function loadLocaleMessages() {
const locales = require.context(
"./locales/messages",
true,
/[A-Za-z0-9-_,\s]+\.json$/i
);
return parseLocaleFiles(locales);
}
function loadDateTimeFormats() {
const locales = require.context(
"./locales/dateTimeFormats",
true,
/[A-Za-z0-9-_,\s]+\.json$/i
);
return parseLocaleFiles(locales);
}
export default new VueI18n({
locale: "en",
fallbackLocale: process.env.VUE_APP_I18N_FALLBACK_LOCALE || "en",
messages: loadLocaleMessages(),
dateTimeFormats: loadDateTimeFormats()
});

View file

@ -0,0 +1,7 @@
{
"short": {
"month": "short",
"day": "numeric",
"weekday": "long"
}
}

View file

@ -0,0 +1,7 @@
{
"short": {
"month": "short",
"day": "numeric",
"weekday": "long"
}
}

View file

@ -0,0 +1,7 @@
{
"short": {
"month": "short",
"day": "numeric",
"weekday": "long"
}
}

View file

@ -0,0 +1,7 @@
{
"short": {
"month": "short",
"day": "numeric",
"weekday": "long"
}
}

View file

@ -0,0 +1,7 @@
{
"short": {
"month": "short",
"day": "numeric",
"weekday": "long"
}
}

View file

@ -0,0 +1,7 @@
{
"short": {
"month": "short",
"day": "numeric",
"weekday": "long"
}
}

View file

@ -0,0 +1,7 @@
{
"short": {
"month": "short",
"day": "numeric",
"weekday": "long"
}
}

View file

@ -0,0 +1,7 @@
{
"short": {
"month": "short",
"day": "numeric",
"weekday": "long"
}
}

View file

@ -1,4 +1,12 @@
{
"dateTimeFormats": {
"short": {
"month": "short",
"day": "numeric",
"weekday": "long"
}
},
"404": {
"page-not-found": "404 Page Not Found",
"take-me-home": "Take me Home"

View file

@ -25,8 +25,8 @@
>
<v-card class="mt-1">
<v-card-title>
{{ formatDate(mealplan.startDate) }} -
{{ formatDate(mealplan.endDate) }}
{{ $d( new Date(mealplan.startDate), 'short' ) }} -
{{ $d( new Date(mealplan.endDate), 'short' ) }}
</v-card-title>
<v-list nav>
<v-list-item-group color="primary">
@ -43,7 +43,7 @@
</v-list-item-avatar>
<v-list-item-content>
<v-list-item-title v-text="meal.name"></v-list-item-title>
<v-list-item-subtitle v-text="meal.dateText">
<v-list-item-subtitle v-text="$d( new Date(meal.date), 'short' )" >
</v-list-item-subtitle>
</v-list-item-content>
</v-list-item>

View file

@ -18,7 +18,7 @@
<v-card-title class="justify-center">
{{ meal.name }}
</v-card-title>
<v-card-subtitle> {{ meal.dateText }}</v-card-subtitle>
<v-card-subtitle> {{ $d(new Date(meal.date), 'short' ) }}</v-card-subtitle>
<v-card-text> {{ meal.description }} </v-card-text>

View file

@ -63,6 +63,7 @@ const actions = {
}
},
async initTheme({ dispatch, getters }) {
//If theme is empty resetTheme
if (Object.keys(getters.getActiveTheme).length === 0) {

View file

@ -2,7 +2,7 @@ from datetime import date, timedelta
from typing import List, Optional
from db.database import db
from pydantic import BaseModel
from pydantic import BaseModel, validator
from sqlalchemy.orm.session import Session
from services.recipe_services import Recipe
@ -41,6 +41,12 @@ class MealPlan(BaseModel):
}
}
@validator('endDate')
def endDate_after_startDate(cls, v, values, **kwargs):
if 'startDate' in values and v < values['startDate']:
raise ValueError('EndDate should be greater than StartDate')
return v
def process_meals(self, session: Session):
meals = []
for x, meal in enumerate(self.meals):