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

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

View File

@ -61,7 +61,6 @@ with
| LongDate -> "L" | LongDate -> "L"
[<AutoOpen>]
module Converters = module Converters =
open Microsoft.EntityFrameworkCore.Storage.ValueConversion open Microsoft.EntityFrameworkCore.Storage.ValueConversion
open Microsoft.FSharp.Linq.RuntimeHelpers open Microsoft.FSharp.Linq.RuntimeHelpers
@ -325,7 +324,7 @@ and [<CLIMutable; NoComparison; NoEquality>] ListPreferences =
|> ignore) |> ignore)
|> ignore |> ignore
mb.Model.FindEntityType(typeof<ListPreferences>).FindProperty("asOfDateDisplay") mb.Model.FindEntityType(typeof<ListPreferences>).FindProperty("asOfDateDisplay")
.SetValueConverter(AsOfDateDisplayConverter ()) .SetValueConverter(Converters.AsOfDateDisplayConverter ())
/// A member of a small group /// A member of a small group

View File

@ -798,10 +798,25 @@
<data name="Search" xml:space="preserve"> <data name="Search" xml:space="preserve">
<value>Buscar</value> <value>Buscar</value>
</data> </data>
<data name="Display a full “as of” date" xml:space="preserve">
<value>Mostrar una fecha “como de” completa</value>
</data>
<data name="Display a short “as of” date" xml:space="preserve">
<value>Mostrar una fecha “como de” corta</value>
</data>
<data name="Do not display the “as of” date" xml:space="preserve">
<value>No se muestran la fecha “como de”</value>
</data>
<data name="Page Size" xml:space="preserve">
<value>Tamaño de Página</value>
</data>
<data name="Prayer Request" xml:space="preserve"> <data name="Prayer Request" xml:space="preserve">
<value>Petición de Oración</value> <value>Petición de Oración</value>
</data> </data>
<data name="Search Results" xml:space="preserve"> <data name="Search Results" xml:space="preserve">
<value>Resultados de la Búsqueda</value> <value>Resultados de la Búsqueda</value>
</data> </data>
<data name="“As of” Date Display" xml:space="preserve">
<value>Visualización de la Fecha “Como de”</value>
</data>
</root> </root>

View File

