mirror of
https://github.com/TheAnachronism/docspell.git
synced 2025-04-05 02:49:32 +00:00
Fix remembering selection when going to detail view
This commit is contained in:
parent
27439530f0
commit
5810eac899
@ -24,10 +24,10 @@ type alias Model =
|
||||
}
|
||||
|
||||
|
||||
init : List FolderItem -> Model
|
||||
init all =
|
||||
init : Maybe FolderItem -> List FolderItem -> Model
|
||||
init selected all =
|
||||
{ all = List.sortBy .name all
|
||||
, selected = Nothing
|
||||
, selected = Maybe.map .id selected
|
||||
, expanded = False
|
||||
}
|
||||
|
||||
|
@ -71,7 +71,7 @@ type alias Model =
|
||||
|
||||
init : Model
|
||||
init =
|
||||
{ tagSelectModel = Comp.TagSelect.init []
|
||||
{ tagSelectModel = Comp.TagSelect.init Comp.TagSelect.emptySelection []
|
||||
, tagSelection = Comp.TagSelect.emptySelection
|
||||
, directionModel =
|
||||
Comp.Dropdown.makeSingleList
|
||||
@ -111,7 +111,7 @@ init =
|
||||
, labelColor = \_ -> \_ -> ""
|
||||
, placeholder = "Choose an equipment"
|
||||
}
|
||||
, folderList = Comp.FolderSelect.init []
|
||||
, folderList = Comp.FolderSelect.init Nothing []
|
||||
, selectedFolder = Nothing
|
||||
, inboxCheckbox = False
|
||||
, fromDateModel = Comp.DatePicker.emptyModel
|
||||
@ -288,7 +288,7 @@ updateDrop ddm flags settings msg model =
|
||||
selectModel =
|
||||
List.sortBy .count tags.items
|
||||
|> List.reverse
|
||||
|> Comp.TagSelect.init
|
||||
|> Comp.TagSelect.init model.tagSelection
|
||||
|
||||
model_ =
|
||||
{ model | tagSelectModel = selectModel }
|
||||
@ -571,7 +571,7 @@ updateDrop ddm flags settings msg model =
|
||||
{ model
|
||||
| folderList =
|
||||
Util.Folder.onlyVisible flags fs.items
|
||||
|> Comp.FolderSelect.init
|
||||
|> Comp.FolderSelect.init model.selectedFolder
|
||||
}
|
||||
in
|
||||
{ model = model_
|
||||
|
@ -41,12 +41,28 @@ type alias Category =
|
||||
}
|
||||
|
||||
|
||||
init : List TagCount -> Model
|
||||
init tags =
|
||||
init : Selection -> List TagCount -> Model
|
||||
init sel tags =
|
||||
let
|
||||
tagId t =
|
||||
t.tag.id
|
||||
|
||||
constDict mkId flag list =
|
||||
List.map (\e -> ( mkId e, flag )) list
|
||||
|> Dict.fromList
|
||||
|
||||
selTag =
|
||||
constDict tagId True sel.includeTags
|
||||
|> Dict.union (constDict tagId False sel.excludeTags)
|
||||
|
||||
selCat =
|
||||
constDict .name True sel.includeCats
|
||||
|> Dict.union (constDict .name False sel.excludeCats)
|
||||
in
|
||||
{ all = tags
|
||||
, categories = sumCategories tags
|
||||
, selectedTags = Dict.empty
|
||||
, selectedCats = Dict.empty
|
||||
, selectedTags = selTag
|
||||
, selectedCats = selCat
|
||||
, expandedTags = False
|
||||
, expandedCats = False
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user