Skip to content

Commit 5232b7a

Browse files
authored
Merge pull request #1198 from jayolee/feat/collection-tag-dropdown
Add autocomplete to project collection logic tag dropdown
2 parents a11cb8d + caa50d6 commit 5232b7a

File tree

2 files changed

+20
-8
lines changed

2 files changed

+20
-8
lines changed

src/views/portfolio/projects/ProjectCreateProjectModal.vue

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@
8383
:tags="collectionTags"
8484
:add-on-key="addOnKeys"
8585
:placeholder="$t('message.project_add_collection_tag')"
86+
:autocomplete-items="tagsAutoCompleteItems"
8687
@tags-changed="
8788
(newCollectionTags) => (this.collectionTags = newCollectionTags)
8889
"
@@ -315,7 +316,12 @@ export default {
315316
},
316317
computed: {},
317318
watch: {
318-
tag: 'searchTags',
319+
tag(input) {
320+
this.searchTags(input);
321+
},
322+
collectionTagTyping(input) {
323+
this.searchTags(input);
324+
},
319325
},
320326
methods: {
321327
async getACLEnabled() {
@@ -465,14 +471,14 @@ export default {
465471
});
466472
}
467473
},
468-
searchTags: function () {
469-
if (!this.tag) {
474+
searchTags: function (input) {
475+
if (!input) {
470476
return;
471477
}
472478
473479
clearTimeout(this.tagsAutoCompleteDebounce);
474480
this.tagsAutoCompleteDebounce = setTimeout(() => {
475-
const url = `${this.$api.BASE_URL}/${this.$api.URL_TAG}?searchText=${encodeURIComponent(this.tag)}&pageNumber=1&pageSize=6`;
481+
const url = `${this.$api.BASE_URL}/${this.$api.URL_TAG}?searchText=${encodeURIComponent(input)}&pageNumber=1&pageSize=6`;
476482
this.axios.get(url).then((response) => {
477483
this.tagsAutoCompleteItems = response.data.map((tag) => {
478484
return { text: tag.name };

src/views/portfolio/projects/ProjectDetailsModal.vue

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@
8585
:tags="collectionTags"
8686
:add-on-key="addOnKeys"
8787
:placeholder="$t('message.project_add_collection_tag')"
88+
:autocomplete-items="tagsAutoCompleteItems"
8889
@tags-changed="
8990
(newCollectionTags) => (this.collectionTags = newCollectionTags)
9091
"
@@ -674,7 +675,12 @@ export default {
674675
});
675676
},
676677
watch: {
677-
tag: 'searchTags',
678+
tag(input) {
679+
this.searchTags(input);
680+
},
681+
collectionTagTyping(input) {
682+
this.searchTags(input);
683+
},
678684
},
679685
methods: {
680686
initializeTags: function () {
@@ -797,14 +803,14 @@ export default {
797803
});
798804
}
799805
},
800-
searchTags: function () {
801-
if (!this.tag) {
806+
searchTags: function (input) {
807+
if (!input) {
802808
return;
803809
}
804810
805811
clearTimeout(this.tagsAutoCompleteDebounce);
806812
this.tagsAutoCompleteDebounce = setTimeout(() => {
807-
const url = `${this.$api.BASE_URL}/${this.$api.URL_TAG}?searchText=${encodeURIComponent(this.tag)}&pageNumber=1&pageSize=6`;
813+
const url = `${this.$api.BASE_URL}/${this.$api.URL_TAG}?searchText=${encodeURIComponent(input)}&pageNumber=1&pageSize=6`;
808814
this.axios.get(url).then((response) => {
809815
this.tagsAutoCompleteItems = response.data.map((tag) => {
810816
return { text: tag.name };

0 commit comments

Comments
 (0)