mirror of
https://github.com/TheAnachronism/docspell.git
synced 2025-06-23 02:48:26 +00:00
Prepare translating dates
This commit is contained in:
@ -18,7 +18,6 @@ import Http
|
||||
import Messages.Comp.AttachmentMeta exposing (Texts)
|
||||
import Styles as S
|
||||
import Util.Http
|
||||
import Util.Time
|
||||
|
||||
|
||||
type alias Model =
|
||||
@ -129,7 +128,7 @@ viewProposals2 texts props =
|
||||
[ class S.basicLabel
|
||||
, class "text-sm"
|
||||
]
|
||||
[ Util.Time.formatDateShort ms |> text
|
||||
[ texts.formatDateShort ms |> text
|
||||
]
|
||||
in
|
||||
div [ class "flex flex-col" ]
|
||||
|
@ -21,7 +21,6 @@ import Messages.Comp.CalEventInput exposing (Texts)
|
||||
import Styles as S
|
||||
import Util.Http
|
||||
import Util.Maybe
|
||||
import Util.Time
|
||||
|
||||
|
||||
type alias Model =
|
||||
@ -284,7 +283,7 @@ view2 texts extraClasses ev model =
|
||||
, ul [ class "list-decimal list-inside text-sm" ]
|
||||
(Maybe.map .next model.checkResult
|
||||
|> Maybe.withDefault []
|
||||
|> List.map Util.Time.formatDateTime
|
||||
|> List.map texts.formatDateTime
|
||||
|> List.map (\s -> li [ class "" ] [ text s ])
|
||||
)
|
||||
]
|
||||
|
@ -13,7 +13,6 @@ import Html exposing (..)
|
||||
import Html.Attributes exposing (..)
|
||||
import Messages.Comp.CustomFieldTable exposing (Texts)
|
||||
import Styles as S
|
||||
import Util.Time
|
||||
|
||||
|
||||
type alias Model =
|
||||
@ -59,13 +58,13 @@ view2 texts _ items =
|
||||
]
|
||||
]
|
||||
, tbody []
|
||||
(List.map viewItem2 items)
|
||||
(List.map (viewItem2 texts) items)
|
||||
]
|
||||
]
|
||||
|
||||
|
||||
viewItem2 : CustomField -> Html Msg
|
||||
viewItem2 item =
|
||||
viewItem2 : Texts -> CustomField -> Html Msg
|
||||
viewItem2 texts item =
|
||||
tr [ class S.tableRow ]
|
||||
[ B.editLinkTableCell (EditItem item)
|
||||
, td [ class "text-left py-4 md:py-2 pr-2" ]
|
||||
@ -79,7 +78,7 @@ viewItem2 item =
|
||||
|> text
|
||||
]
|
||||
, td [ class "text-center py-4 md:py-2 hidden sm:table-cell" ]
|
||||
[ Util.Time.formatDateShort item.created
|
||||
[ texts.formatDateShort item.created
|
||||
|> text
|
||||
]
|
||||
]
|
||||
|
@ -13,7 +13,6 @@ import Html exposing (..)
|
||||
import Html.Attributes exposing (..)
|
||||
import Messages.Comp.FolderTable exposing (Texts)
|
||||
import Styles as S
|
||||
import Util.Time
|
||||
|
||||
|
||||
type alias Model =
|
||||
@ -69,12 +68,12 @@ view2 texts _ items =
|
||||
]
|
||||
]
|
||||
, tbody []
|
||||
(List.map viewItem2 items)
|
||||
(List.map (viewItem2 texts) items)
|
||||
]
|
||||
|
||||
|
||||
viewItem2 : FolderItem -> Html Msg
|
||||
viewItem2 item =
|
||||
viewItem2 : Texts -> FolderItem -> Html Msg
|
||||
viewItem2 texts item =
|
||||
tr
|
||||
[ class S.tableRow
|
||||
]
|
||||
@ -97,7 +96,7 @@ viewItem2 item =
|
||||
|> text
|
||||
]
|
||||
, td [ class "text-center py-4 md:py-2" ]
|
||||
[ Util.Time.formatDateShort item.created
|
||||
[ texts.formatDateShort item.created
|
||||
|> text
|
||||
]
|
||||
]
|
||||
|
@ -221,6 +221,14 @@ fulltextResultsContent2 item =
|
||||
(List.map renderHighlightEntry2 item.highlighting)
|
||||
|
||||
|
||||
templateCtx : Texts -> IT.TemplateContext
|
||||
templateCtx texts =
|
||||
{ dateFormatLong = texts.formatDateLong
|
||||
, dateFormatShort = texts.formatDateShort
|
||||
, directionLabel = texts.directionLabel
|
||||
}
|
||||
|
||||
|
||||
metaDataContent2 : Texts -> UiSettings -> ItemLight -> Html Msg
|
||||
metaDataContent2 texts settings item =
|
||||
let
|
||||
@ -249,7 +257,7 @@ metaDataContent2 texts settings item =
|
||||
, Comp.LinkTarget.makeSourceLink
|
||||
[ ( "hover:opacity-60", True ) ]
|
||||
SetLinkTarget
|
||||
(IT.render IT.source item)
|
||||
(IT.render IT.source (templateCtx texts) item)
|
||||
]
|
||||
]
|
||||
]
|
||||
@ -289,7 +297,7 @@ mainContent2 texts cardAction cardColor isConfirmed settings _ item =
|
||||
[ class (Data.Direction.iconFromMaybe2 item.direction)
|
||||
, class "mr-2 w-4 text-center"
|
||||
, classList [ ( "hidden", fieldHidden Data.Fields.Direction ) ]
|
||||
, IT.render IT.direction item |> title
|
||||
, IT.render IT.direction (templateCtx texts) item |> title
|
||||
]
|
||||
[]
|
||||
|
||||
@ -330,9 +338,9 @@ mainContent2 texts cardAction cardColor isConfirmed settings _ item =
|
||||
)
|
||||
, div
|
||||
[ class "font-bold py-1 text-lg"
|
||||
, classList [ ( "hidden", IT.render titlePattern item == "" ) ]
|
||||
, classList [ ( "hidden", IT.render titlePattern (templateCtx texts) item == "" ) ]
|
||||
]
|
||||
[ IT.render titlePattern item |> text
|
||||
[ IT.render titlePattern (templateCtx texts) item |> text
|
||||
]
|
||||
, div
|
||||
[ classList
|
||||
@ -347,11 +355,11 @@ mainContent2 texts cardAction cardColor isConfirmed settings _ item =
|
||||
, div
|
||||
[ classList
|
||||
[ ( "opacity-75", True )
|
||||
, ( "hidden", IT.render subtitlePattern item == "" )
|
||||
, ( "hidden", IT.render subtitlePattern (templateCtx texts) item == "" )
|
||||
]
|
||||
]
|
||||
[ dirIcon
|
||||
, IT.render subtitlePattern item |> text
|
||||
, IT.render subtitlePattern (templateCtx texts) item |> text
|
||||
]
|
||||
, div [ class "" ]
|
||||
[ mainTagsAndFields2 settings item
|
||||
@ -466,7 +474,7 @@ previewMenu2 texts settings model item mainAttach =
|
||||
|> Maybe.withDefault "/api/v1/sec/attachment/none"
|
||||
|
||||
dueDate =
|
||||
IT.render IT.dueDateShort item
|
||||
IT.render IT.dueDateShort (templateCtx texts) item
|
||||
|
||||
dueDateLabel =
|
||||
div
|
||||
|
@ -32,7 +32,6 @@ import Styles as S
|
||||
import Util.Folder
|
||||
import Util.Person
|
||||
import Util.Tag
|
||||
import Util.Time
|
||||
|
||||
|
||||
view2 : Texts -> Flags -> UiSettings -> Model -> Html Msg
|
||||
@ -467,7 +466,7 @@ renderItemDateSuggestions : Texts -> Model -> Html Msg
|
||||
renderItemDateSuggestions texts model =
|
||||
renderSuggestions texts
|
||||
model
|
||||
Util.Time.formatDate
|
||||
texts.formatDate
|
||||
(List.take 6 model.itemProposals.itemDate)
|
||||
SetItemDateSuggestion
|
||||
|
||||
@ -476,7 +475,7 @@ renderDueDateSuggestions : Texts -> Model -> Html Msg
|
||||
renderDueDateSuggestions texts model =
|
||||
renderSuggestions texts
|
||||
model
|
||||
Util.Time.formatDate
|
||||
texts.formatDate
|
||||
(List.take 6 model.itemProposals.dueDate)
|
||||
SetDueDateSuggestion
|
||||
|
||||
|
@ -19,7 +19,6 @@ import Messages.Comp.ItemDetail.ItemInfoHeader exposing (Texts)
|
||||
import Page exposing (Page(..))
|
||||
import Styles as S
|
||||
import Util.Maybe
|
||||
import Util.Time
|
||||
|
||||
|
||||
view : Texts -> UiSettings -> Model -> Html Msg
|
||||
@ -32,7 +31,7 @@ view texts settings model =
|
||||
]
|
||||
[ Icons.dateIcon2 "mr-2"
|
||||
, Maybe.withDefault model.item.created model.item.itemDate
|
||||
|> Util.Time.formatDate
|
||||
|> texts.formatDate
|
||||
|> text
|
||||
]
|
||||
, Data.UiSettings.fieldVisible settings Data.Fields.Date
|
||||
@ -51,7 +50,7 @@ view texts settings model =
|
||||
, title texts.dueDate
|
||||
]
|
||||
[ Icons.dueDateIcon2 "mr-2"
|
||||
, Maybe.map Util.Time.formatDate model.item.dueDate
|
||||
, Maybe.map texts.formatDate model.item.dueDate
|
||||
|> Maybe.withDefault ""
|
||||
|> text
|
||||
]
|
||||
|
@ -292,14 +292,14 @@ itemIdInfo texts model =
|
||||
, title texts.createdOn
|
||||
]
|
||||
[ i [ class "fa fa-sun font-thin mr-2" ] []
|
||||
, Util.Time.formatDateTime model.item.created |> text
|
||||
, texts.formatDateTime model.item.created |> text
|
||||
]
|
||||
, div
|
||||
[ class "inline-flex items-center"
|
||||
, title texts.lastUpdateOn
|
||||
]
|
||||
[ i [ class "fa fa-pencil-alt mr-2" ] []
|
||||
, Util.Time.formatDateTime model.item.updated |> text
|
||||
, texts.formatDateTime model.item.updated |> text
|
||||
]
|
||||
]
|
||||
|
||||
|
@ -15,7 +15,6 @@ import Html.Attributes exposing (..)
|
||||
import Html.Events exposing (onClick)
|
||||
import Messages.Comp.SentMails exposing (Texts)
|
||||
import Styles as S
|
||||
import Util.Time
|
||||
|
||||
|
||||
type alias Model =
|
||||
@ -82,7 +81,7 @@ view2 texts model =
|
||||
[ text (texts.date ++ ":")
|
||||
]
|
||||
, div [ class "ml-2" ]
|
||||
[ Util.Time.formatDateTime mail.created |> text
|
||||
[ texts.formatDateTime mail.created |> text
|
||||
]
|
||||
]
|
||||
, div [ class "flex flex-row" ]
|
||||
@ -131,13 +130,13 @@ view2 texts model =
|
||||
]
|
||||
, tbody [] <|
|
||||
List.map
|
||||
renderLine2
|
||||
(renderLine2 texts)
|
||||
model.mails
|
||||
]
|
||||
|
||||
|
||||
renderLine2 : SentMail -> Html Msg
|
||||
renderLine2 mail =
|
||||
renderLine2 : Texts -> SentMail -> Html Msg
|
||||
renderLine2 texts mail =
|
||||
tr [ class S.tableRow ]
|
||||
[ td []
|
||||
[ B.linkLabel
|
||||
@ -152,7 +151,7 @@ renderLine2 mail =
|
||||
]
|
||||
, td [ class "hidden" ] [ text mail.subject ]
|
||||
, td [ class "hidden text-center xl:table-cell" ]
|
||||
[ Util.Time.formatDateTime mail.created |> text
|
||||
[ texts.formatDateTime mail.created |> text
|
||||
]
|
||||
, td [ class "hidden" ] [ text mail.sender ]
|
||||
]
|
||||
|
@ -13,7 +13,6 @@ import Html exposing (..)
|
||||
import Html.Attributes exposing (..)
|
||||
import Messages.Comp.UserTable exposing (Texts)
|
||||
import Styles as S
|
||||
import Util.Time exposing (formatDateTime)
|
||||
|
||||
|
||||
type alias Model =
|
||||
@ -93,9 +92,9 @@ renderUserLine2 texts model user =
|
||||
[ String.fromInt user.loginCount |> text
|
||||
]
|
||||
, td [ class "hidden sm:table-cell text-center" ]
|
||||
[ Maybe.map formatDateTime user.lastLogin |> Maybe.withDefault "" |> text
|
||||
[ Maybe.map texts.formatDateTime user.lastLogin |> Maybe.withDefault "" |> text
|
||||
]
|
||||
, td [ class "hidden md:table-cell text-center" ]
|
||||
[ formatDateTime user.created |> text
|
||||
[ texts.formatDateTime user.created |> text
|
||||
]
|
||||
]
|
||||
|
Reference in New Issue
Block a user