@ -284,7 +284,7 @@ let members (mbrs : Member list) (emailTyps : Map<string, LocalizedString>) ctx
let overview m vi = let overview m vi =
let s = I18N.localizer.Force () let s = I18N.localizer.Force ()
let linkSpacer = rawText "&nbsp; " let linkSpacer = rawText "&nbsp; "
let typs = ReferenceList.requestTypeList s |> Map.ofList let typs = ReferenceList.requestTypeList s |> dict
article [ _class "pt-overview" ] [ article [ _class "pt-overview" ] [
section [] [ section [] [
header [ _role "heading" ] [ header [ _role "heading" ] [
@ -350,7 +350,7 @@ let preferences (m : EditPreferences) (tzs : TimeZone list) ctx vi =
use sw = new StringWriter () use sw = new StringWriter ()
let raw = rawLocText sw let raw = rawLocText sw
[ form [ _action "/small-group/preferences/save"; _method "post"; _class "pt-center-columns" ] [ [ form [ _action "/small-group/preferences/save"; _method "post"; _class "pt-center-columns" ] [
style [ _scoped ] [ rawText "#expireDays, #daysToKeepNew, #longTermUpdateWeeks, #headingFontSize, #listFontSize { width: 3rem; } #emailFromAddress { width: 20rem; } #listFonts { width: 40rem; } @media screen and (max-width: 40rem) { #listFonts { width: 100%; } }" ] style [ _scoped ] [ rawText "#expireDays, #daysToKeepNew, #longTermUpdateWeeks, #headingFontSize, #listFontSize, #pageSize { width: 3rem; } #emailFromAddress { width: 20rem; } #listFonts { width: 40rem; } @media screen and (max-width: 40rem) { #listFonts { width: 100%; } }" ]
csrfToken ctx csrfToken ctx
fieldset [] [ fieldset [] [
legend [] [ strong [] [ icon "date_range"; rawText " &nbsp;"; locStr s.["Dates"] ] ] legend [] [ strong [] [ icon "date_range"; rawText " &nbsp;"; locStr s.["Dates"] ] ]
@ -479,7 +479,7 @@ let preferences (m : EditPreferences) (tzs : TimeZone list) ctx vi =
legend [] [ strong [] [ icon "settings"; rawText " &nbsp;"; locStr s.["Other Settings"] ] ] legend [] [ strong [] [ icon "settings"; rawText " &nbsp;"; locStr s.["Other Settings"] ] ]
div [ _class "pt-field-row" ] [ div [ _class "pt-field-row" ] [
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 yield "", 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)
@ -511,6 +511,19 @@ let preferences (m : EditPreferences) (tzs : TimeZone list) ctx vi =
_value (match m.groupPassword with Some x -> x | None -> "") ] _value (match m.groupPassword with Some x -> x | None -> "") ]
] ]
] ]
div [ _class "pt-field-row" ] [
div [ _class "pt-field" ] [
label [ _for "pageSize" ] [ locStr s.["Page Size"] ]
input [ _type "number"; _name "pageSize"; _id "pageSize"; _min "10"; _max "255"; _required
_value (string m.pageSize) ]
]
div [ _class "pt-field" ] [
label [ _for "asOfDate" ] [ locStr s.["“As of” Date Display"] ]
ReferenceList.asOfDateList s
|> List.map (fun (code, desc) -> code, desc.Value)
|> selectList "asOfDate" m.asOfDate [ _required ]
]
]
div [ _class "pt-field-row" ] [ submit [] "save" s.["Save Preferences"] ] div [ _class "pt-field-row" ] [ submit [] "save" s.["Save Preferences"] ]
] ]
] ]

View File

@ -10,6 +10,13 @@ open System
/// Helper module to return localized reference lists /// Helper module to return localized reference lists
module ReferenceList = module ReferenceList =
/// A localized list of the AsOfDateDisplay DU cases
let asOfDateList (s : IStringLocalizer) =
[ NoDisplay.toCode (), s.["Do not display the “as of” date"]
ShortDate.toCode (), s.["Display a short “as of” date"]
LongDate.toCode (), s.["Display a full “as of” date"]
]
/// A list of e-mail type options /// A list of e-mail type options
let emailTypeList def (s : IStringLocalizer) = let emailTypeList def (s : IStringLocalizer) =
// Localize the default type // Localize the default type
@ -27,12 +34,10 @@ module ReferenceList =
/// A list of expiration options /// A list of expiration options
let expirationList (s : IStringLocalizer) includeExpireNow = let expirationList (s : IStringLocalizer) includeExpireNow =
seq { [ yield "N", s.["Expire Normally"]
yield "N", s.["Expire Normally"]
yield "Y", s.["Request Never Expires"] yield "Y", s.["Request Never Expires"]
match includeExpireNow with true -> yield "X", s.["Expire Immediately"] | false -> () match includeExpireNow with true -> yield "X", s.["Expire Immediately"] | false -> ()
} ]
|> List.ofSeq
/// A list of request types /// A list of request types
let requestTypeList (s : IStringLocalizer) = let requestTypeList (s : IStringLocalizer) =
@ -273,6 +278,10 @@ type EditPreferences =
listVisibility : int listVisibility : int
/// The small group password /// The small group password
groupPassword : string option groupPassword : string option
/// The page size for search / inactive requests
pageSize : int
/// How the as-of date should be displayed
asOfDate : string
} }
with with
static member fromPreferences (prefs : ListPreferences) = static member fromPreferences (prefs : ListPreferences) =
@ -293,6 +302,8 @@ with
listFontSize = prefs.textFontSize listFontSize = prefs.textFontSize
timeZone = prefs.timeZoneId timeZone = prefs.timeZoneId
groupPassword = Some prefs.groupPassword groupPassword = Some prefs.groupPassword
pageSize = prefs.pageSize
asOfDate = prefs.asOfDateDisplay.toCode ()
listVisibility = listVisibility =
match true with match true with
| _ when prefs.isPublic -> RequestVisibility.``public`` | _ when prefs.isPublic -> RequestVisibility.``public``
@ -323,6 +334,8 @@ with
timeZoneId = this.timeZone timeZoneId = this.timeZone
isPublic = isPublic isPublic = isPublic
groupPassword = grpPw groupPassword = grpPw
pageSize = this.pageSize
asOfDateDisplay = AsOfDateDisplay.fromCode this.asOfDate
} }