From 4a4dafd69c0b955b613d4132ba36d6d1bb5e2045 Mon Sep 17 00:00:00 2001 From: smilerz Date: Tue, 9 Feb 2021 11:17:31 -0600 Subject: [PATCH] add keyword during recipe edit --- .gitignore | 1 + cookbook/templates/forms/edit_internal_recipe.html | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/.gitignore b/.gitignore index 908033e1..33755583 100644 --- a/.gitignore +++ b/.gitignore @@ -78,3 +78,4 @@ postgresql/ /docker-compose.override.yml vue/node_modules +.vscode/ diff --git a/cookbook/templates/forms/edit_internal_recipe.html b/cookbook/templates/forms/edit_internal_recipe.html index 4151e6d2..84d4f7f7 100644 --- a/cookbook/templates/forms/edit_internal_recipe.html +++ b/cookbook/templates/forms/edit_internal_recipe.html @@ -77,6 +77,9 @@ :hide-selected="true" :preserve-search="true" placeholder="{% trans 'Select Keywords' %}" + tag-placeholder="{% trans 'Add Keyword' %}" + :taggable="true" + @tag="addKeyword" label="label" track-by="id" id="id_keywords" @@ -667,6 +670,10 @@ this.units.push(new_unit.unit) this.recipe.steps[step].ingredients[id] = new_unit }, + addKeyword: function (tag) { + let new_keyword = {'label':tag,'name':tag} + this.recipe.keywords.push(new_keyword) + }, searchKeywords: function (query) { this.keywords_loading = true this.$http.get("{% url 'api:keyword-list' %}" + '?query=' + query + '&limit=10').then((response) => {