renamed ingredients_markdown and removed ingredients_vue

This commit is contained in:
vabene1111 2024-02-24 13:05:23 +01:00
parent 6de68707ed
commit ae70064c06
4 changed files with 19 additions and 20 deletions

2
.gitignore vendored
View File

@ -87,3 +87,5 @@ vue/webpack-stats.json
cookbook/templates/sw.js
.prettierignore
vue/.yarn
vue3/.vite
vue3/node_modules

View File

@ -772,8 +772,7 @@ class IngredientSerializer(IngredientSimpleSerializer):
class StepSerializer(WritableNestedModelSerializer, ExtendedRecipeMixin):
ingredients = IngredientSerializer(many=True)
ingredients_markdown = serializers.SerializerMethodField('get_ingredients_markdown')
ingredients_vue = serializers.SerializerMethodField('get_ingredients_vue')
instructions_markdown = serializers.SerializerMethodField('get_instructions_markdown')
file = UserFileViewSerializer(allow_null=True, required=False)
step_recipe_data = serializers.SerializerMethodField('get_step_recipe_data')
recipe_filter = 'steps'
@ -782,10 +781,7 @@ class StepSerializer(WritableNestedModelSerializer, ExtendedRecipeMixin):
validated_data['space'] = self.context['request'].space
return super().create(validated_data)
def get_ingredients_vue(self, obj):
return obj.get_instruction_render()
def get_ingredients_markdown(self, obj):
def get_instructions_markdown(self, obj):
return obj.get_instruction_render()
def get_step_recipes(self, obj):
@ -800,8 +796,8 @@ class StepSerializer(WritableNestedModelSerializer, ExtendedRecipeMixin):
class Meta:
model = Step
fields = (
'id', 'name', 'instruction', 'ingredients', 'ingredients_markdown',
'ingredients_vue', 'time', 'order', 'show_as_header', 'file', 'step_recipe',
'id', 'name', 'instruction', 'ingredients', 'instructions_markdown',
'time', 'order', 'show_as_header', 'file', 'step_recipe',
'step_recipe_data', 'numrecipe', 'show_ingredients_table'
)
@ -873,6 +869,13 @@ class RecipeBaseSerializer(WritableNestedModelSerializer):
return False
class CommentSerializer(serializers.ModelSerializer):
class Meta:
model = Comment
fields = '__all__'
read_only_fields = ['id', 'created_at', 'created_by', 'updated_at',]
class RecipeOverviewSerializer(RecipeBaseSerializer):
keywords = KeywordLabelSerializer(many=True)
new = serializers.SerializerMethodField('is_recipe_new')
@ -950,12 +953,6 @@ class RecipeImportSerializer(SpacedModelSerializer):
fields = '__all__'
class CommentSerializer(serializers.ModelSerializer):
class Meta:
model = Comment
fields = '__all__'
class CustomFilterSerializer(SpacedModelSerializer, WritableNestedModelSerializer):
shared = UserSerializer(many=True, required=False)
@ -1150,7 +1147,7 @@ class ShoppingListEntrySerializer(WritableNestedModelSerializer):
'recipe_mealplan',
'created_by', 'created_at', 'updated_at', 'completed_at', 'delay_until'
)
read_only_fields = ('id', 'created_by', 'created_at','updated_at',)
read_only_fields = ('id', 'created_by', 'created_at', 'updated_at',)
class ShoppingListEntryBulkSerializer(serializers.Serializer):

View File

@ -44,7 +44,7 @@
<!-- step text -->
<div class="row">
<div class="col col-md-12">
<compile-component :code="step.ingredients_markdown"
<compile-component :code="step.instructions_markdown"
:ingredient_factor="ingredient_factor"></compile-component>
</div>
</div>

View File

@ -2878,7 +2878,7 @@ export interface RecipeSteps {
* @type {string}
* @memberof RecipeSteps
*/
ingredients_markdown?: string;
instructions_markdown?: string;
/**
*
* @type {string}
@ -3731,7 +3731,7 @@ export interface Step {
* @type {string}
* @memberof Step
*/
ingredients_markdown?: string;
instructions_markdown?: string;
/**
*
* @type {string}