1
0
Fork 0
mirror of https://github.com/mealie-recipes/mealie.git synced 2025-08-04 04:55:21 +02:00

file reorganize

This commit is contained in:
Hayden 2021-01-08 17:09:03 -09:00
parent a731b9f6ab
commit fef8ad540a
28 changed files with 80 additions and 231 deletions

View file

@ -1,75 +0,0 @@
<template>
<v-container>
<v-alert v-if="newVersion" color="green" type="success" outlined>
A New Version of Mealie is Avaiable,
<a href="https://github.com/hay-kot/mealie" class="green--text">
Visit the Repo
</a>
</v-alert>
<Theme />
<Backup />
<Webhooks />
<Migration />
<p class="text-center my-2">
Version: {{ version }} | Latest: {{ latestVersion }} ·
<a href="https://hay-kot.github.io/mealie/" target="_blank">
Explore the Docs
</a>
·
<a
href="https://hay-kot.github.io/mealie/2.1%20-%20Contributions/"
target="_blank"
>
Contribute
</a>
</p>
</v-container>
</template>
<script>
import Backup from "./Backup";
import Webhooks from "./Webhooks";
import Theme from "./Theme";
import Migration from "./Migration";
import axios from "axios";
export default {
components: {
Backup,
Webhooks,
Theme,
Migration,
},
data() {
return {
latestVersion: null,
version: "v0.0.1",
};
},
mounted() {
this.getVersion();
},
computed: {
newVersion() {
if ((this.latestVersion != null) & (this.latestVersion != this.version)) {
console.log("New Version Avaiable");
return true;
} else {
return false;
}
},
},
methods: {
async getVersion() {
let response = await axios.get(
"https://api.github.com/repos/hay-kot/mealie/releases/latest"
);
console.log(response);
this.latestVersion = response.data.tag_name;
},
},
};
</script>
<style>
</style>

View file

@ -1,12 +0,0 @@
<template>
<v-card>
<v-card-title class="card-title mt-1"> SFTP Settings </v-card-title>
</v-card>
</template>
<script>
export default {};
</script>
<style>
</style>

View file

@ -1,12 +0,0 @@
<template>
<v-card>
<v-card-title class="card-title mt-1"> User Settings </v-card-title>
</v-card>
</template>
<script>
export default {};
</script>
<style>
</style>

View file

@ -1,18 +0,0 @@
<template>
<div>
<RecentRecipes />
</div>
</template>
<script>
import RecentRecipes from "./RecentRecipes";
export default {
components: {
RecentRecipes,
},
};
</script>
<style>
</style>

View file

@ -1,125 +0,0 @@
<template>
<div>
<EditPlan
v-if="editMealPlan"
:meal-plan="editMealPlan"
@updated="planUpdated"
/>
<NewMeal v-else @created="requestMeals" />
<v-card class="my-1">
<v-card-title class="secondary white--text"> Meal Plans </v-card-title>
<v-timeline align-top :dense="$vuetify.breakpoint.smAndDown">
<v-timeline-item
class="mx-4"
v-for="(mealplan, i) in plannedMeals"
:key="i"
color="accent lighten-2"
icon="mdi-silverware-variant"
fill-dot
>
<v-card>
<v-card-title class="white--text secondary lighten-1">
{{ formatDate(mealplan.startDate) }} -
{{ formatDate(mealplan.endDate) }}
</v-card-title>
<v-card-text>
<v-row dense align="center">
<v-col></v-col>
<v-col
v-for="(meal, index) in mealplan.meals"
:key="generateKey(meal.slug, index)"
>
<v-img
class="rounded-lg info"
:src="getImage(meal.image)"
height="80"
width="80"
>
</v-img>
</v-col>
<v-col></v-col>
</v-row>
<v-row class="mt-2 ml-1">
<v-btn
color="accent lighten-2"
class="mx-0"
text
@click="editPlan(mealplan.uid)"
>
Edit
</v-btn>
<v-btn
color="error lighten-2"
class="mx-2"
text
@click="deletePlan(mealplan.uid)"
>
Delete
</v-btn>
</v-row>
</v-card-text>
</v-card>
</v-timeline-item>
</v-timeline>
</v-card>
</div>
</template>
<script>
import api from "../../api";
import utils from "../../utils";
import NewMeal from "./NewMeal";
import EditPlan from "./EditPlan";
export default {
components: {
NewMeal,
EditPlan,
},
data: () => ({
plannedMeals: [],
editMealPlan: null,
}),
async mounted() {
this.requestMeals();
},
methods: {
async requestMeals() {
const response = await api.mealPlans.all();
this.plannedMeals = response.data;
},
generateKey(name, index) {
return utils.generateUniqueKey(name, index);
},
formatDate(timestamp) {
let dateObject = new Date(timestamp);
return utils.getDateAsTextAlt(dateObject);
},
getImage(image) {
return utils.getImageURL(image);
},
editPlan(id) {
this.plannedMeals.forEach((element) => {
if (element.uid === id) {
this.editMealPlan = element;
}
});
},
planUpdated() {
this.editMealPlan = null;
this.requestMeals();
},
deletePlan(id) {
api.mealPlans.delete(id);
this.requestMeals();
},
},
};
</script>
<style>
</style>

