Externalize strings for home page

This commit is contained in:
Eike Kettner 2021-04-05 21:31:45 +02:00
parent 9c1beb2240
commit 1762e7afac
24 changed files with 601 additions and 225 deletions

View File

@ -118,7 +118,7 @@ mainContent model =
] ]
(case model.page of (case model.page of
HomePage -> HomePage ->
viewHome model viewHome texts model
CollectiveSettingPage -> CollectiveSettingPage ->
viewCollectiveSettings texts model viewCollectiveSettings texts model
@ -397,10 +397,21 @@ dropdownMenu =
" absolute right-0 bg-white dark:bg-bluegray-800 border dark:border-bluegray-700 dark:text-bluegray-300 shadow-lg opacity-1 transition duration-200 min-w-max " " absolute right-0 bg-white dark:bg-bluegray-800 border dark:border-bluegray-700 dark:text-bluegray-300 shadow-lg opacity-1 transition duration-200 min-w-max "
viewHome : Model -> List (Html Msg) viewHome : Messages -> Model -> List (Html Msg)
viewHome model = viewHome texts model =
[ Html.map HomeMsg (Home.viewSidebar model.sidebarVisible model.flags model.uiSettings model.homeModel) [ Html.map HomeMsg
, Html.map HomeMsg (Home.viewContent model.flags model.uiSettings model.homeModel) (Home.viewSidebar texts.home
model.sidebarVisible
model.flags
model.uiSettings
model.homeModel
)
, Html.map HomeMsg
(Home.viewContent texts.home
model.flags
model.uiSettings
model.homeModel
)
] ]

View File

@ -23,14 +23,14 @@ type alias Settings msg =
} }
defaultSettings : msg -> msg -> String -> Settings msg defaultSettings : msg -> msg -> String -> String -> String -> Settings msg
defaultSettings confirm cancel confirmMsg = defaultSettings confirm cancel okLabel cancelLabel confirmMsg =
{ enabled = True { enabled = True
, extraClass = "" , extraClass = ""
, headerIcon = "fa fa-exclamation-circle mr-3" , headerIcon = "fa fa-exclamation-circle mr-3"
, headerClass = "text-2xl font-bold text-center w-full" , headerClass = "text-2xl font-bold text-center w-full"
, confirmText = "Ok" , confirmText = okLabel
, cancelText = "Cancel" , cancelText = cancelLabel
, message = confirmMsg , message = confirmMsg
, confirm = confirm , confirm = confirm
, cancel = cancel , cancel = cancel

View File

@ -313,23 +313,28 @@ type alias ViewSettings =
{ showAddButton : Bool { showAddButton : Bool
, classes : String , classes : String
, fieldIcon : CustomField -> Maybe String , fieldIcon : CustomField -> Maybe String
, style : DS.DropdownStyle
, createCustomFieldTitle : String
} }
view2 : DS.DropdownStyle -> ViewSettings -> Model -> Html Msg view2 : ViewSettings -> Model -> Html Msg
view2 ddstyle viewSettings model = view2 viewSettings model =
div [ class viewSettings.classes ] div [ class viewSettings.classes ]
(viewMenuBar2 ddstyle viewSettings model (viewMenuBar2 viewSettings model
:: List.map (viewCustomField2 viewSettings model) (visibleFields model) :: List.map (viewCustomField2 viewSettings model) (visibleFields model)
) )
viewMenuBar2 : DS.DropdownStyle -> ViewSettings -> Model -> Html Msg viewMenuBar2 : ViewSettings -> Model -> Html Msg
viewMenuBar2 ddstyle viewSettings model = viewMenuBar2 viewSettings model =
let let
{ dropdown, selected } = { dropdown, selected } =
model.fieldSelect model.fieldSelect
ddstyle =
viewSettings.style
ddstyleFlex = ddstyleFlex =
{ display = \f -> Maybe.withDefault f.name f.label { display = \f -> Maybe.withDefault f.name f.label
, icon = \_ -> Nothing , icon = \_ -> Nothing
@ -350,7 +355,7 @@ viewMenuBar2 ddstyle viewSettings model =
dropdown dropdown
) )
:: (if viewSettings.showAddButton then :: (if viewSettings.showAddButton then
[ addFieldLink2 "ml-1" model [ addFieldLink2 viewSettings.createCustomFieldTitle "ml-1" model
] ]
else else
@ -377,8 +382,8 @@ viewCustomField2 viewSettings model field =
span [] [] span [] []
addFieldLink2 : String -> Model -> Html Msg addFieldLink2 : String -> String -> Model -> Html Msg
addFieldLink2 classes _ = addFieldLink2 titleStr classes _ =
a a
[ class classes [ class classes
, class S.secondaryButton , class S.secondaryButton
@ -386,7 +391,7 @@ addFieldLink2 classes _ =
-- , class "absolute -right-12 top-0" -- , class "absolute -right-12 top-0"
, href "#" , href "#"
, onClick CreateNewField , onClick CreateNewField
, title "Create a new custom field" , title titleStr
] ]
[ i [ class "fa fa-plus" ] [] [ i [ class "fa fa-plus" ] []
] ]

View File

@ -23,6 +23,7 @@ import Html exposing (..)
import Html.Attributes exposing (..) import Html.Attributes exposing (..)
import Html.Events exposing (onClick) import Html.Events exposing (onClick)
import Markdown import Markdown
import Messages.ItemCardComp exposing (Texts)
import Page exposing (Page(..)) import Page exposing (Page(..))
import Set exposing (Set) import Set exposing (Set)
import Styles as S import Styles as S
@ -135,12 +136,11 @@ update ddm msg model =
--- View
--- View2 --- View2
view2 : ViewConfig -> UiSettings -> Model -> ItemLight -> Html Msg view2 : Texts -> ViewConfig -> UiSettings -> Model -> ItemLight -> Html Msg
view2 cfg settings model item = view2 texts cfg settings model item =
let let
isConfirmed = isConfirmed =
item.state /= "created" item.state /= "created"
@ -200,8 +200,8 @@ view2 cfg settings model item =
[ previewImage2 settings cardAction model item [ previewImage2 settings cardAction model item
] ]
) )
++ [ mainContent2 cardAction cardColor isConfirmed settings cfg item ++ [ mainContent2 texts cardAction cardColor isConfirmed settings cfg item
, metaDataContent2 settings item , metaDataContent2 texts settings item
, notesContent2 settings item , notesContent2 settings item
, fulltextResultsContent2 item , fulltextResultsContent2 item
, previewMenu2 settings model item (currentAttachment model item) , previewMenu2 settings model item (currentAttachment model item)
@ -221,8 +221,8 @@ fulltextResultsContent2 item =
(List.map renderHighlightEntry2 item.highlighting) (List.map renderHighlightEntry2 item.highlighting)
metaDataContent2 : UiSettings -> ItemLight -> Html Msg metaDataContent2 : Texts -> UiSettings -> ItemLight -> Html Msg
metaDataContent2 settings item = metaDataContent2 texts settings item =
let let
fieldHidden f = fieldHidden f =
Data.UiSettings.fieldHidden settings f Data.UiSettings.fieldHidden settings f
@ -234,7 +234,7 @@ metaDataContent2 settings item =
[ ( "hidden", fieldHidden Data.Fields.Folder ) [ ( "hidden", fieldHidden Data.Fields.Folder )
] ]
, class "hover:opacity-60" , class "hover:opacity-60"
, title "Folder" , title texts.folder
] ]
[ Icons.folderIcon2 "mr-2" [ Icons.folderIcon2 "mr-2"
, Comp.LinkTarget.makeFolderLink item , Comp.LinkTarget.makeFolderLink item
@ -273,8 +273,16 @@ notesContent2 settings item =
] ]
mainContent2 : List (Attribute Msg) -> String -> Bool -> UiSettings -> ViewConfig -> ItemLight -> Html Msg mainContent2 :
mainContent2 cardAction cardColor isConfirmed settings _ item = Texts
-> List (Attribute Msg)
-> String
-> Bool
-> UiSettings
-> ViewConfig
-> ItemLight
-> Html Msg
mainContent2 texts cardAction cardColor isConfirmed settings _ item =
let let
dirIcon = dirIcon =
i i

View File

@ -22,6 +22,7 @@ import Data.UiSettings exposing (UiSettings)
import Dict exposing (Dict) import Dict exposing (Dict)
import Html exposing (..) import Html exposing (..)
import Html.Attributes exposing (..) import Html.Attributes exposing (..)
import Messages.ItemCardListComp exposing (Texts)
import Page exposing (Page(..)) import Page exposing (Page(..))
import Styles as S import Styles as S
import Util.ItemDragDrop as DD import Util.ItemDragDrop as DD
@ -148,19 +149,19 @@ type alias ViewConfig =
} }
view2 : ViewConfig -> UiSettings -> Model -> Html Msg view2 : Texts -> ViewConfig -> UiSettings -> Model -> Html Msg
view2 cfg settings model = view2 texts cfg settings model =
div div
[ classList [ classList
[ ( "ds-item-list", True ) [ ( "ds-item-list", True )
, ( "ds-multi-select-mode", isMultiSelectMode cfg ) , ( "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 : Texts -> Model -> ViewConfig -> UiSettings -> ItemLightGroup -> Html Msg
viewGroup2 model cfg settings group = viewGroup2 texts model cfg settings group =
div [ class "ds-item-group" ] div [ class "ds-item-group" ]
[ div [ div
[ class "flex py-0 mt-2 flex flex-row items-center" [ 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" ] , 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 : Texts -> Model -> ViewConfig -> UiSettings -> ItemLight -> Html Msg
viewItem2 model cfg settings item = viewItem2 texts model cfg settings item =
let let
currentClass = currentClass =
if cfg.current == Just item.id then if cfg.current == Just item.id then
@ -207,7 +208,7 @@ viewItem2 model cfg settings item =
|> Maybe.withDefault Comp.ItemCard.init |> Maybe.withDefault Comp.ItemCard.init
cardHtml = cardHtml =
Comp.ItemCard.view2 vvcfg settings cardModel item Comp.ItemCard.view2 texts.itemCard vvcfg settings cardModel item
in in
Html.map (ItemCardMsg item) cardHtml Html.map (ItemCardMsg item) cardHtml

View File

@ -96,10 +96,12 @@ formTabs flags settings model =
Data.UiSettings.fieldVisible settings field Data.UiSettings.fieldVisible settings field
customFieldSettings = customFieldSettings =
Comp.CustomFieldMultiInput.ViewSettings { showAddButton = True
True , classes = ""
"field" , fieldIcon = \f -> Dict.get f.id model.customFieldSavingIcon
(\f -> Dict.get f.id model.customFieldSavingIcon) , style = dds
, createCustomFieldTitle = "Create new custom field"
}
optional fields html = optional fields html =
if if
@ -255,7 +257,6 @@ item visible. This message will disappear then.
[ div [ class "mb-4" ] [ div [ class "mb-4" ]
[ Html.map CustomFieldMsg [ Html.map CustomFieldMsg
(Comp.CustomFieldMultiInput.view2 (Comp.CustomFieldMultiInput.view2
dds
customFieldSettings customFieldSettings
model.customFieldsModel model.customFieldsModel
) )

View File

@ -39,6 +39,7 @@ import Html.Attributes exposing (..)
import Html.Events exposing (onClick, onInput) import Html.Events exposing (onClick, onInput)
import Http import Http
import Markdown import Markdown
import Messages.MultiEditComp exposing (Texts)
import Page exposing (Page(..)) import Page exposing (Page(..))
import Set exposing (Set) import Set exposing (Set)
import Styles as S import Styles as S
@ -601,13 +602,13 @@ defaultViewConfig =
--- View2 --- View2
view2 : Flags -> ViewConfig -> UiSettings -> Model -> Html Msg view2 : Texts -> Flags -> ViewConfig -> UiSettings -> Model -> Html Msg
view2 = view2 =
renderEditForm2 renderEditForm2
renderEditForm2 : Flags -> ViewConfig -> UiSettings -> Model -> Html Msg renderEditForm2 : Texts -> Flags -> ViewConfig -> UiSettings -> Model -> Html Msg
renderEditForm2 flags cfg settings model = renderEditForm2 texts flags cfg settings model =
let let
fieldVisible field = fieldVisible field =
Data.UiSettings.fieldVisible settings field Data.UiSettings.fieldVisible settings field
@ -636,13 +637,13 @@ renderEditForm2 flags cfg settings model =
tagModeMsg = tagModeMsg =
case model.tagEditMode of case model.tagEditMode of
AddTags -> AddTags ->
"Tags chosen here are *added* to all selected items." texts.tagModeAddInfo
RemoveTags -> RemoveTags ->
"Tags chosen here are *removed* from all selected items." texts.tagModeRemoveInfo
ReplaceTags -> ReplaceTags ->
"Tags chosen here *replace* those on selected items." texts.tagModeReplaceInfo
customFieldIcon field = customFieldIcon field =
case cfg.customFieldState field.id of case cfg.customFieldState field.id of
@ -656,10 +657,12 @@ renderEditForm2 flags cfg settings model =
Just "fa fa-sync-alt animate-spin" Just "fa fa-sync-alt animate-spin"
customFieldSettings = customFieldSettings =
Comp.CustomFieldMultiInput.ViewSettings { showAddButton = False
False , classes = "mb-4"
"mb-4" , fieldIcon = customFieldIcon
customFieldIcon , style = dds
, createCustomFieldTitle = ""
}
dds = dds =
Data.DropdownStyle.sidebarStyle Data.DropdownStyle.sidebarStyle
@ -677,7 +680,7 @@ renderEditForm2 flags cfg settings model =
idNameCfg = idNameCfg =
{ makeOption = \e -> { text = e.name, additional = "" } { makeOption = \e -> { text = e.name, additional = "" }
, labelColor = \_ -> \_ -> "" , labelColor = \_ -> \_ -> ""
, placeholder = "Select" , placeholder = texts.selectPlaceholder
, style = dds , style = dds
} }
@ -687,7 +690,7 @@ renderEditForm2 flags cfg settings model =
{ text = Data.Direction.toString entry { text = Data.Direction.toString entry
, additional = "" , additional = ""
} }
, placeholder = "Choose a direction" , placeholder = texts.chooseDirection
, labelColor = \_ -> \_ -> "" , labelColor = \_ -> \_ -> ""
, style = dds , style = dds
} }
@ -697,7 +700,7 @@ renderEditForm2 flags cfg settings model =
tabStyle tabStyle
(tabState settings model) (tabState settings model)
[ { name = tabName TabConfirmUnconfirm [ { name = tabName TabConfirmUnconfirm
, title = "Confirm/Unconfirm item metadata" , title = texts.confirmUnconfirm
, titleRight = [] , titleRight = []
, info = Nothing , info = Nothing
, body = , body =
@ -709,32 +712,32 @@ renderEditForm2 flags cfg settings model =
, class "flex-grow" , class "flex-grow"
, onClick (ConfirmMsg True) , onClick (ConfirmMsg True)
] ]
[ text "Confirm" [ text texts.confirm
] ]
, button , button
[ class S.secondaryButton [ class S.secondaryButton
, class "flex-grow" , class "flex-grow"
, onClick (ConfirmMsg False) , onClick (ConfirmMsg False)
] ]
[ text "Unconfirm" [ text texts.unconfirm
] ]
] ]
] ]
} }
, { name = tabName TabTags , { name = tabName TabTags
, title = "Tags" , title = texts.basics.tags
, titleRight = [] , titleRight = []
, info = Nothing , info = Nothing
, body = , body =
[ div [ class "field" ] [ div [ class "field" ]
[ label [ class S.inputLabel ] [ label [ class S.inputLabel ]
[ Icons.tagsIcon2 "" [ Icons.tagsIcon2 ""
, text "Tags" , text texts.basics.tags
, a , a
[ class "float-right" [ class "float-right"
, class S.link , class S.link
, href "#" , href "#"
, title "Change tag edit mode" , title texts.changeTagMode
, onClick ToggleTagEditMode , onClick ToggleTagEditMode
] ]
[ tagModeIcon [ tagModeIcon
@ -750,7 +753,7 @@ renderEditForm2 flags cfg settings model =
] ]
} }
, { name = tabName TabFolder , { name = tabName TabFolder
, title = "Folder" , title = texts.folderTab
, titleRight = [] , titleRight = []
, info = Nothing , info = Nothing
, body = , body =
@ -761,25 +764,24 @@ renderEditForm2 flags cfg settings model =
, ( "hidden", isFolderMember model ) , ( "hidden", isFolderMember model )
] ]
] ]
[ Markdown.toHtml [] """ [ Markdown.toHtml [] texts.folderNotOwnerWarning
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.
"""
] ]
] ]
} }
, { name = tabName TabCustomFields , { name = tabName TabCustomFields
, title = "Custom Fields" , title = texts.customFieldsTab
, titleRight = [] , titleRight = []
, info = Nothing , info = Nothing
, body = , body =
[ Html.map CustomFieldMsg [ Html.map CustomFieldMsg
(Comp.CustomFieldMultiInput.view2 dds customFieldSettings model.customFieldModel) (Comp.CustomFieldMultiInput.view2
customFieldSettings
model.customFieldModel
)
] ]
} }
, { name = tabName TabDate , { name = tabName TabDate
, title = "Date" , title = texts.dateTab
, titleRight = [] , titleRight = []
, info = Nothing , info = Nothing
, body = , body =
@ -802,7 +804,7 @@ item visible. This message will disappear then.
] ]
} }
, { name = tabName TabDueDate , { name = tabName TabDueDate
, title = "Due Date" , title = texts.dueDateTab
, titleRight = [] , titleRight = []
, info = Nothing , info = Nothing
, body = , body =
@ -825,7 +827,7 @@ item visible. This message will disappear then.
] ]
} }
, { name = tabName TabCorrespondent , { name = tabName TabCorrespondent
, title = "Correspondent" , title = texts.correspondentTab
, titleRight = [] , titleRight = []
, info = Nothing , info = Nothing
, body = , body =
@ -834,25 +836,35 @@ item visible. This message will disappear then.
[ label [ class S.inputLabel ] [ label [ class S.inputLabel ]
[ Icons.organizationIcon2 "" [ Icons.organizationIcon2 ""
, span [ class "ml-2" ] , 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 ] <| , optional [ Data.Fields.CorrPerson ] <|
div [ class "mb-4" ] div [ class "mb-4" ]
[ label [ class S.inputLabel ] [ label [ class S.inputLabel ]
[ Icons.personIcon2 "" [ Icons.personIcon2 ""
, span [ class "ml-2" ] , 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 , { name = tabName TabConcerning
, title = "Concerning" , title = texts.concerningTab
, titleRight = [] , titleRight = []
, info = Nothing , info = Nothing
, body = , body =
@ -861,7 +873,7 @@ item visible. This message will disappear then.
[ label [ class S.inputLabel ] [ label [ class S.inputLabel ]
[ Icons.personIcon2 "" [ Icons.personIcon2 ""
, span [ class "ml-2" ] , span [ class "ml-2" ]
[ text "Person" ] [ text texts.person ]
] ]
, Html.map ConcPersonMsg (Comp.Dropdown.view2 idNameCfg settings model.concPersonModel) , 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 ] [ label [ class S.inputLabel ]
[ Icons.equipmentIcon2 "" [ Icons.equipmentIcon2 ""
, span [ class "ml-2" ] , span [ class "ml-2" ]
[ text "Equipment" ] [ text texts.equipment ]
] ]
, Html.map ConcEquipMsg , Html.map ConcEquipMsg
(Comp.Dropdown.view2 idNameCfg (Comp.Dropdown.view2 idNameCfg
@ -881,7 +893,7 @@ item visible. This message will disappear then.
] ]
} }
, { name = tabName TabDirection , { name = tabName TabDirection
, title = "Direction" , title = texts.directionTab
, titleRight = [] , titleRight = []
, info = Nothing , info = Nothing
, body = , body =
@ -889,7 +901,7 @@ item visible. This message will disappear then.
] ]
} }
, { name = tabName TabName , { name = tabName TabName
, title = "Name" , title = texts.nameTab
, titleRight = [] , titleRight = []
, info = Nothing , info = Nothing
, body = , body =
@ -904,9 +916,15 @@ item visible. This message will disappear then.
, span [ class S.inputLeftIconOnly ] , span [ class S.inputLeftIconOnly ]
[ i [ i
[ classList [ classList
[ ( "text-green-500 fa fa-check", cfg.nameState == SaveSuccess ) [ ( "text-green-500 fa fa-check"
, ( "text-red-500 fa fa-exclamation-triangle", cfg.nameState == SaveFailed ) , cfg.nameState == SaveSuccess
, ( "sync fa fa-circle-notch animate-spin", cfg.nameState == Saving ) )
, ( "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 FTabState.tabState settings
model.openTabs model.openTabs
(Just model.customFieldModel) (Just model.customFieldModel)
(.title >> ToggleAkkordionTab) (.name >> ToggleAkkordionTab)
tab tab

View File

@ -550,6 +550,8 @@ update key flags inav settings msg model =
Comp.ConfirmModal.defaultSettings Comp.ConfirmModal.defaultSettings
DeleteItemConfirmed DeleteItemConfirmed
ItemModalCancelled ItemModalCancelled
"Ok"
"Cancel"
confirmMsg confirmMsg
in in
resultModel { model | itemModal = Just confirm } resultModel { model | itemModal = Just confirm }
@ -923,6 +925,8 @@ update key flags inav settings msg model =
Comp.ConfirmModal.defaultSettings Comp.ConfirmModal.defaultSettings
(DeleteAttachConfirmed id) (DeleteAttachConfirmed id)
AttachModalCancelled AttachModalCancelled
"Ok"
"Cancel"
"Really delete this file?" "Really delete this file?"
model_ = model_ =
@ -1511,6 +1515,8 @@ update key flags inav settings msg model =
Comp.ConfirmModal.defaultSettings Comp.ConfirmModal.defaultSettings
(ReprocessFileConfirmed id) (ReprocessFileConfirmed id)
AttachModalCancelled AttachModalCancelled
"Ok"
"Cancel"
confirmMsg confirmMsg
model_ = model_ =
@ -1546,6 +1552,8 @@ update key flags inav settings msg model =
Comp.ConfirmModal.defaultSettings Comp.ConfirmModal.defaultSettings
ReprocessItemConfirmed ReprocessItemConfirmed
ItemModalCancelled ItemModalCancelled
"Ok"
"Cancel"
confirmMsg confirmMsg
model_ = model_ =

View File

@ -2,6 +2,7 @@ module Comp.PowerSearchInput exposing
( Action(..) ( Action(..)
, Model , Model
, Msg , Msg
, ViewSettings
, init , init
, update , update
, viewInput , viewInput
@ -133,12 +134,18 @@ throttleUpdate model =
--- View --- View
viewInput : List (Attribute Msg) -> Model -> Html Msg type alias ViewSettings =
viewInput attrs model = { placeholder : String
, extraAttrs : List (Attribute Msg)
}
viewInput : ViewSettings -> Model -> Html Msg
viewInput cfg model =
input input
(attrs (cfg.extraAttrs
++ [ type_ "text" ++ [ type_ "text"
, placeholder "Search query " , placeholder cfg.placeholder
, onInput SetSearch , onInput SetSearch
, Util.Html.onKeyUpCode KeyUpMsg , Util.Html.onKeyUpCode KeyUpMsg
, Maybe.map value model.input , Maybe.map value model.input

View File

@ -44,6 +44,7 @@ import Html exposing (..)
import Html.Attributes exposing (..) import Html.Attributes exposing (..)
import Html.Events exposing (onClick, onInput) import Html.Events exposing (onClick, onInput)
import Http import Http
import Messages.SearchMenuComp exposing (Texts)
import Set exposing (Set) import Set exposing (Set)
import Styles as S import Styles as S
import Util.Html exposing (KeyCode(..)) import Util.Html exposing (KeyCode(..))
@ -902,8 +903,7 @@ updateDrop ddm flags settings msg model =
ToggleOpenAllAkkordionTabs -> ToggleOpenAllAkkordionTabs ->
let let
allNames = allNames =
searchTabs (DD.DragDropData ddm Nothing) flags settings model List.map tabName allTabs
|> List.map .title
|> Set.fromList |> Set.fromList
next = next =
@ -924,8 +924,8 @@ updateDrop ddm flags settings msg model =
--- View2 --- View2
viewDrop2 : DD.DragDropData -> Flags -> UiSettings -> Model -> Html Msg viewDrop2 : Texts -> DD.DragDropData -> Flags -> UiSettings -> Model -> Html Msg
viewDrop2 ddd flags settings model = viewDrop2 texts ddd flags settings model =
let let
akkordionStyle = akkordionStyle =
Comp.Tabs.searchMenuStyle Comp.Tabs.searchMenuStyle
@ -933,7 +933,7 @@ viewDrop2 ddd flags settings model =
Comp.Tabs.akkordion Comp.Tabs.akkordion
akkordionStyle akkordionStyle
(searchTabState settings model) (searchTabState settings model)
(searchTabs ddd flags settings model) (searchTabs texts ddd flags settings model)
type SearchTab type SearchTab
@ -950,6 +950,22 @@ type SearchTab
| TabDirection | TabDirection
allTabs : List SearchTab
allTabs =
[ TabInbox
, TabTags
, TabTagCategories
, TabFolder
, TabCorrespondent
, TabConcerning
, TabCustomFields
, TabDate
, TabDueDate
, TabSource
, TabDirection
]
tabName : SearchTab -> String tabName : SearchTab -> String
tabName tab = tabName tab =
case tab of case tab of
@ -1085,8 +1101,8 @@ searchTabState settings model tab =
( state, ToggleAkkordionTab tab.name ) ( state, ToggleAkkordionTab tab.name )
searchTabs : DD.DragDropData -> Flags -> UiSettings -> Model -> List (Comp.Tabs.Tab Msg) searchTabs : Texts -> DD.DragDropData -> Flags -> UiSettings -> Model -> List (Comp.Tabs.Tab Msg)
searchTabs ddd flags settings model = searchTabs texts ddd flags settings model =
let let
isHidden f = isHidden f =
Data.UiSettings.fieldHidden settings f Data.UiSettings.fieldHidden settings f
@ -1100,21 +1116,14 @@ searchTabs ddd flags settings model =
{ text = Data.Direction.toString entry { text = Data.Direction.toString entry
, additional = "" , additional = ""
} }
, placeholder = "Choose a direction" , placeholder = texts.chooseDirection
, labelColor = \_ -> \_ -> "" , labelColor = \_ -> \_ -> ""
, style = DS.sidebarStyle , style = DS.sidebarStyle
} }
corrPersonCfg = personCfg =
{ makeOption = \e -> { text = e.name, additional = "" } { makeOption = \e -> { text = e.name, additional = "" }
, placeholder = "Choose a person" , placeholder = texts.choosePerson
, labelColor = \_ -> \_ -> ""
, style = DS.sidebarStyle
}
concPersonCfg =
{ makeOption = \e -> { text = e.name, additional = "" }
, placeholder = "Choose a person"
, labelColor = \_ -> \_ -> "" , labelColor = \_ -> \_ -> ""
, style = DS.sidebarStyle , style = DS.sidebarStyle
} }
@ -1122,12 +1131,12 @@ searchTabs ddd flags settings model =
concEquipCfg = concEquipCfg =
{ makeOption = \e -> { text = e.name, additional = "" } { makeOption = \e -> { text = e.name, additional = "" }
, labelColor = \_ -> \_ -> "" , labelColor = \_ -> \_ -> ""
, placeholder = "Choose an equipment" , placeholder = texts.chooseEquipment
, style = DS.sidebarStyle , style = DS.sidebarStyle
} }
in in
[ { name = tabName TabInbox [ { name = tabName TabInbox
, title = "Inbox" , title = texts.inbox
, info = Nothing , info = Nothing
, titleRight = [] , titleRight = []
, body = , body =
@ -1135,7 +1144,7 @@ searchTabs ddd flags settings model =
MB.Checkbox MB.Checkbox
{ id = "search-inbox" { id = "search-inbox"
, value = model.inboxCheckbox , value = model.inboxCheckbox
, label = "Inbox" , label = texts.inbox
, tagger = \_ -> ToggleInbox , tagger = \_ -> ToggleInbox
} }
, div [ class "mt-2 hidden" ] , div [ class "mt-2 hidden" ]
@ -1143,10 +1152,10 @@ searchTabs ddd flags settings model =
[ text [ text
(case model.textSearchModel of (case model.textSearchModel of
Fulltext _ -> Fulltext _ ->
"Fulltext Search" texts.fulltextSearch
Names _ -> Names _ ->
"Search in names" texts.searchInNames
) )
, a , a
[ classList [ classList
@ -1156,7 +1165,7 @@ searchTabs ddd flags settings model =
, class S.link , class S.link
, href "#" , href "#"
, onClick SwapTextSearch , onClick SwapTextSearch
, title "Switch between text search modes" , title texts.switchSearchModes
] ]
[ i [ class "fa fa-exchange-alt" ] [] [ i [ class "fa fa-exchange-alt" ] []
] ]
@ -1168,26 +1177,26 @@ searchTabs ddd flags settings model =
, textSearchString model.textSearchModel |> Maybe.withDefault "" |> value , textSearchString model.textSearchModel |> Maybe.withDefault "" |> value
, case model.textSearchModel of , case model.textSearchModel of
Fulltext _ -> Fulltext _ ->
placeholder "Content search" placeholder texts.contentSearch
Names _ -> Names _ ->
placeholder "Search in various names" placeholder texts.searchInNamesPlaceholder
, class S.textInputSidebar , class S.textInputSidebar
] ]
[] []
, span [ class "opacity-50 text-sm" ] , span [ class "opacity-50 text-sm" ]
[ case model.textSearchModel of [ case model.textSearchModel of
Fulltext _ -> Fulltext _ ->
text "Fulltext search in document contents and notes." text texts.fulltextSearchInfo
Names _ -> Names _ ->
text "Looks in correspondents, concerned entities, item name and notes." text texts.nameSearchInfo
] ]
] ]
] ]
} }
, { name = tabName TabTags , { name = tabName TabTags
, title = "Tags" , title = texts.basics.tags
, titleRight = [] , titleRight = []
, info = Nothing , info = Nothing
, body = , body =
@ -1200,7 +1209,7 @@ searchTabs ddd flags settings model =
) )
} }
, { name = tabName TabTagCategories , { name = tabName TabTagCategories
, title = "Tag Categories" , title = texts.tagCategoryTab
, titleRight = [] , titleRight = []
, info = Nothing , info = Nothing
, body = , body =
@ -1213,7 +1222,7 @@ searchTabs ddd flags settings model =
] ]
} }
, { name = tabName TabFolder , { name = tabName TabFolder
, title = "Folder" , title = texts.folderTab
, titleRight = [] , titleRight = []
, info = Nothing , info = Nothing
, body = , body =
@ -1225,7 +1234,7 @@ searchTabs ddd flags settings model =
] ]
} }
, { name = tabName TabCorrespondent , { name = tabName TabCorrespondent
, title = "Correspondent" , title = texts.correspondentTab
, titleRight = [] , titleRight = []
, info = Nothing , info = Nothing
, body = , body =
@ -1234,10 +1243,10 @@ searchTabs ddd flags settings model =
, classList [ ( "hidden", isHidden Data.Fields.CorrOrg ) ] , classList [ ( "hidden", isHidden Data.Fields.CorrOrg ) ]
] ]
[ label [ class S.inputLabel ] [ label [ class S.inputLabel ]
[ text "Organization" ] [ text texts.organization ]
, Html.map OrgMsg , Html.map OrgMsg
(Comp.Dropdown.view2 (Comp.Dropdown.view2
(Comp.Dropdown.orgFormViewSettings "Choose an organization" DS.sidebarStyle) (Comp.Dropdown.orgFormViewSettings texts.chooseOrganization DS.sidebarStyle)
settings settings
model.orgModel model.orgModel
) )
@ -1246,10 +1255,10 @@ searchTabs ddd flags settings model =
[ class "mb-4" [ class "mb-4"
, classList [ ( "hidden", isHidden Data.Fields.CorrPerson ) ] , classList [ ( "hidden", isHidden Data.Fields.CorrPerson ) ]
] ]
[ label [ class S.inputLabel ] [ text "Person" ] [ label [ class S.inputLabel ] [ text texts.person ]
, Html.map CorrPersonMsg , Html.map CorrPersonMsg
(Comp.Dropdown.view2 (Comp.Dropdown.view2
corrPersonCfg personCfg
settings settings
model.corrPersonModel model.corrPersonModel
) )
@ -1257,7 +1266,7 @@ searchTabs ddd flags settings model =
] ]
} }
, { name = tabName TabConcerning , { name = tabName TabConcerning
, title = "Concerning" , title = texts.concerningTab
, titleRight = [] , titleRight = []
, info = Nothing , info = Nothing
, body = , body =
@ -1265,10 +1274,10 @@ searchTabs ddd flags settings model =
[ class "mb-4" [ class "mb-4"
, classList [ ( "hidden", isHidden Data.Fields.ConcPerson ) ] , classList [ ( "hidden", isHidden Data.Fields.ConcPerson ) ]
] ]
[ label [ class S.inputLabel ] [ text "Person" ] [ label [ class S.inputLabel ] [ text texts.person ]
, Html.map ConcPersonMsg , Html.map ConcPersonMsg
(Comp.Dropdown.view2 (Comp.Dropdown.view2
concPersonCfg personCfg
settings settings
model.concPersonModel model.concPersonModel
) )
@ -1277,7 +1286,7 @@ searchTabs ddd flags settings model =
[ class "mb-4" [ class "mb-4"
, classList [ ( "hidden", isHidden Data.Fields.ConcEquip ) ] , classList [ ( "hidden", isHidden Data.Fields.ConcEquip ) ]
] ]
[ label [ class S.inputLabel ] [ text "Equipment" ] [ label [ class S.inputLabel ] [ text texts.equipment ]
, Html.map ConcEquipmentMsg , Html.map ConcEquipmentMsg
(Comp.Dropdown.view2 (Comp.Dropdown.view2
concEquipCfg concEquipCfg
@ -1288,20 +1297,24 @@ searchTabs ddd flags settings model =
] ]
} }
, { name = tabName TabCustomFields , { name = tabName TabCustomFields
, title = "Custom Fields" , title = texts.customFieldsTab
, titleRight = [] , titleRight = []
, info = Nothing , info = Nothing
, body = , body =
[ Html.map CustomFieldMsg [ Html.map CustomFieldMsg
(Comp.CustomFieldMultiInput.view2 (Comp.CustomFieldMultiInput.view2
DS.sidebarStyle { showAddButton = False
(Comp.CustomFieldMultiInput.ViewSettings False "field" (\_ -> Nothing)) , classes = ""
, fieldIcon = \_ -> Nothing
, style = DS.sidebarStyle
, createCustomFieldTitle = texts.createCustomFieldTitle
}
model.customFieldModel model.customFieldModel
) )
] ]
} }
, { name = tabName TabDate , { name = tabName TabDate
, title = "Date" , title = texts.dateTab
, titleRight = [] , titleRight = []
, info = Nothing , info = Nothing
, body = , body =
@ -1309,7 +1322,7 @@ searchTabs ddd flags settings model =
[ class "flex flex-col" ] [ class "flex flex-col" ]
[ div [ class "mb-2" ] [ div [ class "mb-2" ]
[ label [ class S.inputLabel ] [ label [ class S.inputLabel ]
[ text "From" [ text texts.from
] ]
, div [ class "relative" ] , div [ class "relative" ]
[ Html.map FromDateMsg [ Html.map FromDateMsg
@ -1326,7 +1339,7 @@ searchTabs ddd flags settings model =
] ]
, div [ class "mb-2" ] , div [ class "mb-2" ]
[ label [ class S.inputLabel ] [ label [ class S.inputLabel ]
[ text "To" [ text texts.to
] ]
, div [ class "relative" ] , div [ class "relative" ]
[ Html.map UntilDateMsg [ Html.map UntilDateMsg
@ -1341,7 +1354,7 @@ searchTabs ddd flags settings model =
] ]
} }
, { name = tabName TabDueDate , { name = tabName TabDueDate
, title = "Due Date" , title = texts.dueDateTab
, titleRight = [] , titleRight = []
, info = Nothing , info = Nothing
, body = , body =
@ -1349,7 +1362,7 @@ searchTabs ddd flags settings model =
[ class "flex flex-col" ] [ class "flex flex-col" ]
[ div [ class "mb-2" ] [ div [ class "mb-2" ]
[ label [ class S.inputLabel ] [ label [ class S.inputLabel ]
[ text "Due From" [ text texts.dueFrom
] ]
, div [ class "relative" ] , div [ class "relative" ]
[ Html.map FromDueDateMsg [ Html.map FromDueDateMsg
@ -1366,7 +1379,7 @@ searchTabs ddd flags settings model =
] ]
, div [ class "mb-2" ] , div [ class "mb-2" ]
[ label [ class S.inputLabel ] [ label [ class S.inputLabel ]
[ text "Due To" [ text texts.dueTo
] ]
, div [ class "relative" ] , div [ class "relative" ]
[ Html.map UntilDueDateMsg [ Html.map UntilDueDateMsg
@ -1385,7 +1398,7 @@ searchTabs ddd flags settings model =
] ]
} }
, { name = tabName TabSource , { name = tabName TabSource
, title = "Source" , title = texts.sourceTab
, titleRight = [] , titleRight = []
, info = Nothing , info = Nothing
, body = , body =
@ -1395,7 +1408,7 @@ searchTabs ddd flags settings model =
, onInput SetSource , onInput SetSource
, Util.Html.onKeyUpCode KeyUpMsg , Util.Html.onKeyUpCode KeyUpMsg
, model.sourceModel |> Maybe.withDefault "" |> value , model.sourceModel |> Maybe.withDefault "" |> value
, placeholder "Search in item source" , placeholder texts.searchInItemSource
, class S.textInputSidebar , class S.textInputSidebar
] ]
[] []
@ -1403,7 +1416,7 @@ searchTabs ddd flags settings model =
] ]
} }
, { name = tabName TabDirection , { name = tabName TabDirection
, title = "Direction" , title = texts.directionTab
, titleRight = [] , titleRight = []
, info = Nothing , info = Nothing
, body = , body =

View File

@ -11,6 +11,7 @@ import Data.Icons as Icons
import Data.Money import Data.Money
import Html exposing (..) import Html exposing (..)
import Html.Attributes exposing (..) import Html.Attributes exposing (..)
import Messages.SearchStatsViewComp exposing (Texts)
import Styles as S import Styles as S
@ -28,8 +29,8 @@ sortFields fields =
--- View2 --- View2
view2 : String -> SearchStats -> Html msg view2 : Texts -> String -> SearchStats -> Html msg
view2 classes stats = view2 texts classes stats =
let let
isNumField f = isNumField f =
f.sum > 0 f.sum > 0
@ -75,7 +76,7 @@ view2 classes stats =
{ rootClass = "" { rootClass = ""
, valueClass = "text-4xl" , valueClass = "text-4xl"
, value = String.fromInt stats.count , value = String.fromInt stats.count
, label = "Items" , label = texts.items
} }
] ]
, div [ class "flex-grow" ] , div [ class "flex-grow" ]
@ -87,15 +88,15 @@ view2 classes stats =
[ tr [ class "" ] [ tr [ class "" ]
[ th [ class "py-2 text-left" ] [] [ th [ class "py-2 text-left" ] []
, th [ class "py-2 text-center" ] , th [ class "py-2 text-center" ]
[ text "Count" ] [ text texts.count ]
, th [ class "py-2 text-center" ] , th [ class "py-2 text-center" ]
[ text "Sum" ] [ text texts.sum ]
, th [ class "py-2 text-center hidden md:table-cell" ] , 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" ] , 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" ] , th [ class "py-2 text-center hidden md:table-cell" ]
[ text "Max" ] [ text texts.max ]
] ]
] ]
, tbody [] , tbody []

View File

@ -7,6 +7,7 @@ module Messages exposing
import Messages.App import Messages.App
import Messages.CollectiveSettingsPage import Messages.CollectiveSettingsPage
import Messages.HomePage
import Messages.ItemDetailPage import Messages.ItemDetailPage
import Messages.LoginPage import Messages.LoginPage
import Messages.ManageDataPage import Messages.ManageDataPage
@ -35,6 +36,7 @@ type alias Messages =
, queue : Messages.QueuePage.Texts , queue : Messages.QueuePage.Texts
, userSettings : Messages.UserSettingsPage.Texts , userSettings : Messages.UserSettingsPage.Texts
, manageData : Messages.ManageDataPage.Texts , manageData : Messages.ManageDataPage.Texts
, home : Messages.HomePage.Texts
} }
@ -97,6 +99,7 @@ gb =
, queue = Messages.QueuePage.gb , queue = Messages.QueuePage.gb
, userSettings = Messages.UserSettingsPage.gb , userSettings = Messages.UserSettingsPage.gb
, manageData = Messages.ManageDataPage.gb , manageData = Messages.ManageDataPage.gb
, home = Messages.HomePage.gb
} }
@ -116,4 +119,5 @@ de =
, queue = Messages.QueuePage.de , queue = Messages.QueuePage.de
, userSettings = Messages.UserSettingsPage.de , userSettings = Messages.UserSettingsPage.de
, manageData = Messages.ManageDataPage.de , manageData = Messages.ManageDataPage.de
, home = Messages.HomePage.de
} }

View File

@ -16,6 +16,9 @@ type alias Texts =
, backToList : String , backToList : String
, searchPlaceholder : String , searchPlaceholder : String
, id : String , id : String
, ok : String
, yes : String
, no : String
} }
@ -35,6 +38,9 @@ gb =
, backToList = "Back to list" , backToList = "Back to list"
, searchPlaceholder = "Search" , searchPlaceholder = "Search"
, id = "Id" , id = "Id"
, ok = "Ok"
, yes = "Yes"
, no = "No"
} }

View File

@ -0,0 +1,58 @@
module Messages.HomePage exposing (..)
import Messages.Basics
import Messages.HomeSideMenu
import Messages.ItemCardListComp
import Messages.SearchStatsViewComp
type alias Texts =
{ basics : Messages.Basics.Texts
, sideMenu : Messages.HomeSideMenu.Texts
, itemCardList : Messages.ItemCardListComp.Texts
, searchStatsView : Messages.SearchStatsViewComp.Texts
, contentSearch : String
, searchInNames : String
, selectModeTitle : String
, fullHeightPreviewTitle : String
, fullWidthPreviewTitle : String
, powerSearchPlaceholder : String
, reallyReprocessQuestion : String
, reallyDeleteQuestion : String
, editSelectedItems : Int -> String
, reprocessSelectedItems : Int -> String
, deleteSelectedItems : Int -> String
, selectAllVisible : String
, selectNone : String
, resetSearchForm : String
, exitSelectMode : String
}
gb : Texts
gb =
{ basics = Messages.Basics.gb
, sideMenu = Messages.HomeSideMenu.gb
, itemCardList = Messages.ItemCardListComp.gb
, searchStatsView = Messages.SearchStatsViewComp.gb
, contentSearch = "Content search"
, searchInNames = "Search in names"
, selectModeTitle = "Select Mode"
, fullHeightPreviewTitle = "Full height preview"
, fullWidthPreviewTitle = "Full width preview"
, powerSearchPlaceholder = "Search query "
, reallyReprocessQuestion = "Really reprocess all selected items? Metadata of unconfirmed items may change."
, reallyDeleteQuestion = "Really delete all selected items?"
, editSelectedItems = \n -> "Edit " ++ String.fromInt n ++ " selected items"
, reprocessSelectedItems = \n -> "Reprocess " ++ String.fromInt n ++ " selected items"
, deleteSelectedItems = \n -> "Delete " ++ String.fromInt n ++ " selected items"
, selectAllVisible = "Select all visible"
, selectNone = "Select none"
, resetSearchForm = "Reset search form"
, exitSelectMode = "Exit Select Mode"
}
de : Texts
de =
gb

View File

@ -0,0 +1,27 @@
module Messages.HomeSideMenu exposing (..)
import Messages.MultiEditComp
import Messages.SearchMenuComp
type alias Texts =
{ searchMenu : Messages.SearchMenuComp.Texts
, multiEdit : Messages.MultiEditComp.Texts
, editMode : String
, resetSearchForm : String
, multiEditHeader : String
, multiEditInfo : String
, close : String
}
gb : Texts
gb =
{ searchMenu = Messages.SearchMenuComp.gb
, multiEdit = Messages.MultiEditComp.gb
, editMode = "Edit Mode"
, resetSearchForm = "Reset search form"
, multiEditHeader = "Multi-Edit"
, multiEditInfo = "Note that a change here immediatly affects all selected items on the right!"
, close = "Close"
}

View File

@ -0,0 +1,12 @@
module Messages.ItemCardComp exposing (..)
type alias Texts =
{ folder : String
}
gb : Texts
gb =
{ folder = "Folder"
}

View File

@ -0,0 +1,14 @@
module Messages.ItemCardListComp exposing (..)
import Messages.ItemCardComp
type alias Texts =
{ itemCard : Messages.ItemCardComp.Texts
}
gb : Texts
gb =
{ itemCard = Messages.ItemCardComp.gb
}

View File

@ -0,0 +1,61 @@
module Messages.MultiEditComp exposing (..)
import Messages.Basics
type alias Texts =
{ basics : Messages.Basics.Texts
, tagModeAddInfo : String
, tagModeRemoveInfo : String
, tagModeReplaceInfo : String
, selectPlaceholder : String
, chooseDirection : String
, confirmUnconfirm : String
, confirm : String
, unconfirm : String
, changeTagMode : String
, folderTab : String
, folderNotOwnerWarning : String
, customFieldsTab : String
, dateTab : String
, dueDateTab : String
, correspondentTab : String
, organization : String
, person : String
, concerningTab : String
, equipment : String
, directionTab : String
, nameTab : String
}
gb : Texts
gb =
{ basics = Messages.Basics.gb
, tagModeAddInfo = "Tags chosen here are *added* to all selected items."
, tagModeRemoveInfo = "Tags chosen here are *removed* from all selected items."
, tagModeReplaceInfo = "Tags chosen here *replace* those on selected items."
, selectPlaceholder = "Select"
, chooseDirection = "Choose a direction"
, confirmUnconfirm = "Confirm/Unconfirm item metadata"
, confirm = "Confirm"
, unconfirm = "Unconfirm"
, changeTagMode = "Change tag edit mode"
, folderTab = "Folder"
, folderNotOwnerWarning =
"""
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.
"""
, customFieldsTab = "Custom Fields"
, dateTab = "Date"
, dueDateTab = "Due Date"
, correspondentTab = "Correspondent"
, organization = "Organization"
, person = "Person"
, concerningTab = "Concerning"
, equipment = "Equipment"
, directionTab = "Direction"
, nameTab = "Name"
}

View File

@ -0,0 +1,74 @@
module Messages.SearchMenuComp exposing (..)
import Messages.Basics
type alias Texts =
{ basics : Messages.Basics.Texts
, chooseDirection : String
, choosePerson : String
, chooseEquipment : String
, inbox : String
, fulltextSearch : String
, searchInNames : String
, switchSearchModes : String
, contentSearch : String
, searchInNamesPlaceholder : String
, fulltextSearchInfo : String
, nameSearchInfo : String
, tagCategoryTab : String
, folderTab : String
, correspondentTab : String
, organization : String
, chooseOrganization : String
, person : String
, concerningTab : String
, equipment : String
, customFieldsTab : String
, createCustomFieldTitle : String
, dateTab : String
, from : String
, to : String
, dueDateTab : String
, dueFrom : String
, dueTo : String
, sourceTab : String
, searchInItemSource : String
, directionTab : String
}
gb : Texts
gb =
{ basics = Messages.Basics.gb
, chooseDirection = "Choose a direction"
, choosePerson = "Choose a person"
, chooseEquipment = "Choose an equipment"
, inbox = "Inbox"
, fulltextSearch = "Fulltext Search"
, searchInNames = "Search in names"
, switchSearchModes = "Switch between text search modes"
, contentSearch = "Content search"
, searchInNamesPlaceholder = "Search in various names"
, fulltextSearchInfo = "Fulltext search in document contents and notes."
, nameSearchInfo = "Looks in correspondents, concerned entities, item name and notes."
, tagCategoryTab = "Tag Categories"
, folderTab = "Folder"
, correspondentTab = "Correspondent"
, organization = "Organization"
, chooseOrganization = "Choose an organization"
, person = "Person"
, concerningTab = "Concerning"
, equipment = "Equipment"
, customFieldsTab = "Custom Fields"
, createCustomFieldTitle = "Create a new custom field"
, dateTab = "Date"
, from = "From"
, to = "To"
, dueDateTab = "Due Date"
, dueFrom = "Due From"
, dueTo = "Due To"
, sourceTab = "Source"
, searchInItemSource = "Search in item source"
, directionTab = "Direction"
}

View File

@ -0,0 +1,22 @@
module Messages.SearchStatsViewComp exposing (..)
type alias Texts =
{ items : String
, count : String
, sum : String
, avg : String
, min : String
, max : String
}
gb : Texts
gb =
{ items = "Items"
, count = "Count"
, sum = "Sum"
, avg = "Avg"
, min = "Min"
, max = "Max"
}

View File

@ -1,5 +1,6 @@
module Page.Home.Data exposing module Page.Home.Data exposing
( Model ( ConfirmModalValue(..)
, Model
, Msg(..) , Msg(..)
, SearchParam , SearchParam
, SearchType(..) , SearchType(..)
@ -21,7 +22,6 @@ import Api.Model.BasicResult exposing (BasicResult)
import Api.Model.ItemLightList exposing (ItemLightList) import Api.Model.ItemLightList exposing (ItemLightList)
import Api.Model.SearchStats exposing (SearchStats) import Api.Model.SearchStats exposing (SearchStats)
import Browser.Dom as Dom import Browser.Dom as Dom
import Comp.ConfirmModal
import Comp.ItemCardList import Comp.ItemCardList
import Comp.ItemDetail.FormChange exposing (FormChange) import Comp.ItemDetail.FormChange exposing (FormChange)
import Comp.ItemDetail.MultiEditMenu exposing (SaveNameState(..)) import Comp.ItemDetail.MultiEditMenu exposing (SaveNameState(..))
@ -58,10 +58,15 @@ type alias Model =
} }
type ConfirmModalValue
= ConfirmReprocessItems
| ConfirmDelete
type alias SelectViewModel = type alias SelectViewModel =
{ ids : Set String { ids : Set String
, action : SelectActionMode , action : SelectActionMode
, confirmModal : Maybe (Comp.ConfirmModal.Settings Msg) , confirmModal : Maybe ConfirmModalValue
, editModel : Comp.ItemDetail.MultiEditMenu.Model , editModel : Comp.ItemDetail.MultiEditMenu.Model
, saveNameState : SaveNameState , saveNameState : SaveNameState
, saveCustomFieldState : Set String , saveCustomFieldState : Set String

View File

@ -9,13 +9,14 @@ import Data.UiSettings exposing (UiSettings)
import Html exposing (..) import Html exposing (..)
import Html.Attributes exposing (..) import Html.Attributes exposing (..)
import Html.Events exposing (onClick) import Html.Events exposing (onClick)
import Messages.HomeSideMenu exposing (Texts)
import Page.Home.Data exposing (..) import Page.Home.Data exposing (..)
import Set import Set
import Styles as S import Styles as S
view : Flags -> UiSettings -> Model -> Html Msg view : Texts -> Flags -> UiSettings -> Model -> Html Msg
view flags settings model = view texts flags settings model =
div div
[ class "flex flex-col" [ class "flex flex-col"
] ]
@ -25,7 +26,7 @@ view flags settings model =
{ tagger = ToggleSelectView { tagger = ToggleSelectView
, label = "" , label = ""
, icon = Just "fa fa-tasks" , icon = Just "fa fa-tasks"
, title = "Edit Mode" , title = texts.editMode
, inputClass = , inputClass =
[ ( S.secondaryBasicButton, True ) [ ( S.secondaryBasicButton, True )
, ( "bg-gray-200 dark:bg-bluegray-600", selectActive model ) , ( "bg-gray-200 dark:bg-bluegray-600", selectActive model )
@ -35,7 +36,7 @@ view flags settings model =
{ tagger = ResetSearch { tagger = ResetSearch
, label = "" , label = ""
, icon = Just "fa fa-sync" , icon = Just "fa fa-sync"
, title = "Reset search form" , title = texts.resetSearchForm
, inputClass = [ ( S.secondaryBasicButton, True ) ] , inputClass = [ ( S.secondaryBasicButton, True ) ]
} }
] ]
@ -47,19 +48,19 @@ view flags settings model =
SelectView svm -> SelectView svm ->
case svm.action of case svm.action of
EditSelected -> EditSelected ->
viewEditMenu flags svm settings viewEditMenu texts flags svm settings
_ -> _ ->
viewSearch flags settings model viewSearch texts flags settings model
_ -> _ ->
viewSearch flags settings model viewSearch texts flags settings model
) )
] ]
viewSearch : Flags -> UiSettings -> Model -> List (Html Msg) viewSearch : Texts -> Flags -> UiSettings -> Model -> List (Html Msg)
viewSearch flags settings model = viewSearch texts flags settings model =
[ MB.viewSide [ MB.viewSide
{ start = { start =
[ MB.CustomElement <| [ MB.CustomElement <|
@ -75,7 +76,8 @@ viewSearch flags settings model =
, rootClasses = "my-1 text-xs hidden sm:flex" , rootClasses = "my-1 text-xs hidden sm:flex"
} }
, Html.map SearchMenuMsg , Html.map SearchMenuMsg
(Comp.SearchMenu.viewDrop2 model.dragDropData (Comp.SearchMenu.viewDrop2 texts.searchMenu
model.dragDropData
flags flags
settings settings
model.searchMenuModel model.searchMenuModel
@ -83,8 +85,8 @@ viewSearch flags settings model =
] ]
viewEditMenu : Flags -> SelectViewModel -> UiSettings -> List (Html Msg) viewEditMenu : Texts -> Flags -> SelectViewModel -> UiSettings -> List (Html Msg)
viewEditMenu flags svm settings = viewEditMenu texts flags svm settings =
let let
cfg_ = cfg_ =
Comp.ItemDetail.MultiEditMenu.defaultViewConfig Comp.ItemDetail.MultiEditMenu.defaultViewConfig
@ -104,17 +106,17 @@ viewEditMenu flags svm settings =
[ div [ class S.header2 ] [ div [ class S.header2 ]
[ i [ class "fa fa-edit" ] [] [ i [ class "fa fa-edit" ] []
, span [ class "ml-2" ] , span [ class "ml-2" ]
[ text "Multi-Edit" [ text texts.multiEditHeader
] ]
] ]
, div [ class S.infoMessage ] , div [ class S.infoMessage ]
[ text "Note that a change here immediatly affects all selected items on the right!" [ text texts.multiEditInfo
] ]
, MB.viewSide , MB.viewSide
{ start = { start =
[ MB.CustomElement <| [ MB.CustomElement <|
B.secondaryButton B.secondaryButton
{ label = "Close" { label = texts.close
, disabled = False , disabled = False
, icon = "fa fa-times" , icon = "fa fa-times"
, handler = onClick ToggleSelectView , handler = onClick ToggleSelectView
@ -127,5 +129,11 @@ viewEditMenu flags svm settings =
, rootClasses = "mt-2 text-sm" , rootClasses = "mt-2 text-sm"
} }
, Html.map EditMenuMsg , Html.map EditMenuMsg
(Comp.ItemDetail.MultiEditMenu.view2 flags cfg settings svm.editModel) (Comp.ItemDetail.MultiEditMenu.view2
texts.multiEdit
flags
cfg
settings
svm.editModel
)
] ]

View File

@ -3,8 +3,6 @@ module Page.Home.Update exposing (update)
import Api import Api
import Api.Model.ItemLightList exposing (ItemLightList) import Api.Model.ItemLightList exposing (ItemLightList)
import Browser.Navigation as Nav import Browser.Navigation as Nav
import Comp.ConfirmModal
import Comp.FixedDropdown
import Comp.ItemCardList import Comp.ItemCardList
import Comp.ItemDetail.FormChange exposing (FormChange(..)) import Comp.ItemDetail.FormChange exposing (FormChange(..))
import Comp.ItemDetail.MultiEditMenu exposing (SaveNameState(..)) import Comp.ItemDetail.MultiEditMenu exposing (SaveNameState(..))
@ -27,7 +25,6 @@ import Throttle
import Time import Time
import Util.Html exposing (KeyCode(..)) import Util.Html exposing (KeyCode(..))
import Util.ItemDragDrop as DD import Util.ItemDragDrop as DD
import Util.Maybe
import Util.Update import Util.Update
@ -378,19 +375,13 @@ update mId key flags settings msg model =
else else
let let
lmsg =
Comp.ConfirmModal.defaultSettings
ReprocessSelectedConfirmed
CloseConfirmModal
"Really reprocess all selected items? Metadata of unconfirmed items may change."
model_ = model_ =
{ model { model
| viewMode = | viewMode =
SelectView SelectView
{ svm { svm
| action = ReprocessSelected | action = ReprocessSelected
, confirmModal = Just lmsg , confirmModal = Just ConfirmReprocessItems
} }
} }
in in
@ -446,19 +437,13 @@ update mId key flags settings msg model =
else else
let let
lmsg =
Comp.ConfirmModal.defaultSettings
DeleteSelectedConfirmed
CloseConfirmModal
"Really delete all selected items?"
model_ = model_ =
{ model { model
| viewMode = | viewMode =
SelectView SelectView
{ svm { svm
| action = DeleteSelected | action = DeleteSelected
, confirmModal = Just lmsg , confirmModal = Just ConfirmDelete
} }
} }
in in

View File

@ -13,6 +13,7 @@ import Data.UiSettings exposing (UiSettings)
import Html exposing (..) import Html exposing (..)
import Html.Attributes exposing (..) import Html.Attributes exposing (..)
import Html.Events exposing (onClick, onInput) import Html.Events exposing (onClick, onInput)
import Messages.HomePage exposing (Texts)
import Page exposing (Page(..)) import Page exposing (Page(..))
import Page.Home.Data exposing (..) import Page.Home.Data exposing (..)
import Page.Home.SideMenu import Page.Home.SideMenu
@ -21,28 +22,28 @@ import Styles as S
import Util.Html import Util.Html
viewSidebar : Bool -> Flags -> UiSettings -> Model -> Html Msg viewSidebar : Texts -> Bool -> Flags -> UiSettings -> Model -> Html Msg
viewSidebar visible flags settings model = viewSidebar texts visible flags settings model =
div div
[ id "sidebar" [ id "sidebar"
, class S.sidebar , class S.sidebar
, class S.sidebarBg , class S.sidebarBg
, classList [ ( "hidden", not visible ) ] , classList [ ( "hidden", not visible ) ]
] ]
[ Page.Home.SideMenu.view flags settings model [ Page.Home.SideMenu.view texts.sideMenu flags settings model
] ]
viewContent : Flags -> UiSettings -> Model -> Html Msg viewContent : Texts -> Flags -> UiSettings -> Model -> Html Msg
viewContent flags settings model = viewContent texts flags settings model =
div div
[ id "item-card-list" -- this id is used in scroll-to-card [ id "item-card-list" -- this id is used in scroll-to-card
, class S.content , class S.content
] ]
(searchStats flags settings model (searchStats texts flags settings model
++ itemsBar flags settings model ++ itemsBar texts flags settings model
++ itemCardList flags settings model ++ itemCardList texts flags settings model
++ deleteSelectedDimmer model ++ confirmModal texts model
) )
@ -50,13 +51,32 @@ viewContent flags settings model =
--- Helpers --- Helpers
deleteSelectedDimmer : Model -> List (Html Msg) confirmModal : Texts -> Model -> List (Html Msg)
deleteSelectedDimmer model = confirmModal texts model =
let
settings modalValue =
case modalValue of
ConfirmReprocessItems ->
Comp.ConfirmModal.defaultSettings
ReprocessSelectedConfirmed
CloseConfirmModal
texts.basics.yes
texts.basics.no
texts.reallyReprocessQuestion
ConfirmDelete ->
Comp.ConfirmModal.defaultSettings
DeleteSelectedConfirmed
CloseConfirmModal
texts.basics.yes
texts.basics.no
texts.reallyDeleteQuestion
in
case model.viewMode of case model.viewMode of
SelectView svm -> SelectView svm ->
case svm.confirmModal of case svm.confirmModal of
Just confirm -> Just confirm ->
[ Comp.ConfirmModal.view confirm [ Comp.ConfirmModal.view (settings confirm)
] ]
Nothing -> Nothing ->
@ -66,21 +86,21 @@ deleteSelectedDimmer model =
[] []
itemsBar : Flags -> UiSettings -> Model -> List (Html Msg) itemsBar : Texts -> Flags -> UiSettings -> Model -> List (Html Msg)
itemsBar flags settings model = itemsBar texts flags settings model =
case model.viewMode of case model.viewMode of
SimpleView -> SimpleView ->
[ defaultMenuBar flags settings model ] [ defaultMenuBar texts flags settings model ]
SearchView -> SearchView ->
[ defaultMenuBar flags settings model ] [ defaultMenuBar texts flags settings model ]
SelectView svm -> SelectView svm ->
[ editMenuBar model svm ] [ editMenuBar texts model svm ]
defaultMenuBar : Flags -> UiSettings -> Model -> Html Msg defaultMenuBar : Texts -> Flags -> UiSettings -> Model -> Html Msg
defaultMenuBar _ settings model = defaultMenuBar texts _ settings model =
let let
btnStyle = btnStyle =
S.secondaryBasicButton ++ " text-sm" S.secondaryBasicButton ++ " text-sm"
@ -97,10 +117,10 @@ defaultMenuBar _ settings model =
, placeholder , placeholder
(case model.searchTypeDropdownValue of (case model.searchTypeDropdownValue of
ContentOnlySearch -> ContentOnlySearch ->
"Content search" texts.contentSearch
BasicSearch -> BasicSearch ->
"Search in names" texts.searchInNames
) )
, onInput SetBasicSearch , onInput SetBasicSearch
, Util.Html.onKeyUpCode KeyUpSearchbarMsg , Util.Html.onKeyUpCode KeyUpSearchbarMsg
@ -124,7 +144,10 @@ defaultMenuBar _ settings model =
div div
[ class "relative flex flex-grow flex-row" ] [ class "relative flex flex-grow flex-row" ]
[ Html.map PowerSearchMsg [ Html.map PowerSearchMsg
(Comp.PowerSearchInput.viewInput [] (Comp.PowerSearchInput.viewInput
{ placeholder = texts.powerSearchPlaceholder
, extraAttrs = []
}
model.powerSearchInput model.powerSearchInput
) )
, Html.map PowerSearchMsg , Html.map PowerSearchMsg
@ -150,7 +173,7 @@ defaultMenuBar _ settings model =
{ tagger = ToggleSelectView { tagger = ToggleSelectView
, label = "" , label = ""
, icon = Just "fa fa-tasks" , icon = Just "fa fa-tasks"
, title = "Select Mode" , title = texts.selectModeTitle
, inputClass = , inputClass =
[ ( btnStyle, True ) [ ( btnStyle, True )
, ( "bg-gray-200 dark:bg-bluegray-600", selectActive model ) , ( "bg-gray-200 dark:bg-bluegray-600", selectActive model )
@ -170,10 +193,10 @@ defaultMenuBar _ settings model =
, icon = Just "fa fa-expand" , icon = Just "fa fa-expand"
, title = , title =
if settings.cardPreviewFullWidth then if settings.cardPreviewFullWidth then
"Full height preview" texts.fullHeightPreviewTitle
else else
"Full width preview" texts.fullHeightPreviewTitle
, inputClass = , inputClass =
[ ( btnStyle, True ) [ ( btnStyle, True )
, ( "hidden sm:inline-block", False ) , ( "hidden sm:inline-block", False )
@ -185,11 +208,11 @@ defaultMenuBar _ settings model =
} }
editMenuBar : Model -> SelectViewModel -> Html Msg editMenuBar : Texts -> Model -> SelectViewModel -> Html Msg
editMenuBar model svm = editMenuBar texts model svm =
let let
selectCount = selectCount =
Set.size svm.ids |> String.fromInt Set.size svm.ids
btnStyle = btnStyle =
S.secondaryBasicButton ++ " text-sm" S.secondaryBasicButton ++ " text-sm"
@ -200,7 +223,7 @@ editMenuBar model svm =
{ tagger = EditSelectedItems { tagger = EditSelectedItems
, label = "" , label = ""
, icon = Just "fa fa-edit" , icon = Just "fa fa-edit"
, title = "Edit " ++ selectCount ++ " selected items" , title = texts.editSelectedItems selectCount
, inputClass = , inputClass =
[ ( btnStyle, True ) [ ( btnStyle, True )
, ( "bg-gray-200 dark:bg-bluegray-600", svm.action == EditSelected ) , ( "bg-gray-200 dark:bg-bluegray-600", svm.action == EditSelected )
@ -210,7 +233,7 @@ editMenuBar model svm =
{ tagger = RequestReprocessSelected { tagger = RequestReprocessSelected
, label = "" , label = ""
, icon = Just "fa fa-redo" , icon = Just "fa fa-redo"
, title = "Reprocess " ++ selectCount ++ " selected items" , title = texts.reprocessSelectedItems selectCount
, inputClass = , inputClass =
[ ( btnStyle, True ) [ ( btnStyle, True )
, ( "bg-gray-200 dark:bg-bluegray-600", svm.action == ReprocessSelected ) , ( "bg-gray-200 dark:bg-bluegray-600", svm.action == ReprocessSelected )
@ -220,7 +243,7 @@ editMenuBar model svm =
{ tagger = RequestDeleteSelected { tagger = RequestDeleteSelected
, label = "" , label = ""
, icon = Just "fa fa-trash" , icon = Just "fa fa-trash"
, title = "Delete " ++ selectCount ++ " selected items" , title = texts.deleteSelectedItems selectCount
, inputClass = , inputClass =
[ ( btnStyle, True ) [ ( btnStyle, True )
, ( "bg-gray-200 dark:bg-bluegray-600", svm.action == DeleteSelected ) , ( "bg-gray-200 dark:bg-bluegray-600", svm.action == DeleteSelected )
@ -232,7 +255,7 @@ editMenuBar model svm =
{ tagger = SelectAllItems { tagger = SelectAllItems
, label = "" , label = ""
, icon = Just "fa fa-check-square font-thin" , icon = Just "fa fa-check-square font-thin"
, title = "Select all visible" , title = texts.selectAllVisible
, inputClass = , inputClass =
[ ( btnStyle, True ) [ ( btnStyle, True )
] ]
@ -241,21 +264,21 @@ editMenuBar model svm =
{ tagger = SelectNoItems { tagger = SelectNoItems
, label = "" , label = ""
, icon = Just "fa fa-square font-thin" , icon = Just "fa fa-square font-thin"
, title = "Select none" , title = texts.selectNone
, inputClass = , inputClass =
[ ( btnStyle, True ) [ ( btnStyle, True )
] ]
} }
, MB.TextLabel , MB.TextLabel
{ icon = "" { icon = ""
, label = selectCount , label = String.fromInt selectCount
, class = "px-4 py-2 w-10 rounded-full font-bold bg-blue-100 dark:bg-lightblue-600 " , class = "px-4 py-2 w-10 rounded-full font-bold bg-blue-100 dark:bg-lightblue-600 "
} }
, MB.CustomButton , MB.CustomButton
{ tagger = ResetSearch { tagger = ResetSearch
, label = "" , label = ""
, icon = Just "fa fa-sync" , icon = Just "fa fa-sync"
, title = "Reset search form" , title = texts.resetSearchForm
, inputClass = , inputClass =
[ ( btnStyle, True ) [ ( btnStyle, True )
, ( "hidden sm:block", True ) , ( "hidden sm:block", True )
@ -265,7 +288,7 @@ editMenuBar model svm =
{ tagger = ToggleSelectView { tagger = ToggleSelectView
, label = "" , label = ""
, icon = Just "fa fa-tasks" , icon = Just "fa fa-tasks"
, title = "Exit Select Mode" , title = texts.exitSelectMode
, inputClass = , inputClass =
[ ( btnStyle, True ) [ ( btnStyle, True )
, ( "bg-gray-200 dark:bg-bluegray-600", selectActive model ) , ( "bg-gray-200 dark:bg-bluegray-600", selectActive model )
@ -276,18 +299,18 @@ editMenuBar model svm =
} }
searchStats : Flags -> UiSettings -> Model -> List (Html Msg) searchStats : Texts -> Flags -> UiSettings -> Model -> List (Html Msg)
searchStats _ settings model = searchStats texts _ settings model =
if settings.searchStatsVisible then if settings.searchStatsVisible then
[ Comp.SearchStatsView.view2 "my-2" model.searchStats [ Comp.SearchStatsView.view2 texts.searchStatsView "my-2" model.searchStats
] ]
else else
[] []
itemCardList : Flags -> UiSettings -> Model -> List (Html Msg) itemCardList : Texts -> Flags -> UiSettings -> Model -> List (Html Msg)
itemCardList _ settings model = itemCardList texts _ settings model =
let let
itemViewCfg = itemViewCfg =
case model.viewMode of case model.viewMode of
@ -302,7 +325,11 @@ itemCardList _ settings model =
Data.ItemSelection.Inactive Data.ItemSelection.Inactive
in in
[ Html.map ItemCardListMsg [ Html.map ItemCardListMsg
(Comp.ItemCardList.view2 itemViewCfg settings model.itemListModel) (Comp.ItemCardList.view2 texts.itemCardList
itemViewCfg
settings
model.itemListModel
)
, loadMore settings model , loadMore settings model
] ]