Merge remote-tracking branch 'upstream/develop' into recipe_description

This commit is contained in:
smilerz
2021-03-18 15:33:50 -05:00
126 changed files with 8261 additions and 5838 deletions

View File

@ -0,0 +1,110 @@
<template>
<div id="app">
<div class="row">
<div class="col col-md-12">
<h2>{{ _('Import') }}</h2>
</div>
</div>
<br/>
<br/>
<template v-if="import_info !== undefined">
<template v-if="import_info.running" style="text-align: center;">
<div class="row">
<div class="col col-md-12">
</div>
</div>
<loading-spinner></loading-spinner>
<br/>
<br/>
<h5 style="text-align: center">{{ _('Import running, please wait!') }}</h5>
</template>
<template v-else>
<div class="row">
<div class="col col-md-12">
<span>{{ _('Import finished') }}! </span>
<a :href="`${resolveDjangoUrl('view_search') }?keywords=${import_info.keyword.id}`"
v-if="import_info.keyword !== null">{{ _('View Recipes') }}</a>
</div>
</div>
<br/>
<div class="row">
<div class="col col-md-12">
<label for="id_textarea">{{ _('Information') }}</label>
<textarea id="id_textarea" class="form-control" style="height: 50vh" v-html="import_info.msg"
disabled></textarea>
</div>
</div>
</template>
</template>
</div>
</template>
<script>
import Vue from 'vue'
import {BootstrapVue} from 'bootstrap-vue'
import 'bootstrap-vue/dist/bootstrap-vue.css'
import {GettextMixin, ResolveUrlMixin, ToastMixin} from "@/utils/utils";
import {apiLoadImportLog} from "@/utils/api";
import LoadingSpinner from "@/components/LoadingSpinner";
Vue.use(BootstrapVue)
export default {
name: 'ImportResponseView',
mixins: [
GettextMixin,
ResolveUrlMixin,
ToastMixin,
],
components: {
LoadingSpinner
},
data() {
return {
import_id: window.IMPORT_ID,
import_info: undefined,
}
},
mounted() {
this.refreshData()
setInterval(() => {
if ((this.import_id !== null) && window.navigator.onLine && this.import_info.running) {
this.refreshData()
}
}, 5000)
},
methods: {
refreshData: function () {
apiLoadImportLog(this.import_id).then(data => {
this.import_info = data
})
}
}
}
</script>
<style>
</style>

View File

@ -0,0 +1,8 @@
import Vue from 'vue'
import App from './ImportResponseView.vue'
Vue.config.productionTip = false
new Vue({
render: h => h(App),
}).$mount('#app')

View File

@ -122,7 +122,7 @@
<PdfViewer :recipe="recipe"></PdfViewer>
</div>
<div
v-if="recipe.file_path.includes('.png') || recipe.file_path.includes('.jpg') || recipe.file_path.includes('.jpeg')">
v-if="recipe.file_path.includes('.png') || recipe.file_path.includes('.jpg') || recipe.file_path.includes('.jpeg') || recipe.file_path.includes('.gif')">
<ImageViewer :recipe="recipe"></ImageViewer>
</div>
</template>

View File

@ -1,7 +1,7 @@
<template>
<div>
<img :src="pdfUrl" width="100%" height="700px" :alt="_('External Recipe Image')">
<div style="text-align: center">
<b-img :src="pdfUrl" :alt="_('External Recipe Image')"></b-img>
</div>
</template>

View File

@ -24,7 +24,7 @@
<i class="fas fa-shopping-cart fa-fw"></i> {{ _('Add to Shopping') }}
</a>
<a class="dropdown-item" :href="`${resolveDjangoUrl('new_meal_plan') }?r=${recipe.id}`"
<a class="dropdown-item" :href="`${resolveDjangoUrl('new_meal_plan') }?recipe=${recipe.id}`"
target="_blank" rel="noopener noreferrer"><i
class="fas fa-calendar fa-fw"></i> {{ _('Add to Plan') }}
</a>

View File

@ -18,6 +18,16 @@ export function apiLoadRecipe(recipe_id) {
})
}
export function apiLoadImportLog(id) {
let url = resolveDjangoUrl('api:importlog-detail', id)
return axios.get(url).then((response) => {
return response.data
}).catch((err) => {
handleError(err, 'There was an error loading a resource!', 'danger')
})
}
export function apiLogCooking(cook_log) {
return axios.post(resolveDjangoUrl('api:cooklog-list',), cook_log).then((response) => {