Release 7.4 #21

Merged
danieljsummers merged 7 commits from release-7.4 into master 2019-10-19 17:22:52 +00:00
10 changed files with 252 additions and 261 deletions
Showing only changes of commit bf48c360de - Show all commits

View File

@ -29,11 +29,11 @@ let edit (m : EditChurch) ctx vi =
] ]
div [ _class "pt-field-row" ] [ div [ _class "pt-field-row" ] [
div [ _class "pt-checkbox-field" ] [ div [ _class "pt-checkbox-field" ] [
input [ yield _type "checkbox" input [ _type "checkbox"
yield _name "hasInterface" _name "hasInterface"
yield _id "hasInterface" _id "hasInterface"
yield _value "True" _value "True"
match m.hasInterface with Some x when x -> yield _checked | _ -> () ] match m.hasInterface with Some x when x -> _checked | _ -> () ]
label [ _for "hasInterface" ] [ locStr s.["Has an interface with Virtual Prayer Room"] ] label [ _for "hasInterface" ] [ locStr s.["Has an interface with Virtual Prayer Room"] ]
] ]
] ]

View File

@ -52,22 +52,22 @@ let tableSummary itemCount (s : IStringLocalizer) =
let namedColorList name selected attrs (s : IStringLocalizer) = let namedColorList name selected attrs (s : IStringLocalizer) =
/// The list of HTML named colors (name, display, text color) /// The list of HTML named colors (name, display, text color)
seq { seq {
yield ("aqua", s.["Aqua"], "black") ("aqua", s.["Aqua"], "black")
yield ("black", s.["Black"], "white") ("black", s.["Black"], "white")
yield ("blue", s.["Blue"], "white") ("blue", s.["Blue"], "white")
yield ("fuchsia", s.["Fuchsia"], "black") ("fuchsia", s.["Fuchsia"], "black")
yield ("gray", s.["Gray"], "white") ("gray", s.["Gray"], "white")
yield ("green", s.["Green"], "white") ("green", s.["Green"], "white")
yield ("lime", s.["Lime"], "black") ("lime", s.["Lime"], "black")
yield ("maroon", s.["Maroon"], "white") ("maroon", s.["Maroon"], "white")
yield ("navy", s.["Navy"], "white") ("navy", s.["Navy"], "white")
yield ("olive", s.["Olive"], "white") ("olive", s.["Olive"], "white")
yield ("purple", s.["Purple"], "white") ("purple", s.["Purple"], "white")
yield ("red", s.["Red"], "black") ("red", s.["Red"], "black")
yield ("silver", s.["Silver"], "black") ("silver", s.["Silver"], "black")
yield ("teal", s.["Teal"], "white") ("teal", s.["Teal"], "white")
yield ("white", s.["White"], "black") ("white", s.["White"], "black")
yield ("yellow", s.["Yellow"], "black") ("yellow", s.["Yellow"], "black")
} }
|> Seq.map (fun color -> |> Seq.map (fun color ->
let (colorName, dispText, txtColor) = 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 /// Generate an input[type=radio] that is selected if its value is the current value
let radio name domId value current = let radio name domId value current =
input [ yield _type "radio" input [ _type "radio"
yield _name name _name name
yield _id domId _id domId
yield _value value _value value
match value = current with true -> yield _checked | false -> () ] match value = current with true -> _checked | false -> () ]
/// Generate a select list with the current value selected /// Generate a select list with the current value selected
let selectList name selected attrs items = let selectList name selected attrs items =
items items
|> Seq.map (fun (value, text) -> |> Seq.map (fun (value, text) ->
option [ yield _value value option [ _value value
match value = selected with true -> yield _selected | false -> () ] [ encodedText text ]) match value = selected with true -> _selected | false -> () ] [ encodedText text ])
|> List.ofSeq |> List.ofSeq
|> select (List.concat [ [ _name name; _id name ]; attrs ]) |> select (List.concat [ [ _name name; _id name ]; attrs ])

View File

@ -32,9 +32,9 @@ let error code vi =
raw l.["Please use your “Back” button to return to {0}.", s.["PrayerTracker"]] raw l.["Please use your “Back” button to return to {0}.", s.["PrayerTracker"]]
] ]
] ]
yield br [] br []
yield hr [] hr []
yield div [ _style "font-size:70%;font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Oxygen-Sans,Ubuntu,Cantarell,'Helvetica Neue',sans-serif" ] [ 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"]) img [ _src (sprintf "/img/%A.png" s.["footer_en"])
_alt (sprintf "%A %A" s.["PrayerTracker"] s.["from Bit Badger Solutions"]) _alt (sprintf "%A %A" s.["PrayerTracker"] s.["from Bit Badger Solutions"])
_title (sprintf "%A %A" s.["PrayerTracker"] s.["from Bit Badger Solutions"]) _title (sprintf "%A %A" s.["PrayerTracker"] s.["from Bit Badger Solutions"])

View File

@ -22,7 +22,7 @@ module Navigation =
let leftLinks = [ let leftLinks = [
match m.user with match m.user with
| Some u -> | Some u ->
yield li [ _class "dropdown" ] [ li [ _class "dropdown" ] [
a [ _class "dropbtn"; _role "button"; _aria "label" s.["Requests"].Value; _title s.["Requests"].Value ] 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" ] [ icon "question_answer"; space; locStr s.["Requests"]; space; icon "keyboard_arrow_down" ]
div [ _class "dropdown-content"; _role "menu" ] [ 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"] ] 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 ] 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" ] [ icon "group"; space; locStr s.["Group"]; space; icon "keyboard_arrow_down" ]
div [ _class "dropdown-content"; _role "menu" ] [ div [ _class "dropdown-content"; _role "menu" ] [
@ -41,7 +41,7 @@ module Navigation =
] ]
match u.isAdmin with match u.isAdmin with
| true -> | true ->
yield li [ _class "dropdown" ] [ li [ _class "dropdown" ] [
a [ _class "dropbtn"; _role "button"; _aria "label" s.["Administration"].Value; _title s.["Administration"].Value ] 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" ] [ icon "settings"; space; locStr s.["Administration"]; space; icon "keyboard_arrow_down" ]
div [ _class "dropdown-content"; _role "menu" ] [ div [ _class "dropdown-content"; _role "menu" ] [
@ -54,14 +54,14 @@ module Navigation =
| None -> | None ->
match m.group with match m.group with
| Some _ -> | Some _ ->
yield li [] [ li [] [
a [ _href "/web/prayer-requests/view" a [ _href "/web/prayer-requests/view"
_aria "label" s.["View Request List"].Value _aria "label" s.["View Request List"].Value
_title s.["View Request List"].Value ] _title s.["View Request List"].Value ]
[ icon "list"; space; locStr s.["View Request List"] ] [ icon "list"; space; locStr s.["View Request List"] ]
] ]
| None -> | None ->
yield li [ _class "dropdown" ] [ li [ _class "dropdown" ] [
a [ _class "dropbtn"; _role "button"; _aria "label" s.["Log On"].Value; _title s.["Log On"].Value ] 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" ] [ icon "security"; space; locStr s.["Log On"]; space; icon "keyboard_arrow_down" ]
div [ _class "dropdown-content"; _role "menu" ] [ 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"] ] a [ _href "/web/small-group/log-on" ] [ icon "group"; menuSpacer; locStr s.["Group"] ]
] ]
] ]
yield li [] [ li [] [
a [ _href "/web/prayer-requests/lists" a [ _href "/web/prayer-requests/lists"
_aria "label" s.["View Request List"].Value _aria "label" s.["View Request List"].Value
_title s.["View Request List"].Value ] _title s.["View Request List"].Value ]
[ icon "list"; space; locStr s.["View Request List"] ] [ icon "list"; space; locStr s.["View Request List"] ]
] ]
yield li [] [ li [] [
a [ _href (sprintf "https://docs.prayer.bitbadger.solutions/%s" <| langCode ()) a [ _href (sprintf "https://docs.prayer.bitbadger.solutions/%s" <| langCode ())
_aria "label" s.["Help"].Value; _aria "label" s.["Help"].Value;
_title s.["View Help"].Value _title s.["View Help"].Value
@ -89,14 +89,14 @@ module Navigation =
| Some _ -> | Some _ ->
[ match m.user with [ match m.user with
| Some _ -> | Some _ ->
yield li [] [ li [] [
a [ _href "/web/user/password" a [ _href "/web/user/password"
_aria "label" s.["Change Your Password"].Value _aria "label" s.["Change Your Password"].Value
_title s.["Change Your Password"].Value ] _title s.["Change Your Password"].Value ]
[ icon "lock"; space; locStr s.["Change Your Password"] ] [ icon "lock"; space; locStr s.["Change Your Password"] ]
] ]
| None -> () | None -> ()
yield li [] [ li [] [
a [ _href "/web/log-off"; _aria "label" s.["Log Off"].Value; _title s.["Log Off"].Value ] 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"] ] [ icon "power_settings_new"; space; locStr s.["Log Off"] ]
] ]
@ -120,35 +120,35 @@ module Navigation =
let s = I18N.localizer.Force () let s = I18N.localizer.Force ()
header [ _id "pt-language" ] [ header [ _id "pt-language" ] [
div [] [ div [] [
yield span [ _class "u" ] [ locStr s.["Language"]; rawText ": " ] span [ _class "u" ] [ locStr s.["Language"]; rawText ": " ]
match langCode () with match langCode () with
| "es" -> | "es" ->
yield locStr s.["Spanish"] locStr s.["Spanish"]
yield rawText " &nbsp; &bull; &nbsp; " rawText " &nbsp; &bull; &nbsp; "
yield a [ _href "/web/language/en" ] [ locStr s.["Change to English"] ] a [ _href "/web/language/en" ] [ locStr s.["Change to English"] ]
| _ -> | _ ->
yield locStr s.["English"] locStr s.["English"]
yield rawText " &nbsp; &bull; &nbsp; " rawText " &nbsp; &bull; &nbsp; "
yield a [ _href "/web/language/es" ] [ locStr s.["Cambie a Español"] ] a [ _href "/web/language/es" ] [ locStr s.["Cambie a Español"] ]
] ]
match m.group with match m.group with
| Some g -> | Some g ->
[ match m.user with [ match m.user with
| Some u -> | Some u ->
yield span [ _class "u" ] [ locStr s.["Currently Logged On"] ] span [ _class "u" ] [ locStr s.["Currently Logged On"] ]
yield rawText "&nbsp; &nbsp;" rawText "&nbsp; &nbsp;"
yield icon "person" icon "person"
yield strong [] [ str u.fullName ] strong [] [ str u.fullName ]
yield rawText "&nbsp; &nbsp; " rawText "&nbsp; &nbsp; "
| None -> | None ->
yield locStr s.["Logged On as a Member of"] locStr s.["Logged On as a Member of"]
yield rawText "&nbsp; " rawText "&nbsp; "
yield icon "group" icon "group"
yield space space
match m.user with match m.user with
| Some _ -> yield a [ _href "/web/small-group" ] [ strong [] [ str g.name ] ] | Some _ -> a [ _href "/web/small-group" ] [ strong [] [ str g.name ] ]
| None -> yield strong [] [ str g.name ] | None -> strong [] [ str g.name ]
yield rawText " &nbsp;" rawText " &nbsp;"
] ]
| None -> [] | None -> []
|> div [] |> div []
@ -179,13 +179,13 @@ let private commonHead =
let private htmlHead m pageTitle = let private htmlHead m pageTitle =
let s = I18N.localizer.Force () let s = I18N.localizer.Force ()
head [] [ head [] [
yield meta [ _charset "UTF-8" ] meta [ _charset "UTF-8" ]
yield title [] [ locStr pageTitle; titleSep; locStr s.["PrayerTracker"] ] title [] [ locStr pageTitle; titleSep; locStr s.["PrayerTracker"] ]
yield! commonHead yield! commonHead
for cssFile in m.style do 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 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 /// 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 /// Render the page title, and optionally a help link
let private renderPageTitle m pageTitle = let private renderPageTitle m pageTitle =
h2 [ _id "pt-page-title" ] [ h2 [ _id "pt-page-title" ] [
match m.helpLink with match m.helpLink with Some link -> Help.fullLink (langCode ()) link |> helpLink | None -> ()
| Some link -> yield Help.fullLink (langCode ()) link |> helpLink locStr pageTitle
| None -> ()
yield locStr pageTitle
] ]
/// Render the messages that may need to be displayed to the user /// Render the messages that may need to be displayed to the user
@ -219,13 +217,13 @@ let private messages m =
match msg.level with match msg.level with
| "Info" -> () | "Info" -> ()
| lvl -> | lvl ->
yield strong [] [ locStr s.[lvl] ] strong [] [ locStr s.[lvl] ]
yield rawText " &#xbb; " rawText " &#xbb; "
yield rawText msg.text.Value rawText msg.text.Value
match msg.description with match msg.description with
| Some desc -> | Some desc ->
yield br [] br []
yield div [ _class "description" ] [ rawText desc.Value ] div [ _class "description" ] [ rawText desc.Value ]
| None -> () | None -> ()
] ]
] ]
@ -262,7 +260,7 @@ let private htmlFooter m =
] ]
/// The standard layout for PrayerTracker /// The standard layout for PrayerTracker
let standard m pageTitle content = let standard m pageTitle (content : XmlNode) =
let s = I18N.localizer.Force () let s = I18N.localizer.Force ()
let ttl = s.[pageTitle] let ttl = s.[pageTitle]
html [ _lang "" ] [ html [ _lang "" ] [
@ -270,11 +268,11 @@ let standard m pageTitle content =
body [] [ body [] [
Navigation.top m Navigation.top m
div [ _id "pt-body" ] [ div [ _id "pt-body" ] [
yield Navigation.identity m Navigation.identity m
yield renderPageTitle m ttl renderPageTitle m ttl
yield! messages m yield! messages m
yield content content
yield htmlFooter m htmlFooter m
] ]
] ]
] ]
@ -288,7 +286,5 @@ let bare pageTitle content =
meta [ _charset "UTF-8" ] meta [ _charset "UTF-8" ]
title [] [ locStr ttl; titleSep; locStr s.["PrayerTracker"] ] title [] [ locStr ttl; titleSep; locStr s.["PrayerTracker"] ]
] ]
body [] [ body [] [ content ]
content
]
] ]

View File

@ -19,14 +19,14 @@ let edit (m : EditRequest) today ctx vi =
csrfToken ctx csrfToken ctx
input [ _type "hidden"; _name "requestId"; _value (flatGuid m.requestId) ] input [ _type "hidden"; _name "requestId"; _value (flatGuid m.requestId) ]
div [ _class "pt-field-row" ] [ div [ _class "pt-field-row" ] [
yield div [ _class "pt-field" ] [ div [ _class "pt-field" ] [
label [ _for "requestType" ] [ locStr s.["Request Type"] ] label [ _for "requestType" ] [ locStr s.["Request Type"] ]
ReferenceList.requestTypeList s ReferenceList.requestTypeList s
|> Seq.ofList |> Seq.ofList
|> Seq.map (fun (typ, desc) -> typ.code, desc.Value) |> Seq.map (fun (typ, desc) -> typ.code, desc.Value)
|> selectList "requestType" m.requestType [ _required; _autofocus ] |> selectList "requestType" m.requestType [ _required; _autofocus ]
] ]
yield div [ _class "pt-field" ] [ div [ _class "pt-field" ] [
label [ _for "requestor" ] [ locStr s.["Requestor / Subject"] ] label [ _for "requestor" ] [ locStr s.["Requestor / Subject"] ]
input [ _type "text" input [ _type "text"
_name "requestor" _name "requestor"
@ -35,12 +35,12 @@ let edit (m : EditRequest) today ctx vi =
] ]
match m.isNew () with match m.isNew () with
| true -> | true ->
yield div [ _class "pt-field" ] [ div [ _class "pt-field" ] [
label [ _for "enteredDate" ] [ locStr s.["Date"] ] label [ _for "enteredDate" ] [ locStr s.["Date"] ]
input [ _type "date"; _name "enteredDate"; _id "enteredDate"; _placeholder today ] input [ _type "date"; _name "enteredDate"; _id "enteredDate"; _placeholder today ]
] ]
| false -> | false ->
yield div [ _class "pt-field" ] [ div [ _class "pt-field" ] [
div [ _class "pt-checkbox-field" ] [ div [ _class "pt-checkbox-field" ] [
br [] br []
input [ _type "checkbox"; _name "skipDateUpdate"; _id "skipDateUpdate"; _value "True" ] 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" let l = I18N.forView "Requests/Lists"
use sw = new StringWriter () use sw = new StringWriter ()
let raw = rawLocText sw let raw = rawLocText sw
[ yield p [] [ [ p [] [
raw l.["The groups listed below have either public or password-protected request lists."] raw l.["The groups listed below have either public or password-protected request lists."]
space space
raw l.["Those with list icons are public, and those with log on icons are password-protected."] 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."] raw l.["Click the appropriate icon to log on or view the request list."]
] ]
match grps.Length with 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 -> | count ->
yield tableSummary count s tableSummary count s
yield table [ _class "pt-table pt-action-table" ] [ table [ _class "pt-table pt-action-table" ] [
thead [] [ thead [] [
tr [] [ tr [] [
th [] [ locStr s.["Actions"] ] th [] [ locStr s.["Actions"] ]
@ -192,18 +192,18 @@ let maintain m (ctx : HttpContext) vi =
|> String.concat "" |> String.concat ""
tr [] [ tr [] [
td [] [ 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" ] [ icon "edit" ]
match req.isExpired now m.smallGroup.preferences.daysToExpire with match req.isExpired now m.smallGroup.preferences.daysToExpire with
| true -> | true ->
yield a [ _href (sprintf "/web/prayer-request/%s/restore" reqId) a [ _href (sprintf "/web/prayer-request/%s/restore" reqId)
_title l.["Restore This Inactive Request"].Value ] _title l.["Restore This Inactive Request"].Value ]
[ icon "visibility" ] [ icon "visibility" ]
| false -> | false ->
yield a [ _href (sprintf "/web/prayer-request/%s/expire" reqId) a [ _href (sprintf "/web/prayer-request/%s/expire" reqId)
_title l.["Expire This Request Immediately"].Value ] _title l.["Expire This Request Immediately"].Value ]
[ icon "visibility_off" ] [ icon "visibility_off" ]
yield a [ _href delAction; _title l.["Delete This Request"].Value; a [ _href delAction; _title l.["Delete This Request"].Value;
_onclick (sprintf "return PT.confirmDelete('%s','%s')" delAction delPrompt) ] _onclick (sprintf "return PT.confirmDelete('%s','%s')" delAction delPrompt) ]
[ icon "delete_forever" ] [ icon "delete_forever" ]
] ]
@ -213,28 +213,27 @@ let maintain m (ctx : HttpContext) vi =
td [] [ locStr typs.[req.requestType] ] td [] [ locStr typs.[req.requestType] ]
td [ reqExp req ] [ str (match req.requestor with Some r -> r | None -> " ") ] td [ reqExp req ] [ str (match req.requestor with Some r -> r | None -> " ") ]
td [] [ td [] [
yield match reqText.Length with
match 60 > reqText.Length with | len when len < 60 -> rawText reqText
| true -> rawText reqText | _ -> rawText (sprintf "%s&hellip;" reqText.[0..59])
| false -> rawText (sprintf "%s&hellip;" reqText.[0..59])
] ]
]) ])
|> List.ofSeq |> List.ofSeq
[ yield div [ _class "pt-center-text" ] [ [ div [ _class "pt-center-text" ] [
yield br [] br []
yield a [ _href (sprintf "/web/prayer-request/%s/edit" emptyGuid); _title s.["Add a New Request"].Value ] a [ _href (sprintf "/web/prayer-request/%s/edit" emptyGuid); _title s.["Add a New Request"].Value ]
[ icon "add_circle"; rawText " &nbsp;"; locStr s.["Add a New Request"] ] [ icon "add_circle"; rawText " &nbsp;"; locStr s.["Add a New Request"] ]
yield rawText " &nbsp; &nbsp; &nbsp; " rawText " &nbsp; &nbsp; &nbsp; "
yield a [ _href "/web/prayer-requests/view"; _title s.["View Prayer Request List"].Value ] a [ _href "/web/prayer-requests/view"; _title s.["View Prayer Request List"].Value ]
[ icon "list"; rawText " &nbsp;"; locStr s.["View Prayer Request List"] ] [ icon "list"; rawText " &nbsp;"; locStr s.["View Prayer Request List"] ]
match m.searchTerm with match m.searchTerm with
| Some _ -> | Some _ ->
yield rawText " &nbsp; &nbsp; &nbsp; " rawText " &nbsp; &nbsp; &nbsp; "
yield a [ _href "/web/prayer-requests"; _title l.["Clear Search Criteria"].Value ] a [ _href "/web/prayer-requests"; _title l.["Clear Search Criteria"].Value ]
[ icon "highlight_off"; rawText " &nbsp;"; raw l.["Clear Search Criteria"] ] [ icon "highlight_off"; rawText " &nbsp;"; raw l.["Clear Search Criteria"] ]
| None -> () | 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" input [ _type "text"
_name "search" _name "search"
_placeholder l.["Search requests..."].Value _placeholder l.["Search requests..."].Value
@ -243,12 +242,12 @@ let maintain m (ctx : HttpContext) vi =
space space
submit [] "search" s.["Search"] submit [] "search" s.["Search"]
] ]
yield br [] br []
yield tableSummary requests.Length s tableSummary requests.Length s
match requests.Length with match requests.Length with
| 0 -> () | 0 -> ()
| _ -> | _ ->
yield table [ _class "pt-table pt-action-table" ] [ table [ _class "pt-table pt-action-table" ] [
thead [] [ thead [] [
tr [] [ tr [] [
th [] [ locStr s.["Actions"] ] th [] [ locStr s.["Actions"] ]
@ -260,40 +259,41 @@ let maintain m (ctx : HttpContext) vi =
] ]
tbody [] requests tbody [] requests
] ]
yield div [ _class "pt-center-text" ] [ div [ _class "pt-center-text" ] [
yield br [] br []
match m.onlyActive with match m.onlyActive with
| Some true -> | Some true ->
yield raw l.["Inactive requests are currently not shown"] raw l.["Inactive requests are currently not shown"]
yield br [] br []
yield a [ _href "/web/prayer-requests/inactive" ] [ raw l.["Show Inactive Requests"] ] a [ _href "/web/prayer-requests/inactive" ] [ raw l.["Show Inactive Requests"] ]
| _ -> | _ ->
match Option.isSome m.onlyActive with match Option.isSome m.onlyActive with
| true -> | true ->
yield raw l.["Inactive requests are currently shown"] raw l.["Inactive requests are currently shown"]
yield br [] br []
yield a [ _href "/web/prayer-requests" ] [ raw l.["Do Not Show Inactive Requests"] ] a [ _href "/web/prayer-requests" ] [ raw l.["Do Not Show Inactive Requests"] ]
yield br [] br []
yield br [] br []
| false -> () | false -> ()
let srch = [ match m.searchTerm with Some s -> yield "search", s | None -> () ] let srch = [ match m.searchTerm with Some s -> "search", s | None -> () ]
let url = match m.onlyActive with Some true | None -> "" | _ -> "/inactive" |> sprintf "/web/prayer-requests%s"
let pg = defaultArg m.pageNbr 1 let pg = defaultArg m.pageNbr 1
let url =
match m.onlyActive with Some true | None -> "" | _ -> "/inactive" |> sprintf "/web/prayer-requests%s"
match pg with match pg with
| 1 -> () | 1 -> ()
| _ -> | _ ->
// button (_type "submit" :: attrs) [ icon ico; rawText " &nbsp;"; locStr text ] // button (_type "submit" :: attrs) [ icon ico; rawText " &nbsp;"; locStr text ]
let withPage = match pg with 2 -> srch | _ -> ("page", string (pg - 1)) :: srch 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"] ] [ icon "keyboard_arrow_left"; space; raw l.["Previous Page"] ]
yield rawText " &nbsp; &nbsp; " rawText " &nbsp; &nbsp; "
match requests.Length = m.smallGroup.preferences.pageSize with match requests.Length = m.smallGroup.preferences.pageSize with
| true -> | 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" ] [ raw l.["Next Page"]; space; icon "keyboard_arrow_right" ]
| false -> () | false -> ()
] ]
yield form [ _id "DeleteForm"; _action ""; _method "post" ] [ csrfToken ctx ] form [ _id "DeleteForm"; _action ""; _method "post" ] [ csrfToken ctx ]
] ]
|> Layout.Content.wide |> Layout.Content.wide
|> Layout.standard vi (match m.searchTerm with Some _ -> "Search Results" | None -> "Maintain Requests") |> Layout.standard vi (match m.searchTerm with Some _ -> "Search Results" | None -> "Maintain Requests")
@ -327,15 +327,15 @@ let view m vi =
let spacer = rawText " &nbsp; &nbsp; &nbsp; " let spacer = rawText " &nbsp; &nbsp; &nbsp; "
let dtString = m.date.ToString "yyyy-MM-dd" let dtString = m.date.ToString "yyyy-MM-dd"
[ div [ _class "pt-center-text" ] [ [ div [ _class "pt-center-text" ] [
yield br [] br []
yield a [ _class "pt-icon-link" a [ _class "pt-icon-link"
_href (sprintf "/web/prayer-requests/print/%s" dtString) _href (sprintf "/web/prayer-requests/print/%s" dtString)
_title s.["View Printable"].Value ] [ _title s.["View Printable"].Value ] [
icon "print"; rawText " &nbsp;"; locStr s.["View Printable"] icon "print"; rawText " &nbsp;"; locStr s.["View Printable"]
] ]
match m.canEmail with match m.canEmail with
| true -> | true ->
yield spacer spacer
match m.date.DayOfWeek = DayOfWeek.Sunday with match m.date.DayOfWeek = DayOfWeek.Sunday with
| true -> () | true -> ()
| false -> | false ->
@ -344,21 +344,21 @@ let view m vi =
| true -> date | true -> date
| false -> findSunday (date.AddDays 1.) | false -> findSunday (date.AddDays 1.)
let sunday = findSunday m.date let sunday = findSunday m.date
yield a [ _class "pt-icon-link" a [ _class "pt-icon-link"
_href (sprintf "/web/prayer-requests/view/%s" (sunday.ToString "yyyy-MM-dd")) _href (sprintf "/web/prayer-requests/view/%s" (sunday.ToString "yyyy-MM-dd"))
_title s.["List for Next Sunday"].Value ] [ _title s.["List for Next Sunday"].Value ] [
icon "update"; rawText " &nbsp;"; locStr s.["List for Next Sunday"] icon "update"; rawText " &nbsp;"; 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 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" a [ _class "pt-icon-link"
_href (sprintf "/web/prayer-requests/email/%s" dtString) _href (sprintf "/web/prayer-requests/email/%s" dtString)
_title s.["Send via E-mail"].Value _title s.["Send via E-mail"].Value
_onclick (sprintf "return PT.requests.view.promptBeforeEmail('%s')" emailPrompt) ] [ _onclick (sprintf "return PT.requests.view.promptBeforeEmail('%s')" emailPrompt) ] [
icon "mail_outline"; rawText " &nbsp;"; locStr s.["Send via E-mail"] icon "mail_outline"; rawText " &nbsp;"; locStr s.["Send via E-mail"]
] ]
yield spacer spacer
yield a [ _class "pt-icon-link"; _href "/web/prayer-requests"; _title s.["Maintain Prayer Requests"].Value ] [ a [ _class "pt-icon-link"; _href "/web/prayer-requests"; _title s.["Maintain Prayer Requests"].Value ] [
icon "compare_arrows"; rawText " &nbsp;"; locStr s.["Maintain Prayer Requests"] icon "compare_arrows"; rawText " &nbsp;"; locStr s.["Maintain Prayer Requests"]
] ]
| false -> () | false -> ()

View File

@ -12,8 +12,8 @@ let announcement isAdmin ctx vi =
let s = I18N.localizer.Force () let s = I18N.localizer.Force ()
let reqTypes = ReferenceList.requestTypeList s let reqTypes = ReferenceList.requestTypeList s
[ form [ _action "/web/small-group/announcement/send"; _method "post"; _class "pt-center-columns" ] [ [ form [ _action "/web/small-group/announcement/send"; _method "post"; _class "pt-center-columns" ] [
yield csrfToken ctx csrfToken ctx
yield div [ _class "pt-field-row" ] [ div [ _class "pt-field-row" ] [
div [ _class "pt-field pt-editor" ] [ div [ _class "pt-field pt-editor" ] [
label [ _for "text" ] [ locStr s.["Announcement Text"] ] label [ _for "text" ] [ locStr s.["Announcement Text"] ]
textarea [ _name "text"; _id "text"; _autofocus ] [] textarea [ _name "text"; _id "text"; _autofocus ] []
@ -21,7 +21,7 @@ let announcement isAdmin ctx vi =
] ]
match isAdmin with match isAdmin with
| true -> | true ->
yield div [ _class "pt-field-row" ] [ div [ _class "pt-field-row" ] [
div [ _class "pt-field" ] [ div [ _class "pt-field" ] [
label [] [ locStr s.["Send Announcement to"]; rawText ":" ] label [] [ locStr s.["Send Announcement to"]; rawText ":" ]
div [ _class "pt-center-text" ] [ div [ _class "pt-center-text" ] [
@ -32,15 +32,14 @@ let announcement isAdmin ctx vi =
] ]
] ]
] ]
| false -> | false -> input [ _type "hidden"; _name "sendToClass"; _value "Y" ]
yield input [ _type "hidden"; _name "sendToClass"; _value "Y" ] div [ _class "pt-field-row pt-fadeable pt-shown"; _id "divAddToList" ] [
yield div [ _class "pt-field-row pt-fadeable pt-shown"; _id "divAddToList" ] [
div [ _class "pt-checkbox-field" ] [ div [ _class "pt-checkbox-field" ] [
input [ _type "checkbox"; _name "addToRequestList"; _id "addToRequestList"; _value "True" ] input [ _type "checkbox"; _name "addToRequestList"; _id "addToRequestList"; _value "True" ]
label [ _for "addToRequestList" ] [ locStr 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-row pt-fadeable"; _id "divCategory" ] [
div [ _class "pt-field" ] [ div [ _class "pt-field" ] [
label [ _for "requestType" ] [ locStr s.["Request Type"] ] label [ _for "requestType" ] [ locStr s.["Request Type"] ]
reqTypes reqTypes
@ -49,7 +48,7 @@ let announcement isAdmin ctx vi =
|> selectList "requestType" "Announcement" [] |> 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)" ] 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" ] [ div [ _class "pt-field" ] [
label [ _for "churchId" ] [ locStr s.["Church"] ] label [ _for "churchId" ] [ locStr s.["Church"] ]
seq { seq {
yield "", selectDefault s.["Select Church"].Value "", selectDefault s.["Select Church"].Value
yield! churches |> List.map (fun c -> flatGuid c.churchId, c.name) yield! churches |> List.map (fun c -> flatGuid c.churchId, c.name)
} }
|> selectList "churchId" (flatGuid m.churchId) [ _required ] |> selectList "churchId" (flatGuid m.churchId) [ _required ]
@ -144,9 +143,9 @@ let logOn (grps : SmallGroup list) grpId ctx vi =
label [ _for "smallGroupId" ] [ locStr s.["Group"] ] label [ _for "smallGroupId" ] [ locStr s.["Group"] ]
seq { seq {
match grps.Length with 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 yield! grps
|> List.map (fun grp -> flatGuid grp.smallGroupId, sprintf "%s | %s" grp.church.name grp.name) |> 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"] locStr s.["Prayer Requests"]
] ]
div [] [ div [] [
yield p [ _class "pt-center-text" ] [ p [ _class "pt-center-text" ] [
strong [] [ str (m.totalActiveReqs.ToString "N0"); space; locStr s.["Active Requests"] ] strong [] [ str (m.totalActiveReqs.ToString "N0"); space; locStr s.["Active Requests"] ]
] ]
yield hr [] hr []
for cat in m.activeReqsByCat do for cat in m.activeReqsByCat do
yield str (cat.Value.ToString "N0") str (cat.Value.ToString "N0")
yield space space
yield locStr typs.[cat.Key] locStr typs.[cat.Key]
yield br [] br []
yield br [] br []
yield str (m.allReqs.ToString "N0") str (m.allReqs.ToString "N0")
yield space space
yield locStr s.["Total Requests"] locStr s.["Total Requests"]
yield hr [] hr []
yield a [ _href "/web/prayer-requests/maintain" ] [ a [ _href "/web/prayer-requests/maintain" ] [
icon "compare_arrows" icon "compare_arrows"
linkSpacer linkSpacer
locStr s.["Maintain Prayer Requests"] locStr s.["Maintain Prayer Requests"]
@ -406,7 +405,7 @@ let preferences (m : EditPreferences) (tzs : TimeZone list) ctx vi =
div [ _class "pt-field" ] [ div [ _class "pt-field" ] [
label [ _for "defaultEmailType" ] [ locStr s.["E-mail Format"] ] label [ _for "defaultEmailType" ] [ locStr s.["E-mail Format"] ]
seq { seq {
yield "", selectDefault s.["Select"].Value "", selectDefault s.["Select"].Value
yield! ReferenceList.emailTypeList HtmlFormat s yield! ReferenceList.emailTypeList HtmlFormat s
|> Seq.skip 1 |> Seq.skip 1
|> Seq.map (fun typ -> fst typ, (snd typ).Value) |> 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 radio "headingLineType" "headingLineType_Name" "Name" m.headingLineType
label [ _for "headingLineType_Name" ] [ locStr s.["Named Color"] ] label [ _for "headingLineType_Name" ] [ locStr s.["Named Color"] ]
namedColorList "headingLineColor" m.headingLineColor namedColorList "headingLineColor" m.headingLineColor
[ yield _id "headingLineColor_Select" [ _id "headingLineColor_Select"
match m.headingLineColor.StartsWith "#" with true -> yield _disabled | false -> () ] s match m.headingLineColor.StartsWith "#" with true -> _disabled | false -> () ] s
rawText "&nbsp; &nbsp; "; str (s.["or"].Value.ToUpper ()) rawText "&nbsp; &nbsp; "; str (s.["or"].Value.ToUpper ())
radio "headingLineType" "headingLineType_RGB" "RGB" m.headingLineType radio "headingLineType" "headingLineType_RGB" "RGB" m.headingLineType
label [ _for "headingLineType_RGB" ] [ locStr s.["Custom Color"] ] label [ _for "headingLineType_RGB" ] [ locStr s.["Custom Color"] ]
input [ yield _type "color" input [ _type "color"
yield _name "headingLineColor" _name "headingLineColor"
yield _id "headingLineColor_Color" _id "headingLineColor_Color"
yield _value m.headingLineColor _value m.headingLineColor
match m.headingLineColor.StartsWith "#" with true -> () | false -> yield _disabled ] 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 radio "headingTextType" "headingTextType_Name" "Name" m.headingTextType
label [ _for "headingTextType_Name" ] [ locStr s.["Named Color"] ] label [ _for "headingTextType_Name" ] [ locStr s.["Named Color"] ]
namedColorList "headingTextColor" m.headingTextColor namedColorList "headingTextColor" m.headingTextColor
[ yield _id "headingTextColor_Select" [ _id "headingTextColor_Select"
match m.headingTextColor.StartsWith "#" with true -> yield _disabled | false -> () ] s match m.headingTextColor.StartsWith "#" with true -> _disabled | false -> () ] s
rawText "&nbsp; &nbsp; "; str (s.["or"].Value.ToUpper ()) rawText "&nbsp; &nbsp; "; str (s.["or"].Value.ToUpper ())
radio "headingTextType" "headingTextType_RGB" "RGB" m.headingTextType radio "headingTextType" "headingTextType_RGB" "RGB" m.headingTextType
label [ _for "headingTextType_RGB" ] [ locStr s.["Custom Color"] ] label [ _for "headingTextType_RGB" ] [ locStr s.["Custom Color"] ]
input [ yield _type "color" input [ _type "color"
yield _name "headingTextColor" _name "headingTextColor"
yield _id "headingTextColor_Color" _id "headingTextColor_Color"
yield _value m.headingTextColor _value m.headingTextColor
match m.headingTextColor.StartsWith "#" with true -> () | false -> yield _disabled ] 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" ] [ div [ _class "pt-field" ] [
label [ _for "timeZone" ] [ locStr s.["Time Zone"] ] label [ _for "timeZone" ] [ locStr s.["Time Zone"] ]
seq { seq {
yield "", selectDefault s.["Select"].Value "", selectDefault s.["Select"].Value
yield! tzs |> List.map (fun tz -> tz.timeZoneId, (TimeZones.name tz.timeZoneId s).Value) yield! tzs |> List.map (fun tz -> tz.timeZoneId, (TimeZones.name tz.timeZoneId s).Value)
} }
|> selectList "timeZone" m.timeZone [ _required ] |> 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"] ] label [ _for "viz_Password" ] [ locStr s.["Password Protected"] ]
] ]
] ]
div [ yield _id "divClassPassword" div [ _id "divClassPassword"
match m.listVisibility = RequestVisibility.passwordProtected with match m.listVisibility = RequestVisibility.passwordProtected with
| true -> yield _class "pt-field-row pt-fadeable pt-show" | true -> _class "pt-field-row pt-fadeable pt-show"
| false -> yield _class "pt-field-row pt-fadeable" | false -> _class "pt-field-row pt-fadeable"
] [ ] [
div [ _class "pt-field" ] [ div [ _class "pt-field" ] [
label [ _for "groupPassword" ] [ locStr s.["Group Password (Used to Read Online)"] ] label [ _for "groupPassword" ] [ locStr s.["Group Password (Used to Read Online)"] ]

View File

@ -24,11 +24,11 @@ let assignGroups m groups curGroups ctx vi =
let inputId = sprintf "id-%s" grpId let inputId = sprintf "id-%s" grpId
tr [] [ tr [] [
td [] [ td [] [
input [ yield _type "checkbox" input [ _type "checkbox"
yield _name "smallGroups" _name "smallGroups"
yield _id inputId _id inputId
yield _value grpId _value grpId
match curGroups |> List.contains grpId with true -> yield _checked | false -> () ] match curGroups |> List.contains grpId with true -> _checked | false -> () ]
] ]
td [] [ label [ _for inputId ] [ str grpName ] ] td [] [ label [ _for inputId ] [ str grpName ] ]
]) ])
@ -114,11 +114,11 @@ let edit (m : EditUser) ctx vi =
] ]
] ]
div [ _class "pt-checkbox-field" ] [ div [ _class "pt-checkbox-field" ] [
input [ yield _type "checkbox" input [ _type "checkbox"
yield _name "isAdmin" _name "isAdmin"
yield _id "isAdmin" _id "isAdmin"
yield _value "True" _value "True"
match m.isAdmin with Some x when x -> yield _checked | _ -> () ] match m.isAdmin with Some x when x -> _checked | _ -> () ]
label [ _for "isAdmin" ] [ locStr 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"] ] 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" ] [ div [ _class "pt-field" ] [
label [ _for "smallGroupId" ] [ locStr s.["Group"] ] label [ _for "smallGroupId" ] [ locStr s.["Group"] ]
seq { seq {
yield "", selectDefault s.["Select Group"].Value "", selectDefault s.["Select Group"].Value
yield! groups yield! groups
} }
|> selectList "smallGroupId" "" [ _required ] |> selectList "smallGroupId" "" [ _required ]
@ -205,8 +205,8 @@ let maintain (users : User list) ctx vi =
td [] [ str user.fullName ] td [] [ str user.fullName ]
td [ _class "pt-center-text" ] [ td [ _class "pt-center-text" ] [
match user.isAdmin with match user.isAdmin with
| true -> yield strong [] [ locStr s.["Yes"] ] | true -> strong [] [ locStr s.["Yes"] ]
| false -> yield locStr s.["No"] | false -> locStr s.["No"]
] ]
]) ])
|> tbody [] |> tbody []

View File

@ -30,17 +30,15 @@ module String =
/// string.Replace() /// string.Replace()
let replace (find : string) repl (str : string) = str.Replace (find, repl) 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 /// Replace the first occurrence of a string with a second string within a given string
let replaceFirst (needle : string) replacement (haystack : string) = let replaceFirst (needle : string) replacement (haystack : string) =
match haystack.IndexOf needle with match haystack.IndexOf needle with
| -1 -> haystack | -1 -> haystack
| idx -> | idx ->
seq { [ haystack.[0..idx - 1]
yield haystack.[0..idx - 1] replacement
yield replacement haystack.[idx + needle.Length..]
yield haystack.[idx + needle.Length..] ]
}
|> String.concat "" |> String.concat ""

View File

@ -25,16 +25,16 @@ module ReferenceList =
| HtmlFormat -> s.["HTML Format"].Value | HtmlFormat -> s.["HTML Format"].Value
| PlainTextFormat -> s.["Plain-Text Format"].Value | PlainTextFormat -> s.["Plain-Text Format"].Value
seq { seq {
yield "", LocalizedString ("", sprintf "%s (%s)" s.["Group Default"].Value defaultType) "", LocalizedString ("", sprintf "%s (%s)" s.["Group Default"].Value defaultType)
yield HtmlFormat.code, s.["HTML Format"] HtmlFormat.code, s.["HTML Format"]
yield PlainTextFormat.code, s.["Plain-Text Format"] PlainTextFormat.code, s.["Plain-Text Format"]
} }
/// A list of expiration options /// A list of expiration options
let expirationList (s : IStringLocalizer) includeExpireNow = let expirationList (s : IStringLocalizer) includeExpireNow =
[ yield Automatic.code, s.["Expire Normally"] [ Automatic.code, s.["Expire Normally"]
yield Manual.code, s.["Request Never Expires"] Manual.code, s.["Request Never Expires"]
match includeExpireNow with true -> yield Forced.code, s.["Expire Immediately"] | false -> () match includeExpireNow with true -> Forced.code, s.["Expire Immediately"] | false -> ()
] ]
/// A list of request types /// A list of request types
@ -583,7 +583,7 @@ with
let asOfSize = Math.Round (float prefs.textFontSize * 0.8, 2) let asOfSize = Math.Round (float prefs.textFontSize * 0.8, 2)
[ match this.showHeader with [ match this.showHeader with
| true -> | 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) ] [ span [ _style (sprintf "font-size:%ipt;" prefs.headingFontSize) ] [
strong [] [ str s.["Prayer Requests"].Value ] strong [] [ str s.["Prayer Requests"].Value ]
] ]
@ -594,7 +594,7 @@ with
str (this.date.ToString s.["MMMM d, yyyy"].Value) str (this.date.ToString s.["MMMM d, yyyy"].Value)
] ]
] ]
yield br [] br []
| false -> () | false -> ()
let typs = ReferenceList.requestTypeList s let typs = ReferenceList.requestTypeList s
for cat in 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 |> Seq.filter (fun c -> 0 < (this.requests |> List.filter (fun req -> req.requestType = c) |> List.length)) do
let reqs = this.requestsInCategory cat let reqs = this.requestsInCategory cat
let catName = typs |> List.filter (fun t -> fst t = cat) |> List.head |> snd 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) ] [ table [ _style (sprintf "font-family:%s;page-break-inside:avoid;" prefs.listFonts) ] [
tr [] [ 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;" 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,7 +614,6 @@ with
] ]
] ]
] ]
yield
reqs reqs
|> List.map (fun req -> |> List.map (fun req ->
let bullet = match this.isNew req with true -> "circle" | false -> "disc" let bullet = match this.isNew req with true -> "circle" | false -> "disc"
@ -622,11 +621,11 @@ with
bullet prefs.listFonts prefs.textFontSize) ] [ bullet prefs.listFonts prefs.textFontSize) ] [
match req.requestor with match req.requestor with
| Some rqstr when rqstr <> "" -> | Some rqstr when rqstr <> "" ->
yield strong [] [ str rqstr ] strong [] [ str rqstr ]
yield rawText " &mdash; " rawText " &mdash; "
| Some _ -> () | Some _ -> ()
| None -> () | None -> ()
yield rawText req.text rawText req.text
match prefs.asOfDateDisplay with match prefs.asOfDateDisplay with
| NoDisplay -> () | NoDisplay -> ()
| ShortDate | ShortDate
@ -636,22 +635,22 @@ with
| ShortDate -> req.updatedDate.ToShortDateString () | ShortDate -> req.updatedDate.ToShortDateString ()
| LongDate -> req.updatedDate.ToLongDateString () | LongDate -> req.updatedDate.ToLongDateString ()
| _ -> "" | _ -> ""
yield i [ _style (sprintf "font-size:%.2fpt" asOfSize) ] [ i [ _style (sprintf "font-size:%.2fpt" asOfSize) ] [
rawText "&nbsp; ("; str s.["as of"].Value; str " "; str dt; rawText ")" rawText "&nbsp; ("; str s.["as of"].Value; str " "; str dt; rawText ")"
] ]
]) ])
|> ul [] |> ul []
yield br [] br []
] ]
|> renderHtmlNodes |> renderHtmlNodes
/// Generate this list as plain text /// Generate this list as plain text
member this.asText (s : IStringLocalizer) = member this.asText (s : IStringLocalizer) =
seq { seq {
yield this.listGroup.name this.listGroup.name
yield s.["Prayer Requests"].Value s.["Prayer Requests"].Value
yield this.date.ToString s.["MMMM d, yyyy"].Value this.date.ToString s.["MMMM d, yyyy"].Value
yield " " " "
let typs = ReferenceList.requestTypeList s let typs = ReferenceList.requestTypeList s
for cat in for cat in
typs typs
@ -661,13 +660,12 @@ with
let reqs = this.requestsInCategory cat let reqs = this.requestsInCategory cat
let typ = (typs |> List.filter (fun t -> fst t = cat) |> List.head |> snd).Value let typ = (typs |> List.filter (fun t -> fst t = cat) |> List.head |> snd).Value
let dashes = String.replicate (typ.Length + 4) "-" let dashes = String.replicate (typ.Length + 4) "-"
yield dashes dashes
yield sprintf @" %s" (typ.ToUpper ()) sprintf @" %s" (typ.ToUpper ())
yield dashes dashes
for req in reqs do for req in reqs do
let bullet = match this.isNew req with true -> "+" | false -> "-" let bullet = match this.isNew req with true -> "+" | false -> "-"
let requestor = match req.requestor with Some r -> sprintf "%s - " r | None -> "" let requestor = match req.requestor with Some r -> sprintf "%s - " r | None -> ""
yield
match this.listGroup.preferences.asOfDateDisplay with match this.listGroup.preferences.asOfDateDisplay with
| NoDisplay -> "" | NoDisplay -> ""
| _ -> | _ ->
@ -678,7 +676,7 @@ with
| _ -> "" | _ -> ""
sprintf " (%s %s)" s.["as of"].Value dt sprintf " (%s %s)" s.["as of"].Value dt
|> sprintf " %s %s%s%s" bullet requestor (htmlToPlainText req.text) |> sprintf " %s %s%s%s" bullet requestor (htmlToPlainText req.text)
yield " " " "
} }
|> String.concat "\n" |> String.concat "\n"
|> wordWrap 74 |> wordWrap 74

View File

@ -44,12 +44,12 @@ let appVersion =
sprintf "v%A" v sprintf "v%A" v
#else #else
seq { seq {
yield sprintf "v%d" v.Major sprintf "v%d" v.Major
match v.Minor with 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 sprintf ".%d" v.Minor
match v.Build with 0 -> () | _ -> yield sprintf ".%d" v.Build match v.Build with 0 -> () | _ -> sprintf ".%d" v.Build
} }
|> String.concat "" |> String.concat ""
#endif #endif