mirror of
https://github.com/TheAnachronism/docspell.git
synced 2025-04-15 07:09:33 +00:00
Use externalized strings for edit label
This commit is contained in:
parent
9070f69c93
commit
9d6e26efb4
@ -1,7 +1,6 @@
|
||||
module Comp.Basic exposing
|
||||
( editLinkLabel
|
||||
, editLinkTableCell
|
||||
, editLinkTableCell2
|
||||
, genericButton
|
||||
, horizontalDivider
|
||||
, inputRequired
|
||||
@ -17,7 +16,6 @@ module Comp.Basic exposing
|
||||
import Html exposing (..)
|
||||
import Html.Attributes exposing (..)
|
||||
import Html.Events exposing (onClick)
|
||||
import Messages.Basics
|
||||
import Styles as S
|
||||
|
||||
|
||||
@ -192,32 +190,20 @@ loadingDimmer cfg =
|
||||
]
|
||||
|
||||
|
||||
editLinkLabel : msg -> Html msg
|
||||
editLinkLabel =
|
||||
editLinkLabel2 Messages.Basics.gb
|
||||
|
||||
|
||||
editLinkLabel2 : Messages.Basics.Texts -> msg -> Html msg
|
||||
editLinkLabel2 texts click =
|
||||
editLinkLabel : String -> msg -> Html msg
|
||||
editLinkLabel label click =
|
||||
linkLabel
|
||||
{ label = texts.edit
|
||||
{ label = label
|
||||
, icon = "fa fa-edit"
|
||||
, handler = click
|
||||
, disabled = False
|
||||
}
|
||||
|
||||
|
||||
editLinkTableCell : msg -> Html msg
|
||||
editLinkTableCell m =
|
||||
editLinkTableCell : String -> msg -> Html msg
|
||||
editLinkTableCell label m =
|
||||
td [ class S.editLinkTableCellStyle ]
|
||||
[ editLinkLabel2 Messages.Basics.gb m
|
||||
]
|
||||
|
||||
|
||||
editLinkTableCell2 : Messages.Basics.Texts -> msg -> Html msg
|
||||
editLinkTableCell2 texts m =
|
||||
td [ class S.editLinkTableCellStyle ]
|
||||
[ editLinkLabel2 texts m
|
||||
[ editLinkLabel label m
|
||||
]
|
||||
|
||||
|
||||
|
@ -118,6 +118,7 @@ update msg model =
|
||||
|
||||
type alias ViewSettings =
|
||||
{ contactTypeLabel : ContactType -> String
|
||||
, editLabel : String
|
||||
, mobile : Bool
|
||||
, selectPlaceholder : String
|
||||
}
|
||||
@ -172,23 +173,23 @@ view2 cfg _ model =
|
||||
]
|
||||
, class "flex flex-col space-y-2 mt-2 px-2 border-0 border-l dark:border-bluegray-600 "
|
||||
]
|
||||
(List.map (renderItem2 cfg.mobile) model.items)
|
||||
(List.map (renderItem2 cfg) model.items)
|
||||
]
|
||||
|
||||
|
||||
renderItem2 : Bool -> Contact -> Html Msg
|
||||
renderItem2 mobile contact =
|
||||
renderItem2 : ViewSettings -> Contact -> Html Msg
|
||||
renderItem2 cfg contact =
|
||||
div
|
||||
[ class "flex flex-row space-x-2 items-center"
|
||||
]
|
||||
[ div [ class "mr-2 flex-nowrap" ]
|
||||
[ B.editLinkLabel (Select contact)
|
||||
[ B.editLinkLabel cfg.editLabel (Select contact)
|
||||
]
|
||||
, div
|
||||
[ class "inline-flex items-center" ]
|
||||
[ div
|
||||
[ class "label inline-block mr-2 hidden text-sm "
|
||||
, classList [ ( " sm:inline-block", not mobile ) ]
|
||||
, classList [ ( " sm:inline-block", not cfg.mobile ) ]
|
||||
]
|
||||
[ text contact.kind
|
||||
]
|
||||
|
@ -66,7 +66,7 @@ view2 texts _ items =
|
||||
viewItem2 : Texts -> CustomField -> Html Msg
|
||||
viewItem2 texts item =
|
||||
tr [ class S.tableRow ]
|
||||
[ B.editLinkTableCell (EditItem item)
|
||||
[ B.editLinkTableCell texts.basics.edit (EditItem item)
|
||||
, td [ class "text-left py-4 md:py-2 pr-2" ]
|
||||
[ text <| Maybe.withDefault item.name item.label
|
||||
]
|
||||
|
@ -60,12 +60,12 @@ view2 texts model =
|
||||
]
|
||||
]
|
||||
, tbody []
|
||||
(List.map (renderLine2 model) model.emailSettings)
|
||||
(List.map (renderLine2 texts model) model.emailSettings)
|
||||
]
|
||||
|
||||
|
||||
renderLine2 : Model -> EmailSettings -> Html Msg
|
||||
renderLine2 _ ems =
|
||||
renderLine2 : Texts -> Model -> EmailSettings -> Html Msg
|
||||
renderLine2 texts _ ems =
|
||||
let
|
||||
hostport =
|
||||
case ems.smtpPort of
|
||||
@ -77,7 +77,7 @@ renderLine2 _ ems =
|
||||
in
|
||||
tr
|
||||
[ class S.tableRow ]
|
||||
[ B.editLinkTableCell (Select ems)
|
||||
[ B.editLinkTableCell texts.basics.edit (Select ems)
|
||||
, td [ class "text-left mr-2" ]
|
||||
[ text ems.name
|
||||
]
|
||||
|
@ -75,7 +75,7 @@ renderEquipmentLine2 texts model equip =
|
||||
[ classList [ ( "active", model.selected == Just equip ) ]
|
||||
, class S.tableRow
|
||||
]
|
||||
[ B.editLinkTableCell (Select equip)
|
||||
[ B.editLinkTableCell texts.basics.edit (Select equip)
|
||||
, td [ class "text-left pr-1 md:px-2" ]
|
||||
[ div [ class "label inline-flex text-sm" ]
|
||||
[ Data.EquipmentUse.fromString equip.use
|
||||
|
@ -77,7 +77,7 @@ viewItem2 texts item =
|
||||
tr
|
||||
[ class S.tableRow
|
||||
]
|
||||
[ B.editLinkTableCell (EditItem item)
|
||||
[ B.editLinkTableCell texts.basics.edit (EditItem item)
|
||||
, td [ class " py-4 md:py-2" ]
|
||||
[ text item.name
|
||||
, span
|
||||
|
@ -59,12 +59,12 @@ view2 texts model =
|
||||
]
|
||||
]
|
||||
, tbody []
|
||||
(List.map (renderLine2 model) model.emailSettings)
|
||||
(List.map (renderLine2 texts model) model.emailSettings)
|
||||
]
|
||||
|
||||
|
||||
renderLine2 : Model -> ImapSettings -> Html Msg
|
||||
renderLine2 _ ems =
|
||||
renderLine2 : Texts -> Model -> ImapSettings -> Html Msg
|
||||
renderLine2 texts _ ems =
|
||||
let
|
||||
hostport =
|
||||
case ems.imapPort of
|
||||
@ -76,7 +76,7 @@ renderLine2 _ ems =
|
||||
in
|
||||
tr
|
||||
[ class S.tableRow ]
|
||||
[ B.editLinkTableCell (Select ems)
|
||||
[ B.editLinkTableCell texts.basics.edit (Select ems)
|
||||
, td [ class "text-left mr-2" ] [ text ems.name ]
|
||||
, td [ class "text-left" ] [ text hostport ]
|
||||
]
|
||||
|
@ -65,15 +65,15 @@ view2 texts _ items =
|
||||
]
|
||||
]
|
||||
, tbody []
|
||||
(List.map viewItem2 items)
|
||||
(List.map (viewItem2 texts) items)
|
||||
]
|
||||
]
|
||||
|
||||
|
||||
viewItem2 : NotificationSettings -> Html Msg
|
||||
viewItem2 item =
|
||||
viewItem2 : Texts -> NotificationSettings -> Html Msg
|
||||
viewItem2 texts item =
|
||||
tr []
|
||||
[ B.editLinkTableCell (EditSettings item)
|
||||
[ B.editLinkTableCell texts.basics.edit (EditSettings item)
|
||||
, td [ class "w-px whitespace-nowrap px-2 text-center" ]
|
||||
[ Util.Html.checkbox2 item.enabled
|
||||
]
|
||||
|
@ -160,6 +160,7 @@ view2 texts mobile settings model =
|
||||
contactTypeCfg =
|
||||
{ mobile = mobile
|
||||
, contactTypeLabel = texts.contactTypeLabel
|
||||
, editLabel = texts.basics.edit
|
||||
, selectPlaceholder = texts.basics.selectPlaceholder
|
||||
}
|
||||
in
|
||||
|
@ -85,7 +85,7 @@ renderOrgLine2 texts model org =
|
||||
[ classList [ ( "active", model.selected == Just org ) ]
|
||||
, class S.tableRow
|
||||
]
|
||||
[ B.editLinkTableCell (Select org)
|
||||
[ B.editLinkTableCell texts.basics.edit (Select org)
|
||||
, td [ class "text-left pr-1 md:px-2" ]
|
||||
[ div [ class "label inline-flex text-sm" ]
|
||||
[ Data.OrgUse.fromString org.use
|
||||
|
@ -192,6 +192,7 @@ view2 texts mobile settings model =
|
||||
contactCfg =
|
||||
{ mobile = mobile
|
||||
, contactTypeLabel = texts.contactTypeLabel
|
||||
, editLabel = texts.basics.edit
|
||||
, selectPlaceholder = texts.basics.selectPlaceholder
|
||||
}
|
||||
in
|
||||
|
@ -78,7 +78,7 @@ renderPersonLine2 texts model person =
|
||||
[ classList [ ( "active", model.selected == Just person ) ]
|
||||
, class S.tableRow
|
||||
]
|
||||
[ B.editLinkTableCell (Select person)
|
||||
[ B.editLinkTableCell texts.basics.edit (Select person)
|
||||
, td [ class "text-left pr-1 md:px-2" ]
|
||||
[ div [ class "label inline-flex text-sm" ]
|
||||
[ Data.PersonUse.fromString person.use
|
||||
|
@ -63,15 +63,15 @@ view2 texts _ items =
|
||||
]
|
||||
]
|
||||
, tbody []
|
||||
(List.map viewItem2 items)
|
||||
(List.map (viewItem2 texts) items)
|
||||
]
|
||||
]
|
||||
|
||||
|
||||
viewItem2 : ScanMailboxSettings -> Html Msg
|
||||
viewItem2 item =
|
||||
viewItem2 : Texts -> ScanMailboxSettings -> Html Msg
|
||||
viewItem2 texts item =
|
||||
tr [ class S.tableRow ]
|
||||
[ B.editLinkTableCell (EditSettings item)
|
||||
[ B.editLinkTableCell texts.basics.edit (EditSettings item)
|
||||
, td [ class "w-px px-2" ]
|
||||
[ Util.Html.checkbox2 item.enabled
|
||||
]
|
||||
|
@ -81,7 +81,7 @@ renderSourceLine2 texts source =
|
||||
[ div
|
||||
[ class "inline-flex space-x-2"
|
||||
]
|
||||
[ B.editLinkLabel (Select source)
|
||||
[ B.editLinkLabel texts.basics.edit (Select source)
|
||||
, B.linkLabel
|
||||
{ label = texts.show
|
||||
, icon = "fa fa-eye"
|
||||
|
@ -62,17 +62,17 @@ view2 texts model =
|
||||
]
|
||||
]
|
||||
, tbody []
|
||||
(List.map (renderTagLine2 model) model.tags)
|
||||
(List.map (renderTagLine2 texts model) model.tags)
|
||||
]
|
||||
|
||||
|
||||
renderTagLine2 : Model -> Tag -> Html Msg
|
||||
renderTagLine2 model tag =
|
||||
renderTagLine2 : Texts -> Model -> Tag -> Html Msg
|
||||
renderTagLine2 texts model tag =
|
||||
tr
|
||||
[ classList [ ( "active", model.selected == Just tag ) ]
|
||||
, class S.tableRow
|
||||
]
|
||||
[ B.editLinkTableCell (Select tag)
|
||||
[ B.editLinkTableCell texts.basics.edit (Select tag)
|
||||
, td [ class "text-left py-4 md:py-2" ]
|
||||
[ text tag.name
|
||||
]
|
||||
|
@ -78,7 +78,7 @@ renderUserLine2 texts model user =
|
||||
[ classList [ ( "active", model.selected == Just user ) ]
|
||||
, class S.tableRow
|
||||
]
|
||||
[ B.editLinkTableCell2 texts.basics (Select user)
|
||||
[ B.editLinkTableCell texts.basics.edit (Select user)
|
||||
, td [ class "text-left" ]
|
||||
[ text user.login
|
||||
]
|
||||
|
@ -1,8 +1,11 @@
|
||||
module Messages.Comp.NotificationTable exposing (Texts, gb)
|
||||
|
||||
import Messages.Basics
|
||||
|
||||
|
||||
type alias Texts =
|
||||
{ summary : String
|
||||
{ basics : Messages.Basics.Texts
|
||||
, summary : String
|
||||
, schedule : String
|
||||
, connection : String
|
||||
, recipients : String
|
||||
@ -11,7 +14,8 @@ type alias Texts =
|
||||
|
||||
gb : Texts
|
||||
gb =
|
||||
{ summary = "Summary"
|
||||
{ basics = Messages.Basics.gb
|
||||
, summary = "Summary"
|
||||
, schedule = "Schedule"
|
||||
, connection = "Connection"
|
||||
, recipients = "Recipients"
|
||||
|
@ -1,8 +1,11 @@
|
||||
module Messages.Comp.ScanMailboxTable exposing (Texts, gb)
|
||||
|
||||
import Messages.Basics
|
||||
|
||||
|
||||
type alias Texts =
|
||||
{ summary : String
|
||||
{ basics : Messages.Basics.Texts
|
||||
, summary : String
|
||||
, connection : String
|
||||
, folders : String
|
||||
, receivedSince : String
|
||||
@ -11,7 +14,8 @@ type alias Texts =
|
||||
|
||||
gb : Texts
|
||||
gb =
|
||||
{ summary = "Summary"
|
||||
{ basics = Messages.Basics.gb
|
||||
, summary = "Summary"
|
||||
, connection = "Connection"
|
||||
, folders = "Folders"
|
||||
, receivedSince = "Received Since"
|
||||
|
@ -1,8 +1,11 @@
|
||||
module Messages.Comp.SourceTable exposing (Texts, gb)
|
||||
|
||||
import Messages.Basics
|
||||
|
||||
|
||||
type alias Texts =
|
||||
{ abbrev : String
|
||||
{ basics : Messages.Basics.Texts
|
||||
, abbrev : String
|
||||
, enabled : String
|
||||
, counter : String
|
||||
, priority : String
|
||||
@ -13,7 +16,8 @@ type alias Texts =
|
||||
|
||||
gb : Texts
|
||||
gb =
|
||||
{ abbrev = "Abbrev"
|
||||
{ basics = Messages.Basics.gb
|
||||
, abbrev = "Abbrev"
|
||||
, enabled = "Enabled"
|
||||
, counter = "Counter"
|
||||
, priority = "Priority"
|
||||
|
Loading…
x
Reference in New Issue
Block a user