add CardList cards & add temp ordered text by authors getter
This commit is contained in:
@@ -58,6 +58,23 @@ export default {
|
||||
value: id,
|
||||
text: `(${id}) ${title}`
|
||||
}))
|
||||
},
|
||||
|
||||
orderedParents: state => {
|
||||
// FIXME duplicates references if multiple authors ?
|
||||
if (!state.textsDepart) return undefined
|
||||
return state.textsDepart.sort((a, b) => {
|
||||
if (!b.authors) return -1
|
||||
if (!a.authors) return +1
|
||||
if (a.authors[0].name < b.authors[0].name) return -1
|
||||
if (a.authors[0].name > b.authors[0].name) return 1
|
||||
return 0
|
||||
}).reduce((dict, text) => {
|
||||
const firstChar = text.authors ? text.authors[0].name[0] : '&'
|
||||
if (!(firstChar in dict)) dict[firstChar] = []
|
||||
dict[firstChar].push(text)
|
||||
return dict
|
||||
}, {})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user