mirror of
https://github.com/TheAnachronism/docspell.git
synced 2025-04-04 18:39:33 +00:00
Keep form state after save
This commit is contained in:
parent
e4527400ca
commit
040100f992
modules/webapp/src/main/elm/Comp
@ -9,6 +9,7 @@ module Comp.UiSettingsForm exposing
|
||||
( Model
|
||||
, Msg
|
||||
, init
|
||||
, initData
|
||||
, toggleAllTabs
|
||||
, update
|
||||
, view2
|
||||
@ -178,6 +179,15 @@ init flags storedSettings defaults =
|
||||
( initModel flags storedSettings defaults, Api.getTags flags "" Data.TagOrder.NameAsc GetTagsResp )
|
||||
|
||||
|
||||
initData : Flags -> StoredUiSettings -> UiSettings -> Model -> ( Model, Cmd Msg )
|
||||
initData flags storedSettings defaults model =
|
||||
let
|
||||
( m, c ) =
|
||||
init flags storedSettings defaults
|
||||
in
|
||||
( { m | openTabs = model.openTabs }, c )
|
||||
|
||||
|
||||
type Msg
|
||||
= SearchPageSizeMsg Comp.IntField.Msg
|
||||
| TagColorMsg Comp.ColorTagger.Msg
|
||||
|
@ -211,11 +211,17 @@ update flags settings msg model =
|
||||
userDefaults =
|
||||
Data.UiSettings.merge coll collDefaults
|
||||
|
||||
( um, uc ) =
|
||||
Comp.UiSettingsForm.init flags user userDefaults
|
||||
( ( um, uc ), ( cm, cc ) ) =
|
||||
case model.formData of
|
||||
Just data ->
|
||||
( Comp.UiSettingsForm.initData flags user userDefaults data.userModel
|
||||
, Comp.UiSettingsForm.initData flags coll collDefaults data.collModel
|
||||
)
|
||||
|
||||
( cm, cc ) =
|
||||
Comp.UiSettingsForm.init flags coll collDefaults
|
||||
Nothing ->
|
||||
( Comp.UiSettingsForm.init flags user userDefaults
|
||||
, Comp.UiSettingsForm.init flags coll collDefaults
|
||||
)
|
||||
|
||||
model_ =
|
||||
{ model
|
||||
|
Loading…
x
Reference in New Issue
Block a user