View file

@ -1,67 +0,0 @@
<template>
<v-container fill-height>
<v-row justify="center" align="center">
<v-col sm="12">
<v-card
v-for="(meal, index) in mealPlan.meals"
:key="index"
class="my-2"
>
<v-row dense no-gutters align="center" justify="center">
<v-col order="1" md="6" sm="12">
<v-card flat>
<v-card-title> {{ meal.name }} </v-card-title>
<v-card-subtitle> {{ meal.dateText }}</v-card-subtitle>
<v-card-text> {{ meal.description }} </v-card-text>
<v-card-actions>
<v-btn
color="secondary"
text
@click="$router.push(`/recipe/${meal.slug}`)"
>
View Recipe
</v-btn>
</v-card-actions>
</v-card>
</v-col>
<v-col order-sm="0" :order-md="getOrder(index)" md="6" sm="12">
<v-card>
<v-img :src="getImage(meal.image)" max-height="300"> </v-img>
</v-card>
</v-col>
</v-row>
</v-card>
</v-col>
</v-row>
</v-container>
</template>
<script>
import api from "../../api";
import utils from "../../utils";
export default {
data() {
return {
mealPlan: {},
};
},
async mounted() {
this.mealPlan = await api.mealPlans.thisWeek();
console.log(this.mealPlan);
},
methods: {
getOrder(index) {
if (index % 2 == 0) return 2;
else return 0;
},
getImage(image) {
return utils.getImageURL(image);
},
},
};
</script>
<style scoped>
</style>

View file

@ -1,112 +0,0 @@
<template>
<v-card :loading="isLoading">
<v-img v-if="image" height="400" :src="image">
<template v-slot:placeholder>
<v-row class="fill-height ma-0" align="center" justify="center">
<v-progress-circular
indeterminate
color="grey lighten-5"
></v-progress-circular>
</v-row>
</template>
</v-img>
<br v-else />
<ButtonRow
@json="jsonEditor = true"
@editor="jsonEditor = false"
@save="createRecipe"
/>
<div v-if="jsonEditor">
<!-- Probably not the best way, but it works! -->
<br />
<br />
<VJsoneditor
v-model="recipeDetails"
height="1500px"
:options="jsonEditorOptions"
/>
</div>
<EditRecipe v-else v-model="recipeDetails" @upload="getImage" />
</v-card>
</template>
<script>
import api from "../api";
import EditRecipe from "./RecipeEditor/EditRecipe";
import VJsoneditor from "v-jsoneditor";
import ButtonRow from "./UI/ButtonRow";
export default {
components: {
VJsoneditor,
EditRecipe,
ButtonRow,
},
data() {
return {
isLoading: false,
fileObject: null,
selectedFile: null,
image: null,
jsonEditor: false,
jsonEditorOptions: {
mode: "code",
search: false,
mainMenuBar: false,
},
recipeDetails: {
name: "",
description: "",
image: "",
recipeYield: "",
recipeIngredient: [],
recipeInstructions: [],
slug: "",
filePath: "",
tags: [],
categories: [],
// dateAdded: "",
notes: [],
extras: [],
},
};
},
methods: {
getImage(fileObject) {
this.fileObject = fileObject;
this.onFileChange();
},
onFileChange() {
this.image = URL.createObjectURL(this.fileObject);
},
async createRecipe() {
this.isLoading = true;
if (this.fileObject) {
this.recipeDetails.image = this.fileObject.name;
}
let slug = await api.recipes.create(this.recipeDetails);
if (this.fileObject) {
await api.recipes.updateImage(slug, this.fileObject);
}
this.isLoading = false;
this.$router.push(`/recipe/${slug}`);
},
},
};
</script>
<style>
.img-input {
position: absolute;
bottom: 0;
}
</style>

