mirror of
https://github.com/TheAnachronism/docspell.git
synced 2025-07-04 16:48:26 +00:00
Apply tag colors from settings
This commit is contained in:
@ -2,7 +2,7 @@ module Page.UserSettings.Data exposing
|
||||
( Model
|
||||
, Msg(..)
|
||||
, Tab(..)
|
||||
, emptyModel
|
||||
, init
|
||||
)
|
||||
|
||||
import Comp.ChangePasswordForm
|
||||
@ -26,17 +26,17 @@ type alias Model =
|
||||
}
|
||||
|
||||
|
||||
emptyModel : Flags -> ( Model, Cmd Msg )
|
||||
emptyModel flags =
|
||||
init : Flags -> UiSettings -> ( Model, Cmd Msg )
|
||||
init flags settings =
|
||||
let
|
||||
( um, uc ) =
|
||||
Comp.UiSettingsManage.init flags Data.UiSettings.defaults
|
||||
Comp.UiSettingsManage.init flags settings
|
||||
in
|
||||
( { currentTab = Nothing
|
||||
, changePassModel = Comp.ChangePasswordForm.emptyModel
|
||||
, emailSettingsModel = Comp.EmailSettingsManage.emptyModel
|
||||
, imapSettingsModel = Comp.ImapSettingsManage.emptyModel
|
||||
, notificationModel = Tuple.first (Comp.NotificationForm.init flags)
|
||||
, notificationModel = Tuple.first (Comp.NotificationForm.init flags settings)
|
||||
, scanMailboxModel = Tuple.first (Comp.ScanMailboxManage.init flags)
|
||||
, uiSettingsModel = um
|
||||
}
|
||||
@ -60,5 +60,5 @@ type Msg
|
||||
| NotificationMsg Comp.NotificationForm.Msg
|
||||
| ImapSettingsMsg Comp.ImapSettingsManage.Msg
|
||||
| ScanMailboxMsg Comp.ScanMailboxManage.Msg
|
||||
| GetUiSettings UiSettings
|
||||
| UiSettingsMsg Comp.UiSettingsManage.Msg
|
||||
| UpdateSettings
|
||||
|
@ -7,11 +7,12 @@ import Comp.NotificationForm
|
||||
import Comp.ScanMailboxManage
|
||||
import Comp.UiSettingsManage
|
||||
import Data.Flags exposing (Flags)
|
||||
import Data.UiSettings exposing (UiSettings)
|
||||
import Page.UserSettings.Data exposing (..)
|
||||
|
||||
|
||||
update : Flags -> Msg -> Model -> ( Model, Cmd Msg, Sub Msg )
|
||||
update flags msg model =
|
||||
update : Flags -> UiSettings -> Msg -> Model -> ( Model, Cmd Msg, Sub Msg )
|
||||
update flags settings msg model =
|
||||
case msg of
|
||||
SetTab t ->
|
||||
let
|
||||
@ -40,7 +41,7 @@ update flags msg model =
|
||||
let
|
||||
initCmd =
|
||||
Cmd.map NotificationMsg
|
||||
(Tuple.second (Comp.NotificationForm.init flags))
|
||||
(Tuple.second (Comp.NotificationForm.init flags settings))
|
||||
in
|
||||
( m, initCmd, Sub.none )
|
||||
|
||||
@ -96,22 +97,18 @@ update flags msg model =
|
||||
, Sub.none
|
||||
)
|
||||
|
||||
GetUiSettings settings ->
|
||||
let
|
||||
( um, uc ) =
|
||||
Comp.UiSettingsManage.init flags settings
|
||||
in
|
||||
( { model | uiSettingsModel = um }
|
||||
, Cmd.map UiSettingsMsg uc
|
||||
, Sub.none
|
||||
)
|
||||
|
||||
UiSettingsMsg lm ->
|
||||
let
|
||||
( m2, c2, s2 ) =
|
||||
Comp.UiSettingsManage.update flags lm model.uiSettingsModel
|
||||
Comp.UiSettingsManage.update flags settings lm model.uiSettingsModel
|
||||
in
|
||||
( { model | uiSettingsModel = m2 }
|
||||
, Cmd.map UiSettingsMsg c2
|
||||
, Sub.map UiSettingsMsg s2
|
||||
)
|
||||
|
||||
UpdateSettings ->
|
||||
update flags
|
||||
settings
|
||||
(UiSettingsMsg Comp.UiSettingsManage.UpdateSettings)
|
||||
model
|
||||
|
@ -6,6 +6,7 @@ import Comp.ImapSettingsManage
|
||||
import Comp.NotificationForm
|
||||
import Comp.ScanMailboxManage
|
||||
import Comp.UiSettingsManage
|
||||
import Data.UiSettings exposing (UiSettings)
|
||||
import Html exposing (..)
|
||||
import Html.Attributes exposing (..)
|
||||
import Html.Events exposing (onClick)
|
||||
@ -13,8 +14,8 @@ import Page.UserSettings.Data exposing (..)
|
||||
import Util.Html exposing (classActive)
|
||||
|
||||
|
||||
view : Model -> Html Msg
|
||||
view model =
|
||||
view : UiSettings -> Model -> Html Msg
|
||||
view settings model =
|
||||
div [ class "usersetting-page ui padded grid" ]
|
||||
[ div [ class "sixteen wide mobile four wide tablet four wide computer column" ]
|
||||
[ h4 [ class "ui top attached ablue-comp header" ]
|
||||
@ -38,19 +39,19 @@ view model =
|
||||
viewChangePassword model
|
||||
|
||||
Just EmailSettingsTab ->
|
||||
viewEmailSettings model
|
||||
viewEmailSettings settings model
|
||||
|
||||
Just NotificationTab ->
|
||||
viewNotificationForm model
|
||||
viewNotificationForm settings model
|
||||
|
||||
Just ImapSettingsTab ->
|
||||
viewImapSettings model
|
||||
viewImapSettings settings model
|
||||
|
||||
Just ScanMailboxTab ->
|
||||
viewScanMailboxManage model
|
||||
viewScanMailboxManage settings model
|
||||
|
||||
Just UiSettingsTab ->
|
||||
viewUiSettings model
|
||||
viewUiSettings settings model
|
||||
|
||||
Nothing ->
|
||||
[]
|
||||
@ -71,8 +72,8 @@ makeTab model tab header icon =
|
||||
]
|
||||
|
||||
|
||||
viewUiSettings : Model -> List (Html Msg)
|
||||
viewUiSettings model =
|
||||
viewUiSettings : UiSettings -> Model -> List (Html Msg)
|
||||
viewUiSettings settings model =
|
||||
[ h2 [ class "ui header" ]
|
||||
[ i [ class "cog icon" ] []
|
||||
, text "UI Settings"
|
||||
@ -81,31 +82,36 @@ viewUiSettings model =
|
||||
[ text "These settings only affect the web ui. They are stored in the browser, "
|
||||
, text "so they are separated between browsers and devices."
|
||||
]
|
||||
, Html.map UiSettingsMsg (Comp.UiSettingsManage.view "ui segment" model.uiSettingsModel)
|
||||
, Html.map UiSettingsMsg
|
||||
(Comp.UiSettingsManage.view
|
||||
settings
|
||||
"ui segment"
|
||||
model.uiSettingsModel
|
||||
)
|
||||
]
|
||||
|
||||
|
||||
viewEmailSettings : Model -> List (Html Msg)
|
||||
viewEmailSettings model =
|
||||
viewEmailSettings : UiSettings -> Model -> List (Html Msg)
|
||||
viewEmailSettings settings model =
|
||||
[ h2 [ class "ui header" ]
|
||||
[ i [ class "mail icon" ] []
|
||||
, div [ class "content" ]
|
||||
[ text "E-Mail Settings (Smtp)"
|
||||
]
|
||||
]
|
||||
, Html.map EmailSettingsMsg (Comp.EmailSettingsManage.view model.emailSettingsModel)
|
||||
, Html.map EmailSettingsMsg (Comp.EmailSettingsManage.view settings model.emailSettingsModel)
|
||||
]
|
||||
|
||||
|
||||
viewImapSettings : Model -> List (Html Msg)
|
||||
viewImapSettings model =
|
||||
viewImapSettings : UiSettings -> Model -> List (Html Msg)
|
||||
viewImapSettings settings model =
|
||||
[ h2 [ class "ui header" ]
|
||||
[ i [ class "mail icon" ] []
|
||||
, div [ class "content" ]
|
||||
[ text "E-Mail Settings (Imap)"
|
||||
]
|
||||
]
|
||||
, Html.map ImapSettingsMsg (Comp.ImapSettingsManage.view model.imapSettingsModel)
|
||||
, Html.map ImapSettingsMsg (Comp.ImapSettingsManage.view settings model.imapSettingsModel)
|
||||
]
|
||||
|
||||
|
||||
@ -121,8 +127,8 @@ viewChangePassword model =
|
||||
]
|
||||
|
||||
|
||||
viewNotificationForm : Model -> List (Html Msg)
|
||||
viewNotificationForm model =
|
||||
viewNotificationForm : UiSettings -> Model -> List (Html Msg)
|
||||
viewNotificationForm settings model =
|
||||
[ h2 [ class "ui header" ]
|
||||
[ i [ class "ui bullhorn icon" ] []
|
||||
, div [ class "content" ]
|
||||
@ -141,12 +147,12 @@ viewNotificationForm model =
|
||||
, text " days and sends this list via e-mail."
|
||||
]
|
||||
, Html.map NotificationMsg
|
||||
(Comp.NotificationForm.view "segment" model.notificationModel)
|
||||
(Comp.NotificationForm.view "segment" settings model.notificationModel)
|
||||
]
|
||||
|
||||
|
||||
viewScanMailboxManage : Model -> List (Html Msg)
|
||||
viewScanMailboxManage model =
|
||||
viewScanMailboxManage : UiSettings -> Model -> List (Html Msg)
|
||||
viewScanMailboxManage settings model =
|
||||
[ h2 [ class "ui header" ]
|
||||
[ i [ class "ui envelope open outline icon" ] []
|
||||
, div [ class "content" ]
|
||||
@ -171,6 +177,7 @@ viewScanMailboxManage model =
|
||||
]
|
||||
, Html.map ScanMailboxMsg
|
||||
(Comp.ScanMailboxManage.view
|
||||
settings
|
||||
model.scanMailboxModel
|
||||
)
|
||||
]
|
||||
|
Reference in New Issue
Block a user