From 2f678aca1701271bd50b60bd6a5038ca423b5611 Mon Sep 17 00:00:00 2001 From: Eike Kettner Date: Wed, 7 Apr 2021 01:09:58 +0200 Subject: [PATCH] Externalize strings in detail page --- .../webapp/src/main/elm/Comp/DetailEdit.elm | 46 +++---- .../main/elm/Comp/ItemDetail/AddFilesForm.elm | 11 +- .../src/main/elm/Comp/ItemDetail/EditForm.elm | 127 +++++++++--------- .../elm/Comp/ItemDetail/FieldTabState.elm | 17 ++- .../elm/Comp/ItemDetail/ItemInfoHeader.elm | 19 +-- .../elm/Comp/ItemDetail/MultiEditMenu.elm | 2 +- .../src/main/elm/Comp/ItemDetail/Notes.elm | 23 ++-- .../elm/Comp/ItemDetail/SingleAttachment.elm | 45 ++++--- .../src/main/elm/Comp/ItemDetail/Update.elm | 4 +- .../src/main/elm/Comp/ItemDetail/View2.elm | 86 ++++++------ modules/webapp/src/main/elm/Comp/ItemMail.elm | 41 +++--- .../src/main/elm/Comp/MarkdownInput.elm | 24 ++-- .../src/main/elm/Comp/NotificationForm.elm | 4 +- .../src/main/elm/Comp/ScanMailboxForm.elm | 2 +- .../webapp/src/main/elm/Comp/SentMails.elm | 21 +-- .../webapp/src/main/elm/Comp/SourceForm.elm | 2 +- .../webapp/src/main/elm/Messages/Basics.elm | 2 + .../src/main/elm/Messages/DetailEditComp.elm | 29 ++++ .../src/main/elm/Messages/EditFormComp.elm | 65 +++++++++ .../src/main/elm/Messages/FixedDropdown.elm | 22 --- .../elm/Messages/ItemDetail/AddFilesForm.elm | 19 ++- .../src/main/elm/Messages/ItemDetailComp.elm | 50 +++++++ .../src/main/elm/Messages/ItemDetailPage.elm | 5 + .../main/elm/Messages/ItemInfoHeaderComp.elm | 24 ++++ .../src/main/elm/Messages/ItemMailComp.elm | 30 +++++ .../src/main/elm/Messages/NotesComp.elm | 20 +++ .../src/main/elm/Messages/SentMailsComp.elm | 22 +++ .../elm/Messages/SingleAttachmentComp.elm | 30 +++++ .../src/main/elm/Page/ItemDetail/View2.elm | 4 +- modules/webapp/src/main/elm/Util/Tag.elm | 12 +- 30 files changed, 554 insertions(+), 254 deletions(-) create mode 100644 modules/webapp/src/main/elm/Messages/DetailEditComp.elm create mode 100644 modules/webapp/src/main/elm/Messages/EditFormComp.elm delete mode 100644 modules/webapp/src/main/elm/Messages/FixedDropdown.elm create mode 100644 modules/webapp/src/main/elm/Messages/ItemInfoHeaderComp.elm create mode 100644 modules/webapp/src/main/elm/Messages/ItemMailComp.elm create mode 100644 modules/webapp/src/main/elm/Messages/NotesComp.elm create mode 100644 modules/webapp/src/main/elm/Messages/SentMailsComp.elm create mode 100644 modules/webapp/src/main/elm/Messages/SingleAttachmentComp.elm diff --git a/modules/webapp/src/main/elm/Comp/DetailEdit.elm b/modules/webapp/src/main/elm/Comp/DetailEdit.elm index 08867e37..1ceaeadf 100644 --- a/modules/webapp/src/main/elm/Comp/DetailEdit.elm +++ b/modules/webapp/src/main/elm/Comp/DetailEdit.elm @@ -47,11 +47,7 @@ import Html exposing (..) import Html.Attributes exposing (..) import Html.Events exposing (onClick) import Http -import Messages.CustomFieldFormComp -import Messages.EquipmentFormComp -import Messages.OrgFormComp -import Messages.PersonFormComp -import Messages.TagFormComp +import Messages.DetailEditComp exposing (Texts) import Styles as S import Util.Http @@ -644,10 +640,10 @@ update flags msg model = --- View2 -view2 : List (Attribute Msg) -> UiSettings -> Model -> Html Msg -view2 attr settings model = +view2 : Texts -> List (Attribute Msg) -> UiSettings -> Model -> Html Msg +view2 texts attr settings model = div attr - (viewIntern2 settings True model) + (viewIntern2 texts settings True model) formHeading : String -> Model -> Html msg @@ -673,8 +669,8 @@ formHeading classes model = ] -viewModal2 : UiSettings -> Maybe Model -> Html Msg -viewModal2 settings mm = +viewModal2 : Texts -> UiSettings -> Maybe Model -> Html Msg +viewModal2 texts settings mm = let hidden = mm == Nothing @@ -715,7 +711,7 @@ viewModal2 settings mm = , div [ class "scrolling content" ] (case mm of Just model -> - viewIntern2 settings False model + viewIntern2 texts settings False model Nothing -> [] @@ -723,7 +719,7 @@ viewModal2 settings mm = , div [ class "flex flex-row space-x-2" ] (case mm of Just model -> - viewButtons2 model + viewButtons2 texts model Nothing -> [] @@ -732,10 +728,10 @@ viewModal2 settings mm = ] -viewButtons2 : Model -> List (Html Msg) -viewButtons2 model = +viewButtons2 : Texts -> Model -> List (Html Msg) +viewButtons2 texts model = [ B.primaryButton - { label = "Submit" + { label = texts.basics.submit , icon = if model.submitting || model.loading then "fa fa-circle-notch animate-spin" @@ -747,7 +743,7 @@ viewButtons2 model = , attrs = [ href "#" ] } , B.secondaryButton - { label = "Cancel" + { label = texts.basics.cancel , handler = onClick Cancel , disabled = False , icon = "fa fa-times" @@ -756,8 +752,8 @@ viewButtons2 model = ] -viewIntern2 : UiSettings -> Bool -> Model -> List (Html Msg) -viewIntern2 settings withButtons model = +viewIntern2 : Texts -> UiSettings -> Bool -> Model -> List (Html Msg) +viewIntern2 texts settings withButtons model = [ div [ classList [ ( S.errorMessage, Maybe.map .success model.result == Just False ) @@ -771,25 +767,25 @@ viewIntern2 settings withButtons model = ] , case model.form of TM tm -> - Html.map TagMsg (Comp.TagForm.view2 Messages.TagFormComp.gb tm) + Html.map TagMsg (Comp.TagForm.view2 texts.tagForm tm) PMR pm -> - Html.map PersonMsg (Comp.PersonForm.view2 Messages.PersonFormComp.gb True settings pm) + Html.map PersonMsg (Comp.PersonForm.view2 texts.personForm True settings pm) PMC pm -> - Html.map PersonMsg (Comp.PersonForm.view2 Messages.PersonFormComp.gb True settings pm) + Html.map PersonMsg (Comp.PersonForm.view2 texts.personForm True settings pm) OM om -> - Html.map OrgMsg (Comp.OrgForm.view2 Messages.OrgFormComp.gb True settings om) + Html.map OrgMsg (Comp.OrgForm.view2 texts.orgForm True settings om) EM em -> - Html.map EquipMsg (Comp.EquipmentForm.view2 Messages.EquipmentFormComp.gb em) + Html.map EquipMsg (Comp.EquipmentForm.view2 texts.equipmentForm em) CFM fm -> div [] (List.map (Html.map CustomFieldMsg) (Comp.CustomFieldForm.view2 - Messages.CustomFieldFormComp.gb + texts.customFieldForm { classes = "" , showControls = False } @@ -799,7 +795,7 @@ viewIntern2 settings withButtons model = ] ++ (if withButtons then [ div [ class "flex flex-row space-x-2" ] - (viewButtons2 model) + (viewButtons2 texts model) ] else diff --git a/modules/webapp/src/main/elm/Comp/ItemDetail/AddFilesForm.elm b/modules/webapp/src/main/elm/Comp/ItemDetail/AddFilesForm.elm index fb3e7147..73cf872c 100644 --- a/modules/webapp/src/main/elm/Comp/ItemDetail/AddFilesForm.elm +++ b/modules/webapp/src/main/elm/Comp/ItemDetail/AddFilesForm.elm @@ -25,7 +25,7 @@ view texts model = , class S.box ] [ div [ class "text-lg font-bold" ] - [ text "Add more files to this item" + [ text texts.addMoreFilesToItem ] , Html.map AddFilesMsg (Comp.Dropzone.view2 texts.dropzone model.addFilesModel) @@ -35,14 +35,14 @@ view texts model = , href "#" , onClick AddFilesSubmitUpload ] - [ text "Submit" + [ text texts.basics.submit ] , button [ class S.secondaryButton , href "#" , onClick AddFilesReset ] - [ text "Reset" + [ text texts.reset ] ] , div @@ -52,14 +52,13 @@ view texts model = ] , class "mt-2" ] - [ text "All files have been uploaded. They are being processed, some data " - , text "may not be available immediately. " + [ text texts.filesSubmittedInfo , a [ class S.successMessageLink , href "#" , onClick ReloadItem ] - [ text "Refresh now" + [ text texts.refreshNow ] ] , div diff --git a/modules/webapp/src/main/elm/Comp/ItemDetail/EditForm.elm b/modules/webapp/src/main/elm/Comp/ItemDetail/EditForm.elm index c5370009..9f5b1666 100644 --- a/modules/webapp/src/main/elm/Comp/ItemDetail/EditForm.elm +++ b/modules/webapp/src/main/elm/Comp/ItemDetail/EditForm.elm @@ -25,6 +25,7 @@ import Html exposing (..) import Html.Attributes exposing (..) import Html.Events exposing (onClick, onInput) import Markdown +import Messages.EditFormComp exposing (Texts) import Page exposing (Page(..)) import Set exposing (Set) import Styles as S @@ -34,8 +35,8 @@ import Util.Tag import Util.Time -view2 : Flags -> UiSettings -> Model -> Html Msg -view2 flags settings model = +view2 : Texts -> Flags -> UiSettings -> Model -> Html Msg +view2 texts flags settings model = let keyAttr = if settings.itemDetailShortcuts then @@ -48,7 +49,7 @@ view2 flags settings model = TB.searchMenuStyle tabs = - formTabs flags settings model + formTabs texts flags settings model allTabNames = List.map .title tabs @@ -61,8 +62,8 @@ view2 flags settings model = ] -formTabs : Flags -> UiSettings -> Model -> List (TB.Tab Msg) -formTabs flags settings model = +formTabs : Texts -> Flags -> UiSettings -> Model -> List (TB.Tab Msg) +formTabs texts flags settings model = let dds = Data.DropdownStyle.sidebarStyle @@ -100,7 +101,7 @@ formTabs flags settings model = , classes = "" , fieldIcon = \f -> Dict.get f.id model.customFieldSavingIcon , style = dds - , createCustomFieldTitle = "Create new custom field" + , createCustomFieldTitle = texts.createNewCustomField } optional fields html = @@ -119,7 +120,7 @@ formTabs flags settings model = { text = Data.Direction.toString entry , additional = "" } - , placeholder = "Choose a direction…" + , placeholder = texts.chooseDirection , labelColor = \_ -> \_ -> "" , style = dds } @@ -134,19 +135,19 @@ formTabs flags settings model = idNameCfg = { makeOption = \e -> { text = e.name, additional = "" } , labelColor = \_ -> \_ -> "" - , placeholder = "Select…" + , placeholder = texts.selectPlaceholder , style = dds } personCfg = { makeOption = \p -> Util.Person.mkPersonOption p model.allPersons , labelColor = \_ -> \_ -> "" - , placeholder = "Select…" + , placeholder = texts.selectPlaceholder , style = dds } in [ { name = FTabState.tabName TabName - , title = "Name" + , title = texts.nameTab , titleRight = [] , info = Nothing , body = @@ -173,7 +174,7 @@ formTabs flags settings model = ] } , { name = FTabState.tabName TabDate - , title = "Date" + , title = texts.dateTab , titleRight = [] , info = Nothing , body = @@ -194,18 +195,18 @@ formTabs flags settings model = ] , Icons.dateIcon2 S.dateInputIcon ] - , renderItemDateSuggestions model + , renderItemDateSuggestions texts model ] ] } , { name = FTabState.tabName TabTags - , title = "Tags" + , title = texts.basics.tags , titleRight = [] , info = Nothing , body = [ div [ class "mb-4 flex flex-col" ] [ Html.map TagDropdownMsg - (Comp.Dropdown.view2 (Util.Tag.tagSettings dds) + (Comp.Dropdown.view2 (Util.Tag.tagSettings texts.basics.chooseTag dds) settings model.tagModel ) @@ -223,7 +224,7 @@ formTabs flags settings model = ] } , { name = FTabState.tabName TabFolder - , title = "Folder" + , title = texts.folderTab , titleRight = [] , info = Nothing , body = @@ -240,17 +241,13 @@ formTabs flags 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 = FTabState.tabName TabCustomFields - , title = "Custom Fields" + , title = texts.customFieldsTab , titleRight = [] , info = Nothing , body = @@ -264,7 +261,7 @@ item visible. This message will disappear then. ] } , { name = FTabState.tabName TabDueDate - , title = "Due Date" + , title = texts.dueDateTab , titleRight = [] , info = Nothing , body = @@ -285,12 +282,12 @@ item visible. This message will disappear then. ] , Icons.dueDateIcon2 S.dateInputIcon ] - , renderDueDateSuggestions model + , renderDueDateSuggestions texts model ] ] } , { name = FTabState.tabName TabCorrespondent - , title = "Correspondent" + , title = texts.correspondentTab , titleRight = [] , info = Nothing , body = @@ -298,25 +295,25 @@ item visible. This message will disappear then. div [ class "mb-4" ] [ label [ class S.inputLabel ] [ Icons.organizationIcon2 "mr-2" - , text "Organization" - , addIconLink "Add new organization" StartCorrOrgModal - , editIconLink "Edit organization" model.corrOrgModel StartEditCorrOrgModal + , text texts.organization + , addIconLink texts.addNewOrg StartCorrOrgModal + , editIconLink texts.editOrg model.corrOrgModel StartEditCorrOrgModal ] , Html.map OrgDropdownMsg (Comp.Dropdown.view2 - (Comp.Dropdown.orgFormViewSettings "Choose an organization" dds) + (Comp.Dropdown.orgFormViewSettings texts.chooseOrg dds) settings model.corrOrgModel ) - , renderOrgSuggestions model + , renderOrgSuggestions texts model ] , optional [ Data.Fields.CorrPerson ] <| div [ class "mb-4" ] [ label [ class S.inputLabel ] [ Icons.personIcon2 "mr-2" , text "Person" - , addIconLink "Add new correspondent person" StartCorrPersonModal - , editIconLink "Edit person" + , addIconLink texts.addNewCorrespondentPerson StartCorrPersonModal + , editIconLink texts.editPerson model.corrPersonModel (StartEditPersonModal model.corrPersonModel) ] @@ -325,7 +322,7 @@ item visible. This message will disappear then. settings model.corrPersonModel ) - , renderCorrPersonSuggestions model + , renderCorrPersonSuggestions texts model , div [ classList [ ( "hidden", personMatchesOrg model ) @@ -334,13 +331,13 @@ item visible. This message will disappear then. , class "my-2" ] [ i [ class "fa fa-info mr-2 " ] [] - , text "The selected person doesn't belong to the selected organization." + , text texts.personOrgInfo ] ] ] } , { name = FTabState.tabName TabConcerning - , title = "Concerning" + , title = texts.concerningTab , titleRight = [] , info = Nothing , body = @@ -349,8 +346,8 @@ item visible. This message will disappear then. [ label [ class S.inputLabel ] [ Icons.personIcon2 "mr-2" , text "Person" - , addIconLink "Add new concerning person" StartConcPersonModal - , editIconLink "Edit person" + , addIconLink texts.addNewConcerningPerson StartConcPersonModal + , editIconLink texts.editPerson model.concPersonModel (StartEditPersonModal model.concPersonModel) ] @@ -360,15 +357,15 @@ item visible. This message will disappear then. settings model.concPersonModel ) - , renderConcPersonSuggestions model + , renderConcPersonSuggestions texts model ] , optional [ Data.Fields.ConcEquip ] <| div [ class "mb-4" ] [ label [ class S.inputLabel ] [ Icons.equipmentIcon2 "mr-2" , text "Equipment" - , addIconLink "Add new equipment" StartEquipModal - , editIconLink "Edit equipment" + , addIconLink texts.addNewEquipment StartEquipModal + , editIconLink texts.editEquipment model.concEquipModel StartEditEquipModal ] @@ -378,12 +375,12 @@ item visible. This message will disappear then. settings model.concEquipModel ) - , renderConcEquipSuggestions model + , renderConcEquipSuggestions texts model ] ] } , { name = FTabState.tabName TabDirection - , title = "Direction" + , title = texts.directionTab , titleRight = [] , info = Nothing , body = @@ -400,8 +397,8 @@ item visible. This message will disappear then. ] -renderSuggestions : Model -> (a -> String) -> List a -> (a -> Msg) -> Html Msg -renderSuggestions model mkName idnames tagger = +renderSuggestions : Texts -> Model -> (a -> String) -> List a -> (a -> Msg) -> Html Msg +renderSuggestions texts model mkName idnames tagger = div [ classList [ ( "hidden", model.item.state /= "created" ) @@ -409,7 +406,7 @@ renderSuggestions model mkName idnames tagger = , class "flex flex-col text-sm" ] [ div [ class "font-bold my-1" ] - [ text "Suggestions" + [ text texts.suggestions ] , ul [ class "list-disc ml-6" ] <| (idnames @@ -428,49 +425,55 @@ renderSuggestions model mkName idnames tagger = ] -renderOrgSuggestions : Model -> Html Msg -renderOrgSuggestions model = - renderSuggestions model +renderOrgSuggestions : Texts -> Model -> Html Msg +renderOrgSuggestions texts model = + renderSuggestions texts + model .name (List.take 6 model.itemProposals.corrOrg) SetCorrOrgSuggestion -renderCorrPersonSuggestions : Model -> Html Msg -renderCorrPersonSuggestions model = - renderSuggestions model +renderCorrPersonSuggestions : Texts -> Model -> Html Msg +renderCorrPersonSuggestions texts model = + renderSuggestions texts + model .name (List.take 6 model.itemProposals.corrPerson) SetCorrPersonSuggestion -renderConcPersonSuggestions : Model -> Html Msg -renderConcPersonSuggestions model = - renderSuggestions model +renderConcPersonSuggestions : Texts -> Model -> Html Msg +renderConcPersonSuggestions texts model = + renderSuggestions texts + model .name (List.take 6 model.itemProposals.concPerson) SetConcPersonSuggestion -renderConcEquipSuggestions : Model -> Html Msg -renderConcEquipSuggestions model = - renderSuggestions model +renderConcEquipSuggestions : Texts -> Model -> Html Msg +renderConcEquipSuggestions texts model = + renderSuggestions texts + model .name (List.take 6 model.itemProposals.concEquipment) SetConcEquipSuggestion -renderItemDateSuggestions : Model -> Html Msg -renderItemDateSuggestions model = - renderSuggestions model +renderItemDateSuggestions : Texts -> Model -> Html Msg +renderItemDateSuggestions texts model = + renderSuggestions texts + model Util.Time.formatDate (List.take 6 model.itemProposals.itemDate) SetItemDateSuggestion -renderDueDateSuggestions : Model -> Html Msg -renderDueDateSuggestions model = - renderSuggestions model +renderDueDateSuggestions : Texts -> Model -> Html Msg +renderDueDateSuggestions texts model = + renderSuggestions texts + model Util.Time.formatDate (List.take 6 model.itemProposals.dueDate) SetDueDateSuggestion diff --git a/modules/webapp/src/main/elm/Comp/ItemDetail/FieldTabState.elm b/modules/webapp/src/main/elm/Comp/ItemDetail/FieldTabState.elm index b1d39ece..0a3c48cf 100644 --- a/modules/webapp/src/main/elm/Comp/ItemDetail/FieldTabState.elm +++ b/modules/webapp/src/main/elm/Comp/ItemDetail/FieldTabState.elm @@ -1,4 +1,4 @@ -module Comp.ItemDetail.FieldTabState exposing (EditTab(..), findTab, tabName, tabState) +module Comp.ItemDetail.FieldTabState exposing (EditTab(..), allTabs, findTab, tabName, tabState) import Comp.CustomFieldMultiInput import Comp.Tabs as TB @@ -20,6 +20,21 @@ type EditTab | TabConfirmUnconfirm +allTabs : List EditTab +allTabs = + [ TabName + , TabDate + , TabTags + , TabFolder + , TabCustomFields + , TabDueDate + , TabCorrespondent + , TabConcerning + , TabDirection + , TabConfirmUnconfirm + ] + + tabName : EditTab -> String tabName tab = case tab of diff --git a/modules/webapp/src/main/elm/Comp/ItemDetail/ItemInfoHeader.elm b/modules/webapp/src/main/elm/Comp/ItemDetail/ItemInfoHeader.elm index 30e11f49..1d1ef6cd 100644 --- a/modules/webapp/src/main/elm/Comp/ItemDetail/ItemInfoHeader.elm +++ b/modules/webapp/src/main/elm/Comp/ItemDetail/ItemInfoHeader.elm @@ -15,19 +15,20 @@ import Data.Icons as Icons import Data.UiSettings exposing (UiSettings) import Html exposing (..) import Html.Attributes exposing (..) +import Messages.ItemInfoHeaderComp exposing (Texts) import Page exposing (Page(..)) import Styles as S import Util.Maybe import Util.Time -view : UiSettings -> Model -> Html Msg -view settings model = +view : Texts -> UiSettings -> Model -> Html Msg +view texts settings model = let date = ( div [ class "ml-2 sm:ml-0 whitespace-nowrap py-1 whitespace-nowrap opacity-75" - , title "Item Date" + , title texts.itemDate ] [ Icons.dateIcon2 "mr-2" , Maybe.withDefault model.item.created model.item.itemDate @@ -47,7 +48,7 @@ view settings model = ( div [ class "ml-2 sm:ml-4 py-1 max-w-min whitespace-nowrap opacity-100" , class S.basicLabel - , title "Due Date" + , title texts.dueDate ] [ Icons.dueDateIcon2 "mr-2" , Maybe.map Util.Time.formatDate model.item.dueDate @@ -61,7 +62,7 @@ view settings model = corr = ( div [ class itemStyle - , title "Correspondent" + , title texts.correspondent ] (Icons.correspondentIcon2 "mr-2" :: Comp.LinkTarget.makeCorrLink model.item @@ -75,7 +76,7 @@ view settings model = conc = ( div [ class itemStyle - , title "Concerning" + , title texts.concerning ] (Icons.concernedIcon2 "mr-2" :: Comp.LinkTarget.makeConcLink model.item @@ -89,7 +90,7 @@ view settings model = itemfolder = ( div [ class itemStyle - , title "Folder" + , title texts.folder ] [ Icons.folderIcon2 "mr-2" , Comp.LinkTarget.makeFolderLink model.item @@ -102,7 +103,7 @@ view settings model = src = ( div [ class itemStyle - , title "Source" + , title texts.source ] [ Icons.sourceIcon2 "mr-2" , Comp.LinkTarget.makeSourceLink [ ( linkStyle, True ) ] @@ -132,7 +133,7 @@ view settings model = ] , class "ml-3 text-base label bg-blue-500 dark:bg-lightblue-500 text-white rounded-lg" ] - [ text "New" + [ text texts.new , i [ class "fa fa-exclamation ml-2" ] [] ] ] diff --git a/modules/webapp/src/main/elm/Comp/ItemDetail/MultiEditMenu.elm b/modules/webapp/src/main/elm/Comp/ItemDetail/MultiEditMenu.elm index d63af8ce..77600cff 100644 --- a/modules/webapp/src/main/elm/Comp/ItemDetail/MultiEditMenu.elm +++ b/modules/webapp/src/main/elm/Comp/ItemDetail/MultiEditMenu.elm @@ -744,7 +744,7 @@ renderEditForm2 texts flags cfg settings model = ] ] , Html.map TagDropdownMsg - (Comp.Dropdown.view2 (Util.Tag.tagSettings dds) + (Comp.Dropdown.view2 (Util.Tag.tagSettings texts.basics.chooseTag dds) settings model.tagModel ) diff --git a/modules/webapp/src/main/elm/Comp/ItemDetail/Notes.elm b/modules/webapp/src/main/elm/Comp/ItemDetail/Notes.elm index 58478bc3..48dfd20d 100644 --- a/modules/webapp/src/main/elm/Comp/ItemDetail/Notes.elm +++ b/modules/webapp/src/main/elm/Comp/ItemDetail/Notes.elm @@ -12,19 +12,20 @@ import Html exposing (..) import Html.Attributes exposing (..) import Html.Events exposing (onClick) import Markdown +import Messages.NotesComp exposing (Texts) import Page exposing (Page(..)) import Styles as S import Util.String -view : Model -> Html Msg -view model = +view : Texts -> Model -> Html Msg +view texts model = case model.notesField of ViewNotes -> div [ class "flex flex-col ds-item-detail-notes" ] [ div [ class "flex flex-row items-center border-b dark:border-bluegray-600" ] [ div [ class "flex-grow font-bold text-lg" ] - [ text "Notes" + [ text texts.notes ] , div [ class "" ] [ a @@ -33,7 +34,7 @@ view model = , href "#" ] [ i [ class "fa fa-edit mr-2" ] [] - , text "Edit" + , text texts.basics.edit ] ] ] @@ -55,14 +56,14 @@ view model = [ div [ class "flex flex-col" ] [ div [ class "flex flex-row items-center" ] [ div [ class "font-bold text-lg" ] - [ text "Notes" + [ text texts.notes ] , div [ class "flex flex-grow justify-end text-sm" ] [ Html.map NotesEditMsg - (Comp.MarkdownInput.viewEditLink2 classes mm) + (Comp.MarkdownInput.viewEditLink2 texts.basics.edit classes mm) , span [ class "px-3" ] [ text "•" ] , Html.map NotesEditMsg - (Comp.MarkdownInput.viewPreviewLink2 classes mm) + (Comp.MarkdownInput.viewPreviewLink2 texts.preview classes mm) ] ] ] @@ -73,7 +74,9 @@ view model = mm ) , div [ class "text-sm flex justify-end" ] - [ Comp.MarkdownInput.viewCheatLink2 S.link mm + [ Comp.MarkdownInput.viewCheatLink2 texts.supportsMarkdown + S.link + mm ] , div [ class "flex flex-row mt-1" ] [ a @@ -82,7 +85,7 @@ view model = , onClick SaveNotes ] [ i [ class "fa fa-save font-thin mr-2" ] [] - , text "Save" + , text texts.basics.submit ] , a [ classList @@ -94,7 +97,7 @@ view model = , onClick ToggleEditNotes ] [ i [ class "fa fa-times mr-2" ] [] - , text "Cancel" + , text texts.basics.cancel ] ] ] diff --git a/modules/webapp/src/main/elm/Comp/ItemDetail/SingleAttachment.elm b/modules/webapp/src/main/elm/Comp/ItemDetail/SingleAttachment.elm index 7d3cd714..9394daa6 100644 --- a/modules/webapp/src/main/elm/Comp/ItemDetail/SingleAttachment.elm +++ b/modules/webapp/src/main/elm/Comp/ItemDetail/SingleAttachment.elm @@ -18,6 +18,7 @@ import Html exposing (..) import Html.Attributes exposing (..) import Html.Events exposing (onClick, onInput) import Html5.DragDrop as DD +import Messages.SingleAttachmentComp exposing (Texts) import Page exposing (Page(..)) import Styles as S import Util.Maybe @@ -25,8 +26,8 @@ import Util.Size import Util.String -view : UiSettings -> Model -> Int -> Attachment -> Html Msg -view settings model pos attach = +view : Texts -> UiSettings -> Model -> Int -> Attachment -> Html Msg +view texts settings model pos attach = let fileUrl = Api.fileURL attach.id @@ -42,10 +43,10 @@ view settings model pos attach = [ class "flex flex-row px-2 py-2 text-sm" , class S.border ] - [ attachHeader settings model pos attach + [ attachHeader texts settings model pos attach ] , editAttachmentName model attach - , attachmentSelect model pos attach + , attachmentSelect texts model pos attach , if isAttachMetaOpen model attach.id then case Dict.get attach.id model.attachMeta of Just am -> @@ -94,11 +95,11 @@ view settings model pos attach = - native view -} -attachHeader : UiSettings -> Model -> Int -> Attachment -> Html Msg -attachHeader settings model _ attach = +attachHeader : Texts -> UiSettings -> Model -> Int -> Attachment -> Html Msg +attachHeader texts settings model _ attach = let attachName = - Maybe.withDefault "No name" attach.name + Maybe.withDefault texts.noName attach.name fileUrl = Api.fileURL attach.id @@ -138,7 +139,7 @@ attachHeader settings model _ attach = , a [ href fileUrl , target "_new" - , title "Open file in new tab" + , title texts.openFileInNewTab , class S.secondaryBasicButton , class "ml-2" ] @@ -155,21 +156,21 @@ attachHeader settings model _ attach = , menuOpen = model.attachmentDropdownOpen , items = [ { icon = "fa fa-download" - , label = "Download file" + , label = texts.downloadFile , attrs = [ download attachName , href fileUrl ] } , { icon = "fa fa-file" - , label = "Rename file" + , label = texts.renameFile , attrs = [ href "#" , onClick (EditAttachNameStart attach.id) ] } , { icon = "fa fa-file-archive" - , label = "Download original archive" + , label = texts.downloadOriginalArchiveFile , attrs = [ href (fileUrl ++ "/archive") , target "_new" @@ -177,7 +178,7 @@ attachHeader settings model _ attach = ] } , { icon = "fa fa-external-link-alt" - , label = "Original file" + , label = texts.originalFile , attrs = [ href (fileUrl ++ "/original") , target "_new" @@ -190,7 +191,7 @@ attachHeader settings model _ attach = else "fa fa-toggle-off" - , label = "Render pdf by browser" + , label = texts.renderPdfByBrowser , attrs = [ onClick (TogglePdfNativeView settings.nativePdfPreview) , href "#" @@ -202,21 +203,21 @@ attachHeader settings model _ attach = else "fa fa-toggle-off" - , label = "View extracted data" + , label = texts.viewExtractedData , attrs = [ onClick (AttachMetaClick attach.id) , href "#" ] } , { icon = "fa fa-redo-alt" - , label = "Re-process this file" + , label = texts.reprocessFile , attrs = [ onClick (RequestReprocessFile attach.id) , href "#" ] } , { icon = "fa fa-trash" - , label = "Delete this file" + , label = texts.deleteThisFile , attrs = [ onClick (RequestDeleteAttachment attach.id) , href "#" @@ -279,8 +280,8 @@ editAttachmentName model attach = span [ class "hidden" ] [] -attachmentSelect : Model -> Int -> Attachment -> Html Msg -attachmentSelect model _ _ = +attachmentSelect : Texts -> Model -> Int -> Attachment -> Html Msg +attachmentSelect texts model _ _ = div [ class "flex flex-row border-l border-r px-2 py-2 dark:border-bluegray-600 " , class "overflow-x-auto overflow-y-none" @@ -288,11 +289,11 @@ attachmentSelect model _ _ = [ ( "hidden", not model.attachMenuOpen ) ] ] - (List.indexedMap (menuItem model) model.item.attachments) + (List.indexedMap (menuItem texts model) model.item.attachments) -menuItem : Model -> Int -> Attachment -> Html Msg -menuItem model pos attach = +menuItem : Texts -> Model -> Int -> Attachment -> Html Msg +menuItem texts model pos attach = let highlight = let @@ -342,7 +343,7 @@ menuItem model pos attach = ] , div [ class "mt-1 text-sm break-all w-28 text-center" ] [ Maybe.map (Util.String.ellipsis 36) attach.name - |> Maybe.withDefault "No Name" + |> Maybe.withDefault texts.noName |> text ] ] diff --git a/modules/webapp/src/main/elm/Comp/ItemDetail/Update.elm b/modules/webapp/src/main/elm/Comp/ItemDetail/Update.elm index d47da245..c8ebf07a 100644 --- a/modules/webapp/src/main/elm/Comp/ItemDetail/Update.elm +++ b/modules/webapp/src/main/elm/Comp/ItemDetail/Update.elm @@ -24,6 +24,7 @@ import Comp.Dropdown exposing (isDropdownChangeMsg) import Comp.Dropzone import Comp.EquipmentForm import Comp.ItemDetail.EditForm +import Comp.ItemDetail.FieldTabState as FTabState import Comp.ItemDetail.Model exposing ( AttachmentRename @@ -1487,8 +1488,7 @@ update key flags inav settings msg model = ToggleOpenAllAkkordionTabs -> let allNames = - Comp.ItemDetail.EditForm.formTabs flags settings model - |> List.map .title + List.map FTabState.tabName FTabState.allTabs |> Set.fromList next = diff --git a/modules/webapp/src/main/elm/Comp/ItemDetail/View2.elm b/modules/webapp/src/main/elm/Comp/ItemDetail/View2.elm index af3c849e..a1ecf2fc 100644 --- a/modules/webapp/src/main/elm/Comp/ItemDetail/View2.elm +++ b/modules/webapp/src/main/elm/Comp/ItemDetail/View2.elm @@ -32,8 +32,8 @@ import Util.Time view : Texts -> ItemNav -> UiSettings -> Model -> Html Msg view texts inav settings model = div [ class "flex flex-col h-full" ] - [ header settings model - , menuBar inav settings model + [ header texts settings model + , menuBar texts inav settings model , body texts inav settings model , itemModal model ] @@ -49,18 +49,18 @@ itemModal model = span [ class "hidden" ] [] -header : UiSettings -> Model -> Html Msg -header settings model = +header : Texts -> UiSettings -> Model -> Html Msg +header texts settings model = div [ class "my-3" ] - [ Comp.ItemDetail.ItemInfoHeader.view settings model ] + [ Comp.ItemDetail.ItemInfoHeader.view texts.itemInfoHeader settings model ] -menuBar : ItemNav -> UiSettings -> Model -> Html Msg -menuBar inav settings model = +menuBar : Texts -> ItemNav -> UiSettings -> Model -> Html Msg +menuBar texts inav settings model = let keyDescr name = if settings.itemDetailShortcuts && model.menuOpen then - " Key '" ++ name ++ "'." + " " ++ texts.key ++ "'" ++ name ++ "'." else "" @@ -71,7 +71,7 @@ menuBar inav settings model = a [ class S.secondaryBasicButton , Page.href HomePage - , title "Back to search results" + , title texts.backToSearchResults ] [ i [ class "fa fa-arrow-left" ] [] ] @@ -88,7 +88,7 @@ menuBar inav settings model = |> Maybe.withDefault (href "#") , disabled = inav.prev == Nothing , attrs = - [ title ("Previous item." ++ keyDescr "Ctrl-,") + [ title (texts.previousItem ++ keyDescr "Ctrl-,") ] } , div @@ -117,7 +117,7 @@ menuBar inav settings model = |> Maybe.withDefault (href "#") , disabled = inav.next == Nothing , attrs = - [ title ("Next item." ++ keyDescr "Ctrl-.") + [ title (texts.nextItem ++ keyDescr "Ctrl-.") ] } ] @@ -126,7 +126,7 @@ menuBar inav settings model = [ classList [ ( "bg-gray-200 dark:bg-bluegray-600", model.mailOpen ) ] - , title "Send Mail" + , title texts.sendMail , onClick ToggleMail , class S.secondaryBasicButton , href "#" @@ -142,7 +142,7 @@ menuBar inav settings model = title "Close" else - title "Add more files to this item" + title texts.addMoreFiles , onClick AddFilesToggle , class S.secondaryBasicButton , href "#" @@ -154,11 +154,11 @@ menuBar inav settings model = [ class S.primaryButton , href "#" , onClick ConfirmItem - , title "Confirm item metadata" + , title texts.confirmItemMetadata , classList [ ( "hidden", model.item.state /= "created" ) ] ] [ i [ class "fa fa-check mr-2" ] [] - , text "Confirm" + , text texts.confirm ] ] , end = @@ -167,7 +167,7 @@ menuBar inav settings model = [ class S.secondaryBasicButton , href "#" , onClick UnconfirmItem - , title "Un-confirm item metadata" + , title texts.unconfirmItemMetadata , classList [ ( "hidden", model.item.state == "created" ) ] ] [ i [ class "fa fa-eye-slash font-thin" ] [] @@ -177,7 +177,7 @@ menuBar inav settings model = [ class S.secondaryBasicButton , href "#" , onClick RequestReprocessItem - , title "Reprocess this item" + , title texts.reprocessItem ] [ i [ class "fa fa-redo" ] [] ] @@ -186,7 +186,7 @@ menuBar inav settings model = [ class S.deleteButton , href "#" , onClick RequestDelete - , title "Delete this item" + , title texts.deleteThisItem ] [ i [ class "fa fa-trash" ] [] ] @@ -199,17 +199,17 @@ body : Texts -> ItemNav -> UiSettings -> Model -> Html Msg body texts _ settings model = div [ class "grid gap-2 grid-cols-1 md:grid-cols-3 h-full" ] [ leftArea texts settings model - , rightArea settings model + , rightArea texts settings model ] leftArea : Texts -> UiSettings -> Model -> Html Msg leftArea texts settings model = div [ class "w-full md:order-first md:mr-2 flex flex-col" ] - [ addDetailForm settings model - , sendMailForm settings model + [ addDetailForm texts settings model + , sendMailForm texts settings model , Comp.ItemDetail.AddFilesForm.view texts.addFilesForm model - , Comp.ItemDetail.Notes.view model + , Comp.ItemDetail.Notes.view texts.notes model , div [ classList [ ( "hidden", Comp.SentMails.isEmpty model.sentMails ) @@ -217,29 +217,29 @@ leftArea texts settings model = , class "mt-4 " ] [ h3 [ class "flex flex-row items-center border-b dark:border-bluegray-600 font-bold text-lg" ] - [ text "Sent E-Mails" + [ text texts.sentEmails ] - , Html.map SentMailsMsg (Comp.SentMails.view2 model.sentMails) + , Html.map SentMailsMsg (Comp.SentMails.view2 texts.sentMails model.sentMails) ] , div [ class "flex-grow" ] [] - , itemIdInfo model + , itemIdInfo texts model ] -rightArea : UiSettings -> Model -> Html Msg -rightArea settings model = +rightArea : Texts -> UiSettings -> Model -> Html Msg +rightArea texts settings model = div [ class "md:col-span-2 h-full" ] - (attachmentsBody settings model) + (attachmentsBody texts settings model) -attachmentsBody : UiSettings -> Model -> List (Html Msg) -attachmentsBody settings model = - List.indexedMap (Comp.ItemDetail.SingleAttachment.view settings model) +attachmentsBody : Texts -> UiSettings -> Model -> List (Html Msg) +attachmentsBody texts settings model = + List.indexedMap (Comp.ItemDetail.SingleAttachment.view texts.singleAttachment settings model) model.item.attachments -sendMailForm : UiSettings -> Model -> Html Msg -sendMailForm settings model = +sendMailForm : Texts -> UiSettings -> Model -> Html Msg +sendMailForm texts settings model = div [ classList [ ( "hidden", not model.mailOpen ) @@ -248,10 +248,10 @@ sendMailForm settings model = , class "mb-4 px-2 py-2" ] [ div [ class "text-lg font-bold" ] - [ text "Send this item via E-Mail" + [ text texts.sendThisItemViaEmail ] , B.loadingDimmer model.mailSending - , Html.map ItemMailMsg (Comp.ItemMail.view2 settings model.itemMail) + , Html.map ItemMailMsg (Comp.ItemMail.view2 texts.itemMail settings model.itemMail) , div [ classList [ ( S.errorMessage @@ -274,26 +274,26 @@ sendMailForm settings model = ] -itemIdInfo : Model -> Html msg -itemIdInfo model = +itemIdInfo : Texts -> Model -> Html msg +itemIdInfo texts model = div [ class "flex flex-col opacity-50 text-xs pb-1 mt-3 border-t dark:border-bluegray-600" ] [ div [ class "inline-flex items-center" - , title "Item ID" + , title texts.itemId ] [ i [ class "fa fa-bullseye mr-2" ] [] , text model.item.id ] , div [ class "inline-flex items-center" - , title "Created on" + , title texts.createdOn ] [ i [ class "fa fa-sun font-thin mr-2" ] [] , Util.Time.formatDateTime model.item.created |> text ] , div [ class "inline-flex items-center" - , title "Last update on" + , title texts.lastUpdateOn ] [ i [ class "fa fa-pencil-alt mr-2" ] [] , Util.Time.formatDateTime model.item.updated |> text @@ -301,8 +301,8 @@ itemIdInfo model = ] -addDetailForm : UiSettings -> Model -> Html Msg -addDetailForm settings model = +addDetailForm : Texts -> UiSettings -> Model -> Html Msg +addDetailForm texts settings model = case model.modalEdit of Just mm -> div @@ -310,7 +310,7 @@ addDetailForm settings model = , class S.box ] [ Comp.DetailEdit.formHeading S.header3 mm - , Html.map ModalEditMsg (Comp.DetailEdit.view2 [] settings mm) + , Html.map ModalEditMsg (Comp.DetailEdit.view2 texts.detailEdit [] settings mm) ] Nothing -> diff --git a/modules/webapp/src/main/elm/Comp/ItemMail.elm b/modules/webapp/src/main/elm/Comp/ItemMail.elm index ad8db394..a656a42e 100644 --- a/modules/webapp/src/main/elm/Comp/ItemMail.elm +++ b/modules/webapp/src/main/elm/Comp/ItemMail.elm @@ -23,6 +23,7 @@ import Html exposing (..) import Html.Attributes exposing (..) import Html.Events exposing (onClick, onInput) import Http +import Messages.ItemMailComp exposing (Texts) import Styles as S import Util.Http @@ -218,15 +219,15 @@ isValid model = --- View2 -view2 : UiSettings -> Model -> Html Msg -view2 settings model = +view2 : Texts -> UiSettings -> Model -> Html Msg +view2 texts settings model = let dds = Data.DropdownStyle.mainStyle connectionCfg = { makeOption = \a -> { text = a, additional = "" } - , placeholder = "Select connection..." + , placeholder = texts.selectConnection , labelColor = \_ -> \_ -> "" , style = dds } @@ -236,10 +237,15 @@ view2 settings model = ] [ div [ class "mb-4" ] [ label [ class S.inputLabel ] - [ text "Send via" + [ text texts.sendVia , B.inputRequired ] - , Html.map ConnMsg (Comp.Dropdown.view2 connectionCfg settings model.connectionModel) + , Html.map ConnMsg + (Comp.Dropdown.view2 + connectionCfg + settings + model.connectionModel + ) ] , div [ class S.errorMessage @@ -251,38 +257,38 @@ view2 settings model = [ label [ class S.inputLabel ] - [ text "Recipient(s)" + [ text texts.recipients , B.inputRequired ] , Html.map RecipientMsg - (Comp.EmailInput.view2 { style = dds, placeholder = "Recipient(s)..." } + (Comp.EmailInput.view2 { style = dds, placeholder = appendDots texts.recipients } model.recipients model.recipientsModel ) ] , div [ class "mb-4" ] [ label [ class S.inputLabel ] - [ text "CC(s)" + [ text texts.ccRecipients ] , Html.map CCRecipientMsg - (Comp.EmailInput.view2 { style = dds, placeholder = "CC recipient(s)..." } + (Comp.EmailInput.view2 { style = dds, placeholder = appendDots texts.ccRecipients } model.ccRecipients model.ccRecipientsModel ) ] , div [ class "mb-4" ] [ label [ class S.inputLabel ] - [ text "BCC(s)" + [ text texts.bccRecipients ] , Html.map BCCRecipientMsg - (Comp.EmailInput.view2 { style = dds, placeholder = "BCC recipient(s)..." } + (Comp.EmailInput.view2 { style = dds, placeholder = appendDots texts.bccRecipients } model.bccRecipients model.bccRecipientsModel ) ] , div [ class "mb-4" ] [ label [ class S.inputLabel ] - [ text "Subject" + [ text texts.subject , B.inputRequired ] , input @@ -295,7 +301,7 @@ view2 settings model = ] , div [ class "mb-4" ] [ label [ class S.inputLabel ] - [ text "Body" + [ text texts.body , B.inputRequired ] , textarea @@ -308,7 +314,7 @@ view2 settings model = , MB.viewItem <| MB.Checkbox { tagger = \_ -> ToggleAttachAll - , label = "Include all item attachments" + , label = texts.includeAllAttachments , value = model.attachAll , id = "item-send-mail-attach-all" } @@ -321,7 +327,7 @@ view2 settings model = , disabled = not (isValid model) } , B.secondaryButton - { label = "Cancel" + { label = texts.basics.cancel , icon = "fa fa-times" , handler = onClick Cancel , attrs = [ href "#" ] @@ -329,3 +335,8 @@ view2 settings model = } ] ] + + +appendDots : String -> String +appendDots name = + name ++ "…" diff --git a/modules/webapp/src/main/elm/Comp/MarkdownInput.elm b/modules/webapp/src/main/elm/Comp/MarkdownInput.elm index 9209d739..8254d325 100644 --- a/modules/webapp/src/main/elm/Comp/MarkdownInput.elm +++ b/modules/webapp/src/main/elm/Comp/MarkdownInput.elm @@ -68,48 +68,48 @@ viewContent2 txt model = splitDisplay2 txt -viewEditLink2 : (Bool -> Attribute Msg) -> Model -> Html Msg -viewEditLink2 classes model = +viewEditLink2 : String -> (Bool -> Attribute Msg) -> Model -> Html Msg +viewEditLink2 label classes model = a [ onClick (SetDisplay Edit) , classes (model.display == Edit) , href "#" ] - [ text "Edit" + [ text label ] -viewPreviewLink2 : (Bool -> Attribute Msg) -> Model -> Html Msg -viewPreviewLink2 classes model = +viewPreviewLink2 : String -> (Bool -> Attribute Msg) -> Model -> Html Msg +viewPreviewLink2 label classes model = a [ onClick (SetDisplay Preview) , classes (model.display == Preview) , href "#" ] - [ text "Preview" + [ text label ] -viewSplitLink2 : (Bool -> Attribute Msg) -> Model -> Html Msg -viewSplitLink2 classes model = +viewSplitLink2 : String -> (Bool -> Attribute Msg) -> Model -> Html Msg +viewSplitLink2 label classes model = a [ onClick (SetDisplay Split) , classes (model.display == Split) , href "#" ] - [ text "Split" + [ text label ] -viewCheatLink2 : String -> Model -> Html msg -viewCheatLink2 classes model = +viewCheatLink2 : String -> String -> Model -> Html msg +viewCheatLink2 label classes model = a [ class classes , target "_new" , href model.cheatSheetUrl ] [ i [ class "fa fa-question mr-2" ] [] - , text "Supports Markdown" + , text label ] diff --git a/modules/webapp/src/main/elm/Comp/NotificationForm.elm b/modules/webapp/src/main/elm/Comp/NotificationForm.elm index d053b203..46d34b1f 100644 --- a/modules/webapp/src/main/elm/Comp/NotificationForm.elm +++ b/modules/webapp/src/main/elm/Comp/NotificationForm.elm @@ -612,7 +612,7 @@ view2 texts extraClasses settings model = [ text texts.tagsInclude ] , Html.map TagIncMsg (Comp.Dropdown.view2 - (Util.Tag.tagSettings DS.mainStyle) + (Util.Tag.tagSettings texts.basics.chooseTag DS.mainStyle) settings model.tagInclModel ) @@ -625,7 +625,7 @@ view2 texts extraClasses settings model = [ text texts.tagsExclude ] , Html.map TagExcMsg (Comp.Dropdown.view2 - (Util.Tag.tagSettings DS.mainStyle) + (Util.Tag.tagSettings texts.basics.chooseTag DS.mainStyle) settings model.tagExclModel ) diff --git a/modules/webapp/src/main/elm/Comp/ScanMailboxForm.elm b/modules/webapp/src/main/elm/Comp/ScanMailboxForm.elm index 3a1c97d9..0dd02167 100644 --- a/modules/webapp/src/main/elm/Comp/ScanMailboxForm.elm +++ b/modules/webapp/src/main/elm/Comp/ScanMailboxForm.elm @@ -1108,7 +1108,7 @@ viewMetadata2 texts flags settings model = [ text texts.basics.tags ] , Html.map TagDropdownMsg (Comp.Dropdown.view2 - (Util.Tag.tagSettings DS.mainStyle) + (Util.Tag.tagSettings texts.basics.chooseTag DS.mainStyle) settings model.tagModel ) diff --git a/modules/webapp/src/main/elm/Comp/SentMails.elm b/modules/webapp/src/main/elm/Comp/SentMails.elm index df28d3c3..bf846162 100644 --- a/modules/webapp/src/main/elm/Comp/SentMails.elm +++ b/modules/webapp/src/main/elm/Comp/SentMails.elm @@ -13,6 +13,7 @@ import Comp.Basic as B import Html exposing (..) import Html.Attributes exposing (..) import Html.Events exposing (onClick) +import Messages.SentMailsComp exposing (Texts) import Styles as S import Util.Time @@ -59,15 +60,15 @@ update msg model = --- View2 -view2 : Model -> Html Msg -view2 model = +view2 : Texts -> Model -> Html Msg +view2 texts model = case model.selected of Just mail -> div [ class "flex flex-col" ] [ div [ class "text-sm flex-flex-col" ] [ div [ class "flex flex-row" ] [ span [ class "font-bold" ] - [ text "From:" + [ text (texts.from ++ ":") ] , div [ class "ml-2" ] [ text mail.sender @@ -78,7 +79,7 @@ view2 model = ] , div [ class "flex flex-row" ] [ span [ class "font-bold" ] - [ text "Date:" + [ text (texts.date ++ ":") ] , div [ class "ml-2" ] [ Util.Time.formatDateTime mail.created |> text @@ -86,7 +87,7 @@ view2 model = ] , div [ class "flex flex-row" ] [ span [ class "font-bold" ] - [ text "Recipients:" + [ text (texts.recipients ++ ":") ] , div [ class "ml-2" ] [ String.join ", " mail.recipients |> text @@ -94,7 +95,7 @@ view2 model = ] , div [ class "flex flex-row" ] [ span [ class "font-bold" ] - [ text "Subject:" + [ text (texts.subject ++ ":") ] , div [ class "ml-2" ] [ text mail.subject @@ -122,10 +123,10 @@ view2 model = [ thead [] [ tr [] [ th [] [] - , th [ class "text-left" ] [ text "Recipients" ] - , th [ class "hidden" ] [ text "Subject" ] - , th [ class "hidden text-center xl:table-cell" ] [ text "Sent" ] - , th [ class "hidden" ] [ text "Sender" ] + , th [ class "text-left" ] [ text texts.recipients ] + , th [ class "hidden" ] [ text texts.subject ] + , th [ class "hidden text-center xl:table-cell" ] [ text texts.sent ] + , th [ class "hidden" ] [ text texts.sender ] ] ] , tbody [] <| diff --git a/modules/webapp/src/main/elm/Comp/SourceForm.elm b/modules/webapp/src/main/elm/Comp/SourceForm.elm index 9ef9003a..3a63a4d9 100644 --- a/modules/webapp/src/main/elm/Comp/SourceForm.elm +++ b/modules/webapp/src/main/elm/Comp/SourceForm.elm @@ -322,7 +322,7 @@ view2 flags texts settings model = } tagCfg = - Util.Tag.tagSettings DS.mainStyle + Util.Tag.tagSettings texts.basics.chooseTag DS.mainStyle languageCfg = { makeOption = diff --git a/modules/webapp/src/main/elm/Messages/Basics.elm b/modules/webapp/src/main/elm/Messages/Basics.elm index aef37b84..9a1f5790 100644 --- a/modules/webapp/src/main/elm/Messages/Basics.elm +++ b/modules/webapp/src/main/elm/Messages/Basics.elm @@ -19,6 +19,7 @@ type alias Texts = , ok : String , yes : String , no : String + , chooseTag : String } @@ -41,6 +42,7 @@ gb = , ok = "Ok" , yes = "Yes" , no = "No" + , chooseTag = "Choose a tag…" } diff --git a/modules/webapp/src/main/elm/Messages/DetailEditComp.elm b/modules/webapp/src/main/elm/Messages/DetailEditComp.elm new file mode 100644 index 00000000..7a6ddeb9 --- /dev/null +++ b/modules/webapp/src/main/elm/Messages/DetailEditComp.elm @@ -0,0 +1,29 @@ +module Messages.DetailEditComp exposing (..) + +import Messages.Basics +import Messages.CustomFieldFormComp +import Messages.EquipmentFormComp +import Messages.OrgFormComp +import Messages.PersonFormComp +import Messages.TagFormComp + + +type alias Texts = + { basics : Messages.Basics.Texts + , tagForm : Messages.TagFormComp.Texts + , personForm : Messages.PersonFormComp.Texts + , orgForm : Messages.OrgFormComp.Texts + , equipmentForm : Messages.EquipmentFormComp.Texts + , customFieldForm : Messages.CustomFieldFormComp.Texts + } + + +gb : Texts +gb = + { basics = Messages.Basics.gb + , tagForm = Messages.TagFormComp.gb + , personForm = Messages.PersonFormComp.gb + , orgForm = Messages.OrgFormComp.gb + , equipmentForm = Messages.EquipmentFormComp.gb + , customFieldForm = Messages.CustomFieldFormComp.gb + } diff --git a/modules/webapp/src/main/elm/Messages/EditFormComp.elm b/modules/webapp/src/main/elm/Messages/EditFormComp.elm new file mode 100644 index 00000000..871c03fb --- /dev/null +++ b/modules/webapp/src/main/elm/Messages/EditFormComp.elm @@ -0,0 +1,65 @@ +module Messages.EditFormComp exposing (..) + +import Messages.Basics + + +type alias Texts = + { basics : Messages.Basics.Texts + , createNewCustomField : String + , chooseDirection : String + , selectPlaceholder : String + , nameTab : String + , dateTab : String + , folderTab : String + , folderNotOwnerWarning : String + , customFieldsTab : String + , dueDateTab : String + , correspondentTab : String + , organization : String + , addNewOrg : String + , editOrg : String + , chooseOrg : String + , addNewCorrespondentPerson : String + , editPerson : String + , personOrgInfo : String + , concerningTab : String + , addNewConcerningPerson : String + , addNewEquipment : String + , editEquipment : String + , directionTab : String + , suggestions : String + } + + +gb : Texts +gb = + { basics = Messages.Basics.gb + , createNewCustomField = "Create new custom field" + , chooseDirection = "Choose a direction…" + , selectPlaceholder = "Select…" + , nameTab = "Name" + , dateTab = "Date" + , 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" + , dueDateTab = "Due Date" + , correspondentTab = "Correspondent" + , organization = "Organization" + , addNewOrg = "Add new organization" + , editOrg = "Edit organization" + , chooseOrg = "Choose an organization" + , addNewCorrespondentPerson = "Add new correspondent person" + , editPerson = "Edit person" + , personOrgInfo = "The selected person doesn't belong to the selected organization." + , concerningTab = "Concerning" + , addNewConcerningPerson = "Add new concerning person" + , addNewEquipment = "Add new equipment" + , editEquipment = "Edit equipment" + , directionTab = "Direction" + , suggestions = "Suggestions" + } diff --git a/modules/webapp/src/main/elm/Messages/FixedDropdown.elm b/modules/webapp/src/main/elm/Messages/FixedDropdown.elm deleted file mode 100644 index 32f7e983..00000000 --- a/modules/webapp/src/main/elm/Messages/FixedDropdown.elm +++ /dev/null @@ -1,22 +0,0 @@ -module Messages.FixedDropdown exposing - ( Texts - , de - , gb - ) - - -type alias Texts = - { select : String - } - - -gb : Texts -gb = - { select = "Select…" - } - - -de : Texts -de = - { select = "Auswahl…" - } diff --git a/modules/webapp/src/main/elm/Messages/ItemDetail/AddFilesForm.elm b/modules/webapp/src/main/elm/Messages/ItemDetail/AddFilesForm.elm index ec4e0b47..66e18079 100644 --- a/modules/webapp/src/main/elm/Messages/ItemDetail/AddFilesForm.elm +++ b/modules/webapp/src/main/elm/Messages/ItemDetail/AddFilesForm.elm @@ -1,12 +1,27 @@ module Messages.ItemDetail.AddFilesForm exposing (..) +import Messages.Basics import Messages.DropzoneComp type alias Texts = - { dropzone : Messages.DropzoneComp.Texts } + { dropzone : Messages.DropzoneComp.Texts + , basics : Messages.Basics.Texts + , addMoreFilesToItem : String + , reset : String + , filesSubmittedInfo : String + , refreshNow : String + } gb : Texts gb = - { dropzone = Messages.DropzoneComp.gb } + { dropzone = Messages.DropzoneComp.gb + , basics = Messages.Basics.gb + , addMoreFilesToItem = "Add more files to this item" + , reset = "Reset" + , filesSubmittedInfo = + "All files have been uploaded. They are being processed, some data " + ++ "may not be available immediately. " + , refreshNow = "Refresh now" + } diff --git a/modules/webapp/src/main/elm/Messages/ItemDetailComp.elm b/modules/webapp/src/main/elm/Messages/ItemDetailComp.elm index 30e17929..715badec 100644 --- a/modules/webapp/src/main/elm/Messages/ItemDetailComp.elm +++ b/modules/webapp/src/main/elm/Messages/ItemDetailComp.elm @@ -1,14 +1,64 @@ module Messages.ItemDetailComp exposing (..) +import Messages.DetailEditComp import Messages.ItemDetail.AddFilesForm +import Messages.ItemInfoHeaderComp +import Messages.ItemMailComp +import Messages.NotesComp +import Messages.SentMailsComp +import Messages.SingleAttachmentComp type alias Texts = { addFilesForm : Messages.ItemDetail.AddFilesForm.Texts + , itemInfoHeader : Messages.ItemInfoHeaderComp.Texts + , singleAttachment : Messages.SingleAttachmentComp.Texts + , sentMails : Messages.SentMailsComp.Texts + , notes : Messages.NotesComp.Texts + , itemMail : Messages.ItemMailComp.Texts + , detailEdit : Messages.DetailEditComp.Texts + , key : String + , backToSearchResults : String + , previousItem : String + , nextItem : String + , sendMail : String + , addMoreFiles : String + , confirmItemMetadata : String + , confirm : String + , unconfirmItemMetadata : String + , reprocessItem : String + , deleteThisItem : String + , sentEmails : String + , sendThisItemViaEmail : String + , itemId : String + , createdOn : String + , lastUpdateOn : String } gb : Texts gb = { addFilesForm = Messages.ItemDetail.AddFilesForm.gb + , itemInfoHeader = Messages.ItemInfoHeaderComp.gb + , singleAttachment = Messages.SingleAttachmentComp.gb + , sentMails = Messages.SentMailsComp.gb + , notes = Messages.NotesComp.gb + , itemMail = Messages.ItemMailComp.gb + , detailEdit = Messages.DetailEditComp.gb + , key = "Key" + , backToSearchResults = "Back to search results" + , previousItem = "Previous item." + , nextItem = "Next item." + , sendMail = "Send Mail" + , addMoreFiles = "Add more files to this item" + , confirmItemMetadata = "Confirm item metadata" + , confirm = "Confirm" + , unconfirmItemMetadata = "Un-confirm item metadata" + , reprocessItem = "Reprocess this item" + , deleteThisItem = "Delete this item" + , sentEmails = "Sent E-Mails" + , sendThisItemViaEmail = "Send this item via E-Mail" + , itemId = "Item ID" + , createdOn = "Created on" + , lastUpdateOn = "Last update on" } diff --git a/modules/webapp/src/main/elm/Messages/ItemDetailPage.elm b/modules/webapp/src/main/elm/Messages/ItemDetailPage.elm index 0b8e43bd..ea1fbda3 100644 --- a/modules/webapp/src/main/elm/Messages/ItemDetailPage.elm +++ b/modules/webapp/src/main/elm/Messages/ItemDetailPage.elm @@ -1,18 +1,23 @@ module Messages.ItemDetailPage exposing (..) +import Messages.EditFormComp import Messages.ItemDetailComp type alias Texts = { itemDetail : Messages.ItemDetailComp.Texts + , editForm : Messages.EditFormComp.Texts , editMetadata : String + , collapseExpand : String } gb : Texts gb = { itemDetail = Messages.ItemDetailComp.gb + , editForm = Messages.EditFormComp.gb , editMetadata = "Edit Metadata" + , collapseExpand = "Collapse/Expand" } diff --git a/modules/webapp/src/main/elm/Messages/ItemInfoHeaderComp.elm b/modules/webapp/src/main/elm/Messages/ItemInfoHeaderComp.elm new file mode 100644 index 00000000..3f09358f --- /dev/null +++ b/modules/webapp/src/main/elm/Messages/ItemInfoHeaderComp.elm @@ -0,0 +1,24 @@ +module Messages.ItemInfoHeaderComp exposing (..) + + +type alias Texts = + { itemDate : String + , dueDate : String + , correspondent : String + , concerning : String + , folder : String + , source : String + , new : String + } + + +gb : Texts +gb = + { itemDate = "Item Date" + , dueDate = "Due Date" + , correspondent = "Correspondent" + , concerning = "Concerning" + , folder = "Folder" + , source = "Source" + , new = "New" + } diff --git a/modules/webapp/src/main/elm/Messages/ItemMailComp.elm b/modules/webapp/src/main/elm/Messages/ItemMailComp.elm new file mode 100644 index 00000000..4ebfc3b0 --- /dev/null +++ b/modules/webapp/src/main/elm/Messages/ItemMailComp.elm @@ -0,0 +1,30 @@ +module Messages.ItemMailComp exposing (..) + +import Messages.Basics + + +type alias Texts = + { basics : Messages.Basics.Texts + , selectConnection : String + , sendVia : String + , recipients : String + , ccRecipients : String + , bccRecipients : String + , subject : String + , body : String + , includeAllAttachments : String + } + + +gb : Texts +gb = + { basics = Messages.Basics.gb + , selectConnection = "Select connection..." + , sendVia = "Send via" + , recipients = "Recipient(s)" + , ccRecipients = "CC recipient(s)" + , bccRecipients = "BCC recipient(s)..." + , subject = "Subject" + , body = "Body" + , includeAllAttachments = "Include all item attachments" + } diff --git a/modules/webapp/src/main/elm/Messages/NotesComp.elm b/modules/webapp/src/main/elm/Messages/NotesComp.elm new file mode 100644 index 00000000..8ab60e8a --- /dev/null +++ b/modules/webapp/src/main/elm/Messages/NotesComp.elm @@ -0,0 +1,20 @@ +module Messages.NotesComp exposing (..) + +import Messages.Basics + + +type alias Texts = + { basics : Messages.Basics.Texts + , notes : String + , preview : String + , supportsMarkdown : String + } + + +gb : Texts +gb = + { basics = Messages.Basics.gb + , notes = "Notes" + , preview = "Preview" + , supportsMarkdown = "Supports Markdown" + } diff --git a/modules/webapp/src/main/elm/Messages/SentMailsComp.elm b/modules/webapp/src/main/elm/Messages/SentMailsComp.elm new file mode 100644 index 00000000..6f68bc65 --- /dev/null +++ b/modules/webapp/src/main/elm/Messages/SentMailsComp.elm @@ -0,0 +1,22 @@ +module Messages.SentMailsComp exposing (..) + + +type alias Texts = + { from : String + , date : String + , recipients : String + , subject : String + , sent : String + , sender : String + } + + +gb : Texts +gb = + { from = "From" + , date = "Date" + , recipients = "Recipients" + , subject = "Subject" + , sent = "Sent" + , sender = "Sender" + } diff --git a/modules/webapp/src/main/elm/Messages/SingleAttachmentComp.elm b/modules/webapp/src/main/elm/Messages/SingleAttachmentComp.elm new file mode 100644 index 00000000..f044d653 --- /dev/null +++ b/modules/webapp/src/main/elm/Messages/SingleAttachmentComp.elm @@ -0,0 +1,30 @@ +module Messages.SingleAttachmentComp exposing (..) + + +type alias Texts = + { noName : String + , openFileInNewTab : String + , downloadFile : String + , renameFile : String + , downloadOriginalArchiveFile : String + , originalFile : String + , renderPdfByBrowser : String + , viewExtractedData : String + , reprocessFile : String + , deleteThisFile : String + } + + +gb : Texts +gb = + { noName = "No name" + , openFileInNewTab = "Open file in new tab" + , downloadFile = "Download file" + , renameFile = "Rename file" + , downloadOriginalArchiveFile = "Download original archive" + , originalFile = "Original file" + , renderPdfByBrowser = "Render pdf by browser" + , viewExtractedData = "View extracted data" + , reprocessFile = "Re-process this file" + , deleteThisFile = "Delete this file" + } diff --git a/modules/webapp/src/main/elm/Page/ItemDetail/View2.elm b/modules/webapp/src/main/elm/Page/ItemDetail/View2.elm index 30fb3371..e3d4b3d9 100644 --- a/modules/webapp/src/main/elm/Page/ItemDetail/View2.elm +++ b/modules/webapp/src/main/elm/Page/ItemDetail/View2.elm @@ -40,7 +40,7 @@ viewSidebar texts visible flags settings model = , disabled = model.detail.item.state == "created" , handler = onClick (ItemDetailMsg Comp.ItemDetail.Model.ToggleOpenAllAkkordionTabs) , attrs = - [ title "Collapse/Expand" + [ title texts.collapseExpand , href "#" ] } @@ -49,7 +49,7 @@ viewSidebar texts visible flags settings model = , rootClasses = "text-sm mb-3 " } , Html.map ItemDetailMsg - (Comp.ItemDetail.EditForm.view2 flags settings model.detail) + (Comp.ItemDetail.EditForm.view2 texts.editForm flags settings model.detail) ] diff --git a/modules/webapp/src/main/elm/Util/Tag.elm b/modules/webapp/src/main/elm/Util/Tag.elm index 753adf34..583f3f0a 100644 --- a/modules/webapp/src/main/elm/Util/Tag.elm +++ b/modules/webapp/src/main/elm/Util/Tag.elm @@ -21,14 +21,14 @@ makeDropdownModel = } -tagSettings : DS.DropdownStyle -> Comp.Dropdown.ViewSettings Tag -tagSettings ds = +tagSettings : String -> DS.DropdownStyle -> Comp.Dropdown.ViewSettings Tag +tagSettings placeholder ds = { makeOption = \tag -> { text = tag.name, additional = "" } , labelColor = \tag -> \settings -> Data.UiSettings.tagColorString2 tag settings - , placeholder = "Choose a tag…" + , placeholder = placeholder , style = ds } @@ -41,11 +41,11 @@ makeCatDropdownModel = } -catSettings : DS.DropdownStyle -> Comp.Dropdown.ViewSettings String -catSettings ds = +catSettings : String -> DS.DropdownStyle -> Comp.Dropdown.ViewSettings String +catSettings placeholder ds = { makeOption = \cat -> { text = cat, additional = "" } , labelColor = \_ -> \_ -> "" - , placeholder = "Choose a tag category…" + , placeholder = placeholder , style = ds }