diff --git a/modules/webapp/src/main/elm/Comp/AttachmentMeta.elm b/modules/webapp/src/main/elm/Comp/AttachmentMeta.elm index 780e4561..37db3a0c 100644 --- a/modules/webapp/src/main/elm/Comp/AttachmentMeta.elm +++ b/modules/webapp/src/main/elm/Comp/AttachmentMeta.elm @@ -15,6 +15,7 @@ import Data.Flags exposing (Flags) import Html exposing (..) import Html.Attributes exposing (..) import Http +import Messages.AttachmentMetaComp exposing (Texts) import Styles as S import Util.Http import Util.Time @@ -64,15 +65,18 @@ update msg model = --- View2 -view2 : List (Attribute Msg) -> Model -> Html Msg -view2 attrs model = +view2 : Texts -> List (Attribute Msg) -> Model -> Html Msg +view2 texts attrs model = div attrs [ h3 [ class S.header3 ] - [ text "Extracted Meta Data" + [ text texts.extractedMetadata ] , case model.meta of NotAvailable -> - B.loadingDimmer True + B.loadingDimmer + { active = True + , label = texts.basics.loading + } Failure msg -> div [ class S.errorMessage ] @@ -80,33 +84,33 @@ view2 attrs model = ] Success data -> - viewData2 data + viewData2 texts data ] -viewData2 : AttachmentMeta -> Html Msg -viewData2 meta = +viewData2 : Texts -> AttachmentMeta -> Html Msg +viewData2 texts meta = div [ class "flex flex-col" ] [ div [ class "text-lg font-bold" ] - [ text "Content" + [ text texts.content ] , div [ class "px-2 py-2 text-sm bg-yellow-50 dark:bg-warmgray-800 break-words whitespace-pre max-h-80 overflow-auto" ] [ text meta.content ] , div [ class "text-lg font-bold mt-2" ] - [ text "Labels" + [ text texts.labels ] , div [ class "flex fex-row flex-wrap" ] (List.map renderLabelItem2 meta.labels) , div [ class "text-lg font-bold mt-2" ] - [ text "Proposals" + [ text texts.proposals ] - , viewProposals2 meta.proposals + , viewProposals2 texts meta.proposals ] -viewProposals2 : ItemProposals -> Html Msg -viewProposals2 props = +viewProposals2 : Texts -> ItemProposals -> Html Msg +viewProposals2 texts props = let mkItem n lbl = div @@ -130,32 +134,32 @@ viewProposals2 props = in div [ class "flex flex-col" ] [ div [ class "font-bold mb-2" ] - [ text "Correspondent Organization" + [ text texts.correspondentOrg ] , div [ class "flex flex-row flex-wrap space-x-2" ] (List.indexedMap mkItem props.corrOrg) , div [ class "font-bold mt-3 mb-2" ] - [ text "Correspondent Person" + [ text texts.correspondentPerson ] , div [ class "flex flex-row flex-wrap space-x-2" ] (List.indexedMap mkItem props.corrPerson) , div [ class "font-bold mt-3 mb-2" ] - [ text "Concerning Person" + [ text texts.concerningPerson ] , div [ class "flex flex-row flex-wrap space-x-2" ] (List.indexedMap mkItem props.concPerson) , div [ class "font-bold mt-3 mb-2" ] - [ text "Concerning Equipment" + [ text texts.concerningEquipment ] , div [ class "flex flex-row flex-wrap space-x-2" ] (List.indexedMap mkItem props.concEquipment) , div [ class "font-bold mb-2 mt-3" ] - [ text "Item Date" + [ text texts.itemDate ] , div [ class "flex flex-row flex-wrap space-x-2" ] (List.map mkTimeItem props.itemDate) , div [ class "font-bold mt-3 mb-2" ] - [ text "Item Due Date" + [ text texts.itemDueDate ] , div [ class "flex flex-row flex-wrap space-x-2 mb-2" ] (List.map mkTimeItem props.dueDate) diff --git a/modules/webapp/src/main/elm/Comp/Basic.elm b/modules/webapp/src/main/elm/Comp/Basic.elm index 9629e3a0..f34f010d 100644 --- a/modules/webapp/src/main/elm/Comp/Basic.elm +++ b/modules/webapp/src/main/elm/Comp/Basic.elm @@ -12,7 +12,6 @@ module Comp.Basic exposing , secondaryBasicButton , secondaryButton , stats - , tooltipRight ) import Html exposing (..) @@ -176,18 +175,18 @@ linkLabel model = genericLink model.icon model.label attrs -loadingDimmer : Bool -> Html msg -loadingDimmer active = +loadingDimmer : { label : String, active : Bool } -> Html msg +loadingDimmer cfg = div [ classList - [ ( "hidden", not active ) + [ ( "hidden", not cfg.active ) ] , class S.dimmer ] [ div [ class "text-gray-200" ] [ i [ class "fa fa-circle-notch animate-spin" ] [] , span [ class "ml-2" ] - [ text "Loading…" + [ text cfg.label ] ] ] @@ -279,17 +278,6 @@ inputRequired = ] -tooltipRight : Bool -> String -> Html msg -tooltipRight show msg = - div - [ class "absolute bottom-0 right-5 px-2 py-2 rounded-lg z-50 w-40" - , class "bg-white border" - , class "text-sm font-thin" - ] - [ text msg - ] - - --- Helpers diff --git a/modules/webapp/src/main/elm/Comp/CalEventInput.elm b/modules/webapp/src/main/elm/Comp/CalEventInput.elm index f69fb809..dfa1c319 100644 --- a/modules/webapp/src/main/elm/Comp/CalEventInput.elm +++ b/modules/webapp/src/main/elm/Comp/CalEventInput.elm @@ -17,6 +17,7 @@ import Html exposing (..) import Html.Attributes exposing (..) import Html.Events exposing (onInput) import Http +import Messages.CalEventInputComp exposing (Texts) import Styles as S import Util.Http import Util.Maybe @@ -129,8 +130,8 @@ update flags ev msg model = --- View2 -view2 : String -> CalEvent -> Model -> Html Msg -view2 extraClasses ev model = +view2 : Texts -> String -> CalEvent -> Model -> Html Msg +view2 texts extraClasses ev model = let yearLen = Basics.max 4 (String.length ev.year) @@ -155,7 +156,7 @@ view2 extraClasses ev model = [ label [ class S.inputLabel ] - [ text "Weekday" ] + [ text texts.weekday ] , input [ type_ "text" , class S.textInput @@ -172,7 +173,7 @@ view2 extraClasses ev model = ] , div [ class "flex flex-col space-y-2 mr-2" ] [ label [ class S.inputLabel ] - [ text "Year" ] + [ text texts.year ] , input [ type_ "text" , class S.textInput @@ -188,7 +189,7 @@ view2 extraClasses ev model = ] , div [ class "flex flex-col space-y-2 mr-2" ] [ label [ class S.inputLabel ] - [ text "Month" ] + [ text texts.month ] , input [ type_ "text" , class styleInput @@ -204,7 +205,7 @@ view2 extraClasses ev model = ] , div [ class "flex flex-col space-y-2 mr-4 mr-2" ] [ label [ class S.inputLabel ] - [ text "Day" + [ text texts.day ] , input [ type_ "text" @@ -218,7 +219,8 @@ view2 extraClasses ev model = ] , div [ class "flex flex-col space-y-2 mr-2" ] [ label [ class S.inputLabel ] - [ text "Hour" ] + [ text texts.hour + ] , input [ type_ "text" , class styleInput @@ -234,7 +236,7 @@ view2 extraClasses ev model = ] , div [ class "flex flex-col space-y-2" ] [ label [ class S.inputLabel ] - [ text "Minute" + [ text texts.minute ] , input [ type_ "text" @@ -253,7 +255,7 @@ view2 extraClasses ev model = ] , class S.errorMessage ] - [ text "Error: " + [ text (texts.error ++ ": ") , Maybe.map .message model.checkResult |> Maybe.withDefault "" |> text @@ -269,7 +271,7 @@ view2 extraClasses ev model = ] [ div [] [ div [ class S.inputLabel ] - [ text "Schedule: " + [ text (texts.schedule ++ ": ") ] , div [ class "px-12 font-mono " ] [ Maybe.andThen .event model.checkResult @@ -277,7 +279,7 @@ view2 extraClasses ev model = |> text ] , div [ class S.inputLabel ] - [ text "Next: " + [ text (texts.next ++ ": ") ] , ul [ class "list-decimal list-inside text-sm" ] (Maybe.map .next model.checkResult diff --git a/modules/webapp/src/main/elm/Comp/ChangePasswordForm.elm b/modules/webapp/src/main/elm/Comp/ChangePasswordForm.elm index 6dd20221..7f6e58de 100644 --- a/modules/webapp/src/main/elm/Comp/ChangePasswordForm.elm +++ b/modules/webapp/src/main/elm/Comp/ChangePasswordForm.elm @@ -267,5 +267,8 @@ view2 texts model = [ text "Submit" ] ] - , B.loadingDimmer model.loading + , B.loadingDimmer + { active = model.loading + , label = texts.basics.loading + } ] diff --git a/modules/webapp/src/main/elm/Comp/ClassifierSettingsForm.elm b/modules/webapp/src/main/elm/Comp/ClassifierSettingsForm.elm index f212b812..0333c81a 100644 --- a/modules/webapp/src/main/elm/Comp/ClassifierSettingsForm.elm +++ b/modules/webapp/src/main/elm/Comp/ClassifierSettingsForm.elm @@ -60,7 +60,7 @@ init flags sett = in ( { scheduleModel = cem , schedule = Data.Validated.Unknown newSchedule - , itemCountModel = Comp.IntField.init (Just 0) Nothing True "" + , itemCountModel = Comp.IntField.init (Just 0) Nothing True , itemCount = Just sett.itemCount , categoryListModel = let @@ -237,6 +237,7 @@ view2 texts settings model = [ text texts.schedule ] , Html.map ScheduleMsg (Comp.CalEventInput.view2 + texts.calEventInput "" (Data.Validated.value model.schedule) model.scheduleModel diff --git a/modules/webapp/src/main/elm/Comp/CustomFieldForm.elm b/modules/webapp/src/main/elm/Comp/CustomFieldForm.elm index afb4b792..f5a6d835 100644 --- a/modules/webapp/src/main/elm/Comp/CustomFieldForm.elm +++ b/modules/webapp/src/main/elm/Comp/CustomFieldForm.elm @@ -201,7 +201,9 @@ view2 : Texts -> ViewSettings -> Model -> List (Html Msg) view2 texts viewSettings model = let dimmerSettings = - Comp.YesNoDimmer.defaultSettings2 texts.reallyDeleteField + Comp.YesNoDimmer.defaultSettings texts.reallyDeleteField + texts.basics.yes + texts.basics.no ftypeCfg = { display = texts.fieldTypeLabel diff --git a/modules/webapp/src/main/elm/Comp/CustomFieldInput.elm b/modules/webapp/src/main/elm/Comp/CustomFieldInput.elm index f725c66d..c9e5b107 100644 --- a/modules/webapp/src/main/elm/Comp/CustomFieldInput.elm +++ b/modules/webapp/src/main/elm/Comp/CustomFieldInput.elm @@ -16,12 +16,13 @@ import Comp.DatePicker import Comp.MenuBar as MB import Data.CustomFieldType exposing (CustomFieldType) import Data.Icons as Icons -import Data.Money +import Data.Money exposing (MoneyParseError(..)) import Date exposing (Date) import DatePicker exposing (DatePicker) import Html exposing (..) import Html.Attributes exposing (..) -import Html.Events exposing (onCheck, onClick, onInput) +import Html.Events exposing (onClick, onInput) +import Messages.CustomFieldInputComp exposing (Texts) import Styles as S import Util.Maybe @@ -32,9 +33,15 @@ type alias Model = } +type FieldError + = NoValue + | NotANumber String + | NotMoney MoneyParseError + + type alias FloatModel = { input : String - , result : Result String Float + , result : Result FieldError Float } @@ -61,27 +68,47 @@ fieldType field = |> Maybe.withDefault Data.CustomFieldType.Text -errorMsg : Model -> Maybe String -errorMsg model = +errorMsg : Texts -> Model -> Maybe String +errorMsg texts model = let - getMsg res = - case res of - Ok _ -> - Nothing + parseMsg isMoneyField perr = + case perr of + NoValue -> + if isMoneyField then + Just <| texts.errorNoAmount - Err m -> - Just m + else + Just <| texts.errorNoNumber + + NotANumber str -> + Just <| texts.errorNotANumber str + + NotMoney (RequireTwoDigitsAfterDot _) -> + Just "Two digits required after the dot." + + NotMoney (NoOrTooManyPoints _) -> + Just "One single dot + digits required for money." in case model.fieldModel of NumberField fm -> - getMsg fm.result + case fm.result of + Ok _ -> + Nothing + + Err parseError -> + parseMsg False parseError MoneyField fm -> - getMsg fm.result + case fm.result of + Ok _ -> + Nothing + + Err parseError -> + parseMsg True parseError TextField mt -> if mt == Nothing then - Just "Please fill in some value" + Just texts.errorNoValue else Nothing @@ -103,10 +130,10 @@ init field = TextField Nothing Data.CustomFieldType.Numeric -> - NumberField (FloatModel "" (Err "No number given")) + NumberField (FloatModel "" (Err NoValue)) Data.CustomFieldType.Money -> - MoneyField (FloatModel "" (Err "No amount given")) + MoneyField (FloatModel "" (Err NoValue)) Data.CustomFieldType.Boolean -> BoolField False @@ -150,7 +177,7 @@ initWith value = updateFloatModel False value.value - Data.Money.fromString + (Data.Money.fromString >> Result.mapError NotMoney) Data.Money.normalizeInput in MoneyField fm @@ -230,7 +257,7 @@ update1 forSearch msg model = updateFloatModel forSearch str - Data.Money.fromString + (Data.Money.fromString >> Result.mapError NotMoney) Data.Money.normalizeInput model_ = @@ -294,7 +321,7 @@ update1 forSearch msg model = updateFloatModel : Bool -> String - -> (String -> Result String Float) + -> (String -> Result FieldError Float) -> (String -> String) -> ( FloatModel, FieldResult ) updateFloatModel forSearch msg parse normalize = @@ -331,11 +358,11 @@ hasWildCards msg = --- View2 -view2 : String -> Maybe String -> Model -> Html Msg -view2 classes icon model = +view2 : Texts -> String -> Maybe String -> Model -> Html Msg +view2 texts classes icon model = let error = - errorMsg model + errorMsg texts model in div [ class classes @@ -473,11 +500,11 @@ mkLabel model = Maybe.withDefault model.field.name model.field.label -string2Float : String -> Result String Float +string2Float : String -> Result FieldError Float string2Float str = case String.toFloat str of Just n -> Ok n Nothing -> - Err ("Not a number: " ++ str) + Err (NotANumber str) diff --git a/modules/webapp/src/main/elm/Comp/CustomFieldManage.elm b/modules/webapp/src/main/elm/Comp/CustomFieldManage.elm index f062d834..c9fa672f 100644 --- a/modules/webapp/src/main/elm/Comp/CustomFieldManage.elm +++ b/modules/webapp/src/main/elm/Comp/CustomFieldManage.elm @@ -203,5 +203,8 @@ viewTable2 texts model = model.tableModel model.fields ) - , B.loadingDimmer model.loading + , B.loadingDimmer + { active = model.loading + , label = texts.basics.loading + } ] diff --git a/modules/webapp/src/main/elm/Comp/CustomFieldMultiInput.elm b/modules/webapp/src/main/elm/Comp/CustomFieldMultiInput.elm index 8cf7ed94..9fe2dcf4 100644 --- a/modules/webapp/src/main/elm/Comp/CustomFieldMultiInput.elm +++ b/modules/webapp/src/main/elm/Comp/CustomFieldMultiInput.elm @@ -29,6 +29,7 @@ import Html exposing (..) import Html.Attributes exposing (..) import Html.Events exposing (onClick) import Http +import Messages.CustomFieldMultiInputComp exposing (Texts) import Styles as S import Util.CustomField import Util.Maybe @@ -318,11 +319,11 @@ type alias ViewSettings = } -view2 : ViewSettings -> Model -> Html Msg -view2 viewSettings model = +view2 : Texts -> ViewSettings -> Model -> Html Msg +view2 texts viewSettings model = div [ class viewSettings.classes ] (viewMenuBar2 viewSettings model - :: List.map (viewCustomField2 viewSettings model) (visibleFields model) + :: List.map (viewCustomField2 texts viewSettings model) (visibleFields model) ) @@ -364,8 +365,8 @@ viewMenuBar2 viewSettings model = ) -viewCustomField2 : ViewSettings -> Model -> CustomField -> Html Msg -viewCustomField2 viewSettings model field = +viewCustomField2 : Texts -> ViewSettings -> Model -> CustomField -> Html Msg +viewCustomField2 texts viewSettings model field = let visibleField = Dict.get field.name model.visibleFields @@ -373,7 +374,8 @@ viewCustomField2 viewSettings model field = case visibleField of Just vf -> Html.map (CustomFieldInputMsg field) - (Comp.CustomFieldInput.view2 "mt-2" + (Comp.CustomFieldInput.view2 texts.customFieldInput + "mt-2" (viewSettings.fieldIcon vf.field) vf.inputModel ) diff --git a/modules/webapp/src/main/elm/Comp/EmailSettingsForm.elm b/modules/webapp/src/main/elm/Comp/EmailSettingsForm.elm index 1119eb69..96c17354 100644 --- a/modules/webapp/src/main/elm/Comp/EmailSettingsForm.elm +++ b/modules/webapp/src/main/elm/Comp/EmailSettingsForm.elm @@ -47,7 +47,7 @@ emptyModel = { settings = Api.Model.EmailSettings.empty , name = "" , host = "" - , portField = Comp.IntField.init (Just 0) Nothing True "SMTP Port" + , portField = Comp.IntField.init (Just 0) Nothing True , portNum = Nothing , user = Nothing , passField = Comp.PasswordInput.init @@ -68,7 +68,7 @@ init ems = { settings = ems , name = ems.name , host = ems.smtpHost - , portField = Comp.IntField.init (Just 0) Nothing True "SMTP Port" + , portField = Comp.IntField.init (Just 0) Nothing True , portNum = ems.smtpPort , user = ems.smtpUser , passField = Comp.PasswordInput.init @@ -225,9 +225,12 @@ view2 texts settings model = [] ] , Html.map PortMsg - (Comp.IntField.viewWithInfo2 "" - model.portNum - "" + (Comp.IntField.view + { label = texts.smtpPort + , info = "" + , number = model.portNum + , classes = "" + } model.portField ) , div [ class "col-span-4 sm:col-span-2" ] diff --git a/modules/webapp/src/main/elm/Comp/EmailSettingsManage.elm b/modules/webapp/src/main/elm/Comp/EmailSettingsManage.elm index 1698f297..1452268f 100644 --- a/modules/webapp/src/main/elm/Comp/EmailSettingsManage.elm +++ b/modules/webapp/src/main/elm/Comp/EmailSettingsManage.elm @@ -250,7 +250,9 @@ viewForm2 : Texts -> UiSettings -> Model -> Html Msg viewForm2 texts settings model = let dimmerSettings = - Comp.YesNoDimmer.defaultSettings2 texts.reallyDeleteConnection + Comp.YesNoDimmer.defaultSettings texts.reallyDeleteConnection + texts.basics.yes + texts.basics.no in div [ class "flex flex-col md:relative" ] [ MB.view @@ -302,5 +304,8 @@ viewForm2 texts settings model = dimmerSettings model.deleteConfirm ) - , B.loadingDimmer model.loading + , B.loadingDimmer + { active = model.loading + , label = texts.basics.loading + } ] diff --git a/modules/webapp/src/main/elm/Comp/EquipmentManage.elm b/modules/webapp/src/main/elm/Comp/EquipmentManage.elm index cb570e12..e10f8af1 100644 --- a/modules/webapp/src/main/elm/Comp/EquipmentManage.elm +++ b/modules/webapp/src/main/elm/Comp/EquipmentManage.elm @@ -258,7 +258,9 @@ viewForm2 texts model = model.formModel.equipment.id == "" dimmerSettings2 = - Comp.YesNoDimmer.defaultSettings2 texts.reallyDeleteEquipment + Comp.YesNoDimmer.defaultSettings texts.reallyDeleteEquipment + texts.basics.yes + texts.basics.no in Html.form [ class "relative flex flex-col" @@ -322,5 +324,8 @@ viewForm2 texts model = [ Maybe.withDefault "" model.formError |> text ] , Html.map FormMsg (Comp.EquipmentForm.view2 texts.equipmentForm model.formModel) - , B.loadingDimmer model.loading + , B.loadingDimmer + { active = model.loading + , label = texts.basics.loading + } ] diff --git a/modules/webapp/src/main/elm/Comp/FolderDetail.elm b/modules/webapp/src/main/elm/Comp/FolderDetail.elm index 326b7ecf..438d53c0 100644 --- a/modules/webapp/src/main/elm/Comp/FolderDetail.elm +++ b/modules/webapp/src/main/elm/Comp/FolderDetail.elm @@ -286,7 +286,9 @@ view2 texts flags model = dimmerSettings : Comp.YesNoDimmer.Settings dimmerSettings = - Comp.YesNoDimmer.defaultSettings2 texts.reallyDeleteThisFolder + Comp.YesNoDimmer.defaultSettings texts.reallyDeleteThisFolder + texts.basics.yes + texts.basics.no in div [ class "flex flex-col md:relative" ] (viewButtons2 texts model diff --git a/modules/webapp/src/main/elm/Comp/FolderSelect.elm b/modules/webapp/src/main/elm/Comp/FolderSelect.elm index 3b65eff9..f7034af8 100644 --- a/modules/webapp/src/main/elm/Comp/FolderSelect.elm +++ b/modules/webapp/src/main/elm/Comp/FolderSelect.elm @@ -156,25 +156,20 @@ viewDrop2 dropModel constr model = highlightDrop = DD.getDropId dropModel == Just DD.FolderRemove in - div [ class "ui list" ] - [ div [ class "item" ] - [ i [ class "folder open icon" ] [] - , div [ class "content" ] - [ div - (classList - [ ( "hidden", True ) - , ( "current-drop-target", highlightDrop ) - ] - :: DD.droppable FolderDDMsg DD.FolderRemove - -- note: re-enable this when adding a "no-folder selection" - -- this enables a drop target that removes a folder - ) - [ text "Folders" - ] - , div [ class "flex flex-col space-y-2 md:space-y-1" ] - (renderItems2 dropModel constr model) + div [] + [ div + (classList + [ ( "hidden", True ) + , ( "current-drop-target", highlightDrop ) ] + :: DD.droppable FolderDDMsg DD.FolderRemove + -- note: re-enable this when adding a "no-folder selection" + -- this enables a drop target that removes a folder + ) + [ text "Folders" ] + , div [ class "flex flex-col space-y-2 md:space-y-1" ] + (renderItems2 dropModel constr model) ] diff --git a/modules/webapp/src/main/elm/Comp/ImapSettingsForm.elm b/modules/webapp/src/main/elm/Comp/ImapSettingsForm.elm index 46426a53..a47db36c 100644 --- a/modules/webapp/src/main/elm/Comp/ImapSettingsForm.elm +++ b/modules/webapp/src/main/elm/Comp/ImapSettingsForm.elm @@ -46,7 +46,7 @@ emptyModel = { settings = Api.Model.ImapSettings.empty , name = "" , host = "" - , portField = Comp.IntField.init (Just 0) Nothing True "IMAP Port" + , portField = Comp.IntField.init (Just 0) Nothing True , portNum = Nothing , user = Nothing , passField = Comp.PasswordInput.init @@ -66,7 +66,7 @@ init ems = { settings = ems , name = ems.name , host = ems.imapHost - , portField = Comp.IntField.init (Just 0) Nothing True "IMAP Port" + , portField = Comp.IntField.init (Just 0) Nothing True , portNum = ems.imapPort , user = ems.imapUser , passField = Comp.PasswordInput.init @@ -216,9 +216,12 @@ view2 texts settings model = [] ] , Html.map PortMsg - (Comp.IntField.viewWithInfo2 "" - model.portNum - "" + (Comp.IntField.view + { label = texts.imapPort + , info = "" + , number = model.portNum + , classes = "" + } model.portField ) , div [ class "col-span-4 sm:col-span-2" ] diff --git a/modules/webapp/src/main/elm/Comp/ImapSettingsManage.elm b/modules/webapp/src/main/elm/Comp/ImapSettingsManage.elm index 48c04dd1..09ea6112 100644 --- a/modules/webapp/src/main/elm/Comp/ImapSettingsManage.elm +++ b/modules/webapp/src/main/elm/Comp/ImapSettingsManage.elm @@ -251,7 +251,9 @@ viewForm2 : Texts -> UiSettings -> Model -> Html Msg viewForm2 texts settings model = let dimmerSettings = - Comp.YesNoDimmer.defaultSettings2 texts.reallyDeleteSettings + Comp.YesNoDimmer.defaultSettings texts.reallyDeleteSettings + texts.basics.yes + texts.basics.no in div [ class "flex flex-col md:relative" ] [ MB.view @@ -304,5 +306,8 @@ viewForm2 texts settings model = dimmerSettings model.deleteConfirm ) - , B.loadingDimmer model.loading + , B.loadingDimmer + { active = model.loading + , label = texts.basics.loading + } ] diff --git a/modules/webapp/src/main/elm/Comp/IntField.elm b/modules/webapp/src/main/elm/Comp/IntField.elm index 49ee0adf..1ecbac18 100644 --- a/modules/webapp/src/main/elm/Comp/IntField.elm +++ b/modules/webapp/src/main/elm/Comp/IntField.elm @@ -5,11 +5,8 @@ module Comp.IntField exposing , init , update , view - , viewWithInfo2 ) ---- L10N TODO - import Html exposing (..) import Html.Attributes exposing (..) import Html.Events exposing (onInput) @@ -20,7 +17,6 @@ import Styles as S type alias Model = { min : Maybe Int , max : Maybe Int - , label : String , error : Maybe String , lastInput : String , optional : Bool @@ -31,11 +27,10 @@ type Msg = SetValue String -init : Maybe Int -> Maybe Int -> Bool -> String -> Model -init min max opt label = +init : Maybe Int -> Maybe Int -> Bool -> Model +init min max opt = { min = min , max = max - , label = label , error = Nothing , lastInput = "" , optional = opt @@ -149,11 +144,11 @@ view cfg model = ] -viewWithInfo2 : String -> Maybe Int -> String -> Model -> Html Msg -viewWithInfo2 info nval classes model = +viewWithInfo2 : String -> String -> Maybe Int -> String -> Model -> Html Msg +viewWithInfo2 label info nval classes model = let cfg = - { label = model.label + { label = label , info = info , number = nval , classes = classes diff --git a/modules/webapp/src/main/elm/Comp/ItemDetail/EditForm.elm b/modules/webapp/src/main/elm/Comp/ItemDetail/EditForm.elm index 9f5b1666..bed67bad 100644 --- a/modules/webapp/src/main/elm/Comp/ItemDetail/EditForm.elm +++ b/modules/webapp/src/main/elm/Comp/ItemDetail/EditForm.elm @@ -52,7 +52,7 @@ view2 texts flags settings model = formTabs texts flags settings model allTabNames = - List.map .title tabs + List.map .name tabs |> Set.fromList in div (class "flex flex-col relative" :: keyAttr) @@ -127,7 +127,7 @@ formTabs texts flags settings model = folderCfg = { makeOption = Util.Folder.mkFolderOption flags model.allFolders - , placeholder = "" + , placeholder = texts.selectPlaceholder , labelColor = \_ -> \_ -> "" , style = dds } @@ -254,6 +254,7 @@ formTabs texts flags settings model = [ div [ class "mb-4" ] [ Html.map CustomFieldMsg (Comp.CustomFieldMultiInput.view2 + texts.customFieldInput customFieldSettings model.customFieldsModel ) diff --git a/modules/webapp/src/main/elm/Comp/ItemDetail/MultiEditMenu.elm b/modules/webapp/src/main/elm/Comp/ItemDetail/MultiEditMenu.elm index 77600cff..99076884 100644 --- a/modules/webapp/src/main/elm/Comp/ItemDetail/MultiEditMenu.elm +++ b/modules/webapp/src/main/elm/Comp/ItemDetail/MultiEditMenu.elm @@ -39,7 +39,7 @@ import Html.Attributes exposing (..) import Html.Events exposing (onClick, onInput) import Http import Markdown -import Messages.MultiEditComp exposing (Texts) +import Messages.MultiEditMenuComp exposing (Texts) import Page exposing (Page(..)) import Set exposing (Set) import Styles as S @@ -775,6 +775,7 @@ renderEditForm2 texts flags cfg settings model = , body = [ Html.map CustomFieldMsg (Comp.CustomFieldMultiInput.view2 + texts.customFieldMultiInput customFieldSettings model.customFieldModel ) diff --git a/modules/webapp/src/main/elm/Comp/ItemDetail/SingleAttachment.elm b/modules/webapp/src/main/elm/Comp/ItemDetail/SingleAttachment.elm index 9394daa6..e22b5f90 100644 --- a/modules/webapp/src/main/elm/Comp/ItemDetail/SingleAttachment.elm +++ b/modules/webapp/src/main/elm/Comp/ItemDetail/SingleAttachment.elm @@ -52,6 +52,7 @@ view texts settings model pos attach = Just am -> Html.map (AttachMetaMsg attach.id) (Comp.AttachmentMeta.view2 + texts.attachmentMeta [ class "border-r border-l border-b dark:border-bluegray-600 px-2" ] am ) diff --git a/modules/webapp/src/main/elm/Comp/ItemDetail/View2.elm b/modules/webapp/src/main/elm/Comp/ItemDetail/View2.elm index a1ecf2fc..31a3dbc7 100644 --- a/modules/webapp/src/main/elm/Comp/ItemDetail/View2.elm +++ b/modules/webapp/src/main/elm/Comp/ItemDetail/View2.elm @@ -250,7 +250,10 @@ sendMailForm texts settings model = [ div [ class "text-lg font-bold" ] [ text texts.sendThisItemViaEmail ] - , B.loadingDimmer model.mailSending + , B.loadingDimmer + { active = model.mailSending + , label = texts.sendingMailNow + } , Html.map ItemMailMsg (Comp.ItemMail.view2 texts.itemMail settings model.itemMail) , div [ classList diff --git a/modules/webapp/src/main/elm/Comp/NotificationForm.elm b/modules/webapp/src/main/elm/Comp/NotificationForm.elm index 46d34b1f..3422c17c 100644 --- a/modules/webapp/src/main/elm/Comp/NotificationForm.elm +++ b/modules/webapp/src/main/elm/Comp/NotificationForm.elm @@ -152,7 +152,7 @@ init flags = , recipients = [] , recipientsModel = Comp.EmailInput.init , remindDays = Just 1 - , remindDaysModel = Comp.IntField.init (Just 1) Nothing True "Remind Days" + , remindDaysModel = Comp.IntField.init (Just 1) Nothing True , enabled = False , capOverdue = False , schedule = initialSchedule @@ -480,7 +480,9 @@ view2 : Texts -> String -> UiSettings -> Model -> Html Msg view2 texts extraClasses settings model = let dimmerSettings = - Comp.YesNoDimmer.defaultSettings2 texts.reallyDeleteTask + Comp.YesNoDimmer.defaultSettings texts.reallyDeleteTask + texts.basics.yes + texts.basics.no startOnceBtn = MB.SecondaryButton @@ -506,7 +508,10 @@ view2 texts extraClasses settings model = dimmerSettings model.yesNoDelete ) - , B.loadingDimmer (model.loading > 0) + , B.loadingDimmer + { active = model.loading > 0 + , label = texts.basics.loading + } , MB.view { start = [ MB.PrimaryButton @@ -634,10 +639,12 @@ view2 texts extraClasses settings model = ] ] , Html.map RemindDaysMsg - (Comp.IntField.viewWithInfo2 - texts.remindDaysInfo - model.remindDays - "mb-4" + (Comp.IntField.view + { label = texts.remindDaysLabel + , info = texts.remindDaysInfo + , number = model.remindDays + , classes = "mb-4" + } model.remindDaysModel ) , div [ class "mb-4" ] @@ -668,7 +675,9 @@ view2 texts extraClasses settings model = ] ] , Html.map CalEventMsg - (Comp.CalEventInput.view2 "" + (Comp.CalEventInput.view2 + texts.calEventInput + "" (Data.Validated.value model.schedule) model.scheduleModel ) diff --git a/modules/webapp/src/main/elm/Comp/OrgManage.elm b/modules/webapp/src/main/elm/Comp/OrgManage.elm index 71c1ba62..38c01908 100644 --- a/modules/webapp/src/main/elm/Comp/OrgManage.elm +++ b/modules/webapp/src/main/elm/Comp/OrgManage.elm @@ -238,7 +238,10 @@ viewTable2 texts model = , rootClasses = "mb-4" } , Html.map TableMsg (Comp.OrgTable.view2 texts.orgTable model.tableModel) - , B.loadingDimmer model.loading + , B.loadingDimmer + { active = model.loading + , label = texts.basics.loading + } ] @@ -249,7 +252,9 @@ viewForm2 texts settings model = model.formModel.org.id == "" dimmerSettings2 = - Comp.YesNoDimmer.defaultSettings2 texts.reallyDeleteOrg + Comp.YesNoDimmer.defaultSettings texts.reallyDeleteOrg + texts.basics.yes + texts.basics.no in Html.form [ class "md:relative flex flex-col" @@ -319,5 +324,8 @@ viewForm2 texts settings model = settings model.formModel ) - , B.loadingDimmer model.loading + , B.loadingDimmer + { active = model.loading + , label = texts.basics.loading + } ] diff --git a/modules/webapp/src/main/elm/Comp/PersonManage.elm b/modules/webapp/src/main/elm/Comp/PersonManage.elm index b63f2f89..257cd2b4 100644 --- a/modules/webapp/src/main/elm/Comp/PersonManage.elm +++ b/modules/webapp/src/main/elm/Comp/PersonManage.elm @@ -275,7 +275,10 @@ viewTable2 texts model = , rootClasses = "mb-4" } , Html.map TableMsg (Comp.PersonTable.view2 texts.personTable model.tableModel) - , B.loadingDimmer (isLoading model) + , B.loadingDimmer + { active = isLoading model + , label = texts.basics.loading + } ] @@ -286,7 +289,9 @@ viewForm2 texts settings model = model.formModel.person.id == "" dimmerSettings2 = - Comp.YesNoDimmer.defaultSettings2 texts.reallyDeletePerson + Comp.YesNoDimmer.defaultSettings texts.reallyDeletePerson + texts.basics.yes + texts.basics.no in Html.form [ class "md:relative flex flex-col" @@ -355,5 +360,8 @@ viewForm2 texts settings model = settings model.formModel ) - , B.loadingDimmer (isLoading model) + , B.loadingDimmer + { active = isLoading model + , label = texts.basics.loading + } ] diff --git a/modules/webapp/src/main/elm/Comp/ScanMailboxForm.elm b/modules/webapp/src/main/elm/Comp/ScanMailboxForm.elm index 0dd02167..74236f85 100644 --- a/modules/webapp/src/main/elm/Comp/ScanMailboxForm.elm +++ b/modules/webapp/src/main/elm/Comp/ScanMailboxForm.elm @@ -221,7 +221,7 @@ init flags = , enabled = False , deleteMail = False , receivedHours = Nothing - , receivedHoursModel = Comp.IntField.init (Just 1) Nothing True "Received Since Hours" + , receivedHoursModel = Comp.IntField.init (Just 1) Nothing True , foldersModel = Comp.StringListInput.init , folders = [] , targetFolder = Nothing @@ -740,7 +740,7 @@ view2 : Texts -> Flags -> String -> UiSettings -> Model -> Html Msg view2 texts flags extraClasses settings model = let dimmerSettings = - Comp.YesNoDimmer.defaultSettings2 texts.reallyDeleteTask + Comp.YesNoDimmer.defaultSettings texts.reallyDeleteTask texts.basics.yes texts.basics.no startOnceBtn = MB.SecondaryButton @@ -813,7 +813,10 @@ view2 texts flags extraClasses settings model = dimmerSettings model.yesNoDelete ) - , B.loadingDimmer (model.loading > 0) + , B.loadingDimmer + { active = model.loading > 0 + , label = texts.basics.loading + } ] @@ -926,10 +929,12 @@ viewProcessing2 texts model = ] ] , Html.map ReceivedHoursMsg - (Comp.IntField.viewWithInfo2 - texts.receivedHoursInfo - model.receivedHours - "mb-4" + (Comp.IntField.view + { label = texts.receivedHoursLabel + , info = texts.receivedHoursInfo + , number = model.receivedHours + , classes = "mb-4" + } model.receivedHoursModel ) ] @@ -1163,7 +1168,9 @@ viewSchedule2 texts model = ] ] , Html.map CalEventMsg - (Comp.CalEventInput.view2 "" + (Comp.CalEventInput.view2 + texts.calEventInput + "" (Data.Validated.value model.schedule) model.scheduleModel ) diff --git a/modules/webapp/src/main/elm/Comp/SearchMenu.elm b/modules/webapp/src/main/elm/Comp/SearchMenu.elm index 2e7a16b7..7e9ac390 100644 --- a/modules/webapp/src/main/elm/Comp/SearchMenu.elm +++ b/modules/webapp/src/main/elm/Comp/SearchMenu.elm @@ -1202,6 +1202,7 @@ searchTabs texts ddd flags settings model = , body = List.map (Html.map TagSelectMsg) (Comp.TagSelect.viewTagsDrop2 + texts.tagSelect ddd.model tagSelectWM settings @@ -1303,6 +1304,7 @@ searchTabs texts ddd flags settings model = , body = [ Html.map CustomFieldMsg (Comp.CustomFieldMultiInput.view2 + texts.customFieldMultiInput { showAddButton = False , classes = "" , fieldIcon = \_ -> Nothing diff --git a/modules/webapp/src/main/elm/Comp/SourceManage.elm b/modules/webapp/src/main/elm/Comp/SourceManage.elm index 0734abc9..e3044782 100644 --- a/modules/webapp/src/main/elm/Comp/SourceManage.elm +++ b/modules/webapp/src/main/elm/Comp/SourceManage.elm @@ -249,7 +249,10 @@ viewTable2 texts model = , rootClasses = "mb-4" } , Html.map TableMsg (Comp.SourceTable.view2 texts.sourceTable model.sources) - , B.loadingDimmer model.loading + , B.loadingDimmer + { active = model.loading + , label = texts.basics.loading + } ] @@ -386,7 +389,9 @@ viewForm2 texts flags settings model = model.formModel.source.source.id == "" dimmerSettings = - Comp.YesNoDimmer.defaultSettings2 texts.reallyDeleteSource + Comp.YesNoDimmer.defaultSettings texts.reallyDeleteSource + texts.basics.yes + texts.basics.no in [ if newSource then h3 [ class S.header2 ] @@ -449,6 +454,9 @@ viewForm2 texts flags settings model = dimmerSettings model.deleteConfirm ) - , B.loadingDimmer model.loading + , B.loadingDimmer + { active = model.loading + , label = texts.basics.loading + } ] ] diff --git a/modules/webapp/src/main/elm/Comp/TagManage.elm b/modules/webapp/src/main/elm/Comp/TagManage.elm index 833fbe06..617038a0 100644 --- a/modules/webapp/src/main/elm/Comp/TagManage.elm +++ b/modules/webapp/src/main/elm/Comp/TagManage.elm @@ -264,7 +264,9 @@ viewForm2 texts model = model.tagFormModel.tag.id == "" dimmerSettings2 = - Comp.YesNoDimmer.defaultSettings2 texts.reallyDeleteTag + Comp.YesNoDimmer.defaultSettings texts.reallyDeleteTag + texts.basics.yes + texts.basics.no in Html.form [ class "relative flex flex-col" @@ -328,5 +330,8 @@ viewForm2 texts model = [ Maybe.withDefault "" model.formError |> text ] , Html.map FormMsg (Comp.TagForm.view2 texts.tagForm model.tagFormModel) - , B.loadingDimmer model.loading + , B.loadingDimmer + { active = model.loading + , label = texts.basics.loading + } ] diff --git a/modules/webapp/src/main/elm/Comp/TagSelect.elm b/modules/webapp/src/main/elm/Comp/TagSelect.elm index 2d89ae4a..579b4c6d 100644 --- a/modules/webapp/src/main/elm/Comp/TagSelect.elm +++ b/modules/webapp/src/main/elm/Comp/TagSelect.elm @@ -26,6 +26,7 @@ import Dict exposing (Dict) import Html exposing (..) import Html.Attributes exposing (..) import Html.Events exposing (onClick, onInput) +import Messages.TagSelectComp exposing (Texts) import Set import Simple.Fuzzy import String as S @@ -422,17 +423,17 @@ catState model name = --- View2 -viewAll2 : DD.Model -> UiSettings -> Selection -> Model -> List (Html Msg) -viewAll2 ddm settings sel model = +viewAll2 : Texts -> DD.Model -> UiSettings -> Selection -> Model -> List (Html Msg) +viewAll2 texts ddm settings sel model = let wm = makeWorkModel sel model in - viewTagsDrop2 ddm wm settings model ++ [ viewCats2 settings wm model ] + viewTagsDrop2 texts ddm wm settings model ++ [ viewCats2 settings wm model ] -viewTagsDrop2 : DD.Model -> WorkModel -> UiSettings -> Model -> List (Html Msg) -viewTagsDrop2 ddm wm settings model = +viewTagsDrop2 : Texts -> DD.Model -> WorkModel -> UiSettings -> Model -> List (Html Msg) +viewTagsDrop2 texts ddm wm settings model = [ div [ class "flex flex-col" ] [ div [ class "flex flex-row h-6 items-center text-xs mb-2" ] [ a @@ -442,16 +443,16 @@ viewTagsDrop2 ddm wm settings model = , onClick ToggleShowEmpty ] [ if model.showEmpty then - text " Hide empty" + text (" " ++ texts.hideEmpty) else - text " Show empty" + text (" " ++ texts.showEmpty) ] , div [ class "flex-grow" ] [] , div [ class " relative h-6" ] [ input [ type_ "text" - , placeholder "Filter …" + , placeholder texts.filterPlaceholder , onInput Search , class "bg-blue-50 w-30 h-6 px-0 py-0 text-xs" , class "border-0 border-b border-gray-200 focus:ring-0 focus:border-black" diff --git a/modules/webapp/src/main/elm/Comp/UiSettingsForm.elm b/modules/webapp/src/main/elm/Comp/UiSettingsForm.elm index 865c9a91..23e9cf48 100644 --- a/modules/webapp/src/main/elm/Comp/UiSettingsForm.elm +++ b/modules/webapp/src/main/elm/Comp/UiSettingsForm.elm @@ -109,7 +109,6 @@ init flags settings = (Just 10) (Just flags.config.maxPageSize) False - "Page size" , tagColors = settings.tagCategoryColors , tagColorModel = Comp.ColorTagger.init @@ -122,28 +121,24 @@ init flags settings = (Just 0) (Just flags.config.maxNoteLength) False - "Max. Note Length" , searchMenuFolderCount = Just settings.searchMenuFolderCount , searchMenuFolderCountModel = Comp.IntField.init (Just 0) (Just 2000) False - "Number of folders in search menu" , searchMenuTagCount = Just settings.searchMenuTagCount , searchMenuTagCountModel = Comp.IntField.init (Just 0) (Just 2000) False - "Number of tags in search menu" , searchMenuTagCatCount = Just settings.searchMenuTagCatCount , searchMenuTagCatCountModel = Comp.IntField.init (Just 0) (Just 2000) False - "Number of categories in search menu" , formFields = settings.formFields , itemDetailShortcuts = settings.itemDetailShortcuts , cardPreviewSize = settings.cardPreviewSize @@ -535,10 +530,12 @@ settingFormTabs texts flags _ model = , info = Nothing , body = [ Html.map SearchPageSizeMsg - (Comp.IntField.viewWithInfo2 - (texts.maxResultsPerPageInfo flags.config.maxPageSize) - model.itemSearchPageSize - "mb-4" + (Comp.IntField.view + { label = texts.maxResultsPerPage + , info = texts.maxResultsPerPageInfo flags.config.maxPageSize + , number = model.itemSearchPageSize + , classes = "mb-4" + } model.searchPageSizeModel ) , div [ class "mb-4" ] @@ -567,10 +564,12 @@ settingFormTabs texts flags _ model = , info = Nothing , body = [ Html.map NoteLengthMsg - (Comp.IntField.viewWithInfo2 - (texts.maxNoteSizeInfo flags.config.maxNoteLength) - model.itemSearchNoteLength - "mb-4" + (Comp.IntField.view + { label = texts.maxNoteSize + , info = texts.maxNoteSizeInfo flags.config.maxNoteLength + , number = model.itemSearchNoteLength + , classes = "mb-4" + } model.searchNoteLengthModel ) , Html.map CardPreviewSizeMsg @@ -636,24 +635,30 @@ settingFormTabs texts flags _ model = , info = Nothing , body = [ Html.map SearchMenuTagMsg - (Comp.IntField.viewWithInfo2 - texts.searchMenuTagCountInfo - model.searchMenuTagCount - "mb-4" + (Comp.IntField.view + { label = texts.searchMenuTagCount + , info = texts.searchMenuTagCountInfo + , number = model.searchMenuTagCount + , classes = "mb-4" + } model.searchMenuTagCountModel ) , Html.map SearchMenuTagCatMsg - (Comp.IntField.viewWithInfo2 - texts.searchMenuCatCountInfo - model.searchMenuTagCatCount - "mb-4" + (Comp.IntField.view + { label = texts.searchMenuCatCount + , info = texts.searchMenuCatCountInfo + , number = model.searchMenuTagCatCount + , classes = "mb-4" + } model.searchMenuTagCatCountModel ) , Html.map SearchMenuFolderMsg - (Comp.IntField.viewWithInfo2 - texts.searchMenuFolderCountInfo - model.searchMenuFolderCount - "mb-4" + (Comp.IntField.view + { label = texts.searchMenuFolderCount + , info = texts.searchMenuFolderCountInfo + , number = model.searchMenuFolderCount + , classes = "mb-4" + } model.searchMenuFolderCountModel ) ] diff --git a/modules/webapp/src/main/elm/Comp/UserManage.elm b/modules/webapp/src/main/elm/Comp/UserManage.elm index 5bb7fe2d..70519b5e 100644 --- a/modules/webapp/src/main/elm/Comp/UserManage.elm +++ b/modules/webapp/src/main/elm/Comp/UserManage.elm @@ -239,7 +239,10 @@ viewTable2 texts model = , rootClasses = "mb-4" } , Html.map TableMsg (Comp.UserTable.view2 texts.userTable model.tableModel) - , B.loadingDimmer model.loading + , B.loadingDimmer + { active = model.loading + , label = texts.basics.loading + } ] @@ -251,7 +254,9 @@ viewForm2 texts settings model = dimmerSettings : Comp.YesNoDimmer.Settings dimmerSettings = - Comp.YesNoDimmer.defaultSettings2 texts.reallyDeleteUser + Comp.YesNoDimmer.defaultSettings texts.reallyDeleteUser + texts.basics.yes + texts.basics.no in Html.form [ class "flex flex-col md:relative" @@ -317,5 +322,8 @@ viewForm2 texts settings model = FormErrorInvalid -> text texts.pleaseCorrectErrors ] - , B.loadingDimmer model.loading + , B.loadingDimmer + { active = model.loading + , label = texts.basics.loading + } ] diff --git a/modules/webapp/src/main/elm/Comp/YesNoDimmer.elm b/modules/webapp/src/main/elm/Comp/YesNoDimmer.elm index e4006c49..d32ed1c3 100644 --- a/modules/webapp/src/main/elm/Comp/YesNoDimmer.elm +++ b/modules/webapp/src/main/elm/Comp/YesNoDimmer.elm @@ -4,7 +4,6 @@ module Comp.YesNoDimmer exposing , Settings , activate , defaultSettings - , defaultSettings2 , disable , emptyModel , initActive @@ -58,24 +57,13 @@ type alias Settings = } -defaultSettings : Settings -defaultSettings = - { message = "Delete this item permanently?" - , headerIcon = "exclamation icon" - , headerClass = "ui inverted icon header" - , confirmButton = "Yes, do it!" - , cancelButton = "No" - , extraClass = "" - } - - -defaultSettings2 : String -> Settings -defaultSettings2 msg = +defaultSettings : String -> String -> String -> Settings +defaultSettings msg yesLabel noLabel = { message = msg , headerIcon = "fa fa-exclamation-circle mr-3" , headerClass = "text-2xl font-bold text-center w-full" - , confirmButton = "Yes, do it!" - , cancelButton = "No" + , confirmButton = yesLabel + , cancelButton = noLabel , extraClass = "" } diff --git a/modules/webapp/src/main/elm/Data/Money.elm b/modules/webapp/src/main/elm/Data/Money.elm index 7856f517..cffe7dfc 100644 --- a/modules/webapp/src/main/elm/Data/Money.elm +++ b/modules/webapp/src/main/elm/Data/Money.elm @@ -1,5 +1,6 @@ module Data.Money exposing ( Money + , MoneyParseError(..) , format , fromString , normalizeInput @@ -11,7 +12,12 @@ type alias Money = Float -fromString : String -> Result String Money +type MoneyParseError + = RequireTwoDigitsAfterDot String + | NoOrTooManyPoints String + + +fromString : String -> Result MoneyParseError Money fromString str = let input = @@ -28,13 +34,13 @@ fromString str = if index == (len - 3) then String.toFloat input |> Maybe.map Ok - |> Maybe.withDefault (Err "Two digits required after the dot.") + |> Maybe.withDefault (Err (RequireTwoDigitsAfterDot str)) else - Err ("Two digits required after the dot: " ++ str) + Err (RequireTwoDigitsAfterDot str) _ -> - Err "One single dot + digits required for money." + Err (NoOrTooManyPoints str) format : Float -> String diff --git a/modules/webapp/src/main/elm/Messages/AttachmentMetaComp.elm b/modules/webapp/src/main/elm/Messages/AttachmentMetaComp.elm new file mode 100644 index 00000000..73c47b01 --- /dev/null +++ b/modules/webapp/src/main/elm/Messages/AttachmentMetaComp.elm @@ -0,0 +1,34 @@ +module Messages.AttachmentMetaComp exposing (..) + +import Messages.Basics + + +type alias Texts = + { basics : Messages.Basics.Texts + , extractedMetadata : String + , content : String + , labels : String + , proposals : String + , correspondentOrg : String + , correspondentPerson : String + , concerningPerson : String + , concerningEquipment : String + , itemDate : String + , itemDueDate : String + } + + +gb : Texts +gb = + { basics = Messages.Basics.gb + , extractedMetadata = "Extracted Meta Data" + , content = "Content" + , labels = "Labels" + , proposals = "Proposals" + , correspondentOrg = "Correspondent Organization" + , correspondentPerson = "Correspondent Person" + , concerningPerson = "Concerning Person" + , concerningEquipment = "Concerning Equipment" + , itemDate = "Item Date" + , itemDueDate = "Item Due Date" + } diff --git a/modules/webapp/src/main/elm/Messages/Basics.elm b/modules/webapp/src/main/elm/Messages/Basics.elm index 9a1f5790..3cf515da 100644 --- a/modules/webapp/src/main/elm/Messages/Basics.elm +++ b/modules/webapp/src/main/elm/Messages/Basics.elm @@ -20,6 +20,7 @@ type alias Texts = , yes : String , no : String , chooseTag : String + , loading : String } @@ -43,6 +44,7 @@ gb = , yes = "Yes" , no = "No" , chooseTag = "Choose a tag…" + , loading = "Loading…" } diff --git a/modules/webapp/src/main/elm/Messages/CalEventInputComp.elm b/modules/webapp/src/main/elm/Messages/CalEventInputComp.elm new file mode 100644 index 00000000..16f67534 --- /dev/null +++ b/modules/webapp/src/main/elm/Messages/CalEventInputComp.elm @@ -0,0 +1,28 @@ +module Messages.CalEventInputComp exposing (..) + + +type alias Texts = + { weekday : String + , year : String + , month : String + , day : String + , hour : String + , minute : String + , error : String + , schedule : String + , next : String + } + + +gb : Texts +gb = + { weekday = "Weekday" + , year = "Year" + , month = "Month" + , day = "Day" + , hour = "Hour" + , minute = "Minute" + , error = "Error" + , schedule = "Schedule" + , next = "Next" + } diff --git a/modules/webapp/src/main/elm/Messages/ChangePasswordFormComp.elm b/modules/webapp/src/main/elm/Messages/ChangePasswordFormComp.elm index b2ec9c6d..3a6d9696 100644 --- a/modules/webapp/src/main/elm/Messages/ChangePasswordFormComp.elm +++ b/modules/webapp/src/main/elm/Messages/ChangePasswordFormComp.elm @@ -1,8 +1,11 @@ module Messages.ChangePasswordFormComp exposing (..) +import Messages.Basics + type alias Texts = - { currentPassword : String + { basics : Messages.Basics.Texts + , currentPassword : String , newPassword : String , repeatPassword : String , currentPasswordPlaceholder : String @@ -13,7 +16,8 @@ type alias Texts = gb : Texts gb = - { currentPassword = "Current Password" + { basics = Messages.Basics.gb + , currentPassword = "Current Password" , newPassword = "New Password" , repeatPassword = "New Password (repeat)" , currentPasswordPlaceholder = "Password" diff --git a/modules/webapp/src/main/elm/Messages/ClassifierSettingsFormComp.elm b/modules/webapp/src/main/elm/Messages/ClassifierSettingsFormComp.elm index 38a4ef45..b342742a 100644 --- a/modules/webapp/src/main/elm/Messages/ClassifierSettingsFormComp.elm +++ b/modules/webapp/src/main/elm/Messages/ClassifierSettingsFormComp.elm @@ -1,8 +1,11 @@ module Messages.ClassifierSettingsFormComp exposing (..) +import Messages.CalEventInputComp + type alias Texts = - { autoTaggingText : String + { calEventInput : Messages.CalEventInputComp.Texts + , autoTaggingText : String , blacklistOrWhitelist : String , whitelistLabel : String , blacklistLabel : String @@ -14,7 +17,8 @@ type alias Texts = gb : Texts gb = - { autoTaggingText = + { calEventInput = Messages.CalEventInputComp.gb + , autoTaggingText = """ Auto-tagging works by learning from existing documents. The more diff --git a/modules/webapp/src/main/elm/Messages/CustomFieldInputComp.elm b/modules/webapp/src/main/elm/Messages/CustomFieldInputComp.elm new file mode 100644 index 00000000..63d9982c --- /dev/null +++ b/modules/webapp/src/main/elm/Messages/CustomFieldInputComp.elm @@ -0,0 +1,18 @@ +module Messages.CustomFieldInputComp exposing (..) + + +type alias Texts = + { errorNoValue : String + , errorNoNumber : String + , errorNoAmount : String + , errorNotANumber : String -> String + } + + +gb : Texts +gb = + { errorNoValue = "Please fill in some value" + , errorNoNumber = "No number given" + , errorNoAmount = "No amount given" + , errorNotANumber = \str -> "Not a number: " ++ str + } diff --git a/modules/webapp/src/main/elm/Messages/CustomFieldMultiInputComp.elm b/modules/webapp/src/main/elm/Messages/CustomFieldMultiInputComp.elm new file mode 100644 index 00000000..96e2a209 --- /dev/null +++ b/modules/webapp/src/main/elm/Messages/CustomFieldMultiInputComp.elm @@ -0,0 +1,14 @@ +module Messages.CustomFieldMultiInputComp exposing (..) + +import Messages.CustomFieldInputComp + + +type alias Texts = + { customFieldInput : Messages.CustomFieldInputComp.Texts + } + + +gb : Texts +gb = + { customFieldInput = Messages.CustomFieldInputComp.gb + } diff --git a/modules/webapp/src/main/elm/Messages/EditFormComp.elm b/modules/webapp/src/main/elm/Messages/EditFormComp.elm index 871c03fb..9b0b085e 100644 --- a/modules/webapp/src/main/elm/Messages/EditFormComp.elm +++ b/modules/webapp/src/main/elm/Messages/EditFormComp.elm @@ -1,10 +1,12 @@ module Messages.EditFormComp exposing (..) import Messages.Basics +import Messages.CustomFieldMultiInputComp type alias Texts = { basics : Messages.Basics.Texts + , customFieldInput : Messages.CustomFieldMultiInputComp.Texts , createNewCustomField : String , chooseDirection : String , selectPlaceholder : String @@ -34,6 +36,7 @@ type alias Texts = gb : Texts gb = { basics = Messages.Basics.gb + , customFieldInput = Messages.CustomFieldMultiInputComp.gb , createNewCustomField = "Create new custom field" , chooseDirection = "Choose a direction…" , selectPlaceholder = "Select…" diff --git a/modules/webapp/src/main/elm/Messages/EmailSettingsFormComp.elm b/modules/webapp/src/main/elm/Messages/EmailSettingsFormComp.elm index a3117c6b..1b971a48 100644 --- a/modules/webapp/src/main/elm/Messages/EmailSettingsFormComp.elm +++ b/modules/webapp/src/main/elm/Messages/EmailSettingsFormComp.elm @@ -11,6 +11,7 @@ type alias Texts = , connectionNameInfo : String , smtpHost : String , smtpHostPlaceholder : String + , smtpPort : String , smtpUser : String , smtpUserPlaceholder : String , smtpPassword : String @@ -32,6 +33,7 @@ gb = , connectionNameInfo = "The connection name must not contain whitespace or special characters." , smtpHost = "SMTP Host" , smtpHostPlaceholder = "SMTP host name, e.g. 'mail.gmail.com'" + , smtpPort = "SMTP Port" , smtpUser = "SMTP User" , smtpUserPlaceholder = "SMTP Username, e.g. 'your.name@gmail.com'" , smtpPassword = "SMTP Password" diff --git a/modules/webapp/src/main/elm/Messages/HomeSideMenu.elm b/modules/webapp/src/main/elm/Messages/HomeSideMenu.elm index bc6a9256..0517f6cf 100644 --- a/modules/webapp/src/main/elm/Messages/HomeSideMenu.elm +++ b/modules/webapp/src/main/elm/Messages/HomeSideMenu.elm @@ -1,12 +1,12 @@ module Messages.HomeSideMenu exposing (..) -import Messages.MultiEditComp +import Messages.MultiEditMenuComp import Messages.SearchMenuComp type alias Texts = { searchMenu : Messages.SearchMenuComp.Texts - , multiEdit : Messages.MultiEditComp.Texts + , multiEdit : Messages.MultiEditMenuComp.Texts , editMode : String , resetSearchForm : String , multiEditHeader : String @@ -18,7 +18,7 @@ type alias Texts = gb : Texts gb = { searchMenu = Messages.SearchMenuComp.gb - , multiEdit = Messages.MultiEditComp.gb + , multiEdit = Messages.MultiEditMenuComp.gb , editMode = "Edit Mode" , resetSearchForm = "Reset search form" , multiEditHeader = "Multi-Edit" diff --git a/modules/webapp/src/main/elm/Messages/ImapSettingsFormComp.elm b/modules/webapp/src/main/elm/Messages/ImapSettingsFormComp.elm index 6a5c095d..9c2ae4be 100644 --- a/modules/webapp/src/main/elm/Messages/ImapSettingsFormComp.elm +++ b/modules/webapp/src/main/elm/Messages/ImapSettingsFormComp.elm @@ -11,6 +11,7 @@ type alias Texts = , connectionNameInfo : String , imapHost : String , imapHostPlaceholder : String + , imapPort : String , imapUser : String , imapUserPlaceholder : String , imapPassword : String @@ -30,6 +31,7 @@ gb = , connectionNameInfo = "The connection name must not contain whitespace or special characters." , imapHost = "IMAP Host" , imapHostPlaceholder = "IMAP host name, e.g. 'mail.gmail.com'" + , imapPort = "IMAP Port" , imapUser = "IMAP User" , imapUserPlaceholder = "IMAP Username, e.g. 'your.name@gmail.com'" , imapPassword = "IMAP Password" diff --git a/modules/webapp/src/main/elm/Messages/ItemDetailComp.elm b/modules/webapp/src/main/elm/Messages/ItemDetailComp.elm index 715badec..d3e64c2c 100644 --- a/modules/webapp/src/main/elm/Messages/ItemDetailComp.elm +++ b/modules/webapp/src/main/elm/Messages/ItemDetailComp.elm @@ -33,6 +33,7 @@ type alias Texts = , itemId : String , createdOn : String , lastUpdateOn : String + , sendingMailNow : String } @@ -61,4 +62,5 @@ gb = , itemId = "Item ID" , createdOn = "Created on" , lastUpdateOn = "Last update on" + , sendingMailNow = "Sending e-mail…" } diff --git a/modules/webapp/src/main/elm/Messages/MultiEditComp.elm b/modules/webapp/src/main/elm/Messages/MultiEditMenuComp.elm similarity index 88% rename from modules/webapp/src/main/elm/Messages/MultiEditComp.elm rename to modules/webapp/src/main/elm/Messages/MultiEditMenuComp.elm index 77f0752f..38920dbc 100644 --- a/modules/webapp/src/main/elm/Messages/MultiEditComp.elm +++ b/modules/webapp/src/main/elm/Messages/MultiEditMenuComp.elm @@ -1,10 +1,12 @@ -module Messages.MultiEditComp exposing (..) +module Messages.MultiEditMenuComp exposing (..) import Messages.Basics +import Messages.CustomFieldMultiInputComp type alias Texts = { basics : Messages.Basics.Texts + , customFieldMultiInput : Messages.CustomFieldMultiInputComp.Texts , tagModeAddInfo : String , tagModeRemoveInfo : String , tagModeReplaceInfo : String @@ -32,6 +34,7 @@ type alias Texts = gb : Texts gb = { basics = Messages.Basics.gb + , customFieldMultiInput = Messages.CustomFieldMultiInputComp.gb , tagModeAddInfo = "Tags chosen here are *added* to all selected items." , tagModeRemoveInfo = "Tags chosen here are *removed* from all selected items." , tagModeReplaceInfo = "Tags chosen here *replace* those on selected items." diff --git a/modules/webapp/src/main/elm/Messages/NotificationFormComp.elm b/modules/webapp/src/main/elm/Messages/NotificationFormComp.elm index b5a5acf0..40360189 100644 --- a/modules/webapp/src/main/elm/Messages/NotificationFormComp.elm +++ b/modules/webapp/src/main/elm/Messages/NotificationFormComp.elm @@ -1,10 +1,12 @@ module Messages.NotificationFormComp exposing (..) import Messages.Basics +import Messages.CalEventInputComp type alias Texts = { basics : Messages.Basics.Texts + , calEventInput : Messages.CalEventInputComp.Texts , reallyDeleteTask : String , startOnce : String , startTaskNow : String @@ -22,6 +24,7 @@ type alias Texts = , tagsExclude : String , tagsExcludeInfo : String , remindDaysInfo : String + , remindDaysLabel : String , capOverdue : String , capOverdueInfo : String , schedule : String @@ -33,6 +36,7 @@ type alias Texts = gb : Texts gb = { basics = Messages.Basics.gb + , calEventInput = Messages.CalEventInputComp.gb , reallyDeleteTask = "Really delete this notification task?" , startOnce = "Start Once" , startTaskNow = "Start this task now" @@ -49,6 +53,7 @@ gb = , tagsIncludeInfo = "Items must have all the tags specified here." , tagsExclude = "Tags Exclude (or)" , tagsExcludeInfo = "Items must not have any tag specified here." + , remindDaysLabel = "Remind Days" , remindDaysInfo = "Select items with a due date *lower than* `today+remindDays`" , capOverdue = "Cap overdue items" , capOverdueInfo = "If checked, only items with a due date *greater than* `today - remindDays` are considered." diff --git a/modules/webapp/src/main/elm/Messages/ScanMailboxFormComp.elm b/modules/webapp/src/main/elm/Messages/ScanMailboxFormComp.elm index ccdbe265..4972896c 100644 --- a/modules/webapp/src/main/elm/Messages/ScanMailboxFormComp.elm +++ b/modules/webapp/src/main/elm/Messages/ScanMailboxFormComp.elm @@ -1,10 +1,12 @@ module Messages.ScanMailboxFormComp exposing (..) import Messages.Basics +import Messages.CalEventInputComp type alias Texts = { basics : Messages.Basics.Texts + , calEventInput : Messages.CalEventInputComp.Texts , reallyDeleteTask : String , startOnce : String , startNow : String @@ -29,6 +31,7 @@ type alias Texts = , folders : String , foldersInfo : String , receivedHoursInfo : String + , receivedHoursLabel : String , fileFilter : String , fileFilterInfo : String , subjectFilter : String @@ -57,6 +60,7 @@ type alias Texts = gb : Texts gb = { basics = Messages.Basics.gb + , calEventInput = Messages.CalEventInputComp.gb , reallyDeleteTask = "Really delete this scan mailbox task?" , startOnce = "Start Once" , startNow = "Start this task now" @@ -81,6 +85,7 @@ gb = , folders = "Folders" , foldersInfo = "The folders to look for mails." , receivedHoursInfo = "Select mails newer than `now - receivedHours`" + , receivedHoursLabel = "Received Since Hours" , fileFilter = "File Filter" , fileFilterInfo = "Specify a file glob to filter attachments. For example, to only extract pdf files: " diff --git a/modules/webapp/src/main/elm/Messages/SearchMenuComp.elm b/modules/webapp/src/main/elm/Messages/SearchMenuComp.elm index 80fad1d6..92119a90 100644 --- a/modules/webapp/src/main/elm/Messages/SearchMenuComp.elm +++ b/modules/webapp/src/main/elm/Messages/SearchMenuComp.elm @@ -1,10 +1,14 @@ module Messages.SearchMenuComp exposing (..) import Messages.Basics +import Messages.CustomFieldMultiInputComp +import Messages.TagSelectComp type alias Texts = { basics : Messages.Basics.Texts + , customFieldMultiInput : Messages.CustomFieldMultiInputComp.Texts + , tagSelect : Messages.TagSelectComp.Texts , chooseDirection : String , choosePerson : String , chooseEquipment : String @@ -41,6 +45,8 @@ type alias Texts = gb : Texts gb = { basics = Messages.Basics.gb + , customFieldMultiInput = Messages.CustomFieldMultiInputComp.gb + , tagSelect = Messages.TagSelectComp.gb , chooseDirection = "Choose a direction…" , choosePerson = "Choose a person" , chooseEquipment = "Choose an equipment" diff --git a/modules/webapp/src/main/elm/Messages/SingleAttachmentComp.elm b/modules/webapp/src/main/elm/Messages/SingleAttachmentComp.elm index f044d653..40aca0e9 100644 --- a/modules/webapp/src/main/elm/Messages/SingleAttachmentComp.elm +++ b/modules/webapp/src/main/elm/Messages/SingleAttachmentComp.elm @@ -1,8 +1,11 @@ module Messages.SingleAttachmentComp exposing (..) +import Messages.AttachmentMetaComp + type alias Texts = - { noName : String + { attachmentMeta : Messages.AttachmentMetaComp.Texts + , noName : String , openFileInNewTab : String , downloadFile : String , renameFile : String @@ -17,7 +20,8 @@ type alias Texts = gb : Texts gb = - { noName = "No name" + { attachmentMeta = Messages.AttachmentMetaComp.gb + , noName = "No name" , openFileInNewTab = "Open file in new tab" , downloadFile = "Download file" , renameFile = "Rename file" diff --git a/modules/webapp/src/main/elm/Messages/TagSelectComp.elm b/modules/webapp/src/main/elm/Messages/TagSelectComp.elm new file mode 100644 index 00000000..e07949ac --- /dev/null +++ b/modules/webapp/src/main/elm/Messages/TagSelectComp.elm @@ -0,0 +1,16 @@ +module Messages.TagSelectComp exposing (..) + + +type alias Texts = + { hideEmpty : String + , showEmpty : String + , filterPlaceholder : String + } + + +gb : Texts +gb = + { hideEmpty = "Hide empty" + , showEmpty = "Show empty" + , filterPlaceholder = "Filter …" + } diff --git a/modules/webapp/src/main/elm/Messages/UiSettingsFormComp.elm b/modules/webapp/src/main/elm/Messages/UiSettingsFormComp.elm index d03d0a85..5da66fcb 100644 --- a/modules/webapp/src/main/elm/Messages/UiSettingsFormComp.elm +++ b/modules/webapp/src/main/elm/Messages/UiSettingsFormComp.elm @@ -12,17 +12,22 @@ type alias Texts = , uiLanguage : String , itemSearch : String , maxResultsPerPageInfo : Int -> String + , maxResultsPerPage : String , showBasicSearchStatsByDefault : String , enablePowerSearch : String , itemCards : String + , maxNoteSize : String , maxNoteSizeInfo : Int -> String , sizeOfItemPreview : String , cardTitlePattern : String , togglePatternHelpText : String , cardSubtitlePattern : String , searchMenu : String + , searchMenuTagCount : String , searchMenuTagCountInfo : String + , searchMenuCatCount : String , searchMenuCatCountInfo : String + , searchMenuFolderCount : String , searchMenuFolderCountInfo : String , itemDetail : String , browserNativePdfView : String @@ -48,9 +53,11 @@ gb = "Maximum results in one page when searching items. At most " ++ String.fromInt max ++ "." + , maxResultsPerPage = "Page size" , showBasicSearchStatsByDefault = "Show basic search statistics by default" , enablePowerSearch = "Enable power-user search bar" , itemCards = "Item Cards" + , maxNoteSize = "Max. Note Length" , maxNoteSizeInfo = \max -> "Maximum size of the item notes to display in card view. Between 0 - " @@ -61,8 +68,11 @@ gb = , togglePatternHelpText = "Toggle pattern help text" , cardSubtitlePattern = "Card Subtitle Pattern" , searchMenu = "Search Menu" + , searchMenuTagCount = "Number of tags in search menu" , searchMenuTagCountInfo = "How many tags to display in search menu at once. Others can be expanded. Use 0 to always show all." + , searchMenuCatCount = "Number of categories in search menu" , searchMenuCatCountInfo = "How many categories to display in search menu at once. Others can be expanded. Use 0 to always show all." + , searchMenuFolderCount = "Number of folders in search menu" , searchMenuFolderCountInfo = "How many folders to display in search menu at once. Other folders can be expanded. Use 0 to always show all." , itemDetail = "Item Detail" , browserNativePdfView = "Browser-native PDF preview" diff --git a/modules/webapp/src/main/elm/Page/Queue/View2.elm b/modules/webapp/src/main/elm/Page/Queue/View2.elm index c137cf92..1fd14053 100644 --- a/modules/webapp/src/main/elm/Page/Queue/View2.elm +++ b/modules/webapp/src/main/elm/Page/Queue/View2.elm @@ -287,13 +287,12 @@ dimmerSettings : Texts -> Comp.YesNoDimmer.Settings dimmerSettings texts = let defaults = - Comp.YesNoDimmer.defaultSettings + Comp.YesNoDimmer.defaultSettings texts.deleteThisJob texts.basics.yes texts.basics.no in { defaults | headerClass = "text-lg text-white" , headerIcon = "" , extraClass = "rounded" - , message = texts.deleteThisJob }