diff --git a/src/pages/library/LibraryOptions.vue b/src/pages/library/LibraryOptions.vue
index b8e9cc7..f1e4470 100644
--- a/src/pages/library/LibraryOptions.vue
+++ b/src/pages/library/LibraryOptions.vue
@@ -93,7 +93,7 @@
-
+
diff --git a/src/store/modules/library.js b/src/store/modules/library.js
index 8155030..84cf183 100644
--- a/src/store/modules/library.js
+++ b/src/store/modules/library.js
@@ -230,16 +230,13 @@ export default {
},
nodesDepartsOptions: (state, getters, rootState) => {
- const departIds = rootState.ids.depart
- if (departIds === undefined) return
- const nodes = departIds.map(id => rootState.nodes[id])
- if (nodes.some(node => node === undefined)) return
- return nodes.map(node => {
- const firstAuthor = node.authors !== null ? node.authors[0].name : 'Pad de noms'
- return {
- text: `${firstAuthor}, ${node.title} (${node.id})`,
- value: node.id
- }
+ const nodes = getters.nodesDeparts
+ if (nodes === undefined) return
+ return nodes.sort((a, b) => {
+ const prev = a.authors[0].last_name.toLowerCase()
+ const next = b.authors[0].last_name.toLowerCase()
+ if (prev === next) return 0
+ return prev < next ? -1 : 1
})
},