mirror of
https://github.com/TandoorRecipes/recipes.git
synced 2026-01-02 20:59:28 -05:00
fix url_import
This commit is contained in:
@@ -660,13 +660,14 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script src="{% url 'javascript-catalog' %}"></script>
|
<script src="{% url 'javascript-catalog' %}">
|
||||||
|
</script>
|
||||||
<script type="application/javascript">
|
<script type="application/javascript">
|
||||||
let csrftoken = Cookies.get('csrftoken');
|
let csrftoken = Cookies.get('csrftoken');
|
||||||
Vue.http.headers.common['X-CSRFToken'] = csrftoken;
|
Vue.http.headers.common['X-CSRFToken'] = csrftoken;
|
||||||
|
|
||||||
Vue.component('vue-multiselect', window.VueMultiselect.default)
|
Vue.component('vue-multiselect', window.VueMultiselect.default)
|
||||||
import { ApiApiFactory } from "@/utils/openapi/api"
|
|
||||||
|
|
||||||
let app = new Vue({
|
let app = new Vue({
|
||||||
components: {
|
components: {
|
||||||
@@ -885,27 +886,27 @@
|
|||||||
this.$set(this.$refs.ingredient[index].$data, 'search', this.recipe_data.recipeIngredient[index].ingredient.text)
|
this.$set(this.$refs.ingredient[index].$data, 'search', this.recipe_data.recipeIngredient[index].ingredient.text)
|
||||||
},
|
},
|
||||||
searchKeywords: function (query) {
|
searchKeywords: function (query) {
|
||||||
// this.keywords_loading = true
|
|
||||||
// this.$http.get("{% url 'dal_keyword' %}" + '?q=' + query).then((response) => {
|
|
||||||
// this.keywords = response.data.results;
|
|
||||||
// this.keywords_loading = false
|
|
||||||
// }).catch((err) => {
|
|
||||||
// console.log(err)
|
|
||||||
// this.makeToast(gettext('Error'), gettext('There was an error loading a resource!') + err.bodyText, 'danger')
|
|
||||||
// })
|
|
||||||
let apiFactory = new ApiApiFactory()
|
|
||||||
|
|
||||||
this.keywords_loading = true
|
this.keywords_loading = true
|
||||||
apiFactory
|
this.$http.get("{% url 'dal_keyword' %}" + '?q=' + query).then((response) => {
|
||||||
.listKeywords(query, undefined, undefined, 1, this.options_limit)
|
this.keywords = response.data.results;
|
||||||
.then((response) => {
|
this.keywords_loading = false
|
||||||
this.keywords = response.data.results
|
}).catch((err) => {
|
||||||
this.keywords_loading = false
|
console.log(err)
|
||||||
})
|
this.makeToast(gettext('Error'), gettext('There was an error loading a resource!') + err.bodyText, 'danger')
|
||||||
.catch((err) => {
|
})
|
||||||
console.log(err)
|
// let apiFactory = new ApiApiFactory()
|
||||||
StandardToasts.makeStandardToast(StandardToasts.FAIL_FETCH)
|
|
||||||
})
|
// this.keywords_loading = true
|
||||||
|
// apiFactory
|
||||||
|
// .listKeywords(query, undefined, undefined, 1, this.options_limit)
|
||||||
|
// .then((response) => {
|
||||||
|
// this.keywords = response.data.results
|
||||||
|
// this.keywords_loading = false
|
||||||
|
// })
|
||||||
|
// .catch((err) => {
|
||||||
|
// console.log(err)
|
||||||
|
// StandardToasts.makeStandardToast(StandardToasts.FAIL_FETCH)
|
||||||
|
// })
|
||||||
},
|
},
|
||||||
searchUnits: function (query) {
|
searchUnits: function (query) {
|
||||||
let apiFactory = new ApiApiFactory()
|
let apiFactory = new ApiApiFactory()
|
||||||
@@ -932,46 +933,46 @@
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
searchIngredients: function (query) {
|
searchIngredients: function (query) {
|
||||||
// this.ingredients_loading = true
|
this.ingredients_loading = true
|
||||||
// this.$http.get("{% url 'dal_food' %}" + '?q=' + query).then((response) => {
|
this.$http.get("{% url 'dal_food' %}" + '?q=' + query).then((response) => {
|
||||||
// this.ingredients = response.data.results
|
this.ingredients = response.data.results
|
||||||
// if (this.recipe_data !== undefined) {
|
if (this.recipe_data !== undefined) {
|
||||||
// for (let x of Array.from(this.recipe_data.recipeIngredient)) {
|
for (let x of Array.from(this.recipe_data.recipeIngredient)) {
|
||||||
// if (x.ingredient.text !== '') {
|
if (x.ingredient.text !== '') {
|
||||||
// this.ingredients = this.ingredients.filter(item => item.text !== x.ingredient.text)
|
this.ingredients = this.ingredients.filter(item => item.text !== x.ingredient.text)
|
||||||
// this.ingredients.push(x.ingredient)
|
this.ingredients.push(x.ingredient)
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// this.ingredients_loading = false
|
|
||||||
// }).catch((err) => {
|
|
||||||
// console.log(err)
|
|
||||||
// this.makeToast(gettext('Error'), gettext('There was an error loading a resource!') + err.bodyText, 'danger')
|
|
||||||
// })
|
|
||||||
let apiFactory = new ApiApiFactory()
|
|
||||||
|
|
||||||
this.foods_loading = true
|
|
||||||
apiFactory
|
|
||||||
.listFoods(query, undefined, undefined, 1, this.options_limit)
|
|
||||||
.then((response) => {
|
|
||||||
this.foods = response.data.results
|
|
||||||
|
|
||||||
if (this.recipe !== undefined) {
|
|
||||||
for (let s of this.recipe.steps) {
|
|
||||||
for (let i of s.ingredients) {
|
|
||||||
if (i.food !== null && i.food.id === undefined) {
|
|
||||||
this.foods.push(i.food)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
this.foods_loading = false
|
this.ingredients_loading = false
|
||||||
})
|
}).catch((err) => {
|
||||||
.catch((err) => {
|
console.log(err)
|
||||||
StandardToasts.makeStandardToast(StandardToasts.FAIL_FETCH)
|
this.makeToast(gettext('Error'), gettext('There was an error loading a resource!') + err.bodyText, 'danger')
|
||||||
})
|
})
|
||||||
|
// let apiFactory = new ApiApiFactory()
|
||||||
|
|
||||||
|
// this.foods_loading = true
|
||||||
|
// apiFactory
|
||||||
|
// .listFoods(query, undefined, undefined, 1, this.options_limit)
|
||||||
|
// .then((response) => {
|
||||||
|
// this.foods = response.data.results
|
||||||
|
|
||||||
|
// if (this.recipe !== undefined) {
|
||||||
|
// for (let s of this.recipe.steps) {
|
||||||
|
// for (let i of s.ingredients) {
|
||||||
|
// if (i.food !== null && i.food.id === undefined) {
|
||||||
|
// this.foods.push(i.food)
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
// this.foods_loading = false
|
||||||
|
// })
|
||||||
|
// .catch((err) => {
|
||||||
|
// StandardToasts.makeStandardToast(StandardToasts.FAIL_FETCH)
|
||||||
|
// })
|
||||||
},
|
},
|
||||||
deleteNode: function (node, item, e) {
|
deleteNode: function (node, item, e) {
|
||||||
e.stopPropagation()
|
e.stopPropagation()
|
||||||
|
|||||||
Reference in New Issue
Block a user