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

@ -47,11 +47,7 @@ import Html exposing (..)
import Html.Attributes exposing (..) import Html.Attributes exposing (..)
import Html.Events exposing (onClick) import Html.Events exposing (onClick)
import Http import Http
import Messages.CustomFieldFormComp import Messages.DetailEditComp exposing (Texts)
import Messages.EquipmentFormComp
import Messages.OrgFormComp
import Messages.PersonFormComp
import Messages.TagFormComp
import Styles as S import Styles as S
import Util.Http import Util.Http
@ -644,10 +640,10 @@ update flags msg model =
--- View2 --- View2
view2 : List (Attribute Msg) -> UiSettings -> Model -> Html Msg view2 : Texts -> List (Attribute Msg) -> UiSettings -> Model -> Html Msg
view2 attr settings model = view2 texts attr settings model =
div attr div attr
(viewIntern2 settings True model) (viewIntern2 texts settings True model)
formHeading : String -> Model -> Html msg formHeading : String -> Model -> Html msg
@ -673,8 +669,8 @@ formHeading classes model =
] ]
viewModal2 : UiSettings -> Maybe Model -> Html Msg viewModal2 : Texts -> UiSettings -> Maybe Model -> Html Msg
viewModal2 settings mm = viewModal2 texts settings mm =
let let
hidden = hidden =
mm == Nothing mm == Nothing
@ -715,7 +711,7 @@ viewModal2 settings mm =
, div [ class "scrolling content" ] , div [ class "scrolling content" ]
(case mm of (case mm of
Just model -> Just model ->
viewIntern2 settings False model viewIntern2 texts settings False model
Nothing -> Nothing ->
[] []
@ -723,7 +719,7 @@ viewModal2 settings mm =
, div [ class "flex flex-row space-x-2" ] , div [ class "flex flex-row space-x-2" ]
(case mm of (case mm of
Just model -> Just model ->
viewButtons2 model viewButtons2 texts model
Nothing -> Nothing ->
[] []
@ -732,10 +728,10 @@ viewModal2 settings mm =
] ]
viewButtons2 : Model -> List (Html Msg) viewButtons2 : Texts -> Model -> List (Html Msg)
viewButtons2 model = viewButtons2 texts model =
[ B.primaryButton [ B.primaryButton
{ label = "Submit" { label = texts.basics.submit
, icon = , icon =
if model.submitting || model.loading then if model.submitting || model.loading then
"fa fa-circle-notch animate-spin" "fa fa-circle-notch animate-spin"
@ -747,7 +743,7 @@ viewButtons2 model =
, attrs = [ href "#" ] , attrs = [ href "#" ]
} }
, B.secondaryButton , B.secondaryButton
{ label = "Cancel" { label = texts.basics.cancel
, handler = onClick Cancel , handler = onClick Cancel
, disabled = False , disabled = False
, icon = "fa fa-times" , icon = "fa fa-times"
@ -756,8 +752,8 @@ viewButtons2 model =
] ]
viewIntern2 : UiSettings -> Bool -> Model -> List (Html Msg) viewIntern2 : Texts -> UiSettings -> Bool -> Model -> List (Html Msg)
viewIntern2 settings withButtons model = viewIntern2 texts settings withButtons model =
[ div [ div
[ classList [ classList
[ ( S.errorMessage, Maybe.map .success model.result == Just False ) [ ( S.errorMessage, Maybe.map .success model.result == Just False )
@ -771,25 +767,25 @@ viewIntern2 settings withButtons model =
] ]
, case model.form of , case model.form of
TM tm -> TM tm ->
Html.map TagMsg (Comp.TagForm.view2 Messages.TagFormComp.gb tm) Html.map TagMsg (Comp.TagForm.view2 texts.tagForm tm)
PMR pm -> 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 -> 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 -> 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 -> EM em ->
Html.map EquipMsg (Comp.EquipmentForm.view2 Messages.EquipmentFormComp.gb em) Html.map EquipMsg (Comp.EquipmentForm.view2 texts.equipmentForm em)
CFM fm -> CFM fm ->
div [] div []
(List.map (Html.map CustomFieldMsg) (List.map (Html.map CustomFieldMsg)
(Comp.CustomFieldForm.view2 (Comp.CustomFieldForm.view2
Messages.CustomFieldFormComp.gb texts.customFieldForm
{ classes = "" { classes = ""
, showControls = False , showControls = False
} }
@ -799,7 +795,7 @@ viewIntern2 settings withButtons model =
] ]
++ (if withButtons then ++ (if withButtons then
[ div [ class "flex flex-row space-x-2" ] [ div [ class "flex flex-row space-x-2" ]
(viewButtons2 model) (viewButtons2 texts model)
] ]
else else

View File

@ -25,7 +25,7 @@ view texts model =
, class S.box , class S.box
] ]
[ div [ class "text-lg font-bold" ] [ div [ class "text-lg font-bold" ]
[ text "Add more files to this item" [ text texts.addMoreFilesToItem
] ]
, Html.map AddFilesMsg , Html.map AddFilesMsg
(Comp.Dropzone.view2 texts.dropzone model.addFilesModel) (Comp.Dropzone.view2 texts.dropzone model.addFilesModel)
@ -35,14 +35,14 @@ view texts model =
, href "#" , href "#"
, onClick AddFilesSubmitUpload , onClick AddFilesSubmitUpload
] ]
[ text "Submit" [ text texts.basics.submit
] ]
, button , button
[ class S.secondaryButton [ class S.secondaryButton
, href "#" , href "#"
, onClick AddFilesReset , onClick AddFilesReset
] ]
[ text "Reset" [ text texts.reset
] ]
] ]
, div , div
@ -52,14 +52,13 @@ view texts model =
] ]
, class "mt-2" , class "mt-2"
] ]
[ text "All files have been uploaded. They are being processed, some data " [ text texts.filesSubmittedInfo
, text "may not be available immediately. "
, a , a
[ class S.successMessageLink [ class S.successMessageLink
, href "#" , href "#"
, onClick ReloadItem , onClick ReloadItem
] ]
[ text "Refresh now" [ text texts.refreshNow
] ]
] ]
, div , div

View File

@ -25,6 +25,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 Markdown import Markdown
import Messages.EditFormComp 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
@ -34,8 +35,8 @@ import Util.Tag
import Util.Time import Util.Time
view2 : Flags -> UiSettings -> Model -> Html Msg view2 : Texts -> Flags -> UiSettings -> Model -> Html Msg
view2 flags settings model = view2 texts flags settings model =
let let
keyAttr = keyAttr =
if settings.itemDetailShortcuts then if settings.itemDetailShortcuts then
@ -48,7 +49,7 @@ view2 flags settings model =
TB.searchMenuStyle TB.searchMenuStyle
tabs = tabs =
formTabs flags settings model formTabs texts flags settings model
allTabNames = allTabNames =
List.map .title tabs List.map .title tabs
@ -61,8 +62,8 @@ view2 flags settings model =
] ]
formTabs : Flags -> UiSettings -> Model -> List (TB.Tab Msg) formTabs : Texts -> Flags -> UiSettings -> Model -> List (TB.Tab Msg)
formTabs flags settings model = formTabs texts flags settings model =
let let
dds = dds =
Data.DropdownStyle.sidebarStyle Data.DropdownStyle.sidebarStyle
@ -100,7 +101,7 @@ formTabs flags settings model =
, classes = "" , classes = ""
, fieldIcon = \f -> Dict.get f.id model.customFieldSavingIcon , fieldIcon = \f -> Dict.get f.id model.customFieldSavingIcon
, style = dds , style = dds
, createCustomFieldTitle = "Create new custom field" , createCustomFieldTitle = texts.createNewCustomField
} }
optional fields html = optional fields html =
@ -119,7 +120,7 @@ formTabs 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 = dds , style = dds
} }
@ -134,19 +135,19 @@ formTabs flags 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
} }
personCfg = personCfg =
{ makeOption = \p -> Util.Person.mkPersonOption p model.allPersons { makeOption = \p -> Util.Person.mkPersonOption p model.allPersons
, labelColor = \_ -> \_ -> "" , labelColor = \_ -> \_ -> ""
, placeholder = "Select" , placeholder = texts.selectPlaceholder
, style = dds , style = dds
} }
in in
[ { name = FTabState.tabName TabName [ { name = FTabState.tabName TabName
, title = "Name" , title = texts.nameTab
, titleRight = [] , titleRight = []
, info = Nothing , info = Nothing
, body = , body =
@ -173,7 +174,7 @@ formTabs flags settings model =
] ]
} }
, { name = FTabState.tabName TabDate , { name = FTabState.tabName TabDate
, title = "Date" , title = texts.dateTab
, titleRight = [] , titleRight = []
, info = Nothing , info = Nothing
, body = , body =
@ -194,18 +195,18 @@ formTabs flags settings model =
] ]
, Icons.dateIcon2 S.dateInputIcon , Icons.dateIcon2 S.dateInputIcon
] ]
, renderItemDateSuggestions model , renderItemDateSuggestions texts model
] ]
] ]
} }
, { name = FTabState.tabName TabTags , { name = FTabState.tabName TabTags
, title = "Tags" , title = texts.basics.tags
, titleRight = [] , titleRight = []
, info = Nothing , info = Nothing
, body = , body =
[ div [ class "mb-4 flex flex-col" ] [ div [ class "mb-4 flex flex-col" ]
[ Html.map TagDropdownMsg [ Html.map TagDropdownMsg
(Comp.Dropdown.view2 (Util.Tag.tagSettings dds) (Comp.Dropdown.view2 (Util.Tag.tagSettings texts.basics.chooseTag dds)
settings settings
model.tagModel model.tagModel
) )
@ -223,7 +224,7 @@ formTabs flags settings model =
] ]
} }
, { name = FTabState.tabName TabFolder , { name = FTabState.tabName TabFolder
, title = "Folder" , title = texts.folderTab
, titleRight = [] , titleRight = []
, info = Nothing , info = Nothing
, body = , body =
@ -240,17 +241,13 @@ formTabs flags 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 = FTabState.tabName TabCustomFields , { name = FTabState.tabName TabCustomFields
, title = "Custom Fields" , title = texts.customFieldsTab
, titleRight = [] , titleRight = []
, info = Nothing , info = Nothing
, body = , body =
@ -264,7 +261,7 @@ item visible. This message will disappear then.
] ]
} }
, { name = FTabState.tabName TabDueDate , { name = FTabState.tabName TabDueDate
, title = "Due Date" , title = texts.dueDateTab
, titleRight = [] , titleRight = []
, info = Nothing , info = Nothing
, body = , body =
@ -285,12 +282,12 @@ item visible. This message will disappear then.
] ]
, Icons.dueDateIcon2 S.dateInputIcon , Icons.dueDateIcon2 S.dateInputIcon
] ]
, renderDueDateSuggestions model , renderDueDateSuggestions texts model
] ]
] ]
} }
, { name = FTabState.tabName TabCorrespondent , { name = FTabState.tabName TabCorrespondent
, title = "Correspondent" , title = texts.correspondentTab
, titleRight = [] , titleRight = []
, info = Nothing , info = Nothing
, body = , body =
@ -298,25 +295,25 @@ item visible. This message will disappear then.
div [ class "mb-4" ] div [ class "mb-4" ]
[ label [ class S.inputLabel ] [ label [ class S.inputLabel ]
[ Icons.organizationIcon2 "mr-2" [ Icons.organizationIcon2 "mr-2"
, text "Organization" , text texts.organization
, addIconLink "Add new organization" StartCorrOrgModal , addIconLink texts.addNewOrg StartCorrOrgModal
, editIconLink "Edit organization" model.corrOrgModel StartEditCorrOrgModal , editIconLink texts.editOrg model.corrOrgModel StartEditCorrOrgModal
] ]
, Html.map OrgDropdownMsg , Html.map OrgDropdownMsg
(Comp.Dropdown.view2 (Comp.Dropdown.view2
(Comp.Dropdown.orgFormViewSettings "Choose an organization" dds) (Comp.Dropdown.orgFormViewSettings texts.chooseOrg dds)
settings settings
model.corrOrgModel model.corrOrgModel
) )
, renderOrgSuggestions model , renderOrgSuggestions texts model
] ]
, 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 "mr-2" [ Icons.personIcon2 "mr-2"
, text "Person" , text "Person"
, addIconLink "Add new correspondent person" StartCorrPersonModal , addIconLink texts.addNewCorrespondentPerson StartCorrPersonModal
, editIconLink "Edit person" , editIconLink texts.editPerson
model.corrPersonModel model.corrPersonModel
(StartEditPersonModal model.corrPersonModel) (StartEditPersonModal model.corrPersonModel)
] ]
@ -325,7 +322,7 @@ item visible. This message will disappear then.
settings settings
model.corrPersonModel model.corrPersonModel
) )
, renderCorrPersonSuggestions model , renderCorrPersonSuggestions texts model
, div , div
[ classList [ classList
[ ( "hidden", personMatchesOrg model ) [ ( "hidden", personMatchesOrg model )
@ -334,13 +331,13 @@ item visible. This message will disappear then.
, class "my-2" , class "my-2"
] ]
[ i [ class "fa fa-info mr-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 , { name = FTabState.tabName TabConcerning
, title = "Concerning" , title = texts.concerningTab
, titleRight = [] , titleRight = []
, info = Nothing , info = Nothing
, body = , body =
@ -349,8 +346,8 @@ item visible. This message will disappear then.
[ label [ class S.inputLabel ] [ label [ class S.inputLabel ]
[ Icons.personIcon2 "mr-2" [ Icons.personIcon2 "mr-2"
, text "Person" , text "Person"
, addIconLink "Add new concerning person" StartConcPersonModal , addIconLink texts.addNewConcerningPerson StartConcPersonModal
, editIconLink "Edit person" , editIconLink texts.editPerson
model.concPersonModel model.concPersonModel
(StartEditPersonModal model.concPersonModel) (StartEditPersonModal model.concPersonModel)
] ]
@ -360,15 +357,15 @@ item visible. This message will disappear then.
settings settings
model.concPersonModel model.concPersonModel
) )
, renderConcPersonSuggestions model , renderConcPersonSuggestions texts model
] ]
, optional [ Data.Fields.ConcEquip ] <| , optional [ Data.Fields.ConcEquip ] <|
div [ class "mb-4" ] div [ class "mb-4" ]
[ label [ class S.inputLabel ] [ label [ class S.inputLabel ]
[ Icons.equipmentIcon2 "mr-2" [ Icons.equipmentIcon2 "mr-2"
, text "Equipment" , text "Equipment"
, addIconLink "Add new equipment" StartEquipModal , addIconLink texts.addNewEquipment StartEquipModal
, editIconLink "Edit equipment" , editIconLink texts.editEquipment
model.concEquipModel model.concEquipModel
StartEditEquipModal StartEditEquipModal
] ]
@ -378,12 +375,12 @@ item visible. This message will disappear then.
settings settings
model.concEquipModel model.concEquipModel
) )
, renderConcEquipSuggestions model , renderConcEquipSuggestions texts model
] ]
] ]
} }
, { name = FTabState.tabName TabDirection , { name = FTabState.tabName TabDirection
, title = "Direction" , title = texts.directionTab
, titleRight = [] , titleRight = []
, info = Nothing , info = Nothing
, body = , body =
@ -400,8 +397,8 @@ item visible. This message will disappear then.
] ]
renderSuggestions : Model -> (a -> String) -> List a -> (a -> Msg) -> Html Msg renderSuggestions : Texts -> Model -> (a -> String) -> List a -> (a -> Msg) -> Html Msg
renderSuggestions model mkName idnames tagger = renderSuggestions texts model mkName idnames tagger =
div div
[ classList [ classList
[ ( "hidden", model.item.state /= "created" ) [ ( "hidden", model.item.state /= "created" )
@ -409,7 +406,7 @@ renderSuggestions model mkName idnames tagger =
, class "flex flex-col text-sm" , class "flex flex-col text-sm"
] ]
[ div [ class "font-bold my-1" ] [ div [ class "font-bold my-1" ]
[ text "Suggestions" [ text texts.suggestions
] ]
, ul [ class "list-disc ml-6" ] <| , ul [ class "list-disc ml-6" ] <|
(idnames (idnames
@ -428,49 +425,55 @@ renderSuggestions model mkName idnames tagger =
] ]
renderOrgSuggestions : Model -> Html Msg renderOrgSuggestions : Texts -> Model -> Html Msg
renderOrgSuggestions model = renderOrgSuggestions texts model =
renderSuggestions model renderSuggestions texts
model
.name .name
(List.take 6 model.itemProposals.corrOrg) (List.take 6 model.itemProposals.corrOrg)
SetCorrOrgSuggestion SetCorrOrgSuggestion
renderCorrPersonSuggestions : Model -> Html Msg renderCorrPersonSuggestions : Texts -> Model -> Html Msg
renderCorrPersonSuggestions model = renderCorrPersonSuggestions texts model =
renderSuggestions model renderSuggestions texts
model
.name .name
(List.take 6 model.itemProposals.corrPerson) (List.take 6 model.itemProposals.corrPerson)
SetCorrPersonSuggestion SetCorrPersonSuggestion
renderConcPersonSuggestions : Model -> Html Msg renderConcPersonSuggestions : Texts -> Model -> Html Msg
renderConcPersonSuggestions model = renderConcPersonSuggestions texts model =
renderSuggestions model renderSuggestions texts
model
.name .name
(List.take 6 model.itemProposals.concPerson) (List.take 6 model.itemProposals.concPerson)
SetConcPersonSuggestion SetConcPersonSuggestion
renderConcEquipSuggestions : Model -> Html Msg renderConcEquipSuggestions : Texts -> Model -> Html Msg
renderConcEquipSuggestions model = renderConcEquipSuggestions texts model =
renderSuggestions model renderSuggestions texts
model
.name .name
(List.take 6 model.itemProposals.concEquipment) (List.take 6 model.itemProposals.concEquipment)
SetConcEquipSuggestion SetConcEquipSuggestion
renderItemDateSuggestions : Model -> Html Msg renderItemDateSuggestions : Texts -> Model -> Html Msg
renderItemDateSuggestions model = renderItemDateSuggestions texts model =
renderSuggestions model renderSuggestions texts
model
Util.Time.formatDate Util.Time.formatDate
(List.take 6 model.itemProposals.itemDate) (List.take 6 model.itemProposals.itemDate)
SetItemDateSuggestion SetItemDateSuggestion
renderDueDateSuggestions : Model -> Html Msg renderDueDateSuggestions : Texts -> Model -> Html Msg
renderDueDateSuggestions model = renderDueDateSuggestions texts model =
renderSuggestions model renderSuggestions texts
model
Util.Time.formatDate Util.Time.formatDate
(List.take 6 model.itemProposals.dueDate) (List.take 6 model.itemProposals.dueDate)
SetDueDateSuggestion 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.CustomFieldMultiInput
import Comp.Tabs as TB import Comp.Tabs as TB
@ -20,6 +20,21 @@ type EditTab
| TabConfirmUnconfirm | TabConfirmUnconfirm
allTabs : List EditTab
allTabs =
[ TabName
, TabDate
, TabTags
, TabFolder
, TabCustomFields
, TabDueDate
, TabCorrespondent
, TabConcerning
, TabDirection
, TabConfirmUnconfirm
]
tabName : EditTab -> String tabName : EditTab -> String
tabName tab = tabName tab =
case tab of case tab of

View File

@ -15,19 +15,20 @@ import Data.Icons as Icons
import Data.UiSettings exposing (UiSettings) import Data.UiSettings exposing (UiSettings)
import Html exposing (..) import Html exposing (..)
import Html.Attributes exposing (..) import Html.Attributes exposing (..)
import Messages.ItemInfoHeaderComp exposing (Texts)
import Page exposing (Page(..)) import Page exposing (Page(..))
import Styles as S import Styles as S
import Util.Maybe import Util.Maybe
import Util.Time import Util.Time
view : UiSettings -> Model -> Html Msg view : Texts -> UiSettings -> Model -> Html Msg
view settings model = view texts settings model =
let let
date = date =
( div ( div
[ class "ml-2 sm:ml-0 whitespace-nowrap py-1 whitespace-nowrap opacity-75" [ class "ml-2 sm:ml-0 whitespace-nowrap py-1 whitespace-nowrap opacity-75"
, title "Item Date" , title texts.itemDate
] ]
[ Icons.dateIcon2 "mr-2" [ Icons.dateIcon2 "mr-2"
, Maybe.withDefault model.item.created model.item.itemDate , Maybe.withDefault model.item.created model.item.itemDate
@ -47,7 +48,7 @@ view settings model =
( div ( div
[ class "ml-2 sm:ml-4 py-1 max-w-min whitespace-nowrap opacity-100" [ class "ml-2 sm:ml-4 py-1 max-w-min whitespace-nowrap opacity-100"
, class S.basicLabel , class S.basicLabel
, title "Due Date" , title texts.dueDate
] ]
[ Icons.dueDateIcon2 "mr-2" [ Icons.dueDateIcon2 "mr-2"
, Maybe.map Util.Time.formatDate model.item.dueDate , Maybe.map Util.Time.formatDate model.item.dueDate
@ -61,7 +62,7 @@ view settings model =
corr = corr =
( div ( div
[ class itemStyle [ class itemStyle
, title "Correspondent" , title texts.correspondent
] ]
(Icons.correspondentIcon2 "mr-2" (Icons.correspondentIcon2 "mr-2"
:: Comp.LinkTarget.makeCorrLink model.item :: Comp.LinkTarget.makeCorrLink model.item
@ -75,7 +76,7 @@ view settings model =
conc = conc =
( div ( div
[ class itemStyle [ class itemStyle
, title "Concerning" , title texts.concerning
] ]
(Icons.concernedIcon2 "mr-2" (Icons.concernedIcon2 "mr-2"
:: Comp.LinkTarget.makeConcLink model.item :: Comp.LinkTarget.makeConcLink model.item
@ -89,7 +90,7 @@ view settings model =
itemfolder = itemfolder =
( div ( div
[ class itemStyle [ class itemStyle
, title "Folder" , title texts.folder
] ]
[ Icons.folderIcon2 "mr-2" [ Icons.folderIcon2 "mr-2"
, Comp.LinkTarget.makeFolderLink model.item , Comp.LinkTarget.makeFolderLink model.item
@ -102,7 +103,7 @@ view settings model =
src = src =
( div ( div
[ class itemStyle [ class itemStyle
, title "Source" , title texts.source
] ]
[ Icons.sourceIcon2 "mr-2" [ Icons.sourceIcon2 "mr-2"
, Comp.LinkTarget.makeSourceLink [ ( linkStyle, True ) ] , 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" , 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" ] [] , i [ class "fa fa-exclamation ml-2" ] []
] ]
] ]

View File

@ -744,7 +744,7 @@ renderEditForm2 texts flags cfg settings model =
] ]
] ]
, Html.map TagDropdownMsg , Html.map TagDropdownMsg
(Comp.Dropdown.view2 (Util.Tag.tagSettings dds) (Comp.Dropdown.view2 (Util.Tag.tagSettings texts.basics.chooseTag dds)
settings settings
model.tagModel model.tagModel
) )

View File

@ -12,19 +12,20 @@ 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.NotesComp exposing (Texts)
import Page exposing (Page(..)) import Page exposing (Page(..))
import Styles as S import Styles as S
import Util.String import Util.String
view : Model -> Html Msg view : Texts -> Model -> Html Msg
view model = view texts model =
case model.notesField of case model.notesField of
ViewNotes -> ViewNotes ->
div [ class "flex flex-col ds-item-detail-notes" ] 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 flex-row items-center border-b dark:border-bluegray-600" ]
[ div [ class "flex-grow font-bold text-lg" ] [ div [ class "flex-grow font-bold text-lg" ]
[ text "Notes" [ text texts.notes
] ]
, div [ class "" ] , div [ class "" ]
[ a [ a
@ -33,7 +34,7 @@ view model =
, href "#" , href "#"
] ]
[ i [ class "fa fa-edit mr-2" ] [] [ 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-col" ]
[ div [ class "flex flex-row items-center" ] [ div [ class "flex flex-row items-center" ]
[ div [ class "font-bold text-lg" ] [ div [ class "font-bold text-lg" ]
[ text "Notes" [ text texts.notes
] ]
, div [ class "flex flex-grow justify-end text-sm" ] , div [ class "flex flex-grow justify-end text-sm" ]
[ Html.map NotesEditMsg [ Html.map NotesEditMsg
(Comp.MarkdownInput.viewEditLink2 classes mm) (Comp.MarkdownInput.viewEditLink2 texts.basics.edit classes mm)
, span [ class "px-3" ] [ text "" ] , span [ class "px-3" ] [ text "" ]
, Html.map NotesEditMsg , Html.map NotesEditMsg
(Comp.MarkdownInput.viewPreviewLink2 classes mm) (Comp.MarkdownInput.viewPreviewLink2 texts.preview classes mm)
] ]
] ]
] ]
@ -73,7 +74,9 @@ view model =
mm mm
) )
, div [ class "text-sm flex justify-end" ] , 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" ] , div [ class "flex flex-row mt-1" ]
[ a [ a
@ -82,7 +85,7 @@ view model =
, onClick SaveNotes , onClick SaveNotes
] ]
[ i [ class "fa fa-save font-thin mr-2" ] [] [ i [ class "fa fa-save font-thin mr-2" ] []
, text "Save" , text texts.basics.submit
] ]
, a , a
[ classList [ classList
@ -94,7 +97,7 @@ view model =
, onClick ToggleEditNotes , onClick ToggleEditNotes
] ]
[ i [ class "fa fa-times mr-2" ] [] [ 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.Attributes exposing (..)
import Html.Events exposing (onClick, onInput) import Html.Events exposing (onClick, onInput)
import Html5.DragDrop as DD import Html5.DragDrop as DD
import Messages.SingleAttachmentComp exposing (Texts)
import Page exposing (Page(..)) import Page exposing (Page(..))
import Styles as S import Styles as S
import Util.Maybe import Util.Maybe
@ -25,8 +26,8 @@ import Util.Size
import Util.String import Util.String
view : UiSettings -> Model -> Int -> Attachment -> Html Msg view : Texts -> UiSettings -> Model -> Int -> Attachment -> Html Msg
view settings model pos attach = view texts settings model pos attach =
let let
fileUrl = fileUrl =
Api.fileURL attach.id Api.fileURL attach.id
@ -42,10 +43,10 @@ view settings model pos attach =
[ class "flex flex-row px-2 py-2 text-sm" [ class "flex flex-row px-2 py-2 text-sm"
, class S.border , class S.border
] ]
[ attachHeader settings model pos attach [ attachHeader texts settings model pos attach
] ]
, editAttachmentName model attach , editAttachmentName model attach
, attachmentSelect model pos attach , attachmentSelect texts model pos attach
, if isAttachMetaOpen model attach.id then , if isAttachMetaOpen model attach.id then
case Dict.get attach.id model.attachMeta of case Dict.get attach.id model.attachMeta of
Just am -> Just am ->
@ -94,11 +95,11 @@ view settings model pos attach =
- native view - native view
-} -}
attachHeader : UiSettings -> Model -> Int -> Attachment -> Html Msg attachHeader : Texts -> UiSettings -> Model -> Int -> Attachment -> Html Msg
attachHeader settings model _ attach = attachHeader texts settings model _ attach =
let let
attachName = attachName =
Maybe.withDefault "No name" attach.name Maybe.withDefault texts.noName attach.name
fileUrl = fileUrl =
Api.fileURL attach.id Api.fileURL attach.id
@ -138,7 +139,7 @@ attachHeader settings model _ attach =
, a , a
[ href fileUrl [ href fileUrl
, target "_new" , target "_new"
, title "Open file in new tab" , title texts.openFileInNewTab
, class S.secondaryBasicButton , class S.secondaryBasicButton
, class "ml-2" , class "ml-2"
] ]
@ -155,21 +156,21 @@ attachHeader settings model _ attach =
, menuOpen = model.attachmentDropdownOpen , menuOpen = model.attachmentDropdownOpen
, items = , items =
[ { icon = "fa fa-download" [ { icon = "fa fa-download"
, label = "Download file" , label = texts.downloadFile
, attrs = , attrs =
[ download attachName [ download attachName
, href fileUrl , href fileUrl
] ]
} }
, { icon = "fa fa-file" , { icon = "fa fa-file"
, label = "Rename file" , label = texts.renameFile
, attrs = , attrs =
[ href "#" [ href "#"
, onClick (EditAttachNameStart attach.id) , onClick (EditAttachNameStart attach.id)
] ]
} }
, { icon = "fa fa-file-archive" , { icon = "fa fa-file-archive"
, label = "Download original archive" , label = texts.downloadOriginalArchiveFile
, attrs = , attrs =
[ href (fileUrl ++ "/archive") [ href (fileUrl ++ "/archive")
, target "_new" , target "_new"
@ -177,7 +178,7 @@ attachHeader settings model _ attach =
] ]
} }
, { icon = "fa fa-external-link-alt" , { icon = "fa fa-external-link-alt"
, label = "Original file" , label = texts.originalFile
, attrs = , attrs =
[ href (fileUrl ++ "/original") [ href (fileUrl ++ "/original")
, target "_new" , target "_new"
@ -190,7 +191,7 @@ attachHeader settings model _ attach =
else else
"fa fa-toggle-off" "fa fa-toggle-off"
, label = "Render pdf by browser" , label = texts.renderPdfByBrowser
, attrs = , attrs =
[ onClick (TogglePdfNativeView settings.nativePdfPreview) [ onClick (TogglePdfNativeView settings.nativePdfPreview)
, href "#" , href "#"
@ -202,21 +203,21 @@ attachHeader settings model _ attach =
else else
"fa fa-toggle-off" "fa fa-toggle-off"
, label = "View extracted data" , label = texts.viewExtractedData
, attrs = , attrs =
[ onClick (AttachMetaClick attach.id) [ onClick (AttachMetaClick attach.id)
, href "#" , href "#"
] ]
} }
, { icon = "fa fa-redo-alt" , { icon = "fa fa-redo-alt"
, label = "Re-process this file" , label = texts.reprocessFile
, attrs = , attrs =
[ onClick (RequestReprocessFile attach.id) [ onClick (RequestReprocessFile attach.id)
, href "#" , href "#"
] ]
} }
, { icon = "fa fa-trash" , { icon = "fa fa-trash"
, label = "Delete this file" , label = texts.deleteThisFile
, attrs = , attrs =
[ onClick (RequestDeleteAttachment attach.id) [ onClick (RequestDeleteAttachment attach.id)
, href "#" , href "#"
@ -279,8 +280,8 @@ editAttachmentName model attach =
span [ class "hidden" ] [] span [ class "hidden" ] []
attachmentSelect : Model -> Int -> Attachment -> Html Msg attachmentSelect : Texts -> Model -> Int -> Attachment -> Html Msg
attachmentSelect model _ _ = attachmentSelect texts model _ _ =
div div
[ class "flex flex-row border-l border-r px-2 py-2 dark:border-bluegray-600 " [ class "flex flex-row border-l border-r px-2 py-2 dark:border-bluegray-600 "
, class "overflow-x-auto overflow-y-none" , class "overflow-x-auto overflow-y-none"
@ -288,11 +289,11 @@ attachmentSelect model _ _ =
[ ( "hidden", not model.attachMenuOpen ) [ ( "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 : Texts -> Model -> Int -> Attachment -> Html Msg
menuItem model pos attach = menuItem texts model pos attach =
let let
highlight = highlight =
let let
@ -342,7 +343,7 @@ menuItem model pos attach =
] ]
, div [ class "mt-1 text-sm break-all w-28 text-center" ] , div [ class "mt-1 text-sm break-all w-28 text-center" ]
[ Maybe.map (Util.String.ellipsis 36) attach.name [ Maybe.map (Util.String.ellipsis 36) attach.name
|> Maybe.withDefault "No Name" |> Maybe.withDefault texts.noName
|> text |> text
] ]
] ]

View File

@ -24,6 +24,7 @@ import Comp.Dropdown exposing (isDropdownChangeMsg)
import Comp.Dropzone import Comp.Dropzone
import Comp.EquipmentForm import Comp.EquipmentForm
import Comp.ItemDetail.EditForm import Comp.ItemDetail.EditForm
import Comp.ItemDetail.FieldTabState as FTabState
import Comp.ItemDetail.Model import Comp.ItemDetail.Model
exposing exposing
( AttachmentRename ( AttachmentRename
@ -1487,8 +1488,7 @@ update key flags inav settings msg model =
ToggleOpenAllAkkordionTabs -> ToggleOpenAllAkkordionTabs ->
let let
allNames = allNames =
Comp.ItemDetail.EditForm.formTabs flags settings model List.map FTabState.tabName FTabState.allTabs
|> List.map .title
|> Set.fromList |> Set.fromList
next = next =

View File

@ -32,8 +32,8 @@ import Util.Time
view : Texts -> ItemNav -> UiSettings -> Model -> Html Msg view : Texts -> ItemNav -> UiSettings -> Model -> Html Msg
view texts inav settings model = view texts inav settings model =
div [ class "flex flex-col h-full" ] div [ class "flex flex-col h-full" ]
[ header settings model [ header texts settings model
, menuBar inav settings model , menuBar texts inav settings model
, body texts inav settings model , body texts inav settings model
, itemModal model , itemModal model
] ]
@ -49,18 +49,18 @@ itemModal model =
span [ class "hidden" ] [] span [ class "hidden" ] []
header : UiSettings -> Model -> Html Msg header : Texts -> UiSettings -> Model -> Html Msg
header settings model = header texts settings model =
div [ class "my-3" ] 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 : Texts -> ItemNav -> UiSettings -> Model -> Html Msg
menuBar inav settings model = menuBar texts inav settings model =
let let
keyDescr name = keyDescr name =
if settings.itemDetailShortcuts && model.menuOpen then if settings.itemDetailShortcuts && model.menuOpen then
" Key '" ++ name ++ "'." " " ++ texts.key ++ "'" ++ name ++ "'."
else else
"" ""
@ -71,7 +71,7 @@ menuBar inav settings model =
a a
[ class S.secondaryBasicButton [ class S.secondaryBasicButton
, Page.href HomePage , Page.href HomePage
, title "Back to search results" , title texts.backToSearchResults
] ]
[ i [ class "fa fa-arrow-left" ] [] [ i [ class "fa fa-arrow-left" ] []
] ]
@ -88,7 +88,7 @@ menuBar inav settings model =
|> Maybe.withDefault (href "#") |> Maybe.withDefault (href "#")
, disabled = inav.prev == Nothing , disabled = inav.prev == Nothing
, attrs = , attrs =
[ title ("Previous item." ++ keyDescr "Ctrl-,") [ title (texts.previousItem ++ keyDescr "Ctrl-,")
] ]
} }
, div , div
@ -117,7 +117,7 @@ menuBar inav settings model =
|> Maybe.withDefault (href "#") |> Maybe.withDefault (href "#")
, disabled = inav.next == Nothing , disabled = inav.next == Nothing
, attrs = , attrs =
[ title ("Next item." ++ keyDescr "Ctrl-.") [ title (texts.nextItem ++ keyDescr "Ctrl-.")
] ]
} }
] ]
@ -126,7 +126,7 @@ menuBar inav settings model =
[ classList [ classList
[ ( "bg-gray-200 dark:bg-bluegray-600", model.mailOpen ) [ ( "bg-gray-200 dark:bg-bluegray-600", model.mailOpen )
] ]
, title "Send Mail" , title texts.sendMail
, onClick ToggleMail , onClick ToggleMail
, class S.secondaryBasicButton , class S.secondaryBasicButton
, href "#" , href "#"
@ -142,7 +142,7 @@ menuBar inav settings model =
title "Close" title "Close"
else else
title "Add more files to this item" title texts.addMoreFiles
, onClick AddFilesToggle , onClick AddFilesToggle
, class S.secondaryBasicButton , class S.secondaryBasicButton
, href "#" , href "#"
@ -154,11 +154,11 @@ menuBar inav settings model =
[ class S.primaryButton [ class S.primaryButton
, href "#" , href "#"
, onClick ConfirmItem , onClick ConfirmItem
, title "Confirm item metadata" , title texts.confirmItemMetadata
, classList [ ( "hidden", model.item.state /= "created" ) ] , classList [ ( "hidden", model.item.state /= "created" ) ]
] ]
[ i [ class "fa fa-check mr-2" ] [] [ i [ class "fa fa-check mr-2" ] []
, text "Confirm" , text texts.confirm
] ]
] ]
, end = , end =
@ -167,7 +167,7 @@ menuBar inav settings model =
[ class S.secondaryBasicButton [ class S.secondaryBasicButton
, href "#" , href "#"
, onClick UnconfirmItem , onClick UnconfirmItem
, title "Un-confirm item metadata" , title texts.unconfirmItemMetadata
, classList [ ( "hidden", model.item.state == "created" ) ] , classList [ ( "hidden", model.item.state == "created" ) ]
] ]
[ i [ class "fa fa-eye-slash font-thin" ] [] [ i [ class "fa fa-eye-slash font-thin" ] []
@ -177,7 +177,7 @@ menuBar inav settings model =
[ class S.secondaryBasicButton [ class S.secondaryBasicButton
, href "#" , href "#"
, onClick RequestReprocessItem , onClick RequestReprocessItem
, title "Reprocess this item" , title texts.reprocessItem
] ]
[ i [ class "fa fa-redo" ] [] [ i [ class "fa fa-redo" ] []
] ]
@ -186,7 +186,7 @@ menuBar inav settings model =
[ class S.deleteButton [ class S.deleteButton
, href "#" , href "#"
, onClick RequestDelete , onClick RequestDelete
, title "Delete this item" , title texts.deleteThisItem
] ]
[ i [ class "fa fa-trash" ] [] [ i [ class "fa fa-trash" ] []
] ]
@ -199,17 +199,17 @@ body : Texts -> ItemNav -> UiSettings -> Model -> Html Msg
body texts _ settings model = body texts _ settings model =
div [ class "grid gap-2 grid-cols-1 md:grid-cols-3 h-full" ] div [ class "grid gap-2 grid-cols-1 md:grid-cols-3 h-full" ]
[ leftArea texts settings model [ leftArea texts settings model
, rightArea settings model , rightArea texts settings model
] ]
leftArea : Texts -> UiSettings -> Model -> Html Msg leftArea : Texts -> UiSettings -> Model -> Html Msg
leftArea texts settings model = leftArea texts settings model =
div [ class "w-full md:order-first md:mr-2 flex flex-col" ] div [ class "w-full md:order-first md:mr-2 flex flex-col" ]
[ addDetailForm settings model [ addDetailForm texts settings model
, sendMailForm settings model , sendMailForm texts settings model
, Comp.ItemDetail.AddFilesForm.view texts.addFilesForm model , Comp.ItemDetail.AddFilesForm.view texts.addFilesForm model
, Comp.ItemDetail.Notes.view model , Comp.ItemDetail.Notes.view texts.notes model
, div , div
[ classList [ classList
[ ( "hidden", Comp.SentMails.isEmpty model.sentMails ) [ ( "hidden", Comp.SentMails.isEmpty model.sentMails )
@ -217,29 +217,29 @@ leftArea texts settings model =
, class "mt-4 " , class "mt-4 "
] ]
[ h3 [ class "flex flex-row items-center border-b dark:border-bluegray-600 font-bold text-lg" ] [ 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" ] [] , div [ class "flex-grow" ] []
, itemIdInfo model , itemIdInfo texts model
] ]
rightArea : UiSettings -> Model -> Html Msg rightArea : Texts -> UiSettings -> Model -> Html Msg
rightArea settings model = rightArea texts settings model =
div [ class "md:col-span-2 h-full" ] div [ class "md:col-span-2 h-full" ]
(attachmentsBody settings model) (attachmentsBody texts settings model)
attachmentsBody : UiSettings -> Model -> List (Html Msg) attachmentsBody : Texts -> UiSettings -> Model -> List (Html Msg)
attachmentsBody settings model = attachmentsBody texts settings model =
List.indexedMap (Comp.ItemDetail.SingleAttachment.view settings model) List.indexedMap (Comp.ItemDetail.SingleAttachment.view texts.singleAttachment settings model)
model.item.attachments model.item.attachments
sendMailForm : UiSettings -> Model -> Html Msg sendMailForm : Texts -> UiSettings -> Model -> Html Msg
sendMailForm settings model = sendMailForm texts settings model =
div div
[ classList [ classList
[ ( "hidden", not model.mailOpen ) [ ( "hidden", not model.mailOpen )
@ -248,10 +248,10 @@ sendMailForm settings model =
, class "mb-4 px-2 py-2" , class "mb-4 px-2 py-2"
] ]
[ div [ class "text-lg font-bold" ] [ div [ class "text-lg font-bold" ]
[ text "Send this item via E-Mail" [ text texts.sendThisItemViaEmail
] ]
, B.loadingDimmer model.mailSending , 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 , div
[ classList [ classList
[ ( S.errorMessage [ ( S.errorMessage
@ -274,26 +274,26 @@ sendMailForm settings model =
] ]
itemIdInfo : Model -> Html msg itemIdInfo : Texts -> Model -> Html msg
itemIdInfo model = itemIdInfo texts model =
div [ class "flex flex-col opacity-50 text-xs pb-1 mt-3 border-t dark:border-bluegray-600" ] div [ class "flex flex-col opacity-50 text-xs pb-1 mt-3 border-t dark:border-bluegray-600" ]
[ div [ div
[ class "inline-flex items-center" [ class "inline-flex items-center"
, title "Item ID" , title texts.itemId
] ]
[ i [ class "fa fa-bullseye mr-2" ] [] [ i [ class "fa fa-bullseye mr-2" ] []
, text model.item.id , text model.item.id
] ]
, div , div
[ class "inline-flex items-center" [ class "inline-flex items-center"
, title "Created on" , title texts.createdOn
] ]
[ i [ class "fa fa-sun font-thin mr-2" ] [] [ i [ class "fa fa-sun font-thin mr-2" ] []
, Util.Time.formatDateTime model.item.created |> text , Util.Time.formatDateTime model.item.created |> text
] ]
, div , div
[ class "inline-flex items-center" [ class "inline-flex items-center"
, title "Last update on" , title texts.lastUpdateOn
] ]
[ i [ class "fa fa-pencil-alt mr-2" ] [] [ i [ class "fa fa-pencil-alt mr-2" ] []
, Util.Time.formatDateTime model.item.updated |> text , Util.Time.formatDateTime model.item.updated |> text
@ -301,8 +301,8 @@ itemIdInfo model =
] ]
addDetailForm : UiSettings -> Model -> Html Msg addDetailForm : Texts -> UiSettings -> Model -> Html Msg
addDetailForm settings model = addDetailForm texts settings model =
case model.modalEdit of case model.modalEdit of
Just mm -> Just mm ->
div div
@ -310,7 +310,7 @@ addDetailForm settings model =
, class S.box , class S.box
] ]
[ Comp.DetailEdit.formHeading S.header3 mm [ 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 -> Nothing ->

View File

@ -23,6 +23,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.ItemMailComp exposing (Texts)
import Styles as S import Styles as S
import Util.Http import Util.Http
@ -218,15 +219,15 @@ isValid model =
--- View2 --- View2
view2 : UiSettings -> Model -> Html Msg view2 : Texts -> UiSettings -> Model -> Html Msg
view2 settings model = view2 texts settings model =
let let
dds = dds =
Data.DropdownStyle.mainStyle Data.DropdownStyle.mainStyle
connectionCfg = connectionCfg =
{ makeOption = \a -> { text = a, additional = "" } { makeOption = \a -> { text = a, additional = "" }
, placeholder = "Select connection..." , placeholder = texts.selectConnection
, labelColor = \_ -> \_ -> "" , labelColor = \_ -> \_ -> ""
, style = dds , style = dds
} }
@ -236,10 +237,15 @@ view2 settings model =
] ]
[ div [ class "mb-4" ] [ div [ class "mb-4" ]
[ label [ class S.inputLabel ] [ label [ class S.inputLabel ]
[ text "Send via" [ text texts.sendVia
, B.inputRequired , B.inputRequired
] ]
, Html.map ConnMsg (Comp.Dropdown.view2 connectionCfg settings model.connectionModel) , Html.map ConnMsg
(Comp.Dropdown.view2
connectionCfg
settings
model.connectionModel
)
] ]
, div , div
[ class S.errorMessage [ class S.errorMessage
@ -251,38 +257,38 @@ view2 settings model =
[ label [ label
[ class S.inputLabel [ class S.inputLabel
] ]
[ text "Recipient(s)" [ text texts.recipients
, B.inputRequired , B.inputRequired
] ]
, Html.map RecipientMsg , Html.map RecipientMsg
(Comp.EmailInput.view2 { style = dds, placeholder = "Recipient(s)..." } (Comp.EmailInput.view2 { style = dds, placeholder = appendDots texts.recipients }
model.recipients model.recipients
model.recipientsModel model.recipientsModel
) )
] ]
, div [ class "mb-4" ] , div [ class "mb-4" ]
[ label [ class S.inputLabel ] [ label [ class S.inputLabel ]
[ text "CC(s)" [ text texts.ccRecipients
] ]
, Html.map CCRecipientMsg , Html.map CCRecipientMsg
(Comp.EmailInput.view2 { style = dds, placeholder = "CC recipient(s)..." } (Comp.EmailInput.view2 { style = dds, placeholder = appendDots texts.ccRecipients }
model.ccRecipients model.ccRecipients
model.ccRecipientsModel model.ccRecipientsModel
) )
] ]
, div [ class "mb-4" ] , div [ class "mb-4" ]
[ label [ class S.inputLabel ] [ label [ class S.inputLabel ]
[ text "BCC(s)" [ text texts.bccRecipients
] ]
, Html.map BCCRecipientMsg , Html.map BCCRecipientMsg
(Comp.EmailInput.view2 { style = dds, placeholder = "BCC recipient(s)..." } (Comp.EmailInput.view2 { style = dds, placeholder = appendDots texts.bccRecipients }
model.bccRecipients model.bccRecipients
model.bccRecipientsModel model.bccRecipientsModel
) )
] ]
, div [ class "mb-4" ] , div [ class "mb-4" ]
[ label [ class S.inputLabel ] [ label [ class S.inputLabel ]
[ text "Subject" [ text texts.subject
, B.inputRequired , B.inputRequired
] ]
, input , input
@ -295,7 +301,7 @@ view2 settings model =
] ]
, div [ class "mb-4" ] , div [ class "mb-4" ]
[ label [ class S.inputLabel ] [ label [ class S.inputLabel ]
[ text "Body" [ text texts.body
, B.inputRequired , B.inputRequired
] ]
, textarea , textarea
@ -308,7 +314,7 @@ view2 settings model =
, MB.viewItem <| , MB.viewItem <|
MB.Checkbox MB.Checkbox
{ tagger = \_ -> ToggleAttachAll { tagger = \_ -> ToggleAttachAll
, label = "Include all item attachments" , label = texts.includeAllAttachments
, value = model.attachAll , value = model.attachAll
, id = "item-send-mail-attach-all" , id = "item-send-mail-attach-all"
} }
@ -321,7 +327,7 @@ view2 settings model =
, disabled = not (isValid model) , disabled = not (isValid model)
} }
, B.secondaryButton , B.secondaryButton
{ label = "Cancel" { label = texts.basics.cancel
, icon = "fa fa-times" , icon = "fa fa-times"
, handler = onClick Cancel , handler = onClick Cancel
, attrs = [ href "#" ] , attrs = [ href "#" ]
@ -329,3 +335,8 @@ view2 settings model =
} }
] ]
] ]
appendDots : String -> String
appendDots name =
name ++ ""

View File

@ -68,48 +68,48 @@ viewContent2 txt model =
splitDisplay2 txt splitDisplay2 txt
viewEditLink2 : (Bool -> Attribute Msg) -> Model -> Html Msg viewEditLink2 : String -> (Bool -> Attribute Msg) -> Model -> Html Msg
viewEditLink2 classes model = viewEditLink2 label classes model =
a a
[ onClick (SetDisplay Edit) [ onClick (SetDisplay Edit)
, classes (model.display == Edit) , classes (model.display == Edit)
, href "#" , href "#"
] ]
[ text "Edit" [ text label
] ]
viewPreviewLink2 : (Bool -> Attribute Msg) -> Model -> Html Msg viewPreviewLink2 : String -> (Bool -> Attribute Msg) -> Model -> Html Msg
viewPreviewLink2 classes model = viewPreviewLink2 label classes model =
a a
[ onClick (SetDisplay Preview) [ onClick (SetDisplay Preview)
, classes (model.display == Preview) , classes (model.display == Preview)
, href "#" , href "#"
] ]
[ text "Preview" [ text label
] ]
viewSplitLink2 : (Bool -> Attribute Msg) -> Model -> Html Msg viewSplitLink2 : String -> (Bool -> Attribute Msg) -> Model -> Html Msg
viewSplitLink2 classes model = viewSplitLink2 label classes model =
a a
[ onClick (SetDisplay Split) [ onClick (SetDisplay Split)
, classes (model.display == Split) , classes (model.display == Split)
, href "#" , href "#"
] ]
[ text "Split" [ text label
] ]
viewCheatLink2 : String -> Model -> Html msg viewCheatLink2 : String -> String -> Model -> Html msg
viewCheatLink2 classes model = viewCheatLink2 label classes model =
a a
[ class classes [ class classes
, target "_new" , target "_new"
, href model.cheatSheetUrl , href model.cheatSheetUrl
] ]
[ i [ class "fa fa-question mr-2" ] [] [ i [ class "fa fa-question mr-2" ] []
, text "Supports Markdown" , text label
] ]

View File

@ -612,7 +612,7 @@ view2 texts extraClasses settings model =
[ text texts.tagsInclude ] [ text texts.tagsInclude ]
, Html.map TagIncMsg , Html.map TagIncMsg
(Comp.Dropdown.view2 (Comp.Dropdown.view2
(Util.Tag.tagSettings DS.mainStyle) (Util.Tag.tagSettings texts.basics.chooseTag DS.mainStyle)
settings settings
model.tagInclModel model.tagInclModel
) )
@ -625,7 +625,7 @@ view2 texts extraClasses settings model =
[ text texts.tagsExclude ] [ text texts.tagsExclude ]
, Html.map TagExcMsg , Html.map TagExcMsg
(Comp.Dropdown.view2 (Comp.Dropdown.view2
(Util.Tag.tagSettings DS.mainStyle) (Util.Tag.tagSettings texts.basics.chooseTag DS.mainStyle)
settings settings
model.tagExclModel model.tagExclModel
) )

View File

@ -1108,7 +1108,7 @@ viewMetadata2 texts flags settings model =
[ text texts.basics.tags ] [ text texts.basics.tags ]
, Html.map TagDropdownMsg , Html.map TagDropdownMsg
(Comp.Dropdown.view2 (Comp.Dropdown.view2
(Util.Tag.tagSettings DS.mainStyle) (Util.Tag.tagSettings texts.basics.chooseTag DS.mainStyle)
settings settings
model.tagModel model.tagModel
) )

View File

@ -13,6 +13,7 @@ import Comp.Basic as B
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.SentMailsComp exposing (Texts)
import Styles as S import Styles as S
import Util.Time import Util.Time
@ -59,15 +60,15 @@ update msg model =
--- View2 --- View2
view2 : Model -> Html Msg view2 : Texts -> Model -> Html Msg
view2 model = view2 texts model =
case model.selected of case model.selected of
Just mail -> Just mail ->
div [ class "flex flex-col" ] div [ class "flex flex-col" ]
[ div [ class "text-sm flex-flex-col" ] [ div [ class "text-sm flex-flex-col" ]
[ div [ class "flex flex-row" ] [ div [ class "flex flex-row" ]
[ span [ class "font-bold" ] [ span [ class "font-bold" ]
[ text "From:" [ text (texts.from ++ ":")
] ]
, div [ class "ml-2" ] , div [ class "ml-2" ]
[ text mail.sender [ text mail.sender
@ -78,7 +79,7 @@ view2 model =
] ]
, div [ class "flex flex-row" ] , div [ class "flex flex-row" ]
[ span [ class "font-bold" ] [ span [ class "font-bold" ]
[ text "Date:" [ text (texts.date ++ ":")
] ]
, div [ class "ml-2" ] , div [ class "ml-2" ]
[ Util.Time.formatDateTime mail.created |> text [ Util.Time.formatDateTime mail.created |> text
@ -86,7 +87,7 @@ view2 model =
] ]
, div [ class "flex flex-row" ] , div [ class "flex flex-row" ]
[ span [ class "font-bold" ] [ span [ class "font-bold" ]
[ text "Recipients:" [ text (texts.recipients ++ ":")
] ]
, div [ class "ml-2" ] , div [ class "ml-2" ]
[ String.join ", " mail.recipients |> text [ String.join ", " mail.recipients |> text
@ -94,7 +95,7 @@ view2 model =
] ]
, div [ class "flex flex-row" ] , div [ class "flex flex-row" ]
[ span [ class "font-bold" ] [ span [ class "font-bold" ]
[ text "Subject:" [ text (texts.subject ++ ":")
] ]
, div [ class "ml-2" ] , div [ class "ml-2" ]
[ text mail.subject [ text mail.subject
@ -122,10 +123,10 @@ view2 model =
[ thead [] [ thead []
[ tr [] [ tr []
[ th [] [] [ th [] []
, th [ class "text-left" ] [ text "Recipients" ] , th [ class "text-left" ] [ text texts.recipients ]
, th [ class "hidden" ] [ text "Subject" ] , th [ class "hidden" ] [ text texts.subject ]
, th [ class "hidden text-center xl:table-cell" ] [ text "Sent" ] , th [ class "hidden text-center xl:table-cell" ] [ text texts.sent ]
, th [ class "hidden" ] [ text "Sender" ] , th [ class "hidden" ] [ text texts.sender ]
] ]
] ]
, tbody [] <| , tbody [] <|

View File

@ -322,7 +322,7 @@ view2 flags texts settings model =
} }
tagCfg = tagCfg =
Util.Tag.tagSettings DS.mainStyle Util.Tag.tagSettings texts.basics.chooseTag DS.mainStyle
languageCfg = languageCfg =
{ makeOption = { makeOption =

View File

@ -19,6 +19,7 @@ type alias Texts =
, ok : String , ok : String
, yes : String , yes : String
, no : String , no : String
, chooseTag : String
} }
@ -41,6 +42,7 @@ gb =
, ok = "Ok" , ok = "Ok"
, yes = "Yes" , yes = "Yes"
, no = "No" , no = "No"
, chooseTag = "Choose a tag"
} }

View File

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

View File

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

View File

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

View File

@ -1,12 +1,27 @@
module Messages.ItemDetail.AddFilesForm exposing (..) module Messages.ItemDetail.AddFilesForm exposing (..)
import Messages.Basics
import Messages.DropzoneComp import Messages.DropzoneComp
type alias Texts = 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 : Texts
gb = 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"
}

View File

@ -1,14 +1,64 @@
module Messages.ItemDetailComp exposing (..) module Messages.ItemDetailComp exposing (..)
import Messages.DetailEditComp
import Messages.ItemDetail.AddFilesForm import Messages.ItemDetail.AddFilesForm
import Messages.ItemInfoHeaderComp
import Messages.ItemMailComp
import Messages.NotesComp
import Messages.SentMailsComp
import Messages.SingleAttachmentComp
type alias Texts = type alias Texts =
{ addFilesForm : Messages.ItemDetail.AddFilesForm.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 : Texts
gb = gb =
{ addFilesForm = Messages.ItemDetail.AddFilesForm.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"
} }

View File

@ -1,18 +1,23 @@
module Messages.ItemDetailPage exposing (..) module Messages.ItemDetailPage exposing (..)
import Messages.EditFormComp
import Messages.ItemDetailComp import Messages.ItemDetailComp
type alias Texts = type alias Texts =
{ itemDetail : Messages.ItemDetailComp.Texts { itemDetail : Messages.ItemDetailComp.Texts
, editForm : Messages.EditFormComp.Texts
, editMetadata : String , editMetadata : String
, collapseExpand : String
} }
gb : Texts gb : Texts
gb = gb =
{ itemDetail = Messages.ItemDetailComp.gb { itemDetail = Messages.ItemDetailComp.gb
, editForm = Messages.EditFormComp.gb
, editMetadata = "Edit Metadata" , editMetadata = "Edit Metadata"
, collapseExpand = "Collapse/Expand"
} }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -40,7 +40,7 @@ viewSidebar texts visible flags settings model =
, disabled = model.detail.item.state == "created" , disabled = model.detail.item.state == "created"
, handler = onClick (ItemDetailMsg Comp.ItemDetail.Model.ToggleOpenAllAkkordionTabs) , handler = onClick (ItemDetailMsg Comp.ItemDetail.Model.ToggleOpenAllAkkordionTabs)
, attrs = , attrs =
[ title "Collapse/Expand" [ title texts.collapseExpand
, href "#" , href "#"
] ]
} }
@ -49,7 +49,7 @@ viewSidebar texts visible flags settings model =
, rootClasses = "text-sm mb-3 " , rootClasses = "text-sm mb-3 "
} }
, Html.map ItemDetailMsg , Html.map ItemDetailMsg
(Comp.ItemDetail.EditForm.view2 flags settings model.detail) (Comp.ItemDetail.EditForm.view2 texts.editForm flags settings model.detail)
] ]

View File

@ -21,14 +21,14 @@ makeDropdownModel =
} }
tagSettings : DS.DropdownStyle -> Comp.Dropdown.ViewSettings Tag tagSettings : String -> DS.DropdownStyle -> Comp.Dropdown.ViewSettings Tag
tagSettings ds = tagSettings placeholder ds =
{ makeOption = \tag -> { text = tag.name, additional = "" } { makeOption = \tag -> { text = tag.name, additional = "" }
, labelColor = , labelColor =
\tag -> \tag ->
\settings -> \settings ->
Data.UiSettings.tagColorString2 tag settings Data.UiSettings.tagColorString2 tag settings
, placeholder = "Choose a tag" , placeholder = placeholder
, style = ds , style = ds
} }
@ -41,11 +41,11 @@ makeCatDropdownModel =
} }
catSettings : DS.DropdownStyle -> Comp.Dropdown.ViewSettings String catSettings : String -> DS.DropdownStyle -> Comp.Dropdown.ViewSettings String
catSettings ds = catSettings placeholder ds =
{ makeOption = \cat -> { text = cat, additional = "" } { makeOption = \cat -> { text = cat, additional = "" }
, labelColor = \_ -> \_ -> "" , labelColor = \_ -> \_ -> ""
, placeholder = "Choose a tag category" , placeholder = placeholder
, style = ds , style = ds
} }