add keyword during recipe edit

This commit is contained in:
smilerz 2021-02-09 11:17:31 -06:00
parent 0f251bee9b
commit 4a4dafd69c
2 changed files with 8 additions and 0 deletions

1
.gitignore vendored
View File

@ -78,3 +78,4 @@ postgresql/
/docker-compose.override.yml
vue/node_modules
.vscode/

View File

@ -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) => {