fixed url importer stuff

This commit is contained in:
vabene1111 2021-03-19 10:05:17 +01:00
parent d3b1139a22
commit 58fc26904b
2 changed files with 17 additions and 4 deletions

View File

@ -236,7 +236,6 @@ def get_from_scraper(scrape, space):
recipe_json['prepTime'] = 0
recipe_json['cookTime'] = 0
description += "\n\nImported from " + scrape.url
recipe_json['description'] = description
try:
@ -315,6 +314,7 @@ def get_from_scraper(scrape, space):
except AttributeError:
recipe_json['recipeInstructions'] = ""
recipe_json['recipeInstructions'] += "\n\nImported from " + scrape.url
return recipe_json

View File

@ -63,7 +63,7 @@
<textarea id="id_description" class="form-control" v-model="recipe_data.description"
rows="4"></textarea>
</div>
<div class="row">
<div class="col col-md-6" v-if="recipe_data.image !== ''">
<img v-bind:src="recipe_data.image" alt="{% trans 'Recipe Image' %}"
@ -302,6 +302,7 @@
loading: false,
all_keywords: false,
importing_recipe: false,
json_data: '',
},
directives: {
tabindex: {
@ -338,7 +339,13 @@
this.error = err.data
this.loading = false
console.log(err)
this.makeToast(gettext('Error'), gettext('There was an error loading a resource!') + err.bodyText, 'danger')
let msg = gettext('There was an error loading a resource!')
if (err.bodyText.length < 300) {
msg += err.bodyText
} else {
msg += ' ' + err.status + ' ' + err.statusText
}
this.makeToast(gettext('Error'), msg, 'danger')
})
},
loadRecipeJson: function () {
@ -353,7 +360,13 @@
this.error = err.data
this.loading = false
console.log(err)
this.makeToast(gettext('Error'), gettext('There was an error loading a resource!') + err.bodyText, 'danger')
let msg = gettext('There was an error loading a resource!')
if (err.bodyText.length < 300) {
msg += err.bodyText
} else {
msg += ' ' + err.status + ' ' + err.statusText
}
this.makeToast(gettext('Error'), msg, 'danger')
})
},
importRecipe: function () {