Externalize strings in detail page

This commit is contained in:
Eike Kettner
2021-04-07 01:09:58 +02:00
parent 1762e7afac
commit 2f678aca17
30 changed files with 554 additions and 254 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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" ] []
]
]

View File

@ -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
)

View File

@ -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
]
]
]

View File

@ -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
]
]

View File

@ -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 =

View File

@ -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 ->