fixed recipe context menu
This commit is contained in:
parent
f9059f636c
commit
23bd0a7d90
@ -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
|
||||
|
@ -61,7 +61,7 @@
|
||||
</div>
|
||||
|
||||
<div class="col col-md-2 col-2" style="text-align: right; padding-right: 1vw">
|
||||
<recipe-context-menu v-bind:recipe="recipe"></recipe-context-menu>
|
||||
<recipe-context-menu v-bind:recipe="recipe" :servings="servings"></recipe-context-menu>
|
||||
</div>
|
||||
</div>
|
||||
<hr/>
|
||||
|
@ -14,14 +14,18 @@
|
||||
<i class="fas fa-bookmark fa-fw"></i> {{ _('Add to Book') }}
|
||||
</button>
|
||||
|
||||
<a class="dropdown-item" :href="recipe.name" v-if="true"> <!--TODO implement -->
|
||||
<i class="fas fa-shopping-cart fa-fw"></i> {{ _('Add to Shopping') }} </a>
|
||||
<a class="dropdown-item" :href="`${resolveDjangoUrl('view_shopping') }?r=[${recipe.id},${servings_value}]`"
|
||||
v-if="recipe.internal" target="_blank" rel="noopener noreferrer">
|
||||
<i class="fas fa-shopping-cart fa-fw"></i> {{ _('Add to Shopping') }}
|
||||
</a>
|
||||
|
||||
<a class="dropdown-item" :href="resolveDjangoUrl('new_meal_plan', recipe.id)"><i
|
||||
class="fas fa-calendar fa-fw"></i> {{ _('Add to Plan') }}</a>
|
||||
<a class="dropdown-item" :href="`${resolveDjangoUrl('new_meal_plan') }?r=${recipe.id}`"
|
||||
target="_blank" rel="noopener noreferrer"><i
|
||||
class="fas fa-calendar fa-fw"></i> {{ _('Add to Plan') }}
|
||||
</a>
|
||||
|
||||
|
||||
<button class="dropdown-item" @click="$bvModal.show('id_modal_cook_log')"><i
|
||||
<button class="dropdown-item" @click="$bvModal.show('id_modal_cook_log')"><i
|
||||
class="fas fa-clipboard-list fa-fw"></i> {{ _('Log Cooking') }}
|
||||
</button>
|
||||
|
||||
@ -29,13 +33,11 @@
|
||||
class="fas fa-print fa-fw"></i> {{ _('Print') }}
|
||||
</button>
|
||||
|
||||
<a class="dropdown-item" :href="resolveDjangoUrl('view_export', recipe.id)" target="_blank"
|
||||
<a class="dropdown-item" :href="resolveDjangoUrl('view_export') + '?r=' + recipe.id" target="_blank"
|
||||
rel="noopener noreferrer"><i class="fas fa-file-export fa-fw"></i> {{ _('Export') }}</a>
|
||||
|
||||
<a class="dropdown-item" :href="resolveDjangoUrl('new_share_link', recipe.id)" target="_blank"
|
||||
rel="noopener noreferrer" v-if="recipe.internal"><i class="fas fa-share-alt fa-fw"></i> {{
|
||||
_('Share')
|
||||
}}</a>
|
||||
rel="noopener noreferrer" v-if="recipe.internal"><i class="fas fa-share-alt fa-fw"></i> {{ _('Share') }}</a>
|
||||
</div>
|
||||
|
||||
|
||||
@ -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)
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
@ -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 {
|
||||
|
@ -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"}
|
||||
{"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"}
|
Loading…
Reference in New Issue
Block a user