mirror of
https://github.com/TheAnachronism/docspell.git
synced 2025-06-23 10:58:26 +00:00
Add some static links to the dashboard
This commit is contained in:
@ -16,6 +16,7 @@ module Comp.BookmarkChooser exposing
|
||||
, isEmptySelection
|
||||
, update
|
||||
, view
|
||||
, viewWith
|
||||
)
|
||||
|
||||
import Api.Model.BookmarkedQuery exposing (BookmarkedQuery)
|
||||
@ -114,19 +115,31 @@ update msg model current =
|
||||
--- View
|
||||
|
||||
|
||||
view : Texts -> Model -> Selection -> Html Msg
|
||||
view texts model selection =
|
||||
type alias ViewSettings =
|
||||
{ showUser : Bool
|
||||
, showCollective : Bool
|
||||
, showShares : Bool
|
||||
}
|
||||
|
||||
|
||||
viewWith : ViewSettings -> Texts -> Model -> Selection -> Html Msg
|
||||
viewWith cfg texts model selection =
|
||||
let
|
||||
( user, coll ) =
|
||||
List.partition .personal model.all.bookmarks
|
||||
in
|
||||
div [ class "flex flex-col" ]
|
||||
[ userBookmarks texts user selection
|
||||
, collBookmarks texts coll selection
|
||||
, shares texts model selection
|
||||
[ userBookmarks cfg.showUser texts user selection
|
||||
, collBookmarks cfg.showCollective texts coll selection
|
||||
, shares cfg.showShares texts model selection
|
||||
]
|
||||
|
||||
|
||||
view : Texts -> Model -> Selection -> Html Msg
|
||||
view =
|
||||
viewWith { showUser = True, showCollective = True, showShares = True }
|
||||
|
||||
|
||||
titleDiv : String -> Html msg
|
||||
titleDiv label =
|
||||
div [ class "text-sm opacity-75 py-0.5 italic" ]
|
||||
@ -136,11 +149,11 @@ titleDiv label =
|
||||
]
|
||||
|
||||
|
||||
userBookmarks : Texts -> List BookmarkedQuery -> Selection -> Html Msg
|
||||
userBookmarks texts model sel =
|
||||
userBookmarks : Bool -> Texts -> List BookmarkedQuery -> Selection -> Html Msg
|
||||
userBookmarks visible texts model sel =
|
||||
div
|
||||
[ class "mb-2"
|
||||
, classList [ ( "hidden", model == [] ) ]
|
||||
, classList [ ( "hidden", model == [] || not visible ) ]
|
||||
]
|
||||
[ titleDiv texts.userLabel
|
||||
, div [ class "flex flex-col space-y-2 md:space-y-1" ]
|
||||
@ -148,11 +161,11 @@ userBookmarks texts model sel =
|
||||
]
|
||||
|
||||
|
||||
collBookmarks : Texts -> List BookmarkedQuery -> Selection -> Html Msg
|
||||
collBookmarks texts model sel =
|
||||
collBookmarks : Bool -> Texts -> List BookmarkedQuery -> Selection -> Html Msg
|
||||
collBookmarks visible texts model sel =
|
||||
div
|
||||
[ class "mb-2"
|
||||
, classList [ ( "hidden", [] == model ) ]
|
||||
, classList [ ( "hidden", [] == model || not visible ) ]
|
||||
]
|
||||
[ titleDiv texts.collectiveLabel
|
||||
, div [ class "flex flex-col space-y-2 md:space-y-1" ]
|
||||
@ -160,15 +173,15 @@ collBookmarks texts model sel =
|
||||
]
|
||||
|
||||
|
||||
shares : Texts -> Model -> Selection -> Html Msg
|
||||
shares texts model sel =
|
||||
shares : Bool -> Texts -> Model -> Selection -> Html Msg
|
||||
shares visible texts model sel =
|
||||
let
|
||||
bms =
|
||||
List.map shareToBookmark model.all.shares
|
||||
in
|
||||
div
|
||||
[ class ""
|
||||
, classList [ ( "hidden", List.isEmpty bms ) ]
|
||||
, classList [ ( "hidden", List.isEmpty bms || not visible ) ]
|
||||
]
|
||||
[ titleDiv texts.shareLabel
|
||||
, div [ class "flex flex-col space-y-2 md:space-y-1" ]
|
||||
|
@ -712,10 +712,10 @@ formHeading texts classes model =
|
||||
(\_ -> texts.addCustomFieldHeader)
|
||||
|
||||
headIcon =
|
||||
fold (\_ -> Icons.tagIcon2 "mr-2")
|
||||
(\_ -> Icons.personIcon2 "mr-2")
|
||||
(\_ -> Icons.organizationIcon2 "mr-2")
|
||||
(\_ -> Icons.equipmentIcon2 "mt-2")
|
||||
fold (\_ -> Icons.tagIcon "mr-2")
|
||||
(\_ -> Icons.personIcon "mr-2")
|
||||
(\_ -> Icons.organizationIcon "mr-2")
|
||||
(\_ -> Icons.equipmentIcon "mt-2")
|
||||
(\_ -> Icons.customFieldIcon2 "mr-2")
|
||||
in
|
||||
div [ class classes ]
|
||||
@ -738,10 +738,10 @@ viewModal2 texts settings mm =
|
||||
(\_ -> texts.addCustomFieldHeader)
|
||||
|
||||
headIcon =
|
||||
fold (\_ -> Icons.tagIcon2 "mr-2")
|
||||
(\_ -> Icons.personIcon2 "mr-2")
|
||||
(\_ -> Icons.organizationIcon2 "mr-2")
|
||||
(\_ -> Icons.equipmentIcon2 "mt-2")
|
||||
fold (\_ -> Icons.tagIcon "mr-2")
|
||||
(\_ -> Icons.personIcon "mr-2")
|
||||
(\_ -> Icons.organizationIcon "mr-2")
|
||||
(\_ -> Icons.equipmentIcon "mt-2")
|
||||
(\_ -> Icons.customFieldIcon2 "mr-2")
|
||||
in
|
||||
div
|
||||
|
@ -9,6 +9,7 @@ module Comp.EquipmentManage exposing
|
||||
( Model
|
||||
, Msg(..)
|
||||
, emptyModel
|
||||
, init
|
||||
, update
|
||||
, view2
|
||||
)
|
||||
@ -70,6 +71,11 @@ emptyModel =
|
||||
}
|
||||
|
||||
|
||||
init : Flags -> ( Model, Cmd Msg )
|
||||
init flags =
|
||||
( emptyModel, Api.getEquipments flags emptyModel.query emptyModel.order EquipmentResp )
|
||||
|
||||
|
||||
type Msg
|
||||
= TableMsg Comp.EquipmentTable.Msg
|
||||
| FormMsg Comp.EquipmentForm.Msg
|
||||
|
@ -418,7 +418,7 @@ viewRow texts cfg settings flags model item =
|
||||
, class "hover:opacity-60"
|
||||
, title texts.basics.folder
|
||||
]
|
||||
[ Icons.folderIcon2 "mr-2"
|
||||
[ Icons.folderIcon "mr-2"
|
||||
, Comp.LinkTarget.makeFolderLink item
|
||||
[ ( "hover:opacity-60", True ) ]
|
||||
SetLinkTarget
|
||||
@ -592,7 +592,7 @@ metaDataContent2 texts settings item =
|
||||
, class "hover:opacity-60"
|
||||
, title texts.basics.folder
|
||||
]
|
||||
[ Icons.folderIcon2 "mr-2"
|
||||
[ Icons.folderIcon "mr-2"
|
||||
, Comp.LinkTarget.makeFolderLink item
|
||||
[ ( "hover:opacity-60", True ) ]
|
||||
SetLinkTarget
|
||||
|
@ -298,7 +298,7 @@ formTabs texts flags settings model =
|
||||
[ optional [ Data.Fields.CorrOrg ] <|
|
||||
div [ class "mb-4" ]
|
||||
[ label [ class S.inputLabel ]
|
||||
[ Icons.organizationIcon2 "mr-2"
|
||||
[ Icons.organizationIcon "mr-2"
|
||||
, text texts.basics.organization
|
||||
, addIconLink texts.addNewOrg StartCorrOrgModal
|
||||
, editIconLink texts.editOrg model.corrOrgModel StartEditCorrOrgModal
|
||||
@ -314,7 +314,7 @@ formTabs texts flags settings model =
|
||||
, optional [ Data.Fields.CorrPerson ] <|
|
||||
div [ class "mb-4" ]
|
||||
[ label [ class S.inputLabel ]
|
||||
[ Icons.personIcon2 "mr-2"
|
||||
[ Icons.personIcon "mr-2"
|
||||
, text texts.basics.person
|
||||
, addIconLink texts.addNewCorrespondentPerson StartCorrPersonModal
|
||||
, editIconLink texts.editPerson
|
||||
@ -348,7 +348,7 @@ formTabs texts flags settings model =
|
||||
[ optional [ Data.Fields.ConcPerson ] <|
|
||||
div [ class "mb-4" ]
|
||||
[ label [ class S.inputLabel ]
|
||||
[ Icons.personIcon2 "mr-2"
|
||||
[ Icons.personIcon "mr-2"
|
||||
, text texts.basics.person
|
||||
, addIconLink texts.addNewConcerningPerson StartConcPersonModal
|
||||
, editIconLink texts.editPerson
|
||||
@ -366,7 +366,7 @@ formTabs texts flags settings model =
|
||||
, optional [ Data.Fields.ConcEquip ] <|
|
||||
div [ class "mb-4" ]
|
||||
[ label [ class S.inputLabel ]
|
||||
[ Icons.equipmentIcon2 "mr-2"
|
||||
[ Icons.equipmentIcon "mr-2"
|
||||
, text texts.basics.equipment
|
||||
, addIconLink texts.addNewEquipment StartEquipModal
|
||||
, editIconLink texts.editEquipment
|
||||
|
@ -98,7 +98,7 @@ view texts settings model =
|
||||
[ class itemStyle
|
||||
, title texts.basics.folder
|
||||
]
|
||||
[ Icons.folderIcon2 "mr-2"
|
||||
[ Icons.folderIcon "mr-2"
|
||||
, Comp.LinkTarget.makeFolderLink model.item
|
||||
[ ( linkStyle, True ) ]
|
||||
SetLinkTarget
|
||||
|
@ -735,7 +735,7 @@ renderEditForm2 texts flags cfg settings model =
|
||||
, body =
|
||||
[ div [ class "field" ]
|
||||
[ label [ class S.inputLabel ]
|
||||
[ Icons.tagsIcon2 ""
|
||||
[ Icons.tagsIcon ""
|
||||
, text texts.basics.tags
|
||||
, a
|
||||
[ class "float-right"
|
||||
@ -841,7 +841,7 @@ renderEditForm2 texts flags cfg settings model =
|
||||
[ optional [ Data.Fields.CorrOrg ] <|
|
||||
div [ class "mb-4" ]
|
||||
[ label [ class S.inputLabel ]
|
||||
[ Icons.organizationIcon2 ""
|
||||
[ Icons.organizationIcon ""
|
||||
, span [ class "ml-2" ]
|
||||
[ text texts.basics.organization
|
||||
]
|
||||
@ -856,7 +856,7 @@ renderEditForm2 texts flags cfg settings model =
|
||||
, optional [ Data.Fields.CorrPerson ] <|
|
||||
div [ class "mb-4" ]
|
||||
[ label [ class S.inputLabel ]
|
||||
[ Icons.personIcon2 ""
|
||||
[ Icons.personIcon ""
|
||||
, span [ class "ml-2" ]
|
||||
[ text texts.basics.person
|
||||
]
|
||||
@ -878,7 +878,7 @@ renderEditForm2 texts flags cfg settings model =
|
||||
[ optional [ Data.Fields.ConcPerson ] <|
|
||||
div [ class "mb-4" ]
|
||||
[ label [ class S.inputLabel ]
|
||||
[ Icons.personIcon2 ""
|
||||
[ Icons.personIcon ""
|
||||
, span [ class "ml-2" ]
|
||||
[ text texts.basics.person ]
|
||||
]
|
||||
@ -887,7 +887,7 @@ renderEditForm2 texts flags cfg settings model =
|
||||
, optional [ Data.Fields.ConcEquip ] <|
|
||||
div [ class "mb-4" ]
|
||||
[ label [ class S.inputLabel ]
|
||||
[ Icons.equipmentIcon2 ""
|
||||
[ Icons.equipmentIcon ""
|
||||
, span [ class "ml-2" ]
|
||||
[ text texts.basics.equipment ]
|
||||
]
|
||||
|
@ -9,6 +9,7 @@ module Comp.OrgManage exposing
|
||||
( Model
|
||||
, Msg(..)
|
||||
, emptyModel
|
||||
, init
|
||||
, update
|
||||
, view2
|
||||
)
|
||||
@ -71,6 +72,11 @@ emptyModel =
|
||||
}
|
||||
|
||||
|
||||
init : Flags -> ( Model, Cmd Msg )
|
||||
init flags =
|
||||
( emptyModel, Api.getOrganizations flags emptyModel.query emptyModel.order OrgResp )
|
||||
|
||||
|
||||
type Msg
|
||||
= TableMsg Comp.OrgTable.Msg
|
||||
| FormMsg Comp.OrgForm.Msg
|
||||
|
@ -9,6 +9,7 @@ module Comp.PersonManage exposing
|
||||
( Model
|
||||
, Msg(..)
|
||||
, emptyModel
|
||||
, init
|
||||
, update
|
||||
, view2
|
||||
)
|
||||
@ -72,6 +73,11 @@ emptyModel =
|
||||
}
|
||||
|
||||
|
||||
init : Flags -> ( Model, Cmd Msg )
|
||||
init flags =
|
||||
( emptyModel, Api.getPersons flags emptyModel.query emptyModel.order PersonResp )
|
||||
|
||||
|
||||
type Msg
|
||||
= TableMsg Comp.PersonTable.Msg
|
||||
| FormMsg Comp.PersonForm.Msg
|
||||
|
@ -85,6 +85,7 @@ init flags =
|
||||
, Cmd.batch
|
||||
[ Cmd.map FormMsg fc
|
||||
, Cmd.map MailMsg mc
|
||||
, Api.getShares flags "" True LoadSharesResp
|
||||
]
|
||||
)
|
||||
|
||||
|
@ -69,6 +69,7 @@ init flags =
|
||||
[ Cmd.map FormMsg fc
|
||||
, Ports.initClipboard appClipboardData
|
||||
, Ports.initClipboard apiClipboardData
|
||||
, Api.getSources flags SourceResp
|
||||
]
|
||||
)
|
||||
|
||||
|
@ -9,6 +9,7 @@ module Comp.TagManage exposing
|
||||
( Model
|
||||
, Msg(..)
|
||||
, emptyModel
|
||||
, init
|
||||
, update
|
||||
, view2
|
||||
)
|
||||
@ -73,6 +74,11 @@ emptyModel =
|
||||
}
|
||||
|
||||
|
||||
init : Flags -> ( Model, Cmd Msg )
|
||||
init flags =
|
||||
( emptyModel, Api.getTags flags emptyModel.query emptyModel.order (TagResp emptyModel.query) )
|
||||
|
||||
|
||||
type Msg
|
||||
= TableMsg Comp.TagTable.Msg
|
||||
| FormMsg Comp.TagForm.Msg
|
||||
|
@ -546,7 +546,7 @@ viewTagItem2 ddm settings model tag =
|
||||
Data.UiSettings.tagColorFg2 tag.tag settings
|
||||
|
||||
icon =
|
||||
getIcon2 state color I.tagIcon2
|
||||
getIcon2 state color I.tagIcon
|
||||
|
||||
dropActive =
|
||||
DD.getDropId ddm == Just (DD.Tag tag.tag.id)
|
||||
@ -587,7 +587,7 @@ viewCategoryItem2 settings model cat =
|
||||
Data.UiSettings.catColorFg2 settings cat.name
|
||||
|
||||
icon =
|
||||
getIcon2 state color I.tagsIcon2
|
||||
getIcon2 state color I.tagsIcon
|
||||
in
|
||||
a
|
||||
[ class "flex flex-row items-center"
|
||||
|
Reference in New Issue
Block a user