diff --git a/cookbook/views/views.py b/cookbook/views/views.py index 1654f4ad..d3b17468 100644 --- a/cookbook/views/views.py +++ b/cookbook/views/views.py @@ -1,6 +1,6 @@ import os +import re from datetime import datetime, timedelta -from typing import re from uuid import UUID from django.conf import settings diff --git a/vue/src/apps/RecipeView/RecipeView.vue b/vue/src/apps/RecipeView/RecipeView.vue index 02d90c32..78d96cae 100644 --- a/vue/src/apps/RecipeView/RecipeView.vue +++ b/vue/src/apps/RecipeView/RecipeView.vue @@ -61,7 +61,7 @@
- +

diff --git a/vue/src/components/RecipeContextMenu.vue b/vue/src/components/RecipeContextMenu.vue index bdf848c1..310c3d95 100644 --- a/vue/src/components/RecipeContextMenu.vue +++ b/vue/src/components/RecipeContextMenu.vue @@ -14,14 +14,18 @@ {{ _('Add to Book') }} - - {{ _('Add to Shopping') }} + + {{ _('Add to Shopping') }} + - {{ _('Add to Plan') }} + {{ _('Add to Plan') }} + - @@ -29,13 +33,11 @@ class="fas fa-print fa-fw"> {{ _('Print') }} - {{ _('Export') }} {{ - _('Share') - }} + rel="noopener noreferrer" v-if="recipe.internal"> {{ _('Share') }} @@ -59,8 +61,20 @@ export default { components: { CookLog }, + data() { + return { + servings_value: 0 + } + }, props: { recipe: Object, + servings: { + type: Number, + default: -1 + } + }, + mounted() { + this.servings_value = ((this.servings === -1) ? this.recipe.servings : this.servings) } } diff --git a/vue/src/utils/utils.js b/vue/src/utils/utils.js index 27c6164f..e23be726 100644 --- a/vue/src/utils/utils.js +++ b/vue/src/utils/utils.js @@ -53,13 +53,13 @@ export const ResolveUrlMixin = { * @param {string} url name of url * @param {*} params tuple of params to pass to django named url */ - resolveDjangoUrl: function (url, params) { + resolveDjangoUrl: function (url, params = null) { return resolveDjangoUrl(url, params) } } } -export function resolveDjangoUrl(url, params=null) { +export function resolveDjangoUrl(url, params = null) { if (params !== null) { return window.Urls[url](params) } else { diff --git a/vue/webpack-stats.json b/vue/webpack-stats.json index c83573df..c741b6fa 100644 --- a/vue/webpack-stats.json +++ b/vue/webpack-stats.json @@ -1 +1 @@ -{"status":"done","publicPath":"http://localhost:8080/","chunks":{"chunk-vendors":[{"name":"js/chunk-vendors.js","publicPath":"http://localhost:8080/js/chunk-vendors.js","path":"F:\\Developement\\Django\\recipes\\cookbook\\static\\vue\\js\\chunk-vendors.js"}],"recipe_view":[{"name":"js/recipe_view.js","publicPath":"http://localhost:8080/js/recipe_view.js","path":"F:\\Developement\\Django\\recipes\\cookbook\\static\\vue\\js\\recipe_view.js"}]},"error":"ModuleError","message":"Module Error (from ./node_modules/eslint-loader/index.js):\n\nF:\\Developement\\Django\\recipes\\vue\\src\\utils\\utils.js\n 63:8 error Parsing error: Unexpected token, expected \"(\"\n\n 61 | \n 62 | export function resolveDjangoUrl(url, params=null) {\n> 63 | if params !== null\n | ^\n 64 | return window.Urls[url](params)\n 65 | else:\n 66 | return window.Urls[url]\n\n✖ 1 problem (1 error, 0 warnings)\n"} \ No newline at end of file +{"status":"done","publicPath":"http://localhost:8080/","chunks":{"chunk-vendors":[{"name":"js/chunk-vendors.js","publicPath":"http://localhost:8080/js/chunk-vendors.js","path":"F:\\Developement\\Django\\recipes\\cookbook\\static\\vue\\js\\chunk-vendors.js"}],"recipe_view":[{"name":"js/recipe_view.js","publicPath":"http://localhost:8080/js/recipe_view.js","path":"F:\\Developement\\Django\\recipes\\cookbook\\static\\vue\\js\\recipe_view.js"},{"name":"recipe_view.249c42bfc6c344069b28.hot-update.js","publicPath":"http://localhost:8080/recipe_view.249c42bfc6c344069b28.hot-update.js","path":"F:\\Developement\\Django\\recipes\\cookbook\\static\\vue\\recipe_view.249c42bfc6c344069b28.hot-update.js"}]},"error":"ModuleError","message":"Module Error (from ./node_modules/eslint-loader/index.js):\n\nF:\\Developement\\Django\\recipes\\vue\\src\\utils\\utils.js\n 63:8 error Parsing error: Unexpected token, expected \"(\"\n\n 61 | \n 62 | export function resolveDjangoUrl(url, params=null) {\n> 63 | if params !== null\n | ^\n 64 | return window.Urls[url](params)\n 65 | else:\n 66 | return window.Urls[url]\n\n✖ 1 problem (1 error, 0 warnings)\n"} \ No newline at end of file