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

View File

@ -302,6 +302,7 @@
loading: false, loading: false,
all_keywords: false, all_keywords: false,
importing_recipe: false, importing_recipe: false,
json_data: '',
}, },
directives: { directives: {
tabindex: { tabindex: {
@ -338,7 +339,13 @@
this.error = err.data this.error = err.data
this.loading = false this.loading = false
console.log(err) 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 () { loadRecipeJson: function () {
@ -353,7 +360,13 @@
this.error = err.data this.error = err.data
this.loading = false this.loading = false
console.log(err) 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 () { importRecipe: function () {