From c20e036d90e9debd06975f9186412772e268d21c Mon Sep 17 00:00:00 2001 From: smilerz Date: Wed, 22 Dec 2021 16:18:45 -0600 Subject: [PATCH] add path to generic cards for food/keywords --- cookbook/serializer.py | 4 +- vue/src/components/GenericHorizontalCard.vue | 62 +++++++++---------- .../components/Modals/GenericModalForm.vue | 4 +- vue/src/components/Modals/SmallText.vue | 20 ++++++ vue/src/utils/models.js | 10 +++ 5 files changed, 64 insertions(+), 36 deletions(-) create mode 100644 vue/src/components/Modals/SmallText.vue diff --git a/cookbook/serializer.py b/cookbook/serializer.py index 4fe1b8148..fca43c1c5 100644 --- a/cookbook/serializer.py +++ b/cookbook/serializer.py @@ -305,7 +305,7 @@ class KeywordSerializer(UniqueFieldsMixin, ExtendedRecipeMixin): model = Keyword fields = ( 'id', 'name', 'icon', 'label', 'description', 'image', 'parent', 'numchild', 'numrecipe', 'created_at', - 'updated_at') + 'updated_at', 'full_name') read_only_fields = ('id', 'label', 'numchild', 'parent', 'image') @@ -403,7 +403,7 @@ class FoodSerializer(UniqueFieldsMixin, WritableNestedModelSerializer, ExtendedR model = Food fields = ( 'id', 'name', 'description', 'shopping', 'recipe', 'ignore_shopping', 'supermarket_category', - 'image', 'parent', 'numchild', 'numrecipe', 'on_hand', 'inherit', 'ignore_inherit', + 'image', 'parent', 'numchild', 'numrecipe', 'on_hand', 'inherit', 'ignore_inherit', 'full_name' ) read_only_fields = ('id', 'numchild', 'parent', 'image', 'numrecipe') diff --git a/vue/src/components/GenericHorizontalCard.vue b/vue/src/components/GenericHorizontalCard.vue index 6ea8e558d..4e3ecbf39 100644 --- a/vue/src/components/GenericHorizontalCard.vue +++ b/vue/src/components/GenericHorizontalCard.vue @@ -17,13 +17,14 @@ > - + - +
{{ item[title] }}
{{ item[subtitle] }}
+
{{ getFullname }}
- +
{{ item[child_count] }} {{ itemName }}
{{ text.hide_children }}
- +
{{ item[recipe_count] }} {{ $t("Recipes") }}
{{ $t("Hide_Recipes") }}
@@ -77,20 +68,19 @@
- - +
-
+
- + ")) { + return undefined + } + return this.item?.full_name + }, }, methods: { - handleDragStart: function(e) { + handleDragStart: function (e) { this.isError = false e.dataTransfer.setData("source", JSON.stringify(this.item)) }, - handleDragEnter: function(e) { + handleDragEnter: function (e) { if (!e.currentTarget.contains(e.relatedTarget) && e.relatedTarget != null) { this.over = true } }, - handleDragLeave: function(e) { + handleDragLeave: function (e) { if (!e.currentTarget.contains(e.relatedTarget)) { this.over = false } }, - handleDragDrop: function(e) { + handleDragDrop: function (e) { let source = JSON.parse(e.dataTransfer.getData("source")) if (source.id != this.item.id) { this.source = source @@ -247,7 +243,7 @@ export default { this.isError = true } }, - generateLocation: function(x = 0, y = 0) { + generateLocation: function (x = 0, y = 0) { return () => ({ width: 0, height: 0, @@ -257,10 +253,10 @@ export default { left: x, }) }, - closeMenu: function() { + closeMenu: function () { this.show_menu = false }, - finishAction: function(e) { + finishAction: function (e) { this.$emit("finish-action", e) }, }, diff --git a/vue/src/components/Modals/GenericModalForm.vue b/vue/src/components/Modals/GenericModalForm.vue index 26ede38bc..28d21666e 100644 --- a/vue/src/components/Modals/GenericModalForm.vue +++ b/vue/src/components/Modals/GenericModalForm.vue @@ -14,6 +14,7 @@ +