Search, Paging, and "As of" Date #10

Merged
danieljsummers merged 15 commits from search into master 2019-03-21 00:19:02 +00:00
3 changed files with 20 additions and 4 deletions
Showing only changes of commit c9dca517b0 - Show all commits

View File

@ -206,7 +206,7 @@ let maintain (reqs : PrayerRequest seq) (grp : SmallGroup) onlyActive (ctx : Htt
yield yield
match 60 > reqText.Length with match 60 > reqText.Length with
| true -> rawText reqText | true -> rawText reqText
| false -> rawText (sprintf "%s…" (reqText.Substring (0, 60))) | false -> rawText (sprintf "%s…" reqText.[0..59])
] ]
]) ])
|> List.ofSeq |> List.ofSeq
@ -217,9 +217,13 @@ let maintain (reqs : PrayerRequest seq) (grp : SmallGroup) onlyActive (ctx : Htt
rawText "       " rawText "       "
a [ _href "/prayer-requests/view"; _title s.["View Prayer Request List"].Value ] a [ _href "/prayer-requests/view"; _title s.["View Prayer Request List"].Value ]
[ icon "list"; rawText "  "; encLocText s.["View Prayer Request List"] ] [ icon "list"; rawText "  "; encLocText s.["View Prayer Request List"] ]
br []
br []
] ]
form [ _action "/prayer-requests"; _method "get"; _class "pt-center-text pt-search-form" ] [
input [ _type "text"; _name "search"; _placeholder s.["Search requests..."].Value ]
space
submit [] "search" s.["Search"]
]
br []
tableSummary requests.Length s tableSummary requests.Length s
table [ _class "pt-table pt-action-table" ] [ table [ _class "pt-table pt-action-table" ] [
thead [] [ thead [] [

View File

@ -190,6 +190,8 @@ let lists : HttpHandler =
/// GET /prayer-requests[/inactive?] /// GET /prayer-requests[/inactive?]
/// - OR -
/// GET /prayer-requests?search=[search-query]
let maintain onlyActive : HttpHandler = let maintain onlyActive : HttpHandler =
requireAccess [ User ] requireAccess [ User ]
>=> fun next ctx -> >=> fun next ctx ->
@ -197,7 +199,11 @@ let maintain onlyActive : HttpHandler =
let db = ctx.dbContext () let db = ctx.dbContext ()
let grp = currentGroup ctx let grp = currentGroup ctx
task { task {
let reqs = db.AllRequestsForSmallGroup grp (ctx.GetService<IClock> ()) None onlyActive let reqs =
match ctx.GetQueryStringValue "search" with
| Ok srch ->
Seq.empty
| Error _ -> db.AllRequestsForSmallGroup grp (ctx.GetService<IClock> ()) None onlyActive
return! return!
{ viewInfo ctx startTicks with helpLink = Some Help.maintainRequests } { viewInfo ctx startTicks with helpLink = Some Help.maintainRequests }
|> Views.PrayerRequest.maintain reqs grp onlyActive ctx |> Views.PrayerRequest.maintain reqs grp onlyActive ctx

View File

@ -369,6 +369,12 @@ article.pt-overview section div p {
border-radius: 5px; border-radius: 5px;
margin: auto; margin: auto;
} }
.pt-search-form input,
.pt-search-form button,
.pt-search-form i.material-icons {
font-size: .8rem;
}
.pt-request-update { .pt-request-update {
font-style: italic; font-style: italic;
} }