mirror of
https://github.com/TheAnachronism/docspell.git
synced 2025-06-22 02:18:26 +00:00
Use share ui settings
This commit is contained in:
@ -22,6 +22,7 @@ module Api exposing
|
|||||||
, changeFolderName
|
, changeFolderName
|
||||||
, changePassword
|
, changePassword
|
||||||
, checkCalEvent
|
, checkCalEvent
|
||||||
|
, clientSettingsShare
|
||||||
, confirmMultiple
|
, confirmMultiple
|
||||||
, confirmOtp
|
, confirmOtp
|
||||||
, createChannel
|
, createChannel
|
||||||
@ -2820,6 +2821,23 @@ itemDetailShare flags token itemId receive =
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
clientSettingsShare : Flags -> String -> (Result Http.Error UiSettings -> msg) -> Cmd msg
|
||||||
|
clientSettingsShare flags token receive =
|
||||||
|
let
|
||||||
|
defaults =
|
||||||
|
Data.UiSettings.defaults
|
||||||
|
|
||||||
|
decoder =
|
||||||
|
JsonDecode.map (\s -> Data.UiSettings.merge s defaults)
|
||||||
|
Data.UiSettings.storedUiSettingsDecoder
|
||||||
|
in
|
||||||
|
Http2.shareGet
|
||||||
|
{ url = flags.config.baseUrl ++ "/api/v1/share/clientSettings/webClient"
|
||||||
|
, token = token
|
||||||
|
, expect = Http.expectJson receive decoder
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
shareSendMail :
|
shareSendMail :
|
||||||
Flags
|
Flags
|
||||||
-> { conn : String, mail : SimpleShareMail }
|
-> { conn : String, mail : SimpleShareMail }
|
||||||
|
@ -18,6 +18,7 @@ import Comp.SearchMenu
|
|||||||
import Comp.SharePasswordForm
|
import Comp.SharePasswordForm
|
||||||
import Data.Flags exposing (Flags)
|
import Data.Flags exposing (Flags)
|
||||||
import Data.ItemArrange exposing (ItemArrange)
|
import Data.ItemArrange exposing (ItemArrange)
|
||||||
|
import Data.UiSettings exposing (UiSettings)
|
||||||
import Http
|
import Http
|
||||||
import Page.Search.Data exposing (Msg(..))
|
import Page.Search.Data exposing (Msg(..))
|
||||||
import Set exposing (Set)
|
import Set exposing (Set)
|
||||||
@ -53,6 +54,7 @@ type alias Model =
|
|||||||
, initialized : Bool
|
, initialized : Bool
|
||||||
, contentSearch : Maybe String
|
, contentSearch : Maybe String
|
||||||
, searchMode : SearchBarMode
|
, searchMode : SearchBarMode
|
||||||
|
, uiSettings : UiSettings
|
||||||
, viewMode :
|
, viewMode :
|
||||||
{ menuOpen : Bool
|
{ menuOpen : Bool
|
||||||
, showGroups : Bool
|
, showGroups : Bool
|
||||||
@ -75,6 +77,7 @@ emptyModel flags =
|
|||||||
, initialized = False
|
, initialized = False
|
||||||
, contentSearch = Nothing
|
, contentSearch = Nothing
|
||||||
, searchMode = SearchBarContent
|
, searchMode = SearchBarContent
|
||||||
|
, uiSettings = Data.UiSettings.defaults
|
||||||
, viewMode =
|
, viewMode =
|
||||||
{ menuOpen = False
|
{ menuOpen = False
|
||||||
, showGroups = True
|
, showGroups = True
|
||||||
@ -107,6 +110,7 @@ type Msg
|
|||||||
= VerifyResp (Result Http.Error ShareVerifyResult)
|
= VerifyResp (Result Http.Error ShareVerifyResult)
|
||||||
| SearchResp (Result Http.Error ItemLightList)
|
| SearchResp (Result Http.Error ItemLightList)
|
||||||
| StatsResp Bool (Result Http.Error SearchStats)
|
| StatsResp Bool (Result Http.Error SearchStats)
|
||||||
|
| UiSettingsResp (Result Http.Error UiSettings)
|
||||||
| PasswordMsg Comp.SharePasswordForm.Msg
|
| PasswordMsg Comp.SharePasswordForm.Msg
|
||||||
| SearchMenuMsg Comp.SearchMenu.Msg
|
| SearchMenuMsg Comp.SearchMenu.Msg
|
||||||
| PowerSearchMsg Comp.PowerSearchInput.Msg
|
| PowerSearchMsg Comp.PowerSearchInput.Msg
|
||||||
|
@ -10,7 +10,6 @@ module Page.Share.Sidebar exposing (..)
|
|||||||
import Comp.SearchMenu
|
import Comp.SearchMenu
|
||||||
import Comp.Tabs
|
import Comp.Tabs
|
||||||
import Data.Flags exposing (Flags)
|
import Data.Flags exposing (Flags)
|
||||||
import Data.UiSettings exposing (UiSettings)
|
|
||||||
import Html exposing (..)
|
import Html exposing (..)
|
||||||
import Html.Attributes exposing (..)
|
import Html.Attributes exposing (..)
|
||||||
import Messages.Page.Share exposing (Texts)
|
import Messages.Page.Share exposing (Texts)
|
||||||
@ -18,8 +17,8 @@ import Page.Share.Data exposing (Model, Msg(..))
|
|||||||
import Util.ItemDragDrop
|
import Util.ItemDragDrop
|
||||||
|
|
||||||
|
|
||||||
view : Texts -> Flags -> UiSettings -> Model -> Html Msg
|
view : Texts -> Flags -> Model -> Html Msg
|
||||||
view texts flags settings model =
|
view texts flags model =
|
||||||
let
|
let
|
||||||
hideTrashTab tab default =
|
hideTrashTab tab default =
|
||||||
case tab of
|
case tab of
|
||||||
@ -41,7 +40,7 @@ view texts flags settings model =
|
|||||||
ddDummy
|
ddDummy
|
||||||
flags
|
flags
|
||||||
searchMenuCfg
|
searchMenuCfg
|
||||||
settings
|
model.uiSettings
|
||||||
model.searchMenuModel
|
model.searchMenuModel
|
||||||
)
|
)
|
||||||
]
|
]
|
||||||
|
@ -43,7 +43,10 @@ update flags settings shareId msg model =
|
|||||||
, verifyResult = res
|
, verifyResult = res
|
||||||
, searchInProgress = True
|
, searchInProgress = True
|
||||||
}
|
}
|
||||||
, makeSearchCmd flags True model
|
, Cmd.batch
|
||||||
|
[ makeSearchCmd flags True model
|
||||||
|
, Api.clientSettingsShare flags res.token UiSettingsResp
|
||||||
|
]
|
||||||
)
|
)
|
||||||
|
|
||||||
else if res.passwordRequired then
|
else if res.passwordRequired then
|
||||||
@ -242,6 +245,12 @@ update flags settings shareId msg model =
|
|||||||
in
|
in
|
||||||
noSub ( { model | viewMode = next }, Cmd.none )
|
noSub ( { model | viewMode = next }, Cmd.none )
|
||||||
|
|
||||||
|
UiSettingsResp (Ok s) ->
|
||||||
|
noSub ( { model | uiSettings = s }, Cmd.none )
|
||||||
|
|
||||||
|
UiSettingsResp (Err _) ->
|
||||||
|
noSub ( model, Cmd.none )
|
||||||
|
|
||||||
|
|
||||||
noSub : ( Model, Cmd Msg ) -> UpdateResult
|
noSub : ( Model, Cmd Msg ) -> UpdateResult
|
||||||
noSub ( m, c ) =
|
noSub ( m, c ) =
|
||||||
|
@ -11,11 +11,9 @@ import Api.Model.VersionInfo exposing (VersionInfo)
|
|||||||
import Comp.Basic as B
|
import Comp.Basic as B
|
||||||
import Comp.SharePasswordForm
|
import Comp.SharePasswordForm
|
||||||
import Data.Flags exposing (Flags)
|
import Data.Flags exposing (Flags)
|
||||||
import Data.Items
|
|
||||||
import Data.UiSettings exposing (UiSettings)
|
import Data.UiSettings exposing (UiSettings)
|
||||||
import Html exposing (..)
|
import Html exposing (..)
|
||||||
import Html.Attributes exposing (..)
|
import Html.Attributes exposing (..)
|
||||||
import Html.Events exposing (onInput, onSubmit)
|
|
||||||
import Messages.Page.Share exposing (Texts)
|
import Messages.Page.Share exposing (Texts)
|
||||||
import Page.Share.Data exposing (..)
|
import Page.Share.Data exposing (..)
|
||||||
import Page.Share.Menubar as Menubar
|
import Page.Share.Menubar as Menubar
|
||||||
@ -25,19 +23,19 @@ import Styles as S
|
|||||||
|
|
||||||
|
|
||||||
viewSidebar : Texts -> Bool -> Flags -> UiSettings -> Model -> Html Msg
|
viewSidebar : Texts -> Bool -> Flags -> UiSettings -> Model -> Html Msg
|
||||||
viewSidebar texts visible flags settings model =
|
viewSidebar texts visible flags _ model =
|
||||||
div
|
div
|
||||||
[ id "sidebar"
|
[ id "sidebar"
|
||||||
, class S.sidebar
|
, class S.sidebar
|
||||||
, class S.sidebarBg
|
, class S.sidebarBg
|
||||||
, classList [ ( "hidden", not visible || model.mode /= ModeShare ) ]
|
, classList [ ( "hidden", not visible || model.mode /= ModeShare ) ]
|
||||||
]
|
]
|
||||||
[ Sidebar.view texts flags settings model
|
[ Sidebar.view texts flags model
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
viewContent : Texts -> Flags -> VersionInfo -> UiSettings -> String -> Model -> Html Msg
|
viewContent : Texts -> Flags -> VersionInfo -> UiSettings -> String -> Model -> Html Msg
|
||||||
viewContent texts flags versionInfo uiSettings shareId model =
|
viewContent texts flags versionInfo _ shareId model =
|
||||||
case model.mode of
|
case model.mode of
|
||||||
ModeInitial ->
|
ModeInitial ->
|
||||||
div
|
div
|
||||||
@ -60,15 +58,15 @@ viewContent texts flags versionInfo uiSettings shareId model =
|
|||||||
passwordContent texts flags versionInfo model
|
passwordContent texts flags versionInfo model
|
||||||
|
|
||||||
ModeShare ->
|
ModeShare ->
|
||||||
mainContent texts flags uiSettings shareId model
|
mainContent texts flags shareId model
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
--- Helpers
|
--- Helpers
|
||||||
|
|
||||||
|
|
||||||
mainContent : Texts -> Flags -> UiSettings -> String -> Model -> Html Msg
|
mainContent : Texts -> Flags -> String -> Model -> Html Msg
|
||||||
mainContent texts flags settings shareId model =
|
mainContent texts flags shareId model =
|
||||||
div
|
div
|
||||||
[ id "content"
|
[ id "content"
|
||||||
, class "h-full flex flex-col"
|
, class "h-full flex flex-col"
|
||||||
@ -82,7 +80,7 @@ mainContent texts flags settings shareId model =
|
|||||||
]
|
]
|
||||||
, Menubar.view texts flags model
|
, Menubar.view texts flags model
|
||||||
, errorMessage texts model
|
, errorMessage texts model
|
||||||
, Results.view texts settings flags shareId model
|
, Results.view texts model.uiSettings flags shareId model
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
@ -14,6 +14,7 @@ import Api.Model.ShareVerifyResult exposing (ShareVerifyResult)
|
|||||||
import Comp.SharePasswordForm
|
import Comp.SharePasswordForm
|
||||||
import Comp.UrlCopy
|
import Comp.UrlCopy
|
||||||
import Data.Flags exposing (Flags)
|
import Data.Flags exposing (Flags)
|
||||||
|
import Data.UiSettings exposing (UiSettings)
|
||||||
import Http
|
import Http
|
||||||
|
|
||||||
|
|
||||||
@ -37,12 +38,14 @@ type alias Model =
|
|||||||
, pageError : PageError
|
, pageError : PageError
|
||||||
, attachMenuOpen : Bool
|
, attachMenuOpen : Bool
|
||||||
, visibleAttach : Int
|
, visibleAttach : Int
|
||||||
|
, uiSettings : UiSettings
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
type Msg
|
type Msg
|
||||||
= VerifyResp (Result Http.Error ShareVerifyResult)
|
= VerifyResp (Result Http.Error ShareVerifyResult)
|
||||||
| GetItemResp (Result Http.Error ItemDetail)
|
| GetItemResp (Result Http.Error ItemDetail)
|
||||||
|
| UiSettingsResp (Result Http.Error UiSettings)
|
||||||
| PasswordMsg Comp.SharePasswordForm.Msg
|
| PasswordMsg Comp.SharePasswordForm.Msg
|
||||||
| SelectActiveAttachment Int
|
| SelectActiveAttachment Int
|
||||||
| ToggleSelectAttach
|
| ToggleSelectAttach
|
||||||
@ -58,6 +61,7 @@ emptyModel vm =
|
|||||||
, pageError = PageErrorNone
|
, pageError = PageErrorNone
|
||||||
, attachMenuOpen = False
|
, attachMenuOpen = False
|
||||||
, visibleAttach = 0
|
, visibleAttach = 0
|
||||||
|
, uiSettings = Data.UiSettings.defaults
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -25,7 +25,10 @@ update shareId itemId flags msg model =
|
|||||||
, viewMode = ViewLoading
|
, viewMode = ViewLoading
|
||||||
, verifyResult = res
|
, verifyResult = res
|
||||||
}
|
}
|
||||||
, Api.itemDetailShare flags res.token itemId GetItemResp
|
, Cmd.batch
|
||||||
|
[ Api.itemDetailShare flags res.token itemId GetItemResp
|
||||||
|
, Api.clientSettingsShare flags res.token UiSettingsResp
|
||||||
|
]
|
||||||
)
|
)
|
||||||
|
|
||||||
else if res.passwordRequired then
|
else if res.passwordRequired then
|
||||||
@ -93,3 +96,9 @@ update shareId itemId flags msg model =
|
|||||||
Comp.UrlCopy.update lm
|
Comp.UrlCopy.update lm
|
||||||
in
|
in
|
||||||
( model, cmd )
|
( model, cmd )
|
||||||
|
|
||||||
|
UiSettingsResp (Ok s) ->
|
||||||
|
( { model | uiSettings = s }, Cmd.none )
|
||||||
|
|
||||||
|
UiSettingsResp (Err _) ->
|
||||||
|
( model, Cmd.none )
|
||||||
|
@ -16,7 +16,7 @@ import Comp.UrlCopy
|
|||||||
import Data.Fields
|
import Data.Fields
|
||||||
import Data.Flags exposing (Flags)
|
import Data.Flags exposing (Flags)
|
||||||
import Data.Icons as Icons
|
import Data.Icons as Icons
|
||||||
import Data.ItemTemplate as IT exposing (ItemTemplate)
|
import Data.ItemTemplate as IT
|
||||||
import Data.UiSettings exposing (UiSettings)
|
import Data.UiSettings exposing (UiSettings)
|
||||||
import Html exposing (..)
|
import Html exposing (..)
|
||||||
import Html.Attributes exposing (..)
|
import Html.Attributes exposing (..)
|
||||||
@ -33,7 +33,7 @@ import Util.String
|
|||||||
|
|
||||||
|
|
||||||
viewSidebar : Texts -> Bool -> Flags -> UiSettings -> String -> String -> Model -> Html Msg
|
viewSidebar : Texts -> Bool -> Flags -> UiSettings -> String -> String -> Model -> Html Msg
|
||||||
viewSidebar texts visible flags settings shareId itemId model =
|
viewSidebar texts visible flags _ shareId itemId model =
|
||||||
div
|
div
|
||||||
[ id "sidebar"
|
[ id "sidebar"
|
||||||
, classList [ ( "hidden", not visible || model.viewMode /= ViewNormal ) ]
|
, classList [ ( "hidden", not visible || model.viewMode /= ViewNormal ) ]
|
||||||
@ -103,6 +103,7 @@ itemData texts flags model shareId itemId =
|
|||||||
div
|
div
|
||||||
[ class "flex ml-2 mt-1 font-semibold hover:opacity-75"
|
[ class "flex ml-2 mt-1 font-semibold hover:opacity-75"
|
||||||
, class S.basicLabel
|
, class S.basicLabel
|
||||||
|
, class (Data.UiSettings.tagColorString2 tag model.uiSettings)
|
||||||
]
|
]
|
||||||
[ i [ class "fa fa-tag mr-2" ] []
|
[ i [ class "fa fa-tag mr-2" ] []
|
||||||
, text tag.name
|
, text tag.name
|
||||||
|
Reference in New Issue
Block a user