mirror of
https://github.com/TheAnachronism/docspell.git
synced 2025-06-07 07:35:59 +00:00
Replaced semantic-ui with the drop-in replacement fomantic-ui [0] which is a maintained fork. The fomantic-ui used here is a custom build [1] of the less-version _without_ google-fonts (css-only). The javascript part of fomantic-ui is not used, and also jquery could be dropped now. [0] https://fomantic-ui.com [1] https://github.com/eikek/fomantic-slim-default Issue: #349
73 lines
1.5 KiB
Elm
73 lines
1.5 KiB
Elm
port module Ports exposing
|
|
( getUiSettings
|
|
, initClipboard
|
|
, loadUiSettings
|
|
, onUiSettingsSaved
|
|
, removeAccount
|
|
, setAccount
|
|
, storeUiSettings
|
|
)
|
|
|
|
import Api.Model.AuthResult exposing (AuthResult)
|
|
import Data.Flags exposing (Flags)
|
|
import Data.UiSettings exposing (StoredUiSettings, UiSettings)
|
|
|
|
|
|
{-| Save the result of authentication to local storage.
|
|
-}
|
|
port setAccount : AuthResult -> Cmd msg
|
|
|
|
|
|
port removeAccount : () -> Cmd msg
|
|
|
|
|
|
port saveUiSettings : ( AuthResult, StoredUiSettings ) -> Cmd msg
|
|
|
|
|
|
port receiveUiSettings : (StoredUiSettings -> msg) -> Sub msg
|
|
|
|
|
|
port requestUiSettings : ( AuthResult, StoredUiSettings ) -> Cmd msg
|
|
|
|
|
|
port uiSettingsSaved : (() -> msg) -> Sub msg
|
|
|
|
|
|
onUiSettingsSaved : msg -> Sub msg
|
|
onUiSettingsSaved m =
|
|
uiSettingsSaved (\_ -> m)
|
|
|
|
|
|
storeUiSettings : Flags -> UiSettings -> Cmd msg
|
|
storeUiSettings flags settings =
|
|
case flags.account of
|
|
Just ar ->
|
|
saveUiSettings
|
|
( ar
|
|
, Data.UiSettings.toStoredUiSettings settings
|
|
)
|
|
|
|
Nothing ->
|
|
Cmd.none
|
|
|
|
|
|
loadUiSettings : (UiSettings -> msg) -> Sub msg
|
|
loadUiSettings tagger =
|
|
receiveUiSettings (Data.UiSettings.mergeDefaults >> tagger)
|
|
|
|
|
|
getUiSettings : Flags -> Cmd msg
|
|
getUiSettings flags =
|
|
case flags.account of
|
|
Just ar ->
|
|
requestUiSettings
|
|
( ar
|
|
, Data.UiSettings.toStoredUiSettings Data.UiSettings.defaults
|
|
)
|
|
|
|
Nothing ->
|
|
Cmd.none
|
|
|
|
|
|
port initClipboard : ( String, String ) -> Cmd msg
|