mirror of
https://github.com/TheAnachronism/docspell.git
synced 2025-06-23 02:48:26 +00:00
Externalize strings for home page
This commit is contained in:
@ -23,14 +23,14 @@ type alias Settings msg =
|
||||
}
|
||||
|
||||
|
||||
defaultSettings : msg -> msg -> String -> Settings msg
|
||||
defaultSettings confirm cancel confirmMsg =
|
||||
defaultSettings : msg -> msg -> String -> String -> String -> Settings msg
|
||||
defaultSettings confirm cancel okLabel cancelLabel confirmMsg =
|
||||
{ enabled = True
|
||||
, extraClass = ""
|
||||
, headerIcon = "fa fa-exclamation-circle mr-3"
|
||||
, headerClass = "text-2xl font-bold text-center w-full"
|
||||
, confirmText = "Ok"
|
||||
, cancelText = "Cancel"
|
||||
, confirmText = okLabel
|
||||
, cancelText = cancelLabel
|
||||
, message = confirmMsg
|
||||
, confirm = confirm
|
||||
, cancel = cancel
|
||||
|
@ -313,23 +313,28 @@ type alias ViewSettings =
|
||||
{ showAddButton : Bool
|
||||
, classes : String
|
||||
, fieldIcon : CustomField -> Maybe String
|
||||
, style : DS.DropdownStyle
|
||||
, createCustomFieldTitle : String
|
||||
}
|
||||
|
||||
|
||||
view2 : DS.DropdownStyle -> ViewSettings -> Model -> Html Msg
|
||||
view2 ddstyle viewSettings model =
|
||||
view2 : ViewSettings -> Model -> Html Msg
|
||||
view2 viewSettings model =
|
||||
div [ class viewSettings.classes ]
|
||||
(viewMenuBar2 ddstyle viewSettings model
|
||||
(viewMenuBar2 viewSettings model
|
||||
:: List.map (viewCustomField2 viewSettings model) (visibleFields model)
|
||||
)
|
||||
|
||||
|
||||
viewMenuBar2 : DS.DropdownStyle -> ViewSettings -> Model -> Html Msg
|
||||
viewMenuBar2 ddstyle viewSettings model =
|
||||
viewMenuBar2 : ViewSettings -> Model -> Html Msg
|
||||
viewMenuBar2 viewSettings model =
|
||||
let
|
||||
{ dropdown, selected } =
|
||||
model.fieldSelect
|
||||
|
||||
ddstyle =
|
||||
viewSettings.style
|
||||
|
||||
ddstyleFlex =
|
||||
{ display = \f -> Maybe.withDefault f.name f.label
|
||||
, icon = \_ -> Nothing
|
||||
@ -350,7 +355,7 @@ viewMenuBar2 ddstyle viewSettings model =
|
||||
dropdown
|
||||
)
|
||||
:: (if viewSettings.showAddButton then
|
||||
[ addFieldLink2 "ml-1" model
|
||||
[ addFieldLink2 viewSettings.createCustomFieldTitle "ml-1" model
|
||||
]
|
||||
|
||||
else
|
||||
@ -377,8 +382,8 @@ viewCustomField2 viewSettings model field =
|
||||
span [] []
|
||||
|
||||
|
||||
addFieldLink2 : String -> Model -> Html Msg
|
||||
addFieldLink2 classes _ =
|
||||
addFieldLink2 : String -> String -> Model -> Html Msg
|
||||
addFieldLink2 titleStr classes _ =
|
||||
a
|
||||
[ class classes
|
||||
, class S.secondaryButton
|
||||
@ -386,7 +391,7 @@ addFieldLink2 classes _ =
|
||||
-- , class "absolute -right-12 top-0"
|
||||
, href "#"
|
||||
, onClick CreateNewField
|
||||
, title "Create a new custom field"
|
||||
, title titleStr
|
||||
]
|
||||
[ i [ class "fa fa-plus" ] []
|
||||
]
|
||||
|
@ -23,6 +23,7 @@ import Html exposing (..)
|
||||
import Html.Attributes exposing (..)
|
||||
import Html.Events exposing (onClick)
|
||||
import Markdown
|
||||
import Messages.ItemCardComp exposing (Texts)
|
||||
import Page exposing (Page(..))
|
||||
import Set exposing (Set)
|
||||
import Styles as S
|
||||
@ -135,12 +136,11 @@ update ddm msg model =
|
||||
|
||||
|
||||
|
||||
--- View
|
||||
--- View2
|
||||
|
||||
|
||||
view2 : ViewConfig -> UiSettings -> Model -> ItemLight -> Html Msg
|
||||
view2 cfg settings model item =
|
||||
view2 : Texts -> ViewConfig -> UiSettings -> Model -> ItemLight -> Html Msg
|
||||
view2 texts cfg settings model item =
|
||||
let
|
||||
isConfirmed =
|
||||
item.state /= "created"
|
||||
@ -200,8 +200,8 @@ view2 cfg settings model item =
|
||||
[ previewImage2 settings cardAction model item
|
||||
]
|
||||
)
|
||||
++ [ mainContent2 cardAction cardColor isConfirmed settings cfg item
|
||||
, metaDataContent2 settings item
|
||||
++ [ mainContent2 texts cardAction cardColor isConfirmed settings cfg item
|
||||
, metaDataContent2 texts settings item
|
||||
, notesContent2 settings item
|
||||
, fulltextResultsContent2 item
|
||||
, previewMenu2 settings model item (currentAttachment model item)
|
||||
@ -221,8 +221,8 @@ fulltextResultsContent2 item =
|
||||
(List.map renderHighlightEntry2 item.highlighting)
|
||||
|
||||
|
||||
metaDataContent2 : UiSettings -> ItemLight -> Html Msg
|
||||
metaDataContent2 settings item =
|
||||
metaDataContent2 : Texts -> UiSettings -> ItemLight -> Html Msg
|
||||
metaDataContent2 texts settings item =
|
||||
let
|
||||
fieldHidden f =
|
||||
Data.UiSettings.fieldHidden settings f
|
||||
@ -234,7 +234,7 @@ metaDataContent2 settings item =
|
||||
[ ( "hidden", fieldHidden Data.Fields.Folder )
|
||||
]
|
||||
, class "hover:opacity-60"
|
||||
, title "Folder"
|
||||
, title texts.folder
|
||||
]
|
||||
[ Icons.folderIcon2 "mr-2"
|
||||
, Comp.LinkTarget.makeFolderLink item
|
||||
@ -273,8 +273,16 @@ notesContent2 settings item =
|
||||
]
|
||||
|
||||
|
||||
mainContent2 : List (Attribute Msg) -> String -> Bool -> UiSettings -> ViewConfig -> ItemLight -> Html Msg
|
||||
mainContent2 cardAction cardColor isConfirmed settings _ item =
|
||||
mainContent2 :
|
||||
Texts
|
||||
-> List (Attribute Msg)
|
||||
-> String
|
||||
-> Bool
|
||||
-> UiSettings
|
||||
-> ViewConfig
|
||||
-> ItemLight
|
||||
-> Html Msg
|
||||
mainContent2 texts cardAction cardColor isConfirmed settings _ item =
|
||||
let
|
||||
dirIcon =
|
||||
i
|
||||
|
@ -22,6 +22,7 @@ import Data.UiSettings exposing (UiSettings)
|
||||
import Dict exposing (Dict)
|
||||
import Html exposing (..)
|
||||
import Html.Attributes exposing (..)
|
||||
import Messages.ItemCardListComp exposing (Texts)
|
||||
import Page exposing (Page(..))
|
||||
import Styles as S
|
||||
import Util.ItemDragDrop as DD
|
||||
@ -148,19 +149,19 @@ type alias ViewConfig =
|
||||
}
|
||||
|
||||
|
||||
view2 : ViewConfig -> UiSettings -> Model -> Html Msg
|
||||
view2 cfg settings model =
|
||||
view2 : Texts -> ViewConfig -> UiSettings -> Model -> Html Msg
|
||||
view2 texts cfg settings model =
|
||||
div
|
||||
[ classList
|
||||
[ ( "ds-item-list", True )
|
||||
, ( "ds-multi-select-mode", isMultiSelectMode cfg )
|
||||
]
|
||||
]
|
||||
(List.map (viewGroup2 model cfg settings) model.results.groups)
|
||||
(List.map (viewGroup2 texts model cfg settings) model.results.groups)
|
||||
|
||||
|
||||
viewGroup2 : Model -> ViewConfig -> UiSettings -> ItemLightGroup -> Html Msg
|
||||
viewGroup2 model cfg settings group =
|
||||
viewGroup2 : Texts -> Model -> ViewConfig -> UiSettings -> ItemLightGroup -> Html Msg
|
||||
viewGroup2 texts model cfg settings group =
|
||||
div [ class "ds-item-group" ]
|
||||
[ div
|
||||
[ class "flex py-0 mt-2 flex flex-row items-center"
|
||||
@ -185,12 +186,12 @@ viewGroup2 model cfg settings group =
|
||||
[]
|
||||
]
|
||||
, div [ class "grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 2xl:grid-cols-4 gap-2" ]
|
||||
(List.map (viewItem2 model cfg settings) group.items)
|
||||
(List.map (viewItem2 texts model cfg settings) group.items)
|
||||
]
|
||||
|
||||
|
||||
viewItem2 : Model -> ViewConfig -> UiSettings -> ItemLight -> Html Msg
|
||||
viewItem2 model cfg settings item =
|
||||
viewItem2 : Texts -> Model -> ViewConfig -> UiSettings -> ItemLight -> Html Msg
|
||||
viewItem2 texts model cfg settings item =
|
||||
let
|
||||
currentClass =
|
||||
if cfg.current == Just item.id then
|
||||
@ -207,7 +208,7 @@ viewItem2 model cfg settings item =
|
||||
|> Maybe.withDefault Comp.ItemCard.init
|
||||
|
||||
cardHtml =
|
||||
Comp.ItemCard.view2 vvcfg settings cardModel item
|
||||
Comp.ItemCard.view2 texts.itemCard vvcfg settings cardModel item
|
||||
in
|
||||
Html.map (ItemCardMsg item) cardHtml
|
||||
|
||||
|
@ -96,10 +96,12 @@ formTabs flags settings model =
|
||||
Data.UiSettings.fieldVisible settings field
|
||||
|
||||
customFieldSettings =
|
||||
Comp.CustomFieldMultiInput.ViewSettings
|
||||
True
|
||||
"field"
|
||||
(\f -> Dict.get f.id model.customFieldSavingIcon)
|
||||
{ showAddButton = True
|
||||
, classes = ""
|
||||
, fieldIcon = \f -> Dict.get f.id model.customFieldSavingIcon
|
||||
, style = dds
|
||||
, createCustomFieldTitle = "Create new custom field"
|
||||
}
|
||||
|
||||
optional fields html =
|
||||
if
|
||||
@ -255,7 +257,6 @@ item visible. This message will disappear then.
|
||||
[ div [ class "mb-4" ]
|
||||
[ Html.map CustomFieldMsg
|
||||
(Comp.CustomFieldMultiInput.view2
|
||||
dds
|
||||
customFieldSettings
|
||||
model.customFieldsModel
|
||||
)
|
||||
|
@ -39,6 +39,7 @@ import Html.Attributes exposing (..)
|
||||
import Html.Events exposing (onClick, onInput)
|
||||
import Http
|
||||
import Markdown
|
||||
import Messages.MultiEditComp exposing (Texts)
|
||||
import Page exposing (Page(..))
|
||||
import Set exposing (Set)
|
||||
import Styles as S
|
||||
@ -601,13 +602,13 @@ defaultViewConfig =
|
||||
--- View2
|
||||
|
||||
|
||||
view2 : Flags -> ViewConfig -> UiSettings -> Model -> Html Msg
|
||||
view2 : Texts -> Flags -> ViewConfig -> UiSettings -> Model -> Html Msg
|
||||
view2 =
|
||||
renderEditForm2
|
||||
|
||||
|
||||
renderEditForm2 : Flags -> ViewConfig -> UiSettings -> Model -> Html Msg
|
||||
renderEditForm2 flags cfg settings model =
|
||||
renderEditForm2 : Texts -> Flags -> ViewConfig -> UiSettings -> Model -> Html Msg
|
||||
renderEditForm2 texts flags cfg settings model =
|
||||
let
|
||||
fieldVisible field =
|
||||
Data.UiSettings.fieldVisible settings field
|
||||
@ -636,13 +637,13 @@ renderEditForm2 flags cfg settings model =
|
||||
tagModeMsg =
|
||||
case model.tagEditMode of
|
||||
AddTags ->
|
||||
"Tags chosen here are *added* to all selected items."
|
||||
texts.tagModeAddInfo
|
||||
|
||||
RemoveTags ->
|
||||
"Tags chosen here are *removed* from all selected items."
|
||||
texts.tagModeRemoveInfo
|
||||
|
||||
ReplaceTags ->
|
||||
"Tags chosen here *replace* those on selected items."
|
||||
texts.tagModeReplaceInfo
|
||||
|
||||
customFieldIcon field =
|
||||
case cfg.customFieldState field.id of
|
||||
@ -656,10 +657,12 @@ renderEditForm2 flags cfg settings model =
|
||||
Just "fa fa-sync-alt animate-spin"
|
||||
|
||||
customFieldSettings =
|
||||
Comp.CustomFieldMultiInput.ViewSettings
|
||||
False
|
||||
"mb-4"
|
||||
customFieldIcon
|
||||
{ showAddButton = False
|
||||
, classes = "mb-4"
|
||||
, fieldIcon = customFieldIcon
|
||||
, style = dds
|
||||
, createCustomFieldTitle = ""
|
||||
}
|
||||
|
||||
dds =
|
||||
Data.DropdownStyle.sidebarStyle
|
||||
@ -677,7 +680,7 @@ renderEditForm2 flags cfg settings model =
|
||||
idNameCfg =
|
||||
{ makeOption = \e -> { text = e.name, additional = "" }
|
||||
, labelColor = \_ -> \_ -> ""
|
||||
, placeholder = "Select…"
|
||||
, placeholder = texts.selectPlaceholder
|
||||
, style = dds
|
||||
}
|
||||
|
||||
@ -687,7 +690,7 @@ renderEditForm2 flags cfg settings model =
|
||||
{ text = Data.Direction.toString entry
|
||||
, additional = ""
|
||||
}
|
||||
, placeholder = "Choose a direction…"
|
||||
, placeholder = texts.chooseDirection
|
||||
, labelColor = \_ -> \_ -> ""
|
||||
, style = dds
|
||||
}
|
||||
@ -697,7 +700,7 @@ renderEditForm2 flags cfg settings model =
|
||||
tabStyle
|
||||
(tabState settings model)
|
||||
[ { name = tabName TabConfirmUnconfirm
|
||||
, title = "Confirm/Unconfirm item metadata"
|
||||
, title = texts.confirmUnconfirm
|
||||
, titleRight = []
|
||||
, info = Nothing
|
||||
, body =
|
||||
@ -709,32 +712,32 @@ renderEditForm2 flags cfg settings model =
|
||||
, class "flex-grow"
|
||||
, onClick (ConfirmMsg True)
|
||||
]
|
||||
[ text "Confirm"
|
||||
[ text texts.confirm
|
||||
]
|
||||
, button
|
||||
[ class S.secondaryButton
|
||||
, class "flex-grow"
|
||||
, onClick (ConfirmMsg False)
|
||||
]
|
||||
[ text "Unconfirm"
|
||||
[ text texts.unconfirm
|
||||
]
|
||||
]
|
||||
]
|
||||
}
|
||||
, { name = tabName TabTags
|
||||
, title = "Tags"
|
||||
, title = texts.basics.tags
|
||||
, titleRight = []
|
||||
, info = Nothing
|
||||
, body =
|
||||
[ div [ class "field" ]
|
||||
[ label [ class S.inputLabel ]
|
||||
[ Icons.tagsIcon2 ""
|
||||
, text "Tags"
|
||||
, text texts.basics.tags
|
||||
, a
|
||||
[ class "float-right"
|
||||
, class S.link
|
||||
, href "#"
|
||||
, title "Change tag edit mode"
|
||||
, title texts.changeTagMode
|
||||
, onClick ToggleTagEditMode
|
||||
]
|
||||
[ tagModeIcon
|
||||
@ -750,7 +753,7 @@ renderEditForm2 flags cfg settings model =
|
||||
]
|
||||
}
|
||||
, { name = tabName TabFolder
|
||||
, title = "Folder"
|
||||
, title = texts.folderTab
|
||||
, titleRight = []
|
||||
, info = Nothing
|
||||
, body =
|
||||
@ -761,25 +764,24 @@ renderEditForm2 flags cfg settings model =
|
||||
, ( "hidden", isFolderMember model )
|
||||
]
|
||||
]
|
||||
[ Markdown.toHtml [] """
|
||||
You are **not a member** of this folder. This item will be **hidden**
|
||||
from any search now. Use a folder where you are a member of to make this
|
||||
item visible. This message will disappear then.
|
||||
"""
|
||||
[ Markdown.toHtml [] texts.folderNotOwnerWarning
|
||||
]
|
||||
]
|
||||
}
|
||||
, { name = tabName TabCustomFields
|
||||
, title = "Custom Fields"
|
||||
, title = texts.customFieldsTab
|
||||
, titleRight = []
|
||||
, info = Nothing
|
||||
, body =
|
||||
[ Html.map CustomFieldMsg
|
||||
(Comp.CustomFieldMultiInput.view2 dds customFieldSettings model.customFieldModel)
|
||||
(Comp.CustomFieldMultiInput.view2
|
||||
customFieldSettings
|
||||
model.customFieldModel
|
||||
)
|
||||
]
|
||||
}
|
||||
, { name = tabName TabDate
|
||||
, title = "Date"
|
||||
, title = texts.dateTab
|
||||
, titleRight = []
|
||||
, info = Nothing
|
||||
, body =
|
||||
@ -802,7 +804,7 @@ item visible. This message will disappear then.
|
||||
]
|
||||
}
|
||||
, { name = tabName TabDueDate
|
||||
, title = "Due Date"
|
||||
, title = texts.dueDateTab
|
||||
, titleRight = []
|
||||
, info = Nothing
|
||||
, body =
|
||||
@ -825,7 +827,7 @@ item visible. This message will disappear then.
|
||||
]
|
||||
}
|
||||
, { name = tabName TabCorrespondent
|
||||
, title = "Correspondent"
|
||||
, title = texts.correspondentTab
|
||||
, titleRight = []
|
||||
, info = Nothing
|
||||
, body =
|
||||
@ -834,25 +836,35 @@ item visible. This message will disappear then.
|
||||
[ label [ class S.inputLabel ]
|
||||
[ Icons.organizationIcon2 ""
|
||||
, span [ class "ml-2" ]
|
||||
[ text "Organization"
|
||||
[ text texts.organization
|
||||
]
|
||||
]
|
||||
, Html.map OrgDropdownMsg (Comp.Dropdown.view2 idNameCfg settings model.corrOrgModel)
|
||||
, Html.map OrgDropdownMsg
|
||||
(Comp.Dropdown.view2
|
||||
idNameCfg
|
||||
settings
|
||||
model.corrOrgModel
|
||||
)
|
||||
]
|
||||
, optional [ Data.Fields.CorrPerson ] <|
|
||||
div [ class "mb-4" ]
|
||||
[ label [ class S.inputLabel ]
|
||||
[ Icons.personIcon2 ""
|
||||
, span [ class "ml-2" ]
|
||||
[ text "Person"
|
||||
[ text texts.person
|
||||
]
|
||||
]
|
||||
, Html.map CorrPersonMsg (Comp.Dropdown.view2 idNameCfg settings model.corrPersonModel)
|
||||
, Html.map CorrPersonMsg
|
||||
(Comp.Dropdown.view2
|
||||
idNameCfg
|
||||
settings
|
||||
model.corrPersonModel
|
||||
)
|
||||
]
|
||||
]
|
||||
}
|
||||
, { name = tabName TabConcerning
|
||||
, title = "Concerning"
|
||||
, title = texts.concerningTab
|
||||
, titleRight = []
|
||||
, info = Nothing
|
||||
, body =
|
||||
@ -861,7 +873,7 @@ item visible. This message will disappear then.
|
||||
[ label [ class S.inputLabel ]
|
||||
[ Icons.personIcon2 ""
|
||||
, span [ class "ml-2" ]
|
||||
[ text "Person" ]
|
||||
[ text texts.person ]
|
||||
]
|
||||
, Html.map ConcPersonMsg (Comp.Dropdown.view2 idNameCfg settings model.concPersonModel)
|
||||
]
|
||||
@ -870,7 +882,7 @@ item visible. This message will disappear then.
|
||||
[ label [ class S.inputLabel ]
|
||||
[ Icons.equipmentIcon2 ""
|
||||
, span [ class "ml-2" ]
|
||||
[ text "Equipment" ]
|
||||
[ text texts.equipment ]
|
||||
]
|
||||
, Html.map ConcEquipMsg
|
||||
(Comp.Dropdown.view2 idNameCfg
|
||||
@ -881,7 +893,7 @@ item visible. This message will disappear then.
|
||||
]
|
||||
}
|
||||
, { name = tabName TabDirection
|
||||
, title = "Direction"
|
||||
, title = texts.directionTab
|
||||
, titleRight = []
|
||||
, info = Nothing
|
||||
, body =
|
||||
@ -889,7 +901,7 @@ item visible. This message will disappear then.
|
||||
]
|
||||
}
|
||||
, { name = tabName TabName
|
||||
, title = "Name"
|
||||
, title = texts.nameTab
|
||||
, titleRight = []
|
||||
, info = Nothing
|
||||
, body =
|
||||
@ -904,9 +916,15 @@ item visible. This message will disappear then.
|
||||
, span [ class S.inputLeftIconOnly ]
|
||||
[ i
|
||||
[ classList
|
||||
[ ( "text-green-500 fa fa-check", cfg.nameState == SaveSuccess )
|
||||
, ( "text-red-500 fa fa-exclamation-triangle", cfg.nameState == SaveFailed )
|
||||
, ( "sync fa fa-circle-notch animate-spin", cfg.nameState == Saving )
|
||||
[ ( "text-green-500 fa fa-check"
|
||||
, cfg.nameState == SaveSuccess
|
||||
)
|
||||
, ( "text-red-500 fa fa-exclamation-triangle"
|
||||
, cfg.nameState == SaveFailed
|
||||
)
|
||||
, ( "sync fa fa-circle-notch animate-spin"
|
||||
, cfg.nameState == Saving
|
||||
)
|
||||
]
|
||||
]
|
||||
[]
|
||||
@ -923,7 +941,7 @@ tabState settings model tab =
|
||||
FTabState.tabState settings
|
||||
model.openTabs
|
||||
(Just model.customFieldModel)
|
||||
(.title >> ToggleAkkordionTab)
|
||||
(.name >> ToggleAkkordionTab)
|
||||
tab
|
||||
|
||||
|
||||
|
@ -550,6 +550,8 @@ update key flags inav settings msg model =
|
||||
Comp.ConfirmModal.defaultSettings
|
||||
DeleteItemConfirmed
|
||||
ItemModalCancelled
|
||||
"Ok"
|
||||
"Cancel"
|
||||
confirmMsg
|
||||
in
|
||||
resultModel { model | itemModal = Just confirm }
|
||||
@ -923,6 +925,8 @@ update key flags inav settings msg model =
|
||||
Comp.ConfirmModal.defaultSettings
|
||||
(DeleteAttachConfirmed id)
|
||||
AttachModalCancelled
|
||||
"Ok"
|
||||
"Cancel"
|
||||
"Really delete this file?"
|
||||
|
||||
model_ =
|
||||
@ -1511,6 +1515,8 @@ update key flags inav settings msg model =
|
||||
Comp.ConfirmModal.defaultSettings
|
||||
(ReprocessFileConfirmed id)
|
||||
AttachModalCancelled
|
||||
"Ok"
|
||||
"Cancel"
|
||||
confirmMsg
|
||||
|
||||
model_ =
|
||||
@ -1546,6 +1552,8 @@ update key flags inav settings msg model =
|
||||
Comp.ConfirmModal.defaultSettings
|
||||
ReprocessItemConfirmed
|
||||
ItemModalCancelled
|
||||
"Ok"
|
||||
"Cancel"
|
||||
confirmMsg
|
||||
|
||||
model_ =
|
||||
|
@ -2,6 +2,7 @@ module Comp.PowerSearchInput exposing
|
||||
( Action(..)
|
||||
, Model
|
||||
, Msg
|
||||
, ViewSettings
|
||||
, init
|
||||
, update
|
||||
, viewInput
|
||||
@ -133,12 +134,18 @@ throttleUpdate model =
|
||||
--- View
|
||||
|
||||
|
||||
viewInput : List (Attribute Msg) -> Model -> Html Msg
|
||||
viewInput attrs model =
|
||||
type alias ViewSettings =
|
||||
{ placeholder : String
|
||||
, extraAttrs : List (Attribute Msg)
|
||||
}
|
||||
|
||||
|
||||
viewInput : ViewSettings -> Model -> Html Msg
|
||||
viewInput cfg model =
|
||||
input
|
||||
(attrs
|
||||
(cfg.extraAttrs
|
||||
++ [ type_ "text"
|
||||
, placeholder "Search query …"
|
||||
, placeholder cfg.placeholder
|
||||
, onInput SetSearch
|
||||
, Util.Html.onKeyUpCode KeyUpMsg
|
||||
, Maybe.map value model.input
|
||||
|
@ -44,6 +44,7 @@ import Html exposing (..)
|
||||
import Html.Attributes exposing (..)
|
||||
import Html.Events exposing (onClick, onInput)
|
||||
import Http
|
||||
import Messages.SearchMenuComp exposing (Texts)
|
||||
import Set exposing (Set)
|
||||
import Styles as S
|
||||
import Util.Html exposing (KeyCode(..))
|
||||
@ -902,8 +903,7 @@ updateDrop ddm flags settings msg model =
|
||||
ToggleOpenAllAkkordionTabs ->
|
||||
let
|
||||
allNames =
|
||||
searchTabs (DD.DragDropData ddm Nothing) flags settings model
|
||||
|> List.map .title
|
||||
List.map tabName allTabs
|
||||
|> Set.fromList
|
||||
|
||||
next =
|
||||
@ -924,8 +924,8 @@ updateDrop ddm flags settings msg model =
|
||||
--- View2
|
||||
|
||||
|
||||
viewDrop2 : DD.DragDropData -> Flags -> UiSettings -> Model -> Html Msg
|
||||
viewDrop2 ddd flags settings model =
|
||||
viewDrop2 : Texts -> DD.DragDropData -> Flags -> UiSettings -> Model -> Html Msg
|
||||
viewDrop2 texts ddd flags settings model =
|
||||
let
|
||||
akkordionStyle =
|
||||
Comp.Tabs.searchMenuStyle
|
||||
@ -933,7 +933,7 @@ viewDrop2 ddd flags settings model =
|
||||
Comp.Tabs.akkordion
|
||||
akkordionStyle
|
||||
(searchTabState settings model)
|
||||
(searchTabs ddd flags settings model)
|
||||
(searchTabs texts ddd flags settings model)
|
||||
|
||||
|
||||
type SearchTab
|
||||
@ -950,6 +950,22 @@ type SearchTab
|
||||
| TabDirection
|
||||
|
||||
|
||||
allTabs : List SearchTab
|
||||
allTabs =
|
||||
[ TabInbox
|
||||
, TabTags
|
||||
, TabTagCategories
|
||||
, TabFolder
|
||||
, TabCorrespondent
|
||||
, TabConcerning
|
||||
, TabCustomFields
|
||||
, TabDate
|
||||
, TabDueDate
|
||||
, TabSource
|
||||
, TabDirection
|
||||
]
|
||||
|
||||
|
||||
tabName : SearchTab -> String
|
||||
tabName tab =
|
||||
case tab of
|
||||
@ -1085,8 +1101,8 @@ searchTabState settings model tab =
|
||||
( state, ToggleAkkordionTab tab.name )
|
||||
|
||||
|
||||
searchTabs : DD.DragDropData -> Flags -> UiSettings -> Model -> List (Comp.Tabs.Tab Msg)
|
||||
searchTabs ddd flags settings model =
|
||||
searchTabs : Texts -> DD.DragDropData -> Flags -> UiSettings -> Model -> List (Comp.Tabs.Tab Msg)
|
||||
searchTabs texts ddd flags settings model =
|
||||
let
|
||||
isHidden f =
|
||||
Data.UiSettings.fieldHidden settings f
|
||||
@ -1100,21 +1116,14 @@ searchTabs ddd flags settings model =
|
||||
{ text = Data.Direction.toString entry
|
||||
, additional = ""
|
||||
}
|
||||
, placeholder = "Choose a direction…"
|
||||
, placeholder = texts.chooseDirection
|
||||
, labelColor = \_ -> \_ -> ""
|
||||
, style = DS.sidebarStyle
|
||||
}
|
||||
|
||||
corrPersonCfg =
|
||||
personCfg =
|
||||
{ makeOption = \e -> { text = e.name, additional = "" }
|
||||
, placeholder = "Choose a person"
|
||||
, labelColor = \_ -> \_ -> ""
|
||||
, style = DS.sidebarStyle
|
||||
}
|
||||
|
||||
concPersonCfg =
|
||||
{ makeOption = \e -> { text = e.name, additional = "" }
|
||||
, placeholder = "Choose a person"
|
||||
, placeholder = texts.choosePerson
|
||||
, labelColor = \_ -> \_ -> ""
|
||||
, style = DS.sidebarStyle
|
||||
}
|
||||
@ -1122,12 +1131,12 @@ searchTabs ddd flags settings model =
|
||||
concEquipCfg =
|
||||
{ makeOption = \e -> { text = e.name, additional = "" }
|
||||
, labelColor = \_ -> \_ -> ""
|
||||
, placeholder = "Choose an equipment"
|
||||
, placeholder = texts.chooseEquipment
|
||||
, style = DS.sidebarStyle
|
||||
}
|
||||
in
|
||||
[ { name = tabName TabInbox
|
||||
, title = "Inbox"
|
||||
, title = texts.inbox
|
||||
, info = Nothing
|
||||
, titleRight = []
|
||||
, body =
|
||||
@ -1135,7 +1144,7 @@ searchTabs ddd flags settings model =
|
||||
MB.Checkbox
|
||||
{ id = "search-inbox"
|
||||
, value = model.inboxCheckbox
|
||||
, label = "Inbox"
|
||||
, label = texts.inbox
|
||||
, tagger = \_ -> ToggleInbox
|
||||
}
|
||||
, div [ class "mt-2 hidden" ]
|
||||
@ -1143,10 +1152,10 @@ searchTabs ddd flags settings model =
|
||||
[ text
|
||||
(case model.textSearchModel of
|
||||
Fulltext _ ->
|
||||
"Fulltext Search"
|
||||
texts.fulltextSearch
|
||||
|
||||
Names _ ->
|
||||
"Search in names"
|
||||
texts.searchInNames
|
||||
)
|
||||
, a
|
||||
[ classList
|
||||
@ -1156,7 +1165,7 @@ searchTabs ddd flags settings model =
|
||||
, class S.link
|
||||
, href "#"
|
||||
, onClick SwapTextSearch
|
||||
, title "Switch between text search modes"
|
||||
, title texts.switchSearchModes
|
||||
]
|
||||
[ i [ class "fa fa-exchange-alt" ] []
|
||||
]
|
||||
@ -1168,26 +1177,26 @@ searchTabs ddd flags settings model =
|
||||
, textSearchString model.textSearchModel |> Maybe.withDefault "" |> value
|
||||
, case model.textSearchModel of
|
||||
Fulltext _ ->
|
||||
placeholder "Content search…"
|
||||
placeholder texts.contentSearch
|
||||
|
||||
Names _ ->
|
||||
placeholder "Search in various names…"
|
||||
placeholder texts.searchInNamesPlaceholder
|
||||
, class S.textInputSidebar
|
||||
]
|
||||
[]
|
||||
, span [ class "opacity-50 text-sm" ]
|
||||
[ case model.textSearchModel of
|
||||
Fulltext _ ->
|
||||
text "Fulltext search in document contents and notes."
|
||||
text texts.fulltextSearchInfo
|
||||
|
||||
Names _ ->
|
||||
text "Looks in correspondents, concerned entities, item name and notes."
|
||||
text texts.nameSearchInfo
|
||||
]
|
||||
]
|
||||
]
|
||||
}
|
||||
, { name = tabName TabTags
|
||||
, title = "Tags"
|
||||
, title = texts.basics.tags
|
||||
, titleRight = []
|
||||
, info = Nothing
|
||||
, body =
|
||||
@ -1200,7 +1209,7 @@ searchTabs ddd flags settings model =
|
||||
)
|
||||
}
|
||||
, { name = tabName TabTagCategories
|
||||
, title = "Tag Categories"
|
||||
, title = texts.tagCategoryTab
|
||||
, titleRight = []
|
||||
, info = Nothing
|
||||
, body =
|
||||
@ -1213,7 +1222,7 @@ searchTabs ddd flags settings model =
|
||||
]
|
||||
}
|
||||
, { name = tabName TabFolder
|
||||
, title = "Folder"
|
||||
, title = texts.folderTab
|
||||
, titleRight = []
|
||||
, info = Nothing
|
||||
, body =
|
||||
@ -1225,7 +1234,7 @@ searchTabs ddd flags settings model =
|
||||
]
|
||||
}
|
||||
, { name = tabName TabCorrespondent
|
||||
, title = "Correspondent"
|
||||
, title = texts.correspondentTab
|
||||
, titleRight = []
|
||||
, info = Nothing
|
||||
, body =
|
||||
@ -1234,10 +1243,10 @@ searchTabs ddd flags settings model =
|
||||
, classList [ ( "hidden", isHidden Data.Fields.CorrOrg ) ]
|
||||
]
|
||||
[ label [ class S.inputLabel ]
|
||||
[ text "Organization" ]
|
||||
[ text texts.organization ]
|
||||
, Html.map OrgMsg
|
||||
(Comp.Dropdown.view2
|
||||
(Comp.Dropdown.orgFormViewSettings "Choose an organization" DS.sidebarStyle)
|
||||
(Comp.Dropdown.orgFormViewSettings texts.chooseOrganization DS.sidebarStyle)
|
||||
settings
|
||||
model.orgModel
|
||||
)
|
||||
@ -1246,10 +1255,10 @@ searchTabs ddd flags settings model =
|
||||
[ class "mb-4"
|
||||
, classList [ ( "hidden", isHidden Data.Fields.CorrPerson ) ]
|
||||
]
|
||||
[ label [ class S.inputLabel ] [ text "Person" ]
|
||||
[ label [ class S.inputLabel ] [ text texts.person ]
|
||||
, Html.map CorrPersonMsg
|
||||
(Comp.Dropdown.view2
|
||||
corrPersonCfg
|
||||
personCfg
|
||||
settings
|
||||
model.corrPersonModel
|
||||
)
|
||||
@ -1257,7 +1266,7 @@ searchTabs ddd flags settings model =
|
||||
]
|
||||
}
|
||||
, { name = tabName TabConcerning
|
||||
, title = "Concerning"
|
||||
, title = texts.concerningTab
|
||||
, titleRight = []
|
||||
, info = Nothing
|
||||
, body =
|
||||
@ -1265,10 +1274,10 @@ searchTabs ddd flags settings model =
|
||||
[ class "mb-4"
|
||||
, classList [ ( "hidden", isHidden Data.Fields.ConcPerson ) ]
|
||||
]
|
||||
[ label [ class S.inputLabel ] [ text "Person" ]
|
||||
[ label [ class S.inputLabel ] [ text texts.person ]
|
||||
, Html.map ConcPersonMsg
|
||||
(Comp.Dropdown.view2
|
||||
concPersonCfg
|
||||
personCfg
|
||||
settings
|
||||
model.concPersonModel
|
||||
)
|
||||
@ -1277,7 +1286,7 @@ searchTabs ddd flags settings model =
|
||||
[ class "mb-4"
|
||||
, classList [ ( "hidden", isHidden Data.Fields.ConcEquip ) ]
|
||||
]
|
||||
[ label [ class S.inputLabel ] [ text "Equipment" ]
|
||||
[ label [ class S.inputLabel ] [ text texts.equipment ]
|
||||
, Html.map ConcEquipmentMsg
|
||||
(Comp.Dropdown.view2
|
||||
concEquipCfg
|
||||
@ -1288,20 +1297,24 @@ searchTabs ddd flags settings model =
|
||||
]
|
||||
}
|
||||
, { name = tabName TabCustomFields
|
||||
, title = "Custom Fields"
|
||||
, title = texts.customFieldsTab
|
||||
, titleRight = []
|
||||
, info = Nothing
|
||||
, body =
|
||||
[ Html.map CustomFieldMsg
|
||||
(Comp.CustomFieldMultiInput.view2
|
||||
DS.sidebarStyle
|
||||
(Comp.CustomFieldMultiInput.ViewSettings False "field" (\_ -> Nothing))
|
||||
{ showAddButton = False
|
||||
, classes = ""
|
||||
, fieldIcon = \_ -> Nothing
|
||||
, style = DS.sidebarStyle
|
||||
, createCustomFieldTitle = texts.createCustomFieldTitle
|
||||
}
|
||||
model.customFieldModel
|
||||
)
|
||||
]
|
||||
}
|
||||
, { name = tabName TabDate
|
||||
, title = "Date"
|
||||
, title = texts.dateTab
|
||||
, titleRight = []
|
||||
, info = Nothing
|
||||
, body =
|
||||
@ -1309,7 +1322,7 @@ searchTabs ddd flags settings model =
|
||||
[ class "flex flex-col" ]
|
||||
[ div [ class "mb-2" ]
|
||||
[ label [ class S.inputLabel ]
|
||||
[ text "From"
|
||||
[ text texts.from
|
||||
]
|
||||
, div [ class "relative" ]
|
||||
[ Html.map FromDateMsg
|
||||
@ -1326,7 +1339,7 @@ searchTabs ddd flags settings model =
|
||||
]
|
||||
, div [ class "mb-2" ]
|
||||
[ label [ class S.inputLabel ]
|
||||
[ text "To"
|
||||
[ text texts.to
|
||||
]
|
||||
, div [ class "relative" ]
|
||||
[ Html.map UntilDateMsg
|
||||
@ -1341,7 +1354,7 @@ searchTabs ddd flags settings model =
|
||||
]
|
||||
}
|
||||
, { name = tabName TabDueDate
|
||||
, title = "Due Date"
|
||||
, title = texts.dueDateTab
|
||||
, titleRight = []
|
||||
, info = Nothing
|
||||
, body =
|
||||
@ -1349,7 +1362,7 @@ searchTabs ddd flags settings model =
|
||||
[ class "flex flex-col" ]
|
||||
[ div [ class "mb-2" ]
|
||||
[ label [ class S.inputLabel ]
|
||||
[ text "Due From"
|
||||
[ text texts.dueFrom
|
||||
]
|
||||
, div [ class "relative" ]
|
||||
[ Html.map FromDueDateMsg
|
||||
@ -1366,7 +1379,7 @@ searchTabs ddd flags settings model =
|
||||
]
|
||||
, div [ class "mb-2" ]
|
||||
[ label [ class S.inputLabel ]
|
||||
[ text "Due To"
|
||||
[ text texts.dueTo
|
||||
]
|
||||
, div [ class "relative" ]
|
||||
[ Html.map UntilDueDateMsg
|
||||
@ -1385,7 +1398,7 @@ searchTabs ddd flags settings model =
|
||||
]
|
||||
}
|
||||
, { name = tabName TabSource
|
||||
, title = "Source"
|
||||
, title = texts.sourceTab
|
||||
, titleRight = []
|
||||
, info = Nothing
|
||||
, body =
|
||||
@ -1395,7 +1408,7 @@ searchTabs ddd flags settings model =
|
||||
, onInput SetSource
|
||||
, Util.Html.onKeyUpCode KeyUpMsg
|
||||
, model.sourceModel |> Maybe.withDefault "" |> value
|
||||
, placeholder "Search in item source…"
|
||||
, placeholder texts.searchInItemSource
|
||||
, class S.textInputSidebar
|
||||
]
|
||||
[]
|
||||
@ -1403,7 +1416,7 @@ searchTabs ddd flags settings model =
|
||||
]
|
||||
}
|
||||
, { name = tabName TabDirection
|
||||
, title = "Direction"
|
||||
, title = texts.directionTab
|
||||
, titleRight = []
|
||||
, info = Nothing
|
||||
, body =
|
||||
|
@ -11,6 +11,7 @@ import Data.Icons as Icons
|
||||
import Data.Money
|
||||
import Html exposing (..)
|
||||
import Html.Attributes exposing (..)
|
||||
import Messages.SearchStatsViewComp exposing (Texts)
|
||||
import Styles as S
|
||||
|
||||
|
||||
@ -28,8 +29,8 @@ sortFields fields =
|
||||
--- View2
|
||||
|
||||
|
||||
view2 : String -> SearchStats -> Html msg
|
||||
view2 classes stats =
|
||||
view2 : Texts -> String -> SearchStats -> Html msg
|
||||
view2 texts classes stats =
|
||||
let
|
||||
isNumField f =
|
||||
f.sum > 0
|
||||
@ -75,7 +76,7 @@ view2 classes stats =
|
||||
{ rootClass = ""
|
||||
, valueClass = "text-4xl"
|
||||
, value = String.fromInt stats.count
|
||||
, label = "Items"
|
||||
, label = texts.items
|
||||
}
|
||||
]
|
||||
, div [ class "flex-grow" ]
|
||||
@ -87,15 +88,15 @@ view2 classes stats =
|
||||
[ tr [ class "" ]
|
||||
[ th [ class "py-2 text-left" ] []
|
||||
, th [ class "py-2 text-center" ]
|
||||
[ text "Count" ]
|
||||
[ text texts.count ]
|
||||
, th [ class "py-2 text-center" ]
|
||||
[ text "Sum" ]
|
||||
[ text texts.sum ]
|
||||
, th [ class "py-2 text-center hidden md:table-cell" ]
|
||||
[ text "Avg" ]
|
||||
[ text texts.avg ]
|
||||
, th [ class "py-2 text-center hidden md:table-cell" ]
|
||||
[ text "Min" ]
|
||||
[ text texts.min ]
|
||||
, th [ class "py-2 text-center hidden md:table-cell" ]
|
||||
[ text "Max" ]
|
||||
[ text texts.max ]
|
||||
]
|
||||
]
|
||||
, tbody []
|
||||
|
Reference in New Issue
Block a user