From 3880f205b6a879152ce85a3b637e5ec8f1e76e69 Mon Sep 17 00:00:00 2001 From: vabene1111 Date: Thu, 30 Jan 2025 10:29:21 +0100 Subject: [PATCH] various fixes --- cookbook/serializer.py | 12 ++++++++-- cookbook/views/views.py | 13 ++++++----- .../dialogs/ShoppingLineItemDialog.vue | 13 +++++++---- .../components/display/ShoppingListView.vue | 2 +- .../components/display/VSnackbarQueued.vue | 8 +++---- .../components/inputs/NumberScalerDialog.vue | 23 ++++++++++--------- vue3/src/components/inputs/StepEditor.vue | 1 + vue3/src/stores/MessageStore.ts | 10 ++++---- vue3/src/utils/model_utils.ts | 5 ++++ 9 files changed, 53 insertions(+), 34 deletions(-) diff --git a/cookbook/serializer.py b/cookbook/serializer.py index c9d734d0e..59093e9bf 100644 --- a/cookbook/serializer.py +++ b/cookbook/serializer.py @@ -1041,7 +1041,7 @@ class RecipeImageSerializer(WritableNestedModelSerializer): def create(self, validated_data): if 'image' in validated_data and not is_file_type_allowed(validated_data['image'].name, image_only=True): return None - return super().create( validated_data) + return super().create(validated_data) def update(self, instance, validated_data): if 'image' in validated_data and not is_file_type_allowed(validated_data['image'].name, image_only=True): @@ -1151,6 +1151,13 @@ class MealPlanSerializer(SpacedModelSerializer, WritableNestedModelSerializer): SLR.create(mealplan=mealplan, servings=validated_data['servings']) return mealplan + def update(self, obj, validated_data): + if sr := ShoppingListRecipe.objects.filter(mealplan=obj.id).first(): + SLR = RecipeShoppingEditor(user=obj.created_by, space=obj.space, id=sr.id) + SLR.edit(mealplan=obj, servings=validated_data['servings']) + + return super().update(obj, validated_data) + class Meta: model = MealPlan fields = ( @@ -1311,7 +1318,8 @@ class ViewLogSerializer(serializers.ModelSerializer): validated_data['created_by'] = self.context['request'].user validated_data['space'] = self.context['request'].space - view_log = ViewLog.objects.filter(recipe=validated_data['recipe'], created_by=self.context['request'].user, created_at__gt=(timezone.now() - timezone.timedelta(minutes=5)), space=self.context['request'].space).first() + view_log = ViewLog.objects.filter(recipe=validated_data['recipe'], created_by=self.context['request'].user, created_at__gt=(timezone.now() - timezone.timedelta(minutes=5)), + space=self.context['request'].space).first() if not view_log: view_log = ViewLog.objects.create(recipe=validated_data['recipe'], created_by=self.context['request'].user, space=self.context['request'].space) diff --git a/cookbook/views/views.py b/cookbook/views/views.py index 8c5ad1299..020d6ba86 100644 --- a/cookbook/views/views.py +++ b/cookbook/views/views.py @@ -533,14 +533,14 @@ def web_manifest(request): "url": "./mealplan", "icons": [ { - "src": static('logo_color_plan.svg'), + "src": static('assets/logo_color_plan.svg'), "sizes": "any" }, { - "src": static('logo_color_plan_144.png'), + "src": static('assets/logo_color_plan_144.png'), "type": "image/png", "sizes": "144x144" }, { - "src": static('logo_color_plan_512.png'), + "src": static('assets/logo_color_plan_512.png'), "type": "image/png", "sizes": "512x512" } @@ -552,14 +552,14 @@ def web_manifest(request): "url": "./shopping", "icons": [ { - "src": static('logo_color_shopping.svg'), + "src": static('assets/logo_color_shopping.svg'), "sizes": "any" }, { - "src": static('logo_color_shopping_144.png'), + "src": static('assets/logo_color_shopping_144.png'), "type": "image/png", "sizes": "144x144" }, { - "src": static('logo_color_shopping_512.png'), + "src": static('assets/logo_color_shopping_512.png'), "type": "image/png", "sizes": "512x512" } @@ -568,6 +568,7 @@ def web_manifest(request): "share_target": { "action": "/recipe/import", "method": "GET", + "enctype": "application/x-www-form-urlencoded", "params": { "title": "title", "url": "url", diff --git a/vue3/src/components/dialogs/ShoppingLineItemDialog.vue b/vue3/src/components/dialogs/ShoppingLineItemDialog.vue index c077c4f29..93a2392bf 100644 --- a/vue3/src/components/dialogs/ShoppingLineItemDialog.vue +++ b/vue3/src/components/dialogs/ShoppingLineItemDialog.vue @@ -87,24 +87,27 @@ - + - + - + - + - + + + + diff --git a/vue3/src/components/display/ShoppingListView.vue b/vue3/src/components/display/ShoppingListView.vue index c1a8d8778..c3e5fcabd 100644 --- a/vue3/src/components/display/ShoppingListView.vue +++ b/vue3/src/components/display/ShoppingListView.vue @@ -164,7 +164,7 @@