Skip to content

Commit

Permalink
feat: Sort Portlets And Categories Input fields - MEED-6993 - Meeds-i…
Browse files Browse the repository at this point in the history
  • Loading branch information
boubaker committed Jun 4, 2024
1 parent 77f5ddf commit 960679d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<v-autocomplete
ref="autocomplete"
v-model="categoryId"
:items="$root.portletInstanceCategories"
:items="sortedCategories"
:placeholder="$t('layout.category.placeholder')"
class="portlet-instance-category-autocomplete ma-0 pa-0"
item-value="id"
Expand All @@ -45,6 +45,13 @@ export default {
data: () => ({
categoryId: null,
}),
computed: {
sortedCategories() {
const categories = this.$root.portletInstanceCategories?.filter?.(c => c.name) || [];
categories.sort((a, b) => this.$root.collator.compare(a.name.toLowerCase(), b.name.toLowerCase()));
return categories;
},
},
watch: {
value: {
immediate: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<v-autocomplete
ref="autocomplete"
v-model="contentId"
:items="$root.portlets"
:items="sortedPortlets"
:disabled="disabled"
:placeholder="$t('layout.portlet.placeholder')"
class="portlet-instance-category-autocomplete ma-0 pa-0"
Expand All @@ -50,6 +50,13 @@ export default {
data: () => ({
contentId: null,
}),
computed: {
sortedPortlets() {
const portlets = this.$root.portlets?.filter?.(c => c.name) || [];
portlets.sort((a, b) => this.$root.collator.compare(a.name.toLowerCase(), b.name.toLowerCase()));
return portlets;
},
},
watch: {
value: {
immediate: true,
Expand Down

0 comments on commit 960679d

Please sign in to comment.