Merge branch 'develop' into json_import

This commit is contained in:
vabene1111
2021-05-01 22:39:20 +02:00
committed by GitHub
47 changed files with 2451 additions and 861 deletions

View File

@@ -27,6 +27,5 @@
window.IMPORT_ID = {{pk}};
</script>
{% render_bundle 'chunk-vendors' %}
{% render_bundle 'import_response_view' %}
{% endblock %}

View File

@@ -509,28 +509,28 @@
this.getRecipes();
},
getRecipes: function () {
let url = "{% url 'api:recipe-list' %}?limit=5"
let url = "{% url 'api:recipe-list' %}?page_size=5"
if (this.recipe_query !== '') {
url += '&query=' + this.recipe_query;
} else {
url += '&random=True'
url += '&random=true'
}
this.$http.get(url).then((response) => {
this.recipes = response.data;
this.recipes = response.data.results;
}).catch((err) => {
console.log("getRecipes error: ", err);
this.makeToast(gettext('Error'), gettext('There was an error loading a resource!') + err.bodyText, 'danger')
})
},
getMdNote: function () {
let url = "{% url 'api:recipe-list' %}?limit=5"
let url = "{% url 'api:recipe-list' %}?page_size=5"
if (this.recipe_query !== '') {
url += '&query=' + this.recipe_query;
}
this.$http.get(url).then((response) => {
this.recipes = response.data;
this.recipes = response.data.results;
}).catch((err) => {
console.log("getRecipes error: ", err);
this.makeToast(gettext('Error'), gettext('There was an error loading a resource!') + err.bodyText, 'danger')
@@ -627,13 +627,14 @@
cloneRecipe: function (recipe) {
let r = {
id: Math.round(Math.random() * 1000) + 10000,
recipe: recipe.id,
recipe: recipe,
recipe_name: recipe.name,
servings: (this.new_note_servings > 1) ? this.new_note_servings : recipe.servings,
title: this.new_note_title,
note: this.new_note_text,
is_new: true
}
console.log(recipe)
this.new_note_title = ''
this.new_note_text = ''
@@ -669,7 +670,7 @@
}
},
planDetailRecipeUrl: function () {
return "{% url 'view_recipe' 12345 %}".replace(/12345/, this.plan_detail.recipe);
return "{% url 'view_recipe' 12345 %}".replace(/12345/, this.plan_detail.recipe.id);
},
planDetailEditUrl: function () {
return "{% url 'edit_meal_plan' 12345 %}".replace(/12345/, this.plan_detail.id);

View File

@@ -38,8 +38,6 @@
<script src="{% static 'django_js_reverse/reverse.js' %}"></script>
{% endif %}
{% render_bundle 'chunk-vendors' %}
<!--
yes this is a stupid solution! i need to figure out a better way to do this but the version hashes
of djangos static files prevent my from simply using preCacheAndRoute

View File

@@ -70,6 +70,5 @@
}
</script>
{% render_bundle 'chunk-vendors' %}
{% render_bundle 'recipe_view' %}
{% endblock %}

View File

@@ -8,7 +8,7 @@
{% block content_fluid %}
<div id="app">
<div id="app" >
<recipe-search-view></recipe-search-view>
</div>
@@ -24,9 +24,8 @@
{% endif %}
<script type="application/javascript">
window.IMAGE_PLACEHOLDER = "{% static 'assets/recipe_no_image.svg' %}"
</script>
{% render_bundle 'chunk-vendors' %}
{% render_bundle 'recipe_search_view' %}
{% endblock %}

View File

@@ -825,7 +825,7 @@
}
},
getRecipes: function () {
let url = "{% url 'api:recipe-list' %}?limit=5&internal=true"
let url = "{% url 'api:recipe-list' %}?page_size=5&internal=true"
if (this.recipe_query !== '') {
url += '&query=' + this.recipe_query;
} else {
@@ -834,7 +834,7 @@
}
this.$http.get(url).then((response) => {
this.recipes = response.data;
this.recipes = response.data.results;
}).catch((err) => {
console.log("getRecipes error: ", err);
this.makeToast(gettext('Error'), gettext('There was an error loading a resource!') + err.bodyText, 'danger')

File diff suppressed because one or more lines are too long