Use correct serving count from recipe view -> add to shopping
This commit is contained in:
@ -39,7 +39,7 @@
|
|||||||
<button class="dropdown-item" onclick="$('#bookmarkModal').modal({'show':true})">
|
<button class="dropdown-item" onclick="$('#bookmarkModal').modal({'show':true})">
|
||||||
<i class="fas fa-bookmark fa-fw"></i> {% trans 'Add to Book' %}</button>
|
<i class="fas fa-bookmark fa-fw"></i> {% trans 'Add to Book' %}</button>
|
||||||
|
|
||||||
<a class="dropdown-item" v-bind:href="getShoppingUrl()" v-if="has_ingredients">
|
<a class="dropdown-item" v-bind:href="shopping_url" v-if="has_ingredients">
|
||||||
<i class="fas fa-shopping-cart fa-fw"></i> {% trans 'Add to Shopping' %}</a>
|
<i class="fas fa-shopping-cart fa-fw"></i> {% trans 'Add to Shopping' %}</a>
|
||||||
|
|
||||||
<a class="dropdown-item" href="{% url 'new_meal_plan' %}?recipe={{ recipe.pk }}"><i
|
<a class="dropdown-item" href="{% url 'new_meal_plan' %}?recipe={{ recipe.pk }}"><i
|
||||||
@ -530,7 +530,10 @@
|
|||||||
computed: {
|
computed: {
|
||||||
ingredient_factor: function () {
|
ingredient_factor: function () {
|
||||||
return this.servings / recipe_servings
|
return this.servings / recipe_servings
|
||||||
}
|
},
|
||||||
|
shopping_url: function () {
|
||||||
|
return `{% url 'view_shopping' %}?r=[${this.recipe.id},${this.servings}]`
|
||||||
|
},
|
||||||
},
|
},
|
||||||
mounted: function () {
|
mounted: function () {
|
||||||
this.loadRecipe()
|
this.loadRecipe()
|
||||||
@ -583,9 +586,6 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
getShoppingUrl: function () {
|
|
||||||
return `{% url 'view_shopping' %}?r=[${this.recipe.id},${this.ingredient_factor}]`
|
|
||||||
},
|
|
||||||
calculateAmount: function (amount) {
|
calculateAmount: function (amount) {
|
||||||
{% if request.user.userpreference.use_fractions %}
|
{% if request.user.userpreference.use_fractions %}
|
||||||
let return_string = ''
|
let return_string = ''
|
||||||
|
Reference in New Issue
Block a user