View file

@ -1,23 +0,0 @@
<template>
<div class="text-center">
<v-row>
<v-col cols="2"></v-col>
<v-col>
<v-card height="">
<v-card-text>
<h1>404 No Page Found</h1>
</v-card-text>
<v-btn text block @click="$router.push('/')"> Take me Home </v-btn>
</v-card>
</v-col>
<v-col cols="2"></v-col>
</v-row>
</div>
</template>
<script>
export default {};
</script>
<style lang="scss" scoped>
</style>

View file

@ -1,157 +0,0 @@
<template>
<v-card id="myRecipe">
<v-img
height="400"
:src="getImage(recipeDetails.image)"
class="d-print-none"
:key="imageKey"
>
</v-img>
<ButtonRow
:open="showIcons"
@json="jsonEditor = true"
@editor="
jsonEditor = false;
form = true;
"
@save="saveRecipe"
@delete="deleteRecipe"
/>
<ViewRecipe
v-if="!form"
:name="recipeDetails.name"
:ingredients="recipeDetails.recipeIngredient"
:description="recipeDetails.description"
:instructions="recipeDetails.recipeInstructions"
:tags="recipeDetails.tags"
:categories="recipeDetails.categories"
:notes="recipeDetails.notes"
:rating="recipeDetails.rating"
:yields="recipeDetails.recipeYield"
:orgURL="recipeDetails.orgURL"
/>
<VJsoneditor
@error="logError()"
class="mt-10"
v-else-if="showJsonEditor"
v-model="recipeDetails"
height="1500px"
:options="jsonEditorOptions"
/>
<EditRecipe v-else v-model="recipeDetails" @upload="getImageFile" />
</v-card>
</template>
<script>
import api from "../api";
import utils from "../utils";
import VJsoneditor from "v-jsoneditor";
import ViewRecipe from "./RecipeEditor/ViewRecipe";
import EditRecipe from "./RecipeEditor/EditRecipe";
import ButtonRow from "./UI/ButtonRow";
export default {
components: {
VJsoneditor,
ViewRecipe,
EditRecipe,
ButtonRow
},
data() {
return {
// CurrentRecipe: this.$route.params.recipe,
form: false,
jsonEditor: false,
jsonEditorOptions: {
mode: "code",
search: false,
mainMenuBar: false
},
// Recipe Details //
recipeDetails: {
name: "",
description: "",
image: "",
recipeYield: "",
recipeIngredient: [],
recipeInstructions: [],
slug: "",
filePath: "",
url: "",
tags: [],
categories: [],
dateAdded: "",
notes: [],
rating: 0
},
imageKey: 1
};
},
mounted() {
this.getRecipeDetails();
},
watch: {
$route: function() {
this.getRecipeDetails();
}
},
computed: {
CurrentRecipe() {
return this.$route.params.recipe;
},
showIcons() {
return this.form;
},
showJsonEditor() {
if ((this.form === true) & (this.jsonEditor === true)) {
return true;
} else {
return false;
}
}
},
methods: {
getImageFile(fileObject) {
this.fileObject = fileObject;
},
async getRecipeDetails() {
this.recipeDetails = await api.recipes.requestDetails(this.CurrentRecipe);
this.form = false;
},
getImage(image) {
if (image) {
return utils.getImageURL(image) + "?rnd=" + this.imageKey;
}
},
deleteRecipe() {
api.recipes.delete(this.recipeDetails.slug);
},
async saveRecipe() {
await api.recipes.update(this.recipeDetails);
if (this.fileObject) {
await api.recipes.updateImage(this.recipeDetails.slug, this.fileObject);
}
this.form = false;
this.imageKey += 1;
},
showForm() {
this.form = true;
this.jsonEditor = false;
}
}
};
</script>
<style>
.card-btn {
margin-top: -10px;
}
.disabled-card {
opacity: 0.5;
}
</style>

