Order categories by translated label
Closes #1082 Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
@@ -33,7 +33,7 @@
|
||||
|
||||
<div class="flex flex-wrap gap-4">
|
||||
<o-field
|
||||
v-if="eventCategories"
|
||||
v-if="orderedCategories"
|
||||
:label="t('Category')"
|
||||
label-for="categoryField"
|
||||
class="w-full md:max-w-fit"
|
||||
@@ -45,7 +45,7 @@
|
||||
expanded
|
||||
>
|
||||
<option
|
||||
v-for="category in eventCategories"
|
||||
v-for="category in orderedCategories"
|
||||
:value="category.id"
|
||||
:key="category.id"
|
||||
>
|
||||
@@ -595,6 +595,7 @@ import { Notifier } from "@/plugins/notifier";
|
||||
import { useHead } from "@vueuse/head";
|
||||
import { useProgrammatic } from "@oruga-ui/oruga-next";
|
||||
import type { Locale } from "date-fns";
|
||||
import sortBy from "lodash/sortBy";
|
||||
|
||||
const DEFAULT_LIMIT_NUMBER_OF_PLACES = 10;
|
||||
|
||||
@@ -1331,6 +1332,11 @@ watch(group, () => {
|
||||
event.value.visibility = EventVisibility.PUBLIC;
|
||||
}
|
||||
});
|
||||
|
||||
const orderedCategories = computed(() => {
|
||||
if (!eventCategories.value) return undefined;
|
||||
return sortBy(eventCategories.value, ["label"]);
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
|
||||
Reference in New Issue
Block a user