diff --git a/src/components/ingredients/EditableIngredientsPanel.vue b/src/components/ingredients/EditableIngredientsPanel.vue
index 720501f..9184ac1 100644
--- a/src/components/ingredients/EditableIngredientsPanel.vue
+++ b/src/components/ingredients/EditableIngredientsPanel.vue
@@ -1,6 +1,8 @@
+
+
-
-
@@ -81,6 +81,12 @@ export default {
const newIngredients = await data.parseIngredients([line]);
this.$emit('on-update-ingredient', ingredient, newIngredients[0]);
},
+ toggleEditing() {
+ this.editing = !this.editing;
+ if (this.editing && !this.ingredients.length) {
+ this.$emit('on-add');
+ }
+ }
}
}
diff --git a/src/components/ingredients/IngredientAddBox.vue b/src/components/ingredients/IngredientAddBox.vue
deleted file mode 100644
index 9602e72..0000000
--- a/src/components/ingredients/IngredientAddBox.vue
+++ /dev/null
@@ -1,89 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/src/components/meals/EditMealPage.vue b/src/components/meals/EditMealPage.vue
index b04bee0..6bee3e0 100644
--- a/src/components/meals/EditMealPage.vue
+++ b/src/components/meals/EditMealPage.vue
@@ -29,18 +29,7 @@
Sides & Additional Ingredients
-
- -
-
-
-
-
-
-
Add some ingredients using the search box
-
-
+
@@ -50,14 +39,13 @@
import data from '@/data.js'
import RecipeSearchBox from '@/components/recipes/RecipeSearchBox.vue';
import RecipeCard from '@/components/recipes/RecipeCard.vue';
-import CompactParsedIngredient from '@/components/ingredients/CompactParsedIngredient.vue';
import DatePicker from './DatePicker.vue';
-import IngredientAddBox from '@/components/ingredients/IngredientAddBox.vue';
+import EditableIngredientsPanel from '../ingredients/EditableIngredientsPanel.vue';
import PersonList from './PersonList.vue';
export default {
props: ['id'],
- components: { RecipeSearchBox, DatePicker, RecipeCard, IngredientAddBox, CompactParsedIngredient, PersonList },
+ components: { RecipeSearchBox, DatePicker, RecipeCard, EditableIngredientsPanel, PersonList },
data() {
return {
meal: {
@@ -98,12 +86,15 @@ export default {
removeRecipe(recipe) {
this.meal.recipes = this.meal.recipes.filter(r => r.id !== recipe.id);
},
- addIngredient(ingredient) {
- this.meal.extra_ingredients.push(ingredient);
+ addIngredient() {
+ this.meal.extra_ingredients = [{ line: '', product: null }, ...this.meal.extra_ingredients];
},
deleteIngredient(ingredient) {
this.meal.extra_ingredients = this.meal.extra_ingredients.filter(i => i != ingredient);
},
+ updateIngredient(ingredient, newIngredient) {
+ this.meal.extra_ingredients = this.meal.extra_ingredients.map(i => i == ingredient ? newIngredient : i);
+ },
removePerson(list, person) {
this.meal[list] = this.meal[list].filter(p => p.id !== person.id);
},
diff --git a/src/components/recipes/EditRecipePage.vue b/src/components/recipes/EditRecipePage.vue
index 7c059d7..e855bfc 100644
--- a/src/components/recipes/EditRecipePage.vue
+++ b/src/components/recipes/EditRecipePage.vue
@@ -15,19 +15,12 @@
Ingredients
-
+
-
@@ -65,40 +58,18 @@ input.recipe-name {
text-decoration: none;
}
-ul {
- padding: 0;
-}
-
-li {
- list-style: none;
- display: flex;
- flex-direction: row;
- justify-content: space-between;
- border: 1px solid #ccc;
- border-radius: 5px;
- padding: 5px;
-}
-
-.ingredient-line {
- flex: 1;
- margin: 0;
- margin-right: 1em;
-}
-