From c9dca517b07ec28f31d5ef730ab17e17a018921c Mon Sep 17 00:00:00 2001 From: "Daniel J. Summers" Date: Mon, 11 Mar 2019 06:08:12 -0500 Subject: [PATCH] WIP on search --- src/PrayerTracker.UI/PrayerRequest.fs | 10 +++++++--- src/PrayerTracker/PrayerRequest.fs | 8 +++++++- src/PrayerTracker/wwwroot/css/app.css | 6 ++++++ 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/src/PrayerTracker.UI/PrayerRequest.fs b/src/PrayerTracker.UI/PrayerRequest.fs index e3a7601..ddb3c35 100644 --- a/src/PrayerTracker.UI/PrayerRequest.fs +++ b/src/PrayerTracker.UI/PrayerRequest.fs @@ -206,7 +206,7 @@ let maintain (reqs : PrayerRequest seq) (grp : SmallGroup) onlyActive (ctx : Htt yield match 60 > reqText.Length with | true -> rawText reqText - | false -> rawText (sprintf "%s…" (reqText.Substring (0, 60))) + | false -> rawText (sprintf "%s…" reqText.[0..59]) ] ]) |> List.ofSeq @@ -217,9 +217,13 @@ let maintain (reqs : PrayerRequest seq) (grp : SmallGroup) onlyActive (ctx : Htt rawText "       " a [ _href "/prayer-requests/view"; _title s.["View Prayer Request List"].Value ] [ 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 table [ _class "pt-table pt-action-table" ] [ thead [] [ diff --git a/src/PrayerTracker/PrayerRequest.fs b/src/PrayerTracker/PrayerRequest.fs index fc17e56..fea0722 100644 --- a/src/PrayerTracker/PrayerRequest.fs +++ b/src/PrayerTracker/PrayerRequest.fs @@ -190,6 +190,8 @@ let lists : HttpHandler = /// GET /prayer-requests[/inactive?] +/// - OR - +/// GET /prayer-requests?search=[search-query] let maintain onlyActive : HttpHandler = requireAccess [ User ] >=> fun next ctx -> @@ -197,7 +199,11 @@ let maintain onlyActive : HttpHandler = let db = ctx.dbContext () let grp = currentGroup ctx task { - let reqs = db.AllRequestsForSmallGroup grp (ctx.GetService ()) None onlyActive + let reqs = + match ctx.GetQueryStringValue "search" with + | Ok srch -> + Seq.empty + | Error _ -> db.AllRequestsForSmallGroup grp (ctx.GetService ()) None onlyActive return! { viewInfo ctx startTicks with helpLink = Some Help.maintainRequests } |> Views.PrayerRequest.maintain reqs grp onlyActive ctx diff --git a/src/PrayerTracker/wwwroot/css/app.css b/src/PrayerTracker/wwwroot/css/app.css index 0134b44..dfed2dd 100644 --- a/src/PrayerTracker/wwwroot/css/app.css +++ b/src/PrayerTracker/wwwroot/css/app.css @@ -369,6 +369,12 @@ article.pt-overview section div p { border-radius: 5px; margin: auto; } +.pt-search-form input, +.pt-search-form button, +.pt-search-form i.material-icons { + font-size: .8rem; +} + .pt-request-update { font-style: italic; }