diff --git a/src/PrayerTracker.UI/Church.fs b/src/PrayerTracker.UI/Church.fs index 7d1cdbd..8e2f317 100644 --- a/src/PrayerTracker.UI/Church.fs +++ b/src/PrayerTracker.UI/Church.fs @@ -29,11 +29,11 @@ let edit (m : EditChurch) ctx vi = ] div [ _class "pt-field-row" ] [ div [ _class "pt-checkbox-field" ] [ - input [ yield _type "checkbox" - yield _name "hasInterface" - yield _id "hasInterface" - yield _value "True" - match m.hasInterface with Some x when x -> yield _checked | _ -> () ] + input [ _type "checkbox" + _name "hasInterface" + _id "hasInterface" + _value "True" + match m.hasInterface with Some x when x -> _checked | _ -> () ] label [ _for "hasInterface" ] [ locStr s.["Has an interface with Virtual Prayer Room"] ] ] ] diff --git a/src/PrayerTracker.UI/CommonFunctions.fs b/src/PrayerTracker.UI/CommonFunctions.fs index ec0f705..d89fb7c 100644 --- a/src/PrayerTracker.UI/CommonFunctions.fs +++ b/src/PrayerTracker.UI/CommonFunctions.fs @@ -52,22 +52,22 @@ let tableSummary itemCount (s : IStringLocalizer) = let namedColorList name selected attrs (s : IStringLocalizer) = /// The list of HTML named colors (name, display, text color) seq { - yield ("aqua", s.["Aqua"], "black") - yield ("black", s.["Black"], "white") - yield ("blue", s.["Blue"], "white") - yield ("fuchsia", s.["Fuchsia"], "black") - yield ("gray", s.["Gray"], "white") - yield ("green", s.["Green"], "white") - yield ("lime", s.["Lime"], "black") - yield ("maroon", s.["Maroon"], "white") - yield ("navy", s.["Navy"], "white") - yield ("olive", s.["Olive"], "white") - yield ("purple", s.["Purple"], "white") - yield ("red", s.["Red"], "black") - yield ("silver", s.["Silver"], "black") - yield ("teal", s.["Teal"], "white") - yield ("white", s.["White"], "black") - yield ("yellow", s.["Yellow"], "black") + ("aqua", s.["Aqua"], "black") + ("black", s.["Black"], "white") + ("blue", s.["Blue"], "white") + ("fuchsia", s.["Fuchsia"], "black") + ("gray", s.["Gray"], "white") + ("green", s.["Green"], "white") + ("lime", s.["Lime"], "black") + ("maroon", s.["Maroon"], "white") + ("navy", s.["Navy"], "white") + ("olive", s.["Olive"], "white") + ("purple", s.["Purple"], "white") + ("red", s.["Red"], "black") + ("silver", s.["Silver"], "black") + ("teal", s.["Teal"], "white") + ("white", s.["White"], "black") + ("yellow", s.["Yellow"], "black") } |> Seq.map (fun color -> let (colorName, dispText, txtColor) = color @@ -81,18 +81,18 @@ let namedColorList name selected attrs (s : IStringLocalizer) = /// Generate an input[type=radio] that is selected if its value is the current value let radio name domId value current = - input [ yield _type "radio" - yield _name name - yield _id domId - yield _value value - match value = current with true -> yield _checked | false -> () ] + input [ _type "radio" + _name name + _id domId + _value value + match value = current with true -> _checked | false -> () ] /// Generate a select list with the current value selected let selectList name selected attrs items = items |> Seq.map (fun (value, text) -> - option [ yield _value value - match value = selected with true -> yield _selected | false -> () ] [ encodedText text ]) + option [ _value value + match value = selected with true -> _selected | false -> () ] [ encodedText text ]) |> List.ofSeq |> select (List.concat [ [ _name name; _id name ]; attrs ]) diff --git a/src/PrayerTracker.UI/Home.fs b/src/PrayerTracker.UI/Home.fs index 5744d35..65edce0 100644 --- a/src/PrayerTracker.UI/Home.fs +++ b/src/PrayerTracker.UI/Home.fs @@ -32,9 +32,9 @@ let error code vi = raw l.["Please use your “Back” button to return to {0}.", s.["PrayerTracker"]] ] ] - yield br [] - yield hr [] - yield div [ _style "font-size:70%;font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Oxygen-Sans,Ubuntu,Cantarell,'Helvetica Neue',sans-serif" ] [ + br [] + hr [] + div [ _style "font-size:70%;font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Oxygen-Sans,Ubuntu,Cantarell,'Helvetica Neue',sans-serif" ] [ img [ _src (sprintf "/img/%A.png" s.["footer_en"]) _alt (sprintf "%A %A" s.["PrayerTracker"] s.["from Bit Badger Solutions"]) _title (sprintf "%A %A" s.["PrayerTracker"] s.["from Bit Badger Solutions"]) diff --git a/src/PrayerTracker.UI/Layout.fs b/src/PrayerTracker.UI/Layout.fs index 6426893..b692840 100644 --- a/src/PrayerTracker.UI/Layout.fs +++ b/src/PrayerTracker.UI/Layout.fs @@ -22,7 +22,7 @@ module Navigation = let leftLinks = [ match m.user with | Some u -> - yield li [ _class "dropdown" ] [ + li [ _class "dropdown" ] [ a [ _class "dropbtn"; _role "button"; _aria "label" s.["Requests"].Value; _title s.["Requests"].Value ] [ icon "question_answer"; space; locStr s.["Requests"]; space; icon "keyboard_arrow_down" ] div [ _class "dropdown-content"; _role "menu" ] [ @@ -30,7 +30,7 @@ module Navigation = a [ _href "/web/prayer-requests/view" ] [ icon "list"; menuSpacer; locStr s.["View List"] ] ] ] - yield li [ _class "dropdown" ] [ + li [ _class "dropdown" ] [ a [ _class "dropbtn"; _role "button"; _aria "label" s.["Group"].Value; _title s.["Group"].Value ] [ icon "group"; space; locStr s.["Group"]; space; icon "keyboard_arrow_down" ] div [ _class "dropdown-content"; _role "menu" ] [ @@ -41,7 +41,7 @@ module Navigation = ] match u.isAdmin with | true -> - yield li [ _class "dropdown" ] [ + li [ _class "dropdown" ] [ a [ _class "dropbtn"; _role "button"; _aria "label" s.["Administration"].Value; _title s.["Administration"].Value ] [ icon "settings"; space; locStr s.["Administration"]; space; icon "keyboard_arrow_down" ] div [ _class "dropdown-content"; _role "menu" ] [ @@ -54,14 +54,14 @@ module Navigation = | None -> match m.group with | Some _ -> - yield li [] [ + li [] [ a [ _href "/web/prayer-requests/view" _aria "label" s.["View Request List"].Value _title s.["View Request List"].Value ] [ icon "list"; space; locStr s.["View Request List"] ] ] | None -> - yield li [ _class "dropdown" ] [ + li [ _class "dropdown" ] [ a [ _class "dropbtn"; _role "button"; _aria "label" s.["Log On"].Value; _title s.["Log On"].Value ] [ icon "security"; space; locStr s.["Log On"]; space; icon "keyboard_arrow_down" ] div [ _class "dropdown-content"; _role "menu" ] [ @@ -69,13 +69,13 @@ module Navigation = a [ _href "/web/small-group/log-on" ] [ icon "group"; menuSpacer; locStr s.["Group"] ] ] ] - yield li [] [ + li [] [ a [ _href "/web/prayer-requests/lists" _aria "label" s.["View Request List"].Value _title s.["View Request List"].Value ] [ icon "list"; space; locStr s.["View Request List"] ] ] - yield li [] [ + li [] [ a [ _href (sprintf "https://docs.prayer.bitbadger.solutions/%s" <| langCode ()) _aria "label" s.["Help"].Value; _title s.["View Help"].Value @@ -89,14 +89,14 @@ module Navigation = | Some _ -> [ match m.user with | Some _ -> - yield li [] [ + li [] [ a [ _href "/web/user/password" _aria "label" s.["Change Your Password"].Value _title s.["Change Your Password"].Value ] [ icon "lock"; space; locStr s.["Change Your Password"] ] ] | None -> () - yield li [] [ + li [] [ a [ _href "/web/log-off"; _aria "label" s.["Log Off"].Value; _title s.["Log Off"].Value ] [ icon "power_settings_new"; space; locStr s.["Log Off"] ] ] @@ -120,35 +120,35 @@ module Navigation = let s = I18N.localizer.Force () header [ _id "pt-language" ] [ div [] [ - yield span [ _class "u" ] [ locStr s.["Language"]; rawText ": " ] + span [ _class "u" ] [ locStr s.["Language"]; rawText ": " ] match langCode () with | "es" -> - yield locStr s.["Spanish"] - yield rawText "   •   " - yield a [ _href "/web/language/en" ] [ locStr s.["Change to English"] ] + locStr s.["Spanish"] + rawText "   •   " + a [ _href "/web/language/en" ] [ locStr s.["Change to English"] ] | _ -> - yield locStr s.["English"] - yield rawText "   •   " - yield a [ _href "/web/language/es" ] [ locStr s.["Cambie a Español"] ] + locStr s.["English"] + rawText "   •   " + a [ _href "/web/language/es" ] [ locStr s.["Cambie a Español"] ] ] match m.group with | Some g -> [ match m.user with | Some u -> - yield span [ _class "u" ] [ locStr s.["Currently Logged On"] ] - yield rawText "   " - yield icon "person" - yield strong [] [ str u.fullName ] - yield rawText "    " + span [ _class "u" ] [ locStr s.["Currently Logged On"] ] + rawText "   " + icon "person" + strong [] [ str u.fullName ] + rawText "    " | None -> - yield locStr s.["Logged On as a Member of"] - yield rawText "  " - yield icon "group" - yield space + locStr s.["Logged On as a Member of"] + rawText "  " + icon "group" + space match m.user with - | Some _ -> yield a [ _href "/web/small-group" ] [ strong [] [ str g.name ] ] - | None -> yield strong [] [ str g.name ] - yield rawText "  " + | Some _ -> a [ _href "/web/small-group" ] [ strong [] [ str g.name ] ] + | None -> strong [] [ str g.name ] + rawText "  " ] | None -> [] |> div [] @@ -179,13 +179,13 @@ let private commonHead = let private htmlHead m pageTitle = let s = I18N.localizer.Force () head [] [ - yield meta [ _charset "UTF-8" ] - yield title [] [ locStr pageTitle; titleSep; locStr s.["PrayerTracker"] ] + meta [ _charset "UTF-8" ] + 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" ] + link [ _rel "stylesheet"; _href (sprintf "/css/%s.css" cssFile); _type "text/css" ] for jsFile in m.script do - yield script [ _src (sprintf "/js/%s.js" jsFile) ] [] + script [ _src (sprintf "/js/%s.js" jsFile) ] [] ] /// Render a link to the help page for the current page @@ -202,10 +202,8 @@ let private helpLink link = /// Render the page title, and optionally a help link let private renderPageTitle m pageTitle = h2 [ _id "pt-page-title" ] [ - match m.helpLink with - | Some link -> yield Help.fullLink (langCode ()) link |> helpLink - | None -> () - yield locStr pageTitle + match m.helpLink with Some link -> Help.fullLink (langCode ()) link |> helpLink | None -> () + locStr pageTitle ] /// Render the messages that may need to be displayed to the user @@ -219,13 +217,13 @@ let private messages m = match msg.level with | "Info" -> () | lvl -> - yield strong [] [ locStr s.[lvl] ] - yield rawText " » " - yield rawText msg.text.Value + strong [] [ locStr s.[lvl] ] + rawText " » " + rawText msg.text.Value match msg.description with | Some desc -> - yield br [] - yield div [ _class "description" ] [ rawText desc.Value ] + br [] + div [ _class "description" ] [ rawText desc.Value ] | None -> () ] ] @@ -262,7 +260,7 @@ let private htmlFooter m = ] /// The standard layout for PrayerTracker -let standard m pageTitle content = +let standard m pageTitle (content : XmlNode) = let s = I18N.localizer.Force () let ttl = s.[pageTitle] html [ _lang "" ] [ @@ -270,11 +268,11 @@ let standard m pageTitle content = body [] [ Navigation.top m div [ _id "pt-body" ] [ - yield Navigation.identity m - yield renderPageTitle m ttl + Navigation.identity m + renderPageTitle m ttl yield! messages m - yield content - yield htmlFooter m + content + htmlFooter m ] ] ] @@ -288,7 +286,5 @@ let bare pageTitle content = meta [ _charset "UTF-8" ] title [] [ locStr ttl; titleSep; locStr s.["PrayerTracker"] ] ] - body [] [ - content - ] + body [] [ content ] ] diff --git a/src/PrayerTracker.UI/PrayerRequest.fs b/src/PrayerTracker.UI/PrayerRequest.fs index 9819331..b619d71 100644 --- a/src/PrayerTracker.UI/PrayerRequest.fs +++ b/src/PrayerTracker.UI/PrayerRequest.fs @@ -19,14 +19,14 @@ let edit (m : EditRequest) today ctx vi = csrfToken ctx input [ _type "hidden"; _name "requestId"; _value (flatGuid m.requestId) ] div [ _class "pt-field-row" ] [ - yield div [ _class "pt-field" ] [ + div [ _class "pt-field" ] [ label [ _for "requestType" ] [ locStr s.["Request Type"] ] ReferenceList.requestTypeList s |> Seq.ofList |> Seq.map (fun (typ, desc) -> typ.code, desc.Value) |> selectList "requestType" m.requestType [ _required; _autofocus ] ] - yield div [ _class "pt-field" ] [ + div [ _class "pt-field" ] [ label [ _for "requestor" ] [ locStr s.["Requestor / Subject"] ] input [ _type "text" _name "requestor" @@ -35,12 +35,12 @@ let edit (m : EditRequest) today ctx vi = ] match m.isNew () with | true -> - yield div [ _class "pt-field" ] [ + div [ _class "pt-field" ] [ label [ _for "enteredDate" ] [ locStr s.["Date"] ] input [ _type "date"; _name "enteredDate"; _id "enteredDate"; _placeholder today ] ] | false -> - yield div [ _class "pt-field" ] [ + div [ _class "pt-field" ] [ div [ _class "pt-checkbox-field" ] [ br [] input [ _type "checkbox"; _name "skipDateUpdate"; _id "skipDateUpdate"; _value "True" ] @@ -118,7 +118,7 @@ let lists (grps : SmallGroup list) vi = let l = I18N.forView "Requests/Lists" use sw = new StringWriter () let raw = rawLocText sw - [ yield p [] [ + [ p [] [ raw l.["The groups listed below have either public or password-protected request lists."] space raw l.["Those with list icons are public, and those with log on icons are password-protected."] @@ -126,10 +126,10 @@ let lists (grps : SmallGroup list) vi = raw l.["Click the appropriate icon to log on or view the request list."] ] match grps.Length with - | 0 -> yield p [] [ raw l.["There are no groups with public or password-protected request lists."] ] + | 0 -> p [] [ raw l.["There are no groups with public or password-protected request lists."] ] | count -> - yield tableSummary count s - yield table [ _class "pt-table pt-action-table" ] [ + tableSummary count s + table [ _class "pt-table pt-action-table" ] [ thead [] [ tr [] [ th [] [ locStr s.["Actions"] ] @@ -192,19 +192,19 @@ let maintain m (ctx : HttpContext) vi = |> String.concat "" tr [] [ td [] [ - yield a [ _href (sprintf "/web/prayer-request/%s/edit" reqId); _title l.["Edit This Prayer Request"].Value ] + a [ _href (sprintf "/web/prayer-request/%s/edit" reqId); _title l.["Edit This Prayer Request"].Value ] [ icon "edit" ] match req.isExpired now m.smallGroup.preferences.daysToExpire with | true -> - yield a [ _href (sprintf "/web/prayer-request/%s/restore" reqId) - _title l.["Restore This Inactive Request"].Value ] + a [ _href (sprintf "/web/prayer-request/%s/restore" reqId) + _title l.["Restore This Inactive Request"].Value ] [ icon "visibility" ] | false -> - yield a [ _href (sprintf "/web/prayer-request/%s/expire" reqId) - _title l.["Expire This Request Immediately"].Value ] + a [ _href (sprintf "/web/prayer-request/%s/expire" reqId) + _title l.["Expire This Request Immediately"].Value ] [ icon "visibility_off" ] - yield a [ _href delAction; _title l.["Delete This Request"].Value; - _onclick (sprintf "return PT.confirmDelete('%s','%s')" delAction delPrompt) ] + a [ _href delAction; _title l.["Delete This Request"].Value; + _onclick (sprintf "return PT.confirmDelete('%s','%s')" delAction delPrompt) ] [ icon "delete_forever" ] ] td [ updReq req ] [ @@ -213,28 +213,27 @@ let maintain m (ctx : HttpContext) vi = td [] [ locStr typs.[req.requestType] ] td [ reqExp req ] [ str (match req.requestor with Some r -> r | None -> " ") ] td [] [ - yield - match 60 > reqText.Length with - | true -> rawText reqText - | false -> rawText (sprintf "%s…" reqText.[0..59]) + match reqText.Length with + | len when len < 60 -> rawText reqText + | _ -> rawText (sprintf "%s…" reqText.[0..59]) ] ]) |> List.ofSeq - [ yield div [ _class "pt-center-text" ] [ - yield br [] - yield a [ _href (sprintf "/web/prayer-request/%s/edit" emptyGuid); _title s.["Add a New Request"].Value ] + [ div [ _class "pt-center-text" ] [ + br [] + a [ _href (sprintf "/web/prayer-request/%s/edit" emptyGuid); _title s.["Add a New Request"].Value ] [ icon "add_circle"; rawText "  "; locStr s.["Add a New Request"] ] - yield rawText "       " - yield a [ _href "/web/prayer-requests/view"; _title s.["View Prayer Request List"].Value ] + rawText "       " + a [ _href "/web/prayer-requests/view"; _title s.["View Prayer Request List"].Value ] [ icon "list"; rawText "  "; locStr s.["View Prayer Request List"] ] match m.searchTerm with | Some _ -> - yield rawText "       " - yield a [ _href "/web/prayer-requests"; _title l.["Clear Search Criteria"].Value ] + rawText "       " + a [ _href "/web/prayer-requests"; _title l.["Clear Search Criteria"].Value ] [ icon "highlight_off"; rawText "  "; raw l.["Clear Search Criteria"] ] | None -> () ] - yield form [ _action "/web/prayer-requests"; _method "get"; _class "pt-center-text pt-search-form" ] [ + form [ _action "/web/prayer-requests"; _method "get"; _class "pt-center-text pt-search-form" ] [ input [ _type "text" _name "search" _placeholder l.["Search requests..."].Value @@ -243,12 +242,12 @@ let maintain m (ctx : HttpContext) vi = space submit [] "search" s.["Search"] ] - yield br [] - yield tableSummary requests.Length s + br [] + tableSummary requests.Length s match requests.Length with | 0 -> () | _ -> - yield table [ _class "pt-table pt-action-table" ] [ + table [ _class "pt-table pt-action-table" ] [ thead [] [ tr [] [ th [] [ locStr s.["Actions"] ] @@ -260,40 +259,41 @@ let maintain m (ctx : HttpContext) vi = ] tbody [] requests ] - yield div [ _class "pt-center-text" ] [ - yield br [] + div [ _class "pt-center-text" ] [ + br [] match m.onlyActive with | Some true -> - yield raw l.["Inactive requests are currently not shown"] - yield br [] - yield a [ _href "/web/prayer-requests/inactive" ] [ raw l.["Show Inactive Requests"] ] + raw l.["Inactive requests are currently not shown"] + br [] + a [ _href "/web/prayer-requests/inactive" ] [ raw l.["Show Inactive Requests"] ] | _ -> match Option.isSome m.onlyActive with | true -> - yield raw l.["Inactive requests are currently shown"] - yield br [] - yield a [ _href "/web/prayer-requests" ] [ raw l.["Do Not Show Inactive Requests"] ] - yield br [] - yield br [] + raw l.["Inactive requests are currently shown"] + br [] + a [ _href "/web/prayer-requests" ] [ raw l.["Do Not Show Inactive Requests"] ] + br [] + br [] | false -> () - let srch = [ match m.searchTerm with Some s -> yield "search", s | None -> () ] - let url = match m.onlyActive with Some true | None -> "" | _ -> "/inactive" |> sprintf "/web/prayer-requests%s" + let srch = [ match m.searchTerm with Some s -> "search", s | None -> () ] let pg = defaultArg m.pageNbr 1 + let url = + match m.onlyActive with Some true | None -> "" | _ -> "/inactive" |> sprintf "/web/prayer-requests%s" match pg with | 1 -> () | _ -> // button (_type "submit" :: attrs) [ icon ico; rawText "  "; locStr text ] let withPage = match pg with 2 -> srch | _ -> ("page", string (pg - 1)) :: srch - yield a [ _href (makeUrl url withPage) ] + a [ _href (makeUrl url withPage) ] [ icon "keyboard_arrow_left"; space; raw l.["Previous Page"] ] - yield rawText "     " + rawText "     " match requests.Length = m.smallGroup.preferences.pageSize with | true -> - yield a [ _href (makeUrl url (("page", string (pg + 1)) :: srch)) ] + a [ _href (makeUrl url (("page", string (pg + 1)) :: srch)) ] [ raw l.["Next Page"]; space; icon "keyboard_arrow_right" ] | false -> () ] - yield form [ _id "DeleteForm"; _action ""; _method "post" ] [ csrfToken ctx ] + form [ _id "DeleteForm"; _action ""; _method "post" ] [ csrfToken ctx ] ] |> Layout.Content.wide |> Layout.standard vi (match m.searchTerm with Some _ -> "Search Results" | None -> "Maintain Requests") @@ -327,15 +327,15 @@ let view m vi = let spacer = rawText "       " let dtString = m.date.ToString "yyyy-MM-dd" [ div [ _class "pt-center-text" ] [ - yield br [] - yield a [ _class "pt-icon-link" - _href (sprintf "/web/prayer-requests/print/%s" dtString) - _title s.["View Printable"].Value ] [ + br [] + a [ _class "pt-icon-link" + _href (sprintf "/web/prayer-requests/print/%s" dtString) + _title s.["View Printable"].Value ] [ icon "print"; rawText "  "; locStr s.["View Printable"] ] match m.canEmail with | true -> - yield spacer + spacer match m.date.DayOfWeek = DayOfWeek.Sunday with | true -> () | false -> @@ -344,21 +344,21 @@ let view m vi = | true -> date | false -> findSunday (date.AddDays 1.) let sunday = findSunday m.date - yield a [ _class "pt-icon-link" - _href (sprintf "/web/prayer-requests/view/%s" (sunday.ToString "yyyy-MM-dd")) - _title s.["List for Next Sunday"].Value ] [ + a [ _class "pt-icon-link" + _href (sprintf "/web/prayer-requests/view/%s" (sunday.ToString "yyyy-MM-dd")) + _title s.["List for Next Sunday"].Value ] [ icon "update"; rawText "  "; locStr s.["List for Next Sunday"] ] - yield spacer + 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 - yield a [ _class "pt-icon-link" - _href (sprintf "/web/prayer-requests/email/%s" dtString) - _title s.["Send via E-mail"].Value - _onclick (sprintf "return PT.requests.view.promptBeforeEmail('%s')" emailPrompt) ] [ + a [ _class "pt-icon-link" + _href (sprintf "/web/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 "  "; locStr s.["Send via E-mail"] ] - yield spacer - yield a [ _class "pt-icon-link"; _href "/web/prayer-requests"; _title s.["Maintain Prayer Requests"].Value ] [ + spacer + a [ _class "pt-icon-link"; _href "/web/prayer-requests"; _title s.["Maintain Prayer Requests"].Value ] [ icon "compare_arrows"; rawText "  "; locStr s.["Maintain Prayer Requests"] ] | false -> () diff --git a/src/PrayerTracker.UI/SmallGroup.fs b/src/PrayerTracker.UI/SmallGroup.fs index c848f3d..cdd279f 100644 --- a/src/PrayerTracker.UI/SmallGroup.fs +++ b/src/PrayerTracker.UI/SmallGroup.fs @@ -12,8 +12,8 @@ let announcement isAdmin ctx vi = let s = I18N.localizer.Force () let reqTypes = ReferenceList.requestTypeList s [ form [ _action "/web/small-group/announcement/send"; _method "post"; _class "pt-center-columns" ] [ - yield csrfToken ctx - yield div [ _class "pt-field-row" ] [ + csrfToken ctx + div [ _class "pt-field-row" ] [ div [ _class "pt-field pt-editor" ] [ label [ _for "text" ] [ locStr s.["Announcement Text"] ] textarea [ _name "text"; _id "text"; _autofocus ] [] @@ -21,7 +21,7 @@ let announcement isAdmin ctx vi = ] match isAdmin with | true -> - yield div [ _class "pt-field-row" ] [ + div [ _class "pt-field-row" ] [ div [ _class "pt-field" ] [ label [] [ locStr s.["Send Announcement to"]; rawText ":" ] div [ _class "pt-center-text" ] [ @@ -32,15 +32,14 @@ let announcement isAdmin ctx vi = ] ] ] - | false -> - yield input [ _type "hidden"; _name "sendToClass"; _value "Y" ] - yield div [ _class "pt-field-row pt-fadeable pt-shown"; _id "divAddToList" ] [ + | false -> input [ _type "hidden"; _name "sendToClass"; _value "Y" ] + 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" ] [ locStr s.["Add to Request List"] ] ] ] - yield div [ _class "pt-field-row pt-fadeable"; _id "divCategory" ] [ + div [ _class "pt-field-row pt-fadeable"; _id "divCategory" ] [ div [ _class "pt-field" ] [ label [ _for "requestType" ] [ locStr s.["Request Type"] ] reqTypes @@ -49,7 +48,7 @@ let announcement isAdmin ctx vi = |> selectList "requestType" "Announcement" [] ] ] - yield div [ _class "pt-field-row" ] [ submit [] "send" s.["Send Announcement"] ] + div [ _class "pt-field-row" ] [ submit [] "send" s.["Send Announcement"] ] ] script [] [ rawText "PT.onLoad(PT.smallGroup.announcement.onPageLoad)" ] ] @@ -88,7 +87,7 @@ let edit (m : EditSmallGroup) (churches : Church list) ctx vi = div [ _class "pt-field" ] [ label [ _for "churchId" ] [ locStr s.["Church"] ] seq { - yield "", selectDefault s.["Select Church"].Value + "", selectDefault s.["Select Church"].Value yield! churches |> List.map (fun c -> flatGuid c.churchId, c.name) } |> selectList "churchId" (flatGuid m.churchId) [ _required ] @@ -144,9 +143,9 @@ let logOn (grps : SmallGroup list) grpId ctx vi = label [ _for "smallGroupId" ] [ locStr s.["Group"] ] seq { match grps.Length with - | 0 -> yield "", s.["There are no classes with passwords defined"].Value + | 0 -> "", s.["There are no classes with passwords defined"].Value | _ -> - yield "", selectDefault s.["Select Group"].Value + "", selectDefault s.["Select Group"].Value yield! grps |> List.map (fun grp -> flatGuid grp.smallGroupId, sprintf "%s | %s" grp.church.name grp.name) } @@ -305,21 +304,21 @@ let overview m vi = locStr s.["Prayer Requests"] ] div [] [ - yield p [ _class "pt-center-text" ] [ + p [ _class "pt-center-text" ] [ strong [] [ str (m.totalActiveReqs.ToString "N0"); space; locStr s.["Active Requests"] ] ] - yield hr [] + hr [] for cat in m.activeReqsByCat do - yield str (cat.Value.ToString "N0") - yield space - yield locStr typs.[cat.Key] - yield br [] - yield br [] - yield str (m.allReqs.ToString "N0") - yield space - yield locStr s.["Total Requests"] - yield hr [] - yield a [ _href "/web/prayer-requests/maintain" ] [ + str (cat.Value.ToString "N0") + space + locStr typs.[cat.Key] + br [] + br [] + str (m.allReqs.ToString "N0") + space + locStr s.["Total Requests"] + hr [] + a [ _href "/web/prayer-requests/maintain" ] [ icon "compare_arrows" linkSpacer locStr s.["Maintain Prayer Requests"] @@ -406,7 +405,7 @@ let preferences (m : EditPreferences) (tzs : TimeZone list) ctx vi = div [ _class "pt-field" ] [ label [ _for "defaultEmailType" ] [ locStr s.["E-mail Format"] ] seq { - yield "", selectDefault s.["Select"].Value + "", selectDefault s.["Select"].Value yield! ReferenceList.emailTypeList HtmlFormat s |> Seq.skip 1 |> Seq.map (fun typ -> fst typ, (snd typ).Value) @@ -424,16 +423,16 @@ let preferences (m : EditPreferences) (tzs : TimeZone list) ctx vi = radio "headingLineType" "headingLineType_Name" "Name" m.headingLineType 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 + [ _id "headingLineColor_Select" + match m.headingLineColor.StartsWith "#" with true -> _disabled | false -> () ] s rawText "    "; str (s.["or"].Value.ToUpper ()) radio "headingLineType" "headingLineType_RGB" "RGB" m.headingLineType label [ _for "headingLineType_RGB" ] [ locStr s.["Custom Color"] ] - input [ yield _type "color" - yield _name "headingLineColor" - yield _id "headingLineColor_Color" - yield _value m.headingLineColor - match m.headingLineColor.StartsWith "#" with true -> () | false -> yield _disabled ] + input [ _type "color" + _name "headingLineColor" + _id "headingLineColor_Color" + _value m.headingLineColor + match m.headingLineColor.StartsWith "#" with true -> () | false -> _disabled ] ] ] ] @@ -444,16 +443,16 @@ let preferences (m : EditPreferences) (tzs : TimeZone list) ctx vi = radio "headingTextType" "headingTextType_Name" "Name" m.headingTextType 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 + [ _id "headingTextColor_Select" + match m.headingTextColor.StartsWith "#" with true -> _disabled | false -> () ] s rawText "    "; str (s.["or"].Value.ToUpper ()) radio "headingTextType" "headingTextType_RGB" "RGB" m.headingTextType label [ _for "headingTextType_RGB" ] [ locStr s.["Custom Color"] ] - input [ yield _type "color" - yield _name "headingTextColor" - yield _id "headingTextColor_Color" - yield _value m.headingTextColor - match m.headingTextColor.StartsWith "#" with true -> () | false -> yield _disabled ] + input [ _type "color" + _name "headingTextColor" + _id "headingTextColor_Color" + _value m.headingTextColor + match m.headingTextColor.StartsWith "#" with true -> () | false -> _disabled ] ] ] ] @@ -483,7 +482,7 @@ let preferences (m : EditPreferences) (tzs : TimeZone list) ctx vi = div [ _class "pt-field" ] [ label [ _for "timeZone" ] [ locStr s.["Time Zone"] ] seq { - yield "", selectDefault s.["Select"].Value + "", selectDefault s.["Select"].Value yield! tzs |> List.map (fun tz -> tz.timeZoneId, (TimeZones.name tz.timeZoneId s).Value) } |> selectList "timeZone" m.timeZone [ _required ] @@ -502,10 +501,10 @@ let preferences (m : EditPreferences) (tzs : TimeZone list) ctx vi = label [ _for "viz_Password" ] [ locStr s.["Password Protected"] ] ] ] - div [ yield _id "divClassPassword" + div [ _id "divClassPassword" match m.listVisibility = RequestVisibility.passwordProtected with - | true -> yield _class "pt-field-row pt-fadeable pt-show" - | false -> yield _class "pt-field-row pt-fadeable" + | true -> _class "pt-field-row pt-fadeable pt-show" + | false -> _class "pt-field-row pt-fadeable" ] [ div [ _class "pt-field" ] [ label [ _for "groupPassword" ] [ locStr s.["Group Password (Used to Read Online)"] ] diff --git a/src/PrayerTracker.UI/User.fs b/src/PrayerTracker.UI/User.fs index 2662213..9f933cc 100644 --- a/src/PrayerTracker.UI/User.fs +++ b/src/PrayerTracker.UI/User.fs @@ -24,11 +24,11 @@ let assignGroups m groups curGroups ctx vi = let inputId = sprintf "id-%s" grpId tr [] [ td [] [ - input [ yield _type "checkbox" - yield _name "smallGroups" - yield _id inputId - yield _value grpId - match curGroups |> List.contains grpId with true -> yield _checked | false -> () ] + input [ _type "checkbox" + _name "smallGroups" + _id inputId + _value grpId + match curGroups |> List.contains grpId with true -> _checked | false -> () ] ] td [] [ label [ _for inputId ] [ str grpName ] ] ]) @@ -114,11 +114,11 @@ let edit (m : EditUser) ctx vi = ] ] div [ _class "pt-checkbox-field" ] [ - input [ yield _type "checkbox" - yield _name "isAdmin" - yield _id "isAdmin" - yield _value "True" - match m.isAdmin with Some x when x -> yield _checked | _ -> () ] + input [ _type "checkbox" + _name "isAdmin" + _id "isAdmin" + _value "True" + match m.isAdmin with Some x when x -> _checked | _ -> () ] label [ _for "isAdmin" ] [ locStr s.["This user is a PrayerTracker administrator"] ] ] div [ _class "pt-field-row" ] [ submit [] "save" s.["Save User"] ] @@ -151,7 +151,7 @@ let logOn (m : UserLogOn) groups ctx vi = div [ _class "pt-field" ] [ label [ _for "smallGroupId" ] [ locStr s.["Group"] ] seq { - yield "", selectDefault s.["Select Group"].Value + "", selectDefault s.["Select Group"].Value yield! groups } |> selectList "smallGroupId" "" [ _required ] @@ -205,8 +205,8 @@ let maintain (users : User list) ctx vi = td [] [ str user.fullName ] td [ _class "pt-center-text" ] [ match user.isAdmin with - | true -> yield strong [] [ locStr s.["Yes"] ] - | false -> yield locStr s.["No"] + | true -> strong [] [ locStr s.["Yes"] ] + | false -> locStr s.["No"] ] ]) |> tbody [] diff --git a/src/PrayerTracker.UI/Utils.fs b/src/PrayerTracker.UI/Utils.fs index dda074e..b7c8766 100644 --- a/src/PrayerTracker.UI/Utils.fs +++ b/src/PrayerTracker.UI/Utils.fs @@ -30,17 +30,15 @@ module String = /// string.Replace() let replace (find : string) repl (str : string) = str.Replace (find, repl) - /// Replace the first occurrence of a string with a second string within a given string let replaceFirst (needle : string) replacement (haystack : string) = match haystack.IndexOf needle with | -1 -> haystack | idx -> - seq { - yield haystack.[0..idx - 1] - yield replacement - yield haystack.[idx + needle.Length..] - } + [ haystack.[0..idx - 1] + replacement + haystack.[idx + needle.Length..] + ] |> String.concat "" diff --git a/src/PrayerTracker.UI/ViewModels.fs b/src/PrayerTracker.UI/ViewModels.fs index 85701ad..24152c1 100644 --- a/src/PrayerTracker.UI/ViewModels.fs +++ b/src/PrayerTracker.UI/ViewModels.fs @@ -25,16 +25,16 @@ module ReferenceList = | HtmlFormat -> s.["HTML Format"].Value | PlainTextFormat -> s.["Plain-Text Format"].Value seq { - yield "", LocalizedString ("", sprintf "%s (%s)" s.["Group Default"].Value defaultType) - yield HtmlFormat.code, s.["HTML Format"] - yield PlainTextFormat.code, s.["Plain-Text Format"] + "", LocalizedString ("", sprintf "%s (%s)" s.["Group Default"].Value defaultType) + HtmlFormat.code, s.["HTML Format"] + PlainTextFormat.code, s.["Plain-Text Format"] } /// A list of expiration options let expirationList (s : IStringLocalizer) includeExpireNow = - [ yield Automatic.code, s.["Expire Normally"] - yield Manual.code, s.["Request Never Expires"] - match includeExpireNow with true -> yield Forced.code, s.["Expire Immediately"] | false -> () + [ Automatic.code, s.["Expire Normally"] + Manual.code, s.["Request Never Expires"] + match includeExpireNow with true -> Forced.code, s.["Expire Immediately"] | false -> () ] /// A list of request types @@ -583,7 +583,7 @@ with let asOfSize = Math.Round (float prefs.textFontSize * 0.8, 2) [ match this.showHeader with | true -> - yield div [ _style (sprintf "text-align:center;font-family:%s" prefs.listFonts) ] [ + div [ _style (sprintf "text-align:center;font-family:%s" prefs.listFonts) ] [ span [ _style (sprintf "font-size:%ipt;" prefs.headingFontSize) ] [ strong [] [ str s.["Prayer Requests"].Value ] ] @@ -594,7 +594,7 @@ with str (this.date.ToString s.["MMMM d, yyyy"].Value) ] ] - yield br [] + br [] | false -> () let typs = ReferenceList.requestTypeList s for cat in @@ -604,7 +604,7 @@ with |> Seq.filter (fun c -> 0 < (this.requests |> List.filter (fun req -> req.requestType = c) |> List.length)) do let reqs = this.requestsInCategory cat let catName = typs |> List.filter (fun t -> fst t = cat) |> List.head |> snd - yield div [ _style "padding-left:10px;padding-bottom:.5em;" ] [ + div [ _style "padding-left:10px;padding-bottom:.5em;" ] [ table [ _style (sprintf "font-family:%s;page-break-inside:avoid;" prefs.listFonts) ] [ 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;" @@ -614,44 +614,43 @@ with ] ] ] - yield - reqs - |> List.map (fun req -> - let bullet = match this.isNew req with true -> "circle" | false -> "disc" - li [ _style (sprintf "list-style-type:%s;font-family:%s;font-size:%ipt;padding-bottom:.25em;" - bullet prefs.listFonts prefs.textFontSize) ] [ - match req.requestor with - | Some rqstr when rqstr <> "" -> - yield strong [] [ str rqstr ] - yield rawText " — " - | Some _ -> () - | None -> () - yield rawText req.text - match prefs.asOfDateDisplay with - | NoDisplay -> () - | ShortDate - | LongDate -> - let dt = - match prefs.asOfDateDisplay with - | ShortDate -> req.updatedDate.ToShortDateString () - | LongDate -> req.updatedDate.ToLongDateString () - | _ -> "" - yield i [ _style (sprintf "font-size:%.2fpt" asOfSize) ] [ - rawText "  ("; str s.["as of"].Value; str " "; str dt; rawText ")" - ] - ]) + reqs + |> List.map (fun req -> + let bullet = match this.isNew req with true -> "circle" | false -> "disc" + li [ _style (sprintf "list-style-type:%s;font-family:%s;font-size:%ipt;padding-bottom:.25em;" + bullet prefs.listFonts prefs.textFontSize) ] [ + match req.requestor with + | Some rqstr when rqstr <> "" -> + strong [] [ str rqstr ] + rawText " — " + | Some _ -> () + | None -> () + rawText req.text + match prefs.asOfDateDisplay with + | NoDisplay -> () + | ShortDate + | LongDate -> + let dt = + match prefs.asOfDateDisplay with + | ShortDate -> req.updatedDate.ToShortDateString () + | LongDate -> req.updatedDate.ToLongDateString () + | _ -> "" + i [ _style (sprintf "font-size:%.2fpt" asOfSize) ] [ + rawText "  ("; str s.["as of"].Value; str " "; str dt; rawText ")" + ] + ]) |> ul [] - yield br [] + br [] ] |> renderHtmlNodes /// Generate this list as plain text member this.asText (s : IStringLocalizer) = seq { - yield this.listGroup.name - yield s.["Prayer Requests"].Value - yield this.date.ToString s.["MMMM d, yyyy"].Value - yield " " + this.listGroup.name + s.["Prayer Requests"].Value + this.date.ToString s.["MMMM d, yyyy"].Value + " " let typs = ReferenceList.requestTypeList s for cat in typs @@ -661,24 +660,23 @@ with let reqs = this.requestsInCategory cat let typ = (typs |> List.filter (fun t -> fst t = cat) |> List.head |> snd).Value let dashes = String.replicate (typ.Length + 4) "-" - yield dashes - yield sprintf @" %s" (typ.ToUpper ()) - yield dashes + dashes + sprintf @" %s" (typ.ToUpper ()) + dashes for req in reqs do let bullet = match this.isNew req with true -> "+" | false -> "-" let requestor = match req.requestor with Some r -> sprintf "%s - " r | None -> "" - yield - match this.listGroup.preferences.asOfDateDisplay with - | NoDisplay -> "" - | _ -> - let dt = - match this.listGroup.preferences.asOfDateDisplay with - | ShortDate -> req.updatedDate.ToShortDateString () - | LongDate -> req.updatedDate.ToLongDateString () - | _ -> "" - sprintf " (%s %s)" s.["as of"].Value dt - |> sprintf " %s %s%s%s" bullet requestor (htmlToPlainText req.text) - yield " " + match this.listGroup.preferences.asOfDateDisplay with + | NoDisplay -> "" + | _ -> + let dt = + match this.listGroup.preferences.asOfDateDisplay with + | ShortDate -> req.updatedDate.ToShortDateString () + | LongDate -> req.updatedDate.ToLongDateString () + | _ -> "" + sprintf " (%s %s)" s.["as of"].Value dt + |> sprintf " %s %s%s%s" bullet requestor (htmlToPlainText req.text) + " " } |> String.concat "\n" |> wordWrap 74 diff --git a/src/PrayerTracker/CommonFunctions.fs b/src/PrayerTracker/CommonFunctions.fs index 52b1fbf..efb3ea0 100644 --- a/src/PrayerTracker/CommonFunctions.fs +++ b/src/PrayerTracker/CommonFunctions.fs @@ -44,12 +44,12 @@ let appVersion = sprintf "v%A" v #else seq { - yield sprintf "v%d" v.Major + sprintf "v%d" v.Major match v.Minor with - | 0 -> match v.Build with 0 -> () | _ -> yield sprintf ".0.%d" v.Build + | 0 -> match v.Build with 0 -> () | _ -> sprintf ".0.%d" v.Build | _ -> - yield sprintf ".%d" v.Minor - match v.Build with 0 -> () | _ -> yield sprintf ".%d" v.Build + sprintf ".%d" v.Minor + match v.Build with 0 -> () | _ -> sprintf ".%d" v.Build } |> String.concat "" #endif