Remove yield not required by F# 4.7

This commit is contained in:
Daniel J. Summers
2019-09-23 20:40:47 -05:00
parent 4dbd58fb92
commit bf48c360de
10 changed files with 252 additions and 261 deletions

View File

@@ -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&hellip;" 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 " &nbsp;"; locStr s.["Add a New Request"] ]
yield rawText " &nbsp; &nbsp; &nbsp; "
yield a [ _href "/web/prayer-requests/view"; _title s.["View Prayer Request List"].Value ]
rawText " &nbsp; &nbsp; &nbsp; "
a [ _href "/web/prayer-requests/view"; _title s.["View Prayer Request List"].Value ]
[ icon "list"; rawText " &nbsp;"; locStr s.["View Prayer Request List"] ]
match m.searchTerm with
| Some _ ->
yield rawText " &nbsp; &nbsp; &nbsp; "
yield a [ _href "/web/prayer-requests"; _title l.["Clear Search Criteria"].Value ]
rawText " &nbsp; &nbsp; &nbsp; "
a [ _href "/web/prayer-requests"; _title l.["Clear Search Criteria"].Value ]
[ icon "highlight_off"; rawText " &nbsp;"; 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 " &nbsp;"; 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 " &nbsp; &nbsp; "
rawText " &nbsp; &nbsp; "
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 " &nbsp; &nbsp; &nbsp; "
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 " &nbsp;"; 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 " &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
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 " &nbsp;"; 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 " &nbsp;"; locStr s.["Maintain Prayer Requests"]
]
| false -> ()