From d80c5eb4ed56ba07de8eca658579c6d2005a8dad Mon Sep 17 00:00:00 2001 From: "Daniel J. Summers" Date: Thu, 14 Mar 2019 22:34:45 -0500 Subject: [PATCH 1/4] Change class to group in e-mail prompt (#8) --- src/PrayerTracker.UI/PrayerRequest.fs | 2 +- src/PrayerTracker.UI/Resources/Common.es.resx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/PrayerTracker.UI/PrayerRequest.fs b/src/PrayerTracker.UI/PrayerRequest.fs index e3a7601..2e7379c 100644 --- a/src/PrayerTracker.UI/PrayerRequest.fs +++ b/src/PrayerTracker.UI/PrayerRequest.fs @@ -302,7 +302,7 @@ let view m vi = icon "update"; rawText "  "; encLocText s.["List for Next Sunday"] ] yield spacer - let emailPrompt = s.["This will e-mail the current list to every member of your class, without further prompting. Are you sure this is what you are ready to do?"].Value + let emailPrompt = s.["This will e-mail the current list to every member of your group, without further prompting. Are you sure this is what you are ready to do?"].Value yield a [ _class "pt-icon-link" _href (sprintf "/prayer-requests/email/%s" dtString) _title s.["Send via E-mail"].Value diff --git a/src/PrayerTracker.UI/Resources/Common.es.resx b/src/PrayerTracker.UI/Resources/Common.es.resx index efd3d6e..80f9af9 100644 --- a/src/PrayerTracker.UI/Resources/Common.es.resx +++ b/src/PrayerTracker.UI/Resources/Common.es.resx @@ -709,7 +709,7 @@ Este Grupo - Esto enviará un correo electrónico la lista actual de todos los miembros de su clase, sin más indicaciones. ¿Estás seguro de que esto es lo que están dispuestos a hacer? + Esto enviará un correo electrónico la lista actual de todos los miembros de su grupo, sin más indicaciones. ¿Estás seguro de que esto es lo que están dispuestos a hacer? Para cambiar su contraseña, introduzca su contraseña actual en el cuadro se especifica a continuación, introduzca su nueva contraseña dos veces. From 05985189e773f2ef95b911f6ae03dfe01bebcb40 Mon Sep 17 00:00:00 2001 From: "Daniel J. Summers" Date: Thu, 14 Mar 2019 22:59:07 -0500 Subject: [PATCH 2/4] Don't show headings for empty tables (#6) --- src/PrayerTracker.UI/Church.fs | 77 ++++++++------- src/PrayerTracker.UI/PrayerRequest.fs | 33 ++++--- src/PrayerTracker.UI/SmallGroup.fs | 132 ++++++++++++++------------ src/PrayerTracker.UI/User.fs | 73 +++++++------- 4 files changed, 169 insertions(+), 146 deletions(-) diff --git a/src/PrayerTracker.UI/Church.fs b/src/PrayerTracker.UI/Church.fs index 983f8c4..8ec25dc 100644 --- a/src/PrayerTracker.UI/Church.fs +++ b/src/PrayerTracker.UI/Church.fs @@ -54,7 +54,46 @@ let edit (m : EditChurch) ctx vi = /// View for church maintenance page let maintain (churches : Church list) (stats : Map) ctx vi = - let s = I18N.localizer.Force () + let s = I18N.localizer.Force () + let chTbl = + match churches with + | [] -> space + | _ -> + table [ _class "pt-table pt-action-table" ] [ + thead [] [ + tr [] [ + th [] [ encLocText s.["Actions"] ] + th [] [ encLocText s.["Name"] ] + th [] [ encLocText s.["Location"] ] + th [] [ encLocText s.["Groups"] ] + th [] [ encLocText s.["Requests"] ] + th [] [ encLocText s.["Users"] ] + th [] [ encLocText s.["Interface?"] ] + ] + ] + churches + |> List.map (fun ch -> + let chId = flatGuid ch.churchId + let delAction = sprintf "/church/%s/delete" chId + let delPrompt = s.["Are you want to delete this {0}? This action cannot be undone.", + sprintf "%s (%s)" (s.["Church"].Value.ToLower ()) ch.name] + tr [] [ + td [] [ + a [ _href (sprintf "/church/%s/edit" chId); _title s.["Edit This Church"].Value ] [ icon "edit" ] + a [ _href delAction + _title s.["Delete This Church"].Value + _onclick (sprintf "return PT.confirmDelete('%s','%A')" delAction delPrompt) ] + [ icon "delete_forever" ] + ] + td [] [ encodedText ch.name ] + td [] [ encodedText ch.city; rawText ", "; encodedText ch.st ] + td [ _class "pt-right-text" ] [ rawText (stats.[chId].smallGroups.ToString "N0") ] + td [ _class "pt-right-text" ] [ rawText (stats.[chId].prayerRequests.ToString "N0") ] + td [ _class "pt-right-text" ] [ rawText (stats.[chId].users.ToString "N0") ] + td [ _class "pt-center-text" ] [ encLocText s.[match ch.hasInterface with true -> "Yes" | false -> "No"] ] + ]) + |> tbody [] + ] [ div [ _class "pt-center-text" ] [ br [] a [ _href (sprintf "/church/%s/edit" emptyGuid); _title s.["Add a New Church"].Value ] @@ -63,41 +102,7 @@ let maintain (churches : Church list) (stats : Map) ctx vi br [] ] tableSummary churches.Length s - table [ _class "pt-table pt-action-table" ] [ - thead [] [ - tr [] [ - th [] [ encLocText s.["Actions"] ] - th [] [ encLocText s.["Name"] ] - th [] [ encLocText s.["Location"] ] - th [] [ encLocText s.["Groups"] ] - th [] [ encLocText s.["Requests"] ] - th [] [ encLocText s.["Users"] ] - th [] [ encLocText s.["Interface?"] ] - ] - ] - churches - |> List.map (fun ch -> - let chId = flatGuid ch.churchId - let delAction = sprintf "/church/%s/delete" chId - let delPrompt = s.["Are you want to delete this {0}? This action cannot be undone.", - sprintf "%s (%s)" (s.["Church"].Value.ToLower ()) ch.name] - tr [] [ - td [] [ - a [ _href (sprintf "/church/%s/edit" chId); _title s.["Edit This Church"].Value ] [ icon "edit" ] - a [ _href delAction - _title s.["Delete This Church"].Value - _onclick (sprintf "return PT.confirmDelete('%s','%A')" delAction delPrompt) ] - [ icon "delete_forever" ] - ] - td [] [ encodedText ch.name ] - td [] [ encodedText ch.city; rawText ", "; encodedText ch.st ] - td [ _class "pt-right-text" ] [ rawText (stats.[chId].smallGroups.ToString "N0") ] - td [ _class "pt-right-text" ] [ rawText (stats.[chId].prayerRequests.ToString "N0") ] - td [ _class "pt-right-text" ] [ rawText (stats.[chId].users.ToString "N0") ] - td [ _class "pt-center-text" ] [ encLocText s.[match ch.hasInterface with true -> "Yes" | false -> "No"] ] - ]) - |> tbody [] - ] + chTbl form [ _id "DeleteForm"; _action ""; _method "post" ] [ csrfToken ctx ] ] |> Layout.Content.wide diff --git a/src/PrayerTracker.UI/PrayerRequest.fs b/src/PrayerTracker.UI/PrayerRequest.fs index 2e7379c..ec44e2d 100644 --- a/src/PrayerTracker.UI/PrayerRequest.fs +++ b/src/PrayerTracker.UI/PrayerRequest.fs @@ -210,7 +210,7 @@ let maintain (reqs : PrayerRequest seq) (grp : SmallGroup) onlyActive (ctx : Htt ] ]) |> List.ofSeq - [ div [ _class "pt-center-text" ] [ + [ yield div [ _class "pt-center-text" ] [ br [] a [ _href (sprintf "/prayer-request/%s/edit" emptyGuid); _title s.["Add a New Request"].Value ] [ icon "add_circle"; rawText "  "; encLocText s.["Add a New Request"] ] @@ -220,20 +220,23 @@ let maintain (reqs : PrayerRequest seq) (grp : SmallGroup) onlyActive (ctx : Htt br [] br [] ] - tableSummary requests.Length s - table [ _class "pt-table pt-action-table" ] [ - thead [] [ - tr [] [ - th [] [ encLocText s.["Actions"] ] - th [] [ encLocText s.["Updated Date"] ] - th [] [ encLocText s.["Type"] ] - th [] [ encLocText s.["Requestor"] ] - th [] [ encLocText s.["Request"] ] + yield tableSummary requests.Length s + match requests.Length with + | 0 -> () + | _ -> + yield table [ _class "pt-table pt-action-table" ] [ + thead [] [ + tr [] [ + th [] [ encLocText s.["Actions"] ] + th [] [ encLocText s.["Updated Date"] ] + th [] [ encLocText s.["Type"] ] + th [] [ encLocText s.["Requestor"] ] + th [] [ encLocText s.["Request"] ] + ] + ] + tbody [] requests ] - ] - tbody [] requests - ] - div [ _class "pt-center-text" ] [ + yield div [ _class "pt-center-text" ] [ yield br [] match onlyActive with | true -> @@ -245,7 +248,7 @@ let maintain (reqs : PrayerRequest seq) (grp : SmallGroup) onlyActive (ctx : Htt yield br [] yield a [ _href "/prayer-requests" ] [ encLocText s.["Do Not Show Inactive Requests"] ] ] - form [ _id "DeleteForm"; _action ""; _method "post" ] [ csrfToken ctx ] + yield form [ _id "DeleteForm"; _action ""; _method "post" ] [ csrfToken ctx ] ] |> Layout.Content.wide |> Layout.standard vi "Maintain Requests" diff --git a/src/PrayerTracker.UI/SmallGroup.fs b/src/PrayerTracker.UI/SmallGroup.fs index 8650b78..c64ae4d 100644 --- a/src/PrayerTracker.UI/SmallGroup.fs +++ b/src/PrayerTracker.UI/SmallGroup.fs @@ -174,7 +174,40 @@ let logOn (grps : SmallGroup list) grpId ctx vi = /// View for the small group maintenance page let maintain (grps : SmallGroup list) ctx vi = - let s = I18N.localizer.Force () + let s = I18N.localizer.Force () + let grpTbl = + match grps with + | [] -> space + | _ -> + table [ _class "pt-table pt-action-table" ] [ + thead [] [ + tr [] [ + th [] [ encLocText s.["Actions"] ] + th [] [ encLocText s.["Name"] ] + th [] [ encLocText s.["Church"] ] + th [] [ encLocText s.["Time Zone"] ] + ] + ] + grps + |> List.map (fun g -> + let grpId = flatGuid g.smallGroupId + let delAction = sprintf "/small-group/%s/delete" grpId + let delPrompt = s.["Are you want to delete this {0}? This action cannot be undone.", + sprintf "%s (%s)" (s.["Small Group"].Value.ToLower ()) g.name].Value + tr [] [ + td [] [ + a [ _href (sprintf "/small-group/%s/edit" grpId); _title s.["Edit This Group"].Value ] [ icon "edit" ] + a [ _href delAction + _title s.["Delete This Group"].Value + _onclick (sprintf "return PT.confirmDelete('%s','%s')" delAction delPrompt) ] + [ icon "delete_forever" ] + ] + td [] [ encodedText g.name ] + td [] [ encodedText g.church.name ] + td [] [ encLocText (TimeZones.name g.preferences.timeZoneId s) ] + ]) + |> tbody [] + ] [ div [ _class "pt-center-text" ] [ br [] a [ _href (sprintf "/small-group/%s/edit" emptyGuid); _title s.["Add a New Group"].Value ] [ @@ -186,35 +219,7 @@ let maintain (grps : SmallGroup list) ctx vi = br [] ] tableSummary grps.Length s - table [ _class "pt-table pt-action-table" ] [ - thead [] [ - tr [] [ - th [] [ encLocText s.["Actions"] ] - th [] [ encLocText s.["Name"] ] - th [] [ encLocText s.["Church"] ] - th [] [ encLocText s.["Time Zone"] ] - ] - ] - grps - |> List.map (fun g -> - let grpId = flatGuid g.smallGroupId - let delAction = sprintf "/small-group/%s/delete" grpId - let delPrompt = s.["Are you want to delete this {0}? This action cannot be undone.", - sprintf "%s (%s)" (s.["Small Group"].Value.ToLower ()) g.name].Value - tr [] [ - td [] [ - a [ _href (sprintf "/small-group/%s/edit" grpId); _title s.["Edit This Group"].Value ] [ icon "edit" ] - a [ _href delAction - _title s.["Delete This Group"].Value - _onclick (sprintf "return PT.confirmDelete('%s','%s')" delAction delPrompt) ] - [ icon "delete_forever" ] - ] - td [] [ encodedText g.name ] - td [] [ encodedText g.church.name ] - td [] [ encLocText (TimeZones.name g.preferences.timeZoneId s) ] - ]) - |> tbody [] - ] + grpTbl form [ _id "DeleteForm"; _action ""; _method "post" ] [ csrfToken ctx ] ] |> Layout.Content.standard @@ -223,7 +228,41 @@ let maintain (grps : SmallGroup list) ctx vi = /// View for the member maintenance page let members (mbrs : Member list) (emailTyps : Map) ctx vi = - let s = I18N.localizer.Force () + let s = I18N.localizer.Force () + let mbrTbl = + match mbrs with + | [] -> space + | _ -> + table [ _class "pt-table pt-action-table" ] [ + thead [] [ + tr [] [ + th [] [ encLocText s.["Actions"] ] + th [] [ encLocText s.["Name"] ] + th [] [ encLocText s.["E-mail Address"] ] + th [] [ encLocText s.["Format"] ] + ] + ] + mbrs + |> List.map (fun mbr -> + let mbrId = flatGuid mbr.memberId + let delAction = sprintf "/small-group/member/%s/delete" mbrId + let delPrompt = s.["Are you want to delete this {0} ({1})? This action cannot be undone.", + s.["group member"], mbr.memberName].Value + tr [] [ + td [] [ + a [ _href (sprintf "/small-group/member/%s/edit" mbrId); _title s.["Edit This Group Member"].Value ] + [ icon "edit" ] + a [ _href delAction + _title s.["Delete This Group Member"].Value + _onclick (sprintf "return PT.confirmDelete('%s','%s')" delAction delPrompt) ] + [ icon "delete_forever" ] + ] + td [] [ encodedText mbr.memberName ] + td [] [ encodedText mbr.email ] + td [] [ encLocText emailTyps.[defaultArg mbr.format ""] ] + ]) + |> tbody [] + ] [ div [ _class"pt-center-text" ] [ br [] a [ _href (sprintf "/small-group/member/%s/edit" emptyGuid); _title s.["Add a New Group Member"].Value ] @@ -232,36 +271,7 @@ let members (mbrs : Member list) (emailTyps : Map) ctx br [] ] tableSummary mbrs.Length s - table [ _class "pt-table pt-action-table" ] [ - thead [] [ - tr [] [ - th [] [ encLocText s.["Actions"] ] - th [] [ encLocText s.["Name"] ] - th [] [ encLocText s.["E-mail Address"] ] - th [] [ encLocText s.["Format"] ] - ] - ] - mbrs - |> List.map (fun mbr -> - let mbrId = flatGuid mbr.memberId - let delAction = sprintf "/small-group/member/%s/delete" mbrId - let delPrompt = s.["Are you want to delete this {0} ({1})? This action cannot be undone.", - s.["group member"], mbr.memberName].Value - tr [] [ - td [] [ - a [ _href (sprintf "/small-group/member/%s/edit" mbrId); _title s.["Edit This Group Member"].Value ] - [ icon "edit" ] - a [ _href delAction - _title s.["Delete This Group Member"].Value - _onclick (sprintf "return PT.confirmDelete('%s','%s')" delAction delPrompt) ] - [ icon "delete_forever" ] - ] - td [] [ encodedText mbr.memberName ] - td [] [ encodedText mbr.email ] - td [] [ encLocText emailTyps.[defaultArg mbr.format ""] ] - ]) - |> tbody [] - ] + mbrTbl form [ _id "DeleteForm"; _action ""; _method "post" ] [ csrfToken ctx ] ] |> Layout.Content.standard diff --git a/src/PrayerTracker.UI/User.fs b/src/PrayerTracker.UI/User.fs index 8cbbca6..b0a92de 100644 --- a/src/PrayerTracker.UI/User.fs +++ b/src/PrayerTracker.UI/User.fs @@ -173,7 +173,44 @@ let logOn (m : UserLogOn) groups ctx vi = /// View for the user maintenance page let maintain (users : User list) ctx vi = - let s = I18N.localizer.Force () + let s = I18N.localizer.Force () + let usrTbl = + match users with + | [] -> space + | _ -> + table [ _class "pt-table pt-action-table" ] [ + thead [] [ + tr [] [ + th [] [ encLocText s.["Actions"] ] + th [] [ encLocText s.["Name"] ] + th [] [ encLocText s.["Admin?"] ] + ] + ] + users + |> List.map (fun user -> + let userId = flatGuid user.userId + let delAction = sprintf "/user/%s/delete" userId + let delPrompt = s.["Are you want to delete this {0}? This action cannot be undone.", + (sprintf "%s (%s)" (s.["User"].Value.ToLower()) user.fullName)].Value + tr [] [ + td [] [ + a [ _href (sprintf "/user/%s/edit" userId); _title s.["Edit This User"].Value ] [ icon "edit" ] + a [ _href (sprintf "/user/%s/small-groups" userId); _title s.["Assign Groups to This User"].Value ] + [ icon "group" ] + a [ _href delAction + _title s.["Delete This User"].Value + _onclick (sprintf "return PT.confirmDelete('%s','%s')" delAction delPrompt) ] + [ icon "delete_forever" ] + ] + td [] [ encodedText user.fullName ] + td [ _class "pt-center-text" ] [ + match user.isAdmin with + | true -> yield strong [] [ encLocText s.["Yes"] ] + | false -> yield encLocText s.["No"] + ] + ]) + |> tbody [] + ] [ div [ _class "pt-center-text" ] [ br [] a [ _href (sprintf "/user/%s/edit" emptyGuid); _title s.["Add a New User"].Value ] @@ -182,39 +219,7 @@ let maintain (users : User list) ctx vi = br [] ] tableSummary users.Length s - table [ _class "pt-table pt-action-table" ] [ - thead [] [ - tr [] [ - th [] [ encLocText s.["Actions"] ] - th [] [ encLocText s.["Name"] ] - th [] [ encLocText s.["Admin?"] ] - ] - ] - users - |> List.map (fun user -> - let userId = flatGuid user.userId - let delAction = sprintf "/user/%s/delete" userId - let delPrompt = s.["Are you want to delete this {0}? This action cannot be undone.", - (sprintf "%s (%s)" (s.["User"].Value.ToLower()) user.fullName)].Value - tr [] [ - td [] [ - a [ _href (sprintf "/user/%s/edit" userId); _title s.["Edit This User"].Value ] [ icon "edit" ] - a [ _href (sprintf "/user/%s/small-groups" userId); _title s.["Assign Groups to This User"].Value ] - [ icon "group" ] - a [ _href delAction - _title s.["Delete This User"].Value - _onclick (sprintf "return PT.confirmDelete('%s','%s')" delAction delPrompt) ] - [ icon "delete_forever" ] - ] - td [] [ encodedText user.fullName ] - td [ _class "pt-center-text" ] [ - match user.isAdmin with - | true -> yield strong [] [ encLocText s.["Yes"] ] - | false -> yield encLocText s.["No"] - ] - ]) - |> tbody [] - ] + usrTbl form [ _id "DeleteForm"; _action ""; _method "post" ] [ csrfToken ctx ] ] |> Layout.Content.standard From ab262fdab32b8d18eb158929311628ebe40cf913 Mon Sep 17 00:00:00 2001 From: "Daniel J. Summers" Date: Thu, 14 Mar 2019 23:30:28 -0500 Subject: [PATCH 3/4] Updated deps; shortened text func names Giraffe has aliased "str" for "encodedText"; this project uses that now, and also uses "locStr" instead of "encLocText" --- .../PrayerTracker.Data.fsproj | 2 +- .../PrayerTracker.Tests.fsproj | 2 +- .../UI/CommonFunctionsTests.fs | 18 +- src/PrayerTracker.UI/Church.fs | 32 ++-- src/PrayerTracker.UI/CommonFunctions.fs | 6 +- src/PrayerTracker.UI/Home.fs | 12 +- src/PrayerTracker.UI/Layout.fs | 78 ++++----- src/PrayerTracker.UI/PrayerRequest.fs | 77 ++++---- src/PrayerTracker.UI/PrayerTracker.UI.fsproj | 2 +- src/PrayerTracker.UI/SmallGroup.fs | 164 +++++++++--------- src/PrayerTracker.UI/User.fs | 46 ++--- src/PrayerTracker.UI/ViewModels.fs | 10 +- src/PrayerTracker/PrayerTracker.fsproj | 2 +- 13 files changed, 225 insertions(+), 226 deletions(-) diff --git a/src/PrayerTracker.Data/PrayerTracker.Data.fsproj b/src/PrayerTracker.Data/PrayerTracker.Data.fsproj index 03de88a..b915c43 100644 --- a/src/PrayerTracker.Data/PrayerTracker.Data.fsproj +++ b/src/PrayerTracker.Data/PrayerTracker.Data.fsproj @@ -16,7 +16,7 @@ - + diff --git a/src/PrayerTracker.Tests/PrayerTracker.Tests.fsproj b/src/PrayerTracker.Tests/PrayerTracker.Tests.fsproj index 9debc3a..e0281fe 100644 --- a/src/PrayerTracker.Tests/PrayerTracker.Tests.fsproj +++ b/src/PrayerTracker.Tests/PrayerTracker.Tests.fsproj @@ -15,7 +15,7 @@ - + diff --git a/src/PrayerTracker.Tests/UI/CommonFunctionsTests.fs b/src/PrayerTracker.Tests/UI/CommonFunctionsTests.fs index 916f8af..156345f 100644 --- a/src/PrayerTracker.Tests/UI/CommonFunctionsTests.fs +++ b/src/PrayerTracker.Tests/UI/CommonFunctionsTests.fs @@ -9,15 +9,6 @@ open PrayerTracker.Views open System.IO -[] -let encLocTextTests = - testList "encLocText" [ - test "succeeds" { - let enc = encLocText (LocalizedString ("test", "test&")) |> renderHtmlNode - Expect.equal enc "test&" "string not encoded correctly" - } - ] - [] let iconSizedTests = testList "iconSized" [ @@ -36,6 +27,15 @@ let iconTests = } ] +[] +let locStrTests = + testList "locStr" [ + test "succeeds" { + let enc = locStr (LocalizedString ("test", "test&")) |> renderHtmlNode + Expect.equal enc "test&" "string not encoded correctly" + } + ] + [] let namedColorListTests = testList "namedColorList" [ diff --git a/src/PrayerTracker.UI/Church.fs b/src/PrayerTracker.UI/Church.fs index 8ec25dc..9deb102 100644 --- a/src/PrayerTracker.UI/Church.fs +++ b/src/PrayerTracker.UI/Church.fs @@ -15,15 +15,15 @@ let edit (m : EditChurch) ctx vi = input [ _type "hidden"; _name "churchId"; _value (flatGuid m.churchId) ] div [ _class "pt-field-row" ] [ div [ _class "pt-field" ] [ - label [ _for "name" ] [ encLocText s.["Church Name"] ] + label [ _for "name" ] [ locStr s.["Church Name"] ] input [ _type "text"; _name "name"; _id "name"; _required; _autofocus; _value m.name ] ] div [ _class "pt-field" ] [ - label [ _for "City"] [ encLocText s.["City"] ] + label [ _for "City"] [ locStr s.["City"] ] input [ _type "text"; _name "city"; _id "city"; _required; _value m.city ] ] div [ _class "pt-field" ] [ - label [ _for "ST" ] [ encLocText s.["State"] ] + label [ _for "ST" ] [ locStr s.["State"] ] input [ _type "text"; _name "st"; _id "st"; _required; _minlength "2"; _maxlength "2"; _value m.st ] ] ] @@ -34,12 +34,12 @@ let edit (m : EditChurch) ctx vi = yield _id "hasInterface" yield _value "True" match m.hasInterface with Some x when x -> yield _checked | _ -> () ] - label [ _for "hasInterface" ] [ encLocText s.["Has an interface with Virtual Prayer Room"] ] + label [ _for "hasInterface" ] [ locStr s.["Has an interface with Virtual Prayer Room"] ] ] ] div [ _class "pt-field-row pt-fadeable"; _id "divInterfaceAddress" ] [ div [ _class "pt-field" ] [ - label [ _for "interfaceAddress" ] [ encLocText s.["VPR Interface URL"] ] + label [ _for "interfaceAddress" ] [ locStr s.["VPR Interface URL"] ] input [ _type "url"; _name "interfaceAddress"; _id "interfaceAddress"; _value (match m.interfaceAddress with Some ia -> ia | None -> "") ] ] @@ -62,13 +62,13 @@ let maintain (churches : Church list) (stats : Map) ctx vi table [ _class "pt-table pt-action-table" ] [ thead [] [ tr [] [ - th [] [ encLocText s.["Actions"] ] - th [] [ encLocText s.["Name"] ] - th [] [ encLocText s.["Location"] ] - th [] [ encLocText s.["Groups"] ] - th [] [ encLocText s.["Requests"] ] - th [] [ encLocText s.["Users"] ] - th [] [ encLocText s.["Interface?"] ] + th [] [ locStr s.["Actions"] ] + th [] [ locStr s.["Name"] ] + th [] [ locStr s.["Location"] ] + th [] [ locStr s.["Groups"] ] + th [] [ locStr s.["Requests"] ] + th [] [ locStr s.["Users"] ] + th [] [ locStr s.["Interface?"] ] ] ] churches @@ -85,19 +85,19 @@ let maintain (churches : Church list) (stats : Map) ctx vi _onclick (sprintf "return PT.confirmDelete('%s','%A')" delAction delPrompt) ] [ icon "delete_forever" ] ] - td [] [ encodedText ch.name ] - td [] [ encodedText ch.city; rawText ", "; encodedText ch.st ] + td [] [ str ch.name ] + td [] [ str ch.city; rawText ", "; str ch.st ] td [ _class "pt-right-text" ] [ rawText (stats.[chId].smallGroups.ToString "N0") ] td [ _class "pt-right-text" ] [ rawText (stats.[chId].prayerRequests.ToString "N0") ] td [ _class "pt-right-text" ] [ rawText (stats.[chId].users.ToString "N0") ] - td [ _class "pt-center-text" ] [ encLocText s.[match ch.hasInterface with true -> "Yes" | false -> "No"] ] + td [ _class "pt-center-text" ] [ locStr s.[match ch.hasInterface with true -> "Yes" | false -> "No"] ] ]) |> tbody [] ] [ div [ _class "pt-center-text" ] [ br [] a [ _href (sprintf "/church/%s/edit" emptyGuid); _title s.["Add a New Church"].Value ] - [ icon "add_circle"; rawText "  "; encLocText s.["Add a New Church"] ] + [ icon "add_circle"; rawText "  "; locStr s.["Add a New Church"] ] br [] br [] ] diff --git a/src/PrayerTracker.UI/CommonFunctions.fs b/src/PrayerTracker.UI/CommonFunctions.fs index aaf3d1e..ec0f705 100644 --- a/src/PrayerTracker.UI/CommonFunctions.fs +++ b/src/PrayerTracker.UI/CommonFunctions.fs @@ -12,7 +12,7 @@ open System.IO open System.Text.Encodings.Web /// Encoded text for a localized string -let encLocText (text : LocalizedString) = encodedText text.Value +let locStr (text : LocalizedString) = str text.Value /// Raw text for a localized HTML string let rawLocText (writer : StringWriter) (text : LocalizedHtmlString) = @@ -44,7 +44,7 @@ let tableSummary itemCount (s : IStringLocalizer) = | 0 -> s.["No Entries to Display"] | 1 -> s.["Displaying {0} Entry", itemCount] | _ -> s.["Displaying {0} Entries", itemCount] - |> encLocText + |> locStr ] ] @@ -100,7 +100,7 @@ let selectList name selected attrs items = let selectDefault text = sprintf "— %s —" text /// Generate a standard submit button with icon and text -let submit attrs ico text = button (_type "submit" :: attrs) [ icon ico; rawText "  "; encLocText text ] +let submit attrs ico text = button (_type "submit" :: attrs) [ icon ico; rawText "  "; locStr text ] /// Format a GUID with no dashes (used for URLs and forms) let flatGuid (x : Guid) = x.ToString "N" diff --git a/src/PrayerTracker.UI/Home.fs b/src/PrayerTracker.UI/Home.fs index deef17a..4f380fb 100644 --- a/src/PrayerTracker.UI/Home.fs +++ b/src/PrayerTracker.UI/Home.fs @@ -39,7 +39,7 @@ let error code vi = _alt (sprintf "%A %A" s.["PrayerTracker"] s.["from Bit Badger Solutions"]) _title (sprintf "%A %A" s.["PrayerTracker"] s.["from Bit Badger Solutions"]) _style "vertical-align:text-bottom;" ] - encodedText vi.version + str vi.version ] ] |> div [] @@ -203,17 +203,17 @@ let termsOfService vi = use sw = new StringWriter () let raw = rawLocText sw let ppLink = - a [ _href "/legal/privacy-policy" ] [ encodedText (s.["Privacy Policy"].Value.ToLower ()) ] + a [ _href "/legal/privacy-policy" ] [ str (s.["Privacy Policy"].Value.ToLower ()) ] |> (renderHtmlNode >> HtmlString) [ p [ _class "pt-right-text" ] [ small [] [ em [] [ raw l.["(as of May 24, 2018)"] ] ] ] - h3 [] [ encodedText "1. "; raw l.["Acceptance of Terms"] ] + h3 [] [ str "1. "; raw l.["Acceptance of Terms"] ] p [] [ raw l.["By accessing this web site, you are agreeing to be bound by these Terms and Conditions, and that you are responsible to ensure that your use of this site complies with all applicable laws."] space raw l.["Your continued use of this site implies your acceptance of these terms."] ] - h3 [] [ encodedText "2. "; raw l.["Description of Service and Registration"] ] + h3 [] [ str "2. "; raw l.["Description of Service and Registration"] ] p [] [ raw l.["{0} is a service that allows individuals to enter and amend prayer requests on behalf of organizations.", s.["PrayerTracker"]] @@ -222,13 +222,13 @@ let termsOfService vi = space raw l.["See our {0} for details on the personal (user) information we maintain.", ppLink] ] - h3 [] [ encodedText "3. "; raw l.["Liability"] ] + h3 [] [ str "3. "; raw l.["Liability"] ] p [] [ raw l.["This service is provided “as is”, and no warranty (express or implied) exists."] space raw l.["The service and its developers may not be held liable for any damages that may arise through the use of this service."] ] - h3 [] [ encodedText "4. "; raw l.["Updates to Terms"] ] + h3 [] [ str "4. "; raw l.["Updates to Terms"] ] p [] [ raw l.["These terms and conditions may be updated at any time."] space diff --git a/src/PrayerTracker.UI/Layout.fs b/src/PrayerTracker.UI/Layout.fs index 11e9649..d9d346c 100644 --- a/src/PrayerTracker.UI/Layout.fs +++ b/src/PrayerTracker.UI/Layout.fs @@ -24,30 +24,30 @@ module Navigation = | Some u -> yield li [ _class "dropdown" ] [ a [ _class "dropbtn"; _role "button"; _aria "label" s.["Requests"].Value; _title s.["Requests"].Value ] - [ icon "question_answer"; space; encLocText s.["Requests"]; space; icon "keyboard_arrow_down" ] + [ icon "question_answer"; space; locStr s.["Requests"]; space; icon "keyboard_arrow_down" ] div [ _class "dropdown-content"; _role "menu" ] [ - a [ _href "/prayer-requests" ] [ icon "compare_arrows"; menuSpacer; encLocText s.["Maintain"] ] - a [ _href "/prayer-requests/view" ] [ icon "list"; menuSpacer; encLocText s.["View List"] ] + a [ _href "/prayer-requests" ] [ icon "compare_arrows"; menuSpacer; locStr s.["Maintain"] ] + a [ _href "/prayer-requests/view" ] [ icon "list"; menuSpacer; locStr s.["View List"] ] ] ] yield li [ _class "dropdown" ] [ a [ _class "dropbtn"; _role "button"; _aria "label" s.["Group"].Value; _title s.["Group"].Value ] - [ icon "group"; space; encLocText s.["Group"]; space; icon "keyboard_arrow_down" ] + [ icon "group"; space; locStr s.["Group"]; space; icon "keyboard_arrow_down" ] div [ _class "dropdown-content"; _role "menu" ] [ - a [ _href "/small-group/members" ] [ icon "email"; menuSpacer; encLocText s.["Maintain Group Members"] ] - a [ _href "/small-group/announcement" ] [ icon "send"; menuSpacer; encLocText s.["Send Announcement"] ] - a [ _href "/small-group/preferences" ] [ icon "build"; menuSpacer; encLocText s.["Change Preferences"] ] + a [ _href "/small-group/members" ] [ icon "email"; menuSpacer; locStr s.["Maintain Group Members"] ] + a [ _href "/small-group/announcement" ] [ icon "send"; menuSpacer; locStr s.["Send Announcement"] ] + a [ _href "/small-group/preferences" ] [ icon "build"; menuSpacer; locStr s.["Change Preferences"] ] ] ] match u.isAdmin with | true -> yield li [ _class "dropdown" ] [ a [ _class "dropbtn"; _role "button"; _aria "label" s.["Administration"].Value; _title s.["Administration"].Value ] - [ icon "settings"; space; encLocText s.["Administration"]; space; icon "keyboard_arrow_down" ] + [ icon "settings"; space; locStr s.["Administration"]; space; icon "keyboard_arrow_down" ] div [ _class "dropdown-content"; _role "menu" ] [ - a [ _href "/churches" ] [ icon "home"; menuSpacer; encLocText s.["Churches"] ] - a [ _href "/small-groups" ] [ icon "send"; menuSpacer; encLocText s.["Groups"] ] - a [ _href "/users" ] [ icon "build"; menuSpacer; encLocText s.["Users"] ] + a [ _href "/churches" ] [ icon "home"; menuSpacer; locStr s.["Churches"] ] + a [ _href "/small-groups" ] [ icon "send"; menuSpacer; locStr s.["Groups"] ] + a [ _href "/users" ] [ icon "build"; menuSpacer; locStr s.["Users"] ] ] ] | false -> () @@ -58,22 +58,22 @@ module Navigation = a [ _href "/prayer-requests/view" _aria "label" s.["View Request List"].Value _title s.["View Request List"].Value ] - [ icon "list"; space; encLocText s.["View Request List"] ] + [ icon "list"; space; locStr s.["View Request List"] ] ] | None -> yield li [ _class "dropdown" ] [ a [ _class "dropbtn"; _role "button"; _aria "label" s.["Log On"].Value; _title s.["Log On"].Value ] - [ icon "security"; space; encLocText s.["Log On"]; space; icon "keyboard_arrow_down" ] + [ icon "security"; space; locStr s.["Log On"]; space; icon "keyboard_arrow_down" ] div [ _class "dropdown-content"; _role "menu" ] [ - a [ _href "/user/log-on" ] [ icon "person"; menuSpacer; encLocText s.["User"] ] - a [ _href "/small-group/log-on" ] [ icon "group"; menuSpacer; encLocText s.["Group"] ] + a [ _href "/user/log-on" ] [ icon "person"; menuSpacer; locStr s.["User"] ] + a [ _href "/small-group/log-on" ] [ icon "group"; menuSpacer; locStr s.["Group"] ] ] ] yield li [] [ a [ _href "/prayer-requests/lists" _aria "label" s.["View Request List"].Value _title s.["View Request List"].Value ] - [ icon "list"; space; encLocText s.["View Request List"] ] + [ icon "list"; space; locStr s.["View Request List"] ] ] yield li [] [ a [ _href (sprintf "https://docs.prayer.bitbadger.solutions/%s" <| langCode ()) @@ -81,7 +81,7 @@ module Navigation = _title s.["View Help"].Value _target "_blank" ] - [ icon "help"; space; encLocText s.["Help"] ] + [ icon "help"; space; locStr s.["Help"] ] ] ] let rightLinks = @@ -93,19 +93,19 @@ module Navigation = a [ _href "/user/password" _aria "label" s.["Change Your Password"].Value _title s.["Change Your Password"].Value ] - [ icon "lock"; space; encLocText s.["Change Your Password"] ] + [ icon "lock"; space; locStr s.["Change Your Password"] ] ] | None -> () yield li [] [ a [ _href "/log-off"; _aria "label" s.["Log Off"].Value; _title s.["Log Off"].Value ] - [ icon "power_settings_new"; space; encLocText s.["Log Off"] ] + [ icon "power_settings_new"; space; locStr s.["Log Off"] ] ] ] | None -> List.empty header [ _class "pt-title-bar" ] [ section [ _class "pt-title-bar-left" ] [ span [ _class "pt-title-bar-home" ] [ - a [ _href "/"; _title s.["Home"].Value ] [ encLocText s.["PrayerTracker"] ] + a [ _href "/"; _title s.["Home"].Value ] [ locStr s.["PrayerTracker"] ] ] ul [] leftLinks ] @@ -120,34 +120,34 @@ module Navigation = let s = I18N.localizer.Force () header [ _id "pt-language" ] [ div [] [ - yield span [ _class "u" ] [ encLocText s.["Language"]; rawText ": " ] + yield span [ _class "u" ] [ locStr s.["Language"]; rawText ": " ] match langCode () with | "es" -> - yield encLocText s.["Spanish"] + yield locStr s.["Spanish"] yield rawText "   •   " - yield a [ _href "/language/en" ] [ encLocText s.["Change to English"] ] + yield a [ _href "/language/en" ] [ locStr s.["Change to English"] ] | _ -> - yield encLocText s.["English"] + yield locStr s.["English"] yield rawText "   •   " - yield a [ _href "/language/es" ] [ encLocText s.["Cambie a Español"] ] + yield a [ _href "/language/es" ] [ locStr s.["Cambie a Español"] ] ] match m.group with | Some g -> [ match m.user with | Some u -> - yield span [ _class "u" ] [ encLocText s.["Currently Logged On"] ] + yield span [ _class "u" ] [ locStr s.["Currently Logged On"] ] yield rawText "   " yield icon "person" - yield strong [] [ encodedText u.fullName ] + yield strong [] [ str u.fullName ] yield rawText "    " | None -> - yield encLocText s.["Logged On as a Member of"] + yield locStr s.["Logged On as a Member of"] yield rawText "  " yield icon "group" yield space match m.user with - | Some _ -> yield a [ _href "/small-group" ] [ strong [] [ encodedText g.name ] ] - | None -> yield strong [] [ encodedText g.name ] + | Some _ -> yield a [ _href "/small-group" ] [ strong [] [ str g.name ] ] + | None -> yield strong [] [ str g.name ] yield rawText "  " ] | None -> [] @@ -180,7 +180,7 @@ let private htmlHead m pageTitle = let s = I18N.localizer.Force () head [] [ yield meta [ _charset "UTF-8" ] - yield title [] [ encLocText pageTitle; titleSep; encLocText s.["PrayerTracker"] ] + yield title [] [ locStr pageTitle; titleSep; locStr s.["PrayerTracker"] ] yield! commonHead for cssFile in m.style do yield link [ _rel "stylesheet"; _href (sprintf "/css/%s.css" cssFile); _type "text/css" ] @@ -205,7 +205,7 @@ let private renderPageTitle m pageTitle = match m.helpLink with | Some link -> yield Help.fullLink (langCode ()) link |> helpLink | None -> () - yield encLocText pageTitle + yield locStr pageTitle ] /// Render the messages that may need to be displayed to the user @@ -219,7 +219,7 @@ let private messages m = match msg.level with | "Info" -> () | lvl -> - yield strong [] [ encLocText s.[lvl] ] + yield strong [] [ locStr s.[lvl] ] yield rawText " » " yield rawText msg.text.Value match msg.description with @@ -238,25 +238,25 @@ let private htmlFooter m = let resultTime = TimeSpan(DateTime.Now.Ticks - m.requestStart).TotalSeconds footer [] [ div [ _id "pt-legal" ] [ - a [ _href "/legal/privacy-policy" ] [ encLocText s.["Privacy Policy"] ] + a [ _href "/legal/privacy-policy" ] [ locStr s.["Privacy Policy"] ] rawText " • " - a [ _href "/legal/terms-of-service" ] [ encLocText s.["Terms of Service"] ] + a [ _href "/legal/terms-of-service" ] [ locStr s.["Terms of Service"] ] rawText " • " a [ _href "https://github.com/bit-badger/PrayerTracker" _title s.["View source code and get technical support"].Value _target "_blank" _rel "noopener" ] [ - encLocText s.["Source & Support"] + locStr s.["Source & Support"] ] ] div [ _id "pt-footer" ] [ a [ _href "/"; _style "line-height:28px;" ] [ img [ _src (sprintf "/img/%O.png" s.["footer_en"]); _alt imgText; _title imgText ] ] - encodedText m.version + str m.version space i [ _title s.["This page loaded in {0:N3} seconds", resultTime].Value; _class "material-icons md-18" ] [ - encodedText "schedule" + str "schedule" ] ] ] @@ -286,7 +286,7 @@ let bare pageTitle content = html [ _lang "" ] [ head [] [ meta [ _charset "UTF-8" ] - title [] [ encLocText ttl; titleSep; encLocText s.["PrayerTracker"] ] + title [] [ locStr ttl; titleSep; locStr s.["PrayerTracker"] ] ] body [] [ content diff --git a/src/PrayerTracker.UI/PrayerRequest.fs b/src/PrayerTracker.UI/PrayerRequest.fs index ec44e2d..94709b3 100644 --- a/src/PrayerTracker.UI/PrayerRequest.fs +++ b/src/PrayerTracker.UI/PrayerRequest.fs @@ -20,14 +20,14 @@ let edit (m : EditRequest) today ctx vi = input [ _type "hidden"; _name "requestId"; _value (flatGuid m.requestId) ] div [ _class "pt-field-row" ] [ yield div [ _class "pt-field" ] [ - label [ _for "requestType" ] [ encLocText s.["Request Type"] ] + label [ _for "requestType" ] [ locStr s.["Request Type"] ] ReferenceList.requestTypeList s |> Seq.ofList |> Seq.map (fun item -> fst item, (snd item).Value) |> selectList "requestType" m.requestType [ _required; _autofocus ] ] yield div [ _class "pt-field" ] [ - label [ _for "requestor" ] [ encLocText s.["Requestor / Subject"] ] + label [ _for "requestor" ] [ locStr s.["Requestor / Subject"] ] input [ _type "text" _name "requestor" _id "requestor" @@ -36,7 +36,7 @@ let edit (m : EditRequest) today ctx vi = match m.isNew () with | true -> yield div [ _class "pt-field" ] [ - label [ _for "enteredDate" ] [ encLocText s.["Date"] ] + label [ _for "enteredDate" ] [ locStr s.["Date"] ] input [ _type "date"; _name "enteredDate"; _id "enteredDate"; _placeholder today ] ] | false -> @@ -44,21 +44,21 @@ let edit (m : EditRequest) today ctx vi = div [ _class "pt-checkbox-field" ] [ br [] input [ _type "checkbox"; _name "skipDateUpdate"; _id "skipDateUpdate"; _value "True" ] - label [ _for "skipDateUpdate" ] [ encLocText s.["Check to not update the date"] ] + label [ _for "skipDateUpdate" ] [ locStr s.["Check to not update the date"] ] br [] - small [] [ em [] [ encodedText (s.["Typo Corrections"].Value.ToLower ()); rawText ", etc." ] ] + small [] [ em [] [ str (s.["Typo Corrections"].Value.ToLower ()); rawText ", etc." ] ] ] ] ] div [ _class "pt-field-row" ] [ div [ _class "pt-field" ] [ - label [] [ encLocText s.["Expiration"] ] + label [] [ locStr s.["Expiration"] ] ReferenceList.expirationList s ((m.isNew >> not) ()) |> List.map (fun exp -> let radioId = sprintf "expiration_%s" (fst exp) span [ _class "text-nowrap" ] [ radio "expiration" radioId (fst exp) m.expiration - label [ _for radioId ] [ encLocText (snd exp) ] + label [ _for radioId ] [ locStr (snd exp) ] rawText "     " ]) |> div [ _class "pt-center-text" ] @@ -66,8 +66,8 @@ let edit (m : EditRequest) today ctx vi = ] div [ _class "pt-field-row" ] [ div [ _class "pt-field pt-editor" ] [ - label [ _for "text" ] [ encLocText s.["Request"] ] - textarea [ _name "text"; _id "text" ] [ encodedText m.text ] + label [ _for "text" ] [ locStr s.["Request"] ] + textarea [ _name "text"; _id "text" ] [ str m.text ] ] ] div [ _class "pt-field-row" ] [ submit [] "save" s.["Save Request"] ] @@ -87,17 +87,17 @@ let email m vi = |> List.fold (fun (acc : StringBuilder) mbr -> acc.AppendFormat(", {0} <{1}>", mbr.memberName, mbr.email)) (StringBuilder ()) [ p [ _style (sprintf "font-family:%s;font-size:%ipt;" prefs.listFonts prefs.textFontSize) ] [ - encLocText s.["The request list was sent to the following people, via individual e-mails"] + locStr s.["The request list was sent to the following people, via individual e-mails"] rawText ":" br [] - small [] [ encodedText (addresses.Remove(0, 2).ToString ()) ] + small [] [ str (addresses.Remove(0, 2).ToString ()) ] ] - span [ _class "pt-email-heading" ] [ encLocText s.["HTML Format"]; rawText ":" ] + span [ _class "pt-email-heading" ] [ locStr s.["HTML Format"]; rawText ":" ] div [ _class "pt-email-canvas" ] [ rawText (m.asHtml s) ] br [] br [] - span [ _class "pt-email-heading" ] [ encLocText s.["Plain-Text Format"]; rawText ":" ] - div[ _class "pt-email-canvas" ] [ pre [] [ encodedText (m.asText s) ] ] + span [ _class "pt-email-heading" ] [ locStr s.["Plain-Text Format"]; rawText ":" ] + div[ _class "pt-email-canvas" ] [ pre [] [ str (m.asText s) ] ] ] |> Layout.Content.standard |> Layout.standard vi pageTitle @@ -132,9 +132,9 @@ let lists (grps : SmallGroup list) vi = yield table [ _class "pt-table pt-action-table" ] [ thead [] [ tr [] [ - th [] [ encLocText s.["Actions"] ] - th [] [ encLocText s.["Church"] ] - th [] [ encLocText s.["Group"] ] + th [] [ locStr s.["Actions"] ] + th [] [ locStr s.["Church"] ] + th [] [ locStr s.["Group"] ] ] ] grps @@ -149,8 +149,8 @@ let lists (grps : SmallGroup list) vi = [ icon "verified_user" ] |> List.singleton |> td [] - td [] [ encodedText grp.church.name ] - td [] [ encodedText grp.name ] + td [] [ str grp.church.name ] + td [] [ str grp.name ] ]) |> tbody [] ] @@ -197,11 +197,10 @@ let maintain (reqs : PrayerRequest seq) (grp : SmallGroup) onlyActive (ctx : Htt [ icon "delete_forever" ] ] td [ updReq req ] [ - encodedText (req.updatedDate.ToString(s.["MMMM d, yyyy"].Value, - System.Globalization.CultureInfo.CurrentUICulture)) + str (req.updatedDate.ToString(s.["MMMM d, yyyy"].Value, System.Globalization.CultureInfo.CurrentUICulture)) ] - td [] [ encLocText typs.[req.requestType] ] - td [ reqExp req ] [ encodedText (match req.requestor with Some r -> r | None -> " ") ] + td [] [ locStr typs.[req.requestType] ] + td [ reqExp req ] [ str (match req.requestor with Some r -> r | None -> " ") ] td [] [ yield match 60 > reqText.Length with @@ -213,10 +212,10 @@ let maintain (reqs : PrayerRequest seq) (grp : SmallGroup) onlyActive (ctx : Htt [ yield div [ _class "pt-center-text" ] [ br [] a [ _href (sprintf "/prayer-request/%s/edit" emptyGuid); _title s.["Add a New Request"].Value ] - [ icon "add_circle"; rawText "  "; encLocText s.["Add a New Request"] ] + [ icon "add_circle"; rawText "  "; locStr s.["Add a New Request"] ] rawText "       " a [ _href "/prayer-requests/view"; _title s.["View Prayer Request List"].Value ] - [ icon "list"; rawText "  "; encLocText s.["View Prayer Request List"] ] + [ icon "list"; rawText "  "; locStr s.["View Prayer Request List"] ] br [] br [] ] @@ -227,11 +226,11 @@ let maintain (reqs : PrayerRequest seq) (grp : SmallGroup) onlyActive (ctx : Htt yield table [ _class "pt-table pt-action-table" ] [ thead [] [ tr [] [ - th [] [ encLocText s.["Actions"] ] - th [] [ encLocText s.["Updated Date"] ] - th [] [ encLocText s.["Type"] ] - th [] [ encLocText s.["Requestor"] ] - th [] [ encLocText s.["Request"] ] + th [] [ locStr s.["Actions"] ] + th [] [ locStr s.["Updated Date"] ] + th [] [ locStr s.["Type"] ] + th [] [ locStr s.["Requestor"] ] + th [] [ locStr s.["Request"] ] ] ] tbody [] requests @@ -240,13 +239,13 @@ let maintain (reqs : PrayerRequest seq) (grp : SmallGroup) onlyActive (ctx : Htt yield br [] match onlyActive with | true -> - yield encLocText s.["Inactive requests are currently not shown"] + yield locStr s.["Inactive requests are currently not shown"] yield br [] - yield a [ _href "/prayer-requests/inactive" ] [ encLocText s.["Show Inactive Requests"] ] + yield a [ _href "/prayer-requests/inactive" ] [ locStr s.["Show Inactive Requests"] ] | false -> - yield encLocText s.["Inactive requests are currently shown"] + yield locStr s.["Inactive requests are currently shown"] yield br [] - yield a [ _href "/prayer-requests" ] [ encLocText s.["Do Not Show Inactive Requests"] ] + yield a [ _href "/prayer-requests" ] [ locStr s.["Do Not Show Inactive Requests"] ] ] yield form [ _id "DeleteForm"; _action ""; _method "post" ] [ csrfToken ctx ] ] @@ -269,7 +268,7 @@ let print m version = _alt imgAlt _title imgAlt ] space - encodedText version + str version ] ] |> Layout.bare pageTitle @@ -286,7 +285,7 @@ let view m vi = yield a [ _class "pt-icon-link" _href (sprintf "/prayer-requests/print/%s" dtString) _title s.["View Printable"].Value ] [ - icon "print"; rawText "  "; encLocText s.["View Printable"] + icon "print"; rawText "  "; locStr s.["View Printable"] ] match m.canEmail with | true -> @@ -302,7 +301,7 @@ let view m vi = yield a [ _class "pt-icon-link" _href (sprintf "/prayer-requests/view/%s" (sunday.ToString "yyyy-MM-dd")) _title s.["List for Next Sunday"].Value ] [ - icon "update"; rawText "  "; encLocText s.["List for Next Sunday"] + icon "update"; rawText "  "; locStr s.["List for Next Sunday"] ] yield spacer let emailPrompt = s.["This will e-mail the current list to every member of your group, without further prompting. Are you sure this is what you are ready to do?"].Value @@ -310,11 +309,11 @@ let view m vi = _href (sprintf "/prayer-requests/email/%s" dtString) _title s.["Send via E-mail"].Value _onclick (sprintf "return PT.requests.view.promptBeforeEmail('%s')" emailPrompt) ] [ - icon "mail_outline"; rawText "  "; encLocText s.["Send via E-mail"] + icon "mail_outline"; rawText "  "; locStr s.["Send via E-mail"] ] yield spacer yield a [ _class "pt-icon-link"; _href "/prayer-requests"; _title s.["Maintain Prayer Requests"].Value ] [ - icon "compare_arrows"; rawText "  "; encLocText s.["Maintain Prayer Requests"] + icon "compare_arrows"; rawText "  "; locStr s.["Maintain Prayer Requests"] ] | false -> () ] diff --git a/src/PrayerTracker.UI/PrayerTracker.UI.fsproj b/src/PrayerTracker.UI/PrayerTracker.UI.fsproj index 42a66d1..aa959ca 100644 --- a/src/PrayerTracker.UI/PrayerTracker.UI.fsproj +++ b/src/PrayerTracker.UI/PrayerTracker.UI.fsproj @@ -21,7 +21,7 @@ - + diff --git a/src/PrayerTracker.UI/SmallGroup.fs b/src/PrayerTracker.UI/SmallGroup.fs index c64ae4d..61a8e20 100644 --- a/src/PrayerTracker.UI/SmallGroup.fs +++ b/src/PrayerTracker.UI/SmallGroup.fs @@ -15,7 +15,7 @@ let announcement isAdmin ctx vi = yield csrfToken ctx yield div [ _class "pt-field-row" ] [ div [ _class "pt-field pt-editor" ] [ - label [ _for "text" ] [ encLocText s.["Announcement Text"] ] + label [ _for "text" ] [ locStr s.["Announcement Text"] ] textarea [ _name "text"; _id "text"; _autofocus ] [] ] ] @@ -23,12 +23,12 @@ let announcement isAdmin ctx vi = | true -> yield div [ _class "pt-field-row" ] [ div [ _class "pt-field" ] [ - label [] [ encLocText s.["Send Announcement to"]; rawText ":" ] + label [] [ locStr s.["Send Announcement to"]; rawText ":" ] div [ _class "pt-center-text" ] [ radio "sendToClass" "sendY" "Y" "Y" - label [ _for "sendY" ] [ encLocText s.["This Group"]; rawText "     " ] + label [ _for "sendY" ] [ locStr s.["This Group"]; rawText "     " ] radio "sendToClass" "sendN" "N" "Y" - label [ _for "sendN" ] [ encLocText s.["All {0} Users", s.["PrayerTracker"]] ] + label [ _for "sendN" ] [ locStr s.["All {0} Users", s.["PrayerTracker"]] ] ] ] ] @@ -37,12 +37,12 @@ let announcement isAdmin ctx vi = yield div [ _class "pt-field-row pt-fadeable pt-shown"; _id "divAddToList" ] [ div [ _class "pt-checkbox-field" ] [ input [ _type "checkbox"; _name "addToRequestList"; _id "addToRequestList"; _value "True" ] - label [ _for "addToRequestList" ] [ encLocText s.["Add to Request List"] ] + label [ _for "addToRequestList" ] [ locStr s.["Add to Request List"] ] ] ] yield div [ _class "pt-field-row pt-fadeable"; _id "divCategory" ] [ div [ _class "pt-field" ] [ - label [ _for "requestType" ] [ encLocText s.["Request Type"] ] + label [ _for "requestType" ] [ locStr s.["Request Type"] ] reqTypes |> Seq.ofList |> Seq.map (fun item -> fst item, (snd item).Value) @@ -60,12 +60,12 @@ let announcement isAdmin ctx vi = /// View for once an announcement has been sent let announcementSent (m : Announcement) vi = let s = I18N.localizer.Force () - [ span [ _class "pt-email-heading" ] [ encLocText s.["HTML Format"]; rawText ":" ] + [ span [ _class "pt-email-heading" ] [ locStr s.["HTML Format"]; rawText ":" ] div [ _class "pt-email-canvas" ] [ rawText m.text ] br [] br [] - span [ _class "pt-email-heading" ] [ encLocText s.["Plain-Text Format"]; rawText ":" ] - div [ _class "pt-email-canvas" ] [ pre [] [ encodedText (m.plainText ()) ] ] + span [ _class "pt-email-heading" ] [ locStr s.["Plain-Text Format"]; rawText ":" ] + div [ _class "pt-email-canvas" ] [ pre [] [ str (m.plainText ()) ] ] ] |> Layout.Content.standard |> Layout.standard vi "Announcement Sent" @@ -80,13 +80,13 @@ let edit (m : EditSmallGroup) (churches : Church list) ctx vi = input [ _type "hidden"; _name "smallGroupId"; _value (flatGuid m.smallGroupId) ] div [ _class "pt-field-row" ] [ div [ _class "pt-field" ] [ - label [ _for "name" ] [ encLocText s.["Group Name"] ] + label [ _for "name" ] [ locStr s.["Group Name"] ] input [ _type "text"; _name "name"; _id "name"; _value m.name; _required; _autofocus ] ] ] div [ _class "pt-field-row" ] [ div [ _class "pt-field" ] [ - label [ _for "churchId" ] [ encLocText s.["Church"] ] + label [ _for "churchId" ] [ locStr s.["Church"] ] seq { yield "", selectDefault s.["Select Church"].Value yield! churches |> List.map (fun c -> flatGuid c.churchId, c.name) @@ -111,17 +111,17 @@ let editMember (m : EditMember) (typs : (string * LocalizedString) seq) ctx vi = input [ _type "hidden"; _name "memberId"; _value (flatGuid m.memberId) ] div [ _class "pt-field-row" ] [ div [ _class "pt-field" ] [ - label [ _for "memberName" ] [ encLocText s.["Member Name"] ] + label [ _for "memberName" ] [ locStr s.["Member Name"] ] input [ _type "text"; _name "memberName"; _id "memberName"; _required; _autofocus; _value m.memberName ] ] div [ _class "pt-field" ] [ - label [ _for "emailAddress" ] [ encLocText s.["E-mail Address"] ] + label [ _for "emailAddress" ] [ locStr s.["E-mail Address"] ] input [ _type "email"; _name "emailAddress"; _id "emailAddress"; _required; _value m.emailAddress ] ] ] div [ _class "pt-field-row" ] [ div [ _class "pt-field" ] [ - label [ _for "emailType" ] [ encLocText s.["E-mail Format"] ] + label [ _for "emailType" ] [ locStr s.["E-mail Format"] ] typs |> Seq.map (fun typ -> fst typ, (snd typ).Value) |> selectList "emailType" m.emailType [] @@ -141,7 +141,7 @@ let logOn (grps : SmallGroup list) grpId ctx vi = csrfToken ctx div [ _class "pt-field-row" ] [ div [ _class "pt-field" ] [ - label [ _for "smallGroupId" ] [ encLocText s.["Group"] ] + label [ _for "smallGroupId" ] [ locStr s.["Group"] ] seq { match grps.Length with | 0 -> yield "", s.["There are no classes with passwords defined"].Value @@ -153,16 +153,16 @@ let logOn (grps : SmallGroup list) grpId ctx vi = |> selectList "smallGroupId" grpId [ _required ] ] div [ _class "pt-field" ] [ - label [ _for "password" ] [ encLocText s.["Password"] ] + label [ _for "password" ] [ locStr s.["Password"] ] input [ _type "password"; _name "password"; _id "password"; _required; _placeholder (s.["Case-Sensitive"].Value.ToLower ()) ] ] ] div [ _class "pt-checkbox-field" ] [ input [ _type "checkbox"; _name "rememberMe"; _id "rememberMe"; _value "True" ] - label [ _for "rememberMe" ] [ encLocText s.["Remember Me"] ] + label [ _for "rememberMe" ] [ locStr s.["Remember Me"] ] br [] - small [] [ em [] [ encodedText (s.["Requires Cookies"].Value.ToLower ()) ] ] + small [] [ em [] [ str (s.["Requires Cookies"].Value.ToLower ()) ] ] ] div [ _class "pt-field-row" ] [ submit [] "account_circle" s.["Log On"] ] ] @@ -182,10 +182,10 @@ let maintain (grps : SmallGroup list) ctx vi = table [ _class "pt-table pt-action-table" ] [ thead [] [ tr [] [ - th [] [ encLocText s.["Actions"] ] - th [] [ encLocText s.["Name"] ] - th [] [ encLocText s.["Church"] ] - th [] [ encLocText s.["Time Zone"] ] + th [] [ locStr s.["Actions"] ] + th [] [ locStr s.["Name"] ] + th [] [ locStr s.["Church"] ] + th [] [ locStr s.["Time Zone"] ] ] ] grps @@ -202,9 +202,9 @@ let maintain (grps : SmallGroup list) ctx vi = _onclick (sprintf "return PT.confirmDelete('%s','%s')" delAction delPrompt) ] [ icon "delete_forever" ] ] - td [] [ encodedText g.name ] - td [] [ encodedText g.church.name ] - td [] [ encLocText (TimeZones.name g.preferences.timeZoneId s) ] + td [] [ str g.name ] + td [] [ str g.church.name ] + td [] [ locStr (TimeZones.name g.preferences.timeZoneId s) ] ]) |> tbody [] ] @@ -213,7 +213,7 @@ let maintain (grps : SmallGroup list) ctx vi = a [ _href (sprintf "/small-group/%s/edit" emptyGuid); _title s.["Add a New Group"].Value ] [ icon "add_circle" rawText "  " - encLocText s.["Add a New Group"] + locStr s.["Add a New Group"] ] br [] br [] @@ -236,10 +236,10 @@ let members (mbrs : Member list) (emailTyps : Map) ctx table [ _class "pt-table pt-action-table" ] [ thead [] [ tr [] [ - th [] [ encLocText s.["Actions"] ] - th [] [ encLocText s.["Name"] ] - th [] [ encLocText s.["E-mail Address"] ] - th [] [ encLocText s.["Format"] ] + th [] [ locStr s.["Actions"] ] + th [] [ locStr s.["Name"] ] + th [] [ locStr s.["E-mail Address"] ] + th [] [ locStr s.["Format"] ] ] ] mbrs @@ -257,16 +257,16 @@ let members (mbrs : Member list) (emailTyps : Map) ctx _onclick (sprintf "return PT.confirmDelete('%s','%s')" delAction delPrompt) ] [ icon "delete_forever" ] ] - td [] [ encodedText mbr.memberName ] - td [] [ encodedText mbr.email ] - td [] [ encLocText emailTyps.[defaultArg mbr.format ""] ] + td [] [ str mbr.memberName ] + td [] [ str mbr.email ] + td [] [ locStr emailTyps.[defaultArg mbr.format ""] ] ]) |> tbody [] ] [ div [ _class"pt-center-text" ] [ br [] a [ _href (sprintf "/small-group/member/%s/edit" emptyGuid); _title s.["Add a New Group Member"].Value ] - [ icon "add_circle"; rawText "  "; encLocText s.["Add a New Group Member"] ] + [ icon "add_circle"; rawText "  "; locStr s.["Add a New Group Member"] ] br [] br [] ] @@ -287,52 +287,52 @@ let overview m vi = section [] [ header [ _role "heading" ] [ iconSized 72 "bookmark_border" - encLocText s.["Quick Actions"] + locStr s.["Quick Actions"] ] div [] [ - a [ _href "/prayer-requests/view" ] [ icon "list"; linkSpacer; encLocText s.["View Prayer Request List"] ] + a [ _href "/prayer-requests/view" ] [ icon "list"; linkSpacer; locStr s.["View Prayer Request List"] ] hr [] - a [ _href "/small-group/announcement" ] [ icon "send"; linkSpacer; encLocText s.["Send Announcement"] ] + a [ _href "/small-group/announcement" ] [ icon "send"; linkSpacer; locStr s.["Send Announcement"] ] hr [] - a [ _href "/small-group/preferences" ] [ icon "build"; linkSpacer; encLocText s.["Change Preferences"] ] + a [ _href "/small-group/preferences" ] [ icon "build"; linkSpacer; locStr s.["Change Preferences"] ] ] ] section [] [ header [ _role "heading" ] [ iconSized 72 "question_answer" - encLocText s.["Prayer Requests"] + locStr s.["Prayer Requests"] ] div [] [ yield p [ _class "pt-center-text" ] [ - strong [] [ encodedText (m.totalActiveReqs.ToString "N0"); space; encLocText s.["Active Requests"] ] + strong [] [ str (m.totalActiveReqs.ToString "N0"); space; locStr s.["Active Requests"] ] ] yield hr [] for cat in m.activeReqsByCat do - yield encodedText (cat.Value.ToString "N0") + yield str (cat.Value.ToString "N0") yield space - yield encLocText typs.[cat.Key] + yield locStr typs.[cat.Key] yield br [] yield br [] - yield encodedText (m.allReqs.ToString "N0") + yield str (m.allReqs.ToString "N0") yield space - yield encLocText s.["Total Requests"] + yield locStr s.["Total Requests"] yield hr [] yield a [ _href "/prayer-requests/maintain" ] [ icon "compare_arrows" linkSpacer - encLocText s.["Maintain Prayer Requests"] + locStr s.["Maintain Prayer Requests"] ] ] ] section [] [ header [ _role "heading" ] [ iconSized 72 "people_outline" - encLocText s.["Group Members"] + locStr s.["Group Members"] ] div [ _class "pt-center-text" ] [ - strong [] [ encodedText (m.totalMbrs.ToString "N0"); space; encLocText s.["Members"] ] + strong [] [ str (m.totalMbrs.ToString "N0"); space; locStr s.["Members"] ] hr [] - a [ _href "/small-group/members" ] [ icon "email"; linkSpacer; encLocText s.["Maintain Group Members"] ] + a [ _href "/small-group/members" ] [ icon "email"; linkSpacer; locStr s.["Maintain Group Members"] ] ] ] ] @@ -351,58 +351,58 @@ let preferences (m : EditPreferences) (tzs : TimeZone list) ctx vi = style [ _scoped ] [ rawText "#expireDays, #daysToKeepNew, #longTermUpdateWeeks, #headingFontSize, #listFontSize { width: 3rem; } #emailFromAddress { width: 20rem; } #listFonts { width: 40rem; } @media screen and (max-width: 40rem) { #listFonts { width: 100%; } }" ] csrfToken ctx fieldset [] [ - legend [] [ strong [] [ icon "date_range"; rawText "  "; encLocText s.["Dates"] ] ] + legend [] [ strong [] [ icon "date_range"; rawText "  "; locStr s.["Dates"] ] ] div [ _class "pt-field-row" ] [ div [ _class "pt-field" ] [ - label [ _for "expireDays" ] [ encLocText s.["Requests Expire After"] ] + label [ _for "expireDays" ] [ locStr s.["Requests Expire After"] ] span [] [ input [ _type "number"; _name "expireDays"; _id "expireDays"; _min "1"; _max "30"; _required; _autofocus _value (string m.expireDays) ] - space; encodedText (s.["Days"].Value.ToLower ()) + space; str (s.["Days"].Value.ToLower ()) ] ] div [ _class "pt-field" ] [ - label [ _for "daysToKeepNew" ] [ encLocText s.["Requests “New” For"] ] + label [ _for "daysToKeepNew" ] [ locStr s.["Requests “New” For"] ] span [] [ input [ _type "number"; _name "daysToKeepNew"; _id "daysToKeepNew"; _min "1"; _max "30"; _required _value (string m.daysToKeepNew) ] - space; encodedText (s.["Days"].Value.ToLower ()) + space; str (s.["Days"].Value.ToLower ()) ] ] div [ _class "pt-field" ] [ - label [ _for "longTermUpdateWeeks" ] [ encLocText s.["Long-Term Requests Alerted for Update"] ] + label [ _for "longTermUpdateWeeks" ] [ locStr s.["Long-Term Requests Alerted for Update"] ] span [] [ input [ _type "number"; _name "longTermUpdateWeeks"; _id "longTermUpdateWeeks"; _min "1"; _max "30" _required; _value (string m.longTermUpdateWeeks) ] - space; encodedText (s.["Weeks"].Value.ToLower ()) + space; str (s.["Weeks"].Value.ToLower ()) ] ] ] ] fieldset [] [ - legend [] [ strong [] [ icon "sort"; rawText "  "; encLocText s.["Request Sorting"] ] ] + legend [] [ strong [] [ icon "sort"; rawText "  "; locStr s.["Request Sorting"] ] ] radio "requestSort" "requestSort_D" "D" m.requestSort - label [ _for "requestSort_D" ] [ encLocText s.["Sort by Last Updated Date"] ] + label [ _for "requestSort_D" ] [ locStr s.["Sort by Last Updated Date"] ] rawText "   " radio "requestSort" "requestSort_R" "R" m.requestSort - label [ _for "requestSort_R" ] [ encLocText s.["Sort by Requestor Name"] ] + label [ _for "requestSort_R" ] [ locStr s.["Sort by Requestor Name"] ] ] fieldset [] [ - legend [] [ strong [] [ icon "mail_outline"; rawText "  "; encLocText s.["E-mail"] ] ] + legend [] [ strong [] [ icon "mail_outline"; rawText "  "; locStr s.["E-mail"] ] ] div [ _class "pt-field-row" ] [ div [ _class "pt-field" ] [ - label [ _for "emailFromName" ] [ encLocText s.["From Name"] ] + label [ _for "emailFromName" ] [ locStr s.["From Name"] ] input [ _type "text"; _name "emailFromName"; _id "emailFromName"; _required; _value m.emailFromName ] ] div [ _class "pt-field" ] [ - label [ _for "emailFromAddress" ] [ encLocText s.["From Address"] ] + label [ _for "emailFromAddress" ] [ locStr s.["From Address"] ] input [ _type "email"; _name "emailFromAddress"; _id "emailFromAddress"; _required _value m.emailFromAddress ] ] ] div [ _class "pt-field-row" ] [ div [ _class "pt-field" ] [ - label [ _for "defaultEmailType" ] [ encLocText s.["E-mail Format"] ] + label [ _for "defaultEmailType" ] [ locStr s.["E-mail Format"] ] seq { yield "", selectDefault s.["Select"].Value yield! ReferenceList.emailTypeList "" s |> Seq.skip 1 |> Seq.map (fun typ -> fst typ, (snd typ).Value) @@ -412,19 +412,19 @@ let preferences (m : EditPreferences) (tzs : TimeZone list) ctx vi = ] ] fieldset [] [ - legend [] [ strong [] [ icon "color_lens"; rawText "  "; encLocText s.["Colors"] ]; rawText " ***" ] + legend [] [ strong [] [ icon "color_lens"; rawText "  "; locStr s.["Colors"] ]; rawText " ***" ] div [ _class "pt-field-row" ] [ div [ _class "pt-field" ] [ - label [ _class "pt-center-text" ] [ encLocText s.["Color of Heading Lines"] ] + label [ _class "pt-center-text" ] [ locStr s.["Color of Heading Lines"] ] span [] [ radio "headingLineType" "headingLineType_Name" "Name" m.headingLineType - label [ _for "headingLineType_Name" ] [ encLocText s.["Named Color"] ] + label [ _for "headingLineType_Name" ] [ locStr s.["Named Color"] ] namedColorList "headingLineColor" m.headingLineColor [ yield _id "headingLineColor_Select" match m.headingLineColor.StartsWith "#" with true -> yield _disabled | false -> () ] s - rawText "    "; encodedText (s.["or"].Value.ToUpper ()) + rawText "    "; str (s.["or"].Value.ToUpper ()) radio "headingLineType" "headingLineType_RGB" "RGB" m.headingLineType - label [ _for "headingLineType_RGB" ] [ encLocText s.["Custom Color"] ] + label [ _for "headingLineType_RGB" ] [ locStr s.["Custom Color"] ] input [ yield _type "color" yield _name "headingLineColor" yield _id "headingLineColor_Color" @@ -435,16 +435,16 @@ let preferences (m : EditPreferences) (tzs : TimeZone list) ctx vi = ] div [ _class "pt-field-row" ] [ div [ _class "pt-field" ] [ - label [ _class "pt-center-text" ] [ encLocText s.["Color of Heading Text"] ] + label [ _class "pt-center-text" ] [ locStr s.["Color of Heading Text"] ] span [] [ radio "headingTextType" "headingTextType_Name" "Name" m.headingTextType - label [ _for "headingTextType_Name" ] [ encLocText s.["Named Color"] ] + label [ _for "headingTextType_Name" ] [ locStr s.["Named Color"] ] namedColorList "headingTextColor" m.headingTextColor [ yield _id "headingTextColor_Select" match m.headingTextColor.StartsWith "#" with true -> yield _disabled | false -> () ] s - rawText "    "; encodedText (s.["or"].Value.ToUpper ()) + rawText "    "; str (s.["or"].Value.ToUpper ()) radio "headingTextType" "headingTextType_RGB" "RGB" m.headingTextType - label [ _for "headingTextType_RGB" ] [ encLocText s.["Custom Color"] ] + label [ _for "headingTextType_RGB" ] [ locStr s.["Custom Color"] ] input [ yield _type "color" yield _name "headingTextColor" yield _id "headingTextColor_Color" @@ -455,29 +455,29 @@ let preferences (m : EditPreferences) (tzs : TimeZone list) ctx vi = ] ] fieldset [] [ - legend [] [ strong [] [ icon "font_download"; rawText "  "; encLocText s.["Fonts"] ] ] + legend [] [ strong [] [ icon "font_download"; rawText "  "; locStr s.["Fonts"] ] ] div [ _class "pt-field" ] [ - label [ _for "listFonts" ] [ encLocText s.["Fonts** for List"] ] + label [ _for "listFonts" ] [ locStr s.["Fonts** for List"] ] input [ _type "text"; _name "listFonts"; _id "listFonts"; _required; _value m.listFonts ] ] div [ _class "pt-field-row" ] [ div [ _class "pt-field" ] [ - label [ _for "headingFontSize" ] [ encLocText s.["Heading Text Size"] ] + label [ _for "headingFontSize" ] [ locStr s.["Heading Text Size"] ] input [ _type "number"; _name "headingFontSize"; _id "headingFontSize"; _min "8"; _max "24"; _required _value (string m.headingFontSize) ] ] div [ _class "pt-field" ] [ - label [ _for "listFontSize" ] [ encLocText s.["List Text Size"] ] + label [ _for "listFontSize" ] [ locStr s.["List Text Size"] ] input [ _type "number"; _name "listFontSize"; _id "listFontSize"; _min "8"; _max "24"; _required _value (string m.listFontSize) ] ] ] ] fieldset [] [ - legend [] [ strong [] [ icon "settings"; rawText "  "; encLocText s.["Other Settings"] ] ] + legend [] [ strong [] [ icon "settings"; rawText "  "; locStr s.["Other Settings"] ] ] div [ _class "pt-field-row" ] [ div [ _class "pt-field" ] [ - label [ _for "TimeZone" ] [ encLocText s.["Time Zone"] ] + label [ _for "TimeZone" ] [ locStr s.["Time Zone"] ] seq { yield "", selectDefault s.["Select"].Value yield! tzs |> List.map (fun tz -> tz.timeZoneId, (TimeZones.name tz.timeZoneId s).Value) @@ -486,16 +486,16 @@ let preferences (m : EditPreferences) (tzs : TimeZone list) ctx vi = ] ] div [ _class "pt-field" ] [ - label [] [ encLocText s.["Request List Visibility"] ] + label [] [ locStr s.["Request List Visibility"] ] span [] [ radio "listVisibility" "viz_Public" (string RequestVisibility.``public``) (string m.listVisibility) - label [ _for "viz_Public" ] [ encLocText s.["Public"] ] + label [ _for "viz_Public" ] [ locStr s.["Public"] ] rawText "  " radio "listVisibility" "viz_Private" (string RequestVisibility.``private``) (string m.listVisibility) - label [ _for "viz_Private" ] [ encLocText s.["Private"] ] + label [ _for "viz_Private" ] [ locStr s.["Private"] ] rawText "  " radio "listVisibility" "viz_Password" (string RequestVisibility.passwordProtected) (string m.listVisibility) - label [ _for "viz_Password" ] [ encLocText s.["Password Protected"] ] + label [ _for "viz_Password" ] [ locStr s.["Password Protected"] ] ] ] div [ yield _id "divClassPassword" @@ -504,7 +504,7 @@ let preferences (m : EditPreferences) (tzs : TimeZone list) ctx vi = | false -> yield _class "pt-field-row pt-fadeable" ] [ div [ _class "pt-field" ] [ - label [ _for "groupPassword" ] [ encLocText s.["Group Password (Used to Read Online)"] ] + label [ _for "groupPassword" ] [ locStr s.["Group Password (Used to Read Online)"] ] input [ _type "text"; _name "groupPassword"; _id "groupPassword"; _value (match m.groupPassword with Some x -> x | None -> "") ] ] diff --git a/src/PrayerTracker.UI/User.fs b/src/PrayerTracker.UI/User.fs index b0a92de..e2119ae 100644 --- a/src/PrayerTracker.UI/User.fs +++ b/src/PrayerTracker.UI/User.fs @@ -16,7 +16,7 @@ let assignGroups m groups curGroups ctx vi = thead [] [ tr [] [ th [] [ rawText " " ] - th [] [ encLocText s.["Group"] ] + th [] [ locStr s.["Group"] ] ] ] groups @@ -30,7 +30,7 @@ let assignGroups m groups curGroups ctx vi = yield _value grpId match curGroups |> List.contains grpId with true -> yield _checked | false -> () ] ] - td [] [ label [ _for inputId ] [ encodedText grpName ] ] + td [] [ label [ _for inputId ] [ str grpName ] ] ]) |> tbody [] ] @@ -45,7 +45,7 @@ let assignGroups m groups curGroups ctx vi = let changePassword ctx vi = let s = I18N.localizer.Force () [ p [ _class "pt-center-text" ] [ - encLocText s.["To change your password, enter your current password in the specified box below, then enter your new password twice."] + locStr s.["To change your password, enter your current password in the specified box below, then enter your new password twice."] ] form [ _action "/user/password/change" _method "post" @@ -54,13 +54,13 @@ let changePassword ctx vi = csrfToken ctx div [ _class "pt-field-row" ] [ div [ _class "pt-field" ] [ - label [ _for "oldPassword" ] [ encLocText s.["Current Password"] ] + label [ _for "oldPassword" ] [ locStr s.["Current Password"] ] input [ _type "password"; _name "oldPassword"; _id "oldPassword"; _required; _autofocus ] ] ] div [ _class "pt-field-row" ] [ div [ _class "pt-field" ] [ - label [ _for "newPassword" ] [ encLocText s.["New Password Twice"] ] + label [ _for "newPassword" ] [ locStr s.["New Password Twice"] ] input [ _type "password"; _name "newPassword"; _id "newPassword"; _required ] ] div [ _class "pt-field" ] [ @@ -91,25 +91,25 @@ let edit (m : EditUser) ctx vi = input [ _type "hidden"; _name "userId"; _value (flatGuid m.userId) ] div [ _class "pt-field-row" ] [ div [ _class "pt-field" ] [ - label [ _for "firstName" ] [ encLocText s.["First Name"] ] + label [ _for "firstName" ] [ locStr s.["First Name"] ] input [ _type "text"; _name "firstName"; _id "firstName"; _value m.firstName; _required; _autofocus ] ] div [ _class "pt-field" ] [ - label [ _for "lastName" ] [ encLocText s.["Last Name"] ] + label [ _for "lastName" ] [ locStr s.["Last Name"] ] input [ _type "text"; _name "lastName"; _id "lastName"; _value m.lastName; _required ] ] div [ _class "pt-field" ] [ - label [ _for "emailAddress" ] [ encLocText s.["E-mail Address"] ] + label [ _for "emailAddress" ] [ locStr s.["E-mail Address"] ] input [ _type "email"; _name "emailAddress"; _id "emailAddress"; _value m.emailAddress; _required ] ] ] div [ _class "pt-field-row" ] [ div [ _class "pt-field" ] [ - label [ _for "password" ] [ encLocText s.["Password"] ] + label [ _for "password" ] [ locStr s.["Password"] ] input [ _type "password"; _name "password"; _id "password"; _placeholder pwPlaceholder ] ] div [ _class "pt-field" ] [ - label [ _for "passwordConfirm" ] [ encLocText s.["Password Again"] ] + label [ _for "passwordConfirm" ] [ locStr s.["Password Again"] ] input [ _type "password"; _name "passwordConfirm"; _id "passwordConfirm"; _placeholder pwPlaceholder ] ] ] @@ -119,7 +119,7 @@ let edit (m : EditUser) ctx vi = yield _id "isAdmin" yield _value "True" match m.isAdmin with Some x when x -> yield _checked | _ -> () ] - label [ _for "isAdmin" ] [ encLocText s.["This user is a PrayerTracker administrator"] ] + label [ _for "isAdmin" ] [ locStr s.["This user is a PrayerTracker administrator"] ] ] div [ _class "pt-field-row" ] [ submit [] "save" s.["Save User"] ] ] @@ -138,18 +138,18 @@ let logOn (m : UserLogOn) groups ctx vi = input [ _type "hidden"; _name "redirectUrl"; _value (defaultArg m.redirectUrl "") ] div [ _class "pt-field-row" ] [ div [ _class "pt-field" ] [ - label [ _for "emailAddress"] [ encLocText s.["E-mail Address"] ] + label [ _for "emailAddress"] [ locStr s.["E-mail Address"] ] input [ _type "email"; _name "emailAddress"; _id "emailAddress"; _value m.emailAddress; _required; _autofocus ] ] div [ _class "pt-field" ] [ - label [ _for "password" ] [ encLocText s.["Password"] ] + label [ _for "password" ] [ locStr s.["Password"] ] input [ _type "password"; _name "password"; _id "password"; _required; _placeholder (sprintf "(%s)" (s.["Case-Sensitive"].Value.ToLower ())) ] ] ] div [ _class "pt-field-row" ] [ div [ _class "pt-field" ] [ - label [ _for "smallGroupId" ] [ encLocText s.["Group"] ] + label [ _for "smallGroupId" ] [ locStr s.["Group"] ] seq { yield "", selectDefault s.["Select Group"].Value yield! groups @@ -160,9 +160,9 @@ let logOn (m : UserLogOn) groups ctx vi = ] div [ _class "pt-checkbox-field" ] [ input [ _type "checkbox"; _name "rememberMe"; _id "rememberMe"; _value "True" ] - label [ _for "rememberMe" ] [ encLocText s.["Remember Me"] ] + label [ _for "rememberMe" ] [ locStr s.["Remember Me"] ] br [] - small [] [ em [] [ rawText "("; encodedText (s.["Requires Cookies"].Value.ToLower ()); rawText ")" ] ] + small [] [ em [] [ rawText "("; str (s.["Requires Cookies"].Value.ToLower ()); rawText ")" ] ] ] div [ _class "pt-field-row" ] [ submit [] "account_circle" s.["Log On"] ] ] @@ -181,9 +181,9 @@ let maintain (users : User list) ctx vi = table [ _class "pt-table pt-action-table" ] [ thead [] [ tr [] [ - th [] [ encLocText s.["Actions"] ] - th [] [ encLocText s.["Name"] ] - th [] [ encLocText s.["Admin?"] ] + th [] [ locStr s.["Actions"] ] + th [] [ locStr s.["Name"] ] + th [] [ locStr s.["Admin?"] ] ] ] users @@ -202,11 +202,11 @@ let maintain (users : User list) ctx vi = _onclick (sprintf "return PT.confirmDelete('%s','%s')" delAction delPrompt) ] [ icon "delete_forever" ] ] - td [] [ encodedText user.fullName ] + td [] [ str user.fullName ] td [ _class "pt-center-text" ] [ match user.isAdmin with - | true -> yield strong [] [ encLocText s.["Yes"] ] - | false -> yield encLocText s.["No"] + | true -> yield strong [] [ locStr s.["Yes"] ] + | false -> yield locStr s.["No"] ] ]) |> tbody [] @@ -214,7 +214,7 @@ let maintain (users : User list) ctx vi = [ div [ _class "pt-center-text" ] [ br [] a [ _href (sprintf "/user/%s/edit" emptyGuid); _title s.["Add a New User"].Value ] - [ icon "add_circle"; rawText "  "; encLocText s.["Add a New User"] ] + [ icon "add_circle"; rawText "  "; locStr s.["Add a New User"] ] br [] br [] ] diff --git a/src/PrayerTracker.UI/ViewModels.fs b/src/PrayerTracker.UI/ViewModels.fs index 3b6c40d..0f162eb 100644 --- a/src/PrayerTracker.UI/ViewModels.fs +++ b/src/PrayerTracker.UI/ViewModels.fs @@ -548,13 +548,13 @@ with | true -> yield div [ _style (sprintf "text-align:center;font-family:%s" prefs.listFonts) ] [ span [ _style (sprintf "font-size:%ipt;" prefs.headingFontSize) ] [ - strong [] [ encodedText s.["Prayer Requests"].Value ] + strong [] [ str s.["Prayer Requests"].Value ] ] br [] span [ _style (sprintf "font-size:%ipt;" prefs.textFontSize) ] [ - strong [] [ encodedText this.listGroup.name ] + strong [] [ str this.listGroup.name ] br [] - encodedText (this.date.ToString s.["MMMM d, yyyy"].Value) + str (this.date.ToString s.["MMMM d, yyyy"].Value) ] ] yield br [] @@ -572,7 +572,7 @@ with tr [] [ td [ _style (sprintf "font-size:%ipt;color:%s;padding:3px 0;border-top:solid 3px %s;border-bottom:solid 3px %s;font-weight:bold;" prefs.headingFontSize prefs.headingColor prefs.lineColor prefs.lineColor) ] [ - rawText "    "; encodedText catName.Value; rawText "    " + rawText "    "; str catName.Value; rawText "    " ] ] ] @@ -585,7 +585,7 @@ with bullet prefs.listFonts prefs.textFontSize) ] [ match req.requestor with | Some rqstr when rqstr <> "" -> - yield strong [] [ encodedText rqstr ] + yield strong [] [ str rqstr ] yield rawText " — " | Some _ -> () | None -> () diff --git a/src/PrayerTracker/PrayerTracker.fsproj b/src/PrayerTracker/PrayerTracker.fsproj index 590ffd2..516089e 100644 --- a/src/PrayerTracker/PrayerTracker.fsproj +++ b/src/PrayerTracker/PrayerTracker.fsproj @@ -30,7 +30,7 @@ - + From 6a6b403216eede455da753da96d56ce539b087be Mon Sep 17 00:00:00 2001 From: "Daniel J. Summers" Date: Fri, 15 Mar 2019 19:02:40 -0500 Subject: [PATCH 4/4] Added test for html -> plain text (#7) Test passed; this was fixed in commit 7e36fff0f135740181a8967ee2f54172019ec957 which has yet to be deployed --- src/PrayerTracker.Tests/UI/UtilsTests.fs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/PrayerTracker.Tests/UI/UtilsTests.fs b/src/PrayerTracker.Tests/UI/UtilsTests.fs index a1d9f42..dbf2384 100644 --- a/src/PrayerTracker.Tests/UI/UtilsTests.fs +++ b/src/PrayerTracker.Tests/UI/UtilsTests.fs @@ -61,6 +61,11 @@ let htmlToPlainTextTests = test "does not fail when passed an empty string" { Expect.equal (htmlToPlainText "") "" "Should return an empty string when given an empty string" } + test "preserves blank lines for two consecutive line breaks" { + let expected = "Paragraph 1\n\nParagraph 2\n\n...and paragraph 3" + Expect.equal (htmlToPlainText "Paragraph 1

Paragraph 2

...and paragraph 3") + expected "Blank lines not preserved for consecutive line breaks" + } ] []