View file

@ -175,8 +175,8 @@
</template>
<script>
import api from "../../api";
import utils from "../../utils";
import api from "../../../api";
import utils from "../../../utils";
import BulkAdd from "./BulkAdd";
export default {
components: {

View file

@ -1,128 +0,0 @@
<template>
<v-card-text>
<v-row>
<v-col cols="4">
<h2 class="mb-4">Ingredients</h2>
<div v-for="ingredient in ingredients" :key="ingredient">
<v-row align="center">
<v-checkbox hide-details class="shrink mr-2 mt-0"></v-checkbox>
<v-text-field :value="ingredient"></v-text-field>
</v-row>
</div>
<v-btn
class="ml-n5"
color="primary"
fab`
dark
small
@click="addIngredient"
>
<v-icon>mdi-plus</v-icon>
</v-btn>
<h2 class="mt-6">Categories</h2>
<v-combobox
dense
multiple
chips
item-color="primary"
deletable-chips
:value="categories"
>
<template v-slot:selection="data">
<v-chip :selected="data.selected" close color="primary" dark>
{{ data.item }}
</v-chip>
</template>
</v-combobox>
<h2 class="mt-4">Tags</h2>
<v-combobox dense multiple chips deletable-chips :value="tags">
<template v-slot:selection="data">
<v-chip :selected="data.selected" close color="primary" dark>
{{ data.item }}
</v-chip>
</template>
</v-combobox>
</v-col>
<v-divider :vertical="true"></v-divider>
<v-col>
<h2 class="mb-4">Instructions</h2>
<div v-for="(step, index) in instructions" :key="step.text">
<v-hover v-slot="{ hover }">
<v-card
class="ma-1"
:class="[{ 'on-hover': hover }]"
:elevation="hover ? 12 : 2"
>
<v-card-title>Step: {{ index + 1 }}</v-card-title>
<v-card-text>
<v-textarea dense :value="step.text"></v-textarea>
</v-card-text>
</v-card>
</v-hover>
</div>
<v-btn color="primary" fab dark small @click="addStep">
<v-icon>mdi-plus</v-icon>
</v-btn>
</v-col>
</v-row>
</v-card-text>
</template>
<script>
export default {
props: {
form: Boolean,
ingredients: Array,
instructions: Array,
categories: Array,
tags: Array,
},
data() {
return {
disabledSteps: [],
};
},
methods: {
toggleDisabled(stepIndex) {
if (this.disabledSteps.includes(stepIndex)) {
let index = this.disabledSteps.indexOf(stepIndex);
if (index !== -1) {
this.disabledSteps.splice(index, 1);
}
} else {
this.disabledSteps.push(stepIndex);
}
},
isDisabled(stepIndex) {
if (this.disabledSteps.includes(stepIndex)) {
return "disabled-card";
} else {
return;
}
},
saveRecipe() {
this.$emit("save");
},
deleteRecipe() {
this.$emit("delete");
},
addIngredient() {
this.$emit("addingredient");
},
addStep() {
this.$emit("addstep");
},
},
};
</script>
<style>
.disabled-card {
opacity: 0.5;
}
</style>

View file

@ -62,7 +62,8 @@
</template>
<script>
import api from "../../api";
import api from "../../../api";
export default {
data() {
return {

View file

@ -40,7 +40,7 @@
</template>
<script>
import api from "../../api";
import api from "../../../api";
// import TimePicker from "./Webhooks/TimePicker";
export default {
data() {

View file

@ -50,7 +50,7 @@
</v-select>
</v-col>
<v-col cols="12" sm="1">
<NewTheme @new-theme="appendTheme" />
<NewThemeDialog @new-theme="appendTheme" />
</v-col>
<v-col cols="12" sm="1">
<v-btn text color="error" @click="deleteSelectedThemeValidation">
@ -69,40 +69,40 @@
</v-form>
<v-row dense align-content="center" v-if="selectedTheme.colors">
<v-col>
<ColorPicker
<ColorPickerDialog
button-text="Primary"
v-model="selectedTheme.colors.primary"
/>
</v-col>
<v-col>
<ColorPicker
<ColorPickerDialog
button-text="Secondary"
v-model="selectedTheme.colors.secondary"
/>
</v-col>
<v-col>
<ColorPicker
<ColorPickerDialog
button-text="Accent"
v-model="selectedTheme.colors.accent"
/>
</v-col>
<v-col>
<ColorPicker
<ColorPickerDialog
button-text="Success"
v-model="selectedTheme.colors.success"
/>
</v-col>
<v-col>
<ColorPicker button-text="Info" v-model="selectedTheme.colors.info" />
<ColorPickerDialog button-text="Info" v-model="selectedTheme.colors.info" />
</v-col>
<v-col>
<ColorPicker
<ColorPickerDialog
button-text="Warning"
v-model="selectedTheme.colors.warning"
/>
</v-col>
<v-col>
<ColorPicker
<ColorPickerDialog
button-text="Error"
v-model="selectedTheme.colors.error"
/>
@ -125,16 +125,16 @@
</template>
<script>
import api from "../../api";
import ColorPicker from "./ThemeUI/ColorPicker";
import NewTheme from "./ThemeUI/NewTheme";
import Confirmation from "../UI/Confirmation";
import api from "../../../api";
import ColorPickerDialog from "./ColorPickerDialog";
import NewThemeDialog from "./NewThemeDialog";
import Confirmation from "../../UI/Confirmation";
export default {
components: {
ColorPicker,
ColorPickerDialog,
Confirmation,
NewTheme,
NewThemeDialog,
},
data() {
return {
@ -186,10 +186,10 @@ export default {
/**
* Create the new Theme and select it.
*/
async appendTheme(newTheme) {
await api.themes.create(newTheme);
this.availableThemes.push(newTheme);
this.selectedTheme = newTheme;
async appendTheme(NewThemeDialog) {
await api.themes.create(NewThemeDialog);
this.availableThemes.push(NewThemeDialog);
this.selectedTheme = NewThemeDialog;
},
themeSelected() {

View file

@ -20,7 +20,7 @@
></v-switch>
</v-col>
<v-col cols="12" md="3" sm="5">
<TimePicker @save-time="saveTime" />
<TimePickerDialog @save-time="saveTime" />
</v-col>
<v-col cols="12" md="4" sm="5">
<v-btn text color="info" @click="testWebhooks"> Test Webhooks </v-btn>
@ -60,11 +60,11 @@
</template>
<script>
import api from "../../api";
import TimePicker from "./Webhooks/TimePicker";
import api from "../../../api";
import TimePickerDialog from "./TimePickerDialog";
export default {
components: {
TimePicker,
TimePickerDialog,
},
data() {
return {

View file

@ -41,7 +41,7 @@
</template>
<script>
import api from "../api";
import api from "../../api";
export default {
data() {

View file

@ -20,7 +20,7 @@
</template>
<script>
import RecipeCard from "./UI/RecipeCard";
import RecipeCard from "./RecipeCard";
export default {
components: {