mirror of
https://github.com/TheAnachronism/docspell.git
synced 2025-06-22 02:18:26 +00:00
@ -442,7 +442,7 @@ object QItem {
|
||||
cfields <- Stream.eval(findCustomFieldValuesForItem(item.id))
|
||||
} yield ListItemWithTags(
|
||||
item,
|
||||
ftags.toList.sortBy(_.name),
|
||||
RTag.sort(ftags.toList),
|
||||
attachs.sortBy(_.position),
|
||||
cfields.toList
|
||||
)
|
||||
|
@ -164,4 +164,23 @@ object RTag {
|
||||
|
||||
def delete(tagId: Ident, coll: Ident): ConnectionIO[Int] =
|
||||
DML.delete(T, T.tid === tagId && T.cid === coll)
|
||||
|
||||
def sort(tags: List[RTag]): List[RTag] =
|
||||
tags match {
|
||||
case Nil => tags
|
||||
case _ =>
|
||||
val byCat = tags
|
||||
.groupBy(_.category)
|
||||
.view
|
||||
.mapValues(_.sortBy(_.name))
|
||||
.toList
|
||||
.sortBy(_._1)
|
||||
|
||||
byCat match {
|
||||
case (None, tags) :: rest =>
|
||||
rest.flatMap(_._2) ++ tags
|
||||
case _ =>
|
||||
byCat.flatMap(_._2)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -33,7 +33,6 @@ import Html exposing (..)
|
||||
import Html.Attributes exposing (..)
|
||||
import Messages.Comp.ItemCardList exposing (Texts)
|
||||
import Page exposing (Page(..))
|
||||
import Set exposing (Set)
|
||||
import Styles as S
|
||||
import Util.ItemDragDrop as DD
|
||||
import Util.List
|
||||
|
Reference in New Issue
Block a user