Compare commits
26 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 733a730591 | |||
| 0c1285eaa7 | |||
| c9ccfe8b68 | |||
| 2e5a1426f6 | |||
| 05394b4461 | |||
| 14b0a58d98 | |||
| bade89dd37 | |||
| 26f408bb54 | |||
| 9d71177352 | |||
| 2b5ec692f2 | |||
| d86249c18e | |||
| 194cd2b5cc | |||
| 42e3a58131 | |||
| facc294d66 | |||
| 5240b78487 | |||
| 7fb1eca2a3 | |||
| ae8cf9ad80 | |||
| bb79b38738 | |||
| fdb8f2ebf1 | |||
| 0f9837c257 | |||
| 51ad71074c | |||
| 377e19ca78 | |||
| 259cc91a11 | |||
| 131012b320 | |||
|
|
cd41aef0ba | ||
|
|
8aa3e41f50 |
@@ -3,10 +3,11 @@
|
|||||||
"isRoot": true,
|
"isRoot": true,
|
||||||
"tools": {
|
"tools": {
|
||||||
"fake-cli": {
|
"fake-cli": {
|
||||||
"version": "5.23.0",
|
"version": "6.1.3",
|
||||||
"commands": [
|
"commands": [
|
||||||
"fake"
|
"fake"
|
||||||
]
|
],
|
||||||
|
"rollForward": false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,44 +1,50 @@
|
|||||||
#r "paket:
|
open Fake.Core
|
||||||
nuget Fake.DotNet.Cli
|
open Fake.DotNet
|
||||||
nuget Fake.DotNet.Testing.Expecto
|
open Fake.IO
|
||||||
nuget Fake.IO.FileSystem
|
open Fake.IO.Globbing.Operators
|
||||||
nuget Fake.Core.Target //"
|
|
||||||
#load ".fake/build.fsx/intellisense.fsx"
|
let execContext = Context.FakeExecutionContext.Create false "build.fsx" []
|
||||||
open Fake.Core
|
Context.setExecutionContext (Context.RuntimeContext.Fake execContext)
|
||||||
open Fake.DotNet
|
|
||||||
open Fake.DotNet.Testing
|
/// The root path to the projects within this solution
|
||||||
open Fake.IO
|
let projPath = "src"
|
||||||
open Fake.IO.Globbing.Operators
|
|
||||||
open Fake.Core.TargetOperators
|
Target.create "Clean" (fun _ ->
|
||||||
|
!! "src/**/bin"
|
||||||
Target.initEnvironment ()
|
++ "src/**/obj"
|
||||||
|
|> Shell.cleanDirs
|
||||||
/// The root path to the projects within this solution
|
)
|
||||||
let projPath = "src/PrayerTracker"
|
|
||||||
|
Target.create "Test" (fun _ ->
|
||||||
Target.create "Clean" (fun _ ->
|
let testPath = $"{projPath}/Tests"
|
||||||
!! "src/**/bin"
|
DotNet.build (fun opts -> { opts with NoLogo = true }) $"{testPath}/PrayerTracker.Tests.fsproj"
|
||||||
++ "src/**/obj"
|
Testing.Expecto.run
|
||||||
|> Shell.cleanDirs
|
(fun opts -> { opts with WorkingDirectory = $"{testPath}/bin/Release/net9.0" })
|
||||||
)
|
[ "PrayerTracker.Tests.dll" ])
|
||||||
|
|
||||||
Target.create "Test" (fun _ ->
|
Target.create "Publish" (fun _ ->
|
||||||
let testPath = $"{projPath}.Tests"
|
DotNet.publish
|
||||||
DotNet.build (fun opts -> { opts with NoLogo = true }) $"{testPath}/PrayerTracker.Tests.fsproj"
|
(fun opts -> { opts with Runtime = Some "linux-x64"; SelfContained = Some false; NoLogo = true })
|
||||||
Expecto.run
|
$"{projPath}/PrayerTracker/PrayerTracker.fsproj")
|
||||||
(fun opts -> { opts with WorkingDirectory = $"{testPath}/bin/Release/net7.0" })
|
|
||||||
[ "PrayerTracker.Tests.dll" ])
|
Target.create "All" ignore
|
||||||
|
|
||||||
Target.create "Publish" (fun _ ->
|
open Fake.Core.TargetOperators
|
||||||
DotNet.publish
|
|
||||||
(fun opts -> { opts with Runtime = Some "linux-x64"; SelfContained = Some false; NoLogo = true })
|
let dependencies = [
|
||||||
$"{projPath}/PrayerTracker.fsproj")
|
"Clean"
|
||||||
|
==> "Test"
|
||||||
Target.create "All" ignore
|
==> "Publish"
|
||||||
|
==> "All"
|
||||||
"Clean"
|
]
|
||||||
==> "Test"
|
|
||||||
==> "Publish"
|
[<EntryPoint>]
|
||||||
==> "All"
|
let main args =
|
||||||
|
try
|
||||||
Target.runOrDefault "All"
|
match args with
|
||||||
|
| [| target |] -> Target.runOrDefault target
|
||||||
|
| _ -> Target.runOrDefault "All"
|
||||||
|
0
|
||||||
|
with e ->
|
||||||
|
printfn "%A" e
|
||||||
|
1
|
||||||
19
build.fsproj
Normal file
19
build.fsproj
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<OutputType>Exe</OutputType>
|
||||||
|
<TargetFramework>net9.0</TargetFramework>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Include="build.fs" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Fake.Core.Target" Version="6.1.3" />
|
||||||
|
<PackageReference Include="Fake.DotNet.Cli" Version="6.1.3" />
|
||||||
|
<PackageReference Include="Fake.Dotnet.Testing.Expecto" Version="6.1.3" />
|
||||||
|
<PackageReference Include="MSBuild.StructuredLogger" Version="2.2.386" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
233
build.fsx.lock
233
build.fsx.lock
@@ -1,233 +0,0 @@
|
|||||||
STORAGE: NONE
|
|
||||||
RESTRICTION: || (== net6.0) (== netstandard2.0)
|
|
||||||
NUGET
|
|
||||||
remote: https://api.nuget.org/v3/index.json
|
|
||||||
BlackFox.VsWhere (1.1)
|
|
||||||
FSharp.Core (>= 4.2.3)
|
|
||||||
Microsoft.Win32.Registry (>= 4.7)
|
|
||||||
Fake.Core.CommandLineParsing (5.23)
|
|
||||||
FParsec (>= 1.1.1)
|
|
||||||
FSharp.Core (>= 6.0)
|
|
||||||
Fake.Core.Context (5.23)
|
|
||||||
FSharp.Core (>= 6.0)
|
|
||||||
Fake.Core.Environment (5.23)
|
|
||||||
FSharp.Core (>= 6.0)
|
|
||||||
Fake.Core.FakeVar (5.23)
|
|
||||||
Fake.Core.Context (>= 5.23)
|
|
||||||
FSharp.Core (>= 6.0)
|
|
||||||
Fake.Core.Process (5.23)
|
|
||||||
Fake.Core.Environment (>= 5.23)
|
|
||||||
Fake.Core.FakeVar (>= 5.23)
|
|
||||||
Fake.Core.String (>= 5.23)
|
|
||||||
Fake.Core.Trace (>= 5.23)
|
|
||||||
Fake.IO.FileSystem (>= 5.23)
|
|
||||||
FSharp.Core (>= 6.0)
|
|
||||||
System.Collections.Immutable (>= 5.0)
|
|
||||||
Fake.Core.SemVer (5.23)
|
|
||||||
FSharp.Core (>= 6.0)
|
|
||||||
Fake.Core.String (5.23)
|
|
||||||
FSharp.Core (>= 6.0)
|
|
||||||
Fake.Core.Target (5.23)
|
|
||||||
Fake.Core.CommandLineParsing (>= 5.23)
|
|
||||||
Fake.Core.Context (>= 5.23)
|
|
||||||
Fake.Core.Environment (>= 5.23)
|
|
||||||
Fake.Core.FakeVar (>= 5.23)
|
|
||||||
Fake.Core.Process (>= 5.23)
|
|
||||||
Fake.Core.String (>= 5.23)
|
|
||||||
Fake.Core.Trace (>= 5.23)
|
|
||||||
FSharp.Control.Reactive (>= 5.0.2)
|
|
||||||
FSharp.Core (>= 6.0)
|
|
||||||
Fake.Core.Tasks (5.23)
|
|
||||||
Fake.Core.Trace (>= 5.23)
|
|
||||||
FSharp.Core (>= 6.0)
|
|
||||||
Fake.Core.Trace (5.23)
|
|
||||||
Fake.Core.Environment (>= 5.23)
|
|
||||||
Fake.Core.FakeVar (>= 5.23)
|
|
||||||
FSharp.Core (>= 6.0)
|
|
||||||
Fake.Core.Xml (5.23)
|
|
||||||
Fake.Core.String (>= 5.23)
|
|
||||||
FSharp.Core (>= 6.0)
|
|
||||||
Fake.DotNet.Cli (5.23)
|
|
||||||
Fake.Core.Environment (>= 5.23)
|
|
||||||
Fake.Core.Process (>= 5.23)
|
|
||||||
Fake.Core.String (>= 5.23)
|
|
||||||
Fake.Core.Trace (>= 5.23)
|
|
||||||
Fake.DotNet.MSBuild (>= 5.23)
|
|
||||||
Fake.DotNet.NuGet (>= 5.23)
|
|
||||||
Fake.IO.FileSystem (>= 5.23)
|
|
||||||
FSharp.Core (>= 6.0)
|
|
||||||
Mono.Posix.NETStandard (>= 1.0)
|
|
||||||
Newtonsoft.Json (>= 13.0.1)
|
|
||||||
Fake.DotNet.MSBuild (5.23)
|
|
||||||
BlackFox.VsWhere (>= 1.1)
|
|
||||||
Fake.Core.Environment (>= 5.23)
|
|
||||||
Fake.Core.Process (>= 5.23)
|
|
||||||
Fake.Core.String (>= 5.23)
|
|
||||||
Fake.Core.Trace (>= 5.23)
|
|
||||||
Fake.IO.FileSystem (>= 5.23)
|
|
||||||
FSharp.Core (>= 6.0)
|
|
||||||
MSBuild.StructuredLogger (>= 2.1.545)
|
|
||||||
Fake.DotNet.NuGet (5.23)
|
|
||||||
Fake.Core.Environment (>= 5.23)
|
|
||||||
Fake.Core.Process (>= 5.23)
|
|
||||||
Fake.Core.SemVer (>= 5.23)
|
|
||||||
Fake.Core.String (>= 5.23)
|
|
||||||
Fake.Core.Tasks (>= 5.23)
|
|
||||||
Fake.Core.Trace (>= 5.23)
|
|
||||||
Fake.Core.Xml (>= 5.23)
|
|
||||||
Fake.IO.FileSystem (>= 5.23)
|
|
||||||
Fake.Net.Http (>= 5.23)
|
|
||||||
FSharp.Core (>= 6.0)
|
|
||||||
Newtonsoft.Json (>= 13.0.1)
|
|
||||||
NuGet.Protocol (>= 5.11)
|
|
||||||
Fake.DotNet.Testing.Expecto (5.23)
|
|
||||||
Fake.Core.Process (>= 5.23)
|
|
||||||
Fake.Core.String (>= 5.23)
|
|
||||||
Fake.Core.Trace (>= 5.23)
|
|
||||||
Fake.IO.FileSystem (>= 5.23)
|
|
||||||
Fake.Testing.Common (>= 5.23)
|
|
||||||
FSharp.Core (>= 6.0)
|
|
||||||
Fake.IO.FileSystem (5.23)
|
|
||||||
Fake.Core.String (>= 5.23)
|
|
||||||
FSharp.Core (>= 6.0)
|
|
||||||
Fake.Net.Http (5.23)
|
|
||||||
Fake.Core.Trace (>= 5.23)
|
|
||||||
FSharp.Core (>= 6.0)
|
|
||||||
Fake.Testing.Common (5.23)
|
|
||||||
Fake.Core.Trace (>= 5.23)
|
|
||||||
FSharp.Core (>= 6.0)
|
|
||||||
FParsec (1.1.1)
|
|
||||||
FSharp.Core (>= 4.3.4)
|
|
||||||
FSharp.Control.Reactive (5.0.5)
|
|
||||||
FSharp.Core (>= 4.7.2)
|
|
||||||
System.Reactive (>= 5.0 < 6.0)
|
|
||||||
FSharp.Core (6.0.5)
|
|
||||||
Microsoft.Build (17.2)
|
|
||||||
Microsoft.Build.Framework (>= 17.2) - restriction: || (== net6.0) (&& (== netstandard2.0) (>= net472)) (&& (== netstandard2.0) (>= net6.0))
|
|
||||||
Microsoft.NET.StringTools (>= 1.0) - restriction: || (== net6.0) (&& (== netstandard2.0) (>= net472)) (&& (== netstandard2.0) (>= net6.0))
|
|
||||||
Microsoft.Win32.Registry (>= 4.3) - restriction: || (== net6.0) (&& (== netstandard2.0) (>= net6.0))
|
|
||||||
System.Collections.Immutable (>= 5.0) - restriction: || (== net6.0) (&& (== netstandard2.0) (>= net472)) (&& (== netstandard2.0) (>= net6.0))
|
|
||||||
System.Configuration.ConfigurationManager (>= 4.7) - restriction: || (== net6.0) (&& (== netstandard2.0) (>= net472)) (&& (== netstandard2.0) (>= net6.0))
|
|
||||||
System.Reflection.Metadata (>= 1.6) - restriction: || (== net6.0) (&& (== netstandard2.0) (>= net6.0))
|
|
||||||
System.Security.Principal.Windows (>= 4.7) - restriction: || (== net6.0) (&& (== netstandard2.0) (>= net6.0))
|
|
||||||
System.Text.Encoding.CodePages (>= 4.0.1) - restriction: || (== net6.0) (&& (== netstandard2.0) (>= net6.0))
|
|
||||||
System.Text.Json (>= 6.0) - restriction: || (== net6.0) (&& (== netstandard2.0) (>= net472)) (&& (== netstandard2.0) (>= net6.0))
|
|
||||||
System.Threading.Tasks.Dataflow (>= 6.0) - restriction: || (== net6.0) (&& (== netstandard2.0) (>= net472)) (&& (== netstandard2.0) (>= net6.0))
|
|
||||||
Microsoft.Build.Framework (17.2)
|
|
||||||
Microsoft.Win32.Registry (>= 4.3)
|
|
||||||
System.Security.Permissions (>= 4.7)
|
|
||||||
Microsoft.Build.Tasks.Core (17.2)
|
|
||||||
Microsoft.Build.Framework (>= 17.2)
|
|
||||||
Microsoft.Build.Utilities.Core (>= 17.2)
|
|
||||||
Microsoft.NET.StringTools (>= 1.0)
|
|
||||||
Microsoft.Win32.Registry (>= 4.3)
|
|
||||||
System.CodeDom (>= 4.4)
|
|
||||||
System.Collections.Immutable (>= 5.0)
|
|
||||||
System.Reflection.Metadata (>= 1.6)
|
|
||||||
System.Resources.Extensions (>= 4.6)
|
|
||||||
System.Security.Cryptography.Pkcs (>= 4.7)
|
|
||||||
System.Security.Cryptography.Xml (>= 4.7)
|
|
||||||
System.Security.Permissions (>= 4.7)
|
|
||||||
System.Threading.Tasks.Dataflow (>= 6.0)
|
|
||||||
Microsoft.Build.Utilities.Core (17.2)
|
|
||||||
Microsoft.Build.Framework (>= 17.2)
|
|
||||||
Microsoft.NET.StringTools (>= 1.0)
|
|
||||||
Microsoft.Win32.Registry (>= 4.3)
|
|
||||||
System.Collections.Immutable (>= 5.0)
|
|
||||||
System.Configuration.ConfigurationManager (>= 4.7)
|
|
||||||
System.Security.Permissions (>= 4.7) - restriction: == netstandard2.0
|
|
||||||
System.Text.Encoding.CodePages (>= 4.0.1) - restriction: == netstandard2.0
|
|
||||||
Microsoft.NET.StringTools (1.0)
|
|
||||||
System.Memory (>= 4.5.4)
|
|
||||||
System.Runtime.CompilerServices.Unsafe (>= 5.0)
|
|
||||||
Microsoft.NETCore.Platforms (6.0.5) - restriction: || (&& (== net6.0) (< netcoreapp3.1)) (&& (== net6.0) (< netstandard1.2)) (&& (== net6.0) (< netstandard1.3)) (&& (== net6.0) (< netstandard1.5)) (== netstandard2.0)
|
|
||||||
Microsoft.NETCore.Targets (5.0) - restriction: || (&& (== net6.0) (< netcoreapp3.1)) (&& (== net6.0) (< netstandard1.2)) (&& (== net6.0) (< netstandard1.3)) (&& (== net6.0) (< netstandard1.5)) (== netstandard2.0)
|
|
||||||
Microsoft.Win32.Registry (5.0)
|
|
||||||
System.Buffers (>= 4.5.1) - restriction: || (&& (== net6.0) (>= monoandroid) (< netstandard1.3)) (&& (== net6.0) (>= monotouch)) (&& (== net6.0) (< netcoreapp2.0)) (&& (== net6.0) (>= xamarinios)) (&& (== net6.0) (>= xamarinmac)) (&& (== net6.0) (>= xamarintvos)) (&& (== net6.0) (>= xamarinwatchos)) (== netstandard2.0)
|
|
||||||
System.Memory (>= 4.5.4) - restriction: || (&& (== net6.0) (< netcoreapp2.0)) (&& (== net6.0) (< netcoreapp2.1)) (&& (== net6.0) (>= uap10.1)) (== netstandard2.0)
|
|
||||||
System.Security.AccessControl (>= 5.0)
|
|
||||||
System.Security.Principal.Windows (>= 5.0)
|
|
||||||
Microsoft.Win32.SystemEvents (6.0.1) - restriction: || (== net6.0) (&& (== netstandard2.0) (>= netcoreapp3.1))
|
|
||||||
Mono.Posix.NETStandard (1.0)
|
|
||||||
MSBuild.StructuredLogger (2.1.669)
|
|
||||||
Microsoft.Build (>= 16.10)
|
|
||||||
Microsoft.Build.Framework (>= 16.10)
|
|
||||||
Microsoft.Build.Tasks.Core (>= 16.10)
|
|
||||||
Microsoft.Build.Utilities.Core (>= 16.10)
|
|
||||||
Newtonsoft.Json (13.0.1)
|
|
||||||
NuGet.Common (6.3)
|
|
||||||
NuGet.Frameworks (>= 6.3)
|
|
||||||
NuGet.Configuration (6.3)
|
|
||||||
NuGet.Common (>= 6.3)
|
|
||||||
System.Security.Cryptography.ProtectedData (>= 4.4)
|
|
||||||
NuGet.Frameworks (6.3)
|
|
||||||
NuGet.Packaging (6.3)
|
|
||||||
Newtonsoft.Json (>= 13.0.1)
|
|
||||||
NuGet.Configuration (>= 6.3)
|
|
||||||
NuGet.Versioning (>= 6.3)
|
|
||||||
System.Security.Cryptography.Cng (>= 5.0)
|
|
||||||
System.Security.Cryptography.Pkcs (>= 5.0)
|
|
||||||
NuGet.Protocol (6.3)
|
|
||||||
NuGet.Packaging (>= 6.3)
|
|
||||||
NuGet.Versioning (6.3)
|
|
||||||
System.Buffers (4.5.1) - restriction: || (&& (== net6.0) (>= monoandroid) (< netstandard1.3)) (&& (== net6.0) (>= monotouch)) (&& (== net6.0) (< netcoreapp2.0)) (&& (== net6.0) (>= xamarinios)) (&& (== net6.0) (>= xamarinmac)) (&& (== net6.0) (>= xamarintvos)) (&& (== net6.0) (>= xamarinwatchos)) (== netstandard2.0)
|
|
||||||
System.CodeDom (6.0)
|
|
||||||
System.Collections.Immutable (6.0)
|
|
||||||
System.Memory (>= 4.5.4) - restriction: || (&& (== net6.0) (>= net461)) (== netstandard2.0)
|
|
||||||
System.Runtime.CompilerServices.Unsafe (>= 6.0)
|
|
||||||
System.Configuration.ConfigurationManager (6.0)
|
|
||||||
System.Security.Cryptography.ProtectedData (>= 6.0)
|
|
||||||
System.Security.Permissions (>= 6.0)
|
|
||||||
System.Drawing.Common (6.0) - restriction: || (== net6.0) (&& (== netstandard2.0) (>= netcoreapp3.1))
|
|
||||||
Microsoft.Win32.SystemEvents (>= 6.0) - restriction: || (== net6.0) (&& (== netstandard2.0) (>= netcoreapp3.1))
|
|
||||||
System.Formats.Asn1 (6.0)
|
|
||||||
System.Buffers (>= 4.5.1) - restriction: || (&& (== net6.0) (>= net461)) (== netstandard2.0)
|
|
||||||
System.Memory (>= 4.5.4) - restriction: || (&& (== net6.0) (>= net461)) (== netstandard2.0)
|
|
||||||
System.Memory (4.5.5)
|
|
||||||
System.Buffers (>= 4.5.1) - restriction: || (&& (== net6.0) (>= monotouch)) (&& (== net6.0) (>= net461)) (&& (== net6.0) (< netcoreapp2.0)) (&& (== net6.0) (< netstandard1.1)) (&& (== net6.0) (< netstandard2.0)) (&& (== net6.0) (>= xamarinios)) (&& (== net6.0) (>= xamarinmac)) (&& (== net6.0) (>= xamarintvos)) (&& (== net6.0) (>= xamarinwatchos)) (== netstandard2.0)
|
|
||||||
System.Numerics.Vectors (>= 4.4) - restriction: || (&& (== net6.0) (< netcoreapp2.0)) (== netstandard2.0)
|
|
||||||
System.Runtime.CompilerServices.Unsafe (>= 4.5.3) - restriction: || (&& (== net6.0) (>= monotouch)) (&& (== net6.0) (>= net461)) (&& (== net6.0) (< netcoreapp2.0)) (&& (== net6.0) (< netcoreapp2.1)) (&& (== net6.0) (< netstandard1.1)) (&& (== net6.0) (< netstandard2.0)) (&& (== net6.0) (>= uap10.1)) (&& (== net6.0) (>= xamarinios)) (&& (== net6.0) (>= xamarinmac)) (&& (== net6.0) (>= xamarintvos)) (&& (== net6.0) (>= xamarinwatchos)) (== netstandard2.0)
|
|
||||||
System.Numerics.Vectors (4.5) - restriction: || (&& (== net6.0) (>= net461)) (== netstandard2.0)
|
|
||||||
System.Reactive (5.0)
|
|
||||||
System.Runtime.InteropServices.WindowsRuntime (>= 4.3) - restriction: || (&& (== net6.0) (< netcoreapp3.1)) (== netstandard2.0)
|
|
||||||
System.Threading.Tasks.Extensions (>= 4.5.4) - restriction: || (&& (== net6.0) (>= net472)) (&& (== net6.0) (< netcoreapp3.1)) (&& (== net6.0) (>= uap10.1)) (== netstandard2.0)
|
|
||||||
System.Reflection.Metadata (6.0.1)
|
|
||||||
System.Collections.Immutable (>= 6.0)
|
|
||||||
System.Resources.Extensions (6.0)
|
|
||||||
System.Memory (>= 4.5.4) - restriction: || (&& (== net6.0) (>= net461)) (== netstandard2.0)
|
|
||||||
System.Runtime (4.3.1) - restriction: || (&& (== net6.0) (< netcoreapp3.1)) (== netstandard2.0)
|
|
||||||
Microsoft.NETCore.Platforms (>= 1.1.1)
|
|
||||||
Microsoft.NETCore.Targets (>= 1.1.3)
|
|
||||||
System.Runtime.CompilerServices.Unsafe (6.0)
|
|
||||||
System.Runtime.InteropServices.WindowsRuntime (4.3) - restriction: || (&& (== net6.0) (< netcoreapp3.1)) (== netstandard2.0)
|
|
||||||
System.Runtime (>= 4.3)
|
|
||||||
System.Security.AccessControl (6.0)
|
|
||||||
System.Security.Principal.Windows (>= 5.0) - restriction: || (&& (== net6.0) (>= net461)) (== netstandard2.0)
|
|
||||||
System.Security.Cryptography.Cng (5.0)
|
|
||||||
System.Formats.Asn1 (>= 5.0) - restriction: || (== net6.0) (&& (== netstandard2.0) (>= netcoreapp3.0))
|
|
||||||
System.Security.Cryptography.Pkcs (6.0.1)
|
|
||||||
System.Buffers (>= 4.5.1) - restriction: || (&& (== net6.0) (< netstandard2.1)) (== netstandard2.0)
|
|
||||||
System.Formats.Asn1 (>= 6.0)
|
|
||||||
System.Memory (>= 4.5.4) - restriction: || (&& (== net6.0) (< netstandard2.1)) (== netstandard2.0)
|
|
||||||
System.Security.Cryptography.Cng (>= 5.0) - restriction: || (&& (== net6.0) (< netcoreapp3.1)) (&& (== net6.0) (< netstandard2.1)) (== netstandard2.0)
|
|
||||||
System.Security.Cryptography.ProtectedData (6.0)
|
|
||||||
System.Security.Cryptography.Xml (6.0.1)
|
|
||||||
System.Memory (>= 4.5.4) - restriction: == netstandard2.0
|
|
||||||
System.Security.AccessControl (>= 6.0)
|
|
||||||
System.Security.Cryptography.Pkcs (>= 6.0.1)
|
|
||||||
System.Security.Permissions (6.0)
|
|
||||||
System.Security.AccessControl (>= 6.0)
|
|
||||||
System.Windows.Extensions (>= 6.0) - restriction: || (== net6.0) (&& (== netstandard2.0) (>= netcoreapp3.1))
|
|
||||||
System.Security.Principal.Windows (5.0)
|
|
||||||
System.Text.Encoding.CodePages (6.0)
|
|
||||||
System.Runtime.CompilerServices.Unsafe (>= 6.0)
|
|
||||||
System.Text.Encodings.Web (6.0) - restriction: || (== net6.0) (&& (== netstandard2.0) (>= net472)) (&& (== netstandard2.0) (>= net6.0))
|
|
||||||
System.Runtime.CompilerServices.Unsafe (>= 6.0)
|
|
||||||
System.Text.Json (6.0.5) - restriction: || (== net6.0) (&& (== netstandard2.0) (>= net472)) (&& (== netstandard2.0) (>= net6.0))
|
|
||||||
System.Runtime.CompilerServices.Unsafe (>= 6.0)
|
|
||||||
System.Text.Encodings.Web (>= 6.0)
|
|
||||||
System.Threading.Tasks.Dataflow (6.0)
|
|
||||||
System.Threading.Tasks.Extensions (4.5.4) - restriction: || (&& (== net6.0) (>= net472)) (&& (== net6.0) (< netcoreapp3.1)) (&& (== net6.0) (>= uap10.1)) (== netstandard2.0)
|
|
||||||
System.Runtime.CompilerServices.Unsafe (>= 4.5.3) - restriction: || (&& (== net6.0) (>= net461)) (&& (== net6.0) (< netcoreapp2.1)) (&& (== net6.0) (< netstandard1.0)) (&& (== net6.0) (< netstandard2.0)) (&& (== net6.0) (>= wp8)) (== netstandard2.0)
|
|
||||||
System.Windows.Extensions (6.0) - restriction: || (== net6.0) (&& (== netstandard2.0) (>= netcoreapp3.1))
|
|
||||||
System.Drawing.Common (>= 6.0) - restriction: || (== net6.0) (&& (== netstandard2.0) (>= netcoreapp3.1))
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
docs.prayer.bitbadger.solutions
|
|
||||||
24
docs/Gemfile
24
docs/Gemfile
@@ -1,24 +0,0 @@
|
|||||||
source "https://rubygems.org"
|
|
||||||
|
|
||||||
# Hello! This is where you manage which Jekyll version is used to run.
|
|
||||||
# When you want to use a different version, change it below, save the
|
|
||||||
# file and run `bundle install`. Run Jekyll with `bundle exec`, like so:
|
|
||||||
#
|
|
||||||
# bundle exec jekyll serve
|
|
||||||
#
|
|
||||||
# This will help ensure the proper Jekyll version is running.
|
|
||||||
# Happy Jekylling!
|
|
||||||
# If you want to use GitHub Pages, remove the "gem "jekyll"" above and
|
|
||||||
# uncomment the line below. To upgrade, run `bundle update github-pages`.
|
|
||||||
gem "github-pages", group: :jekyll_plugins
|
|
||||||
|
|
||||||
# If you have any plugins, put them here!
|
|
||||||
group :jekyll_plugins do
|
|
||||||
end
|
|
||||||
|
|
||||||
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
|
|
||||||
gem "tzinfo-data", platforms: [:mingw, :mswin, :x64_mingw, :jruby]
|
|
||||||
|
|
||||||
# Performance-booster for watching directories on Windows
|
|
||||||
gem "wdm", "~> 0.1.0" if Gem.win_platform?
|
|
||||||
|
|
||||||
@@ -1,259 +0,0 @@
|
|||||||
GEM
|
|
||||||
remote: https://rubygems.org/
|
|
||||||
specs:
|
|
||||||
activesupport (7.0.4.3)
|
|
||||||
concurrent-ruby (~> 1.0, >= 1.0.2)
|
|
||||||
i18n (>= 1.6, < 2)
|
|
||||||
minitest (>= 5.1)
|
|
||||||
tzinfo (~> 2.0)
|
|
||||||
addressable (2.8.4)
|
|
||||||
public_suffix (>= 2.0.2, < 6.0)
|
|
||||||
coffee-script (2.4.1)
|
|
||||||
coffee-script-source
|
|
||||||
execjs
|
|
||||||
coffee-script-source (1.11.1)
|
|
||||||
colorator (1.1.0)
|
|
||||||
commonmarker (0.23.9)
|
|
||||||
concurrent-ruby (1.2.2)
|
|
||||||
dnsruby (1.70.0)
|
|
||||||
simpleidn (~> 0.2.1)
|
|
||||||
em-websocket (0.5.3)
|
|
||||||
eventmachine (>= 0.12.9)
|
|
||||||
http_parser.rb (~> 0)
|
|
||||||
ethon (0.16.0)
|
|
||||||
ffi (>= 1.15.0)
|
|
||||||
eventmachine (1.2.7)
|
|
||||||
execjs (2.8.1)
|
|
||||||
faraday (2.7.5)
|
|
||||||
faraday-net_http (>= 2.0, < 3.1)
|
|
||||||
ruby2_keywords (>= 0.0.4)
|
|
||||||
faraday-net_http (3.0.2)
|
|
||||||
ffi (1.15.5)
|
|
||||||
forwardable-extended (2.6.0)
|
|
||||||
gemoji (3.0.1)
|
|
||||||
github-pages (228)
|
|
||||||
github-pages-health-check (= 1.17.9)
|
|
||||||
jekyll (= 3.9.3)
|
|
||||||
jekyll-avatar (= 0.7.0)
|
|
||||||
jekyll-coffeescript (= 1.1.1)
|
|
||||||
jekyll-commonmark-ghpages (= 0.4.0)
|
|
||||||
jekyll-default-layout (= 0.1.4)
|
|
||||||
jekyll-feed (= 0.15.1)
|
|
||||||
jekyll-gist (= 1.5.0)
|
|
||||||
jekyll-github-metadata (= 2.13.0)
|
|
||||||
jekyll-include-cache (= 0.2.1)
|
|
||||||
jekyll-mentions (= 1.6.0)
|
|
||||||
jekyll-optional-front-matter (= 0.3.2)
|
|
||||||
jekyll-paginate (= 1.1.0)
|
|
||||||
jekyll-readme-index (= 0.3.0)
|
|
||||||
jekyll-redirect-from (= 0.16.0)
|
|
||||||
jekyll-relative-links (= 0.6.1)
|
|
||||||
jekyll-remote-theme (= 0.4.3)
|
|
||||||
jekyll-sass-converter (= 1.5.2)
|
|
||||||
jekyll-seo-tag (= 2.8.0)
|
|
||||||
jekyll-sitemap (= 1.4.0)
|
|
||||||
jekyll-swiss (= 1.0.0)
|
|
||||||
jekyll-theme-architect (= 0.2.0)
|
|
||||||
jekyll-theme-cayman (= 0.2.0)
|
|
||||||
jekyll-theme-dinky (= 0.2.0)
|
|
||||||
jekyll-theme-hacker (= 0.2.0)
|
|
||||||
jekyll-theme-leap-day (= 0.2.0)
|
|
||||||
jekyll-theme-merlot (= 0.2.0)
|
|
||||||
jekyll-theme-midnight (= 0.2.0)
|
|
||||||
jekyll-theme-minimal (= 0.2.0)
|
|
||||||
jekyll-theme-modernist (= 0.2.0)
|
|
||||||
jekyll-theme-primer (= 0.6.0)
|
|
||||||
jekyll-theme-slate (= 0.2.0)
|
|
||||||
jekyll-theme-tactile (= 0.2.0)
|
|
||||||
jekyll-theme-time-machine (= 0.2.0)
|
|
||||||
jekyll-titles-from-headings (= 0.5.3)
|
|
||||||
jemoji (= 0.12.0)
|
|
||||||
kramdown (= 2.3.2)
|
|
||||||
kramdown-parser-gfm (= 1.1.0)
|
|
||||||
liquid (= 4.0.4)
|
|
||||||
mercenary (~> 0.3)
|
|
||||||
minima (= 2.5.1)
|
|
||||||
nokogiri (>= 1.13.6, < 2.0)
|
|
||||||
rouge (= 3.26.0)
|
|
||||||
terminal-table (~> 1.4)
|
|
||||||
github-pages-health-check (1.17.9)
|
|
||||||
addressable (~> 2.3)
|
|
||||||
dnsruby (~> 1.60)
|
|
||||||
octokit (~> 4.0)
|
|
||||||
public_suffix (>= 3.0, < 5.0)
|
|
||||||
typhoeus (~> 1.3)
|
|
||||||
html-pipeline (2.14.3)
|
|
||||||
activesupport (>= 2)
|
|
||||||
nokogiri (>= 1.4)
|
|
||||||
http_parser.rb (0.8.0)
|
|
||||||
i18n (1.13.0)
|
|
||||||
concurrent-ruby (~> 1.0)
|
|
||||||
jekyll (3.9.3)
|
|
||||||
addressable (~> 2.4)
|
|
||||||
colorator (~> 1.0)
|
|
||||||
em-websocket (~> 0.5)
|
|
||||||
i18n (>= 0.7, < 2)
|
|
||||||
jekyll-sass-converter (~> 1.0)
|
|
||||||
jekyll-watch (~> 2.0)
|
|
||||||
kramdown (>= 1.17, < 3)
|
|
||||||
liquid (~> 4.0)
|
|
||||||
mercenary (~> 0.3.3)
|
|
||||||
pathutil (~> 0.9)
|
|
||||||
rouge (>= 1.7, < 4)
|
|
||||||
safe_yaml (~> 1.0)
|
|
||||||
jekyll-avatar (0.7.0)
|
|
||||||
jekyll (>= 3.0, < 5.0)
|
|
||||||
jekyll-coffeescript (1.1.1)
|
|
||||||
coffee-script (~> 2.2)
|
|
||||||
coffee-script-source (~> 1.11.1)
|
|
||||||
jekyll-commonmark (1.4.0)
|
|
||||||
commonmarker (~> 0.22)
|
|
||||||
jekyll-commonmark-ghpages (0.4.0)
|
|
||||||
commonmarker (~> 0.23.7)
|
|
||||||
jekyll (~> 3.9.0)
|
|
||||||
jekyll-commonmark (~> 1.4.0)
|
|
||||||
rouge (>= 2.0, < 5.0)
|
|
||||||
jekyll-default-layout (0.1.4)
|
|
||||||
jekyll (~> 3.0)
|
|
||||||
jekyll-feed (0.15.1)
|
|
||||||
jekyll (>= 3.7, < 5.0)
|
|
||||||
jekyll-gist (1.5.0)
|
|
||||||
octokit (~> 4.2)
|
|
||||||
jekyll-github-metadata (2.13.0)
|
|
||||||
jekyll (>= 3.4, < 5.0)
|
|
||||||
octokit (~> 4.0, != 4.4.0)
|
|
||||||
jekyll-include-cache (0.2.1)
|
|
||||||
jekyll (>= 3.7, < 5.0)
|
|
||||||
jekyll-mentions (1.6.0)
|
|
||||||
html-pipeline (~> 2.3)
|
|
||||||
jekyll (>= 3.7, < 5.0)
|
|
||||||
jekyll-optional-front-matter (0.3.2)
|
|
||||||
jekyll (>= 3.0, < 5.0)
|
|
||||||
jekyll-paginate (1.1.0)
|
|
||||||
jekyll-readme-index (0.3.0)
|
|
||||||
jekyll (>= 3.0, < 5.0)
|
|
||||||
jekyll-redirect-from (0.16.0)
|
|
||||||
jekyll (>= 3.3, < 5.0)
|
|
||||||
jekyll-relative-links (0.6.1)
|
|
||||||
jekyll (>= 3.3, < 5.0)
|
|
||||||
jekyll-remote-theme (0.4.3)
|
|
||||||
addressable (~> 2.0)
|
|
||||||
jekyll (>= 3.5, < 5.0)
|
|
||||||
jekyll-sass-converter (>= 1.0, <= 3.0.0, != 2.0.0)
|
|
||||||
rubyzip (>= 1.3.0, < 3.0)
|
|
||||||
jekyll-sass-converter (1.5.2)
|
|
||||||
sass (~> 3.4)
|
|
||||||
jekyll-seo-tag (2.8.0)
|
|
||||||
jekyll (>= 3.8, < 5.0)
|
|
||||||
jekyll-sitemap (1.4.0)
|
|
||||||
jekyll (>= 3.7, < 5.0)
|
|
||||||
jekyll-swiss (1.0.0)
|
|
||||||
jekyll-theme-architect (0.2.0)
|
|
||||||
jekyll (> 3.5, < 5.0)
|
|
||||||
jekyll-seo-tag (~> 2.0)
|
|
||||||
jekyll-theme-cayman (0.2.0)
|
|
||||||
jekyll (> 3.5, < 5.0)
|
|
||||||
jekyll-seo-tag (~> 2.0)
|
|
||||||
jekyll-theme-dinky (0.2.0)
|
|
||||||
jekyll (> 3.5, < 5.0)
|
|
||||||
jekyll-seo-tag (~> 2.0)
|
|
||||||
jekyll-theme-hacker (0.2.0)
|
|
||||||
jekyll (> 3.5, < 5.0)
|
|
||||||
jekyll-seo-tag (~> 2.0)
|
|
||||||
jekyll-theme-leap-day (0.2.0)
|
|
||||||
jekyll (> 3.5, < 5.0)
|
|
||||||
jekyll-seo-tag (~> 2.0)
|
|
||||||
jekyll-theme-merlot (0.2.0)
|
|
||||||
jekyll (> 3.5, < 5.0)
|
|
||||||
jekyll-seo-tag (~> 2.0)
|
|
||||||
jekyll-theme-midnight (0.2.0)
|
|
||||||
jekyll (> 3.5, < 5.0)
|
|
||||||
jekyll-seo-tag (~> 2.0)
|
|
||||||
jekyll-theme-minimal (0.2.0)
|
|
||||||
jekyll (> 3.5, < 5.0)
|
|
||||||
jekyll-seo-tag (~> 2.0)
|
|
||||||
jekyll-theme-modernist (0.2.0)
|
|
||||||
jekyll (> 3.5, < 5.0)
|
|
||||||
jekyll-seo-tag (~> 2.0)
|
|
||||||
jekyll-theme-primer (0.6.0)
|
|
||||||
jekyll (> 3.5, < 5.0)
|
|
||||||
jekyll-github-metadata (~> 2.9)
|
|
||||||
jekyll-seo-tag (~> 2.0)
|
|
||||||
jekyll-theme-slate (0.2.0)
|
|
||||||
jekyll (> 3.5, < 5.0)
|
|
||||||
jekyll-seo-tag (~> 2.0)
|
|
||||||
jekyll-theme-tactile (0.2.0)
|
|
||||||
jekyll (> 3.5, < 5.0)
|
|
||||||
jekyll-seo-tag (~> 2.0)
|
|
||||||
jekyll-theme-time-machine (0.2.0)
|
|
||||||
jekyll (> 3.5, < 5.0)
|
|
||||||
jekyll-seo-tag (~> 2.0)
|
|
||||||
jekyll-titles-from-headings (0.5.3)
|
|
||||||
jekyll (>= 3.3, < 5.0)
|
|
||||||
jekyll-watch (2.2.1)
|
|
||||||
listen (~> 3.0)
|
|
||||||
jemoji (0.12.0)
|
|
||||||
gemoji (~> 3.0)
|
|
||||||
html-pipeline (~> 2.2)
|
|
||||||
jekyll (>= 3.0, < 5.0)
|
|
||||||
kramdown (2.3.2)
|
|
||||||
rexml
|
|
||||||
kramdown-parser-gfm (1.1.0)
|
|
||||||
kramdown (~> 2.0)
|
|
||||||
liquid (4.0.4)
|
|
||||||
listen (3.8.0)
|
|
||||||
rb-fsevent (~> 0.10, >= 0.10.3)
|
|
||||||
rb-inotify (~> 0.9, >= 0.9.10)
|
|
||||||
mercenary (0.3.6)
|
|
||||||
minima (2.5.1)
|
|
||||||
jekyll (>= 3.5, < 5.0)
|
|
||||||
jekyll-feed (~> 0.9)
|
|
||||||
jekyll-seo-tag (~> 2.1)
|
|
||||||
minitest (5.18.0)
|
|
||||||
nokogiri (1.15.1-x86_64-linux)
|
|
||||||
racc (~> 1.4)
|
|
||||||
octokit (4.25.1)
|
|
||||||
faraday (>= 1, < 3)
|
|
||||||
sawyer (~> 0.9)
|
|
||||||
pathutil (0.16.2)
|
|
||||||
forwardable-extended (~> 2.6)
|
|
||||||
public_suffix (4.0.7)
|
|
||||||
racc (1.6.2)
|
|
||||||
rb-fsevent (0.11.2)
|
|
||||||
rb-inotify (0.10.1)
|
|
||||||
ffi (~> 1.0)
|
|
||||||
rexml (3.2.5)
|
|
||||||
rouge (3.26.0)
|
|
||||||
ruby2_keywords (0.0.5)
|
|
||||||
rubyzip (2.3.2)
|
|
||||||
safe_yaml (1.0.5)
|
|
||||||
sass (3.7.4)
|
|
||||||
sass-listen (~> 4.0.0)
|
|
||||||
sass-listen (4.0.0)
|
|
||||||
rb-fsevent (~> 0.9, >= 0.9.4)
|
|
||||||
rb-inotify (~> 0.9, >= 0.9.7)
|
|
||||||
sawyer (0.9.2)
|
|
||||||
addressable (>= 2.3.5)
|
|
||||||
faraday (>= 0.17.3, < 3)
|
|
||||||
simpleidn (0.2.1)
|
|
||||||
unf (~> 0.1.4)
|
|
||||||
terminal-table (1.8.0)
|
|
||||||
unicode-display_width (~> 1.1, >= 1.1.1)
|
|
||||||
typhoeus (1.4.0)
|
|
||||||
ethon (>= 0.9.0)
|
|
||||||
tzinfo (2.0.6)
|
|
||||||
concurrent-ruby (~> 1.0)
|
|
||||||
unf (0.1.4)
|
|
||||||
unf_ext
|
|
||||||
unf_ext (0.0.8.2)
|
|
||||||
unicode-display_width (1.8.0)
|
|
||||||
|
|
||||||
PLATFORMS
|
|
||||||
x86_64-linux
|
|
||||||
|
|
||||||
DEPENDENCIES
|
|
||||||
github-pages
|
|
||||||
tzinfo-data
|
|
||||||
|
|
||||||
BUNDLED WITH
|
|
||||||
2.3.15
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
defaults:
|
|
||||||
-
|
|
||||||
scope:
|
|
||||||
path: "en"
|
|
||||||
values:
|
|
||||||
layout: "en"
|
|
||||||
-
|
|
||||||
scope:
|
|
||||||
path: "es"
|
|
||||||
values:
|
|
||||||
layout: "es"
|
|
||||||
@@ -1,41 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<meta charset="UTF-8">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
||||||
<title>{{ page.title }} « PrayerTracker Help</title>
|
|
||||||
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
|
|
||||||
<link href="https://prayer.bitbadger.solutions/css/app.css" rel="stylesheet">
|
|
||||||
<link href="/css/help.css" rel="stylesheet">
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<header class="pt-title-bar">
|
|
||||||
<section class="pt-title-bar-left"><span class="pt-title-bar-home"><a href="/" title="Home">PrayerTracker</a></span></section>
|
|
||||||
<section class="pt-title-bar-right">Help</section>
|
|
||||||
</header>
|
|
||||||
<div id="pt-body">
|
|
||||||
<header id="pt-language">
|
|
||||||
<div>
|
|
||||||
Language: English •
|
|
||||||
<a href="{{ page.url | replace_first: "/en", "/es" }}">Esta pagina en español</a>
|
|
||||||
</div>
|
|
||||||
</header>
|
|
||||||
<h2 id="pt-page-title">{{ page.title }}</h2>
|
|
||||||
<div class="pt-content">
|
|
||||||
{{ content }}
|
|
||||||
<div class="pt-close-window">
|
|
||||||
<p class="pt-center-text">
|
|
||||||
<a href="#" title="Click to Close This Window" onclick="window.close();return false">
|
|
||||||
<i class="material-icons">cancel</i> Close Window
|
|
||||||
</a>
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
<div class="pt-help-index">
|
|
||||||
<p class="pt-center-text">
|
|
||||||
<a href="/en/" title="Help Index">« Back to Help Index</a>
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
@@ -1,44 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<meta charset="UTF-8">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
||||||
<title>{{ page.title }} « Ayuda de SeguidorOración</title>
|
|
||||||
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
|
|
||||||
<link href="https://prayer.bitbadger.solutions/css/app.css" rel="stylesheet">
|
|
||||||
<link href="/css/help.css" rel="stylesheet">
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<header class="pt-title-bar">
|
|
||||||
<section class="pt-title-bar-left"><span class="pt-title-bar-home"><a href="/" title="Home">SeguidorOración</a></span></section>
|
|
||||||
<section class="pt-title-bar-right">Ayuda</section>
|
|
||||||
</header>
|
|
||||||
<div id="pt-body">
|
|
||||||
<header id="pt-language">
|
|
||||||
<div>
|
|
||||||
Lengua: Español •
|
|
||||||
<a href="{{ page.url | replace_first: "/es", "/en" }}">This page in English</a>
|
|
||||||
</div>
|
|
||||||
</header>
|
|
||||||
<h2 id="pt-page-title">{{ page.title }}</h2>
|
|
||||||
<div class="pt-content">
|
|
||||||
{{ content }}
|
|
||||||
{% if page.skip_footer %}
|
|
||||||
{% else %}
|
|
||||||
<div class="pt-close-window">
|
|
||||||
<p class="pt-center-text">
|
|
||||||
<a href="#" title="Haga Clic para Cerrar Esta Ventana" onclick="window.close();return false">
|
|
||||||
<i class="material-icons">cancel</i> Cerrar Esta Ventana
|
|
||||||
</a>
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
<div class="pt-help-index">
|
|
||||||
<p class="pt-center-text">
|
|
||||||
<a href="/es/" title="Índice de ayuda">« Volver al índice de ayuda</a>
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
{% endif %}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<meta charset="UTF-8">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
||||||
<title>{{ page.title }} « PrayerTracker Help / Ayuda de SeguidorOración</title>
|
|
||||||
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
|
|
||||||
<link href="https://prayer.bitbadger.solutions/css/app.css" rel="stylesheet">
|
|
||||||
<link href="/css/help.css" rel="stylesheet">
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<header class="pt-title-bar">
|
|
||||||
<section class="pt-title-bar-left"><span class="pt-title-bar-home"><a href="/" title="Home">PrayerTracker / SeguidorOración</a></span></section>
|
|
||||||
<section class="pt-title-bar-right">Help / Ayuda</section>
|
|
||||||
</header>
|
|
||||||
<div id="pt-body">
|
|
||||||
<header id="pt-language">
|
|
||||||
<div> </div>
|
|
||||||
</header>
|
|
||||||
<h2 id="pt-page-title">{{ page.title }}</h2>
|
|
||||||
<div class="pt-content pt-center-text">
|
|
||||||
{{ content }}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
---
|
|
||||||
title: Help
|
|
||||||
skip_footer: true
|
|
||||||
---
|
|
||||||
|
|
||||||
Throughout PrayerTracker, you'll see an icon (a question mark in a circle) next to the title on each page. Clicking this will open a new, small window with directions on using that page. If you are looking for a quick overview of PrayerTracker, start with the “Add / Edit a Request” and “Change Preferences” entries.
|
|
||||||
|
|
||||||
----
|
|
||||||
|
|
||||||
<p class="pt-center-text"><strong>Help Topics</strong></p>
|
|
||||||
|
|
||||||
[Change Preferences](./small-group/preferences.html)
|
|
||||||
|
|
||||||
[Send Announcement](./small-group/announcement.html)
|
|
||||||
|
|
||||||
[Maintain Group Members](./small-group/members.html)
|
|
||||||
|
|
||||||
[Add / Edit a Request](./requests/edit.html)
|
|
||||||
|
|
||||||
[Maintain Requests](./requests/maintain.html)
|
|
||||||
|
|
||||||
[View Request List](./requests/view.html)
|
|
||||||
|
|
||||||
[Log On](./user/log-on.html)
|
|
||||||
|
|
||||||
[Change Your Password](./user/password.html)
|
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
---
|
|
||||||
title: Add / Edit a Request
|
|
||||||
---
|
|
||||||
|
|
||||||
This page allows you to enter or update a new prayer request.
|
|
||||||
|
|
||||||
## Request Type
|
|
||||||
|
|
||||||
There are 5 request types in PrayerTracker. “Current Requests” are your regular requests that people may have regarding things happening over the next week or so. “Long-Term Requests” are requests that may occur repeatedly or continue indefinitely. “Praise Reports” are like “Current Requests”, but they are answers to prayer to share with your group. “Expecting” is for those who are pregnant. “Announcements” are like “Current Requests”, but instead of a request, they are simply passing information along about something coming up.
|
|
||||||
|
|
||||||
The order above is the order in which the request types appear on the list. “Long-Term Requests” and “Expecting” are not subject to the automatic expiration (set on the “Change Preferences” page) that the other requests are.
|
|
||||||
|
|
||||||
## Date
|
|
||||||
|
|
||||||
For new requests, this is a box with a calendar date picker. Click or tab into the box to display the calendar, which will be preselected to today's date. For existing requests, there will be a check box labeled “Check to not update the date”. This can be used if you are correcting spelling or punctuation, and do not have an actual update to make to the request.
|
|
||||||
|
|
||||||
## Requestor / Subject
|
|
||||||
|
|
||||||
For requests or praises, this field is for the name of the person who made the request or offered the praise report. For announcements, this should contain the subject of the announcement. For all types, it is optional; I used to have an announcement with no subject that ran every week, telling where to send requests and updates.
|
|
||||||
|
|
||||||
## Expiration
|
|
||||||
|
|
||||||
“Expire Normally” means that the request is subject to the expiration days in the group preferences. “Request Never Expires” can be used to make a request never expire (note that this is redundant for “Long-Term Requests” and “Expecting”). If you are editing an existing request, a third option appears. “Expire Immediately” will make the request expire when it is saved. Apart from the icons on the request maintenance page, this is the only way to expire “Long-Term Requests” and “Expecting” requests, but it can be used for any request type.
|
|
||||||
|
|
||||||
## Request
|
|
||||||
|
|
||||||
This is the text of the request. The editor provides many formatting capabilities, including “Spell Check as you Type” (enabled by default), “Paste from Word”, and “Paste Plain”, as well as “Source” view, if you want to edit the HTML yourself. It also supports undo and redo, and the editor supports full-screen mode. Hover over each icon to see what each button does.
|
|
||||||
@@ -1,29 +0,0 @@
|
|||||||
---
|
|
||||||
title: Maintain Requests
|
|
||||||
---
|
|
||||||
|
|
||||||
From this page, you can add, edit, and delete your current requests. You can also restore requests that may have expired, but should be made active once again.
|
|
||||||
|
|
||||||
## Add a New Request
|
|
||||||
|
|
||||||
To add a request, click the icon or text in the center of the page, below the title and above the list of requests for your group.
|
|
||||||
|
|
||||||
## Search Requests
|
|
||||||
|
|
||||||
If you are looking for a particular requests, enter some text in the search box and click “Search”. PrayerTracker will search the Requestor/Subject and Request Text fields (case-insensitively) of both active and inactive requests. The results will be displayed in the same format as the original Maintain Requests page, so the buttons described below will work the same for those requests as well. They will also be displayed in pages, if there are a lot of results; the number per page is configurable by small group.
|
|
||||||
|
|
||||||
## Edit Request
|
|
||||||
|
|
||||||
To edit a request, click the pencil icon; it's the first icon under the “Actions” column heading.
|
|
||||||
|
|
||||||
## Expire a Request
|
|
||||||
|
|
||||||
For active requests, the second icon is an eye with a slash through it; clicking this icon will expire the request immediately. This is equivalent to editing the request, selecting “Expire Immediately”, and saving it.
|
|
||||||
|
|
||||||
## Restore an Inactive Request
|
|
||||||
|
|
||||||
When the page is first displayed, it does not display inactive requests. However, clicking the link at the bottom of the page will refresh the page with the inactive requests shown. The middle icon will look like an eye; clicking it will restore the request as an active request. The last updated date will be current, and the request is set to expire normally.
|
|
||||||
|
|
||||||
## Delete a Request
|
|
||||||
|
|
||||||
Deleting a request is contrary to the intent of PrayerTracker, as you can retrieve requests that have expired. However, if there is a request that needs to be deleted, clicking the trash can icon in the “Actions” column will allow you to do it. Use this option carefully, as these deletions cannot be undone; once a request is deleted, it is gone for good.
|
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
---
|
|
||||||
title: View Request List
|
|
||||||
---
|
|
||||||
|
|
||||||
From this page, you can view the request list (for today or for the next Sunday), view a printable version of the list, and e-mail the list to the members of your group. (NOTE: If you are logged in as a group member, the only option you will see is to view a printable list.)
|
|
||||||
|
|
||||||
## List for Next Sunday
|
|
||||||
|
|
||||||
This will modify the date for the list, so it will look like it is currently next Sunday. This can be used, for example, to see what requests will expire, or allow you to print a list with Sunday's date on Saturday evening. Note that this link does not appear if it is Sunday.
|
|
||||||
|
|
||||||
## View Printable
|
|
||||||
|
|
||||||
Clicking this link will display the list in a format that is suitable for printing; it does not have the normal PrayerTracker header across the top. Once you have clicked the link, you can print it using your browser's standard “Print” functionality.
|
|
||||||
|
|
||||||
## Send Via E-mail
|
|
||||||
|
|
||||||
Clicking this link will send the list you are currently viewing to your group members. The page will remind you that you are about to do that, and ask for your confirmation. If you proceed, you will see a page that shows to whom the list was sent, and what the list looked like. You may safely use your browser's “Back” button to navigate away from the page.
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
---
|
|
||||||
title: Send Announcement
|
|
||||||
---
|
|
||||||
|
|
||||||
## Announcement Text
|
|
||||||
|
|
||||||
This is the text of the announcement you would like to send. It functions the same way as the text box on the [“Edit Request” page](../requests/edit.html#request).
|
|
||||||
|
|
||||||
## Add to Request List
|
|
||||||
|
|
||||||
Without this box checked, the text of the announcement will only be e-mailed to your group members. If you check this box, however, the text of the announcement will be added to your prayer list under the section you have selected.
|
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
---
|
|
||||||
title: Maintain Group Members
|
|
||||||
---
|
|
||||||
|
|
||||||
From this page, you can add, edit, and delete the e-mail addresses for your group.
|
|
||||||
|
|
||||||
## Add a New Group Member
|
|
||||||
|
|
||||||
To add an e-mail address, click the icon or text in the center of the page, below the title and above the list of addresses for your group.
|
|
||||||
|
|
||||||
## Edit Group Member
|
|
||||||
|
|
||||||
To edit an e-mail address, click the pencil icon; it's the first icon under the “Actions” column heading. This will allow you to update the name and/or the e-mail address for that member.
|
|
||||||
|
|
||||||
## Delete a Group Member
|
|
||||||
|
|
||||||
To delete an e-mail address, click the trash can icon in the “Actions” column. Note that once an e-mail address has been deleted, it is gone. (Of course, if you delete it in error, you can enter it again using the “Add” instructions above.)
|
|
||||||
@@ -1,73 +0,0 @@
|
|||||||
---
|
|
||||||
title: Change Preferences
|
|
||||||
---
|
|
||||||
|
|
||||||
This page allows you to change how your prayer request list looks and behaves. Each section is addressed below.
|
|
||||||
|
|
||||||
## Requests Expire After
|
|
||||||
|
|
||||||
When a regular request goes this many days without being updated, it expires and no longer appears on the request list. Note that the categories “Long-Term Requests” and “Expecting” never expire automatically.
|
|
||||||
|
|
||||||
## Requests “New” For
|
|
||||||
|
|
||||||
Requests that have been updated within this many days are identified by a hollow circle for their bullet, as opposed to a filled circle for other requests. All categories respect this setting. If you do a typo correction on a request, if you do not check the box to update the date, this setting will change the bullet. (NOTE: In the plain-text e-mail, new requests are bulleted with a “+” symbol, and old are bulleted with a “-” symbol.)
|
|
||||||
|
|
||||||
## Long-Term Requests Alerted for Update
|
|
||||||
|
|
||||||
Requests that have not been updated in this many weeks are identified by an italic font on the “Maintain Requests” page, to remind you to seek updates on these requests so that your prayers can stay relevant and current.
|
|
||||||
|
|
||||||
## Request Sorting
|
|
||||||
|
|
||||||
By default, requests are sorted within each group by the last updated date, with the most recent on top. If you would prefer to have the list sorted by requestor or subject rather than by date, select “Sort by Requestor Name” instead.
|
|
||||||
|
|
||||||
## E-mail “From” Name and Address
|
|
||||||
|
|
||||||
PrayerTracker must put an name and e-mail address in the “from” position of each e-mail it sends. The default name is “PrayerTracker”, and the default e-mail address is “prayer@djs-consulting.com”. This will work, but any bounced e-mails and out-of-office replies will be sent to that address (which is not even a real address). Changing at least the e-mail address to your address will ensure that you receive these e-mails, and can prune your e-mail list accordingly.
|
|
||||||
|
|
||||||
## E-mail Format
|
|
||||||
|
|
||||||
This is the default e-mail format for your group. The PrayerTracker default is HTML, which sends the list just as you see it online. However, some e-mail clients may not display this properly, so you can choose to default the email to a plain-text format, which does not have colors, italics, or other formatting. The setting on this page is the group default; you can select a format for each recipient on the “Maintain Group Members” page.
|
|
||||||
|
|
||||||
## Colors
|
|
||||||
|
|
||||||
You can customize the colors that are used for the headings and lines in your request list. You can select one of the 16 named colors in the drop down lists, or you can “mix your own” using red, green, and blue (RGB) values between 0 and 255. There is a link on the bottom of the page to a color list with more names and their RGB values, if you're really feeling artistic. The background color cannot be changed.
|
|
||||||
|
|
||||||
## Fonts for List
|
|
||||||
|
|
||||||
There are two options for fonts that will be used in the prayer request list.
|
|
||||||
|
|
||||||
* “Native Fonts” uses a list of fonts that will render the prayer requests in the best available font for their device, whether that is a desktop or laptop computer, mobile device, or tablet. (This is the default for new small groups.)
|
|
||||||
* “Named Fonts” uses a comma-separated list of fonts that you specify. A warning is good here; just because you have an obscure font and like the way that it looks does not mean that others have that same font. It is generally best to stick with the fonts that come with Windows - fonts like “Arial”, “Times New Roman”, “Tahoma”, and “Comic Sans MS”. You should also end the font list with either “serif” or “sans-serif”, which will use the browser's default serif (like “Times New Roman”) or sans-serif (like “Arial”) font.
|
|
||||||
|
|
||||||
## Heading / List Text Size
|
|
||||||
|
|
||||||
This is the point size to use for each. The default for the heading is 16pt, and the default for the text is 12pt.
|
|
||||||
|
|
||||||
## Making a “Large Print” List
|
|
||||||
|
|
||||||
If your group is comprised mostly of people who prefer large print, the following settings will make your list look like the typical large-print publication:
|
|
||||||
|
|
||||||
> **Fonts**<br>
|
|
||||||
> Named Fonts: "Times New Roman",serif
|
|
||||||
>
|
|
||||||
> **Heading Text Size**<br>
|
|
||||||
> 18pt
|
|
||||||
>
|
|
||||||
> **List Text Size**<br>
|
|
||||||
> 16pt
|
|
||||||
|
|
||||||
## Request List Visibility
|
|
||||||
|
|
||||||
The group's request list can be either public, private, or password-protected. Public lists are available without logging in, and private lists are only available online to administrators (though the list can still be sent via e-mail by an administrator). Password-protected lists allow group members to log in and view the current request list online, using the “Group Log On” link and providing this password. As this is a shared password, it is stored in plain text, so you can easily see what it is. If you select “Password Protected” but do not enter a password, the list remains private, which is also the default value. (Changing this password will force all members of the group who logged in with the “Remember Me” box checked to provide the new password.)
|
|
||||||
|
|
||||||
## Time Zone
|
|
||||||
|
|
||||||
This is the time zone that you would like to use for your group. If you do not see your time zone listed, just [contact Daniel](mailto:daniel@bitbadger.solutions?subject=PrayerTracker%20Time%20Zone) and tell him what time zone you need.
|
|
||||||
|
|
||||||
## Page Size
|
|
||||||
|
|
||||||
As small groups use PrayerTracker, they accumulate many expired requests. When lists of requests that include expired requests, the results will be broken up into pages. The default value is 100 requests per page, but may be set as low as 10 or as high as 255.
|
|
||||||
|
|
||||||
## "As of" Date Display
|
|
||||||
|
|
||||||
PrayerTracker can display the last date a request was updated, at the end of the request text. By default, it does not. If you select a short date, it will show "(as of 10/11/2015)" (for October 11, 2015); if you select a long date, it will show "(as of Sunday, October 11, 2015)".
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
---
|
|
||||||
title: Log On
|
|
||||||
---
|
|
||||||
|
|
||||||
This page allows you to log on to PrayerTracker. There are two different levels of access for PrayerTracker - user and group.
|
|
||||||
|
|
||||||
## User Log On
|
|
||||||
|
|
||||||
Enter your e-mail address and password into the appropriate boxes, then select your group. If you want PrayerTracker to remember you on your computer, click the “Remember Me” box before clicking the “Log On” button.
|
|
||||||
|
|
||||||
## Group Log On
|
|
||||||
|
|
||||||
If your group has defined a password to use to allow you to view their request list online, select your group from the drop down list, then enter the group password into the appropriate box. If you want PrayerTracker to remember your group, click the “Remember Me” box before clicking the “Log On” button.
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
---
|
|
||||||
title: Change Your Password
|
|
||||||
---
|
|
||||||
|
|
||||||
This page will let you change your password. Enter your existing password in the top box, then enter your new password in the bottom two boxes. Entering your existing password is a security measure; with the “Remember Me” box on the log in page, this will prevent someone else who may be using your computer from being able to simply go to the site and change your password.
|
|
||||||
|
|
||||||
"If you cannot remember your existing password, we cannot retrieve it, but we can set it to something known so that you can then change it to your password. [Click here to request help resetting your password](mailto:daniel@bitbadger.solutions?subject=PrayerTracker%20Password%20Help).
|
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
---
|
|
||||||
title: Ayuda
|
|
||||||
skip_footer: true
|
|
||||||
---
|
|
||||||
|
|
||||||
En todo el sistema, verá un icono (un signo de interrogación en un círculo) junto al título de cada página. Al hacer clic en esta opción, se abrirá una nueva y pequeña ventana con instrucciones sobre cómo usar esa página. Si está buscando una descripción rápida de SeguidorOración, comience con las entradas "Agregar / Editar una Petición" y "Cambiar las Preferencias".
|
|
||||||
|
|
||||||
----
|
|
||||||
|
|
||||||
<p class="pt-center-text"><strong>Los Temas de Ayuda</strong></p>
|
|
||||||
|
|
||||||
[Cambiar las Preferencias](./small-group/preferences.html)
|
|
||||||
|
|
||||||
[Enviar un Anuncio](./small-group/announcement.html)
|
|
||||||
|
|
||||||
[Mantener los Miembros del Grupo](./small-group/members.html)
|
|
||||||
|
|
||||||
[Agregar / Editar una Petición](./requests/edit.html)
|
|
||||||
|
|
||||||
[Mantener las Peticiones](./requests/maintain.html)
|
|
||||||
|
|
||||||
[Ver la Lista de Peticiones](./requests/view.html)
|
|
||||||
|
|
||||||
[Iniciar Sesión](./user/log-on.html)
|
|
||||||
|
|
||||||
[Cambiar Su Contraseña](./user/password.html)
|
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
---
|
|
||||||
title: Agregar / Editar una Petición
|
|
||||||
---
|
|
||||||
|
|
||||||
Esta página le permite introducir o actualizar una petición de oración nueva.
|
|
||||||
|
|
||||||
## Tipo de Petición
|
|
||||||
|
|
||||||
Hay 5 tipos de peticiones en SeguidorOración. “Peticiones Actuales” son sus peticiones habituales que la gente pueda tener acerca de las cosas que suceden durante la próxima semana o así. “Peticiones a Largo Plazo” son peticiones que pueden ocurrir varias veces, o continuar indefinidamente. “Informes de Alabanza” son como “Peticiones Actuales”, pero son respuestas a la oración para compartir con su grupo. “Embarazada” es para aquellos que están embarazadas. “Anuncios” son como “Peticiones Actuales”, pero en lugar de una petición, simplemente se pasa la información a lo largo de algo por venir.
|
|
||||||
|
|
||||||
El orden anterior es el orden en que los tipos de peticiones aparecen en la lista. “Peticiones a Largo Plazo” y “Embarazada” no están sujetos a la caducidad automática (establecida en el “Cambiar las Preferencias” de la página) que las peticiones son otros.
|
|
||||||
|
|
||||||
## Fecha
|
|
||||||
|
|
||||||
Para nuevas peticiones, se trata de una caja con un selector de fechas del calendario. Haga clic en la pestaña o en la caja para mostrar el calendario, que será preseleccionada para la fecha de hoy. Para peticiones existentes, habrá una casilla de verificación “Seleccionar para no actualizar la fecha”. Esto puede ser usado si corrige la ortografía ni la puntuacion, y no tienen una actualización real de hacer la petición.
|
|
||||||
|
|
||||||
## Peticionario / Sujeto
|
|
||||||
|
|
||||||
Para las peticiones o alabanzas, este campo es el nombre de la persona que hizo la petición o que ofrece el informe de alabanza. Para los anuncios, este debe contener el objeto del anuncio. Para todos los tipos, es opcional, yo solía tener un anuncio con ningún tema que iba todas las semanas, diciendo a dónde enviar peticiones y actualizaciones.
|
|
||||||
|
|
||||||
## Expiración
|
|
||||||
|
|
||||||
“Expirará Normalmente” significa que la petición está sujeta a los días de vencimiento de las preferencias del grupo. “Petición no Expira Nunca” se puede utilizar para hacer una petición que no caduque nunca (nótese que esto es redundante para los tipos “Peticiones a Largo Plazo” y “Embarazada”). Si está editando una petición existente, aparece una tercera opción. “Expirará Inmediatamente” hará que la petición expirará cuando se guarda. Aparte de los iconos de la página de mantenimiento de las peticiones, ésta es la única otra forma de expirar peticiones del tipos “Peticiones a Largo Plazo” y “Embarazada”, pero puede ser utilizada para cualquier tipo de petición.
|
|
||||||
|
|
||||||
## Petición
|
|
||||||
|
|
||||||
Este es el texto de la petición. El editor ofrece muchas capacidades de formato, como "El Corrector Ortográfico al Escribir" (habilitado predeterminado), "Pegar desde Word" y "Pegar sin formato", así como "Código Fuente" punto de vista, si quieres editar el código HTML usted mismo. También es compatible con deshacer y rehacer, y el editor soporta modo de pantalla completa. Pase el ratón sobre cada icono para ver qué hace cada botón.
|
|
||||||
@@ -1,29 +0,0 @@
|
|||||||
---
|
|
||||||
title: Mantener las Peticiones
|
|
||||||
---
|
|
||||||
|
|
||||||
Desde esta página, usted puede agregar, editar y borrar sus peticiones actuales. También puede restaurar peticiones que han caducado, sino que debe ser activa, una vez más.
|
|
||||||
|
|
||||||
## Agregar una Nueva Petición
|
|
||||||
|
|
||||||
Para agregar una petición, haga clic en el icono o el texto en el centro de la página, debajo del título y por encima de la lista de peticiones para su grupo.
|
|
||||||
|
|
||||||
## Busca las Peticiones
|
|
||||||
|
|
||||||
Si está buscando una solicitud en particular, ingrese un texto en el cuadro de búsqueda y haga clic en “Buscar”. SeguidorOración buscará los campos de Solicitante / Asunto y Texto de solicitud (sin distinción de mayúsculas y minúsculas) de solicitudes activas e inactivas. Los resultados se mostrarán en el mismo formato que la página de solicitudes de mantenimiento original, por lo que los botones que se describen a continuación funcionarán igual para esas solicitudes. También se mostrarán en las páginas, si hay muchos resultados; el número por página es configurable por grupos pequeños.
|
|
||||||
|
|
||||||
## Editar la Petición
|
|
||||||
|
|
||||||
Para editar una petición, haga clic en el icono de lápiz, el primer icono bajo el título de columna “Acciones”.
|
|
||||||
|
|
||||||
## Expirar una petición
|
|
||||||
|
|
||||||
Para las peticiones activas, el segundo icono es un ojo con una barra a través de él; Si hace clic en este icono, la petición se cancelará inmediatamente. Esto equivale a editar la petición, seleccionar "Expirará Inmediatamente" y guardarla.
|
|
||||||
|
|
||||||
## Restaurar una Petición Inactivo
|
|
||||||
|
|
||||||
Cuando la página se muestra por primera vez, que no muestra peticiones inactivos. Sin embargo, al hacer clic en el vínculo en la parte inferior de la página se actualizará la página con las peticiones se muestran inactivos. El icono del centro se verá como un ojo; Haciendo clic en él, restaurará la petición como una petición activa. La última fecha actualizada será actual, y la petición se establece para caducar normalmente.
|
|
||||||
|
|
||||||
## Eliminar una Petición
|
|
||||||
|
|
||||||
Eliminación de una petición es contraria a la intención de SeguidorOración, como se puede recuperar peticiones que han expirado. Sin embargo, si hay una solicitud que debe ser eliminado, haga clic en el icono de la papelera en la columna “Acciones” le permitirá hacerlo. Utilice esta opción con cuidado, ya que estas supresiones no se puede deshacer, una vez a la petición se ha borrado, ha desaparecido para siempre.
|
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
---
|
|
||||||
title: Ver la Lista de Peticiones
|
|
||||||
---
|
|
||||||
|
|
||||||
Desde esta página, puede ver la lista de peticiones (para hoy o para el próximo Domingo), ver una versión imprimible de la lista, y por correo electrónico la lista de los miembros de su grupo. (NOTA: Si usted está registrado como miembro de la clase, la única opción que se ve es para ver una lista para imprimir.)
|
|
||||||
|
|
||||||
## Lista para el Próximo Domingo
|
|
||||||
|
|
||||||
Esto modificará la fecha de la lista, por lo que se verá como es en la actualidad el próximo Domingo. Esto puede ser usado, por ejemplo, para ver lo que peticiones de caducidad, ni le permite imprimir una lista con la fecha del Domingo en la noche del Sábado. Tenga en cuenta que este enlace no aparece si es Domingo.
|
|
||||||
|
|
||||||
## Versión Imprimible
|
|
||||||
|
|
||||||
Hacer clic en este vínculo, se muestra la lista en un formato que sea adecuado para imprimir, sino que no tiene el encabezado normal de SeguidorOración en la parte superior. Una vez que haya hecho clic en el enlace, se puede imprimir con el navegador estándar de “Imprimir” funcionalidad.
|
|
||||||
|
|
||||||
## Enviar por correo electrónico
|
|
||||||
|
|
||||||
Al hacer clic en este enlace le enviará la lista que está viendo en ese momento a los miembros del grupo. La página te recordará que estás a punto de hacerlo, y pedir su confirmación. Si continúa, usted verá una página que muestra a la que la lista fue enviado, y lo que la lista parecía. Usted puede utilizar con seguridad de su navegador botón “Atrás” para navegar fuera de la página.
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
---
|
|
||||||
title: Enviar un Anuncio
|
|
||||||
---
|
|
||||||
|
|
||||||
## Texto del Anuncio
|
|
||||||
|
|
||||||
Este es el texto del anuncio que desea enviar. Funciona de la misma forma que el cuadro de texto en [la página “Editar la Petición”](../requests/edit.html#peticion).
|
|
||||||
|
|
||||||
## Agregar a la Lista de Peticiones En
|
|
||||||
|
|
||||||
Sin esta caja marcada, el texto del anuncio sólo será por correo electrónico a los miembros del su grupo. Si marca esta caja, sin embargo, el texto del anuncio será añadido a su lista de oración en la sección que ha seleccionado.
|
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
---
|
|
||||||
title: Mantener los Miembros del Grupo
|
|
||||||
---
|
|
||||||
|
|
||||||
Desde esta página, usted puede agregar, editar y eliminar las direcciones de correo electrónico para su grupo.
|
|
||||||
|
|
||||||
## Añadir un Nuevo Miembro del Grupo
|
|
||||||
|
|
||||||
Para agregar una dirección de correo electrónico, haga clic en el icono o el texto en el centro de la página, debajo del título y por encima de la lista de direcciones para su grupo.
|
|
||||||
|
|
||||||
## Editar el Miembro del Grupo
|
|
||||||
|
|
||||||
Para editar una dirección de correo electrónico, haga clic en el icono de lápiz, es el primer icono bajo el título de columna “Acciones”. Esto le permitirá actualizar el nombre y / o la dirección de correo electrónico para ese miembro.
|
|
||||||
|
|
||||||
## Eliminar un Miembro del Grupo
|
|
||||||
|
|
||||||
Para eliminar una dirección de correo electrónico, haga clic en el icono de la papelera en la columna “Acciones”. Tenga en cuenta que una vez que la dirección de correo electrónico se ha eliminado, se ha ido. (Por supuesto, si usted lo elimine por error, se puede entrar de nuevo utilizando la opción “Agregar” instrucciones de arriba.)
|
|
||||||
@@ -1,73 +0,0 @@
|
|||||||
---
|
|
||||||
title: Cambiar las Preferencias
|
|
||||||
---
|
|
||||||
|
|
||||||
Esta página le permite cambiar la forma en que su lista de peticiones de la oración se ve y se comporta. Cada sección se aborda más adelante.
|
|
||||||
|
|
||||||
## Peticiones Expiran Después de
|
|
||||||
|
|
||||||
Cuando una petición regular va esta cantidad de días sin actualizar, caduca y ya no aparece en la lista de peticiones. Tenga en cuenta que las categorías “Peticiones a Largo Plazo” y “Embarazada” no expirará automáticamente.
|
|
||||||
|
|
||||||
## Peticiones “Nuevas” Para
|
|
||||||
|
|
||||||
Peticiones que han sido actualizadas dentro de esta cantidad de días se identifican por un círculo hueco para su bala, en oposición a un círculo relleno para otras peticiones. Todas las categorías respetar esta opción. Si usted hace una corrección de errata en una petición, si no marque la caja para actualizar la fecha, este valor va a cambiar la bala. (NOTA: En el texto sin formato de correo electrónico, las nuevas solicitudes se identifican con un símbolo “+”, y pide a los viejos se identifican con un símbolo “-”.)
|
|
||||||
|
|
||||||
## Peticiones a Largo Plazo Alertó para la Actualización
|
|
||||||
|
|
||||||
Peticiones que no han sido actualizados en esta semana muchos se identifican con un tipo de letra cursiva en la página “Mantener las Peticiones”, para recordarle que debe buscar novedades en estas peticiones para que vuestras oraciones pueden permanecer relevante y actual.
|
|
||||||
|
|
||||||
## Orden de Peticiones
|
|
||||||
|
|
||||||
De forma predeterminada, las solicitudes se ordenan dentro de cada grupo por la última fecha de actualización, con el más reciente en la parte superior. Si prefiere tener la lista ordenada por el solicitante o el sujeto en vez de por fecha, seleccione “Ordenar por Nombre del Solicitante” en su lugar.
|
|
||||||
|
|
||||||
## Correo Electrónico “De” Nombre y Dirección
|
|
||||||
|
|
||||||
SeguidorOración debe poner el nombre y la dirección de correo electrónico en el “de” posición de cada correo electrónico que envía. El nombre predeterminado es “PrayerTracker”, y el valor predeterminado dirección de correo electrónico es “prayer@djs-consulting.com”. Esto funciona, pero los mensajes devueltos, y las respuestas de fuera de la oficina serán enviados a esa dirección (que no es ni siquiera una dirección real). Cambiar por lo menos la dirección de correo electrónico a su dirección se asegurará de que usted recibe estos correos electrónicos, y se puede podar su lista de correo electrónico en consecuencia.
|
|
||||||
|
|
||||||
## Formato de Correo Electrónico
|
|
||||||
|
|
||||||
Este es el valor predeterminado formato de correo electrónico para su grupo. El valor predeterminado de SeguidorOración es HTML, el cual envía la lista al igual que usted lo ve en el sitio. Sin embargo, algunos clientes de correo electrónico no puede mostrar esto correctamente, para que pueda elegir el correo electrónico a un formato de texto plano predeterminadas, que no tiene colores, cursiva, u otro formato. La configuración en esta página es el valor predeterminado del grupo, se puede seleccionar un formato para cada destinatario de la página “Mantener los Miembros del Grupo”.
|
|
||||||
|
|
||||||
## Colores
|
|
||||||
|
|
||||||
Usted puede personalizar los colores que se utilizan para las partidas y líneas en su lista de peticiones. Puede seleccionar uno de los 16 colores con nombre en las listas desplegables, o puede “mezclar su propia” en colores rojo, verde y azul (RGB) valores entre 0 y 255. Hay un enlace en la parte inferior de la página para una lista de colores con más nombres y sus valores RGB, si realmente estás sintiendo artística. El color de fondo no puede ser cambiado.
|
|
||||||
|
|
||||||
## Fuentes de la Lista
|
|
||||||
|
|
||||||
Hay dos opciones para las fuentes que se utilizarán en la lista de peticiones de oración.
|
|
||||||
|
|
||||||
* “Fuentes Nativas” utiliza una lista de fuentes que representarán las peticiones de oración en la mejor fuente disponible para su dispositivo, ya sea una computadora de escritorio o portátil, un dispositivo móvil o una tableta. (Este es el valor predeterminado para los nuevos grupos pequeños).
|
|
||||||
* “Fuentes con Nombre” utiliza una lista de fuentes separadas por comas que usted especifica. Una advertencia de que es bueno aquí, sólo porque usted tiene una fuente oscura y gusta la forma en que se vea no significa que los demás tienen de que la misma fuente. Generalmente es mejor quedarse con las fuentes que vienen con Windows - Fuentes como “Arial”, “Times New Roman”, “Tahoma”, y “Comic Sans MS”. También debe poner fin a la lista de fuentes, ya sea con “serif” o el “sans-serif”, que utilizará el fuente serif predeterminado (como “Times New Roman”) o el fuente sans-serif predeterminado (como “Arial”).
|
|
||||||
|
|
||||||
## Tamaño del Texto de Partida y Lista
|
|
||||||
|
|
||||||
Este es el tamaño de punto a utilizar para cada uno. El valor predeterminado para el título es 16 puntos, y el valor por defecto para el texto es 12 puntos.
|
|
||||||
|
|
||||||
## Realización de una Lista de “Letra Grande”
|
|
||||||
|
|
||||||
Si el grupo está compuesta en su mayoría de la gente que prefiere letras grandes, los siguientes ajustes harán que su lista de parecerse a la típica la publicación “Letra Grande”:
|
|
||||||
|
|
||||||
> **Fuentes**<br>
|
|
||||||
> Fuentes con Nombre: "Times New Roman",serif
|
|
||||||
>
|
|
||||||
> **Partida el Tamaño del Texto**<br>
|
|
||||||
> 18pt
|
|
||||||
>
|
|
||||||
> **Lista el Tamaño del Texto**<br>
|
|
||||||
> 16pt
|
|
||||||
|
|
||||||
## La Visibilidad del la Lista de las Peticiones
|
|
||||||
|
|
||||||
La lista de peticiones del grupo puede ser pública, privada o protegida por contraseña. Las listas públicas están disponibles sin iniciar sesión, y listas privadas sólo están disponibles en línea a los administradores (aunque la lista todavía puede ser enviado por correo electrónico por el administrador). Protegidos con contraseña listas permiten miembros del grupo iniciar sesión y ver la lista de peticiones actual en el sito, utilizando el "Iniciar Sesión como Grupo" enlace y proporcionar la contraseña. Como se trata de una contraseña compartida, se almacena en texto plano, así que usted puede ver fácilmente lo que es. Si selecciona "Protegido por Contraseña" pero no introduce una contraseña, la lista sigue siendo privado, que también es el valor predeterminado. (Cambiar esta contraseña obligará a todos los miembros del grupo que se iniciar sesión en el "Acuérdate de Mí" caja marcada para proporcionar la nueva contraseña.)
|
|
||||||
|
|
||||||
## Zona Horaria
|
|
||||||
|
|
||||||
Esta es la zona horaria que desea utilizar para su clase. Si no puede ver la zona horaria en la lista, ponte en [contacto con Daniel](mailto:daniel@bitbadger.solutions?subject=Zona%20Horaria%20por%20SeguidorOración) y decirle lo que la zona horaria que usted necesita.
|
|
||||||
|
|
||||||
## Tamaño de Página
|
|
||||||
|
|
||||||
A medida que los grupos pequeños utilizan SeguidorOración, acumulan muchas solicitudes caducadas. Cuando las listas de solicitudes que incluyen solicitudes caducadas, los resultados se dividirán en páginas. El valor predeterminado es de 100 solicitudes por página, pero se puede establecer tan bajo como 10 o tan alto como 255.
|
|
||||||
|
|
||||||
## Visualización de la Fecha “Como de”
|
|
||||||
|
|
||||||
SeguidorOración puede mostrar la última fecha en que se actualizó una solicitud, al final del texto de solicitud. Por defecto, no lo hace. Si selecciona una fecha corta, se mostrará "(como de 11/10/2015)" (para el 11 de octubre de 2015); si selecciona una fecha larga, se mostrará "(como de domingo, 11 de octubre de 2015)".
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
---
|
|
||||||
title: Iniciar Sesión
|
|
||||||
---
|
|
||||||
|
|
||||||
Esta página le permite acceder a SeguidorOración. Hay dos diferentes niveles de acceso para SeguidorOración - el usuario y el grupo.
|
|
||||||
|
|
||||||
## Iniciar Sesión como Usuario
|
|
||||||
|
|
||||||
Introduzca su dirección de correo electrónico y contraseña en las cajas apropiadas y seleccione su grupo. Si desea que SeguidorOración que le recuerde en su ordenador, haga clic en “Acuérdate de Mí” caja antes de pulsar el “Iniciar Sesión” botón.
|
|
||||||
|
|
||||||
## Iniciar Sesión como Grupo
|
|
||||||
|
|
||||||
Si el grupo se ha definido una contraseña para usar que le permite ver su lista de peticiones en línea, seleccionar el grupo en la lista desplegable y introduzca la contraseña del grupo en la caja correspondiente. Si desea que SeguidorOración recuerde su grupo, haga clic en “Acuérdate de Mí” caja antes de pulsar el “Iniciar Sesión” botón.
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
---
|
|
||||||
title: Cambiar Su Contraseña
|
|
||||||
---
|
|
||||||
|
|
||||||
Esta página le permitirá cambiar su contraseña. Ingrese su contraseña actual en la caja superior y introduzca la nueva contraseña en la parte inferior dos cajas. Al entrar su contraseña actual es una medida de seguridad, con el “Acuérdate de Mí” caja de la página inicio de sesión, esto evitará que otra persona que pueda estar usando su computadora de la posibilidad de simplemente ir a el sitio y cambiar la contraseña.
|
|
||||||
|
|
||||||
Si no recuerdas tu contraseña actual, no podemos recuperar, pero podemos ponerlo en algo que se conoce de modo que usted puede cambiarlo a su contraseña. [Haga clic aquí para solicitar ayuda para restablecer su contraseña](mailto:daniel@bitbadger.solutions?subject=Ayuda%20de%20Contraseña%20de%20SeguidorOración).
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
---
|
|
||||||
title: Help / Ayuda
|
|
||||||
layout: home
|
|
||||||
---
|
|
||||||
|
|
||||||
## [English](/en)
|
|
||||||
|
|
||||||
## [Español](/es)
|
|
||||||
7
fake.sh
7
fake.sh
@@ -1,7 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
set -eu
|
|
||||||
set -o pipefail
|
|
||||||
|
|
||||||
dotnet tool restore
|
|
||||||
dotnet fake "$@"
|
|
||||||
456
src/Data/Access.fs
Normal file
456
src/Data/Access.fs
Normal file
@@ -0,0 +1,456 @@
|
|||||||
|
namespace PrayerTracker.Data
|
||||||
|
|
||||||
|
/// Table names
|
||||||
|
[<RequireQualifiedAccess>]
|
||||||
|
module Table =
|
||||||
|
|
||||||
|
/// The church table
|
||||||
|
[<Literal>]
|
||||||
|
let Church = "church"
|
||||||
|
|
||||||
|
/// The small group table
|
||||||
|
[<Literal>]
|
||||||
|
let Group = "small_group"
|
||||||
|
|
||||||
|
/// The small group member table
|
||||||
|
[<Literal>]
|
||||||
|
let Member = "member"
|
||||||
|
|
||||||
|
/// The prayer request table
|
||||||
|
[<Literal>]
|
||||||
|
let Request = "prayer_request"
|
||||||
|
|
||||||
|
/// The user table
|
||||||
|
[<Literal>]
|
||||||
|
let User = "pt_user"
|
||||||
|
|
||||||
|
|
||||||
|
open System
|
||||||
|
open NodaTime
|
||||||
|
open PrayerTracker.Entities
|
||||||
|
|
||||||
|
/// JSON serialization customizations
|
||||||
|
[<RequireQualifiedAccess>]
|
||||||
|
module Json =
|
||||||
|
|
||||||
|
open System.Text.Json.Serialization
|
||||||
|
|
||||||
|
/// Convert a wrapped DU to/from its string representation
|
||||||
|
type WrappedJsonConverter<'T>(wrap: string -> 'T, unwrap: 'T -> string) =
|
||||||
|
inherit JsonConverter<'T>()
|
||||||
|
override _.Read(reader, _, _) = wrap (reader.GetString())
|
||||||
|
override _.Write(writer, value, _) = writer.WriteStringValue(unwrap value)
|
||||||
|
|
||||||
|
open System.Text.Json
|
||||||
|
open NodaTime.Serialization.SystemTextJson
|
||||||
|
|
||||||
|
/// JSON serializer options to support the target domain
|
||||||
|
let options =
|
||||||
|
let opts = JsonSerializerOptions()
|
||||||
|
|
||||||
|
[ WrappedJsonConverter<AsOfDateDisplay>(AsOfDateDisplay.Parse, string) :> JsonConverter
|
||||||
|
WrappedJsonConverter<EmailFormat>(EmailFormat.Parse, string)
|
||||||
|
WrappedJsonConverter<Expiration>(Expiration.Parse, string)
|
||||||
|
WrappedJsonConverter<PrayerRequestType>(PrayerRequestType.Parse, string)
|
||||||
|
WrappedJsonConverter<RequestSort>(RequestSort.Parse, string)
|
||||||
|
WrappedJsonConverter<TimeZoneId>(TimeZoneId, string)
|
||||||
|
WrappedJsonConverter<ChurchId>(Guid.Parse >> ChurchId, string)
|
||||||
|
WrappedJsonConverter<MemberId>(Guid.Parse >> MemberId, string)
|
||||||
|
WrappedJsonConverter<PrayerRequestId>(Guid.Parse >> PrayerRequestId, string)
|
||||||
|
WrappedJsonConverter<SmallGroupId>(Guid.Parse >> SmallGroupId, string)
|
||||||
|
WrappedJsonConverter<UserId>(Guid.Parse >> UserId, string)
|
||||||
|
JsonFSharpConverter() ]
|
||||||
|
|> List.iter opts.Converters.Add
|
||||||
|
|
||||||
|
let _ = opts.ConfigureForNodaTime DateTimeZoneProviders.Tzdb
|
||||||
|
opts.PropertyNamingPolicy <- JsonNamingPolicy.CamelCase
|
||||||
|
opts.DefaultIgnoreCondition <- JsonIgnoreCondition.WhenWritingNull
|
||||||
|
opts
|
||||||
|
|
||||||
|
|
||||||
|
module private Helpers =
|
||||||
|
let instant (it: Instant) =
|
||||||
|
it.ToString()
|
||||||
|
|
||||||
|
open BitBadger.Documents
|
||||||
|
open BitBadger.Documents.Sqlite
|
||||||
|
|
||||||
|
/// Establish the required data environment
|
||||||
|
[<RequireQualifiedAccess>]
|
||||||
|
module Connection =
|
||||||
|
|
||||||
|
open System.Text.Json
|
||||||
|
|
||||||
|
/// Ensure tables and indexes are defined
|
||||||
|
let setUp () =
|
||||||
|
backgroundTask {
|
||||||
|
Configuration.useIdField "id"
|
||||||
|
|
||||||
|
Configuration.useSerializer
|
||||||
|
{ new IDocumentSerializer with
|
||||||
|
member _.Serialize<'T>(it: 'T) =
|
||||||
|
JsonSerializer.Serialize(it, Json.options)
|
||||||
|
|
||||||
|
member _.Deserialize<'T>(it: string) =
|
||||||
|
JsonSerializer.Deserialize<'T>(it, Json.options) }
|
||||||
|
|
||||||
|
let! tables = Custom.list<string> "SELECT name FROM sqlite_master WHERE type = 'table'" [] _.GetString(0)
|
||||||
|
|
||||||
|
if not (List.contains Table.Church tables) then
|
||||||
|
do! Definition.ensureTable Table.Church
|
||||||
|
|
||||||
|
if not (List.contains Table.Group tables) then
|
||||||
|
do! Definition.ensureTable Table.Group
|
||||||
|
do! Definition.ensureFieldIndex Table.Group "church" [ "churchId" ]
|
||||||
|
|
||||||
|
if not (List.contains Table.Member tables) then
|
||||||
|
do! Definition.ensureTable Table.Member
|
||||||
|
do! Definition.ensureFieldIndex Table.Member "group" [ "smallGroupId" ]
|
||||||
|
|
||||||
|
if not (List.contains Table.Request tables) then
|
||||||
|
do! Definition.ensureTable Table.Request
|
||||||
|
do! Definition.ensureFieldIndex Table.Request "group" [ "smallGroupId" ]
|
||||||
|
|
||||||
|
if not (List.contains Table.User tables) then
|
||||||
|
do! Definition.ensureTable Table.User
|
||||||
|
do! Definition.ensureFieldIndex Table.User "email" [ "email" ]
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
open Microsoft.Data.Sqlite
|
||||||
|
|
||||||
|
/// Functions to retrieve small group information
|
||||||
|
module SmallGroups =
|
||||||
|
|
||||||
|
/// Query to retrieve data for a small group info instance
|
||||||
|
let private infoQuery =
|
||||||
|
$"SELECT g.data->>'id' AS id, g.data->>'name' AS groupName, c.data->>'name' AS churchName,
|
||||||
|
g.data->'preferences'->>'timeZoneId' AS timeZoneId, g.data->'preferences'->>'isPublic' AS isPublic
|
||||||
|
FROM {Table.Group} g
|
||||||
|
INNER JOIN {Table.Church} c ON c.data->>'id' = g.data->>'churchId'"
|
||||||
|
|
||||||
|
/// Query to retrieve data for a small group select list item
|
||||||
|
let private itemQuery =
|
||||||
|
$"SELECT g.data->>'name' AS groupName, g.data->>'id' AS id, c.data->>'name' AS churchName
|
||||||
|
FROM {Table.Group} g
|
||||||
|
INNER JOIN {Table.Church} c ON c.data->>'id' = g.data->>'churchId'"
|
||||||
|
|
||||||
|
/// The ORDER BY clause for select list item queries
|
||||||
|
let private itemOrderBy =
|
||||||
|
Query.orderBy
|
||||||
|
[ { Field.Named "name" with Qualifier = Some "c" }; { Field.Named "name" with Qualifier = Some "g" } ]
|
||||||
|
SQLite
|
||||||
|
|
||||||
|
/// Map a row to a Small Group list item
|
||||||
|
let private toSmallGroupItem (rdr: SqliteDataReader) =
|
||||||
|
(rdr.GetOrdinal >> rdr.GetString >> Guid.Parse >> Giraffe.ShortGuid.fromGuid) "id",
|
||||||
|
$"""{(rdr.GetOrdinal >> rdr.GetString) "churchName"} | {(rdr.GetOrdinal >> rdr.GetString) "groupName"}"""
|
||||||
|
|
||||||
|
/// Get the group IDs for the given church
|
||||||
|
let internal groupIdsByChurch (churchId: ChurchId) =
|
||||||
|
backgroundTask {
|
||||||
|
let! groups = Find.byFields<SmallGroup> Table.Group All [ Field.Equal "churchId" (string churchId) ]
|
||||||
|
return groups |> List.map _.Id
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Count the number of small groups for a church
|
||||||
|
let countByChurch (churchId: ChurchId) =
|
||||||
|
Count.byFields Table.Group All [ Field.Equal "churchId" (string churchId) ]
|
||||||
|
|
||||||
|
/// Delete a small group by its ID
|
||||||
|
let deleteById (groupId: SmallGroupId) =
|
||||||
|
backgroundTask {
|
||||||
|
use conn = Configuration.dbConn ()
|
||||||
|
use! txn = conn.BeginTransactionAsync()
|
||||||
|
|
||||||
|
let! users =
|
||||||
|
Find.byFields<User> Table.User All [ Field.InArray "smallGroups" Table.User [ (string groupId) ] ]
|
||||||
|
|
||||||
|
for user in users do
|
||||||
|
do! Patch.byId Table.User user.Id {| SmallGroups = user.SmallGroups |> List.except [ groupId ] |}
|
||||||
|
|
||||||
|
do! conn.deleteByFields Table.Request All [ Field.Equal "smallGroupId" (string groupId) ]
|
||||||
|
do! conn.deleteById Table.Group (string groupId)
|
||||||
|
|
||||||
|
do! txn.CommitAsync()
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Get information for all small groups
|
||||||
|
let infoForAll () =
|
||||||
|
Custom.list $"{infoQuery} ORDER BY g.data->>'name'" [] SmallGroupInfo.FromReader
|
||||||
|
|
||||||
|
/// Get a list of small group IDs along with a description that includes the church name
|
||||||
|
let listAll () =
|
||||||
|
Custom.list $"{itemQuery} {itemOrderBy}" [] toSmallGroupItem
|
||||||
|
|
||||||
|
/// Get a list of small group IDs and descriptions for groups with a group password
|
||||||
|
let listProtected () =
|
||||||
|
Custom.list
|
||||||
|
$"{itemQuery} WHERE COALESCE(g.data->'preferences'->>'groupPassword', '') <> '' {itemOrderBy}"
|
||||||
|
[]
|
||||||
|
toSmallGroupItem
|
||||||
|
|
||||||
|
/// Get a list of small group IDs and descriptions for groups that are public or have a group password
|
||||||
|
let listPublicAndProtected () =
|
||||||
|
Custom.list
|
||||||
|
$"{infoQuery}
|
||||||
|
WHERE g.data->'preferences'->>'isPublic' = TRUE
|
||||||
|
OR COALESCE(g.data->'preferences'->>'groupPassword', '') <> ''
|
||||||
|
{itemOrderBy}"
|
||||||
|
[]
|
||||||
|
SmallGroupInfo.FromReader
|
||||||
|
|
||||||
|
/// Log on for a small group (includes list preferences)
|
||||||
|
let logOn (groupId: SmallGroupId) (password: string) =
|
||||||
|
Find.firstByFields<SmallGroup>
|
||||||
|
Table.Group
|
||||||
|
All
|
||||||
|
[ Field.Equal "id" (string groupId); Field.Equal "preferences.groupPassword" password ]
|
||||||
|
|
||||||
|
/// Save a small group
|
||||||
|
let save group = save<SmallGroup> Table.Group group
|
||||||
|
|
||||||
|
/// Save a small group's list preferences
|
||||||
|
let savePreferences (groupId: SmallGroupId) (pref: ListPreferences) =
|
||||||
|
Patch.byId Table.Group (string groupId) {| Preferences = pref |}
|
||||||
|
|
||||||
|
/// Get a small group by its ID (including list preferences)
|
||||||
|
let tryById groupId =
|
||||||
|
Find.byId<SmallGroupId, SmallGroup> Table.Group groupId
|
||||||
|
|
||||||
|
|
||||||
|
/// Functions to manipulate churches
|
||||||
|
module Churches =
|
||||||
|
|
||||||
|
/// Get a list of all churches
|
||||||
|
let all () = Find.all<Church> Table.Church
|
||||||
|
|
||||||
|
/// Delete a church by its ID
|
||||||
|
let deleteById churchId =
|
||||||
|
backgroundTask {
|
||||||
|
use conn = Configuration.dbConn ()
|
||||||
|
use! txn = conn.BeginTransactionAsync()
|
||||||
|
|
||||||
|
let! groupIds = SmallGroups.groupIdsByChurch churchId
|
||||||
|
let gIdStrings = groupIds |> List.map string
|
||||||
|
|
||||||
|
do! Delete.byFields Table.Request All [ Field.In "smallGroupId" gIdStrings ]
|
||||||
|
|
||||||
|
let! users = Find.byFields<User> Table.User All [ Field.InArray "smallGroups" Table.User gIdStrings ]
|
||||||
|
|
||||||
|
for user in users do
|
||||||
|
do! Patch.byId Table.User (string user.Id) {| SmallGroups = user.SmallGroups |> List.except groupIds |}
|
||||||
|
|
||||||
|
do! Delete.byFields Table.Group All [ Field.Equal "churchId" (string churchId) ]
|
||||||
|
do! Delete.byId Table.Church (string churchId)
|
||||||
|
do! txn.CommitAsync()
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Save a church's information
|
||||||
|
let save church = save<Church> Table.Church church
|
||||||
|
|
||||||
|
/// Find a church by its ID
|
||||||
|
let tryById churchId =
|
||||||
|
Find.byId<ChurchId, Church> Table.Church churchId
|
||||||
|
|
||||||
|
|
||||||
|
/// Functions to manipulate small group members
|
||||||
|
module Members =
|
||||||
|
|
||||||
|
/// Count members for the given small group
|
||||||
|
let countByGroup (groupId: SmallGroupId) =
|
||||||
|
Count.byFields Table.Member All [ Field.Equal "smallGroupId" (string groupId) ]
|
||||||
|
|
||||||
|
/// Delete a small group member by its ID
|
||||||
|
let deleteById (memberId: MemberId) = Delete.byId Table.Member (string memberId)
|
||||||
|
|
||||||
|
/// Retrieve all members for a given small group
|
||||||
|
let forGroup (groupId: SmallGroupId) =
|
||||||
|
Find.byFieldsOrdered<Member>
|
||||||
|
Table.Member
|
||||||
|
All
|
||||||
|
[ Field.Equal "smallGroupId" (string groupId) ]
|
||||||
|
[ Field.Named "memberName" ]
|
||||||
|
|
||||||
|
/// Save a small group member
|
||||||
|
let save mbr = save<Member> Table.Member mbr
|
||||||
|
|
||||||
|
/// Retrieve a small group member by its ID
|
||||||
|
let tryById memberId =
|
||||||
|
Find.byId<MemberId, Member> Table.Member memberId
|
||||||
|
|
||||||
|
|
||||||
|
/// Options to retrieve a list of requests
|
||||||
|
type PrayerRequestOptions =
|
||||||
|
{
|
||||||
|
/// The small group for which requests should be retrieved
|
||||||
|
SmallGroup: SmallGroup
|
||||||
|
|
||||||
|
/// The clock instance to use for date/time manipulation
|
||||||
|
Clock: IClock
|
||||||
|
|
||||||
|
/// The date for which the list is being retrieved
|
||||||
|
ListDate: LocalDate option
|
||||||
|
|
||||||
|
/// Whether only active requests should be retrieved
|
||||||
|
ActiveOnly: bool
|
||||||
|
|
||||||
|
/// The page number, for paged lists
|
||||||
|
PageNumber: int
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// Functions to manipulate prayer requests
|
||||||
|
module PrayerRequests =
|
||||||
|
|
||||||
|
/// Central place to append sort criteria for prayer request queries
|
||||||
|
let private orderBy sort =
|
||||||
|
match sort with
|
||||||
|
| SortByDate -> [ Field.Named "updatedDate DESC"; Field.Named "enteredDate DESC"; Field.Named "requestor" ]
|
||||||
|
| SortByRequestor -> [ Field.Named "requestor"; Field.Named "updatedDate DESC"; Field.Named "enteredDate DESC" ]
|
||||||
|
|> fun fields -> Query.orderBy fields SQLite
|
||||||
|
|
||||||
|
/// Paginate a prayer request query
|
||||||
|
let private paginate (pageNbr: int) pageSize =
|
||||||
|
if pageNbr > 0 then
|
||||||
|
$"LIMIT {pageSize} OFFSET {(pageNbr - 1) * pageSize}"
|
||||||
|
else
|
||||||
|
""
|
||||||
|
|
||||||
|
/// Count the number of prayer requests for a church
|
||||||
|
let countByChurch churchId =
|
||||||
|
backgroundTask {
|
||||||
|
let! groupIds = SmallGroups.groupIdsByChurch churchId
|
||||||
|
return! Count.byFields Table.Request All [ Field.In "smallGroupId" (List.map string groupIds) ]
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Count the number of prayer requests for a small group
|
||||||
|
let countByGroup (groupId: SmallGroupId) =
|
||||||
|
Count.byFields Table.Request All [ Field.Equal "smallGroupId" (string groupId) ]
|
||||||
|
|
||||||
|
/// Delete a prayer request by its ID
|
||||||
|
let deleteById (reqId: PrayerRequestId) = Delete.byId Table.Request (string reqId)
|
||||||
|
|
||||||
|
/// Get all (or active) requests for a small group as of now or the specified date
|
||||||
|
let forGroup (opts: PrayerRequestOptions) =
|
||||||
|
let theDate = defaultArg opts.ListDate (opts.SmallGroup.LocalDateNow opts.Clock)
|
||||||
|
|
||||||
|
let sql, parameters =
|
||||||
|
if opts.ActiveOnly then
|
||||||
|
let expDate =
|
||||||
|
(theDate.AtStartOfDayInZone(opts.SmallGroup.TimeZone)
|
||||||
|
- Duration.FromDays opts.SmallGroup.Preferences.DaysToExpire)
|
||||||
|
.ToInstant()
|
||||||
|
$"""AND ( date(data->>'updatedDate') > date(:updatedDate)
|
||||||
|
OR data->>'expiration' = :expManual
|
||||||
|
OR data->>'requestType' IN (:typLongTerm, :typExpecting))
|
||||||
|
AND data->>'expiration' <> :expForced""",
|
||||||
|
[ SqliteParameter(":updatedDate", string expDate)
|
||||||
|
SqliteParameter(":expManual", string Manual)
|
||||||
|
SqliteParameter(":typLongTerm", string LongTermRequest)
|
||||||
|
SqliteParameter(":typExpecting", string Expecting)
|
||||||
|
SqliteParameter(":expForced", string Forced) ]
|
||||||
|
else
|
||||||
|
"", []
|
||||||
|
|
||||||
|
Custom.list
|
||||||
|
$"SELECT data FROM {Table.Request}
|
||||||
|
WHERE data->>'smallGroupId' = :groupId
|
||||||
|
{sql}
|
||||||
|
{orderBy opts.SmallGroup.Preferences.RequestSort}
|
||||||
|
{paginate opts.PageNumber opts.SmallGroup.Preferences.PageSize}"
|
||||||
|
(SqliteParameter(":groupId", string opts.SmallGroup.Id) :: parameters)
|
||||||
|
fromData<PrayerRequest>
|
||||||
|
|
||||||
|
/// Save a prayer request
|
||||||
|
let save req = save<PrayerRequest> Table.Request req
|
||||||
|
|
||||||
|
/// Search prayer requests for the given term
|
||||||
|
let searchForGroup group searchTerm pageNbr =
|
||||||
|
let pct = "%"
|
||||||
|
Custom.list
|
||||||
|
$"WITH results AS (
|
||||||
|
SELECT data FROM {Table.Request}
|
||||||
|
WHERE data->>'smallGroupId' = :groupId
|
||||||
|
AND data->>'text' LIKE :search
|
||||||
|
UNION
|
||||||
|
SELECT data FROM {Table.Request}
|
||||||
|
WHERE data->>'smallGroupId' = :groupId
|
||||||
|
AND COALESCE(data->>'requestor', '') LIKE :search)
|
||||||
|
SELECT data FROM results
|
||||||
|
{orderBy group.Preferences.RequestSort}
|
||||||
|
{paginate pageNbr group.Preferences.PageSize}"
|
||||||
|
[ SqliteParameter(":groupId", string group.Id); SqliteParameter(":search", $"{pct}%s{searchTerm}{pct}") ]
|
||||||
|
fromData<PrayerRequest>
|
||||||
|
|
||||||
|
/// Retrieve a prayer request by its ID
|
||||||
|
let tryById reqId =
|
||||||
|
Find.byId<PrayerRequestId, PrayerRequest> Table.Request reqId
|
||||||
|
|
||||||
|
/// Update the expiration for the given prayer request
|
||||||
|
let updateExpiration (req: PrayerRequest) withTime =
|
||||||
|
if withTime then
|
||||||
|
Patch.byId
|
||||||
|
Table.Request
|
||||||
|
(string req.Id)
|
||||||
|
{| UpdatedDate = req.UpdatedDate
|
||||||
|
Expiration = req.Expiration |}
|
||||||
|
else
|
||||||
|
Patch.byId Table.Request (string req.Id) {| Expiration = req.Expiration |}
|
||||||
|
|
||||||
|
|
||||||
|
/// Functions to manipulate users
|
||||||
|
module Users =
|
||||||
|
|
||||||
|
/// Retrieve all PrayerTracker users
|
||||||
|
let all () =
|
||||||
|
Find.allOrdered<User> Table.User [ Field.Named "lastName"; Field.Named "firstName" ]
|
||||||
|
|
||||||
|
/// Count the number of users for a church
|
||||||
|
let countByChurch churchId =
|
||||||
|
backgroundTask {
|
||||||
|
let! groupIds = SmallGroups.groupIdsByChurch churchId
|
||||||
|
return! Count.byFields Table.User All [ Field.InArray "smallGroups" Table.User (List.map string groupIds) ]
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Count the number of users for a small group
|
||||||
|
let countByGroup (groupId: SmallGroupId) =
|
||||||
|
Count.byFields Table.User All [ Field.InArray "smallGroups" Table.User [ (string groupId) ] ]
|
||||||
|
|
||||||
|
/// Delete a user by its database ID
|
||||||
|
let deleteById (userId: UserId) = Delete.byId Table.User (string userId)
|
||||||
|
|
||||||
|
/// Get a list of users authorized to administer the given small group
|
||||||
|
let listByGroupId (groupId: SmallGroupId) =
|
||||||
|
Find.byFieldsOrdered<User>
|
||||||
|
Table.User
|
||||||
|
All
|
||||||
|
[ Field.InArray "smallGroups" Table.User [ (string groupId) ] ]
|
||||||
|
[ Field.Named "lastName"; Field.Named "firstName" ]
|
||||||
|
|
||||||
|
/// Save a user's information
|
||||||
|
let save user = save<User> Table.User user
|
||||||
|
|
||||||
|
/// Find a user by its e-mail address and authorized small group
|
||||||
|
let tryByEmailAndGroup (email: string) (groupId: SmallGroupId) =
|
||||||
|
Find.firstByFields<User>
|
||||||
|
Table.User
|
||||||
|
All
|
||||||
|
[ Field.Equal "email" email
|
||||||
|
Field.InArray "smallGroups" Table.User [ (string groupId) ] ]
|
||||||
|
|
||||||
|
/// Find a user by their database ID
|
||||||
|
let tryById userId =
|
||||||
|
Find.byId<UserId, User> Table.User userId
|
||||||
|
|
||||||
|
/// Update a user's last seen date/time
|
||||||
|
let updateLastSeen (userId: UserId) (now: Instant) =
|
||||||
|
Patch.byId Table.User (string userId) {| LastSeen = now |}
|
||||||
|
|
||||||
|
/// Update a user's password hash
|
||||||
|
let updatePassword (user: User) =
|
||||||
|
Patch.byId Table.User (string user.Id) {| PasswordHash = user.PasswordHash |}
|
||||||
|
|
||||||
|
/// Update a user's authorized small groups
|
||||||
|
let updateSmallGroups (userId: UserId) (groupIds: SmallGroupId list) =
|
||||||
|
Patch.byId Table.User (string userId) {| SmallGroups = groupIds |}
|
||||||
565
src/Data/Entities.fs
Normal file
565
src/Data/Entities.fs
Normal file
@@ -0,0 +1,565 @@
|
|||||||
|
namespace PrayerTracker.Entities
|
||||||
|
|
||||||
|
(*-- SUPPORT TYPES --*)
|
||||||
|
|
||||||
|
/// How as-of dates should (or should not) be displayed with requests
|
||||||
|
type AsOfDateDisplay =
|
||||||
|
/// No as-of date should be displayed
|
||||||
|
| NoDisplay
|
||||||
|
/// The as-of date should be displayed in the culture's short date format
|
||||||
|
| ShortDate
|
||||||
|
/// The as-of date should be displayed in the culture's long date format
|
||||||
|
| LongDate
|
||||||
|
|
||||||
|
/// Convert this to a single-character code
|
||||||
|
override this.ToString() =
|
||||||
|
match this with
|
||||||
|
| NoDisplay -> "N"
|
||||||
|
| ShortDate -> "S"
|
||||||
|
| LongDate -> "L"
|
||||||
|
|
||||||
|
/// <summary>Create an <c>AsOfDateDisplay</c> from a single-character code</summary>
|
||||||
|
static member Parse code =
|
||||||
|
match code with
|
||||||
|
| "N" -> NoDisplay
|
||||||
|
| "S" -> ShortDate
|
||||||
|
| "L" -> LongDate
|
||||||
|
| _ -> invalidArg "code" $"Unknown code {code}"
|
||||||
|
|
||||||
|
|
||||||
|
/// Acceptable e-mail formats
|
||||||
|
type EmailFormat =
|
||||||
|
/// HTML e-mail
|
||||||
|
| HtmlFormat
|
||||||
|
/// Plain-text e-mail
|
||||||
|
| PlainTextFormat
|
||||||
|
|
||||||
|
/// Convert this to a single-character code
|
||||||
|
override this.ToString() =
|
||||||
|
match this with
|
||||||
|
| HtmlFormat -> "H"
|
||||||
|
| PlainTextFormat -> "P"
|
||||||
|
|
||||||
|
/// <summary>Create an <c>EmailFormat</c> from a single-character code</summary>
|
||||||
|
static member Parse code =
|
||||||
|
match code with
|
||||||
|
| "H" -> HtmlFormat
|
||||||
|
| "P" -> PlainTextFormat
|
||||||
|
| _ -> invalidArg "code" $"Unknown code {code}"
|
||||||
|
|
||||||
|
|
||||||
|
/// Expiration for requests
|
||||||
|
type Expiration =
|
||||||
|
/// Follow the rules for normal expiration
|
||||||
|
| Automatic
|
||||||
|
/// Do not expire via rules
|
||||||
|
| Manual
|
||||||
|
/// Force immediate expiration
|
||||||
|
| Forced
|
||||||
|
|
||||||
|
/// Convert this to a single-character code
|
||||||
|
override this.ToString() =
|
||||||
|
match this with
|
||||||
|
| Automatic -> "A"
|
||||||
|
| Manual -> "M"
|
||||||
|
| Forced -> "F"
|
||||||
|
|
||||||
|
/// <summary>Create an <c>Expiration</c> from a single-character code</summary>
|
||||||
|
static member Parse code =
|
||||||
|
match code with
|
||||||
|
| "A" -> Automatic
|
||||||
|
| "M" -> Manual
|
||||||
|
| "F" -> Forced
|
||||||
|
| _ -> invalidArg "code" $"Unknown code {code}"
|
||||||
|
|
||||||
|
|
||||||
|
/// Types of prayer requests
|
||||||
|
type PrayerRequestType =
|
||||||
|
/// Current requests
|
||||||
|
| CurrentRequest
|
||||||
|
/// Long-term/ongoing request
|
||||||
|
| LongTermRequest
|
||||||
|
/// Expectant couples
|
||||||
|
| Expecting
|
||||||
|
/// Praise reports
|
||||||
|
| PraiseReport
|
||||||
|
/// Announcements
|
||||||
|
| Announcement
|
||||||
|
|
||||||
|
/// Convert this to a single-character code
|
||||||
|
override this.ToString() =
|
||||||
|
match this with
|
||||||
|
| CurrentRequest -> "C"
|
||||||
|
| LongTermRequest -> "L"
|
||||||
|
| Expecting -> "E"
|
||||||
|
| PraiseReport -> "P"
|
||||||
|
| Announcement -> "A"
|
||||||
|
|
||||||
|
/// <summary>Create a <c>PrayerRequestType</c> from a single-character code</summary>
|
||||||
|
static member Parse code =
|
||||||
|
match code with
|
||||||
|
| "C" -> CurrentRequest
|
||||||
|
| "L" -> LongTermRequest
|
||||||
|
| "E" -> Expecting
|
||||||
|
| "P" -> PraiseReport
|
||||||
|
| "A" -> Announcement
|
||||||
|
| _ -> invalidArg "code" $"Unknown code {code}"
|
||||||
|
|
||||||
|
|
||||||
|
/// How requests should be sorted
|
||||||
|
type RequestSort =
|
||||||
|
/// Sort by date, then by requestor/subject
|
||||||
|
| SortByDate
|
||||||
|
/// Sort by requestor/subject, then by date
|
||||||
|
| SortByRequestor
|
||||||
|
|
||||||
|
/// Convert this to a single-character code
|
||||||
|
override this.ToString() =
|
||||||
|
match this with
|
||||||
|
| SortByDate -> "D"
|
||||||
|
| SortByRequestor -> "R"
|
||||||
|
|
||||||
|
/// <summary>Create a <c>RequestSort</c> from a single-character code</summary>
|
||||||
|
static member Parse code =
|
||||||
|
match code with
|
||||||
|
| "D" -> SortByDate
|
||||||
|
| "R" -> SortByRequestor
|
||||||
|
| _ -> invalidArg "code" $"Unknown code {code}"
|
||||||
|
|
||||||
|
|
||||||
|
/// Type for a time zone ID
|
||||||
|
type TimeZoneId =
|
||||||
|
| TimeZoneId of string
|
||||||
|
|
||||||
|
override this.ToString() =
|
||||||
|
match this with
|
||||||
|
| TimeZoneId it -> it
|
||||||
|
|
||||||
|
|
||||||
|
open System
|
||||||
|
|
||||||
|
/// PK type for the Church entity
|
||||||
|
type ChurchId =
|
||||||
|
| ChurchId of Guid
|
||||||
|
|
||||||
|
/// The GUID value of the church ID
|
||||||
|
member this.Value =
|
||||||
|
this
|
||||||
|
|> function
|
||||||
|
| ChurchId guid -> guid
|
||||||
|
|
||||||
|
override this.ToString() =
|
||||||
|
this.Value.ToString "N"
|
||||||
|
|
||||||
|
|
||||||
|
/// PK type for the Member entity
|
||||||
|
type MemberId =
|
||||||
|
| MemberId of Guid
|
||||||
|
|
||||||
|
/// The GUID value of the member ID
|
||||||
|
member this.Value =
|
||||||
|
this
|
||||||
|
|> function
|
||||||
|
| MemberId guid -> guid
|
||||||
|
|
||||||
|
override this.ToString() =
|
||||||
|
this.Value.ToString "N"
|
||||||
|
|
||||||
|
|
||||||
|
/// PK type for the PrayerRequest entity
|
||||||
|
type PrayerRequestId =
|
||||||
|
| PrayerRequestId of Guid
|
||||||
|
|
||||||
|
/// The GUID value of the prayer request ID
|
||||||
|
member this.Value =
|
||||||
|
this
|
||||||
|
|> function
|
||||||
|
| PrayerRequestId guid -> guid
|
||||||
|
|
||||||
|
override this.ToString() =
|
||||||
|
this.Value.ToString "N"
|
||||||
|
|
||||||
|
|
||||||
|
/// PK type for the SmallGroup entity
|
||||||
|
type SmallGroupId =
|
||||||
|
| SmallGroupId of Guid
|
||||||
|
|
||||||
|
/// The GUID value of the small group ID
|
||||||
|
member this.Value =
|
||||||
|
this
|
||||||
|
|> function
|
||||||
|
| SmallGroupId guid -> guid
|
||||||
|
|
||||||
|
override this.ToString() =
|
||||||
|
this.Value.ToString "N"
|
||||||
|
|
||||||
|
|
||||||
|
/// PK type for the User entity
|
||||||
|
type UserId =
|
||||||
|
| UserId of Guid
|
||||||
|
|
||||||
|
/// The GUID value of the user ID
|
||||||
|
member this.Value =
|
||||||
|
this
|
||||||
|
|> function
|
||||||
|
| UserId guid -> guid
|
||||||
|
|
||||||
|
override this.ToString() =
|
||||||
|
this.Value.ToString "N"
|
||||||
|
|
||||||
|
(*-- SPECIFIC VIEW TYPES --*)
|
||||||
|
|
||||||
|
open Microsoft.Data.Sqlite
|
||||||
|
|
||||||
|
/// Statistics for churches
|
||||||
|
[<NoComparison; NoEquality>]
|
||||||
|
type ChurchStats =
|
||||||
|
{
|
||||||
|
/// The number of small groups in the church
|
||||||
|
SmallGroups: int
|
||||||
|
|
||||||
|
/// The number of prayer requests in the church
|
||||||
|
PrayerRequests: int
|
||||||
|
|
||||||
|
/// The number of users who can access small groups in the church
|
||||||
|
Users: int
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// Information needed to display the public/protected request list and small group maintenance pages
|
||||||
|
[<CLIMutable; NoComparison; NoEquality>]
|
||||||
|
type SmallGroupInfo =
|
||||||
|
{
|
||||||
|
/// The ID of the small group
|
||||||
|
Id: string
|
||||||
|
|
||||||
|
/// The name of the small group
|
||||||
|
Name: string
|
||||||
|
|
||||||
|
/// The name of the church to which the small group belongs
|
||||||
|
ChurchName: string
|
||||||
|
|
||||||
|
/// The ID of the time zone for the small group
|
||||||
|
TimeZoneId: TimeZoneId
|
||||||
|
|
||||||
|
/// Whether the small group has a publicly-available request list
|
||||||
|
IsPublic: bool
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Map a row to a Small Group information set
|
||||||
|
static member FromReader (rdr: SqliteDataReader) =
|
||||||
|
{ Id = Giraffe.ShortGuid.fromGuid ((rdr.GetOrdinal >> rdr.GetString >> Guid.Parse) "id")
|
||||||
|
Name = (rdr.GetOrdinal >> rdr.GetString) "groupName"
|
||||||
|
ChurchName = (rdr.GetOrdinal >> rdr.GetString) "churchName"
|
||||||
|
TimeZoneId = (rdr.GetOrdinal >> rdr.GetString >> TimeZoneId) "timeZoneId"
|
||||||
|
IsPublic = (rdr.GetOrdinal >> rdr.GetBoolean) "isPublic" }
|
||||||
|
|
||||||
|
|
||||||
|
(*-- ENTITIES --*)
|
||||||
|
|
||||||
|
open NodaTime
|
||||||
|
|
||||||
|
/// This represents a church
|
||||||
|
[<CLIMutable; NoComparison; NoEquality>]
|
||||||
|
type Church =
|
||||||
|
{
|
||||||
|
/// The ID of this church
|
||||||
|
Id: ChurchId
|
||||||
|
|
||||||
|
/// The name of the church
|
||||||
|
Name: string
|
||||||
|
|
||||||
|
/// The city where the church is
|
||||||
|
City: string
|
||||||
|
|
||||||
|
/// The 2-letter state or province code for the church's location
|
||||||
|
State: string
|
||||||
|
|
||||||
|
/// Does this church have an active interface with Virtual Prayer Space?
|
||||||
|
HasVpsInterface: bool
|
||||||
|
|
||||||
|
/// The address for the interface
|
||||||
|
InterfaceAddress: string option
|
||||||
|
}
|
||||||
|
|
||||||
|
/// An empty church
|
||||||
|
// aww... how sad :(
|
||||||
|
static member Empty =
|
||||||
|
{ Id = ChurchId Guid.Empty
|
||||||
|
Name = ""
|
||||||
|
City = ""
|
||||||
|
State = ""
|
||||||
|
HasVpsInterface = false
|
||||||
|
InterfaceAddress = None }
|
||||||
|
|
||||||
|
|
||||||
|
/// Preferences for the form and format of the prayer request list
|
||||||
|
[<NoComparison; NoEquality>]
|
||||||
|
type ListPreferences =
|
||||||
|
{
|
||||||
|
/// The days after which regular requests expire
|
||||||
|
DaysToExpire: int
|
||||||
|
|
||||||
|
/// The number of days a new or updated request is considered new
|
||||||
|
DaysToKeepNew: int
|
||||||
|
|
||||||
|
/// The number of weeks after which long-term requests are flagged for follow-up
|
||||||
|
LongTermUpdateWeeks: int
|
||||||
|
|
||||||
|
/// The name from which e-mails are sent
|
||||||
|
EmailFromName: string
|
||||||
|
|
||||||
|
/// The e-mail address from which e-mails are sent
|
||||||
|
EmailFromAddress: string
|
||||||
|
|
||||||
|
/// The fonts to use in generating the list of prayer requests
|
||||||
|
Fonts: string
|
||||||
|
|
||||||
|
/// The color for the prayer request list headings
|
||||||
|
HeadingColor: string
|
||||||
|
|
||||||
|
/// The color for the lines offsetting the prayer request list headings
|
||||||
|
LineColor: string
|
||||||
|
|
||||||
|
/// The font size for the headings on the prayer request list
|
||||||
|
HeadingFontSize: int
|
||||||
|
|
||||||
|
/// The font size for the text on the prayer request list
|
||||||
|
TextFontSize: int
|
||||||
|
|
||||||
|
/// The order in which the prayer requests are sorted
|
||||||
|
RequestSort: RequestSort
|
||||||
|
|
||||||
|
/// The password used for "small group login" (view-only request list)
|
||||||
|
GroupPassword: string
|
||||||
|
|
||||||
|
/// The default e-mail type for this class
|
||||||
|
DefaultEmailType: EmailFormat
|
||||||
|
|
||||||
|
/// Whether this class makes its request list public
|
||||||
|
IsPublic: bool
|
||||||
|
|
||||||
|
/// The time zone which this class uses (use tzdata names)
|
||||||
|
TimeZoneId: TimeZoneId
|
||||||
|
|
||||||
|
/// The number of requests displayed per page
|
||||||
|
PageSize: int
|
||||||
|
|
||||||
|
/// How the as-of date should be automatically displayed
|
||||||
|
AsOfDateDisplay: AsOfDateDisplay
|
||||||
|
}
|
||||||
|
|
||||||
|
/// The list of fonts to use when displaying request lists (converts "native" to native font stack)
|
||||||
|
member this.FontStack =
|
||||||
|
if this.Fonts = "native" then
|
||||||
|
"""system-ui,-apple-system,"Segoe UI",Roboto,Ubuntu,"Liberation Sans",Cantarell,"Helvetica Neue",sans-serif"""
|
||||||
|
else
|
||||||
|
this.Fonts
|
||||||
|
|
||||||
|
/// A set of preferences with their default values
|
||||||
|
static member Empty =
|
||||||
|
{ DaysToExpire = 14
|
||||||
|
DaysToKeepNew = 7
|
||||||
|
LongTermUpdateWeeks = 4
|
||||||
|
EmailFromName = "PrayerTracker"
|
||||||
|
EmailFromAddress = "prayer@bitbadger.solutions"
|
||||||
|
Fonts = "native"
|
||||||
|
HeadingColor = "maroon"
|
||||||
|
LineColor = "navy"
|
||||||
|
HeadingFontSize = 16
|
||||||
|
TextFontSize = 12
|
||||||
|
RequestSort = SortByDate
|
||||||
|
GroupPassword = ""
|
||||||
|
DefaultEmailType = HtmlFormat
|
||||||
|
IsPublic = false
|
||||||
|
TimeZoneId = TimeZoneId "America/Denver"
|
||||||
|
PageSize = 100
|
||||||
|
AsOfDateDisplay = NoDisplay }
|
||||||
|
|
||||||
|
|
||||||
|
/// A member of a small group
|
||||||
|
[<CLIMutable; NoComparison; NoEquality>]
|
||||||
|
type Member =
|
||||||
|
{
|
||||||
|
/// The ID of the small group member
|
||||||
|
Id: MemberId
|
||||||
|
|
||||||
|
/// The Id of the small group to which this member belongs
|
||||||
|
SmallGroupId: SmallGroupId
|
||||||
|
|
||||||
|
/// The name of the member
|
||||||
|
Name: string
|
||||||
|
|
||||||
|
/// The e-mail address for the member
|
||||||
|
Email: string
|
||||||
|
|
||||||
|
/// The type of e-mail preferred by this member
|
||||||
|
Format: EmailFormat option
|
||||||
|
}
|
||||||
|
|
||||||
|
/// An empty member
|
||||||
|
static member Empty =
|
||||||
|
{ Id = MemberId Guid.Empty
|
||||||
|
SmallGroupId = SmallGroupId Guid.Empty
|
||||||
|
Name = ""
|
||||||
|
Email = ""
|
||||||
|
Format = None }
|
||||||
|
|
||||||
|
|
||||||
|
/// This represents a small group (Sunday School class, Bible study group, etc.)
|
||||||
|
[<CLIMutable; NoComparison; NoEquality>]
|
||||||
|
type SmallGroup =
|
||||||
|
{
|
||||||
|
/// The ID of this small group
|
||||||
|
Id: SmallGroupId
|
||||||
|
|
||||||
|
/// The church to which this group belongs
|
||||||
|
ChurchId: ChurchId
|
||||||
|
|
||||||
|
/// The name of the group
|
||||||
|
Name: string
|
||||||
|
|
||||||
|
/// The preferences for the request list
|
||||||
|
Preferences: ListPreferences
|
||||||
|
}
|
||||||
|
|
||||||
|
/// The DateTimeZone for the time zone ID for this small group
|
||||||
|
member this.TimeZone =
|
||||||
|
let tzId = string this.Preferences.TimeZoneId
|
||||||
|
|
||||||
|
if DateTimeZoneProviders.Tzdb.Ids.Contains tzId then
|
||||||
|
DateTimeZoneProviders.Tzdb[tzId]
|
||||||
|
else
|
||||||
|
DateTimeZone.Utc
|
||||||
|
|
||||||
|
/// Get the local date/time for this group
|
||||||
|
member this.LocalTimeNow(clock: IClock) =
|
||||||
|
if isNull clock then
|
||||||
|
nullArg (nameof clock)
|
||||||
|
|
||||||
|
clock.GetCurrentInstant().InZone(this.TimeZone).LocalDateTime
|
||||||
|
|
||||||
|
/// Get the local date for this group
|
||||||
|
member this.LocalDateNow clock = this.LocalTimeNow(clock).Date
|
||||||
|
|
||||||
|
/// An empty small group
|
||||||
|
static member Empty =
|
||||||
|
{ Id = SmallGroupId Guid.Empty
|
||||||
|
ChurchId = ChurchId Guid.Empty
|
||||||
|
Name = ""
|
||||||
|
Preferences = ListPreferences.Empty }
|
||||||
|
|
||||||
|
|
||||||
|
/// This represents a single prayer request
|
||||||
|
[<CLIMutable; NoComparison; NoEquality>]
|
||||||
|
type PrayerRequest =
|
||||||
|
{
|
||||||
|
/// The ID of this request
|
||||||
|
Id: PrayerRequestId
|
||||||
|
|
||||||
|
/// The type of the request
|
||||||
|
RequestType: PrayerRequestType
|
||||||
|
|
||||||
|
/// The ID of the user who entered the request
|
||||||
|
UserId: UserId
|
||||||
|
|
||||||
|
/// The small group to which this request belongs
|
||||||
|
SmallGroupId: SmallGroupId
|
||||||
|
|
||||||
|
/// The date/time on which this request was entered
|
||||||
|
EnteredDate: Instant
|
||||||
|
|
||||||
|
/// The date/time this request was last updated
|
||||||
|
UpdatedDate: Instant
|
||||||
|
|
||||||
|
/// The name of the requestor or subject, or title of announcement
|
||||||
|
Requestor: string option
|
||||||
|
|
||||||
|
/// The text of the request
|
||||||
|
Text: string
|
||||||
|
|
||||||
|
/// Whether the chaplain should be notified for this request
|
||||||
|
NotifyChaplain: bool
|
||||||
|
|
||||||
|
/// Is this request expired?
|
||||||
|
Expiration: Expiration
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Is this request expired?
|
||||||
|
member this.IsExpired (asOf: LocalDate) (group: SmallGroup) =
|
||||||
|
match this.Expiration, this.RequestType with
|
||||||
|
| Forced, _ -> true
|
||||||
|
| Manual, _
|
||||||
|
| Automatic, LongTermRequest
|
||||||
|
| Automatic, Expecting -> false
|
||||||
|
| Automatic, _ ->
|
||||||
|
// Automatic expiration
|
||||||
|
Period
|
||||||
|
.Between(this.UpdatedDate.InZone(group.TimeZone).Date, asOf, PeriodUnits.Days)
|
||||||
|
.Days
|
||||||
|
>= group.Preferences.DaysToExpire
|
||||||
|
|
||||||
|
/// Is an update required for this long-term request?
|
||||||
|
member this.UpdateRequired asOf group =
|
||||||
|
if this.IsExpired asOf group then
|
||||||
|
false
|
||||||
|
else
|
||||||
|
asOf.PlusWeeks -group.Preferences.LongTermUpdateWeeks
|
||||||
|
>= this.UpdatedDate.InZone(group.TimeZone).Date
|
||||||
|
|
||||||
|
/// An empty request
|
||||||
|
static member Empty =
|
||||||
|
{ Id = PrayerRequestId Guid.Empty
|
||||||
|
RequestType = CurrentRequest
|
||||||
|
UserId = UserId Guid.Empty
|
||||||
|
SmallGroupId = SmallGroupId Guid.Empty
|
||||||
|
EnteredDate = Instant.MinValue
|
||||||
|
UpdatedDate = Instant.MinValue
|
||||||
|
Requestor = None
|
||||||
|
Text = ""
|
||||||
|
NotifyChaplain = false
|
||||||
|
Expiration = Automatic }
|
||||||
|
|
||||||
|
|
||||||
|
/// This represents a user of PrayerTracker
|
||||||
|
[<CLIMutable; NoComparison; NoEquality>]
|
||||||
|
type User =
|
||||||
|
{
|
||||||
|
/// The ID of this user
|
||||||
|
Id: UserId
|
||||||
|
|
||||||
|
/// The first name of this user
|
||||||
|
FirstName: string
|
||||||
|
|
||||||
|
/// The last name of this user
|
||||||
|
LastName: string
|
||||||
|
|
||||||
|
/// The e-mail address of the user
|
||||||
|
Email: string
|
||||||
|
|
||||||
|
/// Whether this user is a PrayerTracker system administrator
|
||||||
|
IsAdmin: bool
|
||||||
|
|
||||||
|
/// The user's hashed password
|
||||||
|
PasswordHash: string
|
||||||
|
|
||||||
|
/// The last time the user was seen (set whenever the user is loaded into a session)
|
||||||
|
LastSeen: Instant option
|
||||||
|
|
||||||
|
/// The small groups to which this user is authorized
|
||||||
|
SmallGroups: SmallGroupId list
|
||||||
|
}
|
||||||
|
|
||||||
|
/// The full name of the user
|
||||||
|
member this.Name = $"{this.FirstName} {this.LastName}"
|
||||||
|
|
||||||
|
/// An empty user
|
||||||
|
static member Empty =
|
||||||
|
{ Id = UserId Guid.Empty
|
||||||
|
FirstName = ""
|
||||||
|
LastName = ""
|
||||||
|
Email = ""
|
||||||
|
IsAdmin = false
|
||||||
|
PasswordHash = ""
|
||||||
|
LastSeen = None
|
||||||
|
SmallGroups = [] }
|
||||||
16
src/Data/PrayerTracker.Data.fsproj
Normal file
16
src/Data/PrayerTracker.Data.fsproj
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Include="Entities.fs" />
|
||||||
|
<Compile Include="Access.fs" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="BitBadger.Documents.Sqlite" Version="4.0.1" />
|
||||||
|
<PackageReference Include="Giraffe" Version="7.0.2" />
|
||||||
|
<PackageReference Include="NodaTime" Version="3.2.1" />
|
||||||
|
<PackageReference Include="NodaTime.Serialization.SystemTextJson" Version="1.3.0" />
|
||||||
|
<PackageReference Update="FSharp.Core" Version="9.0.101" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
@@ -1,11 +1,11 @@
|
|||||||
<Project>
|
<Project>
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net7.0</TargetFramework>
|
<TargetFramework>net9.0</TargetFramework>
|
||||||
<AssemblyVersion>8.2.0.0</AssemblyVersion>
|
<AssemblyVersion>9.0.0.0</AssemblyVersion>
|
||||||
<FileVersion>8.2.0.0</FileVersion>
|
<FileVersion>9.0.0.0</FileVersion>
|
||||||
<Authors>danieljsummers</Authors>
|
<Authors>danieljsummers</Authors>
|
||||||
<Company>Bit Badger Solutions</Company>
|
<Company>Bit Badger Solutions</Company>
|
||||||
<Version>8.2.0</Version>
|
<Version>9.0.0</Version>
|
||||||
<DebugType>Embedded</DebugType>
|
<DebugType>Embedded</DebugType>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
@@ -1,25 +1,25 @@
|
|||||||
FROM mcr.microsoft.com/dotnet/sdk:7.0-alpine AS build
|
FROM mcr.microsoft.com/dotnet/sdk:8.0-alpine AS build
|
||||||
WORKDIR /pt
|
WORKDIR /pt
|
||||||
COPY ./PrayerTracker.sln ./
|
COPY ./PrayerTracker.sln ./
|
||||||
COPY ./Directory.Build.props ./
|
COPY ./Directory.Build.props ./
|
||||||
COPY ./PrayerTracker/PrayerTracker.fsproj ./PrayerTracker/
|
COPY ./Data/PrayerTracker.Data.fsproj ./Data/
|
||||||
COPY ./PrayerTracker.Data/PrayerTracker.Data.fsproj ./PrayerTracker.Data/
|
COPY ./UI/PrayerTracker.UI.fsproj ./UI/
|
||||||
COPY ./PrayerTracker.Tests/PrayerTracker.Tests.fsproj ./PrayerTracker.Tests/
|
COPY ./PrayerTracker/PrayerTracker.fsproj ./PrayerTracker/
|
||||||
COPY ./PrayerTracker.UI/PrayerTracker.UI.fsproj ./PrayerTracker.UI/
|
COPY ./Tests/PrayerTracker.Tests.fsproj ./Tests/
|
||||||
RUN dotnet restore
|
RUN dotnet restore
|
||||||
|
|
||||||
COPY . ./
|
COPY . ./
|
||||||
WORKDIR /pt/PrayerTracker.Tests
|
WORKDIR /pt/Tests
|
||||||
RUN dotnet run
|
RUN dotnet run
|
||||||
|
|
||||||
WORKDIR /pt/PrayerTracker
|
WORKDIR /pt/PrayerTracker
|
||||||
RUN dotnet publish -c Release -r linux-x64
|
RUN dotnet publish -c Release -r linux-x64
|
||||||
|
|
||||||
FROM mcr.microsoft.com/dotnet/aspnet:7.0-alpine as final
|
FROM mcr.microsoft.com/dotnet/aspnet:8.0-alpine as final
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
RUN apk add --no-cache icu-libs
|
RUN apk add --no-cache icu-libs
|
||||||
ENV DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=false
|
ENV DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=false
|
||||||
COPY --from=build /pt/PrayerTracker/bin/Release/net7.0/linux-x64/publish/ ./
|
COPY --from=build /pt/PrayerTracker/bin/Release/net8.0/linux-x64/publish/ ./
|
||||||
|
|
||||||
EXPOSE 80
|
EXPOSE 80
|
||||||
CMD [ "dotnet", "/app/PrayerTracker.dll" ]
|
CMD [ "dotnet", "/app/PrayerTracker.dll" ]
|
||||||
|
|||||||
@@ -1,589 +0,0 @@
|
|||||||
namespace PrayerTracker.Data
|
|
||||||
|
|
||||||
open NodaTime
|
|
||||||
open Npgsql
|
|
||||||
open Npgsql.FSharp
|
|
||||||
open PrayerTracker.Entities
|
|
||||||
|
|
||||||
/// Helper functions for the PostgreSQL data implementation
|
|
||||||
[<AutoOpen>]
|
|
||||||
module private Helpers =
|
|
||||||
|
|
||||||
/// Map a row to a Church instance
|
|
||||||
let mapToChurch (row : RowReader) =
|
|
||||||
{ Id = ChurchId (row.uuid "id")
|
|
||||||
Name = row.string "church_name"
|
|
||||||
City = row.string "city"
|
|
||||||
State = row.string "state"
|
|
||||||
HasVpsInterface = row.bool "has_vps_interface"
|
|
||||||
InterfaceAddress = row.stringOrNone "interface_address"
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Map a row to a ListPreferences instance
|
|
||||||
let mapToListPreferences (row : RowReader) =
|
|
||||||
{ SmallGroupId = SmallGroupId (row.uuid "small_group_id")
|
|
||||||
DaysToKeepNew = row.int "days_to_keep_new"
|
|
||||||
DaysToExpire = row.int "days_to_expire"
|
|
||||||
LongTermUpdateWeeks = row.int "long_term_update_weeks"
|
|
||||||
EmailFromName = row.string "email_from_name"
|
|
||||||
EmailFromAddress = row.string "email_from_address"
|
|
||||||
Fonts = row.string "fonts"
|
|
||||||
HeadingColor = row.string "heading_color"
|
|
||||||
LineColor = row.string "line_color"
|
|
||||||
HeadingFontSize = row.int "heading_font_size"
|
|
||||||
TextFontSize = row.int "text_font_size"
|
|
||||||
GroupPassword = row.string "group_password"
|
|
||||||
IsPublic = row.bool "is_public"
|
|
||||||
PageSize = row.int "page_size"
|
|
||||||
TimeZoneId = TimeZoneId (row.string "time_zone_id")
|
|
||||||
RequestSort = RequestSort.fromCode (row.string "request_sort")
|
|
||||||
DefaultEmailType = EmailFormat.fromCode (row.string "default_email_type")
|
|
||||||
AsOfDateDisplay = AsOfDateDisplay.fromCode (row.string "as_of_date_display")
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Map a row to a Member instance
|
|
||||||
let mapToMember (row : RowReader) =
|
|
||||||
{ Id = MemberId (row.uuid "id")
|
|
||||||
SmallGroupId = SmallGroupId (row.uuid "small_group_id")
|
|
||||||
Name = row.string "member_name"
|
|
||||||
Email = row.string "email"
|
|
||||||
Format = row.stringOrNone "email_format" |> Option.map EmailFormat.fromCode
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Map a row to a Prayer Request instance
|
|
||||||
let mapToPrayerRequest (row : RowReader) =
|
|
||||||
{ Id = PrayerRequestId (row.uuid "id")
|
|
||||||
UserId = UserId (row.uuid "user_id")
|
|
||||||
SmallGroupId = SmallGroupId (row.uuid "small_group_id")
|
|
||||||
EnteredDate = row.fieldValue<Instant> "entered_date"
|
|
||||||
UpdatedDate = row.fieldValue<Instant> "updated_date"
|
|
||||||
Requestor = row.stringOrNone "requestor"
|
|
||||||
Text = row.string "request_text"
|
|
||||||
NotifyChaplain = row.bool "notify_chaplain"
|
|
||||||
RequestType = PrayerRequestType.fromCode (row.string "request_type")
|
|
||||||
Expiration = Expiration.fromCode (row.string "expiration")
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Map a row to a Small Group instance
|
|
||||||
let mapToSmallGroup (row : RowReader) =
|
|
||||||
{ Id = SmallGroupId (row.uuid "id")
|
|
||||||
ChurchId = ChurchId (row.uuid "church_id")
|
|
||||||
Name = row.string "group_name"
|
|
||||||
Preferences = ListPreferences.empty
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Map a row to a Small Group information set
|
|
||||||
let mapToSmallGroupInfo (row : RowReader) =
|
|
||||||
{ Id = Giraffe.ShortGuid.fromGuid (row.uuid "id")
|
|
||||||
Name = row.string "group_name"
|
|
||||||
ChurchName = row.string "church_name"
|
|
||||||
TimeZoneId = TimeZoneId (row.string "time_zone_id")
|
|
||||||
IsPublic = row.bool "is_public"
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Map a row to a Small Group list item
|
|
||||||
let mapToSmallGroupItem (row : RowReader) =
|
|
||||||
Giraffe.ShortGuid.fromGuid (row.uuid "id"), $"""{row.string "church_name"} | {row.string "group_name"}"""
|
|
||||||
|
|
||||||
/// Map a row to a Small Group instance with populated list preferences
|
|
||||||
let mapToSmallGroupWithPreferences (row : RowReader) =
|
|
||||||
{ mapToSmallGroup row with
|
|
||||||
Preferences = mapToListPreferences row
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Map a row to a User instance
|
|
||||||
let mapToUser (row : RowReader) =
|
|
||||||
{ Id = UserId (row.uuid "id")
|
|
||||||
FirstName = row.string "first_name"
|
|
||||||
LastName = row.string "last_name"
|
|
||||||
Email = row.string "email"
|
|
||||||
IsAdmin = row.bool "is_admin"
|
|
||||||
PasswordHash = row.string "password_hash"
|
|
||||||
LastSeen = row.fieldValueOrNone<Instant> "last_seen"
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
open BitBadger.Npgsql.FSharp.Documents
|
|
||||||
|
|
||||||
/// Functions to manipulate churches
|
|
||||||
module Churches =
|
|
||||||
|
|
||||||
/// Get a list of all churches
|
|
||||||
let all () =
|
|
||||||
Custom.list "SELECT * FROM pt.church ORDER BY church_name" [] mapToChurch
|
|
||||||
|
|
||||||
/// Delete a church by its ID
|
|
||||||
let deleteById (churchId : ChurchId) = backgroundTask {
|
|
||||||
let idParam = [ [ "@churchId", Sql.uuid churchId.Value ] ]
|
|
||||||
let where = "WHERE small_group_id IN (SELECT id FROM pt.small_group WHERE church_id = @churchId)"
|
|
||||||
let! _ =
|
|
||||||
Configuration.dataSource ()
|
|
||||||
|> Sql.fromDataSource
|
|
||||||
|> Sql.executeTransactionAsync
|
|
||||||
[ $"DELETE FROM pt.prayer_request {where}", idParam
|
|
||||||
$"DELETE FROM pt.user_small_group {where}", idParam
|
|
||||||
$"DELETE FROM pt.list_preference {where}", idParam
|
|
||||||
"DELETE FROM pt.small_group WHERE church_id = @churchId", idParam
|
|
||||||
"DELETE FROM pt.church WHERE id = @churchId", idParam ]
|
|
||||||
()
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Save a church's information
|
|
||||||
let save (church : Church) =
|
|
||||||
Custom.nonQuery
|
|
||||||
"INSERT INTO pt.church (
|
|
||||||
id, church_name, city, state, has_vps_interface, interface_address
|
|
||||||
) VALUES (
|
|
||||||
@id, @name, @city, @state, @hasVpsInterface, @interfaceAddress
|
|
||||||
) ON CONFLICT (id) DO UPDATE
|
|
||||||
SET church_name = EXCLUDED.church_name,
|
|
||||||
city = EXCLUDED.city,
|
|
||||||
state = EXCLUDED.state,
|
|
||||||
has_vps_interface = EXCLUDED.has_vps_interface,
|
|
||||||
interface_address = EXCLUDED.interface_address"
|
|
||||||
[ "@id", Sql.uuid church.Id.Value
|
|
||||||
"@name", Sql.string church.Name
|
|
||||||
"@city", Sql.string church.City
|
|
||||||
"@state", Sql.string church.State
|
|
||||||
"@hasVpsInterface", Sql.bool church.HasVpsInterface
|
|
||||||
"@interfaceAddress", Sql.stringOrNone church.InterfaceAddress ]
|
|
||||||
|
|
||||||
/// Find a church by its ID
|
|
||||||
let tryById (churchId : ChurchId) =
|
|
||||||
Custom.single "SELECT * FROM pt.church WHERE id = @id" [ "@id", Sql.uuid churchId.Value ] mapToChurch
|
|
||||||
|
|
||||||
|
|
||||||
/// Functions to manipulate small group members
|
|
||||||
module Members =
|
|
||||||
|
|
||||||
/// Count members for the given small group
|
|
||||||
let countByGroup (groupId : SmallGroupId) =
|
|
||||||
Custom.scalar "SELECT COUNT(id) AS mbr_count FROM pt.member WHERE small_group_id = @groupId"
|
|
||||||
[ "@groupId", Sql.uuid groupId.Value ] (fun row -> row.int "mbr_count")
|
|
||||||
|
|
||||||
/// Delete a small group member by its ID
|
|
||||||
let deleteById (memberId : MemberId) =
|
|
||||||
Custom.nonQuery "DELETE FROM pt.member WHERE id = @id" [ "@id", Sql.uuid memberId.Value ]
|
|
||||||
|
|
||||||
/// Retrieve all members for a given small group
|
|
||||||
let forGroup (groupId : SmallGroupId) =
|
|
||||||
Custom.list "SELECT * FROM pt.member WHERE small_group_id = @groupId ORDER BY member_name"
|
|
||||||
[ "@groupId", Sql.uuid groupId.Value ] mapToMember
|
|
||||||
|
|
||||||
/// Save a small group member
|
|
||||||
let save (mbr : Member) =
|
|
||||||
Custom.nonQuery
|
|
||||||
"INSERT INTO pt.member (
|
|
||||||
id, small_group_id, member_name, email, email_format
|
|
||||||
) VALUES (
|
|
||||||
@id, @groupId, @name, @email, @format
|
|
||||||
) ON CONFLICT (id) DO UPDATE
|
|
||||||
SET member_name = EXCLUDED.member_name,
|
|
||||||
email = EXCLUDED.email,
|
|
||||||
email_format = EXCLUDED.email_format"
|
|
||||||
[ "@id", Sql.uuid mbr.Id.Value
|
|
||||||
"@groupId", Sql.uuid mbr.SmallGroupId.Value
|
|
||||||
"@name", Sql.string mbr.Name
|
|
||||||
"@email", Sql.string mbr.Email
|
|
||||||
"@format", Sql.stringOrNone (mbr.Format |> Option.map EmailFormat.toCode) ]
|
|
||||||
|
|
||||||
/// Retrieve a small group member by its ID
|
|
||||||
let tryById (memberId : MemberId) =
|
|
||||||
Custom.single "SELECT * FROM pt.member WHERE id = @id" [ "@id", Sql.uuid memberId.Value ] mapToMember
|
|
||||||
|
|
||||||
|
|
||||||
/// Options to retrieve a list of requests
|
|
||||||
type PrayerRequestOptions =
|
|
||||||
{ /// The small group for which requests should be retrieved
|
|
||||||
SmallGroup : SmallGroup
|
|
||||||
|
|
||||||
/// The clock instance to use for date/time manipulation
|
|
||||||
Clock : IClock
|
|
||||||
|
|
||||||
/// The date for which the list is being retrieved
|
|
||||||
ListDate : LocalDate option
|
|
||||||
|
|
||||||
/// Whether only active requests should be retrieved
|
|
||||||
ActiveOnly : bool
|
|
||||||
|
|
||||||
/// The page number, for paged lists
|
|
||||||
PageNumber : int
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/// Functions to manipulate prayer requests
|
|
||||||
module PrayerRequests =
|
|
||||||
|
|
||||||
/// Central place to append sort criteria for prayer request queries
|
|
||||||
let private orderBy sort =
|
|
||||||
match sort with
|
|
||||||
| SortByDate -> "updated_date DESC, entered_date DESC, requestor"
|
|
||||||
| SortByRequestor -> "requestor, updated_date DESC, entered_date DESC"
|
|
||||||
|
|
||||||
/// Paginate a prayer request query
|
|
||||||
let private paginate (pageNbr : int) pageSize =
|
|
||||||
if pageNbr > 0 then $"LIMIT {pageSize} OFFSET {(pageNbr - 1) * pageSize}" else ""
|
|
||||||
|
|
||||||
/// Count the number of prayer requests for a church
|
|
||||||
let countByChurch (churchId : ChurchId) =
|
|
||||||
Custom.scalar
|
|
||||||
"SELECT COUNT(id) AS req_count
|
|
||||||
FROM pt.prayer_request
|
|
||||||
WHERE small_group_id IN (SELECT id FROM pt.small_group WHERE church_id = @churchId)"
|
|
||||||
[ "@churchId", Sql.uuid churchId.Value ] (fun row -> row.int "req_count")
|
|
||||||
|
|
||||||
/// Count the number of prayer requests for a small group
|
|
||||||
let countByGroup (groupId : SmallGroupId) =
|
|
||||||
Custom.scalar "SELECT COUNT(id) AS req_count FROM pt.prayer_request WHERE small_group_id = @groupId"
|
|
||||||
[ "@groupId", Sql.uuid groupId.Value ] (fun row -> row.int "req_count")
|
|
||||||
|
|
||||||
/// Delete a prayer request by its ID
|
|
||||||
let deleteById (reqId : PrayerRequestId) =
|
|
||||||
Custom.nonQuery "DELETE FROM pt.prayer_request WHERE id = @id" [ "@id", Sql.uuid reqId.Value ]
|
|
||||||
|
|
||||||
/// Get all (or active) requests for a small group as of now or the specified date
|
|
||||||
let forGroup (opts : PrayerRequestOptions) =
|
|
||||||
let theDate = defaultArg opts.ListDate (SmallGroup.localDateNow opts.Clock opts.SmallGroup)
|
|
||||||
let where, parameters =
|
|
||||||
if opts.ActiveOnly then
|
|
||||||
let asOf = NpgsqlParameter (
|
|
||||||
"@asOf",
|
|
||||||
(theDate.AtStartOfDayInZone(SmallGroup.timeZone opts.SmallGroup)
|
|
||||||
- Duration.FromDays opts.SmallGroup.Preferences.DaysToExpire)
|
|
||||||
.ToInstant ())
|
|
||||||
" AND ( updated_date > @asOf
|
|
||||||
OR expiration = @manual
|
|
||||||
OR request_type = @longTerm
|
|
||||||
OR request_type = @expecting)
|
|
||||||
AND expiration <> @forced",
|
|
||||||
[ "@asOf", Sql.parameter asOf
|
|
||||||
"@manual", Sql.string (Expiration.toCode Manual)
|
|
||||||
"@longTerm", Sql.string (PrayerRequestType.toCode LongTermRequest)
|
|
||||||
"@expecting", Sql.string (PrayerRequestType.toCode Expecting)
|
|
||||||
"@forced", Sql.string (Expiration.toCode Forced) ]
|
|
||||||
else "", []
|
|
||||||
Custom.list
|
|
||||||
$"SELECT *
|
|
||||||
FROM pt.prayer_request
|
|
||||||
WHERE small_group_id = @groupId {where}
|
|
||||||
ORDER BY {orderBy opts.SmallGroup.Preferences.RequestSort}
|
|
||||||
{paginate opts.PageNumber opts.SmallGroup.Preferences.PageSize}"
|
|
||||||
(("@groupId", Sql.uuid opts.SmallGroup.Id.Value) :: parameters) mapToPrayerRequest
|
|
||||||
|
|
||||||
/// Save a prayer request
|
|
||||||
let save (req : PrayerRequest) =
|
|
||||||
Custom.nonQuery
|
|
||||||
"INSERT into pt.prayer_request (
|
|
||||||
id, request_type, user_id, small_group_id, entered_date, updated_date, requestor, request_text,
|
|
||||||
notify_chaplain, expiration
|
|
||||||
) VALUES (
|
|
||||||
@id, @type, @userId, @groupId, @entered, @updated, @requestor, @text,
|
|
||||||
@notifyChaplain, @expiration
|
|
||||||
) ON CONFLICT (id) DO UPDATE
|
|
||||||
SET request_type = EXCLUDED.request_type,
|
|
||||||
updated_date = EXCLUDED.updated_date,
|
|
||||||
requestor = EXCLUDED.requestor,
|
|
||||||
request_text = EXCLUDED.request_text,
|
|
||||||
notify_chaplain = EXCLUDED.notify_chaplain,
|
|
||||||
expiration = EXCLUDED.expiration"
|
|
||||||
[ "@id", Sql.uuid req.Id.Value
|
|
||||||
"@type", Sql.string (PrayerRequestType.toCode req.RequestType)
|
|
||||||
"@userId", Sql.uuid req.UserId.Value
|
|
||||||
"@groupId", Sql.uuid req.SmallGroupId.Value
|
|
||||||
"@entered", Sql.parameter (NpgsqlParameter ("@entered", req.EnteredDate))
|
|
||||||
"@updated", Sql.parameter (NpgsqlParameter ("@updated", req.UpdatedDate))
|
|
||||||
"@requestor", Sql.stringOrNone req.Requestor
|
|
||||||
"@text", Sql.string req.Text
|
|
||||||
"@notifyChaplain", Sql.bool req.NotifyChaplain
|
|
||||||
"@expiration", Sql.string (Expiration.toCode req.Expiration) ]
|
|
||||||
|
|
||||||
/// Search prayer requests for the given term
|
|
||||||
let searchForGroup group searchTerm pageNbr =
|
|
||||||
Custom.list
|
|
||||||
$"SELECT * FROM pt.prayer_request WHERE small_group_id = @groupId AND request_text ILIKE @search
|
|
||||||
UNION
|
|
||||||
SELECT * FROM pt.prayer_request WHERE small_group_id = @groupId AND COALESCE(requestor, '') ILIKE @search
|
|
||||||
ORDER BY {orderBy group.Preferences.RequestSort}
|
|
||||||
{paginate pageNbr group.Preferences.PageSize}"
|
|
||||||
[ "@groupId", Sql.uuid group.Id.Value; "@search", Sql.string $"%%%s{searchTerm}%%" ] mapToPrayerRequest
|
|
||||||
|
|
||||||
/// Retrieve a prayer request by its ID
|
|
||||||
let tryById (reqId : PrayerRequestId) =
|
|
||||||
Custom.single "SELECT * FROM pt.prayer_request WHERE id = @id" [ "@id", Sql.uuid reqId.Value ]
|
|
||||||
mapToPrayerRequest
|
|
||||||
|
|
||||||
/// Update the expiration for the given prayer request
|
|
||||||
let updateExpiration (req : PrayerRequest) withTime =
|
|
||||||
let sql, parameters =
|
|
||||||
if withTime then
|
|
||||||
", updated_date = @updated",
|
|
||||||
[ "@updated", Sql.parameter (NpgsqlParameter ("@updated", req.UpdatedDate)) ]
|
|
||||||
else "", []
|
|
||||||
Custom.nonQuery $"UPDATE pt.prayer_request SET expiration = @expiration{sql} WHERE id = @id"
|
|
||||||
([ "@expiration", Sql.string (Expiration.toCode req.Expiration)
|
|
||||||
"@id", Sql.uuid req.Id.Value ]
|
|
||||||
|> List.append parameters)
|
|
||||||
|
|
||||||
|
|
||||||
/// Functions to retrieve small group information
|
|
||||||
module SmallGroups =
|
|
||||||
|
|
||||||
/// Count the number of small groups for a church
|
|
||||||
let countByChurch (churchId : ChurchId) =
|
|
||||||
Custom.scalar "SELECT COUNT(id) AS group_count FROM pt.small_group WHERE church_id = @churchId"
|
|
||||||
[ "@churchId", Sql.uuid churchId.Value ] (fun row -> row.int "group_count")
|
|
||||||
|
|
||||||
/// Delete a small group by its ID
|
|
||||||
let deleteById (groupId : SmallGroupId) = backgroundTask {
|
|
||||||
let idParam = [ [ "@groupId", Sql.uuid groupId.Value ] ]
|
|
||||||
let! _ =
|
|
||||||
Configuration.dataSource ()
|
|
||||||
|> Sql.fromDataSource
|
|
||||||
|> Sql.executeTransactionAsync
|
|
||||||
[ "DELETE FROM pt.prayer_request WHERE small_group_id = @groupId", idParam
|
|
||||||
"DELETE FROM pt.user_small_group WHERE small_group_id = @groupId", idParam
|
|
||||||
"DELETE FROM pt.list_preference WHERE small_group_id = @groupId", idParam
|
|
||||||
"DELETE FROM pt.small_group WHERE id = @groupId", idParam ]
|
|
||||||
()
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Get information for all small groups
|
|
||||||
let infoForAll () =
|
|
||||||
Custom.list
|
|
||||||
"SELECT sg.id, sg.group_name, c.church_name, lp.time_zone_id, lp.is_public
|
|
||||||
FROM pt.small_group sg
|
|
||||||
INNER JOIN pt.church c ON c.id = sg.church_id
|
|
||||||
INNER JOIN pt.list_preference lp ON lp.small_group_id = sg.id
|
|
||||||
ORDER BY sg.group_name"
|
|
||||||
[] mapToSmallGroupInfo
|
|
||||||
|
|
||||||
/// Get a list of small group IDs along with a description that includes the church name
|
|
||||||
let listAll () =
|
|
||||||
Custom.list
|
|
||||||
"SELECT g.group_name, g.id, c.church_name
|
|
||||||
FROM pt.small_group g
|
|
||||||
INNER JOIN pt.church c ON c.id = g.church_id
|
|
||||||
ORDER BY c.church_name, g.group_name"
|
|
||||||
[] mapToSmallGroupItem
|
|
||||||
|
|
||||||
/// Get a list of small group IDs and descriptions for groups with a group password
|
|
||||||
let listProtected () =
|
|
||||||
Custom.list
|
|
||||||
"SELECT g.group_name, g.id, c.church_name, lp.is_public
|
|
||||||
FROM pt.small_group g
|
|
||||||
INNER JOIN pt.church c ON c.id = g.church_id
|
|
||||||
INNER JOIN pt.list_preference lp ON lp.small_group_id = g.id
|
|
||||||
WHERE COALESCE(lp.group_password, '') <> ''
|
|
||||||
ORDER BY c.church_name, g.group_name"
|
|
||||||
[] mapToSmallGroupItem
|
|
||||||
|
|
||||||
/// Get a list of small group IDs and descriptions for groups that are public or have a group password
|
|
||||||
let listPublicAndProtected () =
|
|
||||||
Custom.list
|
|
||||||
"SELECT g.group_name, g.id, c.church_name, lp.time_zone_id, lp.is_public
|
|
||||||
FROM pt.small_group g
|
|
||||||
INNER JOIN pt.church c ON c.id = g.church_id
|
|
||||||
INNER JOIN pt.list_preference lp ON lp.small_group_id = g.id
|
|
||||||
WHERE lp.is_public = TRUE
|
|
||||||
OR COALESCE(lp.group_password, '') <> ''
|
|
||||||
ORDER BY c.church_name, g.group_name"
|
|
||||||
[] mapToSmallGroupInfo
|
|
||||||
|
|
||||||
/// Log on for a small group (includes list preferences)
|
|
||||||
let logOn (groupId : SmallGroupId) password =
|
|
||||||
Custom.single
|
|
||||||
"SELECT sg.*, lp.*
|
|
||||||
FROM pt.small_group sg
|
|
||||||
INNER JOIN pt.list_preference lp ON lp.small_group_id = sg.id
|
|
||||||
WHERE sg.id = @id
|
|
||||||
AND lp.group_password = @password"
|
|
||||||
[ "@id", Sql.uuid groupId.Value; "@password", Sql.string password ] mapToSmallGroupWithPreferences
|
|
||||||
|
|
||||||
/// Save a small group
|
|
||||||
let save (group : SmallGroup) isNew = backgroundTask {
|
|
||||||
let! _ =
|
|
||||||
Configuration.dataSource ()
|
|
||||||
|> Sql.fromDataSource
|
|
||||||
|> Sql.executeTransactionAsync [
|
|
||||||
"INSERT INTO pt.small_group (
|
|
||||||
id, church_id, group_name
|
|
||||||
) VALUES (
|
|
||||||
@id, @churchId, @name
|
|
||||||
) ON CONFLICT (id) DO UPDATE
|
|
||||||
SET church_id = EXCLUDED.church_id,
|
|
||||||
group_name = EXCLUDED.group_name",
|
|
||||||
[ [ "@id", Sql.uuid group.Id.Value
|
|
||||||
"@churchId", Sql.uuid group.ChurchId.Value
|
|
||||||
"@name", Sql.string group.Name ] ]
|
|
||||||
if isNew then
|
|
||||||
"INSERT INTO pt.list_preference (small_group_id) VALUES (@id)",
|
|
||||||
[ [ "@id", Sql.uuid group.Id.Value ] ]
|
|
||||||
]
|
|
||||||
()
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Save a small group's list preferences
|
|
||||||
let savePreferences (pref : ListPreferences) =
|
|
||||||
Custom.nonQuery
|
|
||||||
"UPDATE pt.list_preference
|
|
||||||
SET days_to_keep_new = @daysToKeepNew,
|
|
||||||
days_to_expire = @daysToExpire,
|
|
||||||
long_term_update_weeks = @longTermUpdateWeeks,
|
|
||||||
email_from_name = @emailFromName,
|
|
||||||
email_from_address = @emailFromAddress,
|
|
||||||
fonts = @fonts,
|
|
||||||
heading_color = @headingColor,
|
|
||||||
line_color = @lineColor,
|
|
||||||
heading_font_size = @headingFontSize,
|
|
||||||
text_font_size = @textFontSize,
|
|
||||||
request_sort = @requestSort,
|
|
||||||
group_password = @groupPassword,
|
|
||||||
default_email_type = @defaultEmailType,
|
|
||||||
is_public = @isPublic,
|
|
||||||
time_zone_id = @timeZoneId,
|
|
||||||
page_size = @pageSize,
|
|
||||||
as_of_date_display = @asOfDateDisplay
|
|
||||||
WHERE small_group_id = @groupId"
|
|
||||||
[ "@groupId", Sql.uuid pref.SmallGroupId.Value
|
|
||||||
"@daysToKeepNew", Sql.int pref.DaysToKeepNew
|
|
||||||
"@daysToExpire", Sql.int pref.DaysToExpire
|
|
||||||
"@longTermUpdateWeeks", Sql.int pref.LongTermUpdateWeeks
|
|
||||||
"@emailFromName", Sql.string pref.EmailFromName
|
|
||||||
"@emailFromAddress", Sql.string pref.EmailFromAddress
|
|
||||||
"@fonts", Sql.string pref.Fonts
|
|
||||||
"@headingColor", Sql.string pref.HeadingColor
|
|
||||||
"@lineColor", Sql.string pref.LineColor
|
|
||||||
"@headingFontSize", Sql.int pref.HeadingFontSize
|
|
||||||
"@textFontSize", Sql.int pref.TextFontSize
|
|
||||||
"@requestSort", Sql.string (RequestSort.toCode pref.RequestSort)
|
|
||||||
"@groupPassword", Sql.string pref.GroupPassword
|
|
||||||
"@defaultEmailType", Sql.string (EmailFormat.toCode pref.DefaultEmailType)
|
|
||||||
"@isPublic", Sql.bool pref.IsPublic
|
|
||||||
"@timeZoneId", Sql.string (TimeZoneId.toString pref.TimeZoneId)
|
|
||||||
"@pageSize", Sql.int pref.PageSize
|
|
||||||
"@asOfDateDisplay", Sql.string (AsOfDateDisplay.toCode pref.AsOfDateDisplay) ]
|
|
||||||
|
|
||||||
/// Get a small group by its ID
|
|
||||||
let tryById (groupId : SmallGroupId) =
|
|
||||||
Custom.single "SELECT * FROM pt.small_group WHERE id = @id" [ "@id", Sql.uuid groupId.Value ] mapToSmallGroup
|
|
||||||
|
|
||||||
/// Get a small group by its ID with its list preferences populated
|
|
||||||
let tryByIdWithPreferences (groupId : SmallGroupId) =
|
|
||||||
Custom.single
|
|
||||||
"SELECT sg.*, lp.*
|
|
||||||
FROM pt.small_group sg
|
|
||||||
INNER JOIN pt.list_preference lp ON lp.small_group_id = sg.id
|
|
||||||
WHERE sg.id = @id"
|
|
||||||
[ "@id", Sql.uuid groupId.Value ] mapToSmallGroupWithPreferences
|
|
||||||
|
|
||||||
|
|
||||||
/// Functions to manipulate users
|
|
||||||
module Users =
|
|
||||||
|
|
||||||
/// Retrieve all PrayerTracker users
|
|
||||||
let all () =
|
|
||||||
Custom.list "SELECT * FROM pt.pt_user ORDER BY last_name, first_name" [] mapToUser
|
|
||||||
|
|
||||||
/// Count the number of users for a church
|
|
||||||
let countByChurch (churchId : ChurchId) =
|
|
||||||
Custom.scalar
|
|
||||||
"SELECT COUNT(u.id) AS user_count
|
|
||||||
FROM pt.pt_user u
|
|
||||||
WHERE EXISTS (
|
|
||||||
SELECT 1
|
|
||||||
FROM pt.user_small_group usg
|
|
||||||
INNER JOIN pt.small_group sg ON sg.id = usg.small_group_id
|
|
||||||
WHERE usg.user_id = u.id
|
|
||||||
AND sg.church_id = @churchId)"
|
|
||||||
[ "@churchId", Sql.uuid churchId.Value ] (fun row -> row.int "user_count")
|
|
||||||
|
|
||||||
/// Count the number of users for a small group
|
|
||||||
let countByGroup (groupId : SmallGroupId) =
|
|
||||||
Custom.scalar "SELECT COUNT(user_id) AS user_count FROM pt.user_small_group WHERE small_group_id = @groupId"
|
|
||||||
[ "@groupId", Sql.uuid groupId.Value ] (fun row -> row.int "user_count")
|
|
||||||
|
|
||||||
/// Delete a user by its database ID
|
|
||||||
let deleteById (userId : UserId) =
|
|
||||||
Custom.nonQuery "DELETE FROM pt.pt_user WHERE id = @id" [ "@id", Sql.uuid userId.Value ]
|
|
||||||
|
|
||||||
/// Get the IDs of the small groups for which the given user is authorized
|
|
||||||
let groupIdsByUserId (userId : UserId) =
|
|
||||||
Custom.list "SELECT small_group_id FROM pt.user_small_group WHERE user_id = @id"
|
|
||||||
[ "@id", Sql.uuid userId.Value ] (fun row -> SmallGroupId (row.uuid "small_group_id"))
|
|
||||||
|
|
||||||
/// Get a list of users authorized to administer the given small group
|
|
||||||
let listByGroupId (groupId : SmallGroupId) =
|
|
||||||
Custom.list
|
|
||||||
"SELECT u.*
|
|
||||||
FROM pt.pt_user u
|
|
||||||
INNER JOIN pt.user_small_group usg ON usg.user_id = u.id
|
|
||||||
WHERE usg.small_group_id = @groupId
|
|
||||||
ORDER BY u.last_name, u.first_name"
|
|
||||||
[ "@groupId", Sql.uuid groupId.Value ] mapToUser
|
|
||||||
|
|
||||||
/// Save a user's information
|
|
||||||
let save (user : User) =
|
|
||||||
Custom.nonQuery
|
|
||||||
"INSERT INTO pt.pt_user (
|
|
||||||
id, first_name, last_name, email, is_admin, password_hash
|
|
||||||
) VALUES (
|
|
||||||
@id, @firstName, @lastName, @email, @isAdmin, @passwordHash
|
|
||||||
) ON CONFLICT (id) DO UPDATE
|
|
||||||
SET first_name = EXCLUDED.first_name,
|
|
||||||
last_name = EXCLUDED.last_name,
|
|
||||||
email = EXCLUDED.email,
|
|
||||||
is_admin = EXCLUDED.is_admin,
|
|
||||||
password_hash = EXCLUDED.password_hash"
|
|
||||||
[ "@id", Sql.uuid user.Id.Value
|
|
||||||
"@firstName", Sql.string user.FirstName
|
|
||||||
"@lastName", Sql.string user.LastName
|
|
||||||
"@email", Sql.string user.Email
|
|
||||||
"@isAdmin", Sql.bool user.IsAdmin
|
|
||||||
"@passwordHash", Sql.string user.PasswordHash ]
|
|
||||||
|
|
||||||
/// Find a user by its e-mail address and authorized small group
|
|
||||||
let tryByEmailAndGroup email (groupId : SmallGroupId) =
|
|
||||||
Custom.single
|
|
||||||
"SELECT u.*
|
|
||||||
FROM pt.pt_user u
|
|
||||||
INNER JOIN pt.user_small_group usg ON usg.user_id = u.id AND usg.small_group_id = @groupId
|
|
||||||
WHERE u.email = @email"
|
|
||||||
[ "@email", Sql.string email; "@groupId", Sql.uuid groupId.Value ] mapToUser
|
|
||||||
|
|
||||||
/// Find a user by their database ID
|
|
||||||
let tryById (userId : UserId) =
|
|
||||||
Custom.single "SELECT * FROM pt.pt_user WHERE id = @id" [ "@id", Sql.uuid userId.Value ] mapToUser
|
|
||||||
|
|
||||||
/// Update a user's last seen date/time
|
|
||||||
let updateLastSeen (userId : UserId) (now : Instant) =
|
|
||||||
Custom.nonQuery "UPDATE pt.pt_user SET last_seen = @now WHERE id = @id"
|
|
||||||
[ "@id", Sql.uuid userId.Value; "@now", Sql.parameter (NpgsqlParameter ("@now", now)) ]
|
|
||||||
|
|
||||||
/// Update a user's password hash
|
|
||||||
let updatePassword (user : User) =
|
|
||||||
Custom.nonQuery "UPDATE pt.pt_user SET password_hash = @passwordHash WHERE id = @id"
|
|
||||||
[ "@id", Sql.uuid user.Id.Value; "@passwordHash", Sql.string user.PasswordHash ]
|
|
||||||
|
|
||||||
/// Update a user's authorized small groups
|
|
||||||
let updateSmallGroups (userId : UserId) groupIds = backgroundTask {
|
|
||||||
let! existingGroupIds = groupIdsByUserId userId
|
|
||||||
let toAdd =
|
|
||||||
groupIds |> List.filter (fun it -> existingGroupIds |> List.exists (fun grpId -> grpId = it) |> not)
|
|
||||||
let toDelete =
|
|
||||||
existingGroupIds |> List.filter (fun it -> groupIds |> List.exists (fun grpId -> grpId = it) |> not)
|
|
||||||
let queries = seq {
|
|
||||||
if not (List.isEmpty toAdd) then
|
|
||||||
"INSERT INTO pt.user_small_group VALUES (@userId, @smallGroupId)",
|
|
||||||
toAdd |> List.map (fun it -> [ "@userId", Sql.uuid userId.Value; "@smallGroupId", Sql.uuid it.Value ])
|
|
||||||
if not (List.isEmpty toDelete) then
|
|
||||||
"DELETE FROM pt.user_small_group WHERE user_id = @userId AND small_group_id = @smallGroupId",
|
|
||||||
toDelete
|
|
||||||
|> List.map (fun it -> [ "@userId", Sql.uuid userId.Value; "@smallGroupId", Sql.uuid it.Value ])
|
|
||||||
}
|
|
||||||
if not (Seq.isEmpty queries) then
|
|
||||||
let! _ =
|
|
||||||
Configuration.dataSource ()
|
|
||||||
|> Sql.fromDataSource
|
|
||||||
|> Sql.executeTransactionAsync (List.ofSeq queries)
|
|
||||||
()
|
|
||||||
}
|
|
||||||
@@ -1,193 +0,0 @@
|
|||||||
namespace PrayerTracker.Data
|
|
||||||
|
|
||||||
open System.Threading
|
|
||||||
open System.Threading.Tasks
|
|
||||||
open Microsoft.Extensions.Caching.Distributed
|
|
||||||
open NodaTime
|
|
||||||
open Npgsql
|
|
||||||
open Npgsql.FSharp
|
|
||||||
|
|
||||||
/// Helper types and functions for the cache
|
|
||||||
[<AutoOpen>]
|
|
||||||
module private CacheHelpers =
|
|
||||||
|
|
||||||
open System
|
|
||||||
|
|
||||||
/// The cache entry
|
|
||||||
type Entry =
|
|
||||||
{ /// The ID of the cache entry
|
|
||||||
Id : string
|
|
||||||
|
|
||||||
/// The value to be cached
|
|
||||||
Payload : byte[]
|
|
||||||
|
|
||||||
/// When this entry will expire
|
|
||||||
ExpireAt : Instant
|
|
||||||
|
|
||||||
/// The duration by which the expiration should be pushed out when being refreshed
|
|
||||||
SlidingExpiration : Duration option
|
|
||||||
|
|
||||||
/// The must-expire-by date/time for the cache entry
|
|
||||||
AbsoluteExpiration : Instant option
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Run a task synchronously
|
|
||||||
let sync<'T> (it : Task<'T>) = it |> (Async.AwaitTask >> Async.RunSynchronously)
|
|
||||||
|
|
||||||
/// Get the current instant
|
|
||||||
let getNow () = SystemClock.Instance.GetCurrentInstant ()
|
|
||||||
|
|
||||||
/// Create a parameter for the expire-at time
|
|
||||||
let expireParam (it : Instant) =
|
|
||||||
"@expireAt", Sql.parameter (NpgsqlParameter ("@expireAt", it))
|
|
||||||
|
|
||||||
/// Create a parameter for a possibly-missing NodaTime type
|
|
||||||
let optParam<'T> name (it : 'T option) =
|
|
||||||
let p = NpgsqlParameter ($"@%s{name}", if Option.isSome it then box it.Value else DBNull.Value)
|
|
||||||
p.ParameterName, Sql.parameter p
|
|
||||||
|
|
||||||
|
|
||||||
open BitBadger.Npgsql.FSharp.Documents
|
|
||||||
|
|
||||||
/// A distributed cache implementation in PostgreSQL used to handle sessions for myWebLog
|
|
||||||
type DistributedCache () =
|
|
||||||
|
|
||||||
// ~~~ INITIALIZATION ~~~
|
|
||||||
|
|
||||||
do
|
|
||||||
task {
|
|
||||||
let! exists =
|
|
||||||
Custom.scalar
|
|
||||||
$"SELECT EXISTS
|
|
||||||
(SELECT 1 FROM pg_tables WHERE schemaname = 'public' AND tablename = 'session')
|
|
||||||
AS does_exist"
|
|
||||||
[] (fun row -> row.bool "does_exist")
|
|
||||||
if not exists then
|
|
||||||
do! Custom.nonQuery
|
|
||||||
"CREATE TABLE session (
|
|
||||||
id TEXT NOT NULL PRIMARY KEY,
|
|
||||||
payload BYTEA NOT NULL,
|
|
||||||
expire_at TIMESTAMPTZ NOT NULL,
|
|
||||||
sliding_expiration INTERVAL,
|
|
||||||
absolute_expiration TIMESTAMPTZ);
|
|
||||||
CREATE INDEX idx_session_expiration ON session (expire_at)" []
|
|
||||||
} |> sync
|
|
||||||
|
|
||||||
// ~~~ SUPPORT FUNCTIONS ~~~
|
|
||||||
|
|
||||||
/// Get an entry, updating it for sliding expiration
|
|
||||||
let getEntry key = backgroundTask {
|
|
||||||
let idParam = "@id", Sql.string key
|
|
||||||
let! tryEntry =
|
|
||||||
Custom.single "SELECT * FROM session WHERE id = @id" [ idParam ]
|
|
||||||
(fun row ->
|
|
||||||
{ Id = row.string "id"
|
|
||||||
Payload = row.bytea "payload"
|
|
||||||
ExpireAt = row.fieldValue<Instant> "expire_at"
|
|
||||||
SlidingExpiration = row.fieldValueOrNone<Duration> "sliding_expiration"
|
|
||||||
AbsoluteExpiration = row.fieldValueOrNone<Instant> "absolute_expiration" })
|
|
||||||
match tryEntry with
|
|
||||||
| Some entry ->
|
|
||||||
let now = getNow ()
|
|
||||||
let slideExp = defaultArg entry.SlidingExpiration Duration.MinValue
|
|
||||||
let absExp = defaultArg entry.AbsoluteExpiration Instant.MinValue
|
|
||||||
let needsRefresh, item =
|
|
||||||
if entry.ExpireAt = absExp then false, entry
|
|
||||||
elif slideExp = Duration.MinValue && absExp = Instant.MinValue then false, entry
|
|
||||||
elif absExp > Instant.MinValue && entry.ExpireAt.Plus slideExp > absExp then
|
|
||||||
true, { entry with ExpireAt = absExp }
|
|
||||||
else true, { entry with ExpireAt = now.Plus slideExp }
|
|
||||||
if needsRefresh then
|
|
||||||
do! Custom.nonQuery "UPDATE session SET expire_at = @expireAt WHERE id = @id"
|
|
||||||
[ expireParam item.ExpireAt; idParam ]
|
|
||||||
return if item.ExpireAt > now then Some entry else None
|
|
||||||
| None -> return None
|
|
||||||
}
|
|
||||||
|
|
||||||
/// The last time expired entries were purged (runs every 30 minutes)
|
|
||||||
let mutable lastPurge = Instant.MinValue
|
|
||||||
|
|
||||||
/// Purge expired entries every 30 minutes
|
|
||||||
let purge () = backgroundTask {
|
|
||||||
let now = getNow ()
|
|
||||||
if lastPurge.Plus (Duration.FromMinutes 30L) < now then
|
|
||||||
do! Custom.nonQuery "DELETE FROM session WHERE expire_at < @expireAt" [ expireParam now ]
|
|
||||||
lastPurge <- now
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Remove a cache entry
|
|
||||||
let removeEntry key =
|
|
||||||
Custom.nonQuery "DELETE FROM session WHERE id = @id" [ "@id", Sql.string key ]
|
|
||||||
|
|
||||||
/// Save an entry
|
|
||||||
let saveEntry (opts : DistributedCacheEntryOptions) key payload =
|
|
||||||
let now = getNow ()
|
|
||||||
let expireAt, slideExp, absExp =
|
|
||||||
if opts.SlidingExpiration.HasValue then
|
|
||||||
let slide = Duration.FromTimeSpan opts.SlidingExpiration.Value
|
|
||||||
now.Plus slide, Some slide, None
|
|
||||||
elif opts.AbsoluteExpiration.HasValue then
|
|
||||||
let exp = Instant.FromDateTimeOffset opts.AbsoluteExpiration.Value
|
|
||||||
exp, None, Some exp
|
|
||||||
elif opts.AbsoluteExpirationRelativeToNow.HasValue then
|
|
||||||
let exp = now.Plus (Duration.FromTimeSpan opts.AbsoluteExpirationRelativeToNow.Value)
|
|
||||||
exp, None, Some exp
|
|
||||||
else
|
|
||||||
// Default to 2 hour sliding expiration
|
|
||||||
let slide = Duration.FromHours 2
|
|
||||||
now.Plus slide, Some slide, None
|
|
||||||
Custom.nonQuery
|
|
||||||
"INSERT INTO session (
|
|
||||||
id, payload, expire_at, sliding_expiration, absolute_expiration
|
|
||||||
) VALUES (
|
|
||||||
@id, @payload, @expireAt, @slideExp, @absExp
|
|
||||||
) ON CONFLICT (id) DO UPDATE
|
|
||||||
SET payload = EXCLUDED.payload,
|
|
||||||
expire_at = EXCLUDED.expire_at,
|
|
||||||
sliding_expiration = EXCLUDED.sliding_expiration,
|
|
||||||
absolute_expiration = EXCLUDED.absolute_expiration"
|
|
||||||
[ "@id", Sql.string key
|
|
||||||
"@payload", Sql.bytea payload
|
|
||||||
expireParam expireAt
|
|
||||||
optParam "slideExp" slideExp
|
|
||||||
optParam "absExp" absExp ]
|
|
||||||
|
|
||||||
// ~~~ IMPLEMENTATION FUNCTIONS ~~~
|
|
||||||
|
|
||||||
/// Retrieve the data for a cache entry
|
|
||||||
let get key (_ : CancellationToken) = backgroundTask {
|
|
||||||
match! getEntry key with
|
|
||||||
| Some entry ->
|
|
||||||
do! purge ()
|
|
||||||
return entry.Payload
|
|
||||||
| None -> return null
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Refresh an entry
|
|
||||||
let refresh key (cancelToken : CancellationToken) = backgroundTask {
|
|
||||||
let! _ = get key cancelToken
|
|
||||||
()
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Remove an entry
|
|
||||||
let remove key (_ : CancellationToken) = backgroundTask {
|
|
||||||
do! removeEntry key
|
|
||||||
do! purge ()
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Set an entry
|
|
||||||
let set key value options (_ : CancellationToken) = backgroundTask {
|
|
||||||
do! saveEntry options key value
|
|
||||||
do! purge ()
|
|
||||||
}
|
|
||||||
|
|
||||||
interface IDistributedCache with
|
|
||||||
member this.Get key = get key CancellationToken.None |> sync
|
|
||||||
member this.GetAsync (key, token) = get key token
|
|
||||||
member this.Refresh key = refresh key CancellationToken.None |> sync
|
|
||||||
member this.RefreshAsync (key, token) = refresh key token
|
|
||||||
member this.Remove key = remove key CancellationToken.None |> sync
|
|
||||||
member this.RemoveAsync (key, token) = remove key token
|
|
||||||
member this.Set (key, value, options) = set key value options CancellationToken.None |> sync
|
|
||||||
member this.SetAsync (key, value, options, token) = set key value options token
|
|
||||||
|
|
||||||
@@ -1,557 +0,0 @@
|
|||||||
namespace PrayerTracker.Entities
|
|
||||||
|
|
||||||
(*-- SUPPORT TYPES --*)
|
|
||||||
|
|
||||||
/// How as-of dates should (or should not) be displayed with requests
|
|
||||||
type AsOfDateDisplay =
|
|
||||||
/// No as-of date should be displayed
|
|
||||||
| NoDisplay
|
|
||||||
/// The as-of date should be displayed in the culture's short date format
|
|
||||||
| ShortDate
|
|
||||||
/// The as-of date should be displayed in the culture's long date format
|
|
||||||
| LongDate
|
|
||||||
|
|
||||||
/// Functions to support as-of date display options
|
|
||||||
module AsOfDateDisplay =
|
|
||||||
|
|
||||||
/// Convert to a DU case from a single-character string
|
|
||||||
let fromCode code =
|
|
||||||
match code with
|
|
||||||
| "N" -> NoDisplay
|
|
||||||
| "S" -> ShortDate
|
|
||||||
| "L" -> LongDate
|
|
||||||
| _ -> invalidArg "code" $"Unknown code {code}"
|
|
||||||
|
|
||||||
/// Convert this DU case to a single-character string
|
|
||||||
let toCode = function NoDisplay -> "N" | ShortDate -> "S" | LongDate -> "L"
|
|
||||||
|
|
||||||
|
|
||||||
/// Acceptable e-mail formats
|
|
||||||
type EmailFormat =
|
|
||||||
/// HTML e-mail
|
|
||||||
| HtmlFormat
|
|
||||||
/// Plain-text e-mail
|
|
||||||
| PlainTextFormat
|
|
||||||
|
|
||||||
/// Functions to support e-mail formats
|
|
||||||
module EmailFormat =
|
|
||||||
|
|
||||||
/// Convert to a DU case from a single-character string
|
|
||||||
let fromCode code =
|
|
||||||
match code with
|
|
||||||
| "H" -> HtmlFormat
|
|
||||||
| "P" -> PlainTextFormat
|
|
||||||
| _ -> invalidArg "code" $"Unknown code {code}"
|
|
||||||
|
|
||||||
/// Convert this DU case to a single-character string
|
|
||||||
let toCode = function HtmlFormat -> "H" | PlainTextFormat -> "P"
|
|
||||||
|
|
||||||
|
|
||||||
/// Expiration for requests
|
|
||||||
type Expiration =
|
|
||||||
/// Follow the rules for normal expiration
|
|
||||||
| Automatic
|
|
||||||
/// Do not expire via rules
|
|
||||||
| Manual
|
|
||||||
/// Force immediate expiration
|
|
||||||
| Forced
|
|
||||||
|
|
||||||
/// Functions to support expirations
|
|
||||||
module Expiration =
|
|
||||||
|
|
||||||
/// Convert to a DU case from a single-character string
|
|
||||||
let fromCode code =
|
|
||||||
match code with
|
|
||||||
| "A" -> Automatic
|
|
||||||
| "M" -> Manual
|
|
||||||
| "F" -> Forced
|
|
||||||
| _ -> invalidArg "code" $"Unknown code {code}"
|
|
||||||
|
|
||||||
/// Convert this DU case to a single-character string
|
|
||||||
let toCode = function Automatic -> "A" | Manual -> "M" | Forced -> "F"
|
|
||||||
|
|
||||||
|
|
||||||
/// Types of prayer requests
|
|
||||||
type PrayerRequestType =
|
|
||||||
/// Current requests
|
|
||||||
| CurrentRequest
|
|
||||||
/// Long-term/ongoing request
|
|
||||||
| LongTermRequest
|
|
||||||
/// Expectant couples
|
|
||||||
| Expecting
|
|
||||||
/// Praise reports
|
|
||||||
| PraiseReport
|
|
||||||
/// Announcements
|
|
||||||
| Announcement
|
|
||||||
|
|
||||||
/// Functions to support prayer request types
|
|
||||||
module PrayerRequestType =
|
|
||||||
|
|
||||||
/// Convert to a DU case from a single-character string
|
|
||||||
let fromCode code =
|
|
||||||
match code with
|
|
||||||
| "C" -> CurrentRequest
|
|
||||||
| "L" -> LongTermRequest
|
|
||||||
| "E" -> Expecting
|
|
||||||
| "P" -> PraiseReport
|
|
||||||
| "A" -> Announcement
|
|
||||||
| _ -> invalidArg "code" $"Unknown code {code}"
|
|
||||||
|
|
||||||
/// Convert this DU case to a single-character string
|
|
||||||
let toCode =
|
|
||||||
function
|
|
||||||
| CurrentRequest -> "C"
|
|
||||||
| LongTermRequest -> "L"
|
|
||||||
| Expecting -> "E"
|
|
||||||
| PraiseReport -> "P"
|
|
||||||
| Announcement -> "A"
|
|
||||||
|
|
||||||
|
|
||||||
/// How requests should be sorted
|
|
||||||
type RequestSort =
|
|
||||||
/// Sort by date, then by requestor/subject
|
|
||||||
| SortByDate
|
|
||||||
/// Sort by requestor/subject, then by date
|
|
||||||
| SortByRequestor
|
|
||||||
|
|
||||||
/// Functions to support request sorts
|
|
||||||
module RequestSort =
|
|
||||||
|
|
||||||
/// Convert to a DU case from a single-character string
|
|
||||||
let fromCode code =
|
|
||||||
match code with
|
|
||||||
| "D" -> SortByDate
|
|
||||||
| "R" -> SortByRequestor
|
|
||||||
| _ -> invalidArg "code" $"Unknown code {code}"
|
|
||||||
|
|
||||||
/// Convert this DU case to a single-character string
|
|
||||||
let toCode = function SortByDate -> "D" | SortByRequestor -> "R"
|
|
||||||
|
|
||||||
|
|
||||||
open System
|
|
||||||
|
|
||||||
/// PK type for the Church entity
|
|
||||||
type ChurchId =
|
|
||||||
| ChurchId of Guid
|
|
||||||
with
|
|
||||||
/// The GUID value of the church ID
|
|
||||||
member this.Value = this |> function ChurchId guid -> guid
|
|
||||||
|
|
||||||
|
|
||||||
/// PK type for the Member entity
|
|
||||||
type MemberId =
|
|
||||||
| MemberId of Guid
|
|
||||||
with
|
|
||||||
/// The GUID value of the member ID
|
|
||||||
member this.Value = this |> function MemberId guid -> guid
|
|
||||||
|
|
||||||
|
|
||||||
/// PK type for the PrayerRequest entity
|
|
||||||
type PrayerRequestId =
|
|
||||||
| PrayerRequestId of Guid
|
|
||||||
with
|
|
||||||
/// The GUID value of the prayer request ID
|
|
||||||
member this.Value = this |> function PrayerRequestId guid -> guid
|
|
||||||
|
|
||||||
|
|
||||||
/// PK type for the SmallGroup entity
|
|
||||||
type SmallGroupId =
|
|
||||||
| SmallGroupId of Guid
|
|
||||||
with
|
|
||||||
/// The GUID value of the small group ID
|
|
||||||
member this.Value = this |> function SmallGroupId guid -> guid
|
|
||||||
|
|
||||||
|
|
||||||
/// PK type for the TimeZone entity
|
|
||||||
type TimeZoneId = TimeZoneId of string
|
|
||||||
|
|
||||||
/// Functions to support time zone IDs
|
|
||||||
module TimeZoneId =
|
|
||||||
|
|
||||||
/// Convert a time zone ID to its string value
|
|
||||||
let toString = function TimeZoneId it -> it
|
|
||||||
|
|
||||||
|
|
||||||
/// PK type for the User entity
|
|
||||||
type UserId =
|
|
||||||
| UserId of Guid
|
|
||||||
with
|
|
||||||
/// The GUID value of the user ID
|
|
||||||
member this.Value = this |> function UserId guid -> guid
|
|
||||||
|
|
||||||
(*-- SPECIFIC VIEW TYPES --*)
|
|
||||||
|
|
||||||
/// Statistics for churches
|
|
||||||
[<NoComparison; NoEquality>]
|
|
||||||
type ChurchStats =
|
|
||||||
{ /// The number of small groups in the church
|
|
||||||
SmallGroups : int
|
|
||||||
|
|
||||||
/// The number of prayer requests in the church
|
|
||||||
PrayerRequests : int
|
|
||||||
|
|
||||||
/// The number of users who can access small groups in the church
|
|
||||||
Users : int
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/// Information needed to display the public/protected request list and small group maintenance pages
|
|
||||||
[<NoComparison; NoEquality>]
|
|
||||||
type SmallGroupInfo =
|
|
||||||
{ /// The ID of the small group
|
|
||||||
Id : string
|
|
||||||
|
|
||||||
/// The name of the small group
|
|
||||||
Name : string
|
|
||||||
|
|
||||||
/// The name of the church to which the small group belongs
|
|
||||||
ChurchName : string
|
|
||||||
|
|
||||||
/// The ID of the time zone for the small group
|
|
||||||
TimeZoneId : TimeZoneId
|
|
||||||
|
|
||||||
/// Whether the small group has a publicly-available request list
|
|
||||||
IsPublic : bool
|
|
||||||
}
|
|
||||||
|
|
||||||
(*-- ENTITIES --*)
|
|
||||||
|
|
||||||
open NodaTime
|
|
||||||
|
|
||||||
/// This represents a church
|
|
||||||
[<NoComparison; NoEquality>]
|
|
||||||
type Church =
|
|
||||||
{ /// The ID of this church
|
|
||||||
Id : ChurchId
|
|
||||||
|
|
||||||
/// The name of the church
|
|
||||||
Name : string
|
|
||||||
|
|
||||||
/// The city where the church is
|
|
||||||
City : string
|
|
||||||
|
|
||||||
/// The 2-letter state or province code for the church's location
|
|
||||||
State : string
|
|
||||||
|
|
||||||
/// Does this church have an active interface with Virtual Prayer Space?
|
|
||||||
HasVpsInterface : bool
|
|
||||||
|
|
||||||
/// The address for the interface
|
|
||||||
InterfaceAddress : string option
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Functions to support churches
|
|
||||||
module Church =
|
|
||||||
|
|
||||||
/// An empty church
|
|
||||||
// aww... how sad :(
|
|
||||||
let empty =
|
|
||||||
{ Id = ChurchId Guid.Empty
|
|
||||||
Name = ""
|
|
||||||
City = ""
|
|
||||||
State = ""
|
|
||||||
HasVpsInterface = false
|
|
||||||
InterfaceAddress = None
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/// Preferences for the form and format of the prayer request list
|
|
||||||
[<NoComparison; NoEquality>]
|
|
||||||
type ListPreferences =
|
|
||||||
{ /// The Id of the small group to which these preferences belong
|
|
||||||
SmallGroupId : SmallGroupId
|
|
||||||
|
|
||||||
/// The days after which regular requests expire
|
|
||||||
DaysToExpire : int
|
|
||||||
|
|
||||||
/// The number of days a new or updated request is considered new
|
|
||||||
DaysToKeepNew : int
|
|
||||||
|
|
||||||
/// The number of weeks after which long-term requests are flagged for follow-up
|
|
||||||
LongTermUpdateWeeks : int
|
|
||||||
|
|
||||||
/// The name from which e-mails are sent
|
|
||||||
EmailFromName : string
|
|
||||||
|
|
||||||
/// The e-mail address from which e-mails are sent
|
|
||||||
EmailFromAddress : string
|
|
||||||
|
|
||||||
/// The fonts to use in generating the list of prayer requests
|
|
||||||
Fonts : string
|
|
||||||
|
|
||||||
/// The color for the prayer request list headings
|
|
||||||
HeadingColor : string
|
|
||||||
|
|
||||||
/// The color for the lines offsetting the prayer request list headings
|
|
||||||
LineColor : string
|
|
||||||
|
|
||||||
/// The font size for the headings on the prayer request list
|
|
||||||
HeadingFontSize : int
|
|
||||||
|
|
||||||
/// The font size for the text on the prayer request list
|
|
||||||
TextFontSize : int
|
|
||||||
|
|
||||||
/// The order in which the prayer requests are sorted
|
|
||||||
RequestSort : RequestSort
|
|
||||||
|
|
||||||
/// The password used for "small group login" (view-only request list)
|
|
||||||
GroupPassword : string
|
|
||||||
|
|
||||||
/// The default e-mail type for this class
|
|
||||||
DefaultEmailType : EmailFormat
|
|
||||||
|
|
||||||
/// Whether this class makes its request list public
|
|
||||||
IsPublic : bool
|
|
||||||
|
|
||||||
/// The time zone which this class uses (use tzdata names)
|
|
||||||
TimeZoneId : TimeZoneId
|
|
||||||
|
|
||||||
/// The number of requests displayed per page
|
|
||||||
PageSize : int
|
|
||||||
|
|
||||||
/// How the as-of date should be automatically displayed
|
|
||||||
AsOfDateDisplay : AsOfDateDisplay
|
|
||||||
}
|
|
||||||
with
|
|
||||||
|
|
||||||
/// The list of fonts to use when displaying request lists (converts "native" to native font stack)
|
|
||||||
member this.FontStack =
|
|
||||||
if this.Fonts = "native" then
|
|
||||||
"""system-ui,-apple-system,"Segoe UI",Roboto,Ubuntu,"Liberation Sans",Cantarell,"Helvetica Neue",sans-serif"""
|
|
||||||
else this.Fonts
|
|
||||||
|
|
||||||
/// Functions to support list preferences
|
|
||||||
module ListPreferences =
|
|
||||||
|
|
||||||
/// A set of preferences with their default values
|
|
||||||
let empty =
|
|
||||||
{ SmallGroupId = SmallGroupId Guid.Empty
|
|
||||||
DaysToExpire = 14
|
|
||||||
DaysToKeepNew = 7
|
|
||||||
LongTermUpdateWeeks = 4
|
|
||||||
EmailFromName = "PrayerTracker"
|
|
||||||
EmailFromAddress = "prayer@bitbadger.solutions"
|
|
||||||
Fonts = "native"
|
|
||||||
HeadingColor = "maroon"
|
|
||||||
LineColor = "navy"
|
|
||||||
HeadingFontSize = 16
|
|
||||||
TextFontSize = 12
|
|
||||||
RequestSort = SortByDate
|
|
||||||
GroupPassword = ""
|
|
||||||
DefaultEmailType = HtmlFormat
|
|
||||||
IsPublic = false
|
|
||||||
TimeZoneId = TimeZoneId "America/Denver"
|
|
||||||
PageSize = 100
|
|
||||||
AsOfDateDisplay = NoDisplay
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/// A member of a small group
|
|
||||||
[<NoComparison; NoEquality>]
|
|
||||||
type Member =
|
|
||||||
{ /// The ID of the small group member
|
|
||||||
Id : MemberId
|
|
||||||
|
|
||||||
/// The Id of the small group to which this member belongs
|
|
||||||
SmallGroupId : SmallGroupId
|
|
||||||
|
|
||||||
/// The name of the member
|
|
||||||
Name : string
|
|
||||||
|
|
||||||
/// The e-mail address for the member
|
|
||||||
Email : string
|
|
||||||
|
|
||||||
/// The type of e-mail preferred by this member
|
|
||||||
Format : EmailFormat option
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Functions to support small group members
|
|
||||||
module Member =
|
|
||||||
|
|
||||||
/// An empty member
|
|
||||||
let empty =
|
|
||||||
{ Id = MemberId Guid.Empty
|
|
||||||
SmallGroupId = SmallGroupId Guid.Empty
|
|
||||||
Name = ""
|
|
||||||
Email = ""
|
|
||||||
Format = None
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/// This represents a single prayer request
|
|
||||||
[<NoComparison; NoEquality>]
|
|
||||||
type PrayerRequest =
|
|
||||||
{ /// The ID of this request
|
|
||||||
Id : PrayerRequestId
|
|
||||||
|
|
||||||
/// The type of the request
|
|
||||||
RequestType : PrayerRequestType
|
|
||||||
|
|
||||||
/// The ID of the user who entered the request
|
|
||||||
UserId : UserId
|
|
||||||
|
|
||||||
/// The small group to which this request belongs
|
|
||||||
SmallGroupId : SmallGroupId
|
|
||||||
|
|
||||||
/// The date/time on which this request was entered
|
|
||||||
EnteredDate : Instant
|
|
||||||
|
|
||||||
/// The date/time this request was last updated
|
|
||||||
UpdatedDate : Instant
|
|
||||||
|
|
||||||
/// The name of the requestor or subject, or title of announcement
|
|
||||||
Requestor : string option
|
|
||||||
|
|
||||||
/// The text of the request
|
|
||||||
Text : string
|
|
||||||
|
|
||||||
/// Whether the chaplain should be notified for this request
|
|
||||||
NotifyChaplain : bool
|
|
||||||
|
|
||||||
/// Is this request expired?
|
|
||||||
Expiration : Expiration
|
|
||||||
}
|
|
||||||
// functions are below small group functions
|
|
||||||
|
|
||||||
|
|
||||||
/// This represents a small group (Sunday School class, Bible study group, etc.)
|
|
||||||
[<NoComparison; NoEquality>]
|
|
||||||
type SmallGroup =
|
|
||||||
{ /// The ID of this small group
|
|
||||||
Id : SmallGroupId
|
|
||||||
|
|
||||||
/// The church to which this group belongs
|
|
||||||
ChurchId : ChurchId
|
|
||||||
|
|
||||||
/// The name of the group
|
|
||||||
Name : string
|
|
||||||
|
|
||||||
/// The preferences for the request list
|
|
||||||
Preferences : ListPreferences
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Functions to support small groups
|
|
||||||
module SmallGroup =
|
|
||||||
|
|
||||||
/// An empty small group
|
|
||||||
let empty =
|
|
||||||
{ Id = SmallGroupId Guid.Empty
|
|
||||||
ChurchId = ChurchId Guid.Empty
|
|
||||||
Name = ""
|
|
||||||
Preferences = ListPreferences.empty
|
|
||||||
}
|
|
||||||
|
|
||||||
/// The DateTimeZone for the time zone ID for this small group
|
|
||||||
let timeZone group =
|
|
||||||
let tzId = TimeZoneId.toString group.Preferences.TimeZoneId
|
|
||||||
if DateTimeZoneProviders.Tzdb.Ids.Contains tzId then DateTimeZoneProviders.Tzdb[tzId]
|
|
||||||
else DateTimeZone.Utc
|
|
||||||
|
|
||||||
/// Get the local date/time for this group
|
|
||||||
let localTimeNow (clock : IClock) group =
|
|
||||||
if isNull clock then nullArg (nameof clock)
|
|
||||||
clock.GetCurrentInstant().InZone(timeZone group).LocalDateTime
|
|
||||||
|
|
||||||
/// Get the local date for this group
|
|
||||||
let localDateNow clock group =
|
|
||||||
(localTimeNow clock group).Date
|
|
||||||
|
|
||||||
|
|
||||||
/// Functions to support prayer requests
|
|
||||||
module PrayerRequest =
|
|
||||||
|
|
||||||
/// An empty request
|
|
||||||
let empty =
|
|
||||||
{ Id = PrayerRequestId Guid.Empty
|
|
||||||
RequestType = CurrentRequest
|
|
||||||
UserId = UserId Guid.Empty
|
|
||||||
SmallGroupId = SmallGroupId Guid.Empty
|
|
||||||
EnteredDate = Instant.MinValue
|
|
||||||
UpdatedDate = Instant.MinValue
|
|
||||||
Requestor = None
|
|
||||||
Text = ""
|
|
||||||
NotifyChaplain = false
|
|
||||||
Expiration = Automatic
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Is this request expired?
|
|
||||||
let isExpired (asOf : LocalDate) group req =
|
|
||||||
match req.Expiration, req.RequestType with
|
|
||||||
| Forced, _ -> true
|
|
||||||
| Manual, _
|
|
||||||
| Automatic, LongTermRequest
|
|
||||||
| Automatic, Expecting -> false
|
|
||||||
| Automatic, _ ->
|
|
||||||
// Automatic expiration
|
|
||||||
Period.Between(req.UpdatedDate.InZone(SmallGroup.timeZone group).Date, asOf, PeriodUnits.Days).Days
|
|
||||||
>= group.Preferences.DaysToExpire
|
|
||||||
|
|
||||||
/// Is an update required for this long-term request?
|
|
||||||
let updateRequired asOf group req =
|
|
||||||
if isExpired asOf group req then false
|
|
||||||
else asOf.PlusWeeks -group.Preferences.LongTermUpdateWeeks
|
|
||||||
>= req.UpdatedDate.InZone(SmallGroup.timeZone group).Date
|
|
||||||
|
|
||||||
|
|
||||||
/// This represents a user of PrayerTracker
|
|
||||||
[<NoComparison; NoEquality>]
|
|
||||||
type User =
|
|
||||||
{ /// The ID of this user
|
|
||||||
Id : UserId
|
|
||||||
|
|
||||||
/// The first name of this user
|
|
||||||
FirstName : string
|
|
||||||
|
|
||||||
/// The last name of this user
|
|
||||||
LastName : string
|
|
||||||
|
|
||||||
/// The e-mail address of the user
|
|
||||||
Email : string
|
|
||||||
|
|
||||||
/// Whether this user is a PrayerTracker system administrator
|
|
||||||
IsAdmin : bool
|
|
||||||
|
|
||||||
/// The user's hashed password
|
|
||||||
PasswordHash : string
|
|
||||||
|
|
||||||
/// The last time the user was seen (set whenever the user is loaded into a session)
|
|
||||||
LastSeen : Instant option
|
|
||||||
}
|
|
||||||
with
|
|
||||||
/// The full name of the user
|
|
||||||
member this.Name =
|
|
||||||
$"{this.FirstName} {this.LastName}"
|
|
||||||
|
|
||||||
/// Functions to support users
|
|
||||||
module User =
|
|
||||||
|
|
||||||
/// An empty user
|
|
||||||
let empty =
|
|
||||||
{ Id = UserId Guid.Empty
|
|
||||||
FirstName = ""
|
|
||||||
LastName = ""
|
|
||||||
Email = ""
|
|
||||||
IsAdmin = false
|
|
||||||
PasswordHash = ""
|
|
||||||
LastSeen = None
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/// Cross-reference between user and small group
|
|
||||||
[<NoComparison; NoEquality>]
|
|
||||||
type UserSmallGroup =
|
|
||||||
{ /// The Id of the user who has access to the small group
|
|
||||||
UserId : UserId
|
|
||||||
|
|
||||||
/// The Id of the small group to which the user has access
|
|
||||||
SmallGroupId : SmallGroupId
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Functions to support user/small group cross-reference
|
|
||||||
module UserSmallGroup =
|
|
||||||
|
|
||||||
/// An empty user/small group xref
|
|
||||||
let empty =
|
|
||||||
{ UserId = UserId Guid.Empty
|
|
||||||
SmallGroupId = SmallGroupId Guid.Empty
|
|
||||||
}
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<Compile Include="Entities.fs" />
|
|
||||||
<Compile Include="Access.fs" />
|
|
||||||
<Compile Include="DistributedCache.fs" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<PackageReference Include="BitBadger.Npgsql.FSharp.Documents" Version="1.0.0-beta3" />
|
|
||||||
<PackageReference Include="Giraffe" Version="6.0.0" />
|
|
||||||
<PackageReference Include="NodaTime" Version="3.1.9" />
|
|
||||||
<PackageReference Include="Npgsql.FSharp" Version="5.7.0" />
|
|
||||||
<PackageReference Include="Npgsql.NodaTime" Version="7.0.4" />
|
|
||||||
<PackageReference Update="FSharp.Core" Version="7.0.300" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
</Project>
|
|
||||||
21
src/PrayerTracker.MigrateV9/PrayerTracker.MigrateV9.fsproj
Normal file
21
src/PrayerTracker.MigrateV9/PrayerTracker.MigrateV9.fsproj
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<OutputType>Exe</OutputType>
|
||||||
|
<TargetFramework>net9.0</TargetFramework>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Include="Program.fs" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\Data\PrayerTracker.Data.fsproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="BitBadger.Documents.Postgres" Version="4.0.1" />
|
||||||
|
<PackageReference Include="Npgsql.NodaTime" Version="9.0.2" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
133
src/PrayerTracker.MigrateV9/Program.fs
Normal file
133
src/PrayerTracker.MigrateV9/Program.fs
Normal file
@@ -0,0 +1,133 @@
|
|||||||
|
|
||||||
|
open NodaTime
|
||||||
|
open PrayerTracker.Entities
|
||||||
|
|
||||||
|
module PgMappings =
|
||||||
|
/// Map a row to a Church instance
|
||||||
|
let mapToChurch (row: RowReader) =
|
||||||
|
{ Id = ChurchId (row.uuid "id")
|
||||||
|
Name = row.string "church_name"
|
||||||
|
City = row.string "city"
|
||||||
|
State = row.string "state"
|
||||||
|
HasVpsInterface = row.bool "has_vps_interface"
|
||||||
|
InterfaceAddress = row.stringOrNone "interface_address" }
|
||||||
|
|
||||||
|
/// Map a row to a Member instance
|
||||||
|
let mapToMember (row: RowReader) =
|
||||||
|
{ Id = MemberId (row.uuid "id")
|
||||||
|
SmallGroupId = SmallGroupId (row.uuid "small_group_id")
|
||||||
|
Name = row.string "member_name"
|
||||||
|
Email = row.string "email"
|
||||||
|
Format = row.stringOrNone "email_format" |> Option.map EmailFormat.Parse }
|
||||||
|
|
||||||
|
/// Map a row to a Prayer Request instance
|
||||||
|
let mapToPrayerRequest (row: RowReader) =
|
||||||
|
{ Id = PrayerRequestId (row.uuid "id")
|
||||||
|
UserId = UserId (row.uuid "user_id")
|
||||||
|
SmallGroupId = SmallGroupId (row.uuid "small_group_id")
|
||||||
|
EnteredDate = row.fieldValue<Instant> "entered_date"
|
||||||
|
UpdatedDate = row.fieldValue<Instant> "updated_date"
|
||||||
|
Requestor = row.stringOrNone "requestor"
|
||||||
|
Text = row.string "request_text"
|
||||||
|
NotifyChaplain = row.bool "notify_chaplain"
|
||||||
|
RequestType = PrayerRequestType.Parse (row.string "request_type")
|
||||||
|
Expiration = Expiration.Parse (row.string "expiration") }
|
||||||
|
|
||||||
|
/// Map a row to a Small Group instance
|
||||||
|
let mapToSmallGroup (row: RowReader) =
|
||||||
|
{ Id = SmallGroupId (row.uuid "id")
|
||||||
|
ChurchId = ChurchId (row.uuid "church_id")
|
||||||
|
Name = row.string "group_name"
|
||||||
|
Preferences =
|
||||||
|
{ DaysToKeepNew = row.int "days_to_keep_new"
|
||||||
|
DaysToExpire = row.int "days_to_expire"
|
||||||
|
LongTermUpdateWeeks = row.int "long_term_update_weeks"
|
||||||
|
EmailFromName = row.string "email_from_name"
|
||||||
|
EmailFromAddress = row.string "email_from_address"
|
||||||
|
Fonts = row.string "fonts"
|
||||||
|
HeadingColor = row.string "heading_color"
|
||||||
|
LineColor = row.string "line_color"
|
||||||
|
HeadingFontSize = row.int "heading_font_size"
|
||||||
|
TextFontSize = row.int "text_font_size"
|
||||||
|
GroupPassword = row.string "group_password"
|
||||||
|
IsPublic = row.bool "is_public"
|
||||||
|
PageSize = row.int "page_size"
|
||||||
|
TimeZoneId = TimeZoneId (row.string "time_zone_id")
|
||||||
|
RequestSort = RequestSort.Parse (row.string "request_sort")
|
||||||
|
DefaultEmailType = EmailFormat.Parse (row.string "default_email_type")
|
||||||
|
AsOfDateDisplay = AsOfDateDisplay.Parse (row.string "as_of_date_display") } }
|
||||||
|
|
||||||
|
/// Map a row to a User instance
|
||||||
|
let mapToUser (row: RowReader) =
|
||||||
|
{ Id = UserId (row.uuid "id")
|
||||||
|
FirstName = row.string "first_name"
|
||||||
|
LastName = row.string "last_name"
|
||||||
|
Email = row.string "email"
|
||||||
|
IsAdmin = row.bool "is_admin"
|
||||||
|
PasswordHash = row.string "password_hash"
|
||||||
|
LastSeen = row.fieldValueOrNone<Instant> "last_seen"
|
||||||
|
SmallGroups = [] }
|
||||||
|
|
||||||
|
|
||||||
|
open System
|
||||||
|
open BitBadger.Documents.Sqlite
|
||||||
|
open Npgsql
|
||||||
|
open Npgsql.FSharp
|
||||||
|
open PrayerTracker.Data
|
||||||
|
|
||||||
|
task {
|
||||||
|
|
||||||
|
Configuration.useConnectionString (Environment.GetEnvironmentVariable "PT_SQLITE_CONN")
|
||||||
|
do! Connection.setUp ()
|
||||||
|
|
||||||
|
let builder = NpgsqlDataSourceBuilder(Environment.GetEnvironmentVariable "PT_PG_CONN")
|
||||||
|
let _ = builder.UseNodaTime()
|
||||||
|
use source = builder.Build()
|
||||||
|
|
||||||
|
let! churches =
|
||||||
|
Sql.fromDataSource source
|
||||||
|
|> Sql.query "SELECT * FROM pt.church"
|
||||||
|
|> Sql.executeAsync PgMappings.mapToChurch
|
||||||
|
for church in churches do
|
||||||
|
do! Churches.save church
|
||||||
|
printfn "Migrated %d churches" churches.Length
|
||||||
|
|
||||||
|
let! groups =
|
||||||
|
Sql.fromDataSource source
|
||||||
|
|> Sql.query "SELECT sg.*, lp.* FROM pt.small_group sg
|
||||||
|
INNER JOIN pt.list_preference lp ON lp.small_group_id = sg.id"
|
||||||
|
|> Sql.executeAsync PgMappings.mapToSmallGroup
|
||||||
|
for group in groups do
|
||||||
|
do! SmallGroups.save group
|
||||||
|
printfn "Migrated %d groups" groups.Length
|
||||||
|
|
||||||
|
let! members =
|
||||||
|
Sql.fromDataSource source
|
||||||
|
|> Sql.query "SELECT * from pt.member"
|
||||||
|
|> Sql.executeAsync PgMappings.mapToMember
|
||||||
|
for mbr in members do
|
||||||
|
do! Members.save mbr
|
||||||
|
printfn "Migrated %d members" members.Length
|
||||||
|
|
||||||
|
let! requests =
|
||||||
|
Sql.fromDataSource source
|
||||||
|
|> Sql.query "SELECT * from pt.prayer_request"
|
||||||
|
|> Sql.executeAsync PgMappings.mapToPrayerRequest
|
||||||
|
for request in requests do
|
||||||
|
do! PrayerRequests.save request
|
||||||
|
printfn "Migrated %d requests" requests.Length
|
||||||
|
|
||||||
|
let! users =
|
||||||
|
Sql.fromDataSource source
|
||||||
|
|> Sql.query "SELECT * FROM pt.pt_user"
|
||||||
|
|> Sql.executeAsync PgMappings.mapToUser
|
||||||
|
for user in users do
|
||||||
|
let! groups =
|
||||||
|
Sql.fromDataSource source
|
||||||
|
|> Sql.query "SELECT small_group_id FROM pt.user_small_group WHERE user_id = @user_id"
|
||||||
|
|> Sql.parameters [ "@user_id", Sql.uuid user.Id.Value ]
|
||||||
|
|> Sql.executeAsync (fun row -> (row.uuid >> SmallGroupId) "small_group_id")
|
||||||
|
do! Users.save { user with SmallGroups = groups }
|
||||||
|
printfn "Migrated %d users" users.Length
|
||||||
|
|
||||||
|
} |> Async.AwaitTask |> Async.RunSynchronously
|
||||||
@@ -1,361 +0,0 @@
|
|||||||
module PrayerTracker.Entities.EntitiesTests
|
|
||||||
|
|
||||||
open Expecto
|
|
||||||
open NodaTime.Testing
|
|
||||||
open NodaTime
|
|
||||||
open System
|
|
||||||
|
|
||||||
[<Tests>]
|
|
||||||
let asOfDateDisplayTests =
|
|
||||||
testList "AsOfDateDisplay" [
|
|
||||||
test "NoDisplay code is correct" {
|
|
||||||
Expect.equal (AsOfDateDisplay.toCode NoDisplay) "N" "The code for NoDisplay should have been \"N\""
|
|
||||||
}
|
|
||||||
test "ShortDate code is correct" {
|
|
||||||
Expect.equal (AsOfDateDisplay.toCode ShortDate) "S" "The code for ShortDate should have been \"S\""
|
|
||||||
}
|
|
||||||
test "LongDate code is correct" {
|
|
||||||
Expect.equal (AsOfDateDisplay.toCode LongDate) "L" "The code for LongDate should have been \"N\""
|
|
||||||
}
|
|
||||||
test "fromCode N should return NoDisplay" {
|
|
||||||
Expect.equal (AsOfDateDisplay.fromCode "N") NoDisplay "\"N\" should have been converted to NoDisplay"
|
|
||||||
}
|
|
||||||
test "fromCode S should return ShortDate" {
|
|
||||||
Expect.equal (AsOfDateDisplay.fromCode "S") ShortDate "\"S\" should have been converted to ShortDate"
|
|
||||||
}
|
|
||||||
test "fromCode L should return LongDate" {
|
|
||||||
Expect.equal (AsOfDateDisplay.fromCode "L") LongDate "\"L\" should have been converted to LongDate"
|
|
||||||
}
|
|
||||||
test "fromCode X should raise" {
|
|
||||||
Expect.throws (fun () -> AsOfDateDisplay.fromCode "X" |> ignore)
|
|
||||||
"An unknown code should have raised an exception"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
|
|
||||||
[<Tests>]
|
|
||||||
let churchTests =
|
|
||||||
testList "Church" [
|
|
||||||
test "empty is as expected" {
|
|
||||||
let mt = Church.empty
|
|
||||||
Expect.equal mt.Id.Value Guid.Empty "The church ID should have been an empty GUID"
|
|
||||||
Expect.equal mt.Name "" "The name should have been blank"
|
|
||||||
Expect.equal mt.City "" "The city should have been blank"
|
|
||||||
Expect.equal mt.State "" "The state should have been blank"
|
|
||||||
Expect.isFalse mt.HasVpsInterface "The church should not show that it has an interface"
|
|
||||||
Expect.isNone mt.InterfaceAddress "The interface address should not exist"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
|
|
||||||
[<Tests>]
|
|
||||||
let emailFormatTests =
|
|
||||||
testList "EmailFormat" [
|
|
||||||
test "HtmlFormat code is correct" {
|
|
||||||
Expect.equal (EmailFormat.toCode HtmlFormat) "H" "The code for HtmlFormat should have been \"H\""
|
|
||||||
}
|
|
||||||
test "PlainTextFormat code is correct" {
|
|
||||||
Expect.equal (EmailFormat.toCode PlainTextFormat) "P" "The code for PlainTextFormat should have been \"P\""
|
|
||||||
}
|
|
||||||
test "fromCode H should return HtmlFormat" {
|
|
||||||
Expect.equal (EmailFormat.fromCode "H") HtmlFormat "\"H\" should have been converted to HtmlFormat"
|
|
||||||
}
|
|
||||||
test "fromCode P should return ShortDate" {
|
|
||||||
Expect.equal (EmailFormat.fromCode "P") PlainTextFormat
|
|
||||||
"\"P\" should have been converted to PlainTextFormat"
|
|
||||||
}
|
|
||||||
test "fromCode Z should raise" {
|
|
||||||
Expect.throws (fun () -> EmailFormat.fromCode "Z" |> ignore)
|
|
||||||
"An unknown code should have raised an exception"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
|
|
||||||
[<Tests>]
|
|
||||||
let expirationTests =
|
|
||||||
testList "Expiration" [
|
|
||||||
test "Automatic code is correct" {
|
|
||||||
Expect.equal (Expiration.toCode Automatic) "A" "The code for Automatic should have been \"A\""
|
|
||||||
}
|
|
||||||
test "Manual code is correct" {
|
|
||||||
Expect.equal (Expiration.toCode Manual) "M" "The code for Manual should have been \"M\""
|
|
||||||
}
|
|
||||||
test "Forced code is correct" {
|
|
||||||
Expect.equal (Expiration.toCode Forced) "F" "The code for Forced should have been \"F\""
|
|
||||||
}
|
|
||||||
test "fromCode A should return Automatic" {
|
|
||||||
Expect.equal (Expiration.fromCode "A") Automatic "\"A\" should have been converted to Automatic"
|
|
||||||
}
|
|
||||||
test "fromCode M should return Manual" {
|
|
||||||
Expect.equal (Expiration.fromCode "M") Manual "\"M\" should have been converted to Manual"
|
|
||||||
}
|
|
||||||
test "fromCode F should return Forced" {
|
|
||||||
Expect.equal (Expiration.fromCode "F") Forced "\"F\" should have been converted to Forced"
|
|
||||||
}
|
|
||||||
test "fromCode V should raise" {
|
|
||||||
Expect.throws (fun () -> Expiration.fromCode "V" |> ignore)
|
|
||||||
"An unknown code should have raised an exception"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
|
|
||||||
[<Tests>]
|
|
||||||
let listPreferencesTests =
|
|
||||||
testList "ListPreferences" [
|
|
||||||
test "FontStack is correct for native fonts" {
|
|
||||||
Expect.equal ListPreferences.empty.FontStack
|
|
||||||
"""system-ui,-apple-system,"Segoe UI",Roboto,Ubuntu,"Liberation Sans",Cantarell,"Helvetica Neue",sans-serif"""
|
|
||||||
"The expected native font stack was incorrect"
|
|
||||||
}
|
|
||||||
test "FontStack is correct for specific fonts" {
|
|
||||||
Expect.equal { ListPreferences.empty with Fonts = "Arial,sans-serif" }.FontStack "Arial,sans-serif"
|
|
||||||
"The specified fonts were not returned correctly"
|
|
||||||
}
|
|
||||||
test "empty is as expected" {
|
|
||||||
let mt = ListPreferences.empty
|
|
||||||
Expect.equal mt.SmallGroupId.Value Guid.Empty "The small group ID should have been an empty GUID"
|
|
||||||
Expect.equal mt.DaysToExpire 14 "The default days to expire should have been 14"
|
|
||||||
Expect.equal mt.DaysToKeepNew 7 "The default days to keep new should have been 7"
|
|
||||||
Expect.equal mt.LongTermUpdateWeeks 4 "The default long term update weeks should have been 4"
|
|
||||||
Expect.equal mt.EmailFromName "PrayerTracker" "The default e-mail from name should have been PrayerTracker"
|
|
||||||
Expect.equal mt.EmailFromAddress "prayer@bitbadger.solutions"
|
|
||||||
"The default e-mail from address should have been prayer@bitbadger.solutions"
|
|
||||||
Expect.equal mt.Fonts "native" "The default list fonts were incorrect"
|
|
||||||
Expect.equal mt.HeadingColor "maroon" "The default heading text color should have been maroon"
|
|
||||||
Expect.equal mt.LineColor "navy" "The default heading line color should have been navy"
|
|
||||||
Expect.equal mt.HeadingFontSize 16 "The default heading font size should have been 16"
|
|
||||||
Expect.equal mt.TextFontSize 12 "The default text font size should have been 12"
|
|
||||||
Expect.equal mt.RequestSort SortByDate "The default request sort should have been by date"
|
|
||||||
Expect.equal mt.GroupPassword "" "The default group password should have been blank"
|
|
||||||
Expect.equal mt.DefaultEmailType HtmlFormat "The default e-mail type should have been HTML"
|
|
||||||
Expect.isFalse mt.IsPublic "The isPublic flag should not have been set"
|
|
||||||
Expect.equal (TimeZoneId.toString mt.TimeZoneId) "America/Denver"
|
|
||||||
"The default time zone should have been America/Denver"
|
|
||||||
Expect.equal mt.PageSize 100 "The default page size should have been 100"
|
|
||||||
Expect.equal mt.AsOfDateDisplay NoDisplay "The as-of date display should have been No Display"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
|
|
||||||
[<Tests>]
|
|
||||||
let memberTests =
|
|
||||||
testList "Member" [
|
|
||||||
test "empty is as expected" {
|
|
||||||
let mt = Member.empty
|
|
||||||
Expect.equal mt.Id.Value Guid.Empty "The member ID should have been an empty GUID"
|
|
||||||
Expect.equal mt.SmallGroupId.Value Guid.Empty "The small group ID should have been an empty GUID"
|
|
||||||
Expect.equal mt.Name "" "The member name should have been blank"
|
|
||||||
Expect.equal mt.Email "" "The member e-mail address should have been blank"
|
|
||||||
Expect.isNone mt.Format "The preferred e-mail format should not exist"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
|
|
||||||
[<Tests>]
|
|
||||||
let prayerRequestTests =
|
|
||||||
let instantNow = SystemClock.Instance.GetCurrentInstant
|
|
||||||
let localDateNow () = (instantNow ()).InUtc().Date
|
|
||||||
testList "PrayerRequest" [
|
|
||||||
test "empty is as expected" {
|
|
||||||
let mt = PrayerRequest.empty
|
|
||||||
Expect.equal mt.Id.Value Guid.Empty "The request ID should have been an empty GUID"
|
|
||||||
Expect.equal mt.RequestType CurrentRequest "The request type should have been Current"
|
|
||||||
Expect.equal mt.UserId.Value Guid.Empty "The user ID should have been an empty GUID"
|
|
||||||
Expect.equal mt.SmallGroupId.Value Guid.Empty "The small group ID should have been an empty GUID"
|
|
||||||
Expect.equal mt.EnteredDate Instant.MinValue "The entered date should have been the minimum"
|
|
||||||
Expect.equal mt.UpdatedDate Instant.MinValue "The updated date should have been the minimum"
|
|
||||||
Expect.isNone mt.Requestor "The requestor should not exist"
|
|
||||||
Expect.equal mt.Text "" "The request text should have been blank"
|
|
||||||
Expect.isFalse mt.NotifyChaplain "The notify chaplain flag should not have been set"
|
|
||||||
Expect.equal mt.Expiration Automatic "The expiration should have been Automatic"
|
|
||||||
}
|
|
||||||
test "isExpired always returns false for expecting requests" {
|
|
||||||
PrayerRequest.isExpired (localDateNow ()) SmallGroup.empty
|
|
||||||
{ PrayerRequest.empty with RequestType = Expecting }
|
|
||||||
|> Flip.Expect.isFalse "An expecting request should never be considered expired"
|
|
||||||
}
|
|
||||||
test "isExpired always returns false for manually-expired requests" {
|
|
||||||
PrayerRequest.isExpired (localDateNow ()) SmallGroup.empty
|
|
||||||
{ PrayerRequest.empty with UpdatedDate = (instantNow ()) - Duration.FromDays 1; Expiration = Manual }
|
|
||||||
|> Flip.Expect.isFalse "A never-expired request should never be considered expired"
|
|
||||||
}
|
|
||||||
test "isExpired always returns false for long term/recurring requests" {
|
|
||||||
PrayerRequest.isExpired (localDateNow ()) SmallGroup.empty
|
|
||||||
{ PrayerRequest.empty with RequestType = LongTermRequest }
|
|
||||||
|> Flip.Expect.isFalse "A recurring/long-term request should never be considered expired"
|
|
||||||
}
|
|
||||||
test "isExpired always returns true for force-expired requests" {
|
|
||||||
PrayerRequest.isExpired (localDateNow ()) SmallGroup.empty
|
|
||||||
{ PrayerRequest.empty with UpdatedDate = (instantNow ()); Expiration = Forced }
|
|
||||||
|> Flip.Expect.isTrue "A force-expired request should always be considered expired"
|
|
||||||
}
|
|
||||||
test "isExpired returns false for non-expired requests" {
|
|
||||||
let now = instantNow ()
|
|
||||||
PrayerRequest.isExpired (now.InUtc().Date) SmallGroup.empty
|
|
||||||
{ PrayerRequest.empty with UpdatedDate = now - Duration.FromDays 5 }
|
|
||||||
|> Flip.Expect.isFalse "A request updated 5 days ago should not be considered expired"
|
|
||||||
}
|
|
||||||
test "isExpired returns true for expired requests" {
|
|
||||||
let now = instantNow ()
|
|
||||||
PrayerRequest.isExpired (now.InUtc().Date) SmallGroup.empty
|
|
||||||
{ PrayerRequest.empty with UpdatedDate = now - Duration.FromDays 15 }
|
|
||||||
|> Flip.Expect.isTrue "A request updated 15 days ago should be considered expired"
|
|
||||||
}
|
|
||||||
test "isExpired returns true for same-day expired requests" {
|
|
||||||
let now = instantNow ()
|
|
||||||
PrayerRequest.isExpired (now.InUtc().Date) SmallGroup.empty
|
|
||||||
{ PrayerRequest.empty with UpdatedDate = now - (Duration.FromDays 14) - (Duration.FromSeconds 1L) }
|
|
||||||
|> Flip.Expect.isTrue "A request entered a second before midnight should be considered expired"
|
|
||||||
}
|
|
||||||
test "updateRequired returns false for expired requests" {
|
|
||||||
PrayerRequest.updateRequired (localDateNow ()) SmallGroup.empty
|
|
||||||
{ PrayerRequest.empty with Expiration = Forced }
|
|
||||||
|> Flip.Expect.isFalse "An expired request should not require an update"
|
|
||||||
}
|
|
||||||
test "updateRequired returns false when an update is not required for an active request" {
|
|
||||||
let now = instantNow ()
|
|
||||||
PrayerRequest.updateRequired (localDateNow ()) SmallGroup.empty
|
|
||||||
{ PrayerRequest.empty with RequestType = LongTermRequest; UpdatedDate = now - Duration.FromDays 14 }
|
|
||||||
|> Flip.Expect.isFalse "An active request updated 14 days ago should not require an update until 28 days"
|
|
||||||
}
|
|
||||||
test "UpdateRequired returns true when an update is required for an active request" {
|
|
||||||
let now = instantNow ()
|
|
||||||
PrayerRequest.updateRequired (localDateNow ()) SmallGroup.empty
|
|
||||||
{ PrayerRequest.empty with RequestType = LongTermRequest; UpdatedDate = now - Duration.FromDays 34 }
|
|
||||||
|> Flip.Expect.isTrue "An active request updated 34 days ago should require an update (past 28 days)"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
|
|
||||||
[<Tests>]
|
|
||||||
let prayerRequestTypeTests =
|
|
||||||
testList "PrayerRequestType" [
|
|
||||||
test "CurrentRequest code is correct" {
|
|
||||||
Expect.equal (PrayerRequestType.toCode CurrentRequest) "C"
|
|
||||||
"The code for CurrentRequest should have been \"C\""
|
|
||||||
}
|
|
||||||
test "LongTermRequest code is correct" {
|
|
||||||
Expect.equal (PrayerRequestType.toCode LongTermRequest) "L"
|
|
||||||
"The code for LongTermRequest should have been \"L\""
|
|
||||||
}
|
|
||||||
test "PraiseReport code is correct" {
|
|
||||||
Expect.equal (PrayerRequestType.toCode PraiseReport) "P" "The code for PraiseReport should have been \"P\""
|
|
||||||
}
|
|
||||||
test "Expecting code is correct" {
|
|
||||||
Expect.equal (PrayerRequestType.toCode Expecting) "E" "The code for Expecting should have been \"E\""
|
|
||||||
}
|
|
||||||
test "Announcement code is correct" {
|
|
||||||
Expect.equal (PrayerRequestType.toCode Announcement) "A" "The code for Announcement should have been \"A\""
|
|
||||||
}
|
|
||||||
test "fromCode C should return CurrentRequest" {
|
|
||||||
Expect.equal (PrayerRequestType.fromCode "C") CurrentRequest
|
|
||||||
"\"C\" should have been converted to CurrentRequest"
|
|
||||||
}
|
|
||||||
test "fromCode L should return LongTermRequest" {
|
|
||||||
Expect.equal (PrayerRequestType.fromCode "L") LongTermRequest
|
|
||||||
"\"L\" should have been converted to LongTermRequest"
|
|
||||||
}
|
|
||||||
test "fromCode P should return PraiseReport" {
|
|
||||||
Expect.equal (PrayerRequestType.fromCode "P") PraiseReport
|
|
||||||
"\"P\" should have been converted to PraiseReport"
|
|
||||||
}
|
|
||||||
test "fromCode E should return Expecting" {
|
|
||||||
Expect.equal (PrayerRequestType.fromCode "E") Expecting "\"E\" should have been converted to Expecting"
|
|
||||||
}
|
|
||||||
test "fromCode A should return Announcement" {
|
|
||||||
Expect.equal (PrayerRequestType.fromCode "A") Announcement
|
|
||||||
"\"A\" should have been converted to Announcement"
|
|
||||||
}
|
|
||||||
test "fromCode R should raise" {
|
|
||||||
Expect.throws (fun () -> PrayerRequestType.fromCode "R" |> ignore)
|
|
||||||
"An unknown code should have raised an exception"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
|
|
||||||
[<Tests>]
|
|
||||||
let requestSortTests =
|
|
||||||
testList "RequestSort" [
|
|
||||||
test "SortByDate code is correct" {
|
|
||||||
Expect.equal (RequestSort.toCode SortByDate) "D" "The code for SortByDate should have been \"D\""
|
|
||||||
}
|
|
||||||
test "SortByRequestor code is correct" {
|
|
||||||
Expect.equal (RequestSort.toCode SortByRequestor) "R" "The code for SortByRequestor should have been \"R\""
|
|
||||||
}
|
|
||||||
test "fromCode D should return SortByDate" {
|
|
||||||
Expect.equal (RequestSort.fromCode "D") SortByDate "\"D\" should have been converted to SortByDate"
|
|
||||||
}
|
|
||||||
test "fromCode R should return SortByRequestor" {
|
|
||||||
Expect.equal (RequestSort.fromCode "R") SortByRequestor
|
|
||||||
"\"R\" should have been converted to SortByRequestor"
|
|
||||||
}
|
|
||||||
test "fromCode Q should raise" {
|
|
||||||
Expect.throws (fun () -> RequestSort.fromCode "Q" |> ignore)
|
|
||||||
"An unknown code should have raised an exception"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
|
|
||||||
[<Tests>]
|
|
||||||
let smallGroupTests =
|
|
||||||
testList "SmallGroup" [
|
|
||||||
let now = Instant.FromDateTimeUtc (DateTime (2017, 5, 12, 12, 15, 0, DateTimeKind.Utc))
|
|
||||||
let withFakeClock f () =
|
|
||||||
FakeClock now |> f
|
|
||||||
yield test "empty is as expected" {
|
|
||||||
let mt = SmallGroup.empty
|
|
||||||
Expect.equal mt.Id.Value Guid.Empty "The small group ID should have been an empty GUID"
|
|
||||||
Expect.equal mt.ChurchId.Value Guid.Empty "The church ID should have been an empty GUID"
|
|
||||||
Expect.equal mt.Name "" "The name should have been blank"
|
|
||||||
}
|
|
||||||
yield! testFixture withFakeClock [
|
|
||||||
"LocalTimeNow adjusts the time ahead of UTC",
|
|
||||||
fun clock ->
|
|
||||||
let grp =
|
|
||||||
{ SmallGroup.empty with
|
|
||||||
Preferences = { ListPreferences.empty with TimeZoneId = TimeZoneId "Europe/Berlin" }
|
|
||||||
}
|
|
||||||
Expect.isGreaterThan (SmallGroup.localTimeNow clock grp) (now.InUtc().LocalDateTime)
|
|
||||||
"UTC to Europe/Berlin should have added hours"
|
|
||||||
"LocalTimeNow adjusts the time behind UTC",
|
|
||||||
fun clock ->
|
|
||||||
Expect.isLessThan (SmallGroup.localTimeNow clock SmallGroup.empty) (now.InUtc().LocalDateTime)
|
|
||||||
"UTC to America/Denver should have subtracted hours"
|
|
||||||
"LocalTimeNow returns UTC when the time zone is invalid",
|
|
||||||
fun clock ->
|
|
||||||
let grp =
|
|
||||||
{ SmallGroup.empty with
|
|
||||||
Preferences = { ListPreferences.empty with TimeZoneId = TimeZoneId "garbage" }
|
|
||||||
}
|
|
||||||
Expect.equal (SmallGroup.localTimeNow clock grp) (now.InUtc().LocalDateTime)
|
|
||||||
"UTC should have been returned for an invalid time zone"
|
|
||||||
]
|
|
||||||
yield test "localTimeNow fails when clock is not passed" {
|
|
||||||
Expect.throws (fun () -> (SmallGroup.localTimeNow null SmallGroup.empty |> ignore))
|
|
||||||
"Should have raised an exception for null clock"
|
|
||||||
}
|
|
||||||
yield test "LocalDateNow returns the date portion" {
|
|
||||||
let clock = FakeClock (Instant.FromDateTimeUtc (DateTime (2017, 5, 12, 1, 15, 0, DateTimeKind.Utc)))
|
|
||||||
Expect.isLessThan (SmallGroup.localDateNow clock SmallGroup.empty) (now.InUtc().Date)
|
|
||||||
"The date should have been a day earlier"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
|
|
||||||
[<Tests>]
|
|
||||||
let userTests =
|
|
||||||
testList "User" [
|
|
||||||
test "empty is as expected" {
|
|
||||||
let mt = User.empty
|
|
||||||
Expect.equal mt.Id.Value Guid.Empty "The user ID should have been an empty GUID"
|
|
||||||
Expect.equal mt.FirstName "" "The first name should have been blank"
|
|
||||||
Expect.equal mt.LastName "" "The last name should have been blank"
|
|
||||||
Expect.equal mt.Email "" "The e-mail address should have been blank"
|
|
||||||
Expect.isFalse mt.IsAdmin "The is admin flag should not have been set"
|
|
||||||
Expect.equal mt.PasswordHash "" "The password hash should have been blank"
|
|
||||||
}
|
|
||||||
test "Name concatenates first and last names" {
|
|
||||||
let user = { User.empty with FirstName = "Unit"; LastName = "Test" }
|
|
||||||
Expect.equal user.Name "Unit Test" "The full name should be the first and last, separated by a space"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
|
|
||||||
[<Tests>]
|
|
||||||
let userSmallGroupTests =
|
|
||||||
testList "UserSmallGroup" [
|
|
||||||
test "empty is as expected" {
|
|
||||||
let mt = UserSmallGroup.empty
|
|
||||||
Expect.equal mt.UserId.Value Guid.Empty "The user ID should have been an empty GUID"
|
|
||||||
Expect.equal mt.SmallGroupId.Value Guid.Empty "The small group ID should have been an empty GUID"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
@@ -1,366 +0,0 @@
|
|||||||
/// Layout items for PrayerTracker
|
|
||||||
module PrayerTracker.Views.Layout
|
|
||||||
|
|
||||||
open Giraffe.ViewEngine
|
|
||||||
open Giraffe.ViewEngine.Accessibility
|
|
||||||
open PrayerTracker.ViewModels
|
|
||||||
open System.Globalization
|
|
||||||
|
|
||||||
/// Get the two-character language code for the current request
|
|
||||||
let langCode () = if CultureInfo.CurrentCulture.Name.StartsWith "es" then "es" else "en"
|
|
||||||
|
|
||||||
|
|
||||||
/// Navigation items
|
|
||||||
module Navigation =
|
|
||||||
|
|
||||||
/// Top navigation bar
|
|
||||||
let top m =
|
|
||||||
let s = I18N.localizer.Force ()
|
|
||||||
let menuSpacer = rawText " "
|
|
||||||
let _dropdown = _class "dropdown-btn"
|
|
||||||
let leftLinks = [
|
|
||||||
match m.User with
|
|
||||||
| Some u ->
|
|
||||||
li [ _class "dropdown" ] [
|
|
||||||
a [ _dropdown; _ariaLabel s["Requests"].Value; _title s["Requests"].Value; _roleButton ] [
|
|
||||||
icon "question_answer"; space; locStr s["Requests"]; space; icon "keyboard_arrow_down"
|
|
||||||
]
|
|
||||||
div [ _class "dropdown-content"; _roleMenuBar ] [
|
|
||||||
a [ _href "/prayer-requests"; _roleMenuItem ] [
|
|
||||||
icon "compare_arrows"; menuSpacer; locStr s["Maintain"]
|
|
||||||
]
|
|
||||||
a [ _href "/prayer-requests/view"; _roleMenuItem ] [
|
|
||||||
icon "list"; menuSpacer; locStr s["View List"]
|
|
||||||
]
|
|
||||||
]
|
|
||||||
]
|
|
||||||
li [ _class "dropdown" ] [
|
|
||||||
a [ _dropdown; _ariaLabel s["Group"].Value; _title s["Group"].Value; _roleButton ] [
|
|
||||||
icon "group"; space; locStr s["Group"]; space; icon "keyboard_arrow_down"
|
|
||||||
]
|
|
||||||
div [ _class "dropdown-content"; _roleMenuBar ] [
|
|
||||||
a [ _href "/small-group/members"; _roleMenuItem ] [
|
|
||||||
icon "email"; menuSpacer; locStr s["Maintain Group Members"]
|
|
||||||
]
|
|
||||||
a [ _href "/small-group/announcement"; _roleMenuItem ] [
|
|
||||||
icon "send"; menuSpacer; locStr s["Send Announcement"]
|
|
||||||
]
|
|
||||||
a [ _href "/small-group/preferences"; _roleMenuItem ] [
|
|
||||||
icon "build"; menuSpacer; locStr s["Change Preferences"]
|
|
||||||
]
|
|
||||||
]
|
|
||||||
]
|
|
||||||
if u.IsAdmin then
|
|
||||||
li [ _class "dropdown" ] [
|
|
||||||
a [ _dropdown
|
|
||||||
_ariaLabel s["Administration"].Value
|
|
||||||
_title s["Administration"].Value
|
|
||||||
_roleButton ] [
|
|
||||||
icon "settings"; space; locStr s["Administration"]; space; icon "keyboard_arrow_down"
|
|
||||||
]
|
|
||||||
div [ _class "dropdown-content"; _roleMenuBar ] [
|
|
||||||
a [ _href "/churches"; _roleMenuItem ] [ icon "home"; menuSpacer; locStr s["Churches"] ]
|
|
||||||
a [ _href "/small-groups"; _roleMenuItem ] [ icon "send"; menuSpacer; locStr s["Groups"] ]
|
|
||||||
a [ _href "/users"; _roleMenuItem ] [ icon "build"; menuSpacer; locStr s["Users"] ]
|
|
||||||
]
|
|
||||||
]
|
|
||||||
| None ->
|
|
||||||
match m.Group with
|
|
||||||
| Some _ ->
|
|
||||||
li [] [
|
|
||||||
a [ _href "/prayer-requests/view"
|
|
||||||
_ariaLabel s["View Request List"].Value
|
|
||||||
_title s["View Request List"].Value ] [
|
|
||||||
icon "list"; space; locStr s["View Request List"]
|
|
||||||
]
|
|
||||||
]
|
|
||||||
| None ->
|
|
||||||
li [ _class "dropdown" ] [
|
|
||||||
a [ _dropdown; _ariaLabel s["Log On"].Value; _title s["Log On"].Value; _roleButton ] [
|
|
||||||
icon "security"; space; locStr s["Log On"]; space; icon "keyboard_arrow_down"
|
|
||||||
]
|
|
||||||
div [ _class "dropdown-content"; _roleMenuBar ] [
|
|
||||||
a [ _href "/user/log-on"; _roleMenuItem ] [ icon "person"; menuSpacer; locStr s["User"] ]
|
|
||||||
a [ _href "/small-group/log-on"; _roleMenuItem ] [
|
|
||||||
icon "group"; menuSpacer; locStr s["Group"]
|
|
||||||
]
|
|
||||||
]
|
|
||||||
]
|
|
||||||
li [] [
|
|
||||||
a [ _href "/prayer-requests/lists"
|
|
||||||
_ariaLabel s["View Request List"].Value
|
|
||||||
_title s["View Request List"].Value ] [
|
|
||||||
icon "list"; space; locStr s["View Request List"]
|
|
||||||
]
|
|
||||||
]
|
|
||||||
li [] [
|
|
||||||
a [ _href $"https://docs.prayer.bitbadger.solutions/{langCode ()}"
|
|
||||||
_ariaLabel s["Help"].Value
|
|
||||||
_title s["View Help"].Value
|
|
||||||
_target "_blank"
|
|
||||||
_relNoOpener ] [
|
|
||||||
icon "help"; space; locStr s["Help"]
|
|
||||||
]
|
|
||||||
]
|
|
||||||
]
|
|
||||||
let rightLinks =
|
|
||||||
match m.Group with
|
|
||||||
| Some _ ->
|
|
||||||
[ match m.User with
|
|
||||||
| Some _ ->
|
|
||||||
li [] [
|
|
||||||
a [ _href "/user/password"
|
|
||||||
_ariaLabel s["Change Your Password"].Value
|
|
||||||
_title s["Change Your Password"].Value ] [
|
|
||||||
icon "lock"; space; locStr s["Change Your Password"]
|
|
||||||
]
|
|
||||||
]
|
|
||||||
| None -> ()
|
|
||||||
li [] [
|
|
||||||
a [ _href "/log-off"; _ariaLabel s["Log Off"].Value; _title s["Log Off"].Value; Target.body ] [
|
|
||||||
icon "power_settings_new"; space; locStr s["Log Off"]
|
|
||||||
]
|
|
||||||
]
|
|
||||||
]
|
|
||||||
| None -> []
|
|
||||||
header [ _class "pt-title-bar"; Target.content ] [
|
|
||||||
section [ _class "pt-title-bar-left"; _ariaLabel "Left side of top menu" ] [
|
|
||||||
span [ _class "pt-title-bar-home" ] [
|
|
||||||
a [ _href "/"; _title s["Home"].Value ] [ locStr s["PrayerTracker"] ]
|
|
||||||
]
|
|
||||||
ul [] leftLinks
|
|
||||||
]
|
|
||||||
section [ _class "pt-title-bar-center"; _ariaLabel "Empty center space in top menu" ] []
|
|
||||||
section [ _class "pt-title-bar-right"; _roleToolBar; _ariaLabel "Right side of top menu" ] [
|
|
||||||
ul [] rightLinks
|
|
||||||
]
|
|
||||||
]
|
|
||||||
|
|
||||||
/// Identity bar (below top nav)
|
|
||||||
let identity m =
|
|
||||||
let s = I18N.localizer.Force ()
|
|
||||||
header [ _id "pt-language"; Target.body ] [
|
|
||||||
div [] [
|
|
||||||
span [ _title s["Language"].Value ] [ icon "record_voice_over"; space ]
|
|
||||||
match langCode () with
|
|
||||||
| "es" ->
|
|
||||||
strong [] [ locStr s["Spanish"] ]
|
|
||||||
rawText " "
|
|
||||||
a [ _href "/language/en" ] [ locStr s["Change to English"] ]
|
|
||||||
| _ ->
|
|
||||||
strong [] [ locStr s["English"] ]
|
|
||||||
rawText " "
|
|
||||||
a [ _href "/language/es" ] [ locStr s["Cambie a Español"] ]
|
|
||||||
]
|
|
||||||
match m.Group with
|
|
||||||
| Some g ->
|
|
||||||
[ match m.User with
|
|
||||||
| Some u ->
|
|
||||||
span [ _class "u" ] [ locStr s["Currently Logged On"] ]
|
|
||||||
rawText " "
|
|
||||||
icon "person"
|
|
||||||
strong [] [ str u.Name ]
|
|
||||||
rawText " "
|
|
||||||
| None ->
|
|
||||||
locStr s["Logged On as a Member of"]
|
|
||||||
rawText " "
|
|
||||||
icon "group"
|
|
||||||
space
|
|
||||||
match m.User with
|
|
||||||
| Some _ -> a [ _href "/small-group"; Target.content ] [ strong [] [ str g.Name ] ]
|
|
||||||
| None -> strong [] [ str g.Name ]
|
|
||||||
]
|
|
||||||
| None -> []
|
|
||||||
|> div []
|
|
||||||
]
|
|
||||||
|
|
||||||
|
|
||||||
/// Content layouts
|
|
||||||
module Content =
|
|
||||||
|
|
||||||
/// Content layout that tops at 60rem
|
|
||||||
let standard = div [ _class "pt-content" ]
|
|
||||||
|
|
||||||
/// Content layout that uses the full width of the browser window
|
|
||||||
let wide = div [ _class "pt-content pt-full-width" ]
|
|
||||||
|
|
||||||
|
|
||||||
/// Separator for parts of the title
|
|
||||||
let private titleSep = rawText " « "
|
|
||||||
|
|
||||||
/// Common HTML head tag items
|
|
||||||
let private commonHead = [
|
|
||||||
meta [ _name "viewport"; _content "width=device-width, initial-scale=1" ]
|
|
||||||
meta [ _name "generator"; _content "Giraffe" ]
|
|
||||||
link [ _rel "stylesheet"; _href "https://fonts.googleapis.com/icon?family=Material+Icons" ]
|
|
||||||
link [ _rel "stylesheet"; _href "/css/app.css" ]
|
|
||||||
]
|
|
||||||
|
|
||||||
/// Render the <head> portion of the page
|
|
||||||
let private htmlHead viewInfo pgTitle =
|
|
||||||
let s = I18N.localizer.Force ()
|
|
||||||
head [] [
|
|
||||||
meta [ _charset "UTF-8" ]
|
|
||||||
title [] [ locStr pgTitle; titleSep; locStr s["PrayerTracker"] ]
|
|
||||||
yield! commonHead
|
|
||||||
for cssFile in viewInfo.Style do
|
|
||||||
link [ _rel "stylesheet"; _href $"/css/{cssFile}.css"; _type "text/css" ]
|
|
||||||
]
|
|
||||||
|
|
||||||
|
|
||||||
open Giraffe.ViewEngine.Htmx
|
|
||||||
|
|
||||||
/// Render a link to the help page for the current page
|
|
||||||
let private helpLink link =
|
|
||||||
let s = I18N.localizer.Force ()
|
|
||||||
sup [ _class "pt-help-link" ] [
|
|
||||||
a [ _href link
|
|
||||||
_title s["Click for Help on This Page"].Value
|
|
||||||
_onclick $"return PT.showHelp('{link}')"
|
|
||||||
_hxNoBoost ] [
|
|
||||||
iconSized 18 "help_outline"
|
|
||||||
]
|
|
||||||
]
|
|
||||||
|
|
||||||
/// Render the page title, and optionally a help link
|
|
||||||
let private renderPageTitle viewInfo pgTitle =
|
|
||||||
h2 [ _id "pt-page-title" ] [
|
|
||||||
match viewInfo.HelpLink with
|
|
||||||
| Some link -> PrayerTracker.Utils.Help.fullLink (langCode ()) link |> helpLink
|
|
||||||
| None -> ()
|
|
||||||
locStr pgTitle
|
|
||||||
]
|
|
||||||
|
|
||||||
/// Render the messages that may need to be displayed to the user
|
|
||||||
let private messages viewInfo =
|
|
||||||
let s = I18N.localizer.Force ()
|
|
||||||
if List.isEmpty viewInfo.Messages then []
|
|
||||||
else
|
|
||||||
viewInfo.Messages
|
|
||||||
|> List.map (fun msg ->
|
|
||||||
div [ _class $"pt-msg {MessageLevel.toCssClass msg.Level}" ] [
|
|
||||||
match msg.Level with
|
|
||||||
| Info -> ()
|
|
||||||
| lvl ->
|
|
||||||
strong [] [ locStr s[MessageLevel.toString lvl] ]
|
|
||||||
rawText " » "
|
|
||||||
rawText msg.Text.Value
|
|
||||||
match msg.Description with
|
|
||||||
| Some desc ->
|
|
||||||
br []
|
|
||||||
div [ _class "description" ] [ rawText desc.Value ]
|
|
||||||
| None -> ()
|
|
||||||
])
|
|
||||||
|> div [ _class "pt-messages" ]
|
|
||||||
|> List.singleton
|
|
||||||
|
|
||||||
|
|
||||||
open NodaTime
|
|
||||||
|
|
||||||
/// Render the <footer> at the bottom of the page
|
|
||||||
let private htmlFooter viewInfo =
|
|
||||||
let s = I18N.localizer.Force ()
|
|
||||||
let imgText = $"""%O{s["PrayerTracker"]} %O{s["from Bit Badger Solutions"]}"""
|
|
||||||
let resultTime = (SystemClock.Instance.GetCurrentInstant () - viewInfo.RequestStart).TotalSeconds
|
|
||||||
footer [ _class "pt-footer" ] [
|
|
||||||
div [ _id "pt-legal" ] [
|
|
||||||
a [ _href "/legal/privacy-policy" ] [ locStr s["Privacy Policy"] ]
|
|
||||||
rawText " "
|
|
||||||
a [ _href "/legal/terms-of-service" ] [ locStr s["Terms of Service"] ]
|
|
||||||
rawText " "
|
|
||||||
a [ _href "https://github.com/bit-badger/PrayerTracker"
|
|
||||||
_title s["View source code and get technical support"].Value
|
|
||||||
_target "_blank"
|
|
||||||
_relNoOpener ] [
|
|
||||||
locStr s["Source & Support"]
|
|
||||||
]
|
|
||||||
]
|
|
||||||
div [ _id "pt-footer" ] [
|
|
||||||
a [ _href "/"; _style "line-height:28px;" ] [
|
|
||||||
img [ _src $"""/img/%O{s["footer_en"]}.png"""
|
|
||||||
_alt imgText
|
|
||||||
_title imgText
|
|
||||||
_width "331"; _height "28" ]
|
|
||||||
]
|
|
||||||
span [ _id "pt-version" ] [ str viewInfo.Version ]
|
|
||||||
space
|
|
||||||
i [ _title s["This page loaded in {0:N3} seconds", resultTime].Value; _class "material-icons md-18" ] [
|
|
||||||
str "schedule"
|
|
||||||
]
|
|
||||||
]
|
|
||||||
]
|
|
||||||
|
|
||||||
/// The content portion of the PrayerTracker layout
|
|
||||||
let private contentSection viewInfo pgTitle (content : XmlNode) = [
|
|
||||||
Navigation.identity viewInfo
|
|
||||||
renderPageTitle viewInfo pgTitle
|
|
||||||
yield! messages viewInfo
|
|
||||||
match viewInfo.ScopedStyle with
|
|
||||||
| [] -> ()
|
|
||||||
| styles -> style [] [ rawText (styles |> String.concat " ") ]
|
|
||||||
content
|
|
||||||
htmlFooter viewInfo
|
|
||||||
match viewInfo.OnLoadScript with
|
|
||||||
| Some onLoad ->
|
|
||||||
let doCall = if onLoad.EndsWith ")" then "" else "()"
|
|
||||||
script [] [
|
|
||||||
rawText $"
|
|
||||||
window.doOnLoad = () => {{
|
|
||||||
if (window.PT) {{
|
|
||||||
{onLoad}{doCall}
|
|
||||||
delete window.doOnLoad
|
|
||||||
}} else {{ setTimeout(window.doOnLoad, 500) }}
|
|
||||||
}}
|
|
||||||
window.doOnLoad()"
|
|
||||||
]
|
|
||||||
| None -> ()
|
|
||||||
]
|
|
||||||
|
|
||||||
/// The HTML head element for partial responses
|
|
||||||
let private partialHead pgTitle =
|
|
||||||
let s = I18N.localizer.Force ()
|
|
||||||
head [] [
|
|
||||||
meta [ _charset "UTF-8" ]
|
|
||||||
title [] [ locStr pgTitle; titleSep; locStr s["PrayerTracker"] ]
|
|
||||||
]
|
|
||||||
|
|
||||||
open Giraffe.Htmx.Common
|
|
||||||
|
|
||||||
/// The body of the PrayerTracker layout
|
|
||||||
let private pageLayout viewInfo pgTitle content =
|
|
||||||
body [ _hxBoost ] [
|
|
||||||
Navigation.top viewInfo
|
|
||||||
div [ _id "pt-body"; Target.content; _hxSwap $"{HxSwap.InnerHtml} show:window:top" ]
|
|
||||||
(contentSection viewInfo pgTitle content)
|
|
||||||
match viewInfo.Layout with
|
|
||||||
| FullPage ->
|
|
||||||
Script.minified
|
|
||||||
script [ _src "/js/ckeditor/ckeditor.js" ] []
|
|
||||||
script [ _src "/js/app.js" ] []
|
|
||||||
| _ -> ()
|
|
||||||
]
|
|
||||||
|
|
||||||
/// The standard layout(s) for PrayerTracker
|
|
||||||
let standard viewInfo pageTitle content =
|
|
||||||
let s = I18N.localizer.Force ()
|
|
||||||
let pgTitle = s[pageTitle]
|
|
||||||
html [ _lang (langCode ()) ] [
|
|
||||||
match viewInfo.Layout with
|
|
||||||
| FullPage ->
|
|
||||||
htmlHead viewInfo pgTitle
|
|
||||||
pageLayout viewInfo pgTitle content
|
|
||||||
| PartialPage ->
|
|
||||||
partialHead pgTitle
|
|
||||||
pageLayout viewInfo pgTitle content
|
|
||||||
| ContentOnly ->
|
|
||||||
partialHead pgTitle
|
|
||||||
body [] (contentSection viewInfo pgTitle content)
|
|
||||||
]
|
|
||||||
|
|
||||||
/// A layout with nothing but a title and content
|
|
||||||
let bare pageTitle content =
|
|
||||||
let s = I18N.localizer.Force ()
|
|
||||||
html [ _lang (langCode ()) ] [
|
|
||||||
partialHead s[pageTitle]
|
|
||||||
body [] [ content ]
|
|
||||||
]
|
|
||||||
@@ -5,17 +5,19 @@ VisualStudioVersion = 17.2.32630.192
|
|||||||
MinimumVisualStudioVersion = 10.0.40219.1
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "PrayerTracker", "PrayerTracker\PrayerTracker.fsproj", "{63780D3F-D811-4BFB-9FB0-C28A83CCE28F}"
|
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "PrayerTracker", "PrayerTracker\PrayerTracker.fsproj", "{63780D3F-D811-4BFB-9FB0-C28A83CCE28F}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "PrayerTracker.UI", "PrayerTracker.UI\PrayerTracker.UI.fsproj", "{EEE04A2B-818C-4241-90C5-69097CB0BF71}"
|
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "PrayerTracker.UI", "UI\PrayerTracker.UI.fsproj", "{EEE04A2B-818C-4241-90C5-69097CB0BF71}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "PrayerTracker.Tests", "PrayerTracker.Tests\PrayerTracker.Tests.fsproj", "{786E7BE9-9370-4117-B194-02CC2F71AA09}"
|
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "PrayerTracker.Tests", "Tests\PrayerTracker.Tests.fsproj", "{786E7BE9-9370-4117-B194-02CC2F71AA09}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "PrayerTracker.Data", "PrayerTracker.Data\PrayerTracker.Data.fsproj", "{2B5BA107-9BDA-4A1D-A9AF-AFEE6BF12270}"
|
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "PrayerTracker.Data", "Data\PrayerTracker.Data.fsproj", "{2B5BA107-9BDA-4A1D-A9AF-AFEE6BF12270}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{B290BA27-C8B8-44F3-BF01-D103302D815F}"
|
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{B290BA27-C8B8-44F3-BF01-D103302D815F}"
|
||||||
ProjectSection(SolutionItems) = preProject
|
ProjectSection(SolutionItems) = preProject
|
||||||
Directory.Build.props = Directory.Build.props
|
Directory.Build.props = Directory.Build.props
|
||||||
EndProjectSection
|
EndProjectSection
|
||||||
EndProject
|
EndProject
|
||||||
|
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "PrayerTracker.MigrateV9", "PrayerTracker.MigrateV9\PrayerTracker.MigrateV9.fsproj", "{CE7C5972-AC9A-44A8-8265-771483FD87DB}"
|
||||||
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|Any CPU = Debug|Any CPU
|
Debug|Any CPU = Debug|Any CPU
|
||||||
@@ -38,6 +40,10 @@ Global
|
|||||||
{2B5BA107-9BDA-4A1D-A9AF-AFEE6BF12270}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{2B5BA107-9BDA-4A1D-A9AF-AFEE6BF12270}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{2B5BA107-9BDA-4A1D-A9AF-AFEE6BF12270}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{2B5BA107-9BDA-4A1D-A9AF-AFEE6BF12270}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{2B5BA107-9BDA-4A1D-A9AF-AFEE6BF12270}.Release|Any CPU.Build.0 = Release|Any CPU
|
{2B5BA107-9BDA-4A1D-A9AF-AFEE6BF12270}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{CE7C5972-AC9A-44A8-8265-771483FD87DB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{CE7C5972-AC9A-44A8-8265-771483FD87DB}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{CE7C5972-AC9A-44A8-8265-771483FD87DB}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{CE7C5972-AC9A-44A8-8265-771483FD87DB}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
|
|||||||
@@ -3,12 +3,13 @@ namespace PrayerTracker
|
|||||||
open Microsoft.AspNetCore.Http
|
open Microsoft.AspNetCore.Http
|
||||||
|
|
||||||
/// Middleware to add the starting ticks for the request
|
/// Middleware to add the starting ticks for the request
|
||||||
type RequestStartMiddleware (next : RequestDelegate) =
|
type RequestStartMiddleware(next: RequestDelegate) =
|
||||||
|
|
||||||
member this.InvokeAsync (ctx : HttpContext) = task {
|
member this.InvokeAsync(ctx: HttpContext) =
|
||||||
ctx.Items[Key.startTime] <- ctx.Now
|
task {
|
||||||
return! next.Invoke ctx
|
ctx.Items[Key.startTime] <- ctx.Now
|
||||||
}
|
return! next.Invoke ctx
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
open System
|
open System
|
||||||
@@ -19,218 +20,267 @@ open Microsoft.Extensions.Configuration
|
|||||||
/// Module to hold configuration for the web app
|
/// Module to hold configuration for the web app
|
||||||
[<RequireQualifiedAccess>]
|
[<RequireQualifiedAccess>]
|
||||||
module Configure =
|
module Configure =
|
||||||
|
|
||||||
/// Set up the configuration for the app
|
/// Set up the configuration for the app
|
||||||
let configuration (ctx : WebHostBuilderContext) (cfg : IConfigurationBuilder) =
|
let configuration (ctx: WebHostBuilderContext) (cfg: IConfigurationBuilder) =
|
||||||
cfg.SetBasePath(ctx.HostingEnvironment.ContentRootPath)
|
cfg
|
||||||
|
.SetBasePath(ctx.HostingEnvironment.ContentRootPath)
|
||||||
.AddJsonFile("appsettings.json", optional = true, reloadOnChange = true)
|
.AddJsonFile("appsettings.json", optional = true, reloadOnChange = true)
|
||||||
.AddJsonFile($"appsettings.{ctx.HostingEnvironment.EnvironmentName}.json", optional = true)
|
.AddJsonFile($"appsettings.{ctx.HostingEnvironment.EnvironmentName}.json", optional = true)
|
||||||
.AddEnvironmentVariables()
|
.AddEnvironmentVariables()
|
||||||
|> ignore
|
|> ignore
|
||||||
|
|
||||||
open Microsoft.AspNetCore.Server.Kestrel.Core
|
open Microsoft.AspNetCore.Server.Kestrel.Core
|
||||||
|
|
||||||
/// Configure Kestrel from appsettings.json
|
/// Configure Kestrel from appsettings.json
|
||||||
let kestrel (ctx : WebHostBuilderContext) (opts : KestrelServerOptions) =
|
let kestrel (ctx: WebHostBuilderContext) (opts: KestrelServerOptions) =
|
||||||
(ctx.Configuration.GetSection >> opts.Configure >> ignore) "Kestrel"
|
(ctx.Configuration.GetSection >> opts.Configure >> ignore) "Kestrel"
|
||||||
|
|
||||||
open System.Globalization
|
open System.Globalization
|
||||||
open BitBadger.Npgsql.FSharp.Documents
|
open BitBadger.Documents.Sqlite
|
||||||
open Microsoft.AspNetCore.Authentication.Cookies
|
open Microsoft.AspNetCore.Authentication.Cookies
|
||||||
open Microsoft.AspNetCore.Localization
|
open Microsoft.AspNetCore.Localization
|
||||||
open Microsoft.Extensions.Caching.Distributed
|
|
||||||
open Microsoft.Extensions.DependencyInjection
|
open Microsoft.Extensions.DependencyInjection
|
||||||
|
open NeoSmart.Caching.Sqlite
|
||||||
open NodaTime
|
open NodaTime
|
||||||
open Npgsql
|
|
||||||
open PrayerTracker.Data
|
open PrayerTracker.Data
|
||||||
|
|
||||||
/// Configure ASP.NET Core's service collection (dependency injection container)
|
|
||||||
let services (svc : IServiceCollection) =
|
|
||||||
let _ = svc.AddOptions ()
|
|
||||||
let _ = svc.AddLocalization (fun options -> options.ResourcesPath <- "Resources")
|
|
||||||
let _ =
|
|
||||||
svc.Configure<RequestLocalizationOptions> (fun (opts : RequestLocalizationOptions) ->
|
|
||||||
let supportedCultures =[|
|
|
||||||
CultureInfo "en-US"; CultureInfo "en-GB"; CultureInfo "en-AU"; CultureInfo "en"
|
|
||||||
CultureInfo "es-MX"; CultureInfo "es-ES"; CultureInfo "es"
|
|
||||||
|]
|
|
||||||
opts.DefaultRequestCulture <- RequestCulture ("en-US", "en-US")
|
|
||||||
opts.SupportedCultures <- supportedCultures
|
|
||||||
opts.SupportedUICultures <- supportedCultures)
|
|
||||||
let _ =
|
|
||||||
svc.AddAuthentication(CookieAuthenticationDefaults.AuthenticationScheme)
|
|
||||||
.AddCookie (fun opts ->
|
|
||||||
opts.ExpireTimeSpan <- TimeSpan.FromMinutes 120.
|
|
||||||
opts.SlidingExpiration <- true
|
|
||||||
opts.AccessDeniedPath <- "/error/403")
|
|
||||||
let _ = svc.AddAuthorization ()
|
|
||||||
|
|
||||||
let cfg = svc.BuildServiceProvider().GetService<IConfiguration> ()
|
/// Configure ASP.NET Core's service collection (dependency injection container)
|
||||||
let dsb = NpgsqlDataSourceBuilder (cfg.GetConnectionString "PrayerTracker")
|
let services (svc: IServiceCollection) =
|
||||||
let _ = dsb.UseNodaTime()
|
let _ = svc.AddOptions()
|
||||||
Configuration.useDataSource (dsb.Build ())
|
let _ = svc.AddLocalization(fun options -> options.ResourcesPath <- "Resources")
|
||||||
|
|
||||||
|
let _ =
|
||||||
|
svc.Configure<RequestLocalizationOptions>(fun (opts: RequestLocalizationOptions) ->
|
||||||
|
let supportedCultures =
|
||||||
|
[| CultureInfo "en-US"
|
||||||
|
CultureInfo "en-GB"
|
||||||
|
CultureInfo "en-AU"
|
||||||
|
CultureInfo "en"
|
||||||
|
CultureInfo "es-MX"
|
||||||
|
CultureInfo "es-ES"
|
||||||
|
CultureInfo "es" |]
|
||||||
|
|
||||||
|
opts.DefaultRequestCulture <- RequestCulture("en-US", "en-US")
|
||||||
|
opts.SupportedCultures <- supportedCultures
|
||||||
|
opts.SupportedUICultures <- supportedCultures)
|
||||||
|
|
||||||
|
let _ =
|
||||||
|
svc
|
||||||
|
.AddAuthentication(CookieAuthenticationDefaults.AuthenticationScheme)
|
||||||
|
.AddCookie(fun opts ->
|
||||||
|
opts.ExpireTimeSpan <- TimeSpan.FromMinutes 120.
|
||||||
|
opts.SlidingExpiration <- true
|
||||||
|
opts.AccessDeniedPath <- "/error/403")
|
||||||
|
|
||||||
|
let _ = svc.AddAuthorization()
|
||||||
|
|
||||||
|
let cfg = svc.BuildServiceProvider().GetService<IConfiguration>()
|
||||||
|
Configuration.useConnectionString (cfg.GetConnectionString "PrayerTracker")
|
||||||
|
Connection.setUp () |> Async.AwaitTask |> Async.RunSynchronously
|
||||||
|
|
||||||
let emailCfg = cfg.GetSection "Email"
|
let emailCfg = cfg.GetSection "Email"
|
||||||
if (emailCfg.GetChildren >> Seq.isEmpty >> not) () then ConfigurationBinder.Bind(emailCfg, Email.smtpOptions)
|
|
||||||
|
|
||||||
let _ = svc.AddSingleton<IDistributedCache, DistributedCache> ()
|
if (emailCfg.GetChildren >> Seq.isEmpty >> not) () then
|
||||||
let _ = svc.AddSession ()
|
ConfigurationBinder.Bind(emailCfg, Email.smtpOptions)
|
||||||
let _ = svc.AddAntiforgery ()
|
|
||||||
let _ = svc.AddRouting ()
|
let cachePath = defaultArg (Option.ofObj (cfg.GetConnectionString "SessionDB")) "./data/session.db"
|
||||||
|
let _ = svc.AddSqliteCache(fun o -> o.CachePath <- cachePath)
|
||||||
|
let _ = svc.AddSession()
|
||||||
|
let _ = svc.AddLogging()
|
||||||
|
let _ = svc.AddAntiforgery()
|
||||||
|
let _ = svc.AddRouting()
|
||||||
let _ = svc.AddSingleton<IClock> SystemClock.Instance
|
let _ = svc.AddSingleton<IClock> SystemClock.Instance
|
||||||
|
|
||||||
()
|
()
|
||||||
|
|
||||||
open Giraffe
|
open Giraffe
|
||||||
|
|
||||||
let noWeb : HttpHandler = fun next ctx ->
|
/// <summary>Endpoint to redirect URLs starting with <c>/web</c> to their non-web equivalent</summary>
|
||||||
redirectTo true $"""/{string ctx.Request.RouteValues["path"]}""" next ctx
|
let noWeb: HttpHandler =
|
||||||
|
fun next ctx -> redirectTo true $"""/{string ctx.Request.RouteValues["path"]}""" next ctx
|
||||||
|
|
||||||
open Giraffe.EndpointRouting
|
open Giraffe.EndpointRouting
|
||||||
|
|
||||||
/// Routes for PrayerTracker
|
/// Routes for PrayerTracker
|
||||||
let routes = [
|
let routes =
|
||||||
route "/web/{**path}" noWeb
|
[ route "/web/{**path}" noWeb
|
||||||
GET_HEAD [
|
GET_HEAD
|
||||||
subRoute "/church" [
|
[ subRoute "/church" [ route "es" Handlers.Church.maintain; routef "/%O/edit" Handlers.Church.edit ]
|
||||||
route "es" Handlers.Church.maintain
|
route "/class/logon" (redirectTo true "/small-group/log-on")
|
||||||
routef "/%O/edit" Handlers.Church.edit
|
routef "/error/%s" Handlers.Home.error
|
||||||
]
|
subRoute
|
||||||
route "/class/logon" (redirectTo true "/small-group/log-on")
|
"/help"
|
||||||
routef "/error/%s" Handlers.Home.error
|
[ route "" Handlers.Help.index
|
||||||
routef "/language/%s" Handlers.Home.language
|
subRoute
|
||||||
subRoute "/legal" [
|
"/requests"
|
||||||
route "/privacy-policy" Handlers.Home.privacyPolicy
|
[ route "/edit" Handlers.Help.Requests.edit
|
||||||
route "/terms-of-service" Handlers.Home.tos
|
route "/maintain" Handlers.Help.Requests.maintain
|
||||||
]
|
route "/view" Handlers.Help.Requests.view ]
|
||||||
route "/log-off" Handlers.Home.logOff
|
subRoute
|
||||||
subRoute "/prayer-request" [
|
"/small-group"
|
||||||
route "s" (Handlers.PrayerRequest.maintain true)
|
[ route "/announcement" Handlers.Help.SmallGroup.announcement
|
||||||
routef "s/email/%s" Handlers.PrayerRequest.email
|
route "/members" Handlers.Help.SmallGroup.members
|
||||||
route "s/inactive" (Handlers.PrayerRequest.maintain false)
|
route "/preferences" Handlers.Help.SmallGroup.preferences ]
|
||||||
route "s/lists" Handlers.PrayerRequest.lists
|
subRoute
|
||||||
routef "s/%O/list" Handlers.PrayerRequest.list
|
"/user"
|
||||||
route "s/maintain" (redirectTo true "/prayer-requests")
|
[ route "/log-on" Handlers.Help.User.logOn
|
||||||
routef "s/print/%s" Handlers.PrayerRequest.print
|
route "/password" Handlers.Help.User.password ] ]
|
||||||
route "s/view" (Handlers.PrayerRequest.view None)
|
routef "/language/%s" Handlers.Home.language
|
||||||
routef "s/view/%s" (Some >> Handlers.PrayerRequest.view)
|
subRoute
|
||||||
routef "/%O/edit" Handlers.PrayerRequest.edit
|
"/legal"
|
||||||
routef "/%O/expire" Handlers.PrayerRequest.expire
|
[ route "/privacy-policy" Handlers.Home.privacyPolicy
|
||||||
routef "/%O/restore" Handlers.PrayerRequest.restore
|
route "/terms-of-service" Handlers.Home.tos ]
|
||||||
]
|
route "/log-off" Handlers.Home.logOff
|
||||||
subRoute "/small-group" [
|
subRoute
|
||||||
route "" Handlers.SmallGroup.overview
|
"/prayer-request"
|
||||||
route "s" Handlers.SmallGroup.maintain
|
[ route "s" (Handlers.PrayerRequest.maintain true)
|
||||||
route "/announcement" Handlers.SmallGroup.announcement
|
routef "s/email/%s" Handlers.PrayerRequest.email
|
||||||
routef "/%O/edit" Handlers.SmallGroup.edit
|
route "s/inactive" (Handlers.PrayerRequest.maintain false)
|
||||||
route "/log-on" (Handlers.SmallGroup.logOn None)
|
route "s/lists" Handlers.PrayerRequest.lists
|
||||||
routef "/log-on/%O" (Some >> Handlers.SmallGroup.logOn)
|
routef "s/%O/list" Handlers.PrayerRequest.list
|
||||||
route "/logon" (redirectTo true "/small-group/log-on")
|
route "s/maintain" (redirectTo true "/prayer-requests")
|
||||||
routef "/member/%O/edit" Handlers.SmallGroup.editMember
|
routef "s/print/%s" Handlers.PrayerRequest.print
|
||||||
route "/members" Handlers.SmallGroup.members
|
route "s/view" (Handlers.PrayerRequest.view None)
|
||||||
route "/preferences" Handlers.SmallGroup.preferences
|
routef "s/view/%s" (Some >> Handlers.PrayerRequest.view)
|
||||||
]
|
routef "/%O/edit" Handlers.PrayerRequest.edit
|
||||||
route "/unauthorized" Handlers.Home.unauthorized
|
routef "/%O/expire" Handlers.PrayerRequest.expire
|
||||||
subRoute "/user" [
|
routef "/%O/restore" Handlers.PrayerRequest.restore ]
|
||||||
route "s" Handlers.User.maintain
|
subRoute
|
||||||
routef "/%O/edit" Handlers.User.edit
|
"/small-group"
|
||||||
routef "/%O/small-groups" Handlers.User.smallGroups
|
[ route "" Handlers.SmallGroup.overview
|
||||||
route "/log-on" Handlers.User.logOn
|
route "s" Handlers.SmallGroup.maintain
|
||||||
route "/logon" (redirectTo true "/user/log-on")
|
route "/announcement" Handlers.SmallGroup.announcement
|
||||||
route "/password" Handlers.User.password
|
routef "/%O/edit" Handlers.SmallGroup.edit
|
||||||
]
|
route "/log-on" (Handlers.SmallGroup.logOn None)
|
||||||
route "/" Handlers.Home.homePage
|
routef "/log-on/%O" (Some >> Handlers.SmallGroup.logOn)
|
||||||
]
|
route "/logon" (redirectTo true "/small-group/log-on")
|
||||||
POST [
|
routef "/member/%O/edit" Handlers.SmallGroup.editMember
|
||||||
subRoute "/church" [
|
route "/members" Handlers.SmallGroup.members
|
||||||
routef "/%O/delete" Handlers.Church.delete
|
route "/preferences" Handlers.SmallGroup.preferences ]
|
||||||
route "/save" Handlers.Church.save
|
route "/unauthorized" Handlers.Home.unauthorized
|
||||||
]
|
subRoute
|
||||||
subRoute "/prayer-request" [
|
"/user"
|
||||||
routef "/%O/delete" Handlers.PrayerRequest.delete
|
[ route "s" Handlers.User.maintain
|
||||||
route "/save" Handlers.PrayerRequest.save
|
routef "/%O/edit" Handlers.User.edit
|
||||||
]
|
routef "/%O/small-groups" Handlers.User.smallGroups
|
||||||
subRoute "/small-group" [
|
route "/log-on" Handlers.User.logOn
|
||||||
route "/announcement/send" Handlers.SmallGroup.sendAnnouncement
|
route "/logon" (redirectTo true "/user/log-on")
|
||||||
routef "/%O/delete" Handlers.SmallGroup.delete
|
route "/password" Handlers.User.password ]
|
||||||
route "/log-on/submit" Handlers.SmallGroup.logOnSubmit
|
route "/" Handlers.Home.homePage ]
|
||||||
routef "/member/%O/delete" Handlers.SmallGroup.deleteMember
|
POST
|
||||||
route "/member/save" Handlers.SmallGroup.saveMember
|
[ subRoute
|
||||||
route "/preferences/save" Handlers.SmallGroup.savePreferences
|
"/church"
|
||||||
route "/save" Handlers.SmallGroup.save
|
[ routef "/%O/delete" Handlers.Church.delete
|
||||||
]
|
route "/save" Handlers.Church.save ]
|
||||||
subRoute "/user" [
|
subRoute
|
||||||
routef "/%O/delete" Handlers.User.delete
|
"/prayer-request"
|
||||||
route "/edit/save" Handlers.User.save
|
[ routef "/%O/delete" Handlers.PrayerRequest.delete
|
||||||
route "/log-on" Handlers.User.doLogOn
|
route "/save" Handlers.PrayerRequest.save ]
|
||||||
route "/password/change" Handlers.User.changePassword
|
subRoute
|
||||||
route "/small-groups/save" Handlers.User.saveGroups
|
"/small-group"
|
||||||
]
|
[ route "/announcement/send" Handlers.SmallGroup.sendAnnouncement
|
||||||
]
|
routef "/%O/delete" Handlers.SmallGroup.delete
|
||||||
]
|
route "/log-on/submit" Handlers.SmallGroup.logOnSubmit
|
||||||
|
routef "/member/%O/delete" Handlers.SmallGroup.deleteMember
|
||||||
|
route "/member/save" Handlers.SmallGroup.saveMember
|
||||||
|
route "/preferences/save" Handlers.SmallGroup.savePreferences
|
||||||
|
route "/save" Handlers.SmallGroup.save ]
|
||||||
|
subRoute
|
||||||
|
"/user"
|
||||||
|
[ routef "/%O/delete" Handlers.User.delete
|
||||||
|
route "/edit/save" Handlers.User.save
|
||||||
|
route "/log-on" Handlers.User.doLogOn
|
||||||
|
route "/password/change" Handlers.User.changePassword
|
||||||
|
route "/small-groups/save" Handlers.User.saveGroups ] ] ]
|
||||||
|
|
||||||
open Microsoft.Extensions.Logging
|
open Microsoft.Extensions.Logging
|
||||||
|
|
||||||
/// Giraffe error handler
|
/// Giraffe error handler
|
||||||
let errorHandler (ex : exn) (logger : ILogger) =
|
let errorHandler (ex: exn) (logger: ILogger) =
|
||||||
logger.LogError (EventId(), ex, "An unhandled exception has occurred while executing the request.")
|
logger.LogError(EventId(), ex, "An unhandled exception has occurred while executing the request.")
|
||||||
clearResponse >=> setStatusCode 500 >=> text ex.Message
|
clearResponse >=> setStatusCode 500 >=> text ex.Message
|
||||||
|
|
||||||
open Microsoft.Extensions.Hosting
|
open Microsoft.Extensions.Hosting
|
||||||
|
|
||||||
/// Configure logging
|
/// Configure logging
|
||||||
let logging (log : ILoggingBuilder) =
|
let logging (log: ILoggingBuilder) =
|
||||||
let env = log.Services.BuildServiceProvider().GetService<IWebHostEnvironment> ()
|
let env = log.Services.BuildServiceProvider().GetService<IWebHostEnvironment>()
|
||||||
if env.IsDevelopment () then log else log.AddFilter (fun l -> l > LogLevel.Information)
|
|
||||||
|> function l -> l.AddConsole().AddDebug()
|
if env.IsDevelopment() then
|
||||||
|
log
|
||||||
|
else
|
||||||
|
log.AddFilter(fun l -> l > LogLevel.Information)
|
||||||
|
|> function
|
||||||
|
| l -> l.AddConsole().AddDebug()
|
||||||
|> ignore
|
|> ignore
|
||||||
|
|
||||||
open BitBadger.AspNetCore.CanonicalDomains
|
open BitBadger.AspNetCore.CanonicalDomains
|
||||||
open Microsoft.Extensions.Localization
|
open Microsoft.Extensions.Localization
|
||||||
open Microsoft.Extensions.Options
|
open Microsoft.Extensions.Options
|
||||||
|
|
||||||
/// Configure the application
|
/// Configure the application
|
||||||
let app (app : IApplicationBuilder) =
|
let app (app: WebApplication) =
|
||||||
let env = app.ApplicationServices.GetRequiredService<IWebHostEnvironment> ()
|
let env = app.Services.GetRequiredService<IWebHostEnvironment>()
|
||||||
if env.IsDevelopment () then
|
|
||||||
app.UseDeveloperExceptionPage ()
|
if env.IsDevelopment() then
|
||||||
|
app.UseDeveloperExceptionPage()
|
||||||
else
|
else
|
||||||
app.UseGiraffeErrorHandler errorHandler
|
app.UseGiraffeErrorHandler errorHandler
|
||||||
|> ignore
|
|> ignore
|
||||||
|
|
||||||
let _ = app.UseForwardedHeaders ()
|
|
||||||
let _ = app.UseCanonicalDomains ()
|
|
||||||
let _ = app.UseStatusCodePagesWithReExecute "/error/{0}"
|
|
||||||
let _ = app.UseStaticFiles ()
|
|
||||||
let _ = app.UseCookiePolicy (CookiePolicyOptions (MinimumSameSitePolicy = SameSiteMode.Strict))
|
|
||||||
let _ = app.UseMiddleware<RequestStartMiddleware> ()
|
|
||||||
let _ = app.UseRouting ()
|
|
||||||
let _ = app.UseSession ()
|
|
||||||
let _ = app.UseRequestLocalization
|
|
||||||
(app.ApplicationServices.GetService<IOptions<RequestLocalizationOptions>>().Value)
|
|
||||||
let _ = app.UseAuthentication ()
|
|
||||||
let _ = app.UseAuthorization ()
|
|
||||||
let _ = app.UseEndpoints (fun e -> e.MapGiraffeEndpoints routes)
|
|
||||||
Views.I18N.setUpFactories <| app.ApplicationServices.GetRequiredService<IStringLocalizerFactory> ()
|
|
||||||
|
|
||||||
|
let _ = app.UseForwardedHeaders()
|
||||||
|
let _ = app.UseCanonicalDomains()
|
||||||
|
let _ = app.UseStatusCodePagesWithReExecute "/error/{0}"
|
||||||
|
let _ = app.UseStaticFiles()
|
||||||
|
let _ = app.UseCookiePolicy(CookiePolicyOptions(MinimumSameSitePolicy = SameSiteMode.Strict))
|
||||||
|
let _ = app.UseMiddleware<RequestStartMiddleware>()
|
||||||
|
let _ = app.UseRouting()
|
||||||
|
let _ = app.UseSession()
|
||||||
|
let _ = app.UseRequestLocalization(app.Services.GetService<IOptions<RequestLocalizationOptions>>().Value)
|
||||||
|
let _ = app.UseAuthentication()
|
||||||
|
let _ = app.UseAuthorization()
|
||||||
|
let _ = app.UseEndpoints(fun e -> e.MapGiraffeEndpoints routes)
|
||||||
|
|
||||||
|
app.Services.GetRequiredService<IStringLocalizerFactory>()
|
||||||
|
|> Views.I18N.setUpFactories
|
||||||
|
|
||||||
|
open Microsoft.Extensions.DependencyInjection
|
||||||
|
open Microsoft.Extensions.Logging
|
||||||
|
|
||||||
/// The web application
|
/// The web application
|
||||||
module App =
|
module App =
|
||||||
|
|
||||||
open System.IO
|
open System.IO
|
||||||
|
|
||||||
[<EntryPoint>]
|
[<EntryPoint>]
|
||||||
let main args =
|
let main args =
|
||||||
let contentRoot = Directory.GetCurrentDirectory ()
|
|
||||||
let app =
|
let contentRoot = Directory.GetCurrentDirectory()
|
||||||
WebHostBuilder()
|
let builder =
|
||||||
.UseContentRoot(contentRoot)
|
WebApplication.CreateBuilder(
|
||||||
|
WebApplicationOptions(
|
||||||
|
Args = args,
|
||||||
|
ApplicationName = "PrayerTracker",
|
||||||
|
ContentRootPath = contentRoot,
|
||||||
|
WebRootPath = Path.Combine(contentRoot, "wwwroot")))
|
||||||
|
let _ =
|
||||||
|
builder.WebHost
|
||||||
.ConfigureAppConfiguration(Configure.configuration)
|
.ConfigureAppConfiguration(Configure.configuration)
|
||||||
.UseKestrel(Configure.kestrel)
|
.ConfigureKestrel(Configure.kestrel)
|
||||||
.UseWebRoot(Path.Combine (contentRoot, "wwwroot"))
|
|
||||||
.ConfigureServices(Configure.services)
|
.ConfigureServices(Configure.services)
|
||||||
.ConfigureLogging(Configure.logging)
|
.ConfigureLogging(Configure.logging)
|
||||||
.Configure(System.Action<IApplicationBuilder> Configure.app)
|
|
||||||
.Build()
|
use app = builder.Build()
|
||||||
if args.Length > 0 then printfn $"Unrecognized option {args[0]}" else app.Run ()
|
|
||||||
|
Configure.app app
|
||||||
|
|
||||||
|
let fac = app.Services.GetRequiredService<ILoggerFactory>()
|
||||||
|
let log = fac.CreateLogger "PrayerTracker"
|
||||||
|
log.LogInformation "Application Started"
|
||||||
|
|
||||||
|
app.Run()
|
||||||
|
|
||||||
|
log.LogInformation "Application Shutting Down"
|
||||||
|
|
||||||
0
|
0
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ let private findStats churchId = task {
|
|||||||
let! groups = SmallGroups.countByChurch churchId
|
let! groups = SmallGroups.countByChurch churchId
|
||||||
let! requests = PrayerRequests.countByChurch churchId
|
let! requests = PrayerRequests.countByChurch churchId
|
||||||
let! users = Users.countByChurch churchId
|
let! users = Users.countByChurch churchId
|
||||||
return shortGuid churchId.Value, { SmallGroups = groups; PrayerRequests = requests; Users = users }
|
return shortGuid churchId.Value, { SmallGroups = int groups; PrayerRequests = int requests; Users = int users }
|
||||||
}
|
}
|
||||||
|
|
||||||
// POST /church/[church-id]/delete
|
// POST /church/[church-id]/delete
|
||||||
@@ -40,7 +40,7 @@ let edit churchId : HttpHandler = requireAccess [ Admin ] >=> fun next ctx -> ta
|
|||||||
|> renderHtml next ctx
|
|> renderHtml next ctx
|
||||||
else
|
else
|
||||||
match! Churches.tryById (ChurchId churchId) with
|
match! Churches.tryById (ChurchId churchId) with
|
||||||
| Some church ->
|
| Some church ->
|
||||||
return!
|
return!
|
||||||
viewInfo ctx
|
viewInfo ctx
|
||||||
|> Views.Church.edit (EditChurch.fromChurch church) ctx
|
|> Views.Church.edit (EditChurch.fromChurch church) ctx
|
||||||
@@ -63,12 +63,12 @@ let save : HttpHandler = requireAccess [ Admin ] >=> validateCsrf >=> fun next c
|
|||||||
match! ctx.TryBindFormAsync<EditChurch> () with
|
match! ctx.TryBindFormAsync<EditChurch> () with
|
||||||
| Ok model ->
|
| Ok model ->
|
||||||
let! church =
|
let! church =
|
||||||
if model.IsNew then Task.FromResult (Some { Church.empty with Id = (Guid.NewGuid >> ChurchId) () })
|
if model.IsNew then Task.FromResult(Some { Church.Empty with Id = (Guid.NewGuid >> ChurchId) () })
|
||||||
else Churches.tryById (idFromShort ChurchId model.ChurchId)
|
else Churches.tryById (idFromShort ChurchId model.ChurchId)
|
||||||
match church with
|
match church with
|
||||||
| Some ch ->
|
| Some ch ->
|
||||||
do! Churches.save (model.PopulateChurch ch)
|
do! Churches.save (model.PopulateChurch ch)
|
||||||
let act = ctx.Strings[if model.IsNew then "Added" else "Updated"].Value.ToLower ()
|
let act = ctx.Strings[if model.IsNew then "Added" else "Updated"].Value.ToLower()
|
||||||
addInfo ctx ctx.Strings["Successfully {0} church “{1}”", act, model.Name]
|
addInfo ctx ctx.Strings["Successfully {0} church “{1}”", act, model.Name]
|
||||||
return! redirectTo false "/churches" next ctx
|
return! redirectTo false "/churches" next ctx
|
||||||
| None -> return! fourOhFour ctx
|
| None -> return! fourOhFour ctx
|
||||||
|
|||||||
@@ -5,22 +5,21 @@ module PrayerTracker.Handlers.CommonFunctions
|
|||||||
open Microsoft.AspNetCore.Mvc.Rendering
|
open Microsoft.AspNetCore.Mvc.Rendering
|
||||||
|
|
||||||
/// Create a select list from an enumeration
|
/// Create a select list from an enumeration
|
||||||
let toSelectList<'T> valFunc textFunc withDefault emptyText (items : 'T seq) =
|
let toSelectList<'T> valFunc textFunc withDefault emptyText (items: 'T seq) =
|
||||||
if isNull items then nullArg (nameof items)
|
if isNull items then nullArg (nameof items)
|
||||||
[ match withDefault with
|
[ match withDefault with
|
||||||
| true ->
|
| true ->
|
||||||
let s = PrayerTracker.Views.I18N.localizer.Force ()
|
let s = PrayerTracker.Views.I18N.localizer.Force()
|
||||||
SelectListItem ($"""— %A{s[emptyText]} —""", "")
|
SelectListItem($"""— %A{s[emptyText]} —""", "")
|
||||||
| _ -> ()
|
| _ -> ()
|
||||||
yield! items |> Seq.map (fun x -> SelectListItem (textFunc x, valFunc x))
|
yield! items |> Seq.map (fun x -> SelectListItem(textFunc x, valFunc x)) ]
|
||||||
]
|
|
||||||
|
|
||||||
/// Create a select list from an enumeration
|
/// Create a select list from an enumeration
|
||||||
let toSelectListWithEmpty<'T> valFunc textFunc emptyText (items : 'T seq) =
|
let toSelectListWithEmpty<'T> valFunc textFunc emptyText (items: 'T seq) =
|
||||||
toSelectList valFunc textFunc true emptyText items
|
toSelectList valFunc textFunc true emptyText items
|
||||||
|
|
||||||
/// Create a select list from an enumeration
|
/// Create a select list from an enumeration
|
||||||
let toSelectListWithDefault<'T> valFunc textFunc (items : 'T seq) =
|
let toSelectListWithDefault<'T> valFunc textFunc (items: 'T seq) =
|
||||||
toSelectList valFunc textFunc true "Select" items
|
toSelectList valFunc textFunc true "Select" items
|
||||||
|
|
||||||
/// The version of PrayerTracker
|
/// The version of PrayerTracker
|
||||||
@@ -49,7 +48,7 @@ open PrayerTracker
|
|||||||
open PrayerTracker.ViewModels
|
open PrayerTracker.ViewModels
|
||||||
|
|
||||||
/// Create the common view information heading
|
/// Create the common view information heading
|
||||||
let viewInfo (ctx : HttpContext) =
|
let viewInfo (ctx: HttpContext) =
|
||||||
let msg =
|
let msg =
|
||||||
match ctx.Session.Messages with
|
match ctx.Session.Messages with
|
||||||
| [] -> []
|
| [] -> []
|
||||||
@@ -67,8 +66,7 @@ let viewInfo (ctx : HttpContext) =
|
|||||||
RequestStart = ctx.Items[Key.startTime] :?> Instant
|
RequestStart = ctx.Items[Key.startTime] :?> Instant
|
||||||
User = ctx.Session.CurrentUser
|
User = ctx.Session.CurrentUser
|
||||||
Group = ctx.Session.CurrentGroup
|
Group = ctx.Session.CurrentGroup
|
||||||
Layout = layout
|
Layout = layout }
|
||||||
}
|
|
||||||
|
|
||||||
/// The view is the last parameter, so it can be composed
|
/// The view is the last parameter, so it can be composed
|
||||||
let renderHtml next ctx view =
|
let renderHtml next ctx view =
|
||||||
@@ -77,24 +75,24 @@ let renderHtml next ctx view =
|
|||||||
open Microsoft.Extensions.Logging
|
open Microsoft.Extensions.Logging
|
||||||
|
|
||||||
/// Display an error regarding form submission
|
/// Display an error regarding form submission
|
||||||
let bindError (msg : string) =
|
let bindError (msg: string) =
|
||||||
handleContext (fun ctx ->
|
handleContext (fun ctx ->
|
||||||
ctx.GetService<ILoggerFactory>().CreateLogger("PrayerTracker.Handlers").LogError msg
|
ctx.GetService<ILoggerFactory>().CreateLogger("PrayerTracker.Handlers").LogError msg
|
||||||
(setStatusCode 400 >=> text msg) earlyReturn ctx)
|
(setStatusCode 400 >=> text msg) earlyReturn ctx)
|
||||||
|
|
||||||
/// Handler that will return a status code 404 and the text "Not Found"
|
/// Handler that will return a status code 404 and the text "Not Found"
|
||||||
let fourOhFour (ctx : HttpContext) =
|
let fourOhFour (ctx: HttpContext) =
|
||||||
(setStatusCode 404 >=> text "Not Found") earlyReturn ctx
|
(setStatusCode 404 >=> text "Not Found") earlyReturn ctx
|
||||||
|
|
||||||
/// Handler to validate CSRF prevention token
|
/// Handler to validate CSRF prevention token
|
||||||
let validateCsrf : HttpHandler = fun next ctx -> task {
|
let validateCsrf : HttpHandler = fun next ctx -> task {
|
||||||
match! (ctx.GetService<Microsoft.AspNetCore.Antiforgery.IAntiforgery> ()).IsRequestValidAsync ctx with
|
match! ctx.GetService<Microsoft.AspNetCore.Antiforgery.IAntiforgery>().IsRequestValidAsync ctx with
|
||||||
| true -> return! next ctx
|
| true -> return! next ctx
|
||||||
| false -> return! (clearResponse >=> setStatusCode 400 >=> text "Quit hacking...") earlyReturn ctx
|
| false -> return! (clearResponse >=> setStatusCode 400 >=> text "Quit hacking...") earlyReturn ctx
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Add a message to the session
|
/// Add a message to the session
|
||||||
let addUserMessage (ctx : HttpContext) msg =
|
let addUserMessage (ctx: HttpContext) msg =
|
||||||
ctx.Session.Messages <- msg :: ctx.Session.Messages
|
ctx.Session.Messages <- msg :: ctx.Session.Messages
|
||||||
|
|
||||||
|
|
||||||
@@ -102,10 +100,10 @@ open Microsoft.AspNetCore.Html
|
|||||||
open Microsoft.Extensions.Localization
|
open Microsoft.Extensions.Localization
|
||||||
|
|
||||||
/// Convert a localized string to an HTML string
|
/// Convert a localized string to an HTML string
|
||||||
let htmlLocString (x : LocalizedString) =
|
let htmlLocString (x: LocalizedString) =
|
||||||
(System.Net.WebUtility.HtmlEncode >> HtmlString) x.Value
|
(System.Net.WebUtility.HtmlEncode >> HtmlString) x.Value
|
||||||
|
|
||||||
let htmlString (x : LocalizedString) =
|
let htmlString (x: LocalizedString) =
|
||||||
HtmlString x.Value
|
HtmlString x.Value
|
||||||
|
|
||||||
/// Add an error message to the session
|
/// Add an error message to the session
|
||||||
@@ -119,7 +117,7 @@ let addInfo ctx msg =
|
|||||||
/// Add an informational HTML message to the session
|
/// Add an informational HTML message to the session
|
||||||
let addHtmlInfo ctx msg =
|
let addHtmlInfo ctx msg =
|
||||||
addUserMessage ctx { UserMessage.info with Text = htmlString msg }
|
addUserMessage ctx { UserMessage.info with Text = htmlString msg }
|
||||||
|
|
||||||
/// Add a warning message to the session
|
/// Add a warning message to the session
|
||||||
let addWarning ctx msg =
|
let addWarning ctx msg =
|
||||||
addUserMessage ctx { UserMessage.warning with Text = htmlLocString msg }
|
addUserMessage ctx { UserMessage.warning with Text = htmlLocString msg }
|
||||||
@@ -143,8 +141,8 @@ open PrayerTracker.Entities
|
|||||||
/// Require one of the given access roles
|
/// Require one of the given access roles
|
||||||
let requireAccess levels : HttpHandler = fun next ctx -> task {
|
let requireAccess levels : HttpHandler = fun next ctx -> task {
|
||||||
// These calls fill the user and group in the session, making .Value safe to use for the rest of the request
|
// These calls fill the user and group in the session, making .Value safe to use for the rest of the request
|
||||||
let! user = ctx.CurrentUser ()
|
let! user = ctx.CurrentUser()
|
||||||
let! group = ctx.CurrentGroup ()
|
let! group = ctx.CurrentGroup()
|
||||||
match user, group with
|
match user, group with
|
||||||
| _, _ when List.contains Public levels -> return! next ctx
|
| _, _ when List.contains Public levels -> return! next ctx
|
||||||
| Some _, _ when List.contains User levels -> return! next ctx
|
| Some _, _ when List.contains User levels -> return! next ctx
|
||||||
@@ -155,7 +153,7 @@ let requireAccess levels : HttpHandler = fun next ctx -> task {
|
|||||||
return! redirectTo false "/unauthorized" next ctx
|
return! redirectTo false "/unauthorized" next ctx
|
||||||
| _, _ when List.contains User levels ->
|
| _, _ when List.contains User levels ->
|
||||||
// Redirect to the user log on page
|
// Redirect to the user log on page
|
||||||
ctx.Session.SetString (Key.Session.redirectUrl, ctx.Request.GetEncodedPathAndQuery ())
|
ctx.Session.SetString(Key.Session.redirectUrl, ctx.Request.GetEncodedPathAndQuery())
|
||||||
return! redirectTo false "/user/log-on" next ctx
|
return! redirectTo false "/user/log-on" next ctx
|
||||||
| _, _ when List.contains Group levels ->
|
| _, _ when List.contains Group levels ->
|
||||||
// Redirect to the small group log on page
|
// Redirect to the small group log on page
|
||||||
|
|||||||
@@ -8,63 +8,62 @@ open PrayerTracker.Entities
|
|||||||
|
|
||||||
/// Parameters required to send an e-mail
|
/// Parameters required to send an e-mail
|
||||||
type EmailOptions =
|
type EmailOptions =
|
||||||
{ /// The SMTP client
|
{ /// The SMTP client
|
||||||
Client : SmtpClient
|
Client: SmtpClient
|
||||||
|
|
||||||
/// The people who should receive the e-mail
|
/// The people who should receive the e-mail
|
||||||
Recipients : Member list
|
Recipients: Member list
|
||||||
|
|
||||||
/// The small group for which this e-mail is being sent
|
/// The small group for which this e-mail is being sent
|
||||||
Group : SmallGroup
|
Group: SmallGroup
|
||||||
|
|
||||||
/// The subject of the e-mail
|
/// The subject of the e-mail
|
||||||
Subject : string
|
Subject: string
|
||||||
|
|
||||||
/// The body of the e-mail in HTML
|
/// The body of the e-mail in HTML
|
||||||
HtmlBody : string
|
HtmlBody: string
|
||||||
|
|
||||||
/// The body of the e-mail in plain text
|
/// The body of the e-mail in plain text
|
||||||
PlainTextBody : string
|
PlainTextBody: string
|
||||||
|
|
||||||
/// Use the current user's preferred language
|
/// Use the current user's preferred language
|
||||||
Strings : IStringLocalizer
|
Strings: IStringLocalizer }
|
||||||
}
|
|
||||||
|
|
||||||
/// Options to use when sending e-mail
|
/// Options to use when sending e-mail
|
||||||
type SmtpServerOptions() =
|
type SmtpServerOptions() =
|
||||||
/// The hostname of the SMTP server
|
/// The hostname of the SMTP server
|
||||||
member val SmtpHost : string = "localhost" with get, set
|
member val SmtpHost: string = "localhost" with get, set
|
||||||
|
|
||||||
/// The port over which SMTP communication should occur
|
/// The port over which SMTP communication should occur
|
||||||
member val Port : int = 25 with get, set
|
member val Port: int = 25 with get, set
|
||||||
|
|
||||||
/// Whether to use SSL when communicating with the SMTP server
|
/// Whether to use SSL when communicating with the SMTP server
|
||||||
member val UseSsl : bool = false with get, set
|
member val UseSsl: bool = false with get, set
|
||||||
|
|
||||||
/// The authentication to use with the SMTP server
|
/// The authentication to use with the SMTP server
|
||||||
member val Authentication : string = "" with get, set
|
member val Authentication: string = "" with get, set
|
||||||
|
|
||||||
/// The e-mail address from which messages should be sent
|
/// The e-mail address from which messages should be sent
|
||||||
member val FromAddress : string = "prayer@bitbadger.solutions" with get, set
|
member val FromAddress: string = "prayer@bitbadger.solutions" with get, set
|
||||||
|
|
||||||
|
|
||||||
/// The options for the SMTP server
|
/// The options for the SMTP server
|
||||||
let smtpOptions = SmtpServerOptions ()
|
let smtpOptions = SmtpServerOptions()
|
||||||
|
|
||||||
/// Get an SMTP client connection
|
/// Get an SMTP client connection
|
||||||
let getConnection () = task {
|
let getConnection () = task {
|
||||||
let client = new SmtpClient ()
|
let client = new SmtpClient()
|
||||||
do! client.ConnectAsync (smtpOptions.SmtpHost, smtpOptions.Port, smtpOptions.UseSsl)
|
do! client.ConnectAsync(smtpOptions.SmtpHost, smtpOptions.Port, smtpOptions.UseSsl)
|
||||||
do! client.AuthenticateAsync (smtpOptions.FromAddress, smtpOptions.Authentication)
|
do! client.AuthenticateAsync(smtpOptions.FromAddress, smtpOptions.Authentication)
|
||||||
return client
|
return client
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Create a mail message object, filled with everything but the body content
|
/// Create a mail message object, filled with everything but the body content
|
||||||
let createMessage opts =
|
let createMessage opts =
|
||||||
let msg = new MimeMessage ()
|
let msg = new MimeMessage()
|
||||||
msg.From.Add (MailboxAddress (opts.Group.Preferences.EmailFromName, smtpOptions.FromAddress))
|
msg.From.Add(MailboxAddress(opts.Group.Preferences.EmailFromName, smtpOptions.FromAddress))
|
||||||
msg.Subject <- opts.Subject
|
msg.Subject <- opts.Subject
|
||||||
msg.ReplyTo.Add (MailboxAddress (opts.Group.Preferences.EmailFromName, opts.Group.Preferences.EmailFromAddress))
|
msg.ReplyTo.Add(MailboxAddress(opts.Group.Preferences.EmailFromName, opts.Group.Preferences.EmailFromAddress))
|
||||||
msg
|
msg
|
||||||
|
|
||||||
open MimeKit.Text
|
open MimeKit.Text
|
||||||
@@ -72,31 +71,29 @@ open MimeKit.Text
|
|||||||
/// Create an HTML-format e-mail message
|
/// Create an HTML-format e-mail message
|
||||||
let createHtmlMessage opts =
|
let createHtmlMessage opts =
|
||||||
let bodyText =
|
let bodyText =
|
||||||
[ """<!DOCTYPE html><html xmlns="http://www.w3.org/1999/xhtml"><head><title></title></head><body>"""
|
[ """<!DOCTYPE html><html xmlns="http://www.w3.org/1999/xhtml"><head><title></title></head><body>"""
|
||||||
opts.HtmlBody
|
opts.HtmlBody
|
||||||
"""<hr><div style="text-align:right;font-family:Arial,Helvetica,sans-serif;font-size:8pt;padding-right:10px;">"""
|
"""<hr><div style="text-align:right;font-family:Arial,Helvetica,sans-serif;font-size:8pt;padding-right:10px;">"""
|
||||||
opts.Strings["Generated by P R A Y E R T R A C K E R"].Value
|
opts.Strings["Generated by P R A Y E R T R A C K E R"].Value
|
||||||
"<br><small>"
|
"<br><small>"
|
||||||
opts.Strings["from Bit Badger Solutions"].Value
|
opts.Strings["from Bit Badger Solutions"].Value
|
||||||
"</small></div></body></html>"
|
"</small></div></body></html>" ]
|
||||||
]
|
|
||||||
|> String.concat ""
|
|> String.concat ""
|
||||||
let msg = createMessage opts
|
let msg = createMessage opts
|
||||||
msg.Body <- new TextPart (TextFormat.Html, Text = bodyText)
|
msg.Body <- new TextPart(TextFormat.Html, Text = bodyText)
|
||||||
msg
|
msg
|
||||||
|
|
||||||
/// Create a plain-text-format e-mail message
|
/// Create a plain-text-format e-mail message
|
||||||
let createTextMessage opts =
|
let createTextMessage opts =
|
||||||
let bodyText =
|
let bodyText =
|
||||||
[ opts.PlainTextBody
|
[ opts.PlainTextBody
|
||||||
"\n\n--\n"
|
"\n\n--\n"
|
||||||
opts.Strings["Generated by P R A Y E R T R A C K E R"].Value
|
opts.Strings["Generated by P R A Y E R T R A C K E R"].Value
|
||||||
"\n"
|
"\n"
|
||||||
opts.Strings["from Bit Badger Solutions"].Value
|
opts.Strings["from Bit Badger Solutions"].Value ]
|
||||||
]
|
|
||||||
|> String.concat ""
|
|> String.concat ""
|
||||||
let msg = createMessage opts
|
let msg = createMessage opts
|
||||||
msg.Body <- new TextPart (TextFormat.Plain, Text = bodyText)
|
msg.Body <- new TextPart(TextFormat.Plain, Text = bodyText)
|
||||||
msg
|
msg
|
||||||
|
|
||||||
/// Send e-mails to a class
|
/// Send e-mails to a class
|
||||||
@@ -105,14 +102,14 @@ let sendEmails opts = task {
|
|||||||
use plainTextMsg = createTextMessage opts
|
use plainTextMsg = createTextMessage opts
|
||||||
|
|
||||||
for mbr in opts.Recipients do
|
for mbr in opts.Recipients do
|
||||||
let emailTo = MailboxAddress (mbr.Name, mbr.Email)
|
let emailTo = MailboxAddress(mbr.Name, mbr.Email)
|
||||||
match defaultArg mbr.Format opts.Group.Preferences.DefaultEmailType with
|
match defaultArg mbr.Format opts.Group.Preferences.DefaultEmailType with
|
||||||
| HtmlFormat ->
|
| HtmlFormat ->
|
||||||
htmlMsg.To.Add emailTo
|
htmlMsg.To.Add emailTo
|
||||||
let! _ = opts.Client.SendAsync htmlMsg
|
let! _ = opts.Client.SendAsync htmlMsg
|
||||||
htmlMsg.To.Clear ()
|
htmlMsg.To.Clear()
|
||||||
| PlainTextFormat ->
|
| PlainTextFormat ->
|
||||||
plainTextMsg.To.Add emailTo
|
plainTextMsg.To.Add emailTo
|
||||||
let! _ = opts.Client.SendAsync plainTextMsg
|
let! _ = opts.Client.SendAsync plainTextMsg
|
||||||
plainTextMsg.To.Clear ()
|
plainTextMsg.To.Clear()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,34 +1,30 @@
|
|||||||
[<AutoOpen>]
|
[<AutoOpen>]
|
||||||
module PrayerTracker.Extensions
|
module PrayerTracker.Extensions
|
||||||
|
|
||||||
|
open BitBadger.Documents
|
||||||
open Microsoft.AspNetCore.Http
|
open Microsoft.AspNetCore.Http
|
||||||
open Newtonsoft.Json
|
|
||||||
open NodaTime
|
open NodaTime
|
||||||
open NodaTime.Serialization.JsonNet
|
|
||||||
open PrayerTracker.Data
|
open PrayerTracker.Data
|
||||||
open PrayerTracker.Entities
|
open PrayerTracker.Entities
|
||||||
open PrayerTracker.ViewModels
|
open PrayerTracker.ViewModels
|
||||||
|
|
||||||
/// JSON.NET serializer settings for NodaTime
|
|
||||||
let private jsonSettings = JsonSerializerSettings().ConfigureForNodaTime DateTimeZoneProviders.Tzdb
|
|
||||||
|
|
||||||
/// Extensions on the .NET session object
|
/// Extensions on the .NET session object
|
||||||
type ISession with
|
type ISession with
|
||||||
|
|
||||||
/// Set an object in the session
|
/// Set an object in the session
|
||||||
member this.SetObject<'T> key (value : 'T) =
|
member this.SetObject<'T> key (value: 'T) =
|
||||||
this.SetString (key, JsonConvert.SerializeObject (value, jsonSettings))
|
this.SetString(key, (Configuration.serializer ()).Serialize value)
|
||||||
|
|
||||||
/// Get an object from the session
|
/// Get an object from the session
|
||||||
member this.TryGetObject<'T> key =
|
member this.TryGetObject<'T> key =
|
||||||
match this.GetString key with
|
match this.GetString key with
|
||||||
| null -> None
|
| null -> None
|
||||||
| v -> Some (JsonConvert.DeserializeObject<'T> (v, jsonSettings))
|
| v -> Some ((Configuration.serializer ()).Deserialize<'T> v)
|
||||||
|
|
||||||
/// The currently logged on small group
|
/// The currently logged on small group
|
||||||
member this.CurrentGroup
|
member this.CurrentGroup
|
||||||
with get () = this.TryGetObject<SmallGroup> Key.Session.currentGroup
|
with get () = this.TryGetObject<SmallGroup> Key.Session.currentGroup
|
||||||
and set (v : SmallGroup option) =
|
and set (v: SmallGroup option) =
|
||||||
match v with
|
match v with
|
||||||
| Some group -> this.SetObject Key.Session.currentGroup group
|
| Some group -> this.SetObject Key.Session.currentGroup group
|
||||||
| None -> this.Remove Key.Session.currentGroup
|
| None -> this.Remove Key.Session.currentGroup
|
||||||
@@ -36,60 +32,59 @@ type ISession with
|
|||||||
/// The currently logged on user
|
/// The currently logged on user
|
||||||
member this.CurrentUser
|
member this.CurrentUser
|
||||||
with get () = this.TryGetObject<User> Key.Session.currentUser
|
with get () = this.TryGetObject<User> Key.Session.currentUser
|
||||||
and set (v : User option) =
|
and set (v: User option) =
|
||||||
match v with
|
match v with
|
||||||
| Some user -> this.SetObject Key.Session.currentUser { user with PasswordHash = "" }
|
| Some user -> this.SetObject Key.Session.currentUser { user with PasswordHash = "" }
|
||||||
| None -> this.Remove Key.Session.currentUser
|
| None -> this.Remove Key.Session.currentUser
|
||||||
|
|
||||||
/// Current messages for the session
|
/// Current messages for the session
|
||||||
member this.Messages
|
member this.Messages
|
||||||
with get () =
|
with get () =
|
||||||
this.TryGetObject<UserMessage list> Key.Session.userMessages
|
this.TryGetObject<UserMessage list> Key.Session.userMessages
|
||||||
|> Option.defaultValue List.empty<UserMessage>
|
|> Option.defaultValue List.empty<UserMessage>
|
||||||
and set (v : UserMessage list) = this.SetObject Key.Session.userMessages v
|
and set (v: UserMessage list) = this.SetObject Key.Session.userMessages v
|
||||||
|
|
||||||
|
|
||||||
open System.Security.Claims
|
open System.Security.Claims
|
||||||
|
|
||||||
/// Extensions on the claims principal
|
/// Extensions on the claims principal
|
||||||
type ClaimsPrincipal with
|
type ClaimsPrincipal with
|
||||||
|
|
||||||
/// The ID of the currently logged on small group
|
/// The ID of the currently logged on small group
|
||||||
member this.SmallGroupId =
|
member this.SmallGroupId =
|
||||||
if this.HasClaim (fun c -> c.Type = ClaimTypes.GroupSid) then
|
this.FindFirstValue ClaimTypes.GroupSid
|
||||||
Some (idFromShort SmallGroupId (this.FindFirst(fun c -> c.Type = ClaimTypes.GroupSid).Value))
|
|> Option.ofObj
|
||||||
else None
|
|> Option.map (idFromShort SmallGroupId)
|
||||||
|
|
||||||
/// The ID of the currently signed in user
|
/// The ID of the currently signed-in user
|
||||||
member this.UserId =
|
member this.UserId =
|
||||||
if this.HasClaim (fun c -> c.Type = ClaimTypes.NameIdentifier) then
|
this.FindFirstValue ClaimTypes.NameIdentifier
|
||||||
Some (idFromShort UserId (this.FindFirst(fun c -> c.Type = ClaimTypes.NameIdentifier).Value))
|
|> Option.ofObj
|
||||||
else None
|
|> Option.map (idFromShort UserId)
|
||||||
|
|
||||||
|
|
||||||
open Giraffe
|
open Giraffe
|
||||||
open Npgsql
|
|
||||||
|
|
||||||
/// Extensions on the ASP.NET Core HTTP context
|
/// Extensions on the ASP.NET Core HTTP context
|
||||||
type HttpContext with
|
type HttpContext with
|
||||||
|
|
||||||
/// The system clock (via DI)
|
/// The system clock (via DI)
|
||||||
member this.Clock = this.GetService<IClock> ()
|
member this.Clock = this.GetService<IClock>()
|
||||||
|
|
||||||
/// The current instant
|
/// The current instant
|
||||||
member this.Now = this.Clock.GetCurrentInstant ()
|
member this.Now = this.Clock.GetCurrentInstant()
|
||||||
|
|
||||||
/// The common string localizer
|
/// The common string localizer
|
||||||
member _.Strings = Views.I18N.localizer.Force ()
|
member _.Strings = Views.I18N.localizer.Force()
|
||||||
|
|
||||||
/// The currently logged on small group (sets the value in the session if it is missing)
|
/// The currently logged on small group (sets the value in the session if it is missing)
|
||||||
member this.CurrentGroup () = task {
|
member this.CurrentGroup() = task {
|
||||||
match this.Session.CurrentGroup with
|
match this.Session.CurrentGroup with
|
||||||
| Some group -> return Some group
|
| Some group -> return Some group
|
||||||
| None ->
|
| None ->
|
||||||
match this.User.SmallGroupId with
|
match this.User.SmallGroupId with
|
||||||
| Some groupId ->
|
| Some groupId ->
|
||||||
match! SmallGroups.tryByIdWithPreferences groupId with
|
match! SmallGroups.tryById groupId with
|
||||||
| Some group ->
|
| Some group ->
|
||||||
this.Session.CurrentGroup <- Some group
|
this.Session.CurrentGroup <- Some group
|
||||||
return Some group
|
return Some group
|
||||||
@@ -98,7 +93,7 @@ type HttpContext with
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// The currently logged on user (sets the value in the session if it is missing)
|
/// The currently logged on user (sets the value in the session if it is missing)
|
||||||
member this.CurrentUser () = task {
|
member this.CurrentUser() = task {
|
||||||
match this.Session.CurrentUser with
|
match this.Session.CurrentUser with
|
||||||
| Some user -> return Some user
|
| Some user -> return Some user
|
||||||
| None ->
|
| None ->
|
||||||
|
|||||||
86
src/PrayerTracker/Help.fs
Normal file
86
src/PrayerTracker/Help.fs
Normal file
@@ -0,0 +1,86 @@
|
|||||||
|
/// Handlers for /help routes
|
||||||
|
module PrayerTracker.Handlers.Help
|
||||||
|
|
||||||
|
open Giraffe
|
||||||
|
open PrayerTracker
|
||||||
|
|
||||||
|
// GET: /help
|
||||||
|
let index : HttpHandler = fun next ctx -> task {
|
||||||
|
return!
|
||||||
|
Views.Help.index ()
|
||||||
|
|> Views.Layout.help ctx.Strings["Help Index"].Value true
|
||||||
|
|> renderHtml next ctx
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Handlers for /help/requests routes
|
||||||
|
module Requests =
|
||||||
|
|
||||||
|
// GET: /help/requests/edit
|
||||||
|
let edit : HttpHandler = fun next ctx -> task {
|
||||||
|
return!
|
||||||
|
Views.Help.Requests.edit ()
|
||||||
|
|> Views.Layout.help ctx.Strings["Add / Edit a Request"].Value false
|
||||||
|
|> renderHtml next ctx
|
||||||
|
}
|
||||||
|
|
||||||
|
// GET: /help/requests/maintain
|
||||||
|
let maintain : HttpHandler = fun next ctx -> task {
|
||||||
|
return!
|
||||||
|
Views.Help.Requests.maintain ()
|
||||||
|
|> Views.Layout.help ctx.Strings["Maintain Requests"].Value false
|
||||||
|
|> renderHtml next ctx
|
||||||
|
}
|
||||||
|
|
||||||
|
// GET: /help/requests/view
|
||||||
|
let view : HttpHandler = fun next ctx -> task {
|
||||||
|
return!
|
||||||
|
Views.Help.Requests.view ()
|
||||||
|
|> Views.Layout.help ctx.Strings["View Request List"].Value false
|
||||||
|
|> renderHtml next ctx
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Handlers for /help/small-group routes
|
||||||
|
module SmallGroup =
|
||||||
|
|
||||||
|
// GET: /help/small-group/announcement
|
||||||
|
let announcement : HttpHandler = fun next ctx -> task {
|
||||||
|
return!
|
||||||
|
Views.Help.SmallGroup.announcement ()
|
||||||
|
|> Views.Layout.help ctx.Strings["Send Announcement"].Value false
|
||||||
|
|> renderHtml next ctx
|
||||||
|
}
|
||||||
|
|
||||||
|
// GET: /help/small-group/members
|
||||||
|
let members : HttpHandler = fun next ctx -> task {
|
||||||
|
return!
|
||||||
|
Views.Help.SmallGroup.members ()
|
||||||
|
|> Views.Layout.help ctx.Strings["Maintain Group Members"].Value false
|
||||||
|
|> renderHtml next ctx
|
||||||
|
}
|
||||||
|
|
||||||
|
// GET: /help/small-group/members
|
||||||
|
let preferences : HttpHandler = fun next ctx -> task {
|
||||||
|
return!
|
||||||
|
Views.Help.SmallGroup.preferences ()
|
||||||
|
|> Views.Layout.help ctx.Strings["Change Preferences"].Value false
|
||||||
|
|> renderHtml next ctx
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Handlers for /help/user routes
|
||||||
|
module User =
|
||||||
|
|
||||||
|
// GET: /help/user/log-on
|
||||||
|
let logOn : HttpHandler = fun next ctx -> task {
|
||||||
|
return!
|
||||||
|
Views.Help.User.logOn ()
|
||||||
|
|> Views.Layout.help ctx.Strings["Log On"].Value false
|
||||||
|
|> renderHtml next ctx
|
||||||
|
}
|
||||||
|
|
||||||
|
// GET: /help/user/password
|
||||||
|
let password : HttpHandler = fun next ctx -> task {
|
||||||
|
return!
|
||||||
|
Views.Help.User.password ()
|
||||||
|
|> Views.Layout.help ctx.Strings["Change Your Password"].Value false
|
||||||
|
|> renderHtml next ctx
|
||||||
|
}
|
||||||
@@ -27,17 +27,17 @@ let language culture : HttpHandler = requireAccess [ AccessLevel.Public ] >=> fu
|
|||||||
| ""
|
| ""
|
||||||
| "en" -> "en-US"
|
| "en" -> "en-US"
|
||||||
| "es" -> "es-MX"
|
| "es" -> "es-MX"
|
||||||
| _ -> $"{culture}-{culture.ToUpper ()}"
|
| _ -> $"{culture}-{culture.ToUpper()}"
|
||||||
|> (CultureInfo >> Option.ofObj)
|
|> (CultureInfo >> Option.ofObj)
|
||||||
with
|
with
|
||||||
| :? CultureNotFoundException
|
| :? CultureNotFoundException
|
||||||
| :? ArgumentException -> None
|
| :? ArgumentException -> None
|
||||||
|> function
|
|> function
|
||||||
| Some c ->
|
| Some c ->
|
||||||
ctx.Response.Cookies.Append (
|
ctx.Response.Cookies.Append(
|
||||||
CookieRequestCultureProvider.DefaultCookieName,
|
CookieRequestCultureProvider.DefaultCookieName,
|
||||||
CookieRequestCultureProvider.MakeCookieValue (RequestCulture c),
|
CookieRequestCultureProvider.MakeCookieValue(RequestCulture c),
|
||||||
CookieOptions (Expires = Nullable<DateTimeOffset> (DateTimeOffset (DateTime.Now.AddYears 1))))
|
CookieOptions(Expires = Nullable<DateTimeOffset>(DateTimeOffset(DateTime.Now.AddYears 1))))
|
||||||
| _ -> ()
|
| _ -> ()
|
||||||
let url = match string ctx.Request.Headers["Referer"] with null | "" -> "/" | r -> r
|
let url = match string ctx.Request.Headers["Referer"] with null | "" -> "/" | r -> r
|
||||||
redirectTo false url next ctx
|
redirectTo false url next ctx
|
||||||
@@ -59,7 +59,7 @@ open Microsoft.AspNetCore.Authentication.Cookies
|
|||||||
|
|
||||||
// GET /log-off
|
// GET /log-off
|
||||||
let logOff : HttpHandler = requireAccess [ AccessLevel.Public ] >=> fun next ctx -> task {
|
let logOff : HttpHandler = requireAccess [ AccessLevel.Public ] >=> fun next ctx -> task {
|
||||||
ctx.Session.Clear ()
|
ctx.Session.Clear()
|
||||||
do! ctx.SignOutAsync CookieAuthenticationDefaults.AuthenticationScheme
|
do! ctx.SignOutAsync CookieAuthenticationDefaults.AuthenticationScheme
|
||||||
addHtmlInfo ctx ctx.Strings["Log Off Successful • Have a nice day!"]
|
addHtmlInfo ctx ctx.Strings["Log Off Successful • Have a nice day!"]
|
||||||
return! redirectTo false "/" next ctx
|
return! redirectTo false "/" next ctx
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ open PrayerTracker.Entities
|
|||||||
open PrayerTracker.ViewModels
|
open PrayerTracker.ViewModels
|
||||||
|
|
||||||
/// Retrieve a prayer request, and ensure that it belongs to the current class
|
/// Retrieve a prayer request, and ensure that it belongs to the current class
|
||||||
let private findRequest (ctx : HttpContext) reqId = task {
|
let private findRequest (ctx: HttpContext) reqId = task {
|
||||||
match! PrayerRequests.tryById reqId with
|
match! PrayerRequests.tryById reqId with
|
||||||
| Some req when req.SmallGroupId = ctx.Session.CurrentGroup.Value.Id -> return Ok req
|
| Some req when req.SmallGroupId = ctx.Session.CurrentGroup.Value.Id -> return Ok req
|
||||||
| Some _ ->
|
| Some _ ->
|
||||||
@@ -18,31 +18,29 @@ let private findRequest (ctx : HttpContext) reqId = task {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Generate a list of requests for the given date
|
/// Generate a list of requests for the given date
|
||||||
let private generateRequestList (ctx : HttpContext) date = task {
|
let private generateRequestList (ctx: HttpContext) date = task {
|
||||||
let group = ctx.Session.CurrentGroup.Value
|
let group = ctx.Session.CurrentGroup.Value
|
||||||
let listDate = match date with Some d -> d | None -> SmallGroup.localDateNow ctx.Clock group
|
let listDate = defaultArg date (group.LocalDateNow ctx.Clock)
|
||||||
let! reqs =
|
let! reqs =
|
||||||
PrayerRequests.forGroup
|
PrayerRequests.forGroup
|
||||||
{ SmallGroup = group
|
{ SmallGroup = group
|
||||||
Clock = ctx.Clock
|
Clock = ctx.Clock
|
||||||
ListDate = Some listDate
|
ListDate = Some listDate
|
||||||
ActiveOnly = true
|
ActiveOnly = true
|
||||||
PageNumber = 0
|
PageNumber = 0 }
|
||||||
}
|
|
||||||
return
|
return
|
||||||
{ Requests = reqs
|
{ Requests = reqs
|
||||||
Date = listDate
|
Date = listDate
|
||||||
SmallGroup = group
|
SmallGroup = group
|
||||||
ShowHeader = true
|
ShowHeader = true
|
||||||
CanEmail = Option.isSome ctx.User.UserId
|
CanEmail = Option.isSome ctx.User.UserId
|
||||||
Recipients = []
|
Recipients = [] }
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
open NodaTime.Text
|
open NodaTime.Text
|
||||||
|
|
||||||
/// Parse a string into a date (optionally, of course)
|
/// Parse a string into a date (optionally, of course)
|
||||||
let private parseListDate (date : string option) =
|
let private parseListDate (date: string option) =
|
||||||
match date with
|
match date with
|
||||||
| Some dt -> match LocalDatePattern.Iso.Parse dt with it when it.Success -> Some it.Value | _ -> None
|
| Some dt -> match LocalDatePattern.Iso.Parse dt with it when it.Success -> Some it.Value | _ -> None
|
||||||
| None -> None
|
| None -> None
|
||||||
@@ -52,18 +50,18 @@ open System
|
|||||||
// GET /prayer-request/[request-id]/edit
|
// GET /prayer-request/[request-id]/edit
|
||||||
let edit reqId : HttpHandler = requireAccess [ User ] >=> fun next ctx -> task {
|
let edit reqId : HttpHandler = requireAccess [ User ] >=> fun next ctx -> task {
|
||||||
let group = ctx.Session.CurrentGroup.Value
|
let group = ctx.Session.CurrentGroup.Value
|
||||||
let now = SmallGroup.localDateNow ctx.Clock group
|
let now = group.LocalDateNow ctx.Clock
|
||||||
let requestId = PrayerRequestId reqId
|
let requestId = PrayerRequestId reqId
|
||||||
if requestId.Value = Guid.Empty then
|
if requestId.Value = Guid.Empty then
|
||||||
return!
|
return!
|
||||||
{ viewInfo ctx with HelpLink = Some Help.editRequest }
|
{ viewInfo ctx with HelpLink = Some Help.editRequest }
|
||||||
|> Views.PrayerRequest.edit EditRequest.empty (now.ToString ("R", null)) ctx
|
|> Views.PrayerRequest.edit EditRequest.empty (now.ToString("R", null)) ctx
|
||||||
|> renderHtml next ctx
|
|> renderHtml next ctx
|
||||||
else
|
else
|
||||||
match! findRequest ctx requestId with
|
match! findRequest ctx requestId with
|
||||||
| Ok req ->
|
| Ok req ->
|
||||||
let s = ctx.Strings
|
let s = ctx.Strings
|
||||||
if PrayerRequest.isExpired now group req then
|
if req.IsExpired now group then
|
||||||
{ UserMessage.warning with
|
{ UserMessage.warning with
|
||||||
Text = htmlLocString s["This request is expired."]
|
Text = htmlLocString s["This request is expired."]
|
||||||
Description =
|
Description =
|
||||||
@@ -90,14 +88,13 @@ let email date : HttpHandler = requireAccess [ User ] >=> fun next ctx -> task {
|
|||||||
let! recipients = Members.forGroup group.Id
|
let! recipients = Members.forGroup group.Id
|
||||||
use! client = Email.getConnection ()
|
use! client = Email.getConnection ()
|
||||||
do! Email.sendEmails
|
do! Email.sendEmails
|
||||||
{ Client = client
|
{ Client = client
|
||||||
Recipients = recipients
|
Recipients = recipients
|
||||||
Group = group
|
Group = group
|
||||||
Subject = s["Prayer Requests for {0} - {1:MMMM d, yyyy}", group.Name, list.Date].Value
|
Subject = s["Prayer Requests for {0} - {1:MMMM d, yyyy}", group.Name, list.Date].Value
|
||||||
HtmlBody = list.AsHtml s
|
HtmlBody = list.AsHtml s
|
||||||
PlainTextBody = list.AsText s
|
PlainTextBody = list.AsText s
|
||||||
Strings = s
|
Strings = s }
|
||||||
}
|
|
||||||
do! client.DisconnectAsync true
|
do! client.DisconnectAsync true
|
||||||
return!
|
return!
|
||||||
viewInfo ctx
|
viewInfo ctx
|
||||||
@@ -122,33 +119,31 @@ let expire reqId : HttpHandler = requireAccess [ User ] >=> fun next ctx -> task
|
|||||||
match! findRequest ctx requestId with
|
match! findRequest ctx requestId with
|
||||||
| Ok req ->
|
| Ok req ->
|
||||||
do! PrayerRequests.updateExpiration { req with Expiration = Forced } false
|
do! PrayerRequests.updateExpiration { req with Expiration = Forced } false
|
||||||
addInfo ctx ctx.Strings["Successfully {0} prayer request", ctx.Strings["Expired"].Value.ToLower ()]
|
addInfo ctx ctx.Strings["Successfully {0} prayer request", ctx.Strings["Expired"].Value.ToLower()]
|
||||||
return! redirectTo false "/prayer-requests" next ctx
|
return! redirectTo false "/prayer-requests" next ctx
|
||||||
| Result.Error e -> return! e
|
| Result.Error e -> return! e
|
||||||
}
|
}
|
||||||
|
|
||||||
// GET /prayer-requests/[group-id]/list
|
// GET /prayer-requests/[group-id]/list
|
||||||
let list groupId : HttpHandler = requireAccess [ AccessLevel.Public ] >=> fun next ctx -> task {
|
let list groupId : HttpHandler = requireAccess [ AccessLevel.Public ] >=> fun next ctx -> task {
|
||||||
match! SmallGroups.tryByIdWithPreferences (SmallGroupId groupId) with
|
match! SmallGroups.tryById (SmallGroupId groupId) with
|
||||||
| Some group when group.Preferences.IsPublic ->
|
| Some group when group.Preferences.IsPublic ->
|
||||||
let! reqs =
|
let! reqs =
|
||||||
PrayerRequests.forGroup
|
PrayerRequests.forGroup
|
||||||
{ SmallGroup = group
|
{ SmallGroup = group
|
||||||
Clock = ctx.Clock
|
Clock = ctx.Clock
|
||||||
ListDate = None
|
ListDate = None
|
||||||
ActiveOnly = true
|
ActiveOnly = true
|
||||||
PageNumber = 0
|
PageNumber = 0 }
|
||||||
}
|
|
||||||
return!
|
return!
|
||||||
viewInfo ctx
|
viewInfo ctx
|
||||||
|> Views.PrayerRequest.list
|
|> Views.PrayerRequest.list
|
||||||
{ Requests = reqs
|
{ Requests = reqs
|
||||||
Date = SmallGroup.localDateNow ctx.Clock group
|
Date = group.LocalDateNow ctx.Clock
|
||||||
SmallGroup = group
|
SmallGroup = group
|
||||||
ShowHeader = true
|
ShowHeader = true
|
||||||
CanEmail = Option.isSome ctx.User.UserId
|
CanEmail = Option.isSome ctx.User.UserId
|
||||||
Recipients = []
|
Recipients = [] }
|
||||||
}
|
|
||||||
|> renderHtml next ctx
|
|> renderHtml next ctx
|
||||||
| Some _ ->
|
| Some _ ->
|
||||||
addError ctx ctx.Strings["The request list for the group you tried to view is not public."]
|
addError ctx ctx.Strings["The request list for the group you tried to view is not public."]
|
||||||
@@ -182,23 +177,20 @@ let maintain onlyActive : HttpHandler = requireAccess [ User ] >=> fun next ctx
|
|||||||
{ MaintainRequests.empty with
|
{ MaintainRequests.empty with
|
||||||
Requests = reqs
|
Requests = reqs
|
||||||
SearchTerm = Some search
|
SearchTerm = Some search
|
||||||
PageNbr = Some pageNbr
|
PageNbr = Some pageNbr }
|
||||||
}
|
|
||||||
| Result.Error _ ->
|
| Result.Error _ ->
|
||||||
let! reqs =
|
let! reqs =
|
||||||
PrayerRequests.forGroup
|
PrayerRequests.forGroup
|
||||||
{ SmallGroup = group
|
{ SmallGroup = group
|
||||||
Clock = ctx.Clock
|
Clock = ctx.Clock
|
||||||
ListDate = None
|
ListDate = None
|
||||||
ActiveOnly = onlyActive
|
ActiveOnly = onlyActive
|
||||||
PageNumber = pageNbr
|
PageNumber = pageNbr }
|
||||||
}
|
|
||||||
return
|
return
|
||||||
{ MaintainRequests.empty with
|
{ MaintainRequests.empty with
|
||||||
Requests = reqs
|
Requests = reqs
|
||||||
OnlyActive = Some onlyActive
|
OnlyActive = Some onlyActive
|
||||||
PageNbr = if onlyActive then None else Some pageNbr
|
PageNbr = if onlyActive then None else Some pageNbr }
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return!
|
return!
|
||||||
{ viewInfo ctx with HelpLink = Some Help.maintainRequests }
|
{ viewInfo ctx with HelpLink = Some Help.maintainRequests }
|
||||||
@@ -229,12 +221,12 @@ open System.Threading.Tasks
|
|||||||
|
|
||||||
// POST /prayer-request/save
|
// POST /prayer-request/save
|
||||||
let save : HttpHandler = requireAccess [ User ] >=> validateCsrf >=> fun next ctx -> task {
|
let save : HttpHandler = requireAccess [ User ] >=> validateCsrf >=> fun next ctx -> task {
|
||||||
match! ctx.TryBindFormAsync<EditRequest> () with
|
match! ctx.TryBindFormAsync<EditRequest>() with
|
||||||
| Ok model ->
|
| Ok model ->
|
||||||
let group = ctx.Session.CurrentGroup.Value
|
let group = ctx.Session.CurrentGroup.Value
|
||||||
let! req =
|
let! req =
|
||||||
if model.IsNew then
|
if model.IsNew then
|
||||||
{ PrayerRequest.empty with
|
{ PrayerRequest.Empty with
|
||||||
Id = (Guid.NewGuid >> PrayerRequestId) ()
|
Id = (Guid.NewGuid >> PrayerRequestId) ()
|
||||||
SmallGroupId = group.Id
|
SmallGroupId = group.Id
|
||||||
UserId = ctx.User.UserId.Value
|
UserId = ctx.User.UserId.Value
|
||||||
@@ -243,26 +235,26 @@ let save : HttpHandler = requireAccess [ User ] >=> validateCsrf >=> fun next ct
|
|||||||
else PrayerRequests.tryById (idFromShort PrayerRequestId model.RequestId)
|
else PrayerRequests.tryById (idFromShort PrayerRequestId model.RequestId)
|
||||||
match req with
|
match req with
|
||||||
| Some pr when pr.SmallGroupId = group.Id ->
|
| Some pr when pr.SmallGroupId = group.Id ->
|
||||||
let now = SmallGroup.localDateNow ctx.Clock group
|
let now = group.LocalDateNow ctx.Clock
|
||||||
let updated =
|
let updated =
|
||||||
{ pr with
|
{ pr with
|
||||||
RequestType = PrayerRequestType.fromCode model.RequestType
|
RequestType = PrayerRequestType.Parse model.RequestType
|
||||||
Requestor = match model.Requestor with Some x when x.Trim () = "" -> None | x -> x
|
Requestor = match model.Requestor with Some x when x.Trim() = "" -> None | x -> x
|
||||||
Text = ckEditorToText model.Text
|
Text = ckEditorToText model.Text
|
||||||
Expiration = Expiration.fromCode model.Expiration
|
Expiration = Expiration.Parse model.Expiration
|
||||||
}
|
}
|
||||||
|> function
|
|> function
|
||||||
| it when model.IsNew ->
|
| it when model.IsNew ->
|
||||||
let dt =
|
let dt =
|
||||||
(defaultArg (parseListDate model.EnteredDate) now)
|
(defaultArg (parseListDate model.EnteredDate) now)
|
||||||
.AtStartOfDayInZone(SmallGroup.timeZone group)
|
.AtStartOfDayInZone(group.TimeZone)
|
||||||
.ToInstant()
|
.ToInstant()
|
||||||
{ it with EnteredDate = dt; UpdatedDate = dt }
|
{ it with EnteredDate = dt; UpdatedDate = dt }
|
||||||
| it when defaultArg model.SkipDateUpdate false -> it
|
| it when defaultArg model.SkipDateUpdate false -> it
|
||||||
| it -> { it with UpdatedDate = ctx.Now }
|
| it -> { it with UpdatedDate = ctx.Now }
|
||||||
do! PrayerRequests.save updated
|
do! PrayerRequests.save updated
|
||||||
let act = if model.IsNew then "Added" else "Updated"
|
let act = if model.IsNew then "Added" else "Updated"
|
||||||
addInfo ctx ctx.Strings["Successfully {0} prayer request", ctx.Strings[act].Value.ToLower ()]
|
addInfo ctx ctx.Strings["Successfully {0} prayer request", ctx.Strings[act].Value.ToLower()]
|
||||||
return! redirectTo false "/prayer-requests" next ctx
|
return! redirectTo false "/prayer-requests" next ctx
|
||||||
| Some _
|
| Some _
|
||||||
| None -> return! fourOhFour ctx
|
| None -> return! fourOhFour ctx
|
||||||
|
|||||||
@@ -16,6 +16,7 @@
|
|||||||
<Compile Include="Email.fs" />
|
<Compile Include="Email.fs" />
|
||||||
<Compile Include="CommonFunctions.fs" />
|
<Compile Include="CommonFunctions.fs" />
|
||||||
<Compile Include="Church.fs" />
|
<Compile Include="Church.fs" />
|
||||||
|
<Compile Include="Help.fs" />
|
||||||
<Compile Include="Home.fs" />
|
<Compile Include="Home.fs" />
|
||||||
<Compile Include="PrayerRequest.fs" />
|
<Compile Include="PrayerRequest.fs" />
|
||||||
<Compile Include="SmallGroup.fs" />
|
<Compile Include="SmallGroup.fs" />
|
||||||
@@ -24,15 +25,15 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="BitBadger.AspNetCore.CanonicalDomains" Version="1.0.0" />
|
<PackageReference Include="BitBadger.AspNetCore.CanonicalDomains" Version="1.1.0" />
|
||||||
<PackageReference Include="Giraffe.Htmx" Version="1.9.2" />
|
<PackageReference Include="Giraffe.Htmx" Version="2.0.4" />
|
||||||
<PackageReference Include="NodaTime.Serialization.JsonNet" Version="3.0.1" />
|
<PackageReference Include="NeoSmart.Caching.Sqlite.AspNetCore" Version="9.0.0" />
|
||||||
<PackageReference Update="FSharp.Core" Version="7.0.300" />
|
<PackageReference Update="FSharp.Core" Version="9.0.101" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\PrayerTracker.Data\PrayerTracker.Data.fsproj" />
|
<ProjectReference Include="..\Data\PrayerTracker.Data.fsproj" />
|
||||||
<ProjectReference Include="..\PrayerTracker.UI\PrayerTracker.UI.fsproj" />
|
<ProjectReference Include="..\UI\PrayerTracker.UI.fsproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
@@ -97,17 +97,17 @@ open Microsoft.AspNetCore.Authentication.Cookies
|
|||||||
|
|
||||||
// POST /small-group/log-on/submit
|
// POST /small-group/log-on/submit
|
||||||
let logOnSubmit : HttpHandler = requireAccess [ AccessLevel.Public ] >=> validateCsrf >=> fun next ctx -> task {
|
let logOnSubmit : HttpHandler = requireAccess [ AccessLevel.Public ] >=> validateCsrf >=> fun next ctx -> task {
|
||||||
match! ctx.TryBindFormAsync<GroupLogOn> () with
|
match! ctx.TryBindFormAsync<GroupLogOn>() with
|
||||||
| Ok model ->
|
| Ok model ->
|
||||||
match! SmallGroups.logOn (idFromShort SmallGroupId model.SmallGroupId) model.Password with
|
match! SmallGroups.logOn (idFromShort SmallGroupId model.SmallGroupId) model.Password with
|
||||||
| Some group ->
|
| Some group ->
|
||||||
ctx.Session.CurrentGroup <- Some group
|
ctx.Session.CurrentGroup <- Some group
|
||||||
let identity = ClaimsIdentity (
|
let identity = ClaimsIdentity(
|
||||||
Seq.singleton (Claim (ClaimTypes.GroupSid, shortGuid group.Id.Value)),
|
Seq.singleton (Claim(ClaimTypes.GroupSid, shortGuid group.Id.Value)),
|
||||||
CookieAuthenticationDefaults.AuthenticationScheme)
|
CookieAuthenticationDefaults.AuthenticationScheme)
|
||||||
do! ctx.SignInAsync (
|
do! ctx.SignInAsync(
|
||||||
identity.AuthenticationType, ClaimsPrincipal identity,
|
identity.AuthenticationType, ClaimsPrincipal identity,
|
||||||
AuthenticationProperties (
|
AuthenticationProperties(
|
||||||
IssuedUtc = DateTimeOffset.UtcNow,
|
IssuedUtc = DateTimeOffset.UtcNow,
|
||||||
IsPersistent = defaultArg model.RememberMe false))
|
IsPersistent = defaultArg model.RememberMe false))
|
||||||
addInfo ctx ctx.Strings["Log On Successful • Welcome to {0}", ctx.Strings["PrayerTracker"]]
|
addInfo ctx ctx.Strings["Log On Successful • Welcome to {0}", ctx.Strings["PrayerTracker"]]
|
||||||
@@ -142,29 +142,26 @@ let members : HttpHandler = requireAccess [ User ] >=> fun next ctx -> task {
|
|||||||
let overview : HttpHandler = requireAccess [ User ] >=> fun next ctx -> task {
|
let overview : HttpHandler = requireAccess [ User ] >=> fun next ctx -> task {
|
||||||
let group = ctx.Session.CurrentGroup.Value
|
let group = ctx.Session.CurrentGroup.Value
|
||||||
let! reqs = PrayerRequests.forGroup
|
let! reqs = PrayerRequests.forGroup
|
||||||
{ SmallGroup = group
|
{ SmallGroup = group
|
||||||
Clock = ctx.Clock
|
Clock = ctx.Clock
|
||||||
ListDate = None
|
ListDate = None
|
||||||
ActiveOnly = true
|
ActiveOnly = true
|
||||||
PageNumber = 0
|
PageNumber = 0 }
|
||||||
}
|
|
||||||
let! reqCount = PrayerRequests.countByGroup group.Id
|
let! reqCount = PrayerRequests.countByGroup group.Id
|
||||||
let! mbrCount = Members.countByGroup group.Id
|
let! mbrCount = Members.countByGroup group.Id
|
||||||
let! admins = Users.listByGroupId group.Id
|
let! admins = Users.listByGroupId group.Id
|
||||||
let model =
|
let model =
|
||||||
{ TotalActiveReqs = List.length reqs
|
{ TotalActiveReqs = List.length reqs
|
||||||
AllReqs = reqCount
|
AllReqs = int reqCount
|
||||||
TotalMembers = mbrCount
|
TotalMembers = int mbrCount
|
||||||
ActiveReqsByType = (
|
ActiveReqsByType = (
|
||||||
reqs
|
reqs
|
||||||
|> Seq.ofList
|
|> Seq.ofList
|
||||||
|> Seq.map (fun req -> req.RequestType)
|
|> Seq.map (fun req -> req.RequestType)
|
||||||
|> Seq.distinct
|
|> Seq.distinct
|
||||||
|> Seq.map (fun reqType ->
|
|> Seq.map (fun reqType -> reqType, reqs |> List.filter (fun r -> r.RequestType = reqType) |> List.length)
|
||||||
reqType, reqs |> List.filter (fun r -> r.RequestType = reqType) |> List.length)
|
|> Map.ofSeq)
|
||||||
|> Map.ofSeq)
|
Admins = admins }
|
||||||
Admins = admins
|
|
||||||
}
|
|
||||||
return!
|
return!
|
||||||
viewInfo ctx
|
viewInfo ctx
|
||||||
|> Views.SmallGroup.overview model
|
|> Views.SmallGroup.overview model
|
||||||
@@ -183,15 +180,15 @@ open System.Threading.Tasks
|
|||||||
|
|
||||||
// POST /small-group/save
|
// POST /small-group/save
|
||||||
let save : HttpHandler = requireAccess [ Admin ] >=> validateCsrf >=> fun next ctx -> task {
|
let save : HttpHandler = requireAccess [ Admin ] >=> validateCsrf >=> fun next ctx -> task {
|
||||||
match! ctx.TryBindFormAsync<EditSmallGroup> () with
|
match! ctx.TryBindFormAsync<EditSmallGroup>() with
|
||||||
| Ok model ->
|
| Ok model ->
|
||||||
let! tryGroup =
|
let! tryGroup =
|
||||||
if model.IsNew then Task.FromResult (Some { SmallGroup.empty with Id = (Guid.NewGuid >> SmallGroupId) () })
|
if model.IsNew then Task.FromResult(Some { SmallGroup.Empty with Id = (Guid.NewGuid >> SmallGroupId) () })
|
||||||
else SmallGroups.tryById (idFromShort SmallGroupId model.SmallGroupId)
|
else SmallGroups.tryById (idFromShort SmallGroupId model.SmallGroupId)
|
||||||
match tryGroup with
|
match tryGroup with
|
||||||
| Some group ->
|
| Some group ->
|
||||||
do! SmallGroups.save (model.populateGroup group) model.IsNew
|
do! SmallGroups.save (model.populateGroup group)
|
||||||
let act = ctx.Strings[if model.IsNew then "Added" else "Updated"].Value.ToLower ()
|
let act = ctx.Strings[if model.IsNew then "Added" else "Updated"].Value.ToLower()
|
||||||
addHtmlInfo ctx ctx.Strings["Successfully {0} group “{1}”", act, model.Name]
|
addHtmlInfo ctx ctx.Strings["Successfully {0} group “{1}”", act, model.Name]
|
||||||
return! redirectTo false "/small-groups" next ctx
|
return! redirectTo false "/small-groups" next ctx
|
||||||
| None -> return! fourOhFour ctx
|
| None -> return! fourOhFour ctx
|
||||||
@@ -200,12 +197,12 @@ let save : HttpHandler = requireAccess [ Admin ] >=> validateCsrf >=> fun next c
|
|||||||
|
|
||||||
// POST /small-group/member/save
|
// POST /small-group/member/save
|
||||||
let saveMember : HttpHandler = requireAccess [ User ] >=> validateCsrf >=> fun next ctx -> task {
|
let saveMember : HttpHandler = requireAccess [ User ] >=> validateCsrf >=> fun next ctx -> task {
|
||||||
match! ctx.TryBindFormAsync<EditMember> () with
|
match! ctx.TryBindFormAsync<EditMember>() with
|
||||||
| Ok model ->
|
| Ok model ->
|
||||||
let group = ctx.Session.CurrentGroup.Value
|
let group = ctx.Session.CurrentGroup.Value
|
||||||
let! tryMbr =
|
let! tryMbr =
|
||||||
if model.IsNew then
|
if model.IsNew then
|
||||||
Task.FromResult (Some { Member.empty with Id = (Guid.NewGuid >> MemberId) (); SmallGroupId = group.Id })
|
Task.FromResult(Some { Member.Empty with Id = (Guid.NewGuid >> MemberId) (); SmallGroupId = group.Id })
|
||||||
else Members.tryById (idFromShort MemberId model.MemberId)
|
else Members.tryById (idFromShort MemberId model.MemberId)
|
||||||
match tryMbr with
|
match tryMbr with
|
||||||
| Some mbr when mbr.SmallGroupId = group.Id ->
|
| Some mbr when mbr.SmallGroupId = group.Id ->
|
||||||
@@ -213,9 +210,8 @@ let saveMember : HttpHandler = requireAccess [ User ] >=> validateCsrf >=> fun n
|
|||||||
{ mbr with
|
{ mbr with
|
||||||
Name = model.Name
|
Name = model.Name
|
||||||
Email = model.Email
|
Email = model.Email
|
||||||
Format = String.noneIfBlank model.Format |> Option.map EmailFormat.fromCode
|
Format = String.noneIfBlank model.Format |> Option.map EmailFormat.Parse }
|
||||||
}
|
let act = ctx.Strings[if model.IsNew then "Added" else "Updated"].Value.ToLower()
|
||||||
let act = ctx.Strings[if model.IsNew then "Added" else "Updated"].Value.ToLower ()
|
|
||||||
addInfo ctx ctx.Strings["Successfully {0} group member", act]
|
addInfo ctx ctx.Strings["Successfully {0} group member", act]
|
||||||
return! redirectTo false "/small-group/members" next ctx
|
return! redirectTo false "/small-group/members" next ctx
|
||||||
| Some _
|
| Some _
|
||||||
@@ -225,16 +221,16 @@ let saveMember : HttpHandler = requireAccess [ User ] >=> validateCsrf >=> fun n
|
|||||||
|
|
||||||
// POST /small-group/preferences/save
|
// POST /small-group/preferences/save
|
||||||
let savePreferences : HttpHandler = requireAccess [ User ] >=> validateCsrf >=> fun next ctx -> task {
|
let savePreferences : HttpHandler = requireAccess [ User ] >=> validateCsrf >=> fun next ctx -> task {
|
||||||
match! ctx.TryBindFormAsync<EditPreferences> () with
|
match! ctx.TryBindFormAsync<EditPreferences>() with
|
||||||
| Ok model ->
|
| Ok model ->
|
||||||
// Since the class is stored in the session, we'll use an intermediate instance to persist it; once that works,
|
// Since the class is stored in the session, we'll use an intermediate instance to persist it; once that works,
|
||||||
// we can repopulate the session instance. That way, if the update fails, the page should still show the
|
// we can repopulate the session instance. That way, if the update fails, the page should still show the
|
||||||
// database values, not the then out-of-sync session ones.
|
// database values, not the then out-of-sync session ones.
|
||||||
let group = ctx.Session.CurrentGroup.Value
|
let group = ctx.Session.CurrentGroup.Value
|
||||||
match! SmallGroups.tryByIdWithPreferences group.Id with
|
match! SmallGroups.tryById group.Id with
|
||||||
| Some group ->
|
| Some group ->
|
||||||
let pref = model.PopulatePreferences group.Preferences
|
let pref = model.PopulatePreferences group.Preferences
|
||||||
do! SmallGroups.savePreferences pref
|
do! SmallGroups.savePreferences group.Id pref
|
||||||
// Refresh session instance
|
// Refresh session instance
|
||||||
ctx.Session.CurrentGroup <- Some { group with Preferences = pref }
|
ctx.Session.CurrentGroup <- Some { group with Preferences = pref }
|
||||||
addInfo ctx ctx.Strings["Group preferences updated successfully"]
|
addInfo ctx ctx.Strings["Group preferences updated successfully"]
|
||||||
@@ -245,16 +241,15 @@ let savePreferences : HttpHandler = requireAccess [ User ] >=> validateCsrf >=>
|
|||||||
|
|
||||||
open Giraffe.ViewEngine
|
open Giraffe.ViewEngine
|
||||||
open PrayerTracker.Views.CommonFunctions
|
open PrayerTracker.Views.CommonFunctions
|
||||||
open Microsoft.Extensions.Configuration
|
|
||||||
|
|
||||||
// POST /small-group/announcement/send
|
// POST /small-group/announcement/send
|
||||||
let sendAnnouncement : HttpHandler = requireAccess [ User ] >=> validateCsrf >=> fun next ctx -> task {
|
let sendAnnouncement : HttpHandler = requireAccess [ User ] >=> validateCsrf >=> fun next ctx -> task {
|
||||||
match! ctx.TryBindFormAsync<Announcement> () with
|
match! ctx.TryBindFormAsync<Announcement>() with
|
||||||
| Ok model ->
|
| Ok model ->
|
||||||
let group = ctx.Session.CurrentGroup.Value
|
let group = ctx.Session.CurrentGroup.Value
|
||||||
let pref = group.Preferences
|
let pref = group.Preferences
|
||||||
let usr = ctx.Session.CurrentUser.Value
|
let usr = ctx.Session.CurrentUser.Value
|
||||||
let now = SmallGroup.localTimeNow ctx.Clock group
|
let now = group.LocalTimeNow ctx.Clock
|
||||||
let s = ctx.Strings
|
let s = ctx.Strings
|
||||||
// Reformat the text to use the class's font stylings
|
// Reformat the text to use the class's font stylings
|
||||||
let requestText = ckEditorToText model.Text
|
let requestText = ckEditorToText model.Text
|
||||||
@@ -266,20 +261,19 @@ let sendAnnouncement : HttpHandler = requireAccess [ User ] >=> validateCsrf >=>
|
|||||||
let! recipients = task {
|
let! recipients = task {
|
||||||
if model.SendToClass = "N" && usr.IsAdmin then
|
if model.SendToClass = "N" && usr.IsAdmin then
|
||||||
let! users = Users.all ()
|
let! users = Users.all ()
|
||||||
return users |> List.map (fun u -> { Member.empty with Name = u.Name; Email = u.Email })
|
return users |> List.map (fun u -> { Member.Empty with Name = u.Name; Email = u.Email })
|
||||||
else return! Members.forGroup group.Id
|
else return! Members.forGroup group.Id
|
||||||
}
|
}
|
||||||
use! client = Email.getConnection ()
|
use! client = Email.getConnection ()
|
||||||
do! Email.sendEmails
|
do! Email.sendEmails
|
||||||
{ Client = client
|
{ Client = client
|
||||||
Recipients = recipients
|
Recipients = recipients
|
||||||
Group = group
|
Group = group
|
||||||
Subject = s["Announcement for {0} - {1:MMMM d, yyyy} {2}", group.Name, now.Date,
|
Subject = s["Announcement for {0} - {1:MMMM d, yyyy} {2}", group.Name, now.Date,
|
||||||
(now.ToString ("h:mm tt", null)).ToLower ()].Value
|
now.ToString("h:mm tt", null).ToLower()].Value
|
||||||
HtmlBody = htmlText
|
HtmlBody = htmlText
|
||||||
PlainTextBody = plainText
|
PlainTextBody = plainText
|
||||||
Strings = s
|
Strings = s }
|
||||||
}
|
|
||||||
do! client.DisconnectAsync true
|
do! client.DisconnectAsync true
|
||||||
// Add to the request list if desired
|
// Add to the request list if desired
|
||||||
match model.SendToClass, model.AddToRequestList with
|
match model.SendToClass, model.AddToRequestList with
|
||||||
@@ -287,21 +281,20 @@ let sendAnnouncement : HttpHandler = requireAccess [ User ] >=> validateCsrf >=>
|
|||||||
| _, None -> ()
|
| _, None -> ()
|
||||||
| _, Some x when not x -> ()
|
| _, Some x when not x -> ()
|
||||||
| _, _ ->
|
| _, _ ->
|
||||||
let zone = SmallGroup.timeZone group
|
let zone = group.TimeZone
|
||||||
do! PrayerRequests.save
|
do! PrayerRequests.save
|
||||||
{ PrayerRequest.empty with
|
{ PrayerRequest.Empty with
|
||||||
Id = (Guid.NewGuid >> PrayerRequestId) ()
|
Id = (Guid.NewGuid >> PrayerRequestId) ()
|
||||||
SmallGroupId = group.Id
|
SmallGroupId = group.Id
|
||||||
UserId = usr.Id
|
UserId = usr.Id
|
||||||
RequestType = (Option.get >> PrayerRequestType.fromCode) model.RequestType
|
RequestType = (Option.get >> PrayerRequestType.Parse) model.RequestType
|
||||||
Text = requestText
|
Text = requestText
|
||||||
EnteredDate = now.Date.AtStartOfDayInZone(zone).ToInstant()
|
EnteredDate = now.Date.AtStartOfDayInZone(zone).ToInstant()
|
||||||
UpdatedDate = now.InZoneLeniently(zone).ToInstant()
|
UpdatedDate = now.InZoneLeniently(zone).ToInstant() }
|
||||||
}
|
|
||||||
// Tell 'em what they've won, Johnny!
|
// Tell 'em what they've won, Johnny!
|
||||||
let toWhom =
|
let toWhom =
|
||||||
if model.SendToClass = "N" then s["{0} users", s["PrayerTracker"]].Value
|
if model.SendToClass = "N" then s["{0} users", s["PrayerTracker"]].Value
|
||||||
else s["Group Members"].Value.ToLower ()
|
else s["Group Members"].Value.ToLower()
|
||||||
let andAdded = match model.AddToRequestList with Some x when x -> "and added it to the request list" | _ -> ""
|
let andAdded = match model.AddToRequestList with Some x when x -> "and added it to the request list" | _ -> ""
|
||||||
addInfo ctx s["Successfully sent announcement to all {0} {1}", toWhom, s[andAdded]]
|
addInfo ctx s["Successfully sent announcement to all {0} {1}", toWhom, s[andAdded]]
|
||||||
return!
|
return!
|
||||||
|
|||||||
@@ -14,20 +14,20 @@ open PrayerTracker.ViewModels
|
|||||||
/// Password hashing implementation extending ASP.NET Core's identity implementation
|
/// Password hashing implementation extending ASP.NET Core's identity implementation
|
||||||
[<AutoOpen>]
|
[<AutoOpen>]
|
||||||
module Hashing =
|
module Hashing =
|
||||||
|
|
||||||
open System.Security.Cryptography
|
open System.Security.Cryptography
|
||||||
open System.Text
|
open System.Text
|
||||||
|
|
||||||
/// Custom password hasher used to verify and upgrade old password hashes
|
/// Custom password hasher used to verify and upgrade old password hashes
|
||||||
type PrayerTrackerPasswordHasher () =
|
type PrayerTrackerPasswordHasher() =
|
||||||
inherit PasswordHasher<User> ()
|
inherit PasswordHasher<User>()
|
||||||
|
|
||||||
override this.VerifyHashedPassword (user, hashedPassword, providedPassword) =
|
override this.VerifyHashedPassword(user, hashedPassword, providedPassword) =
|
||||||
if isNull hashedPassword then nullArg (nameof hashedPassword)
|
if isNull hashedPassword then nullArg (nameof hashedPassword)
|
||||||
if isNull providedPassword then nullArg (nameof providedPassword)
|
if isNull providedPassword then nullArg (nameof providedPassword)
|
||||||
|
|
||||||
let hashBytes = Convert.FromBase64String hashedPassword
|
let hashBytes = Convert.FromBase64String hashedPassword
|
||||||
|
|
||||||
match hashBytes[0] with
|
match hashBytes[0] with
|
||||||
| 255uy ->
|
| 255uy ->
|
||||||
// v2 hashes - PBKDF2 (RFC 2898), 1,024 rounds
|
// v2 hashes - PBKDF2 (RFC 2898), 1,024 rounds
|
||||||
@@ -43,7 +43,7 @@ module Hashing =
|
|||||||
| 254uy ->
|
| 254uy ->
|
||||||
// v1 hashes - SHA-1
|
// v1 hashes - SHA-1
|
||||||
let v1Hash =
|
let v1Hash =
|
||||||
use alg = SHA1.Create ()
|
use alg = SHA1.Create()
|
||||||
alg.ComputeHash (Encoding.ASCII.GetBytes providedPassword)
|
alg.ComputeHash (Encoding.ASCII.GetBytes providedPassword)
|
||||||
|> Seq.map (fun byt -> byt.ToString "x2")
|
|> Seq.map (fun byt -> byt.ToString "x2")
|
||||||
|> String.concat ""
|
|> String.concat ""
|
||||||
@@ -51,18 +51,18 @@ module Hashing =
|
|||||||
PasswordVerificationResult.SuccessRehashNeeded
|
PasswordVerificationResult.SuccessRehashNeeded
|
||||||
else
|
else
|
||||||
PasswordVerificationResult.Failed
|
PasswordVerificationResult.Failed
|
||||||
| _ -> base.VerifyHashedPassword (user, hashedPassword, providedPassword)
|
| _ -> base.VerifyHashedPassword(user, hashedPassword, providedPassword)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// Retrieve a user from the database by password, upgrading password hashes if required
|
/// Retrieve a user from the database by password, upgrading password hashes if required
|
||||||
let private findUserByPassword model = task {
|
let private findUserByPassword model = task {
|
||||||
match! Users.tryByEmailAndGroup model.Email (idFromShort SmallGroupId model.SmallGroupId) with
|
match! Users.tryByEmailAndGroup model.Email (idFromShort SmallGroupId model.SmallGroupId) with
|
||||||
| Some user ->
|
| Some user ->
|
||||||
let hasher = PrayerTrackerPasswordHasher ()
|
let hasher = PrayerTrackerPasswordHasher()
|
||||||
match hasher.VerifyHashedPassword (user, user.PasswordHash, model.Password) with
|
match hasher.VerifyHashedPassword(user, user.PasswordHash, model.Password) with
|
||||||
| PasswordVerificationResult.Success -> return Some user
|
| PasswordVerificationResult.Success -> return Some user
|
||||||
| PasswordVerificationResult.SuccessRehashNeeded ->
|
| PasswordVerificationResult.SuccessRehashNeeded ->
|
||||||
let upgraded = { user with PasswordHash = hasher.HashPassword (user, model.Password) }
|
let upgraded = { user with PasswordHash = hasher.HashPassword(user, model.Password) }
|
||||||
do! Users.updatePassword upgraded
|
do! Users.updatePassword upgraded
|
||||||
return Some upgraded
|
return Some upgraded
|
||||||
| _ -> return None
|
| _ -> return None
|
||||||
@@ -78,14 +78,14 @@ let sanitizeUrl providedUrl defaultUrl =
|
|||||||
|
|
||||||
// POST /user/password/change
|
// POST /user/password/change
|
||||||
let changePassword : HttpHandler = requireAccess [ User ] >=> validateCsrf >=> fun next ctx -> task {
|
let changePassword : HttpHandler = requireAccess [ User ] >=> validateCsrf >=> fun next ctx -> task {
|
||||||
match! ctx.TryBindFormAsync<ChangePassword> () with
|
match! ctx.TryBindFormAsync<ChangePassword>() with
|
||||||
| Ok model ->
|
| Ok model ->
|
||||||
let curUsr = ctx.Session.CurrentUser.Value
|
let curUsr = ctx.Session.CurrentUser.Value
|
||||||
let hasher = PrayerTrackerPasswordHasher ()
|
let hasher = PrayerTrackerPasswordHasher()
|
||||||
let! user = task {
|
let! user = task {
|
||||||
match! Users.tryById curUsr.Id with
|
match! Users.tryById curUsr.Id with
|
||||||
| Some usr ->
|
| Some usr ->
|
||||||
if hasher.VerifyHashedPassword (usr, usr.PasswordHash, model.OldPassword)
|
if hasher.VerifyHashedPassword(usr, usr.PasswordHash, model.OldPassword)
|
||||||
= PasswordVerificationResult.Success then
|
= PasswordVerificationResult.Success then
|
||||||
return Some usr
|
return Some usr
|
||||||
else return None
|
else return None
|
||||||
@@ -93,7 +93,7 @@ let changePassword : HttpHandler = requireAccess [ User ] >=> validateCsrf >=> f
|
|||||||
}
|
}
|
||||||
match user with
|
match user with
|
||||||
| Some usr when model.NewPassword = model.NewPasswordConfirm ->
|
| Some usr when model.NewPassword = model.NewPasswordConfirm ->
|
||||||
do! Users.updatePassword { usr with PasswordHash = hasher.HashPassword (usr, model.NewPassword) }
|
do! Users.updatePassword { usr with PasswordHash = hasher.HashPassword(usr, model.NewPassword) }
|
||||||
addInfo ctx ctx.Strings["Your password was changed successfully"]
|
addInfo ctx ctx.Strings["Your password was changed successfully"]
|
||||||
return! redirectTo false "/" next ctx
|
return! redirectTo false "/" next ctx
|
||||||
| Some _ ->
|
| Some _ ->
|
||||||
@@ -124,23 +124,23 @@ open Microsoft.AspNetCore.Html
|
|||||||
|
|
||||||
// POST /user/log-on
|
// POST /user/log-on
|
||||||
let doLogOn : HttpHandler = requireAccess [ AccessLevel.Public ] >=> validateCsrf >=> fun next ctx -> task {
|
let doLogOn : HttpHandler = requireAccess [ AccessLevel.Public ] >=> validateCsrf >=> fun next ctx -> task {
|
||||||
match! ctx.TryBindFormAsync<UserLogOn> () with
|
match! ctx.TryBindFormAsync<UserLogOn>() with
|
||||||
| Ok model ->
|
| Ok model ->
|
||||||
let s = ctx.Strings
|
let s = ctx.Strings
|
||||||
match! findUserByPassword model with
|
match! findUserByPassword model with
|
||||||
| Some user ->
|
| Some user ->
|
||||||
match! SmallGroups.tryByIdWithPreferences (idFromShort SmallGroupId model.SmallGroupId) with
|
match! SmallGroups.tryById (idFromShort SmallGroupId model.SmallGroupId) with
|
||||||
| Some group ->
|
| Some group ->
|
||||||
ctx.Session.CurrentUser <- Some user
|
ctx.Session.CurrentUser <- Some user
|
||||||
ctx.Session.CurrentGroup <- Some group
|
ctx.Session.CurrentGroup <- Some group
|
||||||
let identity = ClaimsIdentity (
|
let identity = ClaimsIdentity(
|
||||||
seq {
|
seq {
|
||||||
Claim (ClaimTypes.NameIdentifier, shortGuid user.Id.Value)
|
Claim(ClaimTypes.NameIdentifier, shortGuid user.Id.Value)
|
||||||
Claim (ClaimTypes.GroupSid, shortGuid group.Id.Value)
|
Claim(ClaimTypes.GroupSid, shortGuid group.Id.Value)
|
||||||
}, CookieAuthenticationDefaults.AuthenticationScheme)
|
}, CookieAuthenticationDefaults.AuthenticationScheme)
|
||||||
do! ctx.SignInAsync (
|
do! ctx.SignInAsync(
|
||||||
identity.AuthenticationType, ClaimsPrincipal identity,
|
identity.AuthenticationType, ClaimsPrincipal identity,
|
||||||
AuthenticationProperties (
|
AuthenticationProperties(
|
||||||
IssuedUtc = DateTimeOffset.UtcNow,
|
IssuedUtc = DateTimeOffset.UtcNow,
|
||||||
IsPersistent = defaultArg model.RememberMe false))
|
IsPersistent = defaultArg model.RememberMe false))
|
||||||
do! Users.updateLastSeen user.Id ctx.Now
|
do! Users.updateLastSeen user.Id ctx.Now
|
||||||
@@ -152,14 +152,12 @@ let doLogOn : HttpHandler = requireAccess [ AccessLevel.Public ] >=> validateCsr
|
|||||||
Text = htmlLocString s["Invalid credentials - log on unsuccessful"]
|
Text = htmlLocString s["Invalid credentials - log on unsuccessful"]
|
||||||
Description =
|
Description =
|
||||||
let detail =
|
let detail =
|
||||||
[ "This is likely due to one of the following reasons:<ul>"
|
[ "This is likely due to one of the following reasons:<ul>"
|
||||||
"<li>The e-mail address “{0}” is invalid.</li>"
|
"<li>The e-mail address “{0}” is invalid.</li>"
|
||||||
"<li>The password entered does not match the password for the given e-mail address.</li>"
|
"<li>The password entered does not match the password for the given e-mail address.</li>"
|
||||||
"<li>You are not authorized to administer the selected group.</li></ul>"
|
"<li>You are not authorized to administer the selected group.</li></ul>" ]
|
||||||
]
|
|
||||||
|> String.concat ""
|
|> String.concat ""
|
||||||
Some (HtmlString (s[detail, WebUtility.HtmlEncode model.Email].Value))
|
Some (HtmlString(s[detail, WebUtility.HtmlEncode model.Email].Value)) }
|
||||||
}
|
|
||||||
|> addUserMessage ctx
|
|> addUserMessage ctx
|
||||||
return! redirectTo false "/user/log-on" next ctx
|
return! redirectTo false "/user/log-on" next ctx
|
||||||
| Result.Error e -> return! bindError e next ctx
|
| Result.Error e -> return! bindError e next ctx
|
||||||
@@ -217,26 +215,25 @@ open System.Threading.Tasks
|
|||||||
|
|
||||||
// POST /user/save
|
// POST /user/save
|
||||||
let save : HttpHandler = requireAccess [ Admin ] >=> validateCsrf >=> fun next ctx -> task {
|
let save : HttpHandler = requireAccess [ Admin ] >=> validateCsrf >=> fun next ctx -> task {
|
||||||
match! ctx.TryBindFormAsync<EditUser> () with
|
match! ctx.TryBindFormAsync<EditUser>() with
|
||||||
| Ok model ->
|
| Ok model ->
|
||||||
let! user =
|
let! user =
|
||||||
if model.IsNew then Task.FromResult (Some { User.empty with Id = (Guid.NewGuid >> UserId) () })
|
if model.IsNew then Task.FromResult(Some { User.Empty with Id = (Guid.NewGuid >> UserId) () })
|
||||||
else Users.tryById (idFromShort UserId model.UserId)
|
else Users.tryById (idFromShort UserId model.UserId)
|
||||||
match user with
|
match user with
|
||||||
| Some usr ->
|
| Some usr ->
|
||||||
let hasher = PrayerTrackerPasswordHasher ()
|
let hasher = PrayerTrackerPasswordHasher()
|
||||||
let updatedUser = model.PopulateUser usr (fun pw -> hasher.HashPassword (usr, pw))
|
let updatedUser = model.PopulateUser usr (fun pw -> hasher.HashPassword(usr, pw))
|
||||||
do! Users.save updatedUser
|
do! Users.save updatedUser
|
||||||
let s = ctx.Strings
|
let s = ctx.Strings
|
||||||
if model.IsNew then
|
if model.IsNew then
|
||||||
let h = CommonFunctions.htmlString
|
let h = CommonFunctions.htmlString
|
||||||
{ UserMessage.info with
|
{ UserMessage.info with
|
||||||
Text = h s["Successfully {0} user", s["Added"].Value.ToLower ()]
|
Text = h s["Successfully {0} user", s["Added"].Value.ToLower ()]
|
||||||
Description =
|
Description =
|
||||||
h s["Please select at least one group for which this user ({0}) is authorized",
|
h s["Please select at least one group for which this user ({0}) is authorized",
|
||||||
updatedUser.Name]
|
updatedUser.Name]
|
||||||
|> Some
|
|> Some }
|
||||||
}
|
|
||||||
|> addUserMessage ctx
|
|> addUserMessage ctx
|
||||||
return! redirectTo false $"/user/{shortGuid usr.Id.Value}/small-groups" next ctx
|
return! redirectTo false $"/user/{shortGuid usr.Id.Value}/small-groups" next ctx
|
||||||
else
|
else
|
||||||
@@ -248,7 +245,7 @@ let save : HttpHandler = requireAccess [ Admin ] >=> validateCsrf >=> fun next c
|
|||||||
|
|
||||||
// POST /user/small-groups/save
|
// POST /user/small-groups/save
|
||||||
let saveGroups : HttpHandler = requireAccess [ Admin ] >=> validateCsrf >=> fun next ctx -> task {
|
let saveGroups : HttpHandler = requireAccess [ Admin ] >=> validateCsrf >=> fun next ctx -> task {
|
||||||
match! ctx.TryBindFormAsync<AssignGroups> () with
|
match! ctx.TryBindFormAsync<AssignGroups>() with
|
||||||
| Ok model ->
|
| Ok model ->
|
||||||
match Seq.length model.SmallGroups with
|
match Seq.length model.SmallGroups with
|
||||||
| 0 ->
|
| 0 ->
|
||||||
@@ -268,9 +265,9 @@ let smallGroups usrId : HttpHandler = requireAccess [ Admin ] >=> fun next ctx -
|
|||||||
match! Users.tryById userId with
|
match! Users.tryById userId with
|
||||||
| Some user ->
|
| Some user ->
|
||||||
let! groups = SmallGroups.listAll ()
|
let! groups = SmallGroups.listAll ()
|
||||||
let! groupIds = Users.groupIdsByUserId userId
|
let groupIds = user.SmallGroups
|
||||||
let curGroups = groupIds |> List.map (fun g -> shortGuid g.Value)
|
let curGroups = groupIds |> List.map (fun g -> shortGuid g.Value)
|
||||||
return!
|
return!
|
||||||
viewInfo ctx
|
viewInfo ctx
|
||||||
|> Views.User.assignGroups (AssignGroups.fromUser user) groups curGroups ctx
|
|> Views.User.assignGroups (AssignGroups.fromUser user) groups curGroups ctx
|
||||||
|> renderHtml next ctx
|
|> renderHtml next ctx
|
||||||
|
|||||||
0
src/PrayerTracker/data/.gitkeep
Normal file
0
src/PrayerTracker/data/.gitkeep
Normal file
87
src/PrayerTracker/wwwroot/_/fixi-0.5.7.js
Normal file
87
src/PrayerTracker/wwwroot/_/fixi-0.5.7.js
Normal file
@@ -0,0 +1,87 @@
|
|||||||
|
(()=>{
|
||||||
|
let send = (elt, type, detail, bub)=>elt.dispatchEvent(new CustomEvent("fx:" + type, {detail, cancelable:true, bubbles:bub !== false, composed:true}))
|
||||||
|
let attr = (elt, name, defaultVal)=>elt.getAttribute(name) || defaultVal
|
||||||
|
let ignore = (elt)=>elt.matches("[fx-ignore]") || elt.closest("[fx-ignore]") != null
|
||||||
|
let init = (elt)=>{
|
||||||
|
let options = {}
|
||||||
|
if (elt.__fixi || ignore(elt) || !send(elt, "init", {options})) return
|
||||||
|
elt.__fixi = async(evt)=>{
|
||||||
|
let reqs = elt.__fixi.requests ||= new Set()
|
||||||
|
let form = elt.form || elt.closest("form")
|
||||||
|
let body = new FormData(form ?? undefined, evt.submitter)
|
||||||
|
if (!form && elt.name) body.append(elt.name, elt.value)
|
||||||
|
let ac = new AbortController()
|
||||||
|
let cfg = {
|
||||||
|
trigger:evt,
|
||||||
|
action:attr(elt, "fx-action"),
|
||||||
|
method:attr(elt, "fx-method", "GET").toUpperCase(),
|
||||||
|
target: document.querySelector(attr(elt, "fx-target")) ?? elt,
|
||||||
|
swap:attr(elt, "fx-swap", "outerHTML"),
|
||||||
|
body,
|
||||||
|
drop:reqs.size,
|
||||||
|
headers:{"FX-Request":"true"},
|
||||||
|
abort:ac.abort.bind(ac),
|
||||||
|
signal:ac.signal,
|
||||||
|
preventTrigger:true,
|
||||||
|
transition:document.startViewTransition?.bind(document),
|
||||||
|
fetch:fetch.bind(window)
|
||||||
|
}
|
||||||
|
let go = send(elt, "config", {cfg, requests:reqs})
|
||||||
|
if (cfg.preventTrigger) evt.preventDefault()
|
||||||
|
if (!go || cfg.drop) return
|
||||||
|
if (/GET|DELETE/.test(cfg.method)){
|
||||||
|
let params = new URLSearchParams(cfg.body)
|
||||||
|
if (params.size)
|
||||||
|
cfg.action += (/\?/.test(cfg.action) ? "&" : "?") + params
|
||||||
|
cfg.body = null
|
||||||
|
}
|
||||||
|
reqs.add(cfg)
|
||||||
|
try {
|
||||||
|
if (cfg.confirm){
|
||||||
|
let result = await cfg.confirm()
|
||||||
|
if (!result) return
|
||||||
|
}
|
||||||
|
if (!send(elt, "before", {cfg, requests:reqs})) return
|
||||||
|
cfg.response = await cfg.fetch(cfg.action, cfg)
|
||||||
|
cfg.text = await cfg.response.text()
|
||||||
|
if (!send(elt, "after", {cfg})) return
|
||||||
|
} catch(error) {
|
||||||
|
send(elt, "error", {cfg, error})
|
||||||
|
return
|
||||||
|
} finally {
|
||||||
|
reqs.delete(cfg)
|
||||||
|
send(elt, "finally", {cfg})
|
||||||
|
}
|
||||||
|
let doSwap = ()=>{
|
||||||
|
if (cfg.swap instanceof Function)
|
||||||
|
return cfg.swap(cfg)
|
||||||
|
else if (/(before|after)(start|end)/.test(cfg.swap))
|
||||||
|
cfg.target.insertAdjacentHTML(cfg.swap, cfg.text)
|
||||||
|
else if(cfg.swap in cfg.target)
|
||||||
|
cfg.target[cfg.swap] = cfg.text
|
||||||
|
else throw cfg.swap
|
||||||
|
}
|
||||||
|
if (cfg.transition)
|
||||||
|
await cfg.transition(doSwap).finished
|
||||||
|
else
|
||||||
|
await doSwap()
|
||||||
|
send(elt, "swapped", {cfg})
|
||||||
|
}
|
||||||
|
elt.__fixi.evt = attr(elt, "fx-trigger", elt.matches("form") ? "submit" : elt.matches("input:not([type=button]),select,textarea") ? "change" : "click")
|
||||||
|
elt.addEventListener(elt.__fixi.evt, elt.__fixi, options)
|
||||||
|
send(elt, "inited", {}, false)
|
||||||
|
}
|
||||||
|
let process = (elt)=>{
|
||||||
|
if (elt instanceof Element){
|
||||||
|
if (ignore(elt)) return
|
||||||
|
if (elt.matches("[fx-action]")) init(elt)
|
||||||
|
elt.querySelectorAll("[fx-action]").forEach(init)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
document.addEventListener("fx:process", (evt)=>process(evt.target))
|
||||||
|
document.addEventListener("DOMContentLoaded", ()=>{
|
||||||
|
document.__fixi_mo = new MutationObserver((recs)=>recs.forEach((r)=>r.type === "childList" && r.addedNodes.forEach((n)=>process(n))))
|
||||||
|
document.__fixi_mo.observe(document.body, {childList:true, subtree:true})
|
||||||
|
process(document.body)
|
||||||
|
})
|
||||||
|
})()
|
||||||
@@ -1,25 +0,0 @@
|
|||||||
/**
|
|
||||||
* PrayerTracker Help styling
|
|
||||||
*/
|
|
||||||
.pt-content {
|
|
||||||
background-color: white;
|
|
||||||
padding: 0 .25em;
|
|
||||||
}
|
|
||||||
.pt-title-bar-left {
|
|
||||||
color: white;
|
|
||||||
font-size: 1.25rem;
|
|
||||||
font-weight: bold;
|
|
||||||
margin-left: .5rem;
|
|
||||||
}
|
|
||||||
.pt-title-bar-right {
|
|
||||||
color: white;
|
|
||||||
color: rgba(255, 255, 255, .75);
|
|
||||||
font-size: 1.1rem;
|
|
||||||
font-variant: small-caps;
|
|
||||||
margin-right: 1rem;
|
|
||||||
}
|
|
||||||
h2 {
|
|
||||||
margin-top: 0;
|
|
||||||
padding-left: .5rem;
|
|
||||||
border-bottom: solid 1px #444;
|
|
||||||
}
|
|
||||||
368
src/Tests/Data/EntitiesTests.fs
Normal file
368
src/Tests/Data/EntitiesTests.fs
Normal file
@@ -0,0 +1,368 @@
|
|||||||
|
module PrayerTracker.Entities.EntitiesTests
|
||||||
|
|
||||||
|
open Expecto
|
||||||
|
open NodaTime.Testing
|
||||||
|
open NodaTime
|
||||||
|
open System
|
||||||
|
|
||||||
|
[<Tests>]
|
||||||
|
let asOfDateDisplayTests =
|
||||||
|
testList "AsOfDateDisplay" [
|
||||||
|
testList "ToString" [
|
||||||
|
test "NoDisplay code is correct" {
|
||||||
|
Expect.equal (string NoDisplay) "N" "The code for NoDisplay should have been \"N\""
|
||||||
|
}
|
||||||
|
test "ShortDate code is correct" {
|
||||||
|
Expect.equal (string ShortDate) "S" "The code for ShortDate should have been \"S\""
|
||||||
|
}
|
||||||
|
test "LongDate code is correct" {
|
||||||
|
Expect.equal (string LongDate) "L" "The code for LongDate should have been \"N\""
|
||||||
|
}
|
||||||
|
]
|
||||||
|
testList "Parse" [
|
||||||
|
test "N should return NoDisplay" {
|
||||||
|
Expect.equal (AsOfDateDisplay.Parse "N") NoDisplay "\"N\" should have been parsed to NoDisplay"
|
||||||
|
}
|
||||||
|
test "S should return ShortDate" {
|
||||||
|
Expect.equal (AsOfDateDisplay.Parse "S") ShortDate "\"S\" should have been parsed to ShortDate"
|
||||||
|
}
|
||||||
|
test "L should return LongDate" {
|
||||||
|
Expect.equal (AsOfDateDisplay.Parse "L") LongDate "\"L\" should have been parsed to LongDate"
|
||||||
|
}
|
||||||
|
test "X should raise" {
|
||||||
|
Expect.throws (fun () -> AsOfDateDisplay.Parse "X" |> ignore)
|
||||||
|
"An unknown code should have raised an exception"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
]
|
||||||
|
|
||||||
|
[<Tests>]
|
||||||
|
let churchTests =
|
||||||
|
testList "Church" [
|
||||||
|
test "Empty is as expected" {
|
||||||
|
let mt = Church.Empty
|
||||||
|
Expect.equal mt.Id.Value Guid.Empty "The church ID should have been an empty GUID"
|
||||||
|
Expect.equal mt.Name "" "The name should have been blank"
|
||||||
|
Expect.equal mt.City "" "The city should have been blank"
|
||||||
|
Expect.equal mt.State "" "The state should have been blank"
|
||||||
|
Expect.isFalse mt.HasVpsInterface "The church should not show that it has an interface"
|
||||||
|
Expect.isNone mt.InterfaceAddress "The interface address should not exist"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
[<Tests>]
|
||||||
|
let emailFormatTests =
|
||||||
|
testList "EmailFormat" [
|
||||||
|
testList "ToString" [
|
||||||
|
test "HtmlFormat code is correct" {
|
||||||
|
Expect.equal (string HtmlFormat) "H" "The code for HtmlFormat should have been \"H\""
|
||||||
|
}
|
||||||
|
test "PlainTextFormat code is correct" {
|
||||||
|
Expect.equal (string PlainTextFormat) "P" "The code for PlainTextFormat should have been \"P\""
|
||||||
|
}
|
||||||
|
]
|
||||||
|
testList "Parse" [
|
||||||
|
test "H should return HtmlFormat" {
|
||||||
|
Expect.equal (EmailFormat.Parse "H") HtmlFormat "\"H\" should have been converted to HtmlFormat"
|
||||||
|
}
|
||||||
|
test "P should return ShortDate" {
|
||||||
|
Expect.equal (EmailFormat.Parse "P") PlainTextFormat
|
||||||
|
"\"P\" should have been converted to PlainTextFormat"
|
||||||
|
}
|
||||||
|
test "Z should raise" {
|
||||||
|
Expect.throws (fun () -> EmailFormat.Parse "Z" |> ignore)
|
||||||
|
"An unknown code should have raised an exception"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
]
|
||||||
|
|
||||||
|
[<Tests>]
|
||||||
|
let expirationTests =
|
||||||
|
testList "Expiration" [
|
||||||
|
testList "ToString" [
|
||||||
|
test "Automatic code is correct" {
|
||||||
|
Expect.equal (string Automatic) "A" "The code for Automatic should have been \"A\""
|
||||||
|
}
|
||||||
|
test "Manual code is correct" {
|
||||||
|
Expect.equal (string Manual) "M" "The code for Manual should have been \"M\""
|
||||||
|
}
|
||||||
|
test "Forced code is correct" {
|
||||||
|
Expect.equal (string Forced) "F" "The code for Forced should have been \"F\""
|
||||||
|
}
|
||||||
|
]
|
||||||
|
testList "Parse" [
|
||||||
|
test "A should return Automatic" {
|
||||||
|
Expect.equal (Expiration.Parse "A") Automatic "\"A\" should have been converted to Automatic"
|
||||||
|
}
|
||||||
|
test "M should return Manual" {
|
||||||
|
Expect.equal (Expiration.Parse "M") Manual "\"M\" should have been converted to Manual"
|
||||||
|
}
|
||||||
|
test "F should return Forced" {
|
||||||
|
Expect.equal (Expiration.Parse "F") Forced "\"F\" should have been converted to Forced"
|
||||||
|
}
|
||||||
|
test "fromCode V should raise" {
|
||||||
|
Expect.throws (fun () -> Expiration.Parse "V" |> ignore)
|
||||||
|
"An unknown code should have raised an exception"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
]
|
||||||
|
|
||||||
|
[<Tests>]
|
||||||
|
let listPreferencesTests =
|
||||||
|
testList "ListPreferences" [
|
||||||
|
test "FontStack is correct for native fonts" {
|
||||||
|
Expect.equal ListPreferences.Empty.FontStack
|
||||||
|
"""system-ui,-apple-system,"Segoe UI",Roboto,Ubuntu,"Liberation Sans",Cantarell,"Helvetica Neue",sans-serif"""
|
||||||
|
"The expected native font stack was incorrect"
|
||||||
|
}
|
||||||
|
test "FontStack is correct for specific fonts" {
|
||||||
|
Expect.equal { ListPreferences.Empty with Fonts = "Arial,sans-serif" }.FontStack "Arial,sans-serif"
|
||||||
|
"The specified fonts were not returned correctly"
|
||||||
|
}
|
||||||
|
test "Empty is as expected" {
|
||||||
|
let mt = ListPreferences.Empty
|
||||||
|
Expect.equal mt.DaysToExpire 14 "The default days to expire should have been 14"
|
||||||
|
Expect.equal mt.DaysToKeepNew 7 "The default days to keep new should have been 7"
|
||||||
|
Expect.equal mt.LongTermUpdateWeeks 4 "The default long term update weeks should have been 4"
|
||||||
|
Expect.equal mt.EmailFromName "PrayerTracker" "The default e-mail from name should have been PrayerTracker"
|
||||||
|
Expect.equal mt.EmailFromAddress "prayer@bitbadger.solutions"
|
||||||
|
"The default e-mail from address should have been prayer@bitbadger.solutions"
|
||||||
|
Expect.equal mt.Fonts "native" "The default list fonts were incorrect"
|
||||||
|
Expect.equal mt.HeadingColor "maroon" "The default heading text color should have been maroon"
|
||||||
|
Expect.equal mt.LineColor "navy" "The default heading line color should have been navy"
|
||||||
|
Expect.equal mt.HeadingFontSize 16 "The default heading font size should have been 16"
|
||||||
|
Expect.equal mt.TextFontSize 12 "The default text font size should have been 12"
|
||||||
|
Expect.equal mt.RequestSort SortByDate "The default request sort should have been by date"
|
||||||
|
Expect.equal mt.GroupPassword "" "The default group password should have been blank"
|
||||||
|
Expect.equal mt.DefaultEmailType HtmlFormat "The default e-mail type should have been HTML"
|
||||||
|
Expect.isFalse mt.IsPublic "The isPublic flag should not have been set"
|
||||||
|
Expect.equal (string mt.TimeZoneId) "America/Denver" "The default time zone should have been America/Denver"
|
||||||
|
Expect.equal mt.PageSize 100 "The default page size should have been 100"
|
||||||
|
Expect.equal mt.AsOfDateDisplay NoDisplay "The as-of date display should have been No Display"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
[<Tests>]
|
||||||
|
let memberTests =
|
||||||
|
testList "Member" [
|
||||||
|
test "Empty is as expected" {
|
||||||
|
let mt = Member.Empty
|
||||||
|
Expect.equal mt.Id.Value Guid.Empty "The member ID should have been an empty GUID"
|
||||||
|
Expect.equal mt.SmallGroupId.Value Guid.Empty "The small group ID should have been an empty GUID"
|
||||||
|
Expect.equal mt.Name "" "The member name should have been blank"
|
||||||
|
Expect.equal mt.Email "" "The member e-mail address should have been blank"
|
||||||
|
Expect.isNone mt.Format "The preferred e-mail format should not exist"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
[<Tests>]
|
||||||
|
let prayerRequestTests =
|
||||||
|
let instantNow = SystemClock.Instance.GetCurrentInstant
|
||||||
|
let localDateNow () = (instantNow ()).InUtc().Date
|
||||||
|
testList "PrayerRequest" [
|
||||||
|
test "Empty is as expected" {
|
||||||
|
let mt = PrayerRequest.Empty
|
||||||
|
Expect.equal mt.Id.Value Guid.Empty "The request ID should have been an empty GUID"
|
||||||
|
Expect.equal mt.RequestType CurrentRequest "The request type should have been Current"
|
||||||
|
Expect.equal mt.UserId.Value Guid.Empty "The user ID should have been an empty GUID"
|
||||||
|
Expect.equal mt.SmallGroupId.Value Guid.Empty "The small group ID should have been an empty GUID"
|
||||||
|
Expect.equal mt.EnteredDate Instant.MinValue "The entered date should have been the minimum"
|
||||||
|
Expect.equal mt.UpdatedDate Instant.MinValue "The updated date should have been the minimum"
|
||||||
|
Expect.isNone mt.Requestor "The requestor should not exist"
|
||||||
|
Expect.equal mt.Text "" "The request text should have been blank"
|
||||||
|
Expect.isFalse mt.NotifyChaplain "The notify chaplain flag should not have been set"
|
||||||
|
Expect.equal mt.Expiration Automatic "The expiration should have been Automatic"
|
||||||
|
}
|
||||||
|
test "IsExpired always returns false for expecting requests" {
|
||||||
|
{ PrayerRequest.Empty with RequestType = Expecting }.IsExpired (localDateNow ()) SmallGroup.Empty
|
||||||
|
|> Flip.Expect.isFalse "An expecting request should never be considered expired"
|
||||||
|
}
|
||||||
|
test "IsExpired always returns false for manually-expired requests" {
|
||||||
|
{ PrayerRequest.Empty with
|
||||||
|
UpdatedDate = (instantNow ()) - Duration.FromDays 1
|
||||||
|
Expiration = Manual }.IsExpired (localDateNow ()) SmallGroup.Empty
|
||||||
|
|> Flip.Expect.isFalse "A never-expired request should never be considered expired"
|
||||||
|
}
|
||||||
|
test "IsExpired always returns false for long term/recurring requests" {
|
||||||
|
{ PrayerRequest.Empty with RequestType = LongTermRequest }.IsExpired (localDateNow ()) SmallGroup.Empty
|
||||||
|
|> Flip.Expect.isFalse "A recurring/long-term request should never be considered expired"
|
||||||
|
}
|
||||||
|
test "IsExpired always returns true for force-expired requests" {
|
||||||
|
{ PrayerRequest.Empty with UpdatedDate = (instantNow ()); Expiration = Forced }.IsExpired
|
||||||
|
(localDateNow ()) SmallGroup.Empty
|
||||||
|
|> Flip.Expect.isTrue "A force-expired request should always be considered expired"
|
||||||
|
}
|
||||||
|
test "IsExpired returns false for non-expired requests" {
|
||||||
|
let now = instantNow ()
|
||||||
|
{ PrayerRequest.Empty with UpdatedDate = now - Duration.FromDays 5 }.IsExpired
|
||||||
|
(now.InUtc().Date) SmallGroup.Empty
|
||||||
|
|> Flip.Expect.isFalse "A request updated 5 days ago should not be considered expired"
|
||||||
|
}
|
||||||
|
test "IsExpired returns true for expired requests" {
|
||||||
|
let now = instantNow ()
|
||||||
|
{ PrayerRequest.Empty with UpdatedDate = now - Duration.FromDays 15 }.IsExpired
|
||||||
|
(now.InUtc().Date) SmallGroup.Empty
|
||||||
|
|> Flip.Expect.isTrue "A request updated 15 days ago should be considered expired"
|
||||||
|
}
|
||||||
|
test "IsExpired returns true for same-day expired requests" {
|
||||||
|
let now = instantNow ()
|
||||||
|
{ PrayerRequest.Empty with
|
||||||
|
UpdatedDate = now - (Duration.FromDays 14) - (Duration.FromSeconds 1L) }.IsExpired
|
||||||
|
(now.InUtc().Date) SmallGroup.Empty
|
||||||
|
|> Flip.Expect.isTrue "A request entered a second before midnight should be considered expired"
|
||||||
|
}
|
||||||
|
test "UpdateRequired returns false for expired requests" {
|
||||||
|
{ PrayerRequest.Empty with Expiration = Forced }.UpdateRequired (localDateNow ()) SmallGroup.Empty
|
||||||
|
|> Flip.Expect.isFalse "An expired request should not require an update"
|
||||||
|
}
|
||||||
|
test "UpdateRequired returns false when an update is not required for an active request" {
|
||||||
|
let now = instantNow ()
|
||||||
|
{ PrayerRequest.Empty with
|
||||||
|
RequestType = LongTermRequest
|
||||||
|
UpdatedDate = now - Duration.FromDays 14 }.UpdateRequired (localDateNow ()) SmallGroup.Empty
|
||||||
|
|> Flip.Expect.isFalse "An active request updated 14 days ago should not require an update until 28 days"
|
||||||
|
}
|
||||||
|
test "UpdateRequired returns true when an update is required for an active request" {
|
||||||
|
let now = instantNow ()
|
||||||
|
{ PrayerRequest.Empty with
|
||||||
|
RequestType = LongTermRequest
|
||||||
|
UpdatedDate = now - Duration.FromDays 34 }.UpdateRequired (localDateNow ()) SmallGroup.Empty
|
||||||
|
|> Flip.Expect.isTrue "An active request updated 34 days ago should require an update (past 28 days)"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
[<Tests>]
|
||||||
|
let prayerRequestTypeTests =
|
||||||
|
testList "PrayerRequestType" [
|
||||||
|
testList "ToString" [
|
||||||
|
test "CurrentRequest code is correct" {
|
||||||
|
Expect.equal (string CurrentRequest) "C" "The code for CurrentRequest should have been \"C\""
|
||||||
|
}
|
||||||
|
test "LongTermRequest code is correct" {
|
||||||
|
Expect.equal (string LongTermRequest) "L" "The code for LongTermRequest should have been \"L\""
|
||||||
|
}
|
||||||
|
test "PraiseReport code is correct" {
|
||||||
|
Expect.equal (string PraiseReport) "P" "The code for PraiseReport should have been \"P\""
|
||||||
|
}
|
||||||
|
test "Expecting code is correct" {
|
||||||
|
Expect.equal (string Expecting) "E" "The code for Expecting should have been \"E\""
|
||||||
|
}
|
||||||
|
test "Announcement code is correct" {
|
||||||
|
Expect.equal (string Announcement) "A" "The code for Announcement should have been \"A\""
|
||||||
|
}
|
||||||
|
]
|
||||||
|
testList "Parse" [
|
||||||
|
test "C should return CurrentRequest" {
|
||||||
|
Expect.equal (PrayerRequestType.Parse "C") CurrentRequest
|
||||||
|
"\"C\" should have been converted to CurrentRequest"
|
||||||
|
}
|
||||||
|
test "L should return LongTermRequest" {
|
||||||
|
Expect.equal (PrayerRequestType.Parse "L") LongTermRequest
|
||||||
|
"\"L\" should have been converted to LongTermRequest"
|
||||||
|
}
|
||||||
|
test "P should return PraiseReport" {
|
||||||
|
Expect.equal (PrayerRequestType.Parse "P") PraiseReport
|
||||||
|
"\"P\" should have been converted to PraiseReport"
|
||||||
|
}
|
||||||
|
test "E should return Expecting" {
|
||||||
|
Expect.equal (PrayerRequestType.Parse "E") Expecting "\"E\" should have been converted to Expecting"
|
||||||
|
}
|
||||||
|
test "A should return Announcement" {
|
||||||
|
Expect.equal (PrayerRequestType.Parse "A") Announcement
|
||||||
|
"\"A\" should have been converted to Announcement"
|
||||||
|
}
|
||||||
|
test "R should raise" {
|
||||||
|
Expect.throws (fun () -> PrayerRequestType.Parse "R" |> ignore)
|
||||||
|
"An unknown code should have raised an exception"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
]
|
||||||
|
|
||||||
|
[<Tests>]
|
||||||
|
let requestSortTests =
|
||||||
|
testList "RequestSort" [
|
||||||
|
testList "ToString" [
|
||||||
|
test "SortByDate code is correct" {
|
||||||
|
Expect.equal (string SortByDate) "D" "The code for SortByDate should have been \"D\""
|
||||||
|
}
|
||||||
|
test "SortByRequestor code is correct" {
|
||||||
|
Expect.equal (string SortByRequestor) "R" "The code for SortByRequestor should have been \"R\""
|
||||||
|
}
|
||||||
|
]
|
||||||
|
testList "Parse" [
|
||||||
|
test "D should return SortByDate" {
|
||||||
|
Expect.equal (RequestSort.Parse "D") SortByDate "\"D\" should have been converted to SortByDate"
|
||||||
|
}
|
||||||
|
test "R should return SortByRequestor" {
|
||||||
|
Expect.equal (RequestSort.Parse "R") SortByRequestor
|
||||||
|
"\"R\" should have been converted to SortByRequestor"
|
||||||
|
}
|
||||||
|
test "Q should raise" {
|
||||||
|
Expect.throws (fun () -> RequestSort.Parse "Q" |> ignore)
|
||||||
|
"An unknown code should have raised an exception"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
]
|
||||||
|
|
||||||
|
[<Tests>]
|
||||||
|
let smallGroupTests =
|
||||||
|
testList "SmallGroup" [
|
||||||
|
let now = Instant.FromDateTimeUtc (DateTime (2017, 5, 12, 12, 15, 0, DateTimeKind.Utc))
|
||||||
|
let withFakeClock f () =
|
||||||
|
FakeClock now |> f
|
||||||
|
yield test "Empty is as expected" {
|
||||||
|
let mt = SmallGroup.Empty
|
||||||
|
Expect.equal mt.Id.Value Guid.Empty "The small group ID should have been an empty GUID"
|
||||||
|
Expect.equal mt.ChurchId.Value Guid.Empty "The church ID should have been an empty GUID"
|
||||||
|
Expect.equal mt.Name "" "The name should have been blank"
|
||||||
|
}
|
||||||
|
yield! testFixture withFakeClock [
|
||||||
|
"LocalTimeNow adjusts the time ahead of UTC",
|
||||||
|
fun clock ->
|
||||||
|
let grp =
|
||||||
|
{ SmallGroup.Empty with
|
||||||
|
Preferences = { ListPreferences.Empty with TimeZoneId = TimeZoneId "Europe/Berlin" }
|
||||||
|
}
|
||||||
|
Expect.isGreaterThan (grp.LocalTimeNow clock) (now.InUtc().LocalDateTime)
|
||||||
|
"UTC to Europe/Berlin should have added hours"
|
||||||
|
"LocalTimeNow adjusts the time behind UTC",
|
||||||
|
fun clock ->
|
||||||
|
Expect.isLessThan (SmallGroup.Empty.LocalTimeNow clock) (now.InUtc().LocalDateTime)
|
||||||
|
"UTC to America/Denver should have subtracted hours"
|
||||||
|
"LocalTimeNow returns UTC when the time zone is invalid",
|
||||||
|
fun clock ->
|
||||||
|
let grp =
|
||||||
|
{ SmallGroup.Empty with
|
||||||
|
Preferences = { ListPreferences.Empty with TimeZoneId = TimeZoneId "garbage" }
|
||||||
|
}
|
||||||
|
Expect.equal (grp.LocalTimeNow clock) (now.InUtc().LocalDateTime)
|
||||||
|
"UTC should have been returned for an invalid time zone"
|
||||||
|
]
|
||||||
|
yield test "localTimeNow fails when clock is not passed" {
|
||||||
|
Expect.throws (fun () -> SmallGroup.Empty.LocalTimeNow null |> ignore)
|
||||||
|
"Should have raised an exception for null clock"
|
||||||
|
}
|
||||||
|
yield test "LocalDateNow returns the date portion" {
|
||||||
|
let clock = FakeClock (Instant.FromDateTimeUtc (DateTime (2017, 5, 12, 1, 15, 0, DateTimeKind.Utc)))
|
||||||
|
Expect.isLessThan (SmallGroup.Empty.LocalDateNow clock) (now.InUtc().Date)
|
||||||
|
"The date should have been a day earlier"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
[<Tests>]
|
||||||
|
let userTests =
|
||||||
|
testList "User" [
|
||||||
|
test "Empty is as expected" {
|
||||||
|
let mt = User.Empty
|
||||||
|
Expect.equal mt.Id.Value Guid.Empty "The user ID should have been an empty GUID"
|
||||||
|
Expect.equal mt.FirstName "" "The first name should have been blank"
|
||||||
|
Expect.equal mt.LastName "" "The last name should have been blank"
|
||||||
|
Expect.equal mt.Email "" "The e-mail address should have been blank"
|
||||||
|
Expect.isFalse mt.IsAdmin "The is admin flag should not have been set"
|
||||||
|
Expect.equal mt.PasswordHash "" "The password hash should have been blank"
|
||||||
|
}
|
||||||
|
test "Name concatenates first and last names" {
|
||||||
|
let user = { User.Empty with FirstName = "Unit"; LastName = "Test" }
|
||||||
|
Expect.equal user.Name "Unit Test" "The full name should be the first and last, separated by a space"
|
||||||
|
}
|
||||||
|
]
|
||||||
@@ -14,14 +14,12 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Expecto" Version="9.0.4" />
|
<PackageReference Include="Expecto" Version="10.2.1" />
|
||||||
<PackageReference Include="NodaTime.Testing" Version="3.1.9" />
|
<PackageReference Include="NodaTime.Testing" Version="3.2.1" />
|
||||||
<PackageReference Update="FSharp.Core" Version="7.0.300" />
|
<PackageReference Update="FSharp.Core" Version="9.0.101" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\PrayerTracker.Data\PrayerTracker.Data.fsproj" />
|
|
||||||
<ProjectReference Include="..\PrayerTracker.UI\PrayerTracker.UI.fsproj" />
|
|
||||||
<ProjectReference Include="..\PrayerTracker\PrayerTracker.fsproj" />
|
<ProjectReference Include="..\PrayerTracker\PrayerTracker.fsproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
@@ -2,4 +2,4 @@
|
|||||||
|
|
||||||
[<EntryPoint>]
|
[<EntryPoint>]
|
||||||
let main argv =
|
let main argv =
|
||||||
runTestsInAssembly defaultConfig argv
|
runTestsInAssemblyWithCLIArgs [] argv
|
||||||
@@ -15,19 +15,16 @@ let countAll _ = true
|
|||||||
|
|
||||||
|
|
||||||
module ReferenceListTests =
|
module ReferenceListTests =
|
||||||
|
|
||||||
[<Tests>]
|
[<Tests>]
|
||||||
let asOfDateListTests =
|
let asOfDateListTests =
|
||||||
testList "ReferenceList.asOfDateList" [
|
testList "ReferenceList.asOfDateList" [
|
||||||
test "has all three options listed" {
|
test "has all three options listed" {
|
||||||
let asOf = ReferenceList.asOfDateList _s
|
let asOf = ReferenceList.asOfDateList _s
|
||||||
Expect.hasCountOf asOf 3u countAll "There should have been 3 as-of choices returned"
|
Expect.hasCountOf asOf 3u countAll "There should have been 3 as-of choices returned"
|
||||||
Expect.exists asOf (fun (x, _) -> x = AsOfDateDisplay.toCode NoDisplay)
|
Expect.exists asOf (fun (x, _) -> x = string NoDisplay) "The option for no display was not found"
|
||||||
"The option for no display was not found"
|
Expect.exists asOf (fun (x, _) -> x = string ShortDate) "The option for a short date was not found"
|
||||||
Expect.exists asOf (fun (x, _) -> x = AsOfDateDisplay.toCode ShortDate)
|
Expect.exists asOf (fun (x, _) -> x = string LongDate) "The option for a full date was not found"
|
||||||
"The option for a short date was not found"
|
|
||||||
Expect.exists asOf (fun (x, _) -> x = AsOfDateDisplay.toCode LongDate)
|
|
||||||
"The option for a full date was not found"
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -41,35 +38,35 @@ module ReferenceListTests =
|
|||||||
Expect.equal (fst top) "" "The default option should have been blank"
|
Expect.equal (fst top) "" "The default option should have been blank"
|
||||||
Expect.equal (snd top).Value "Group Default (HTML Format)" "The default option label was incorrect"
|
Expect.equal (snd top).Value "Group Default (HTML Format)" "The default option label was incorrect"
|
||||||
let nxt = typs |> Seq.skip 1 |> Seq.head
|
let nxt = typs |> Seq.skip 1 |> Seq.head
|
||||||
Expect.equal (fst nxt) (EmailFormat.toCode HtmlFormat) "The 2nd option should have been HTML"
|
Expect.equal (fst nxt) (string HtmlFormat) "The 2nd option should have been HTML"
|
||||||
let lst = typs |> Seq.last
|
let lst = typs |> Seq.last
|
||||||
Expect.equal (fst lst) (EmailFormat.toCode PlainTextFormat) "The 3rd option should have been plain text"
|
Expect.equal (fst lst) (string PlainTextFormat) "The 3rd option should have been plain text"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
[<Tests>]
|
[<Tests>]
|
||||||
let expirationListTests =
|
let expirationListTests =
|
||||||
testList "ReferenceList.expirationList" [
|
testList "ReferenceList.expirationList" [
|
||||||
test "excludes immediate expiration if not required" {
|
test "excludes immediate expiration if not required" {
|
||||||
let exps = ReferenceList.expirationList _s false
|
let exps = ReferenceList.expirationList _s false
|
||||||
Expect.hasCountOf exps 2u countAll "There should have been 2 expiration types returned"
|
Expect.hasCountOf exps 2u countAll "There should have been 2 expiration types returned"
|
||||||
Expect.exists exps (fun (exp, _) -> exp = Expiration.toCode Automatic)
|
Expect.exists exps (fun (exp, _) -> exp = string Automatic)
|
||||||
"The option for automatic expiration was not found"
|
"The option for automatic expiration was not found"
|
||||||
Expect.exists exps (fun (exp, _) -> exp = Expiration.toCode Manual)
|
Expect.exists exps (fun (exp, _) -> exp = string Manual)
|
||||||
"The option for manual expiration was not found"
|
"The option for manual expiration was not found"
|
||||||
}
|
}
|
||||||
test "includes immediate expiration if required" {
|
test "includes immediate expiration if required" {
|
||||||
let exps = ReferenceList.expirationList _s true
|
let exps = ReferenceList.expirationList _s true
|
||||||
Expect.hasCountOf exps 3u countAll "There should have been 3 expiration types returned"
|
Expect.hasCountOf exps 3u countAll "There should have been 3 expiration types returned"
|
||||||
Expect.exists exps (fun (exp, _) -> exp = Expiration.toCode Automatic)
|
Expect.exists exps (fun (exp, _) -> exp = string Automatic)
|
||||||
"The option for automatic expiration was not found"
|
"The option for automatic expiration was not found"
|
||||||
Expect.exists exps (fun (exp, _) -> exp = Expiration.toCode Manual)
|
Expect.exists exps (fun (exp, _) -> exp = string Manual)
|
||||||
"The option for manual expiration was not found"
|
"The option for manual expiration was not found"
|
||||||
Expect.exists exps (fun (exp, _) -> exp = Expiration.toCode Forced)
|
Expect.exists exps (fun (exp, _) -> exp = string Forced)
|
||||||
"The option for immediate expiration was not found"
|
"The option for immediate expiration was not found"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
[<Tests>]
|
[<Tests>]
|
||||||
let requestTypeListTests =
|
let requestTypeListTests =
|
||||||
testList "ReferenceList.requestTypeList" [
|
testList "ReferenceList.requestTypeList" [
|
||||||
@@ -132,7 +129,7 @@ let appViewInfoTests =
|
|||||||
let assignGroupsTests =
|
let assignGroupsTests =
|
||||||
testList "AssignGroups" [
|
testList "AssignGroups" [
|
||||||
test "fromUser populates correctly" {
|
test "fromUser populates correctly" {
|
||||||
let usr = { User.empty with Id = (Guid.NewGuid >> UserId) (); FirstName = "Alice"; LastName = "Bob" }
|
let usr = { User.Empty with Id = (Guid.NewGuid >> UserId) (); FirstName = "Alice"; LastName = "Bob" }
|
||||||
let asg = AssignGroups.fromUser usr
|
let asg = AssignGroups.fromUser usr
|
||||||
Expect.equal asg.UserId (shortGuid usr.Id.Value) "The user ID was not filled correctly"
|
Expect.equal asg.UserId (shortGuid usr.Id.Value) "The user ID was not filled correctly"
|
||||||
Expect.equal asg.UserName usr.Name "The user's name was not filled correctly"
|
Expect.equal asg.UserName usr.Name "The user's name was not filled correctly"
|
||||||
@@ -145,7 +142,7 @@ let editChurchTests =
|
|||||||
testList "EditChurch" [
|
testList "EditChurch" [
|
||||||
test "fromChurch populates correctly when interface exists" {
|
test "fromChurch populates correctly when interface exists" {
|
||||||
let church =
|
let church =
|
||||||
{ Church.empty with
|
{ Church.Empty with
|
||||||
Id = (Guid.NewGuid >> ChurchId) ()
|
Id = (Guid.NewGuid >> ChurchId) ()
|
||||||
Name = "Unit Test"
|
Name = "Unit Test"
|
||||||
City = "Testlandia"
|
City = "Testlandia"
|
||||||
@@ -166,7 +163,7 @@ let editChurchTests =
|
|||||||
test "fromChurch populates correctly when interface does not exist" {
|
test "fromChurch populates correctly when interface does not exist" {
|
||||||
let edit =
|
let edit =
|
||||||
EditChurch.fromChurch
|
EditChurch.fromChurch
|
||||||
{ Church.empty with
|
{ Church.Empty with
|
||||||
Id = (Guid.NewGuid >> ChurchId) ()
|
Id = (Guid.NewGuid >> ChurchId) ()
|
||||||
Name = "Unit Test"
|
Name = "Unit Test"
|
||||||
City = "Testlandia"
|
City = "Testlandia"
|
||||||
@@ -201,7 +198,7 @@ let editChurchTests =
|
|||||||
HasInterface = Some true
|
HasInterface = Some true
|
||||||
InterfaceAddress = Some "https://test.units"
|
InterfaceAddress = Some "https://test.units"
|
||||||
}
|
}
|
||||||
let church = edit.PopulateChurch Church.empty
|
let church = edit.PopulateChurch Church.Empty
|
||||||
Expect.notEqual (shortGuid church.Id.Value) edit.ChurchId "The church ID should not have been modified"
|
Expect.notEqual (shortGuid church.Id.Value) edit.ChurchId "The church ID should not have been modified"
|
||||||
Expect.equal church.Name edit.Name "The church name was not updated correctly"
|
Expect.equal church.Name edit.Name "The church name was not updated correctly"
|
||||||
Expect.equal church.City edit.City "The church's city was not updated correctly"
|
Expect.equal church.City edit.City "The church's city was not updated correctly"
|
||||||
@@ -216,7 +213,7 @@ let editChurchTests =
|
|||||||
Name = "Test Baptist Church"
|
Name = "Test Baptist Church"
|
||||||
City = "Testerville"
|
City = "Testerville"
|
||||||
State = "TE"
|
State = "TE"
|
||||||
}.PopulateChurch Church.empty
|
}.PopulateChurch Church.Empty
|
||||||
Expect.isFalse church.HasVpsInterface "The church should show that it has an interface"
|
Expect.isFalse church.HasVpsInterface "The church should show that it has an interface"
|
||||||
Expect.isNone church.InterfaceAddress "The interface address should exist"
|
Expect.isNone church.InterfaceAddress "The interface address should exist"
|
||||||
}
|
}
|
||||||
@@ -227,7 +224,7 @@ let editMemberTests =
|
|||||||
testList "EditMember" [
|
testList "EditMember" [
|
||||||
test "fromMember populates with group default format" {
|
test "fromMember populates with group default format" {
|
||||||
let mbr =
|
let mbr =
|
||||||
{ Member.empty with
|
{ Member.Empty with
|
||||||
Id = (Guid.NewGuid >> MemberId) ()
|
Id = (Guid.NewGuid >> MemberId) ()
|
||||||
Name = "Test Name"
|
Name = "Test Name"
|
||||||
Email = "test_units@example.com"
|
Email = "test_units@example.com"
|
||||||
@@ -239,8 +236,8 @@ let editMemberTests =
|
|||||||
Expect.equal edit.Format "" "The e-mail format should have been blank for group default"
|
Expect.equal edit.Format "" "The e-mail format should have been blank for group default"
|
||||||
}
|
}
|
||||||
test "fromMember populates with specific format" {
|
test "fromMember populates with specific format" {
|
||||||
let edit = EditMember.fromMember { Member.empty with Format = Some HtmlFormat }
|
let edit = EditMember.fromMember { Member.Empty with Format = Some HtmlFormat }
|
||||||
Expect.equal edit.Format (EmailFormat.toCode HtmlFormat) "The e-mail format was not filled correctly"
|
Expect.equal edit.Format (string HtmlFormat) "The e-mail format was not filled correctly"
|
||||||
}
|
}
|
||||||
test "empty is as expected" {
|
test "empty is as expected" {
|
||||||
let edit = EditMember.empty
|
let edit = EditMember.empty
|
||||||
@@ -262,17 +259,16 @@ let editMemberTests =
|
|||||||
let editPreferencesTests =
|
let editPreferencesTests =
|
||||||
testList "EditPreferences" [
|
testList "EditPreferences" [
|
||||||
test "fromPreferences succeeds for native fonts, named colors, and private list" {
|
test "fromPreferences succeeds for native fonts, named colors, and private list" {
|
||||||
let prefs = ListPreferences.empty
|
let prefs = ListPreferences.Empty
|
||||||
let edit = EditPreferences.fromPreferences prefs
|
let edit = EditPreferences.fromPreferences prefs
|
||||||
Expect.equal edit.ExpireDays prefs.DaysToExpire "The expiration days were not filled correctly"
|
Expect.equal edit.ExpireDays prefs.DaysToExpire "The expiration days were not filled correctly"
|
||||||
Expect.equal edit.DaysToKeepNew prefs.DaysToKeepNew "The days to keep new were not filled correctly"
|
Expect.equal edit.DaysToKeepNew prefs.DaysToKeepNew "The days to keep new were not filled correctly"
|
||||||
Expect.equal edit.LongTermUpdateWeeks prefs.LongTermUpdateWeeks
|
Expect.equal edit.LongTermUpdateWeeks prefs.LongTermUpdateWeeks
|
||||||
"The weeks for update were not filled correctly"
|
"The weeks for update were not filled correctly"
|
||||||
Expect.equal edit.RequestSort (RequestSort.toCode prefs.RequestSort)
|
Expect.equal edit.RequestSort (string prefs.RequestSort) "The request sort was not filled correctly"
|
||||||
"The request sort was not filled correctly"
|
|
||||||
Expect.equal edit.EmailFromName prefs.EmailFromName "The e-mail from name was not filled correctly"
|
Expect.equal edit.EmailFromName prefs.EmailFromName "The e-mail from name was not filled correctly"
|
||||||
Expect.equal edit.EmailFromAddress prefs.EmailFromAddress "The e-mail from address was not filled correctly"
|
Expect.equal edit.EmailFromAddress prefs.EmailFromAddress "The e-mail from address was not filled correctly"
|
||||||
Expect.equal edit.DefaultEmailType (EmailFormat.toCode prefs.DefaultEmailType)
|
Expect.equal edit.DefaultEmailType (string prefs.DefaultEmailType)
|
||||||
"The default e-mail type was not filled correctly"
|
"The default e-mail type was not filled correctly"
|
||||||
Expect.equal edit.LineColorType "Name" "The heading line color type was not derived correctly"
|
Expect.equal edit.LineColorType "Name" "The heading line color type was not derived correctly"
|
||||||
Expect.equal edit.LineColor prefs.LineColor "The heading line color was not filled correctly"
|
Expect.equal edit.LineColor prefs.LineColor "The heading line color was not filled correctly"
|
||||||
@@ -282,17 +278,16 @@ let editPreferencesTests =
|
|||||||
Expect.isNone edit.Fonts "The list fonts should not exist for native font stack"
|
Expect.isNone edit.Fonts "The list fonts should not exist for native font stack"
|
||||||
Expect.equal edit.HeadingFontSize prefs.HeadingFontSize "The heading font size was not filled correctly"
|
Expect.equal edit.HeadingFontSize prefs.HeadingFontSize "The heading font size was not filled correctly"
|
||||||
Expect.equal edit.ListFontSize prefs.TextFontSize "The list text font size was not filled correctly"
|
Expect.equal edit.ListFontSize prefs.TextFontSize "The list text font size was not filled correctly"
|
||||||
Expect.equal edit.TimeZone (TimeZoneId.toString prefs.TimeZoneId) "The time zone was not filled correctly"
|
Expect.equal edit.TimeZone (string prefs.TimeZoneId) "The time zone was not filled correctly"
|
||||||
Expect.isSome edit.GroupPassword "The group password should have been set"
|
Expect.isSome edit.GroupPassword "The group password should have been set"
|
||||||
Expect.equal edit.GroupPassword (Some prefs.GroupPassword) "The group password was not filled correctly"
|
Expect.equal edit.GroupPassword (Some prefs.GroupPassword) "The group password was not filled correctly"
|
||||||
Expect.equal edit.Visibility GroupVisibility.PrivateList
|
Expect.equal edit.Visibility GroupVisibility.PrivateList
|
||||||
"The list visibility was not derived correctly"
|
"The list visibility was not derived correctly"
|
||||||
Expect.equal edit.PageSize prefs.PageSize "The page size was not filled correctly"
|
Expect.equal edit.PageSize prefs.PageSize "The page size was not filled correctly"
|
||||||
Expect.equal edit.AsOfDate (AsOfDateDisplay.toCode prefs.AsOfDateDisplay)
|
Expect.equal edit.AsOfDate (string prefs.AsOfDateDisplay) "The as-of date display was not filled correctly"
|
||||||
"The as-of date display was not filled correctly"
|
|
||||||
}
|
}
|
||||||
test "fromPreferences succeeds for RGB line color and password-protected list" {
|
test "fromPreferences succeeds for RGB line color and password-protected list" {
|
||||||
let prefs = { ListPreferences.empty with LineColor = "#ff0000"; GroupPassword = "pw" }
|
let prefs = { ListPreferences.Empty with LineColor = "#ff0000"; GroupPassword = "pw" }
|
||||||
let edit = EditPreferences.fromPreferences prefs
|
let edit = EditPreferences.fromPreferences prefs
|
||||||
Expect.equal edit.LineColorType "RGB" "The heading line color type was not derived correctly"
|
Expect.equal edit.LineColorType "RGB" "The heading line color type was not derived correctly"
|
||||||
Expect.equal edit.LineColor prefs.LineColor "The heading line color was not filled correctly"
|
Expect.equal edit.LineColor prefs.LineColor "The heading line color was not filled correctly"
|
||||||
@@ -302,7 +297,7 @@ let editPreferencesTests =
|
|||||||
"The list visibility was not derived correctly"
|
"The list visibility was not derived correctly"
|
||||||
}
|
}
|
||||||
test "fromPreferences succeeds for RGB text color and public list" {
|
test "fromPreferences succeeds for RGB text color and public list" {
|
||||||
let prefs = { ListPreferences.empty with HeadingColor = "#0000ff"; IsPublic = true }
|
let prefs = { ListPreferences.Empty with HeadingColor = "#0000ff"; IsPublic = true }
|
||||||
let edit = EditPreferences.fromPreferences prefs
|
let edit = EditPreferences.fromPreferences prefs
|
||||||
Expect.equal edit.HeadingColorType "RGB" "The heading text color type was not derived correctly"
|
Expect.equal edit.HeadingColorType "RGB" "The heading text color type was not derived correctly"
|
||||||
Expect.equal edit.HeadingColor prefs.HeadingColor "The heading text color was not filled correctly"
|
Expect.equal edit.HeadingColor prefs.HeadingColor "The heading text color was not filled correctly"
|
||||||
@@ -312,7 +307,7 @@ let editPreferencesTests =
|
|||||||
"The list visibility was not derived correctly"
|
"The list visibility was not derived correctly"
|
||||||
}
|
}
|
||||||
test "fromPreferences succeeds for non-native fonts" {
|
test "fromPreferences succeeds for non-native fonts" {
|
||||||
let prefs = { ListPreferences.empty with Fonts = "Arial,sans-serif" }
|
let prefs = { ListPreferences.Empty with Fonts = "Arial,sans-serif" }
|
||||||
let edit = EditPreferences.fromPreferences prefs
|
let edit = EditPreferences.fromPreferences prefs
|
||||||
Expect.isFalse edit.IsNative "The IsNative flag should have been false"
|
Expect.isFalse edit.IsNative "The IsNative flag should have been false"
|
||||||
Expect.isSome edit.Fonts "The fonts should have been filled for non-native fonts"
|
Expect.isSome edit.Fonts "The fonts should have been filled for non-native fonts"
|
||||||
@@ -326,18 +321,16 @@ let editRequestTests =
|
|||||||
test "empty is as expected" {
|
test "empty is as expected" {
|
||||||
let mt = EditRequest.empty
|
let mt = EditRequest.empty
|
||||||
Expect.equal mt.RequestId emptyGuid "The request ID should be an empty GUID"
|
Expect.equal mt.RequestId emptyGuid "The request ID should be an empty GUID"
|
||||||
Expect.equal mt.RequestType (PrayerRequestType.toCode CurrentRequest)
|
Expect.equal mt.RequestType (string CurrentRequest) "The request type should have been \"Current\""
|
||||||
"The request type should have been \"Current\""
|
|
||||||
Expect.isNone mt.EnteredDate "The entered date should have been None"
|
Expect.isNone mt.EnteredDate "The entered date should have been None"
|
||||||
Expect.isNone mt.SkipDateUpdate """The "skip date update" flag should have been None"""
|
Expect.isNone mt.SkipDateUpdate """The "skip date update" flag should have been None"""
|
||||||
Expect.isNone mt.Requestor "The requestor should have been None"
|
Expect.isNone mt.Requestor "The requestor should have been None"
|
||||||
Expect.equal mt.Expiration (Expiration.toCode Automatic)
|
Expect.equal mt.Expiration (string Automatic) """The expiration should have been "A" (Automatic)"""
|
||||||
"""The expiration should have been "A" (Automatic)"""
|
|
||||||
Expect.equal mt.Text "" "The text should have been blank"
|
Expect.equal mt.Text "" "The text should have been blank"
|
||||||
}
|
}
|
||||||
test "fromRequest succeeds" {
|
test "fromRequest succeeds" {
|
||||||
let req =
|
let req =
|
||||||
{ PrayerRequest.empty with
|
{ PrayerRequest.Empty with
|
||||||
Id = (Guid.NewGuid >> PrayerRequestId) ()
|
Id = (Guid.NewGuid >> PrayerRequestId) ()
|
||||||
RequestType = CurrentRequest
|
RequestType = CurrentRequest
|
||||||
Requestor = Some "Me"
|
Requestor = Some "Me"
|
||||||
@@ -346,10 +339,9 @@ let editRequestTests =
|
|||||||
}
|
}
|
||||||
let edit = EditRequest.fromRequest req
|
let edit = EditRequest.fromRequest req
|
||||||
Expect.equal edit.RequestId (shortGuid req.Id.Value) "The request ID was not filled correctly"
|
Expect.equal edit.RequestId (shortGuid req.Id.Value) "The request ID was not filled correctly"
|
||||||
Expect.equal edit.RequestType (PrayerRequestType.toCode req.RequestType)
|
Expect.equal edit.RequestType (string req.RequestType) "The request type was not filled correctly"
|
||||||
"The request type was not filled correctly"
|
|
||||||
Expect.equal edit.Requestor req.Requestor "The requestor was not filled correctly"
|
Expect.equal edit.Requestor req.Requestor "The requestor was not filled correctly"
|
||||||
Expect.equal edit.Expiration (Expiration.toCode Manual) "The expiration was not filled correctly"
|
Expect.equal edit.Expiration (string Manual) "The expiration was not filled correctly"
|
||||||
Expect.equal edit.Text req.Text "The text was not filled correctly"
|
Expect.equal edit.Text req.Text "The text was not filled correctly"
|
||||||
}
|
}
|
||||||
test "isNew works for a new request" {
|
test "isNew works for a new request" {
|
||||||
@@ -366,7 +358,7 @@ let editSmallGroupTests =
|
|||||||
testList "EditSmallGroup" [
|
testList "EditSmallGroup" [
|
||||||
test "fromGroup succeeds" {
|
test "fromGroup succeeds" {
|
||||||
let grp =
|
let grp =
|
||||||
{ SmallGroup.empty with
|
{ SmallGroup.Empty with
|
||||||
Id = (Guid.NewGuid >> SmallGroupId) ()
|
Id = (Guid.NewGuid >> SmallGroupId) ()
|
||||||
Name = "test group"
|
Name = "test group"
|
||||||
ChurchId = (Guid.NewGuid >> ChurchId) ()
|
ChurchId = (Guid.NewGuid >> ChurchId) ()
|
||||||
@@ -395,7 +387,7 @@ let editSmallGroupTests =
|
|||||||
Name = "test name"
|
Name = "test name"
|
||||||
ChurchId = (Guid.NewGuid >> shortGuid) ()
|
ChurchId = (Guid.NewGuid >> shortGuid) ()
|
||||||
}
|
}
|
||||||
let grp = edit.populateGroup SmallGroup.empty
|
let grp = edit.populateGroup SmallGroup.Empty
|
||||||
Expect.equal grp.Name edit.Name "The name was not populated correctly"
|
Expect.equal grp.Name edit.Name "The name was not populated correctly"
|
||||||
Expect.equal grp.ChurchId (idFromShort ChurchId edit.ChurchId) "The church ID was not populated correctly"
|
Expect.equal grp.ChurchId (idFromShort ChurchId edit.ChurchId) "The church ID was not populated correctly"
|
||||||
}
|
}
|
||||||
@@ -416,7 +408,7 @@ let editUserTests =
|
|||||||
}
|
}
|
||||||
test "fromUser succeeds" {
|
test "fromUser succeeds" {
|
||||||
let usr =
|
let usr =
|
||||||
{ User.empty with
|
{ User.Empty with
|
||||||
Id = (Guid.NewGuid >> UserId) ()
|
Id = (Guid.NewGuid >> UserId) ()
|
||||||
FirstName = "user"
|
FirstName = "user"
|
||||||
LastName = "test"
|
LastName = "test"
|
||||||
@@ -446,7 +438,7 @@ let editUserTests =
|
|||||||
Password = "testpw"
|
Password = "testpw"
|
||||||
}
|
}
|
||||||
let hasher = fun x -> x + "+"
|
let hasher = fun x -> x + "+"
|
||||||
let usr = edit.PopulateUser User.empty hasher
|
let usr = edit.PopulateUser User.Empty hasher
|
||||||
Expect.equal usr.FirstName edit.FirstName "The first name was not populated correctly"
|
Expect.equal usr.FirstName edit.FirstName "The first name was not populated correctly"
|
||||||
Expect.equal usr.LastName edit.LastName "The last name was not populated correctly"
|
Expect.equal usr.LastName edit.LastName "The last name was not populated correctly"
|
||||||
Expect.equal usr.Email edit.Email "The e-mail address was not populated correctly"
|
Expect.equal usr.Email edit.Email "The e-mail address was not populated correctly"
|
||||||
@@ -508,26 +500,26 @@ let requestListTests =
|
|||||||
let withRequestList f () =
|
let withRequestList f () =
|
||||||
let today = SystemClock.Instance.GetCurrentInstant ()
|
let today = SystemClock.Instance.GetCurrentInstant ()
|
||||||
{ Requests = [
|
{ Requests = [
|
||||||
{ PrayerRequest.empty with
|
{ PrayerRequest.Empty with
|
||||||
RequestType = CurrentRequest
|
RequestType = CurrentRequest
|
||||||
Requestor = Some "Zeb"
|
Requestor = Some "Zeb"
|
||||||
Text = "zyx"
|
Text = "zyx"
|
||||||
UpdatedDate = today
|
UpdatedDate = today
|
||||||
}
|
}
|
||||||
{ PrayerRequest.empty with
|
{ PrayerRequest.Empty with
|
||||||
RequestType = CurrentRequest
|
RequestType = CurrentRequest
|
||||||
Requestor = Some "Aaron"
|
Requestor = Some "Aaron"
|
||||||
Text = "abc"
|
Text = "abc"
|
||||||
UpdatedDate = today - Duration.FromDays 9
|
UpdatedDate = today - Duration.FromDays 9
|
||||||
}
|
}
|
||||||
{ PrayerRequest.empty with
|
{ PrayerRequest.Empty with
|
||||||
RequestType = PraiseReport
|
RequestType = PraiseReport
|
||||||
Text = "nmo"
|
Text = "nmo"
|
||||||
UpdatedDate = today
|
UpdatedDate = today
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
Date = today.InUtc().Date
|
Date = today.InUtc().Date
|
||||||
SmallGroup = SmallGroup.empty
|
SmallGroup = SmallGroup.Empty
|
||||||
ShowHeader = false
|
ShowHeader = false
|
||||||
Recipients = []
|
Recipients = []
|
||||||
CanEmail = false
|
CanEmail = false
|
||||||
@@ -604,10 +596,10 @@ let requestListTests =
|
|||||||
}
|
}
|
||||||
let html = htmlList.AsHtml _s
|
let html = htmlList.AsHtml _s
|
||||||
let expected =
|
let expected =
|
||||||
htmlList.Requests[0].UpdatedDate.InZone(SmallGroup.timeZone reqList.SmallGroup).Date.ToString ("d", null)
|
htmlList.Requests[0].UpdatedDate.InZone(reqList.SmallGroup.TimeZone).Date.ToString ("d", null)
|
||||||
|> sprintf """<strong>Zeb</strong> – zyx<i style="font-size:9.60pt"> (as of %s)</i>"""
|
|> sprintf """<strong>Zeb</strong> – zyx<i style="font-size:9.60pt"> (as of %s)</i>"""
|
||||||
// spot check; if one request has it, they all should
|
// spot check; if one request has it, they all should
|
||||||
Expect.stringContains html expected "Expected short as-of date not found"
|
Expect.stringContains html expected "Expected short as-of date not found"
|
||||||
"AsHtml succeeds with long as-of date",
|
"AsHtml succeeds with long as-of date",
|
||||||
fun reqList ->
|
fun reqList ->
|
||||||
let htmlList =
|
let htmlList =
|
||||||
@@ -619,10 +611,10 @@ let requestListTests =
|
|||||||
}
|
}
|
||||||
let html = htmlList.AsHtml _s
|
let html = htmlList.AsHtml _s
|
||||||
let expected =
|
let expected =
|
||||||
htmlList.Requests[0].UpdatedDate.InZone(SmallGroup.timeZone reqList.SmallGroup).Date.ToString ("D", null)
|
htmlList.Requests[0].UpdatedDate.InZone(reqList.SmallGroup.TimeZone).Date.ToString ("D", null)
|
||||||
|> sprintf """<strong>Zeb</strong> – zyx<i style="font-size:9.60pt"> (as of %s)</i>"""
|
|> sprintf """<strong>Zeb</strong> – zyx<i style="font-size:9.60pt"> (as of %s)</i>"""
|
||||||
// spot check; if one request has it, they all should
|
// spot check; if one request has it, they all should
|
||||||
Expect.stringContains html expected "Expected long as-of date not found"
|
Expect.stringContains html expected "Expected long as-of date not found"
|
||||||
"AsText succeeds with no as-of date",
|
"AsText succeeds with no as-of date",
|
||||||
fun reqList ->
|
fun reqList ->
|
||||||
let textList = { reqList with SmallGroup = { reqList.SmallGroup with Name = "Test Group" } }
|
let textList = { reqList with SmallGroup = { reqList.SmallGroup with Name = "Test Group" } }
|
||||||
@@ -650,10 +642,10 @@ let requestListTests =
|
|||||||
}
|
}
|
||||||
let text = textList.AsText _s
|
let text = textList.AsText _s
|
||||||
let expected =
|
let expected =
|
||||||
textList.Requests[0].UpdatedDate.InZone(SmallGroup.timeZone reqList.SmallGroup).Date.ToString ("d", null)
|
textList.Requests[0].UpdatedDate.InZone(reqList.SmallGroup.TimeZone).Date.ToString ("d", null)
|
||||||
|> sprintf " + Zeb - zyx (as of %s)"
|
|> sprintf " + Zeb - zyx (as of %s)"
|
||||||
// spot check; if one request has it, they all should
|
// spot check; if one request has it, they all should
|
||||||
Expect.stringContains text expected "Expected short as-of date not found"
|
Expect.stringContains text expected "Expected short as-of date not found"
|
||||||
"AsText succeeds with long as-of date",
|
"AsText succeeds with long as-of date",
|
||||||
fun reqList ->
|
fun reqList ->
|
||||||
let textList =
|
let textList =
|
||||||
@@ -665,10 +657,10 @@ let requestListTests =
|
|||||||
}
|
}
|
||||||
let text = textList.AsText _s
|
let text = textList.AsText _s
|
||||||
let expected =
|
let expected =
|
||||||
textList.Requests[0].UpdatedDate.InZone(SmallGroup.timeZone reqList.SmallGroup).Date.ToString ("D", null)
|
textList.Requests[0].UpdatedDate.InZone(reqList.SmallGroup.TimeZone).Date.ToString ("D", null)
|
||||||
|> sprintf " + Zeb - zyx (as of %s)"
|
|> sprintf " + Zeb - zyx (as of %s)"
|
||||||
// spot check; if one request has it, they all should
|
// spot check; if one request has it, they all should
|
||||||
Expect.stringContains text expected "Expected long as-of date not found"
|
Expect.stringContains text expected "Expected long as-of date not found"
|
||||||
"IsNew succeeds for both old and new requests",
|
"IsNew succeeds for both old and new requests",
|
||||||
fun reqList ->
|
fun reqList ->
|
||||||
let allReqs = reqList.RequestsByType _s
|
let allReqs = reqList.RequestsByType _s
|
||||||
@@ -3,40 +3,45 @@ module PrayerTracker.Views.CommonFunctions
|
|||||||
|
|
||||||
open System.IO
|
open System.IO
|
||||||
open System.Text.Encodings.Web
|
open System.Text.Encodings.Web
|
||||||
open Giraffe
|
|
||||||
open Giraffe.ViewEngine
|
open Giraffe.ViewEngine
|
||||||
open Microsoft.AspNetCore.Antiforgery
|
|
||||||
open Microsoft.AspNetCore.Http
|
|
||||||
open Microsoft.AspNetCore.Mvc.Localization
|
open Microsoft.AspNetCore.Mvc.Localization
|
||||||
open Microsoft.Extensions.Localization
|
open Microsoft.Extensions.Localization
|
||||||
|
|
||||||
/// Encoded text for a localized string
|
/// Encoded text for a localized string
|
||||||
let locStr (text : LocalizedString) = str text.Value
|
let locStr (text: LocalizedString) =
|
||||||
|
str text.Value
|
||||||
|
|
||||||
/// Raw text for a localized HTML string
|
/// Raw text for a localized HTML string
|
||||||
let rawLocText (writer : StringWriter) (text : LocalizedHtmlString) =
|
let rawLocText (writer: StringWriter) (text: LocalizedHtmlString) =
|
||||||
text.WriteTo (writer, HtmlEncoder.Default)
|
text.WriteTo(writer, HtmlEncoder.Default)
|
||||||
let txt = string writer
|
let txt = string writer
|
||||||
writer.GetStringBuilder().Clear () |> ignore
|
writer.GetStringBuilder().Clear() |> ignore
|
||||||
rawText txt
|
rawText txt
|
||||||
|
|
||||||
/// A space (used for back-to-back localization string breaks)
|
/// A space (used for back-to-back localization string breaks)
|
||||||
let space = rawText " "
|
let space = rawText " "
|
||||||
|
|
||||||
/// Generate a Material Design icon
|
/// Generate a Material Design icon
|
||||||
let icon name = i [ _class "material-icons" ] [ rawText name ]
|
let icon name =
|
||||||
|
i [ _class "material-icons" ] [ rawText name ]
|
||||||
|
|
||||||
/// Generate a Material Design icon, specifying the point size (must be defined in CSS)
|
/// Generate a Material Design icon, specifying the point size (must be defined in CSS)
|
||||||
let iconSized size name = i [ _class $"material-icons md-%i{size}" ] [ rawText name ]
|
let iconSized size name =
|
||||||
|
i [ _class $"material-icons md-%i{size}" ] [ rawText name ]
|
||||||
|
|
||||||
|
|
||||||
|
open Giraffe
|
||||||
|
open Microsoft.AspNetCore.Antiforgery
|
||||||
|
open Microsoft.AspNetCore.Http
|
||||||
|
|
||||||
/// Generate a CSRF prevention token
|
/// Generate a CSRF prevention token
|
||||||
let csrfToken (ctx : HttpContext) =
|
let csrfToken (ctx: HttpContext) =
|
||||||
let antiForgery = ctx.GetService<IAntiforgery> ()
|
let antiForgery = ctx.GetService<IAntiforgery>()
|
||||||
let tokenSet = antiForgery.GetAndStoreTokens ctx
|
let tokenSet = antiForgery.GetAndStoreTokens ctx
|
||||||
input [ _type "hidden"; _name tokenSet.FormFieldName; _value tokenSet.RequestToken ]
|
input [ _type "hidden"; _name tokenSet.FormFieldName; _value tokenSet.RequestToken ]
|
||||||
|
|
||||||
/// Create a summary for a table of items
|
/// Create a summary for a table of items
|
||||||
let tableSummary itemCount (s : IStringLocalizer) =
|
let tableSummary itemCount (s: IStringLocalizer) =
|
||||||
div [ _class "pt-center-text" ] [
|
div [ _class "pt-center-text" ] [
|
||||||
small [] [
|
small [] [
|
||||||
match itemCount with
|
match itemCount with
|
||||||
@@ -46,9 +51,9 @@ let tableSummary itemCount (s : IStringLocalizer) =
|
|||||||
|> locStr
|
|> locStr
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
|
|
||||||
/// Generate a list of named HTML colors
|
/// Generate a list of named HTML colors
|
||||||
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 {
|
||||||
("aqua", s["Aqua"], "black")
|
("aqua", s["Aqua"], "black")
|
||||||
@@ -79,7 +84,7 @@ let namedColorList name selected attrs (s : IStringLocalizer) =
|
|||||||
|> select (_name name :: attrs)
|
|> select (_name name :: attrs)
|
||||||
|
|
||||||
/// Convert a named color to its hex notation
|
/// Convert a named color to its hex notation
|
||||||
let colorToHex (color : string) =
|
let colorToHex (color: string) =
|
||||||
match color with
|
match color with
|
||||||
| it when it.StartsWith "#" -> color
|
| it when it.StartsWith "#" -> color
|
||||||
| "aqua" -> "#00ffff"
|
| "aqua" -> "#00ffff"
|
||||||
@@ -99,8 +104,8 @@ let colorToHex (color : string) =
|
|||||||
| "white" -> "#ffffff"
|
| "white" -> "#ffffff"
|
||||||
| "yellow" -> "#ffff00"
|
| "yellow" -> "#ffff00"
|
||||||
| it -> it
|
| it -> it
|
||||||
|
|
||||||
/// Generate an input[type=radio] that is selected if its value is the current value
|
/// <summary>Generate an <c>input type=radio</c> that is selected if its value is the current value</summary>
|
||||||
let radio name domId value current =
|
let radio name domId value current =
|
||||||
input [ _type "radio"
|
input [ _type "radio"
|
||||||
_name name
|
_name name
|
||||||
@@ -108,7 +113,7 @@ let radio name domId value current =
|
|||||||
_value value
|
_value value
|
||||||
if value = current then _checked ]
|
if value = current then _checked ]
|
||||||
|
|
||||||
/// Generate a select list with the current value selected
|
/// <summary>Generate a <c>select</c> list with the current value selected</summary>
|
||||||
let selectList name selected attrs items =
|
let selectList name selected attrs items =
|
||||||
items
|
items
|
||||||
|> Seq.map (fun (value, text) ->
|
|> Seq.map (fun (value, text) ->
|
||||||
@@ -119,16 +124,18 @@ let selectList name selected attrs items =
|
|||||||
|> List.ofSeq
|
|> List.ofSeq
|
||||||
|> select (List.concat [ [ _name name; _id name ]; attrs ])
|
|> select (List.concat [ [ _name name; _id name ]; attrs ])
|
||||||
|
|
||||||
/// Generate the text for a default entry at the top of a select list
|
/// <summary>Generate the text for a default entry at the top of a <c>select</c> list</summary>
|
||||||
let selectDefault text = $"— %s{text} —"
|
let selectDefault text =
|
||||||
|
$"— %s{text} —"
|
||||||
|
|
||||||
/// Generate a standard submit button with icon and text
|
/// <summary>Generate a standard <c>button type=submit</c> with icon and text</summary>
|
||||||
let submit attrs ico text = button (_type "submit" :: attrs) [ icon ico; rawText " "; locStr text ]
|
let submit attrs ico text =
|
||||||
|
button (_type "submit" :: attrs) [ icon ico; rawText " "; locStr text ]
|
||||||
|
|
||||||
/// Create an HTML onsubmit event handler
|
/// Create an HTML onsubmit event handler
|
||||||
let _onsubmit = attr "onsubmit"
|
let _onsubmit = attr "onsubmit"
|
||||||
|
|
||||||
/// A "rel='noopener'" attribute
|
/// <summary>A <c>rel="noopener"</c> attribute</summary>
|
||||||
let _relNoOpener = _rel "noopener"
|
let _relNoOpener = _rel "noopener"
|
||||||
|
|
||||||
/// A class attribute that designates a row of fields, with the additional classes passed
|
/// A class attribute that designates a row of fields, with the additional classes passed
|
||||||
@@ -153,12 +160,14 @@ let _checkboxField = _class "pt-checkbox-field"
|
|||||||
/// A group of related fields, inputs, links, etc., displayed in a row
|
/// A group of related fields, inputs, links, etc., displayed in a row
|
||||||
let _group = _class "pt-group"
|
let _group = _class "pt-group"
|
||||||
|
|
||||||
/// Create an input field of the given type, with matching name and ID and the given value
|
/// <summary>
|
||||||
|
/// Create an <c>input</c> field of the given <c>type</c>, with matching name and ID and the given value
|
||||||
|
/// </summary>
|
||||||
let inputField typ name value attrs =
|
let inputField typ name value attrs =
|
||||||
List.concat [ [ _type typ; _name name; _id name; if value <> "" then _value value ]; attrs ] |> input
|
List.concat [ [ _type typ; _name name; _id name; if value <> "" then _value value ]; attrs ] |> input
|
||||||
|
|
||||||
/// Generate a table heading with the given localized column names
|
/// Generate a table heading with the given localized column names
|
||||||
let tableHeadings (s : IStringLocalizer) (headings : string list) =
|
let tableHeadings (s: IStringLocalizer) (headings: string list) =
|
||||||
headings
|
headings
|
||||||
|> List.map (fun heading -> th [ _scope "col" ] [ locStr s[heading] ])
|
|> List.map (fun heading -> th [ _scope "col" ] [ locStr s[heading] ])
|
||||||
|> tr []
|
|> tr []
|
||||||
@@ -166,7 +175,8 @@ let tableHeadings (s : IStringLocalizer) (headings : string list) =
|
|||||||
|> thead []
|
|> thead []
|
||||||
|
|
||||||
/// For a list of strings, prepend a pound sign and string them together with commas (CSS selector by ID)
|
/// For a list of strings, prepend a pound sign and string them together with commas (CSS selector by ID)
|
||||||
let toHtmlIds it = it |> List.map (fun x -> $"#%s{x}") |> String.concat ", "
|
let toHtmlIds it =
|
||||||
|
it |> List.map (fun x -> $"#%s{x}") |> String.concat ", "
|
||||||
|
|
||||||
/// The name this function used to have when the view engine was part of Giraffe
|
/// The name this function used to have when the view engine was part of Giraffe
|
||||||
let renderHtmlNode = RenderView.AsString.htmlNode
|
let renderHtmlNode = RenderView.AsString.htmlNode
|
||||||
@@ -180,7 +190,7 @@ let renderHtmlString = renderHtmlNode >> HtmlString
|
|||||||
|
|
||||||
/// Utility methods to help with time zones (and localization of their names)
|
/// Utility methods to help with time zones (and localization of their names)
|
||||||
module TimeZones =
|
module TimeZones =
|
||||||
|
|
||||||
open PrayerTracker.Entities
|
open PrayerTracker.Entities
|
||||||
|
|
||||||
/// Cross-reference between time zone Ids and their English names
|
/// Cross-reference between time zone Ids and their English names
|
||||||
@@ -194,24 +204,28 @@ module TimeZones =
|
|||||||
]
|
]
|
||||||
|
|
||||||
/// Get the name of a time zone, given its Id
|
/// Get the name of a time zone, given its Id
|
||||||
let name timeZoneId (s : IStringLocalizer) =
|
let name timeZoneId (s: IStringLocalizer) =
|
||||||
match xref |> List.tryFind (fun it -> fst it = timeZoneId) with
|
match xref |> List.tryFind (fun it -> fst it = timeZoneId) with
|
||||||
| Some tz -> s[snd tz]
|
| Some tz -> s[snd tz]
|
||||||
| None ->
|
| None ->
|
||||||
let tzId = TimeZoneId.toString timeZoneId
|
let tzId = string timeZoneId
|
||||||
LocalizedString (tzId, tzId)
|
LocalizedString (tzId, tzId)
|
||||||
|
|
||||||
/// All known time zones in their defined order
|
/// All known time zones in their defined order
|
||||||
let all = xref |> List.map fst
|
let all = xref |> List.map fst
|
||||||
|
|
||||||
|
|
||||||
open Giraffe.ViewEngine.Htmx
|
open Giraffe.ViewEngine.Htmx
|
||||||
|
|
||||||
|
/// Create a page link that will make the request with fixi
|
||||||
|
let pageLink href attrs content =
|
||||||
|
a (List.append [ _href href; _hxGet href ] attrs) content
|
||||||
|
|
||||||
/// Known htmx targets
|
/// Known htmx targets
|
||||||
module Target =
|
module Target =
|
||||||
|
|
||||||
/// htmx links target the body element
|
/// htmx links target the body element
|
||||||
let body = _hxTarget "body"
|
let body = _hxTarget "body"
|
||||||
|
|
||||||
/// htmx links target the #pt-body element
|
/// htmx links target the #pt-body element
|
||||||
let content = _hxTarget "#pt-body"
|
let content = _hxTarget "#pt-body"
|
||||||
300
src/UI/Help.fs
Normal file
300
src/UI/Help.fs
Normal file
@@ -0,0 +1,300 @@
|
|||||||
|
/// Help content for PrayerTracker
|
||||||
|
module PrayerTracker.Views.Help
|
||||||
|
|
||||||
|
open System.IO
|
||||||
|
open Giraffe.ViewEngine
|
||||||
|
open PrayerTracker.ViewModels
|
||||||
|
|
||||||
|
/// The help index page
|
||||||
|
let index () =
|
||||||
|
let s = I18N.localizer.Force()
|
||||||
|
let l = I18N.forView "Help/Index"
|
||||||
|
use sw = new StringWriter()
|
||||||
|
let raw = rawLocText sw
|
||||||
|
[ p [] [
|
||||||
|
raw l["Throughout PrayerTracker, you'll see an icon (a question mark in a circle) next to the title on each page."]; space
|
||||||
|
raw l["Clicking this will open a new, small window with directions on using that page."]; space
|
||||||
|
raw l["If you are looking for a quick overview of PrayerTracker, start with the “Add / Edit a Request” and “Change Preferences” entries."] ]
|
||||||
|
hr []
|
||||||
|
p [ _class "pt-center-text" ] [ strong [] [ locStr s["Help Topics"] ] ]
|
||||||
|
p [] [ a [ _href "/help/small-group/preferences" ] [ locStr s["Change Preferences"] ] ]
|
||||||
|
p [] [ a [ _href "/help/small-group/announcement" ] [ locStr s["Send Announcement"] ] ]
|
||||||
|
p [] [ a [ _href "/help/small-group/members" ] [ locStr s["Maintain Group Members"] ] ]
|
||||||
|
p [] [ a [ _href "/help/requests/edit" ] [ locStr s["Add / Edit a Request"] ] ]
|
||||||
|
p [] [ a [ _href "/help/requests/maintain" ] [ locStr s["Maintain Requests"] ] ]
|
||||||
|
p [] [ a [ _href "/help/requests/view" ] [ locStr s["View Request List"] ] ]
|
||||||
|
p [] [ a [ _href "/help/user/log-on" ] [ locStr s["Log On"] ] ]
|
||||||
|
p [] [ a [ _href "/help/user/password" ] [ locStr s["Change Your Password"] ] ] ]
|
||||||
|
|
||||||
|
|
||||||
|
/// Help for prayer requests
|
||||||
|
module Requests =
|
||||||
|
|
||||||
|
/// Add / Edit a Request
|
||||||
|
let edit () =
|
||||||
|
let s = I18N.localizer.Force()
|
||||||
|
let l = I18N.forView "Help/Requests/Edit"
|
||||||
|
use sw = new StringWriter()
|
||||||
|
let raw = rawLocText sw
|
||||||
|
[ p [] [ raw l["This page allows you to enter or update a new prayer request."] ]
|
||||||
|
h2 [ _id "request-type" ] [ locStr s["Request Type"] ]
|
||||||
|
p [] [
|
||||||
|
raw l["There are 5 request types in PrayerTracker."]; space
|
||||||
|
raw l["“Current Requests” are your regular requests that people may have regarding things happening over the next week or so."]; space
|
||||||
|
raw l["“Long-Term Requests” are requests that may occur repeatedly or continue indefinitely."]; space
|
||||||
|
raw l["“Praise Reports” are like “Current Requests”, but they are answers to prayer to share with your group."]; space
|
||||||
|
raw l["“Expecting” is for those who are pregnant."]; space
|
||||||
|
raw l["“Announcements” are like “Current Requests”, but instead of a request, they are simply passing information along about something coming up."] ]
|
||||||
|
p [] [
|
||||||
|
raw l["The order above is the order in which the request types appear on the list."]; space
|
||||||
|
raw l["“Long-Term Requests” and “Expecting” are not subject to the automatic expiration (set on the “Change Preferences” page) that the other requests are."] ]
|
||||||
|
h2 [ _id "date" ] [ locStr s["Date"] ]
|
||||||
|
p [] [
|
||||||
|
raw l["For new requests, this is a box with a calendar date picker."]; space
|
||||||
|
raw l["Click or tab into the box to display the calendar, which will be preselected to today's date."]; space
|
||||||
|
raw l["For existing requests, there will be a check box labeled “Check to not update the date”."]; space
|
||||||
|
raw l["This can be used if you are correcting spelling or punctuation, and do not have an actual update to make to the request."]
|
||||||
|
]
|
||||||
|
h2 [ _id "requestor-subject" ] [ locStr s["Requestor / Subject"] ]
|
||||||
|
p [] [
|
||||||
|
raw l["For requests or praises, this field is for the name of the person who made the request or offered the praise report."]; space
|
||||||
|
raw l["For announcements, this should contain the subject of the announcement."]; space
|
||||||
|
raw l["For all types, it is optional; I used to have an announcement with no subject that ran every week, telling where to send requests and updates."] ]
|
||||||
|
h2 [ _id "expiration" ] [ locStr s["Expiration"] ]
|
||||||
|
p [] [
|
||||||
|
raw l["“Expire Normally” means that the request is subject to the expiration days in the group preferences."]; space
|
||||||
|
raw l["“Request Never Expires” can be used to make a request never expire (note that this is redundant for “Long-Term Requests” and “Expecting”)."]; space
|
||||||
|
raw l["If you are editing an existing request, a third option appears."]; space
|
||||||
|
raw l["“Expire Immediately” will make the request expire when it is saved."]; space
|
||||||
|
raw l["Apart from the icons on the request maintenance page, this is the only way to expire “Long-Term Requests” and “Expecting” requests, but it can be used for any request type."] ]
|
||||||
|
h2 [ _id "request" ] [ locStr s["Request"] ]
|
||||||
|
p [] [
|
||||||
|
raw l["This is the text of the request."]; space
|
||||||
|
raw l["The editor provides many formatting capabilities, including “Spell Check as you Type” (enabled by default), “Paste from Word”, and “Paste Plain”, as well as “Source” view, if you want to edit the HTML yourself."]; space
|
||||||
|
raw l["It also supports undo and redo, and the editor supports full-screen mode. Hover over each icon to see what each button does."] ] ]
|
||||||
|
|
||||||
|
/// Maintain Requests
|
||||||
|
let maintain () =
|
||||||
|
let s = I18N.localizer.Force()
|
||||||
|
let l = I18N.forView "Help/Requests/Maintain"
|
||||||
|
use sw = new StringWriter()
|
||||||
|
let raw = rawLocText sw
|
||||||
|
[ p [] [
|
||||||
|
raw l["From this page, you can add, edit, and delete your current requests."]; space
|
||||||
|
raw l["You can also restore requests that may have expired, but should be made active once again."] ]
|
||||||
|
h2 [ _id "add-a-new-request" ] [ locStr s["Add a New Request"] ]
|
||||||
|
p [] [
|
||||||
|
raw l["To add a request, click the icon or text in the center of the page, below the title and above the list of requests for your group."] ]
|
||||||
|
h2 [ _id "search-requests" ] [ locStr s["Search Requests"] ]
|
||||||
|
p [] [
|
||||||
|
raw l["If you are looking for a particular requests, enter some text in the search box and click “Search”."]; space
|
||||||
|
raw l["PrayerTracker will search the Requestor/Subject and Request Text fields (case-insensitively) of both active and inactive requests."]; space
|
||||||
|
raw l["The results will be displayed in the same format as the original Maintain Requests page, so the buttons described below will work the same for those requests as well."]; space
|
||||||
|
raw l["They will also be displayed in pages, if there are a lot of results; the number per page is configurable by small group."] ]
|
||||||
|
h2 [ _id "edit-request" ] [ locStr s["Edit Request"] ]
|
||||||
|
p [] [
|
||||||
|
raw l["To edit a request, click the pencil icon; it's the first icon under the “Actions” column heading."] ]
|
||||||
|
h2 [ _id "expire-a-request" ] [ locStr s["Expire a Request"] ]
|
||||||
|
p [] [
|
||||||
|
raw l["For active requests, the second icon is an eye with a slash through it; clicking this icon will expire the request immediately."]; space
|
||||||
|
raw l["This is equivalent to editing the request, selecting “Expire Immediately”, and saving it."] ]
|
||||||
|
h2 [ _id "restore-an-inactive-request" ] [ locStr s["Restore an Inactive Request"] ]
|
||||||
|
p [] [
|
||||||
|
raw l["When the page is first displayed, it does not display inactive requests."]; space
|
||||||
|
raw l["However, clicking the link at the bottom of the page will refresh the page with the inactive requests shown."]; space
|
||||||
|
raw l["The middle icon will look like an eye; clicking it will restore the request as an active request."]; space
|
||||||
|
raw l["The last updated date will be current, and the request is set to expire normally."] ]
|
||||||
|
h2 [ _id "delete-a-request" ] [ locStr s["Delete a Request"] ]
|
||||||
|
p [] [
|
||||||
|
raw l["Deleting a request is contrary to the intent of PrayerTracker, as you can retrieve requests that have expired."]; space
|
||||||
|
raw l["However, if there is a request that needs to be deleted, clicking the trash can icon in the “Actions” column will allow you to do it."]; space
|
||||||
|
raw l["Use this option carefully, as these deletions cannot be undone; once a request is deleted, it is gone for good."] ] ]
|
||||||
|
|
||||||
|
/// View Request List
|
||||||
|
let view () =
|
||||||
|
let s = I18N.localizer.Force()
|
||||||
|
let l = I18N.forView "Help/Requests/View"
|
||||||
|
use sw = new StringWriter()
|
||||||
|
let raw = rawLocText sw
|
||||||
|
[ p [] [
|
||||||
|
raw l["From this page, you can view the request list (for today or for the next Sunday), view a printable version of the list, and e-mail the list to the members of your group."]; space
|
||||||
|
raw l["(NOTE: If you are logged in as a group member, the only option you will see is to view a printable list.)"] ]
|
||||||
|
h2 [ _id "list-for-next-sunday" ] [ locStr s["List for Next Sunday"] ]
|
||||||
|
p [] [
|
||||||
|
raw l["This will modify the date for the list, so it will look like it is currently next Sunday."]; space
|
||||||
|
raw l["This can be used, for example, to see what requests will expire, or allow you to print a list with Sunday's date on Saturday evening."]; space
|
||||||
|
raw l["Note that this link does not appear if it is Sunday."] ]
|
||||||
|
h2 [ _id "view-printable" ] [ locStr s["View Printable"] ]
|
||||||
|
p [] [
|
||||||
|
raw l["Clicking this link will display the list in a format that is suitable for printing; it does not have the normal PrayerTracker header across the top."]; space
|
||||||
|
raw l["Once you have clicked the link, you can print it using your browser's standard “Print” functionality."] ]
|
||||||
|
h2 [ _id "send-via-e-mail" ] [ locStr s["Send via E-mail"] ]
|
||||||
|
p [] [
|
||||||
|
raw l["Clicking this link will send the list you are currently viewing to your group members."]; space
|
||||||
|
raw l["The page will remind you that you are about to do that, and ask for your confirmation."]; space
|
||||||
|
raw l["If you proceed, you will see a page that shows to whom the list was sent, and what the list looked like."]; space
|
||||||
|
raw l["You may safely use your browser's “Back” button to navigate away from the page."] ] ]
|
||||||
|
|
||||||
|
|
||||||
|
/// Help for small group pages
|
||||||
|
module SmallGroup =
|
||||||
|
|
||||||
|
/// Send an Announcement
|
||||||
|
let announcement () =
|
||||||
|
let s = I18N.localizer.Force()
|
||||||
|
let l = I18N.forView "Help/SmallGroup/Announcement"
|
||||||
|
use sw = new StringWriter()
|
||||||
|
let raw = rawLocText sw
|
||||||
|
[ h2 [ _id "announcement-text" ] [ locStr s["Announcement Text"] ]
|
||||||
|
p [] [
|
||||||
|
raw l["This is the text of the announcement you would like to send."]; space
|
||||||
|
raw l["""It functions the same way as the text box on the <a href="../requests/edit#request">“Edit Request” page</a>."""] ]
|
||||||
|
h2 [ _id "add-to-request-list" ] [ locStr s["Add to Request List"] ]
|
||||||
|
p [] [
|
||||||
|
raw l["Without this box checked, the text of the announcement will only be e-mailed to your group members."]; space
|
||||||
|
raw l["If you check this box, however, the text of the announcement will be added to your prayer list under the section you have selected."] ] ]
|
||||||
|
|
||||||
|
/// Maintain Group Members
|
||||||
|
let members () =
|
||||||
|
let s = I18N.localizer.Force()
|
||||||
|
let l = I18N.forView "Help/SmallGroup/Members"
|
||||||
|
use sw = new StringWriter()
|
||||||
|
let raw = rawLocText sw
|
||||||
|
[ p [] [ raw l["From this page, you can add, edit, and delete the e-mail addresses for your group."] ]
|
||||||
|
h2 [ _id "add-a-new-group-member" ] [ locStr s["Add a New Group Member"] ]
|
||||||
|
p [] [
|
||||||
|
raw l["To add an e-mail address, click the icon or text in the center of the page, below the title and above the list of addresses for your group."] ]
|
||||||
|
h2 [ _id "edit-group-member" ] [ locStr s["Edit Group Member"] ]
|
||||||
|
p [] [
|
||||||
|
raw l["To edit an e-mail address, click the pencil icon; it's the first icon under the “Actions” column heading."]; space
|
||||||
|
raw l["This will allow you to update the name and/or the e-mail address for that member."] ]
|
||||||
|
h2 [ _id "delete-a-group-member" ] [ locStr s["Delete a Group Member"] ]
|
||||||
|
p [] [
|
||||||
|
raw l["To delete an e-mail address, click the trash can icon in the “Actions” column."]; space
|
||||||
|
raw l["Note that once an e-mail address has been deleted, it is gone."]; space
|
||||||
|
raw l["(Of course, if you delete it in error, you can enter it again using the “Add” instructions above.)"] ] ]
|
||||||
|
|
||||||
|
/// Change Preferences
|
||||||
|
let preferences () =
|
||||||
|
let s = I18N.localizer.Force()
|
||||||
|
let l = I18N.forView "Help/SmallGroup/Preferences"
|
||||||
|
use sw = new StringWriter()
|
||||||
|
let raw = rawLocText sw
|
||||||
|
[ p [] [
|
||||||
|
raw l["This page allows you to change how your prayer request list looks and behaves."]; space
|
||||||
|
raw l["Each section is addressed below."] ]
|
||||||
|
h2 [ _id "requests-expire-after" ] [ locStr s["Requests Expire After"] ]
|
||||||
|
p [] [
|
||||||
|
raw l["When a regular request goes this many days without being updated, it expires and no longer appears on the request list."]; space
|
||||||
|
raw l["Note that the categories “Long-Term Requests” and “Expecting” never expire automatically."] ]
|
||||||
|
h2 [ _id "requests-new-for" ] [ locStr s["Requests “New” For"] ]
|
||||||
|
p [] [
|
||||||
|
raw l["Requests that have been updated within this many days are identified by a hollow circle for their bullet, as opposed to a filled circle for other requests."]; space
|
||||||
|
raw l["All categories respect this setting."]; space
|
||||||
|
raw l["If you do a typo correction on a request, if you do not check the box to update the date, this setting will change the bullet."]; space
|
||||||
|
raw l["(NOTE: In the plain-text e-mail, new requests are bulleted with a “+” symbol, and old are bulleted with a “-” symbol.)"] ]
|
||||||
|
h2 [ _id "long-term-requests-alerted-for-update" ] [ locStr s["Long-Term Requests Alerted for Update"] ]
|
||||||
|
p [] [
|
||||||
|
raw l["Requests that have not been updated in this many weeks are identified by an italic font on the “Maintain Requests” page, to remind you to seek updates on these requests so that your prayers can stay relevant and current."] ]
|
||||||
|
h2 [ _id "request-sorting" ] [ locStr s["Request Sorting"] ]
|
||||||
|
p [] [
|
||||||
|
raw l["By default, requests are sorted within each group by the last updated date, with the most recent on top."]; space
|
||||||
|
raw l["If you would prefer to have the list sorted by requestor or subject rather than by date, select “Sort by Requestor Name” instead."] ]
|
||||||
|
h2 [ _id "e-mail-from-name-and-address" ] [ locStr s["E-mail “From” Name and Address"] ]
|
||||||
|
p [] [
|
||||||
|
raw l["PrayerTracker must put an name and e-mail address in the “from” position of each e-mail it sends."]; space
|
||||||
|
raw l["The default name is “PrayerTracker”, and the default e-mail address is “prayer@bitbadger.solutions”."]; space
|
||||||
|
raw l["This will work, but any bounced e-mails and out-of-office replies will be sent to that address (which is not even a real address)."]; space
|
||||||
|
raw l["Changing at least the e-mail address to your address will ensure that you receive these e-mails, and can prune your e-mail list accordingly."] ]
|
||||||
|
h2 [ _id "e-mail-format" ] [ locStr s["E-mail Format"] ]
|
||||||
|
p [] [
|
||||||
|
raw l["This is the default e-mail format for your group."]; space
|
||||||
|
raw l["The PrayerTracker default is HTML, which sends the list just as you see it online."]; space
|
||||||
|
raw l["However, some e-mail clients may not display this properly, so you can choose to default the email to a plain-text format, which does not have colors, italics, or other formatting."]; space
|
||||||
|
raw l["The setting on this page is the group default; you can select a format for each recipient on the “Maintain Group Members” page."] ]
|
||||||
|
h2 [ _id "colors" ] [ locStr s["Colors"] ]
|
||||||
|
p [] [
|
||||||
|
raw l["You can customize the colors that are used for the headings and lines in your request list."]; space
|
||||||
|
raw l["You can select one of the 16 named colors in the drop down lists, or you can “mix your own” using red, green, and blue (RGB) values between 0 and 255."]; space
|
||||||
|
raw l["There is a link on the bottom of the page to a color list with more names and their RGB values, if you're really feeling artistic."]; space
|
||||||
|
raw l["The background color cannot be changed."] ]
|
||||||
|
h2 [ _id "fonts-for-list" ] [ locStr s["Fonts for List"] ]
|
||||||
|
p [] [ raw l["There are two options for fonts that will be used in the prayer request list."] ]
|
||||||
|
ul [] [
|
||||||
|
li [] [
|
||||||
|
raw l["“Native Fonts” uses a list of fonts that will render the prayer requests in the best available font for their device, whether that is a desktop or laptop computer, mobile device, or tablet."]; space
|
||||||
|
raw l["(This is the default for new small groups.)"] ]
|
||||||
|
li [] [
|
||||||
|
raw l["“Named Fonts” uses a comma-separated list of fonts that you specify."]; space
|
||||||
|
raw l["A warning is good here; just because you have an obscure font and like the way that it looks does not mean that others have that same font."]; space
|
||||||
|
raw l["It is generally best to stick with the fonts that come with Windows - fonts like “Arial”, “Times New Roman”, “Tahoma”, and “Comic Sans MS”."]; space
|
||||||
|
raw l["You should also end the font list with either “serif” or “sans-serif”, which will use the browser's default serif (like “Times New Roman”) or sans-serif (like “Arial”) font."] ] ]
|
||||||
|
h2 [ _id "heading-list-text-size" ] [ locStr s["Heading / List Text Size"] ]
|
||||||
|
p [] [
|
||||||
|
raw l["This is the point size to use for each."]; space
|
||||||
|
raw l["The default for the heading is 16pt, and the default for the text is 12pt."] ]
|
||||||
|
h2 [ _id "making-a-large-print-list" ] [ locStr s["Making a “Large Print” List"] ]
|
||||||
|
p [] [
|
||||||
|
raw l["If your group is comprised mostly of people who prefer large print, the following settings will make your list look like the typical large-print publication:"] ]
|
||||||
|
blockquote [] [
|
||||||
|
p [] [ strong [] [ locStr s["Fonts"] ]; br []; raw l["""Named Fonts: "Times New Roman",serif"""] ]
|
||||||
|
p [] [ strong [] [ locStr s["Heading Text Size"] ]; br []; rawText "18pt" ]
|
||||||
|
p [] [ strong [] [ locStr s["List Text Size"] ]; br []; rawText "16pt" ] ]
|
||||||
|
h2 [ _id "request-list-visibility" ] [ locStr s["Request List Visibility"] ]
|
||||||
|
p [] [
|
||||||
|
raw l["The group's request list can be either public, private, or password-protected."]; space
|
||||||
|
raw l["Public lists are available without logging in, and private lists are only available online to administrators (though the list can still be sent via e-mail by an administrator)."]; space
|
||||||
|
raw l["Password-protected lists allow group members to log in and view the current request list online, using the “Group Log On” link and providing this password."]; space
|
||||||
|
raw l["As this is a shared password, it is stored in plain text, so you can easily see what it is."]; space
|
||||||
|
raw l["If you select “Password Protected” but do not enter a password, the list remains private, which is also the default value."]; space
|
||||||
|
raw l["(Changing this password will force all members of the group who logged in with the “Remember Me” box checked to provide the new password.)"] ]
|
||||||
|
h2 [ _id "time-zone" ] [ locStr s["Time Zone"] ]
|
||||||
|
p [] [
|
||||||
|
raw l["This is the time zone that you would like to use for your group."]; space
|
||||||
|
raw l["""If you do not see your time zone listed, just <a href="mailto:daniel@bitbadger.solutions?subject=PrayerTracker+Time+Zone">contact Daniel</a> and tell him what time zone you need."""] ]
|
||||||
|
h2 [ _id "page-size" ] [ locStr s["Page Size"] ]
|
||||||
|
p [] [
|
||||||
|
raw l["As small groups use PrayerTracker, they accumulate many expired requests."]; space
|
||||||
|
raw l["When lists of requests include expired requests, the results will be broken up into pages."]; space
|
||||||
|
raw l["The default value is 100 requests per page, but may be set as low as 10 or as high as 255."] ]
|
||||||
|
h2 [ _id "as-of-date-display" ] [ locStr s["“As of” Date Display"] ]
|
||||||
|
p [] [
|
||||||
|
raw l["PrayerTracker can display the last date a request was updated, at the end of the request text."]; space
|
||||||
|
raw l["By default, it does not."]; space
|
||||||
|
raw l["If you select a short date, it will show “(as of 10/11/2015)” (for October 11, 2015); if you select a long date, it will show “(as of Sunday, October 11, 2015)”."] ] ]
|
||||||
|
|
||||||
|
/// Help for user pages
|
||||||
|
module User =
|
||||||
|
|
||||||
|
/// Log On
|
||||||
|
let logOn () =
|
||||||
|
let s = I18N.localizer.Force()
|
||||||
|
let l = I18N.forView "Help/User/LogOn"
|
||||||
|
use sw = new StringWriter()
|
||||||
|
let raw = rawLocText sw
|
||||||
|
[ p [] [
|
||||||
|
raw l["This page allows you to log on to PrayerTracker."]; space
|
||||||
|
raw l["There are two different levels of access for PrayerTracker - user and group."] ]
|
||||||
|
h2 [ _id "user-log-on" ] [ locStr s["User Log On"] ]
|
||||||
|
p [] [
|
||||||
|
raw l["Enter your e-mail address and password into the appropriate boxes, then select your group."]; space
|
||||||
|
raw l["If you want PrayerTracker to remember you on your computer, click the “Remember Me” box before clicking the “Log On” button."] ]
|
||||||
|
h2 [ _id "group-log-on" ] [ locStr s["Group Log On"] ]
|
||||||
|
p [] [
|
||||||
|
raw l["If your group has defined a password to use to allow you to view their request list online, select your group from the drop down list, then enter the group password into the appropriate box."]; space
|
||||||
|
raw l["If you want PrayerTracker to remember your group, click the “Remember Me” box before clicking the “Log On” button."] ] ]
|
||||||
|
|
||||||
|
/// Change Your Password
|
||||||
|
let password () =
|
||||||
|
let s = I18N.localizer.Force()
|
||||||
|
let l = I18N.forView "Help/User/Password"
|
||||||
|
use sw = new StringWriter()
|
||||||
|
let raw = rawLocText sw
|
||||||
|
[ p [] [
|
||||||
|
raw l["This page will let you change your password."]; space
|
||||||
|
raw l["Enter your existing password in the top box, then enter your new password in the bottom two boxes."]; space
|
||||||
|
raw l["Entering your existing password is a security measure; with the “Remember Me” box on the log in page, this will prevent someone else who may be using your computer from being able to simply go to the site and change your password."] ]
|
||||||
|
p [] [
|
||||||
|
raw l["If you cannot remember your existing password, we cannot retrieve it, but we can set it to something known so that you can then change it to your password."]; space
|
||||||
|
a [ _href $"""mailto:daniel@bitbadger.solutions?subject={l["PrayerTracker+Password+Help"].Value}""" ] [
|
||||||
|
raw l["Click here to request help resetting your password."] ] ] ]
|
||||||
@@ -12,11 +12,11 @@ let private resAsmName = typeof<Common>.Assembly.GetName().Name
|
|||||||
/// Set up the string and HTML localizer factories
|
/// Set up the string and HTML localizer factories
|
||||||
let setUpFactories fac =
|
let setUpFactories fac =
|
||||||
stringLocFactory <- fac
|
stringLocFactory <- fac
|
||||||
htmlLocFactory <- HtmlLocalizerFactory stringLocFactory
|
htmlLocFactory <- HtmlLocalizerFactory stringLocFactory
|
||||||
|
|
||||||
/// An instance of the common string localizer
|
/// An instance of the common string localizer
|
||||||
let localizer = lazy (stringLocFactory.Create ("Common", resAsmName))
|
let localizer = lazy stringLocFactory.Create("Common", resAsmName)
|
||||||
|
|
||||||
/// Get a view localizer
|
/// Get a view localizer
|
||||||
let forView (view : string) =
|
let forView (view: string) =
|
||||||
htmlLocFactory.Create ($"Views.{view.Replace ('/', '.')}", resAsmName)
|
htmlLocFactory.Create($"Views.{view.Replace('/', '.')}", resAsmName)
|
||||||
350
src/UI/Layout.fs
Normal file
350
src/UI/Layout.fs
Normal file
@@ -0,0 +1,350 @@
|
|||||||
|
/// Layout items for PrayerTracker
|
||||||
|
module PrayerTracker.Views.Layout
|
||||||
|
|
||||||
|
open Giraffe.ViewEngine
|
||||||
|
open Giraffe.ViewEngine.Accessibility
|
||||||
|
open PrayerTracker.ViewModels
|
||||||
|
open System.Globalization
|
||||||
|
|
||||||
|
/// Get the two-character language code for the current request
|
||||||
|
let langCode () = if CultureInfo.CurrentCulture.Name.StartsWith "es" then "es" else "en"
|
||||||
|
|
||||||
|
|
||||||
|
/// Navigation items
|
||||||
|
module Navigation =
|
||||||
|
|
||||||
|
/// Top navigation bar
|
||||||
|
let top m =
|
||||||
|
let s = I18N.localizer.Force()
|
||||||
|
let menuSpacer = rawText " "
|
||||||
|
let _dropdown = _class "dropdown-btn"
|
||||||
|
let leftLinks = [
|
||||||
|
match m.User with
|
||||||
|
| Some u ->
|
||||||
|
li [ _class "dropdown" ] [
|
||||||
|
a [ _dropdown; _ariaLabel s["Requests"].Value; _title s["Requests"].Value; _roleButton ] [
|
||||||
|
icon "question_answer"; space; locStr s["Requests"]; space; icon "keyboard_arrow_down" ]
|
||||||
|
div [ _class "dropdown-content"; _roleMenuBar ] [
|
||||||
|
pageLink "/prayer-requests"
|
||||||
|
[ _roleMenuItem ]
|
||||||
|
[ icon "compare_arrows"; menuSpacer; locStr s["Maintain"] ]
|
||||||
|
pageLink "/prayer-requests/view"
|
||||||
|
[ _roleMenuItem ]
|
||||||
|
[ icon "list"; menuSpacer; locStr s["View List"] ] ] ]
|
||||||
|
li [ _class "dropdown" ] [
|
||||||
|
a [ _dropdown; _ariaLabel s["Group"].Value; _title s["Group"].Value; _roleButton ] [
|
||||||
|
icon "group"; space; locStr s["Group"]; space; icon "keyboard_arrow_down" ]
|
||||||
|
div [ _class "dropdown-content"; _roleMenuBar ] [
|
||||||
|
pageLink "/small-group/members"
|
||||||
|
[ _roleMenuItem ]
|
||||||
|
[ icon "email"; menuSpacer; locStr s["Maintain Group Members"] ]
|
||||||
|
pageLink "/small-group/announcement"
|
||||||
|
[ _roleMenuItem ]
|
||||||
|
[ icon "send"; menuSpacer; locStr s["Send Announcement"] ]
|
||||||
|
pageLink "/small-group/preferences"
|
||||||
|
[ _roleMenuItem ]
|
||||||
|
[ icon "build"; menuSpacer; locStr s["Change Preferences"] ] ] ]
|
||||||
|
if u.IsAdmin then
|
||||||
|
li [ _class "dropdown" ] [
|
||||||
|
a [ _dropdown
|
||||||
|
_ariaLabel s["Administration"].Value
|
||||||
|
_title s["Administration"].Value
|
||||||
|
_roleButton ] [
|
||||||
|
icon "settings"; space; locStr s["Administration"]; space; icon "keyboard_arrow_down" ]
|
||||||
|
div [ _class "dropdown-content"; _roleMenuBar ] [
|
||||||
|
pageLink "/churches" [ _roleMenuItem ] [ icon "home"; menuSpacer; locStr s["Churches"] ]
|
||||||
|
pageLink "/small-groups"
|
||||||
|
[ _roleMenuItem ]
|
||||||
|
[ icon "send"; menuSpacer; locStr s["Groups"] ]
|
||||||
|
pageLink "/users" [ _roleMenuItem ] [ icon "build"; menuSpacer; locStr s["Users"] ] ] ]
|
||||||
|
| None ->
|
||||||
|
match m.Group with
|
||||||
|
| Some _ ->
|
||||||
|
li [] [
|
||||||
|
pageLink "/prayer-requests/view"
|
||||||
|
[ _ariaLabel s["View Request List"].Value; _title s["View Request List"].Value ]
|
||||||
|
[ icon "list"; space; locStr s["View Request List"] ] ]
|
||||||
|
| None ->
|
||||||
|
li [ _class "dropdown" ] [
|
||||||
|
a [ _dropdown; _ariaLabel s["Log On"].Value; _title s["Log On"].Value; _roleButton ] [
|
||||||
|
icon "security"; space; locStr s["Log On"]; space; icon "keyboard_arrow_down" ]
|
||||||
|
div [ _class "dropdown-content"; _roleMenuBar ] [
|
||||||
|
pageLink "/user/log-on" [ _roleMenuItem ] [ icon "person"; menuSpacer; locStr s["User"] ]
|
||||||
|
pageLink "/small-group/log-on"
|
||||||
|
[ _roleMenuItem ]
|
||||||
|
[ icon "group"; menuSpacer; locStr s["Group"] ] ] ]
|
||||||
|
li [] [
|
||||||
|
pageLink "/prayer-requests/lists"
|
||||||
|
[ _ariaLabel s["View Request List"].Value; _title s["View Request List"].Value ]
|
||||||
|
[ icon "list"; space; locStr s["View Request List"] ] ]
|
||||||
|
li [] [
|
||||||
|
a [ _href "/help"; _ariaLabel s["Help"].Value; _title s["View Help"].Value; _target "_blank" ] [
|
||||||
|
icon "help"; space; locStr s["Help"] ] ] ]
|
||||||
|
let rightLinks =
|
||||||
|
match m.Group with
|
||||||
|
| Some _ -> [
|
||||||
|
match m.User with
|
||||||
|
| Some _ ->
|
||||||
|
li [] [
|
||||||
|
pageLink "/user/password"
|
||||||
|
[ _ariaLabel s["Change Your Password"].Value; _title s["Change Your Password"].Value ]
|
||||||
|
[ icon "lock"; space; locStr s["Change Your Password"] ] ]
|
||||||
|
| None -> ()
|
||||||
|
li [] [
|
||||||
|
pageLink "/log-off"
|
||||||
|
[ _ariaLabel s["Log Off"].Value; _title s["Log Off"].Value; Target.body ]
|
||||||
|
[ icon "power_settings_new"; space; locStr s["Log Off"] ] ] ]
|
||||||
|
| None -> []
|
||||||
|
header [ _class "pt-title-bar"; Target.content ] [
|
||||||
|
section [ _class "pt-title-bar-left"; _ariaLabel "Left side of top menu" ] [
|
||||||
|
span [ _class "pt-title-bar-home" ] [
|
||||||
|
pageLink "/" [ _title s["Home"].Value ] [ locStr s["PrayerTracker"] ] ]
|
||||||
|
ul [] leftLinks ]
|
||||||
|
section [ _class "pt-title-bar-center"; _ariaLabel "Empty center space in top menu" ] []
|
||||||
|
section [ _class "pt-title-bar-right"; _roleToolBar; _ariaLabel "Right side of top menu" ] [
|
||||||
|
ul [] rightLinks ] ]
|
||||||
|
|
||||||
|
/// Identity bar (below top nav)
|
||||||
|
let identity m =
|
||||||
|
let s = I18N.localizer.Force()
|
||||||
|
header [ _id "pt-language"; Target.body ] [
|
||||||
|
div [] [
|
||||||
|
span [ _title s["Language"].Value ] [ icon "record_voice_over"; space ]
|
||||||
|
match langCode () with
|
||||||
|
| "es" ->
|
||||||
|
strong [] [ locStr s["Spanish"] ]
|
||||||
|
rawText " "
|
||||||
|
pageLink "/language/en" [] [ locStr s["Change to English"] ]
|
||||||
|
| _ ->
|
||||||
|
strong [] [ locStr s["English"] ]
|
||||||
|
rawText " "
|
||||||
|
pageLink "/language/es" [] [ locStr s["Cambie a Español"] ] ]
|
||||||
|
match m.Group with
|
||||||
|
| Some g ->
|
||||||
|
[ match m.User with
|
||||||
|
| Some u ->
|
||||||
|
span [ _class "u" ] [ locStr s["Currently Logged On"] ]
|
||||||
|
rawText " "
|
||||||
|
icon "person"
|
||||||
|
strong [] [ str u.Name ]
|
||||||
|
rawText " "
|
||||||
|
| None ->
|
||||||
|
locStr s["Logged On as a Member of"]
|
||||||
|
rawText " "
|
||||||
|
icon "group"
|
||||||
|
space
|
||||||
|
match m.User with
|
||||||
|
| Some _ -> pageLink "/small-group" [] [ strong [] [ str g.Name ] ]
|
||||||
|
| None -> strong [] [ str g.Name ] ]
|
||||||
|
| None -> []
|
||||||
|
|> div [] ]
|
||||||
|
|
||||||
|
|
||||||
|
/// Content layouts
|
||||||
|
module Content =
|
||||||
|
|
||||||
|
/// Content layout that tops at 60rem
|
||||||
|
let standard = div [ _class "pt-content" ]
|
||||||
|
|
||||||
|
/// Content layout that uses the full width of the browser window
|
||||||
|
let wide = div [ _class "pt-content pt-full-width" ]
|
||||||
|
|
||||||
|
|
||||||
|
/// Separator for parts of the title
|
||||||
|
let private titleSep = rawText " « "
|
||||||
|
|
||||||
|
/// Common HTML head tag items
|
||||||
|
let private commonHead = [
|
||||||
|
meta [ _name "viewport"; _content "width=device-width, initial-scale=1" ]
|
||||||
|
meta [ _name "generator"; _content "Giraffe" ]
|
||||||
|
link [ _rel "stylesheet"; _href "https://fonts.googleapis.com/icon?family=Material+Icons" ]
|
||||||
|
link [ _rel "stylesheet"; _href "/_/app.css" ] ]
|
||||||
|
|
||||||
|
/// Render the <head> portion of the page
|
||||||
|
let private htmlHead viewInfo pgTitle =
|
||||||
|
let s = I18N.localizer.Force()
|
||||||
|
head [] [
|
||||||
|
meta [ _charset "UTF-8" ]
|
||||||
|
title [] [ locStr pgTitle; titleSep; locStr s["PrayerTracker"] ]
|
||||||
|
yield! commonHead
|
||||||
|
for cssFile in viewInfo.Style do
|
||||||
|
link [ _rel "stylesheet"; _href $"/_/{cssFile}.css"; _type "text/css" ] ]
|
||||||
|
|
||||||
|
|
||||||
|
/// Render a link to the help page for the current page
|
||||||
|
let private helpLink link =
|
||||||
|
let s = I18N.localizer.Force()
|
||||||
|
sup [ _class "pt-help-link" ] [
|
||||||
|
a [ _href link
|
||||||
|
_title s["Click for Help on This Page"].Value
|
||||||
|
_onclick $"return PT.showHelp('{link}')" ] [ iconSized 18 "help_outline" ] ]
|
||||||
|
|
||||||
|
/// Render the page title, and optionally a help link
|
||||||
|
let private renderPageTitle viewInfo pgTitle =
|
||||||
|
h2 [ _id "pt-page-title" ] [
|
||||||
|
match viewInfo.HelpLink with
|
||||||
|
| Some link -> helpLink $"/help/{link}"
|
||||||
|
| None -> ()
|
||||||
|
locStr pgTitle ]
|
||||||
|
|
||||||
|
/// Render the messages that may need to be displayed to the user
|
||||||
|
let private messages viewInfo =
|
||||||
|
let s = I18N.localizer.Force()
|
||||||
|
if List.isEmpty viewInfo.Messages then []
|
||||||
|
else
|
||||||
|
viewInfo.Messages
|
||||||
|
|> List.map (fun msg ->
|
||||||
|
div [ _class $"pt-msg {MessageLevel.toCssClass msg.Level}" ] [
|
||||||
|
match msg.Level with
|
||||||
|
| Info -> ()
|
||||||
|
| lvl ->
|
||||||
|
strong [] [ locStr s[MessageLevel.toString lvl] ]
|
||||||
|
rawText " » "
|
||||||
|
rawText msg.Text.Value
|
||||||
|
match msg.Description with
|
||||||
|
| Some desc ->
|
||||||
|
br []
|
||||||
|
div [ _class "description" ] [ rawText desc.Value ]
|
||||||
|
| None -> () ])
|
||||||
|
|> div [ _class "pt-messages" ]
|
||||||
|
|> List.singleton
|
||||||
|
|
||||||
|
|
||||||
|
open NodaTime
|
||||||
|
|
||||||
|
/// Render the <footer> at the bottom of the page
|
||||||
|
let private htmlFooter viewInfo =
|
||||||
|
let s = I18N.localizer.Force()
|
||||||
|
let imgText = $"""%O{s["PrayerTracker"]} %O{s["from Bit Badger Solutions"]}"""
|
||||||
|
let resultTime = (SystemClock.Instance.GetCurrentInstant() - viewInfo.RequestStart).TotalSeconds
|
||||||
|
footer [ _class "pt-footer" ] [
|
||||||
|
div [ _id "pt-legal" ] [
|
||||||
|
pageLink "/legal/privacy-policy" [] [ locStr s["Privacy Policy"] ]
|
||||||
|
rawText " "
|
||||||
|
pageLink "/legal/terms-of-service" [] [ locStr s["Terms of Service"] ]
|
||||||
|
rawText " "
|
||||||
|
a [ _href "https://git.bitbadger.solutions/bit-badger/PrayerTracker"
|
||||||
|
_title s["View source code and get technical support"].Value
|
||||||
|
_target "_blank"
|
||||||
|
_relNoOpener ] [
|
||||||
|
locStr s["Source & Support"] ] ]
|
||||||
|
div [ _id "pt-footer" ] [
|
||||||
|
pageLink "/" [ _style "line-height:28px;" ] [
|
||||||
|
img [ _src $"""/img/%O{s["footer_en"]}.png"""
|
||||||
|
_alt imgText
|
||||||
|
_title imgText
|
||||||
|
_width "331"; _height "28" ] ]
|
||||||
|
span [ _id "pt-version" ] [ str viewInfo.Version ]
|
||||||
|
space
|
||||||
|
i [ _title s["This page loaded in {0:N3} seconds", resultTime].Value; _class "material-icons md-18" ] [
|
||||||
|
str "schedule" ] ] ]
|
||||||
|
|
||||||
|
/// The content portion of the PrayerTracker layout
|
||||||
|
let private contentSection viewInfo pgTitle (content: XmlNode) =
|
||||||
|
[ Navigation.identity viewInfo
|
||||||
|
renderPageTitle viewInfo pgTitle
|
||||||
|
yield! messages viewInfo
|
||||||
|
match viewInfo.ScopedStyle with
|
||||||
|
| [] -> ()
|
||||||
|
| styles -> style [] [ rawText (styles |> String.concat " ") ]
|
||||||
|
content
|
||||||
|
htmlFooter viewInfo
|
||||||
|
match viewInfo.OnLoadScript with
|
||||||
|
| Some onLoad ->
|
||||||
|
let doCall = if onLoad.EndsWith ")" then "" else "()"
|
||||||
|
script [] [
|
||||||
|
rawText $"
|
||||||
|
window.doOnLoad = () => {{
|
||||||
|
if (window.PT) {{
|
||||||
|
{onLoad}{doCall}
|
||||||
|
delete window.doOnLoad
|
||||||
|
}} else {{ setTimeout(window.doOnLoad, 500) }}
|
||||||
|
}}
|
||||||
|
window.doOnLoad()" ]
|
||||||
|
| None -> () ]
|
||||||
|
|
||||||
|
/// The HTML head element for partial responses
|
||||||
|
let private partialHead pgTitle =
|
||||||
|
let s = I18N.localizer.Force()
|
||||||
|
head [] [
|
||||||
|
meta [ _charset "UTF-8" ]
|
||||||
|
title [] [ locStr pgTitle; titleSep; locStr s["PrayerTracker"] ] ]
|
||||||
|
|
||||||
|
/// The body of the PrayerTracker layout
|
||||||
|
let private pageLayout viewInfo pgTitle content =
|
||||||
|
body [] [
|
||||||
|
Navigation.top viewInfo
|
||||||
|
div [ _id "pt-body"; Target.content ] (contentSection viewInfo pgTitle content)
|
||||||
|
match viewInfo.Layout with
|
||||||
|
| FullPage ->
|
||||||
|
script [ _src "/js/ckeditor/ckeditor.js" ] []
|
||||||
|
Htmx.Script.minified
|
||||||
|
script [ _src "/_/app.js" ] []
|
||||||
|
| _ -> () ]
|
||||||
|
|
||||||
|
/// The standard layout(s) for PrayerTracker
|
||||||
|
let standard viewInfo pageTitle content =
|
||||||
|
let s = I18N.localizer.Force()
|
||||||
|
let pgTitle = s[pageTitle]
|
||||||
|
html [ _lang (langCode ()) ] [
|
||||||
|
match viewInfo.Layout with
|
||||||
|
| FullPage ->
|
||||||
|
htmlHead viewInfo pgTitle
|
||||||
|
pageLayout viewInfo pgTitle content
|
||||||
|
| PartialPage ->
|
||||||
|
partialHead pgTitle
|
||||||
|
pageLayout viewInfo pgTitle content
|
||||||
|
| ContentOnly ->
|
||||||
|
partialHead pgTitle
|
||||||
|
body [] (contentSection viewInfo pgTitle content) ]
|
||||||
|
|
||||||
|
/// A layout with nothing but a title and content
|
||||||
|
let bare pageTitle content =
|
||||||
|
let s = I18N.localizer.Force()
|
||||||
|
html [ _lang (langCode ()) ] [
|
||||||
|
partialHead s[pageTitle]
|
||||||
|
body [] [ content ] ]
|
||||||
|
|
||||||
|
/// Help page layout
|
||||||
|
let help pageTitle isHome content =
|
||||||
|
let s = I18N.localizer.Force()
|
||||||
|
let pgTitle = s[pageTitle]
|
||||||
|
html [ _lang (langCode ()) ] [
|
||||||
|
head [] [
|
||||||
|
meta [ _charset "UTF-8" ]
|
||||||
|
meta [ _name "viewport"; _content "width=device-width, initial-scale=1" ]
|
||||||
|
title [] [ locStr pgTitle; titleSep; locStr s["PrayerTracker Help"] ]
|
||||||
|
link [ _href "https://fonts.googleapis.com/icon?family=Material+Icons"; _rel "stylesheet" ]
|
||||||
|
link [ _href "/_/app.css"; _rel "stylesheet" ]
|
||||||
|
link [ _href "/_/help.css"; _rel "stylesheet" ] ]
|
||||||
|
body [] [
|
||||||
|
header [ _class "pt-title-bar" ] [
|
||||||
|
section [ _class "pt-title-bar-left" ] [
|
||||||
|
span [ _class "pt-title-bar-home" ] [
|
||||||
|
a [ _href "/help"; _title "Home" ] [ locStr s["PrayerTracker"] ] ] ]
|
||||||
|
section [ _class "pt-title-bar-right" ] [ locStr s["Help"] ] ]
|
||||||
|
div [ _id "pt-body" ] [
|
||||||
|
header [ _id "pt-language" ] [
|
||||||
|
div [] [
|
||||||
|
locStr s["Language"]; rawText ": "
|
||||||
|
match langCode () with
|
||||||
|
| "es" ->
|
||||||
|
locStr s["Spanish"]; rawText " • "
|
||||||
|
a [ _href "/language/en" ] [ locStr s["Change to English"] ]
|
||||||
|
| _ ->
|
||||||
|
locStr s["English"]; rawText " • "
|
||||||
|
a [ _href "/language/es" ] [ locStr s["Cambie a Español"] ] ] ]
|
||||||
|
h2 [ _id "pt-page-title" ] [ locStr pgTitle ]
|
||||||
|
div [ _class "pt-content" ] [
|
||||||
|
yield! content
|
||||||
|
div [ _class "pt-close-window" ] [
|
||||||
|
p [ _class "pt-center-text" ] [
|
||||||
|
a [ _href "#"; _title s["Click to Close This Window"].Value
|
||||||
|
_onclick "window.close(); return false" ] [
|
||||||
|
i [ _class "material-icons"] [ rawText "cancel" ]
|
||||||
|
space; locStr s["Close Window"] ] ] ]
|
||||||
|
if not isHome then
|
||||||
|
div [ _class "pt-help-index" ] [
|
||||||
|
p [ _class "pt-center-text" ] [
|
||||||
|
a [ _href "/help"; _title s["Help Index"].Value ] [
|
||||||
|
rawText "« "; locStr s["Back to Help Index"] ] ] ] ] ] ] ]
|
||||||
@@ -29,7 +29,7 @@ let edit (model : EditRequest) today ctx viewInfo =
|
|||||||
label [ _for (nameof model.RequestType) ] [ locStr s["Request Type"] ]
|
label [ _for (nameof model.RequestType) ] [ locStr s["Request Type"] ]
|
||||||
ReferenceList.requestTypeList s
|
ReferenceList.requestTypeList s
|
||||||
|> Seq.ofList
|
|> Seq.ofList
|
||||||
|> Seq.map (fun (typ, desc) -> PrayerRequestType.toCode typ, desc.Value)
|
|> Seq.map (fun (typ, desc) -> string typ, desc.Value)
|
||||||
|> selectList (nameof model.RequestType) model.RequestType [ _required; _autofocus ]
|
|> selectList (nameof model.RequestType) model.RequestType [ _required; _autofocus ]
|
||||||
]
|
]
|
||||||
div [ _inputField ] [
|
div [ _inputField ] [
|
||||||
@@ -98,7 +98,7 @@ let email model viewInfo =
|
|||||||
/// View for a small group's public prayer request list
|
/// View for a small group's public prayer request list
|
||||||
let list (model : RequestList) viewInfo =
|
let list (model : RequestList) viewInfo =
|
||||||
[ br []
|
[ br []
|
||||||
I18N.localizer.Force () |> (model.AsHtml >> rawText)
|
I18N.localizer.Force () |> (model.AsHtml >> rawText)
|
||||||
]
|
]
|
||||||
|> Layout.Content.standard
|
|> Layout.Content.standard
|
||||||
|> Layout.standard viewInfo "View Request List"
|
|> Layout.standard viewInfo "View Request List"
|
||||||
@@ -156,7 +156,7 @@ let maintain (model : MaintainRequests) (ctx : HttpContext) viewInfo =
|
|||||||
use sw = new StringWriter ()
|
use sw = new StringWriter ()
|
||||||
let raw = rawLocText sw
|
let raw = rawLocText sw
|
||||||
let group = model.SmallGroup
|
let group = model.SmallGroup
|
||||||
let now = SmallGroup.localDateNow (ctx.GetService<IClock> ()) group
|
let now = group.LocalDateNow (ctx.GetService<IClock>())
|
||||||
let types = ReferenceList.requestTypeList s |> Map.ofList
|
let types = ReferenceList.requestTypeList s |> Map.ofList
|
||||||
let vi = AppViewInfo.withScopedStyles [ "#requestList { grid-template-columns: repeat(5, auto); }" ] viewInfo
|
let vi = AppViewInfo.withScopedStyles [ "#requestList { grid-template-columns: repeat(5, auto); }" ] viewInfo
|
||||||
/// Iterate the sequence once, before we render, so we can get the count of it at the top of the table
|
/// Iterate the sequence once, before we render, so we can get the count of it at the top of the table
|
||||||
@@ -164,8 +164,8 @@ let maintain (model : MaintainRequests) (ctx : HttpContext) viewInfo =
|
|||||||
model.Requests
|
model.Requests
|
||||||
|> List.map (fun req ->
|
|> List.map (fun req ->
|
||||||
let updateClass =
|
let updateClass =
|
||||||
_class (if PrayerRequest.updateRequired now group req then "cell pt-request-update" else "cell")
|
_class (if req.UpdateRequired now group then "cell pt-request-update" else "cell")
|
||||||
let isExpired = PrayerRequest.isExpired now group req
|
let isExpired = req.IsExpired now group
|
||||||
let expiredClass = _class (if isExpired then "cell pt-request-expired" else "cell")
|
let expiredClass = _class (if isExpired then "cell pt-request-expired" else "cell")
|
||||||
let reqId = shortGuid req.Id.Value
|
let reqId = shortGuid req.Id.Value
|
||||||
let reqText = htmlToPlainText req.Text
|
let reqText = htmlToPlainText req.Text
|
||||||
@@ -7,6 +7,7 @@
|
|||||||
<Compile Include="CommonFunctions.fs" />
|
<Compile Include="CommonFunctions.fs" />
|
||||||
<Compile Include="Layout.fs" />
|
<Compile Include="Layout.fs" />
|
||||||
<Compile Include="Church.fs" />
|
<Compile Include="Church.fs" />
|
||||||
|
<Compile Include="Help.fs" />
|
||||||
<Compile Include="Home.fs" />
|
<Compile Include="Home.fs" />
|
||||||
<Compile Include="PrayerRequest.fs" />
|
<Compile Include="PrayerRequest.fs" />
|
||||||
<Compile Include="SmallGroup.fs" />
|
<Compile Include="SmallGroup.fs" />
|
||||||
@@ -15,24 +16,46 @@
|
|||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Giraffe.ViewEngine" Version="1.4.0" />
|
<PackageReference Include="Giraffe.ViewEngine" Version="1.4.0" />
|
||||||
<PackageReference Include="Giraffe.ViewEngine.Htmx" Version="1.9.2" />
|
<PackageReference Include="Giraffe.ViewEngine.Htmx" Version="2.0.4" />
|
||||||
<PackageReference Include="MailKit" Version="4.1.0" />
|
<PackageReference Include="MailKit" Version="4.10.0" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Html.Abstractions" Version="2.2.0" />
|
<PackageReference Update="FSharp.Core" Version="9.0.101" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Http" Version="2.2.2" />
|
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Http.Extensions" Version="2.2.0" />
|
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="2.2.0" />
|
|
||||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
|
||||||
<PackageReference Update="FSharp.Core" Version="7.0.300" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\PrayerTracker.Data\PrayerTracker.Data.fsproj" />
|
<ProjectReference Include="..\Data\PrayerTracker.Data.fsproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<EmbeddedResource Update="Resources\Common.es.resx">
|
<EmbeddedResource Update="Resources\Common.es.resx">
|
||||||
<Generator>ResXFileCodeGenerator</Generator>
|
<Generator>ResXFileCodeGenerator</Generator>
|
||||||
</EmbeddedResource>
|
</EmbeddedResource>
|
||||||
|
<EmbeddedResource Update="Resources\Help\Index.es.resx">
|
||||||
|
<Generator>ResXFileCodeGenerator</Generator>
|
||||||
|
</EmbeddedResource>
|
||||||
|
<EmbeddedResource Update="Resources\Help\Requests\Edit.es.resx">
|
||||||
|
<Generator>ResXFileCodeGenerator</Generator>
|
||||||
|
</EmbeddedResource>
|
||||||
|
<EmbeddedResource Update="Resources\Help\Requests\Maintain.es.resx">
|
||||||
|
<Generator>ResXFileCodeGenerator</Generator>
|
||||||
|
</EmbeddedResource>
|
||||||
|
<EmbeddedResource Update="Resources\Help\Requests\View.es.resx">
|
||||||
|
<Generator>ResXFileCodeGenerator</Generator>
|
||||||
|
</EmbeddedResource>
|
||||||
|
<EmbeddedResource Update="Resources\Help\SmallGroup\Announcement.es.resx">
|
||||||
|
<Generator>ResXFileCodeGenerator</Generator>
|
||||||
|
</EmbeddedResource>
|
||||||
|
<EmbeddedResource Update="Resources\Help\SmallGroup\Members.es.resx">
|
||||||
|
<Generator>ResXFileCodeGenerator</Generator>
|
||||||
|
</EmbeddedResource>
|
||||||
|
<EmbeddedResource Update="Resources\Help\SmallGroup\Preferences.es.resx">
|
||||||
|
<Generator>ResXFileCodeGenerator</Generator>
|
||||||
|
</EmbeddedResource>
|
||||||
|
<EmbeddedResource Update="Resources\Help\User\LogOn.es.resx">
|
||||||
|
<Generator>ResXFileCodeGenerator</Generator>
|
||||||
|
</EmbeddedResource>
|
||||||
|
<EmbeddedResource Update="Resources\Help\User\Password.es.resx">
|
||||||
|
<Generator>ResXFileCodeGenerator</Generator>
|
||||||
|
</EmbeddedResource>
|
||||||
<EmbeddedResource Update="Resources\Views\Home\Error.es.resx">
|
<EmbeddedResource Update="Resources\Views\Home\Error.es.resx">
|
||||||
<Generator>ResXFileCodeGenerator</Generator>
|
<Generator>ResXFileCodeGenerator</Generator>
|
||||||
</EmbeddedResource>
|
</EmbeddedResource>
|
||||||
@@ -882,4 +882,40 @@
|
|||||||
<data name="This User Is a {0} Administrator" xml:space="preserve">
|
<data name="This User Is a {0} Administrator" xml:space="preserve">
|
||||||
<value>Este Usuario Es un Administrador de {0}</value>
|
<value>Este Usuario Es un Administrador de {0}</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="PrayerTracker Help" xml:space="preserve">
|
||||||
|
<value>Ayuda de SeguidorOración</value>
|
||||||
|
</data>
|
||||||
|
<data name="Click to Close This Window" xml:space="preserve">
|
||||||
|
<value>Haga Clic para Cerrar Esta Ventana</value>
|
||||||
|
</data>
|
||||||
|
<data name="Close Window" xml:space="preserve">
|
||||||
|
<value>Cerrar Esta Ventana</value>
|
||||||
|
</data>
|
||||||
|
<data name="Help Index" xml:space="preserve">
|
||||||
|
<value>Índice de Ayuda</value>
|
||||||
|
</data>
|
||||||
|
<data name="Back to Help Index" xml:space="preserve">
|
||||||
|
<value>Volver al Índice de Ayuda</value>
|
||||||
|
</data>
|
||||||
|
<data name="Add / Edit a Request" xml:space="preserve">
|
||||||
|
<value>Agregar o Editar una Petición</value>
|
||||||
|
</data>
|
||||||
|
<data name="Search Requests" xml:space="preserve">
|
||||||
|
<value>Peticiones de Búsqueda</value>
|
||||||
|
</data>
|
||||||
|
<data name="Expire a Request" xml:space="preserve">
|
||||||
|
<value>Expirar un Petición</value>
|
||||||
|
</data>
|
||||||
|
<data name="Restore an Inactive Request" xml:space="preserve">
|
||||||
|
<value>Restaurar un Petición Inactiva</value>
|
||||||
|
</data>
|
||||||
|
<data name="E-mail “From” Name and Address" xml:space="preserve">
|
||||||
|
<value>Correo Electrónico “De” Nombre y Dirección</value>
|
||||||
|
</data>
|
||||||
|
<data name="Fonts for List" xml:space="preserve">
|
||||||
|
<value>Fuentes de la Lista</value>
|
||||||
|
</data>
|
||||||
|
<data name="Making a “Large Print” List" xml:space="preserve">
|
||||||
|
<value>Realización de una Lista de “Letra Grande”</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
||||||
70
src/UI/Resources/Views/Help/Index.es.resx
Normal file
70
src/UI/Resources/Views/Help/Index.es.resx
Normal file
@@ -0,0 +1,70 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<root>
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="metadata">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="assembly">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<data name="Throughout PrayerTracker, you'll see an icon (a question mark in a circle) next to the title on each page." xml:space="preserve">
|
||||||
|
<value>En todo el sistema, verá un icono (un signo de interrogación en un círculo) junto al título de cada página.</value>
|
||||||
|
</data>
|
||||||
|
<data name="Clicking this will open a new, small window with directions on using that page." xml:space="preserve">
|
||||||
|
<value>Al hacer clic en esta opción, se abrirá una nueva y pequeña ventana con instrucciones sobre cómo usar esa página.</value>
|
||||||
|
</data>
|
||||||
|
<data name="If you are looking for a quick overview of PrayerTracker, start with the “Add / Edit a Request” and “Change Preferences” entries." xml:space="preserve">
|
||||||
|
<value>Si está buscando una descripción rápida de SeguidorOración, comience con las entradas “Agregar o Editar una Petición” y “Cambiar las Preferencias”.</value>
|
||||||
|
</data>
|
||||||
|
</root>
|
||||||
133
src/UI/Resources/Views/Help/Requests/Edit.es.resx
Normal file
133
src/UI/Resources/Views/Help/Requests/Edit.es.resx
Normal file
@@ -0,0 +1,133 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<root>
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="metadata">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="assembly">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<data name="This page allows you to enter or update a new prayer request." xml:space="preserve">
|
||||||
|
<value>Esta página le permite introducir o actualizar una petición de oración nueva.</value>
|
||||||
|
</data>
|
||||||
|
<data name="There are 5 request types in PrayerTracker." xml:space="preserve">
|
||||||
|
<value>Hay 5 tipos de peticiones en SeguidorOración.</value>
|
||||||
|
</data>
|
||||||
|
<data name="“Current Requests” are your regular requests that people may have regarding things happening over the next week or so." xml:space="preserve">
|
||||||
|
<value>“Peticiones Actuales” son sus peticiones habituales que la gente pueda tener acerca de las cosas que suceden durante la próxima semana o así.</value>
|
||||||
|
</data>
|
||||||
|
<data name="“Long-Term Requests” are requests that may occur repeatedly or continue indefinitely." xml:space="preserve">
|
||||||
|
<value>“Peticiones a Largo Plazo” son peticiones que pueden ocurrir varias veces, o continuar indefinidamente.</value>
|
||||||
|
</data>
|
||||||
|
<data name="“Praise Reports” are like “Current Requests”, but they are answers to prayer to share with your group." xml:space="preserve">
|
||||||
|
<value>“Informes de Alabanza” son como “Peticiones Actuales”, pero son respuestas a la oración para compartir con su grupo.</value>
|
||||||
|
</data>
|
||||||
|
<data name="“Expecting” is for those who are pregnant." xml:space="preserve">
|
||||||
|
<value>“Embarazada” es para aquellos que están embarazadas.</value>
|
||||||
|
</data>
|
||||||
|
<data name="“Announcements” are like “Current Requests”, but instead of a request, they are simply passing information along about something coming up." xml:space="preserve">
|
||||||
|
<value>“Anuncios” son como “Peticiones Actuales”, pero en lugar de una petición, simplemente se pasa la información a lo largo de algo por venir.</value>
|
||||||
|
</data>
|
||||||
|
<data name="The order above is the order in which the request types appear on the list." xml:space="preserve">
|
||||||
|
<value>El orden anterior es el orden en que los tipos de peticiones aparecen en la lista.</value>
|
||||||
|
</data>
|
||||||
|
<data name="“Long-Term Requests” and “Expecting” are not subject to the automatic expiration (set on the “Change Preferences” page) that the other requests are." xml:space="preserve">
|
||||||
|
<value>“Peticiones a Largo Plazo” y “Embarazada” no están sujetos a la caducidad automática (establecida en el “Cambiar las Preferencias” de la página) que las peticiones son otros.</value>
|
||||||
|
</data>
|
||||||
|
<data name="For new requests, this is a box with a calendar date picker." xml:space="preserve">
|
||||||
|
<value>Para nuevas peticiones, se trata de una caja con un selector de fechas del calendario.</value>
|
||||||
|
</data>
|
||||||
|
<data name="Click or tab into the box to display the calendar, which will be preselected to today's date." xml:space="preserve">
|
||||||
|
<value>Haga clic en la pestaña o en la caja para mostrar el calendario, que será preseleccionada para la fecha de hoy.</value>
|
||||||
|
</data>
|
||||||
|
<data name="For existing requests, there will be a check box labeled “Check to not update the date”." xml:space="preserve">
|
||||||
|
<value>Para peticiones existentes, habrá una casilla de verificación “Seleccionar para no actualizar la fecha”.</value>
|
||||||
|
</data>
|
||||||
|
<data name="This can be used if you are correcting spelling or punctuation, and do not have an actual update to make to the request." xml:space="preserve">
|
||||||
|
<value>Esto puede ser usado si corrige la ortografía ni la puntuacion, y no tienen una actualización real de hacer la petición.</value>
|
||||||
|
</data>
|
||||||
|
<data name="For requests or praises, this field is for the name of the person who made the request or offered the praise report." xml:space="preserve">
|
||||||
|
<value>Para las peticiones o alabanzas, este campo es el nombre de la persona que hizo la petición o que ofrece el informe de alabanza.</value>
|
||||||
|
</data>
|
||||||
|
<data name="For announcements, this should contain the subject of the announcement." xml:space="preserve">
|
||||||
|
<value>Para los anuncios, este debe contener el objeto del anuncio.</value>
|
||||||
|
</data>
|
||||||
|
<data name="For all types, it is optional; I used to have an announcement with no subject that ran every week, telling where to send requests and updates." xml:space="preserve">
|
||||||
|
<value>Para todos los tipos, es opcional, yo solía tener un anuncio con ningún tema que iba todas las semanas, diciendo a dónde enviar peticiones y actualizaciones.</value>
|
||||||
|
</data>
|
||||||
|
<data name="“Expire Normally” means that the request is subject to the expiration days in the group preferences." xml:space="preserve">
|
||||||
|
<value>“Expirará Normalmente” significa que la petición está sujeta a los días de vencimiento de las preferencias del grupo.</value>
|
||||||
|
</data>
|
||||||
|
<data name="“Request Never Expires” can be used to make a request never expire (note that this is redundant for “Long-Term Requests” and “Expecting”)." xml:space="preserve">
|
||||||
|
<value>“Petición no Expira Nunca” se puede utilizar para hacer una petición que no caduque nunca (nótese que esto es redundante para los tipos “Peticiones a Largo Plazo” y “Embarazada”).</value>
|
||||||
|
</data>
|
||||||
|
<data name="If you are editing an existing request, a third option appears." xml:space="preserve">
|
||||||
|
<value>Si está editando una petición existente, aparece una tercera opción.</value>
|
||||||
|
</data>
|
||||||
|
<data name="“Expire Immediately” will make the request expire when it is saved." xml:space="preserve">
|
||||||
|
<value>“Expirará Inmediatamente” hará que la petición expirará cuando se guarda.</value>
|
||||||
|
</data>
|
||||||
|
<data name="Apart from the icons on the request maintenance page, this is the only way to expire “Long-Term Requests” and “Expecting” requests, but it can be used for any request type." xml:space="preserve">
|
||||||
|
<value>Aparte de los iconos de la página de mantenimiento de las peticiones, ésta es la única otra forma de expirar peticiones del tipos “Peticiones a Largo Plazo” y “Embarazada”, pero puede ser utilizada para cualquier tipo de petición.</value>
|
||||||
|
</data>
|
||||||
|
<data name="This is the text of the request." xml:space="preserve">
|
||||||
|
<value>Este es el texto de la petición.</value>
|
||||||
|
</data>
|
||||||
|
<data name="The editor provides many formatting capabilities, including “Spell Check as you Type” (enabled by default), “Paste from Word”, and “Paste Plain”, as well as “Source” view, if you want to edit the HTML yourself." xml:space="preserve">
|
||||||
|
<value>El editor ofrece muchas capacidades de formato, como "El Corrector Ortográfico al Escribir" (habilitado predeterminado), "Pegar desde Word" y "Pegar sin formato", así como "Código Fuente" punto de vista, si quieres editar el código HTML usted mismo.</value>
|
||||||
|
</data>
|
||||||
|
<data name="It also supports undo and redo, and the editor supports full-screen mode. Hover over each icon to see what each button does." xml:space="preserve">
|
||||||
|
<value>También es compatible con deshacer y rehacer, y el editor soporta modo de pantalla completa. Pase el ratón sobre cada icono para ver qué hace cada botón.</value>
|
||||||
|
</data>
|
||||||
|
</root>
|
||||||
112
src/UI/Resources/Views/Help/Requests/Maintain.es.resx
Normal file
112
src/UI/Resources/Views/Help/Requests/Maintain.es.resx
Normal file
@@ -0,0 +1,112 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<root>
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="metadata">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="assembly">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<data name="From this page, you can add, edit, and delete your current requests." xml:space="preserve">
|
||||||
|
<value>Desde esta página, usted puede agregar, editar y borrar sus peticiones actuales.</value>
|
||||||
|
</data>
|
||||||
|
<data name="You can also restore requests that may have expired, but should be made active once again." xml:space="preserve">
|
||||||
|
<value>También puede restaurar peticiones que han caducado, sino que debe ser activa, una vez más.</value>
|
||||||
|
</data>
|
||||||
|
<data name="To add a request, click the icon or text in the center of the page, below the title and above the list of requests for your group." xml:space="preserve">
|
||||||
|
<value>Para agregar una petición, haga clic en el icono o el texto en el centro de la página, debajo del título y por encima de la lista de peticiones para su grupo.</value>
|
||||||
|
</data>
|
||||||
|
<data name="If you are looking for a particular requests, enter some text in the search box and click “Search”." xml:space="preserve">
|
||||||
|
<value>Si está buscando una solicitud en particular, ingrese un texto en el cuadro de búsqueda y haga clic en “Buscar”.</value>
|
||||||
|
</data>
|
||||||
|
<data name="PrayerTracker will search the Requestor/Subject and Request Text fields (case-insensitively) of both active and inactive requests." xml:space="preserve">
|
||||||
|
<value>SeguidorOración buscará los campos de Solicitante / Asunto y Texto de solicitud (sin distinción de mayúsculas y minúsculas) de solicitudes activas e inactivas.</value>
|
||||||
|
</data>
|
||||||
|
<data name="The results will be displayed in the same format as the original Maintain Requests page, so the buttons described below will work the same for those requests as well." xml:space="preserve">
|
||||||
|
<value>Los resultados se mostrarán en el mismo formato que la página de solicitudes de mantenimiento original, por lo que los botones que se describen a continuación funcionarán igual para esas solicitudes.</value>
|
||||||
|
</data>
|
||||||
|
<data name="They will also be displayed in pages, if there are a lot of results; the number per page is configurable by small group." xml:space="preserve">
|
||||||
|
<value>También se mostrarán en las páginas, si hay muchos resultados; el número por página es configurable por grupos pequeños.</value>
|
||||||
|
</data>
|
||||||
|
<data name="To edit a request, click the pencil icon; it's the first icon under the “Actions” column heading." xml:space="preserve">
|
||||||
|
<value>Para editar una petición, haga clic en el icono de lápiz, el primer icono bajo el título de columna “Acciones”.</value>
|
||||||
|
</data>
|
||||||
|
<data name="For active requests, the second icon is an eye with a slash through it; clicking this icon will expire the request immediately." xml:space="preserve">
|
||||||
|
<value>Para las peticiones activas, el segundo icono es un ojo con una barra a través de él; Si hace clic en este icono, la petición se cancelará inmediatamente.</value>
|
||||||
|
</data>
|
||||||
|
<data name="This is equivalent to editing the request, selecting “Expire Immediately”, and saving it." xml:space="preserve">
|
||||||
|
<value>Esto equivale a editar la petición, seleccionar "Expirará Inmediatamente" y guardarla.</value>
|
||||||
|
</data>
|
||||||
|
<data name="When the page is first displayed, it does not display inactive requests." xml:space="preserve">
|
||||||
|
<value>Cuando la página se muestra por primera vez, que no muestra peticiones inactivos.</value>
|
||||||
|
</data>
|
||||||
|
<data name="However, clicking the link at the bottom of the page will refresh the page with the inactive requests shown." xml:space="preserve">
|
||||||
|
<value>Sin embargo, al hacer clic en el vínculo en la parte inferior de la página se actualizará la página con las peticiones se muestran inactivos.</value>
|
||||||
|
</data>
|
||||||
|
<data name="The middle icon will look like an eye; clicking it will restore the request as an active request." xml:space="preserve">
|
||||||
|
<value>El icono del centro se verá como un ojo; Haciendo clic en él, restaurará la petición como una petición activa.</value>
|
||||||
|
</data>
|
||||||
|
<data name="The last updated date will be current, and the request is set to expire normally." xml:space="preserve">
|
||||||
|
<value>La última fecha actualizada será actual, y la petición se establece para caducar normalmente.</value>
|
||||||
|
</data>
|
||||||
|
<data name="Deleting a request is contrary to the intent of PrayerTracker, as you can retrieve requests that have expired." xml:space="preserve">
|
||||||
|
<value>Eliminación de una petición es contraria a la intención de SeguidorOración, como se puede recuperar peticiones que han expirado.</value>
|
||||||
|
</data>
|
||||||
|
<data name="However, if there is a request that needs to be deleted, clicking the trash can icon in the “Actions” column will allow you to do it." xml:space="preserve">
|
||||||
|
<value>Sin embargo, si hay una solicitud que debe ser eliminado, haga clic en el icono de la papelera en la columna “Acciones” le permitirá hacerlo.</value>
|
||||||
|
</data>
|
||||||
|
<data name="Use this option carefully, as these deletions cannot be undone; once a request is deleted, it is gone for good." xml:space="preserve">
|
||||||
|
<value>Utilice esta opción con cuidado, ya que estas supresiones no se puede deshacer, una vez a la petición se ha borrado, ha desaparecido para siempre.</value>
|
||||||
|
</data>
|
||||||
|
</root>
|
||||||
94
src/UI/Resources/Views/Help/Requests/View.es.resx
Normal file
94
src/UI/Resources/Views/Help/Requests/View.es.resx
Normal file
@@ -0,0 +1,94 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<root>
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="metadata">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="assembly">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<data name="From this page, you can view the request list (for today or for the next Sunday), view a printable version of the list, and e-mail the list to the members of your group." xml:space="preserve">
|
||||||
|
<value>Desde esta página, puede ver la lista de peticiones (para hoy o para el próximo Domingo), ver una versión imprimible de la lista, y por correo electrónico la lista de los miembros de su grupo.</value>
|
||||||
|
</data>
|
||||||
|
<data name="(NOTE: If you are logged in as a group member, the only option you will see is to view a printable list.)" xml:space="preserve">
|
||||||
|
<value>(NOTA: Si usted está registrado como miembro de la clase, la única opción que se ve es para ver una lista para imprimir.)</value>
|
||||||
|
</data>
|
||||||
|
<data name="This will modify the date for the list, so it will look like it is currently next Sunday." xml:space="preserve">
|
||||||
|
<value>Esto modificará la fecha de la lista, por lo que se verá como es en la actualidad el próximo Domingo.</value>
|
||||||
|
</data>
|
||||||
|
<data name="This can be used, for example, to see what requests will expire, or allow you to print a list with Sunday's date on Saturday evening." xml:space="preserve">
|
||||||
|
<value>Esto puede ser usado, por ejemplo, para ver lo que peticiones de caducidad, ni le permite imprimir una lista con la fecha del Domingo en la noche del Sábado.</value>
|
||||||
|
</data>
|
||||||
|
<data name="Note that this link does not appear if it is Sunday." xml:space="preserve">
|
||||||
|
<value>Tenga en cuenta que este enlace no aparece si es Domingo.</value>
|
||||||
|
</data>
|
||||||
|
<data name="Clicking this link will display the list in a format that is suitable for printing; it does not have the normal PrayerTracker header across the top." xml:space="preserve">
|
||||||
|
<value>Hacer clic en este vínculo, se muestra la lista en un formato que sea adecuado para imprimir, sino que no tiene el encabezado normal de SeguidorOración en la parte superior.</value>
|
||||||
|
</data>
|
||||||
|
<data name="Once you have clicked the link, you can print it using your browser's standard “Print” functionality." xml:space="preserve">
|
||||||
|
<value>Una vez que haya hecho clic en el enlace, se puede imprimir con el navegador estándar de “Imprimir” funcionalidad.</value>
|
||||||
|
</data>
|
||||||
|
<data name="Clicking this link will send the list you are currently viewing to your group members." xml:space="preserve">
|
||||||
|
<value>Al hacer clic en este enlace le enviará la lista que está viendo en ese momento a los miembros del grupo.</value>
|
||||||
|
</data>
|
||||||
|
<data name="The page will remind you that you are about to do that, and ask for your confirmation." xml:space="preserve">
|
||||||
|
<value>La página te recordará que estás a punto de hacerlo, y pedir su confirmación.</value>
|
||||||
|
</data>
|
||||||
|
<data name="If you proceed, you will see a page that shows to whom the list was sent, and what the list looked like." xml:space="preserve">
|
||||||
|
<value>Si continúa, usted verá una página que muestra a la que la lista fue enviado, y lo que la lista parecía.</value>
|
||||||
|
</data>
|
||||||
|
<data name="You may safely use your browser's “Back” button to navigate away from the page." xml:space="preserve">
|
||||||
|
<value>Usted puede utilizar con seguridad de su navegador botón “Atrás” para navegar fuera de la página.</value>
|
||||||
|
</data>
|
||||||
|
</root>
|
||||||
73
src/UI/Resources/Views/Help/SmallGroup/Announcement.es.resx
Normal file
73
src/UI/Resources/Views/Help/SmallGroup/Announcement.es.resx
Normal file
@@ -0,0 +1,73 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<root>
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="metadata">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="assembly">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<data name="This is the text of the announcement you would like to send." xml:space="preserve">
|
||||||
|
<value>Este es el texto del anuncio que desea enviar.</value>
|
||||||
|
</data>
|
||||||
|
<data name="It functions the same way as the text box on the <a href="../requests/edit#request">“Edit Request” page</a>." xml:space="preserve">
|
||||||
|
<value>Funciona de la misma forma que el cuadro de texto en <a href="../requests/edit#request">la página “Editar la Petición”</a>.</value>
|
||||||
|
</data>
|
||||||
|
<data name="Without this box checked, the text of the announcement will only be e-mailed to your group members." xml:space="preserve">
|
||||||
|
<value>Sin esta caja marcada, el texto del anuncio sólo será por correo electrónico a los miembros del su grupo.</value>
|
||||||
|
</data>
|
||||||
|
<data name="If you check this box, however, the text of the announcement will be added to your prayer list under the section you have selected." xml:space="preserve">
|
||||||
|
<value>Si marca esta caja, sin embargo, el texto del anuncio será añadido a su lista de oración en la sección que ha seleccionado.</value>
|
||||||
|
</data>
|
||||||
|
</root>
|
||||||
82
src/UI/Resources/Views/Help/SmallGroup/Members.es.resx
Normal file
82
src/UI/Resources/Views/Help/SmallGroup/Members.es.resx
Normal file
@@ -0,0 +1,82 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<root>
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="metadata">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="assembly">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<data name="From this page, you can add, edit, and delete the e-mail addresses for your group." xml:space="preserve">
|
||||||
|
<value>Desde esta página, usted puede agregar, editar y eliminar las direcciones de correo electrónico para su grupo.</value>
|
||||||
|
</data>
|
||||||
|
<data name="To add an e-mail address, click the icon or text in the center of the page, below the title and above the list of addresses for your group." xml:space="preserve">
|
||||||
|
<value>Para agregar una dirección de correo electrónico, haga clic en el icono o el texto en el centro de la página, debajo del título y por encima de la lista de direcciones para su grupo.</value>
|
||||||
|
</data>
|
||||||
|
<data name="To edit an e-mail address, click the pencil icon; it's the first icon under the “Actions” column heading." xml:space="preserve">
|
||||||
|
<value>Para editar una dirección de correo electrónico, haga clic en el icono de lápiz, es el primer icono bajo el título de columna “Acciones”.</value>
|
||||||
|
</data>
|
||||||
|
<data name="This will allow you to update the name and/or the e-mail address for that member." xml:space="preserve">
|
||||||
|
<value>Esto le permitirá actualizar el nombre y / o la dirección de correo electrónico para ese miembro.</value>
|
||||||
|
</data>
|
||||||
|
<data name="To delete an e-mail address, click the trash can icon in the “Actions” column." xml:space="preserve">
|
||||||
|
<value>Para eliminar una dirección de correo electrónico, haga clic en el icono de la papelera en la columna “Acciones”.</value>
|
||||||
|
</data>
|
||||||
|
<data name="Note that once an e-mail address has been deleted, it is gone." xml:space="preserve">
|
||||||
|
<value>Tenga en cuenta que una vez que la dirección de correo electrónico se ha eliminado, se ha ido.</value>
|
||||||
|
</data>
|
||||||
|
<data name="(Of course, if you delete it in error, you can enter it again using the “Add” instructions above.)" xml:space="preserve">
|
||||||
|
<value>(Por supuesto, si usted lo elimine por error, se puede entrar de nuevo utilizando la opción “Agregar” instrucciones de arriba.)</value>
|
||||||
|
</data>
|
||||||
|
</root>
|
||||||
205
src/UI/Resources/Views/Help/SmallGroup/Preferences.es.resx
Normal file
205
src/UI/Resources/Views/Help/SmallGroup/Preferences.es.resx
Normal file
@@ -0,0 +1,205 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<root>
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="metadata">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="assembly">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<data name="This page allows you to change how your prayer request list looks and behaves." xml:space="preserve">
|
||||||
|
<value>Esta página le permite cambiar la forma en que su lista de peticiones de la oración se ve y se comporta.</value>
|
||||||
|
</data>
|
||||||
|
<data name="Each section is addressed below." xml:space="preserve">
|
||||||
|
<value>Cada sección se aborda más adelante.</value>
|
||||||
|
</data>
|
||||||
|
<data name="When a regular request goes this many days without being updated, it expires and no longer appears on the request list." xml:space="preserve">
|
||||||
|
<value>Cuando una petición regular va esta cantidad de días sin actualizar, caduca y ya no aparece en la lista de peticiones.</value>
|
||||||
|
</data>
|
||||||
|
<data name="Note that the categories “Long-Term Requests” and “Expecting” never expire automatically." xml:space="preserve">
|
||||||
|
<value>Tenga en cuenta que las categorías “Peticiones a Largo Plazo” y “Embarazada” no expirará automáticamente.</value>
|
||||||
|
</data>
|
||||||
|
<data name="Requests that have been updated within this many days are identified by a hollow circle for their bullet, as opposed to a filled circle for other requests." xml:space="preserve">
|
||||||
|
<value>Peticiones que han sido actualizadas dentro de esta cantidad de días se identifican por un círculo hueco para su bala, en oposición a un círculo relleno para otras peticiones.</value>
|
||||||
|
</data>
|
||||||
|
<data name="All categories respect this setting." xml:space="preserve">
|
||||||
|
<value>Todas las categorías respetar esta opción.</value>
|
||||||
|
</data>
|
||||||
|
<data name="If you do a typo correction on a request, if you do not check the box to update the date, this setting will change the bullet." xml:space="preserve">
|
||||||
|
<value>Si usted hace una corrección de errata en una petición, si no marque la caja para actualizar la fecha, este valor va a cambiar la bala.</value>
|
||||||
|
</data>
|
||||||
|
<data name="(NOTE: In the plain-text e-mail, new requests are bulleted with a “+” symbol, and old are bulleted with a “-” symbol.)" xml:space="preserve">
|
||||||
|
<value>(NOTA: En el texto sin formato de correo electrónico, las nuevas solicitudes se identifican con un símbolo “+”, y pide a los viejos se identifican con un símbolo “-”.)</value>
|
||||||
|
</data>
|
||||||
|
<data name="Requests that have not been updated in this many weeks are identified by an italic font on the “Maintain Requests” page, to remind you to seek updates on these requests so that your prayers can stay relevant and current." xml:space="preserve">
|
||||||
|
<value>Peticiones que no han sido actualizados en esta semana muchos se identifican con un tipo de letra cursiva en la página “Mantener las Peticiones”, para recordarle que debe buscar novedades en estas peticiones para que vuestras oraciones pueden permanecer relevante y actual.</value>
|
||||||
|
</data>
|
||||||
|
<data name="By default, requests are sorted within each group by the last updated date, with the most recent on top." xml:space="preserve">
|
||||||
|
<value>De forma predeterminada, las solicitudes se ordenan dentro de cada grupo por la última fecha de actualización, con el más reciente en la parte superior.</value>
|
||||||
|
</data>
|
||||||
|
<data name="If you would prefer to have the list sorted by requestor or subject rather than by date, select “Sort by Requestor Name” instead." xml:space="preserve">
|
||||||
|
<value>Si prefiere tener la lista ordenada por el solicitante o el sujeto en vez de por fecha, seleccione “Ordenar por Nombre del Solicitante” en su lugar.</value>
|
||||||
|
</data>
|
||||||
|
<data name="PrayerTracker must put an name and e-mail address in the “from” position of each e-mail it sends." xml:space="preserve">
|
||||||
|
<value>SeguidorOración debe poner el nombre y la dirección de correo electrónico en el “de” posición de cada correo electrónico que envía.</value>
|
||||||
|
</data>
|
||||||
|
<data name="The default name is “PrayerTracker”, and the default e-mail address is “prayer@bitbadger.solutions”." xml:space="preserve">
|
||||||
|
<value>El nombre predeterminado es “PrayerTracker”, y el valor predeterminado dirección de correo electrónico es “prayer@bitbadger.solutions”.</value>
|
||||||
|
</data>
|
||||||
|
<data name="This will work, but any bounced e-mails and out-of-office replies will be sent to that address (which is not even a real address)." xml:space="preserve">
|
||||||
|
<value>Esto funciona, pero los mensajes devueltos, y las respuestas de fuera de la oficina serán enviados a esa dirección (que no es ni siquiera una dirección real).</value>
|
||||||
|
</data>
|
||||||
|
<data name="Changing at least the e-mail address to your address will ensure that you receive these e-mails, and can prune your e-mail list accordingly." xml:space="preserve">
|
||||||
|
<value>Cambiar por lo menos la dirección de correo electrónico a su dirección se asegurará de que usted recibe estos correos electrónicos, y se puede podar su lista de correo electrónico en consecuencia.</value>
|
||||||
|
</data>
|
||||||
|
<data name="This is the default e-mail format for your group." xml:space="preserve">
|
||||||
|
<value>Este es el valor predeterminado formato de correo electrónico para su grupo.</value>
|
||||||
|
</data>
|
||||||
|
<data name="The PrayerTracker default is HTML, which sends the list just as you see it online." xml:space="preserve">
|
||||||
|
<value>El valor predeterminado de SeguidorOración es HTML, el cual envía la lista al igual que usted lo ve en el sitio.</value>
|
||||||
|
</data>
|
||||||
|
<data name="However, some e-mail clients may not display this properly, so you can choose to default the email to a plain-text format, which does not have colors, italics, or other formatting." xml:space="preserve">
|
||||||
|
<value>Sin embargo, algunos clientes de correo electrónico no puede mostrar esto correctamente, para que pueda elegir el correo electrónico a un formato de texto plano predeterminadas, que no tiene colores, cursiva, u otro formato.</value>
|
||||||
|
</data>
|
||||||
|
<data name="The setting on this page is the group default; you can select a format for each recipient on the “Maintain Group Members” page." xml:space="preserve">
|
||||||
|
<value>La configuración en esta página es el valor predeterminado del grupo, se puede seleccionar un formato para cada destinatario de la página “Mantener los Miembros del Grupo”.</value>
|
||||||
|
</data>
|
||||||
|
<data name="You can customize the colors that are used for the headings and lines in your request list." xml:space="preserve">
|
||||||
|
<value>Usted puede personalizar los colores que se utilizan para las partidas y líneas en su lista de peticiones.</value>
|
||||||
|
</data>
|
||||||
|
<data name="You can select one of the 16 named colors in the drop down lists, or you can “mix your own” using red, green, and blue (RGB) values between 0 and 255." xml:space="preserve">
|
||||||
|
<value>Puede seleccionar uno de los 16 colores con nombre en las listas desplegables, o puede “mezclar su propia” en colores rojo, verde y azul (RGB) valores entre 0 y 255.</value>
|
||||||
|
</data>
|
||||||
|
<data name="There is a link on the bottom of the page to a color list with more names and their RGB values, if you're really feeling artistic." xml:space="preserve">
|
||||||
|
<value>Hay un enlace en la parte inferior de la página para una lista de colores con más nombres y sus valores RGB, si realmente estás sintiendo artística.</value>
|
||||||
|
</data>
|
||||||
|
<data name="The background color cannot be changed." xml:space="preserve">
|
||||||
|
<value>El color de fondo no puede ser cambiado.</value>
|
||||||
|
</data>
|
||||||
|
<data name="There are two options for fonts that will be used in the prayer request list." xml:space="preserve">
|
||||||
|
<value>Hay dos opciones para las fuentes que se utilizarán en la lista de peticiones de oración.</value>
|
||||||
|
</data>
|
||||||
|
<data name="“Native Fonts” uses a list of fonts that will render the prayer requests in the best available font for their device, whether that is a desktop or laptop computer, mobile device, or tablet." xml:space="preserve">
|
||||||
|
<value>“Fuentes Nativas” utiliza una lista de fuentes que representarán las peticiones de oración en la mejor fuente disponible para su dispositivo, ya sea una computadora de escritorio o portátil, un dispositivo móvil o una tableta.</value>
|
||||||
|
</data>
|
||||||
|
<data name="(This is the default for new small groups.)" xml:space="preserve">
|
||||||
|
<value>(Este es el valor predeterminado para los nuevos grupos pequeños).</value>
|
||||||
|
</data>
|
||||||
|
<data name="“Named Fonts” uses a comma-separated list of fonts that you specify." xml:space="preserve">
|
||||||
|
<value>“Fuentes con Nombre” utiliza una lista de fuentes separadas por comas que usted especifica.</value>
|
||||||
|
</data>
|
||||||
|
<data name="A warning is good here; just because you have an obscure font and like the way that it looks does not mean that others have that same font." xml:space="preserve">
|
||||||
|
<value>Una advertencia de que es bueno aquí, sólo porque usted tiene una fuente oscura y gusta la forma en que se vea no significa que los demás tienen de que la misma fuente.</value>
|
||||||
|
</data>
|
||||||
|
<data name="It is generally best to stick with the fonts that come with Windows - fonts like “Arial”, “Times New Roman”, “Tahoma”, and “Comic Sans MS”." xml:space="preserve">
|
||||||
|
<value>Generalmente es mejor quedarse con las fuentes que vienen con Windows - Fuentes como “Arial”, “Times New Roman”, “Tahoma”, y “Comic Sans MS”.</value>
|
||||||
|
</data>
|
||||||
|
<data name="You should also end the font list with either “serif” or “sans-serif”, which will use the browser's default serif (like “Times New Roman”) or sans-serif (like “Arial”) font." xml:space="preserve">
|
||||||
|
<value>También debe poner fin a la lista de fuentes, ya sea con “serif” o el “sans-serif”, que utilizará el fuente serif predeterminado (como “Times New Roman”) o el fuente sans-serif predeterminado (como “Arial”).</value>
|
||||||
|
</data>
|
||||||
|
<data name="This is the point size to use for each." xml:space="preserve">
|
||||||
|
<value>Este es el tamaño de punto a utilizar para cada uno.</value>
|
||||||
|
</data>
|
||||||
|
<data name="The default for the heading is 16pt, and the default for the text is 12pt." xml:space="preserve">
|
||||||
|
<value>El valor predeterminado para el título es 16 puntos, y el valor por defecto para el texto es 12 puntos.</value>
|
||||||
|
</data>
|
||||||
|
<data name="If your group is comprised mostly of people who prefer large print, the following settings will make your list look like the typical large-print publication:" xml:space="preserve">
|
||||||
|
<value>Si el grupo está compuesta en su mayoría de la gente que prefiere letras grandes, los siguientes ajustes harán que su lista de parecerse a la típica la publicación “Letra Grande”:</value>
|
||||||
|
</data>
|
||||||
|
<data name="Named Fonts: "Times New Roman",serif" xml:space="preserve">
|
||||||
|
<value>Fuentes con Nombre: "Times New Roman",serif</value>
|
||||||
|
</data>
|
||||||
|
<data name="The group's request list can be either public, private, or password-protected." xml:space="preserve">
|
||||||
|
<value>La lista de peticiones del grupo puede ser pública, privada o protegida por contraseña.</value>
|
||||||
|
</data>
|
||||||
|
<data name="Public lists are available without logging in, and private lists are only available online to administrators (though the list can still be sent via e-mail by an administrator)." xml:space="preserve">
|
||||||
|
<value>Las listas públicas están disponibles sin iniciar sesión, y listas privadas sólo están disponibles en línea a los administradores (aunque la lista todavía puede ser enviado por correo electrónico por el administrador).</value>
|
||||||
|
</data>
|
||||||
|
<data name="Password-protected lists allow group members to log in and view the current request list online, using the “Group Log On” link and providing this password." xml:space="preserve">
|
||||||
|
<value>Protegidos con contraseña listas permiten miembros del grupo iniciar sesión y ver la lista de peticiones actual en el sito, utilizando el "Iniciar Sesión como Grupo" enlace y proporcionar la contraseña.</value>
|
||||||
|
</data>
|
||||||
|
<data name="As this is a shared password, it is stored in plain text, so you can easily see what it is." xml:space="preserve">
|
||||||
|
<value>Como se trata de una contraseña compartida, se almacena en texto plano, así que usted puede ver fácilmente lo que es.</value>
|
||||||
|
</data>
|
||||||
|
<data name="If you select “Password Protected” but do not enter a password, the list remains private, which is also the default value." xml:space="preserve">
|
||||||
|
<value>Si selecciona "Protegido por Contraseña" pero no introduce una contraseña, la lista sigue siendo privado, que también es el valor predeterminado.</value>
|
||||||
|
</data>
|
||||||
|
<data name="(Changing this password will force all members of the group who logged in with the “Remember Me” box checked to provide the new password.)" xml:space="preserve">
|
||||||
|
<value>(Cambiar esta contraseña obligará a todos los miembros del grupo que se iniciar sesión en el "Acuérdate de Mí" caja marcada para proporcionar la nueva contraseña.)</value>
|
||||||
|
</data>
|
||||||
|
<data name="This is the time zone that you would like to use for your group." xml:space="preserve">
|
||||||
|
<value>Esta es la zona horaria que desea utilizar para su clase.</value>
|
||||||
|
</data>
|
||||||
|
<data name="If you do not see your time zone listed, just <a href="mailto:daniel@bitbadger.solutions?subject=PrayerTracker+Time+Zone">contact Daniel</a> and tell him what time zone you need." xml:space="preserve">
|
||||||
|
<value>Si no puede ver la zona horaria en la lista, ponte en <a href="daniel@bitbadger.solutions?subject=Zona+Horaria+por+SeguidorOración">contacto con Daniel</a> y decirle lo que la zona horaria que usted necesita.</value>
|
||||||
|
</data>
|
||||||
|
<data name="As small groups use PrayerTracker, they accumulate many expired requests." xml:space="preserve">
|
||||||
|
<value>A medida que los grupos pequeños utilizan SeguidorOración, acumulan muchas solicitudes caducadas.</value>
|
||||||
|
</data>
|
||||||
|
<data name="When lists of requests include expired requests, the results will be broken up into pages." xml:space="preserve">
|
||||||
|
<value>Cuando las listas de solicitudes que incluyen solicitudes caducadas, los resultados se dividirán en páginas.</value>
|
||||||
|
</data>
|
||||||
|
<data name="The default value is 100 requests per page, but may be set as low as 10 or as high as 255." xml:space="preserve">
|
||||||
|
<value>El valor predeterminado es de 100 solicitudes por página, pero se puede establecer tan bajo como 10 o tan alto como 255.</value>
|
||||||
|
</data>
|
||||||
|
<data name="PrayerTracker can display the last date a request was updated, at the end of the request text." xml:space="preserve">
|
||||||
|
<value>SeguidorOración puede mostrar la última fecha en que se actualizó una solicitud, al final del texto de solicitud.</value>
|
||||||
|
</data>
|
||||||
|
<data name="By default, it does not." xml:space="preserve">
|
||||||
|
<value>Por defecto, no lo hace.</value>
|
||||||
|
</data>
|
||||||
|
<data name="If you select a short date, it will show “(as of 10/11/2015)” (for October 11, 2015); if you select a long date, it will show “(as of Sunday, October 11, 2015)”." xml:space="preserve">
|
||||||
|
<value>Si selecciona una fecha corta, se mostrará “(como de 11/10/2015)” (para el 11 de octubre de 2015); si selecciona una fecha larga, se mostrará “(como de domingo, 11 de octubre de 2015)”.</value>
|
||||||
|
</data>
|
||||||
|
</root>
|
||||||
79
src/UI/Resources/Views/Help/User/LogOn.es.resx
Normal file
79
src/UI/Resources/Views/Help/User/LogOn.es.resx
Normal file
@@ -0,0 +1,79 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<root>
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="metadata">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="assembly">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<data name="This page allows you to log on to PrayerTracker." xml:space="preserve">
|
||||||
|
<value>Esta página le permite acceder a SeguidorOración.</value>
|
||||||
|
</data>
|
||||||
|
<data name="There are two different levels of access for PrayerTracker - user and group." xml:space="preserve">
|
||||||
|
<value>Hay dos diferentes niveles de acceso para SeguidorOración - el usuario y el grupo.</value>
|
||||||
|
</data>
|
||||||
|
<data name="Enter your e-mail address and password into the appropriate boxes, then select your group." xml:space="preserve">
|
||||||
|
<value>Introduzca su dirección de correo electrónico y contraseña en las cajas apropiadas y seleccione su grupo.</value>
|
||||||
|
</data>
|
||||||
|
<data name="If you want PrayerTracker to remember you on your computer, click the “Remember Me” box before clicking the “Log On” button." xml:space="preserve">
|
||||||
|
<value>Si desea que SeguidorOración que le recuerde en su ordenador, haga clic en “Acuérdate de Mí” caja antes de pulsar el “Iniciar Sesión” botón.</value>
|
||||||
|
</data>
|
||||||
|
<data name="If your group has defined a password to use to allow you to view their request list online, select your group from the drop down list, then enter the group password into the appropriate box." xml:space="preserve">
|
||||||
|
<value>Si el grupo se ha definido una contraseña para usar que le permite ver su lista de peticiones en línea, seleccionar el grupo en la lista desplegable y introduzca la contraseña del grupo en la caja correspondiente.</value>
|
||||||
|
</data>
|
||||||
|
<data name="If you want PrayerTracker to remember your group, click the “Remember Me” box before clicking the “Log On” button." xml:space="preserve">
|
||||||
|
<value>Si desea que SeguidorOración recuerde su grupo, haga clic en “Acuérdate de Mí” caja antes de pulsar el “Iniciar Sesión” botón.</value>
|
||||||
|
</data>
|
||||||
|
</root>
|
||||||
79
src/UI/Resources/Views/Help/User/Password.es.resx
Normal file
79
src/UI/Resources/Views/Help/User/Password.es.resx
Normal file
@@ -0,0 +1,79 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<root>
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="metadata">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="assembly">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<data name="This page will let you change your password." xml:space="preserve">
|
||||||
|
<value>Esta página le permitirá cambiar su contraseña.</value>
|
||||||
|
</data>
|
||||||
|
<data name="Enter your existing password in the top box, then enter your new password in the bottom two boxes." xml:space="preserve">
|
||||||
|
<value>Ingrese su contraseña actual en la caja superior y introduzca la nueva contraseña en la parte inferior dos cajas.</value>
|
||||||
|
</data>
|
||||||
|
<data name="Entering your existing password is a security measure; with the “Remember Me” box on the log in page, this will prevent someone else who may be using your computer from being able to simply go to the site and change your password." xml:space="preserve">
|
||||||
|
<value>Al entrar su contraseña actual es una medida de seguridad, con el “Acuérdate de Mí” caja de la página inicio de sesión, esto evitará que otra persona que pueda estar usando su computadora de la posibilidad de simplemente ir a el sitio y cambiar la contraseña.</value>
|
||||||
|
</data>
|
||||||
|
<data name="If you cannot remember your existing password, we cannot retrieve it, but we can set it to something known so that you can then change it to your password." xml:space="preserve">
|
||||||
|
<value>Si no recuerdas tu contraseña actual, no podemos recuperar, pero podemos ponerlo en algo que se conoce de modo que usted puede cambiarlo a su contraseña.</value>
|
||||||
|
</data>
|
||||||
|
<data name="PrayerTracker+Password+Help" xml:space="preserve">
|
||||||
|
<value>Ayuda+de+Contraseña+de+SeguidorOración</value>
|
||||||
|
</data>
|
||||||
|
<data name="Click here to request help resetting your password." xml:space="preserve">
|
||||||
|
<value>Haga clic aquí para solicitar ayuda para restablecer su contraseña.</value>
|
||||||
|
</data>
|
||||||
|
</root>
|
||||||
@@ -54,8 +54,8 @@ let announcement isAdmin ctx viewInfo =
|
|||||||
label [ _for (nameof model.RequestType) ] [ locStr s["Request Type"] ]
|
label [ _for (nameof model.RequestType) ] [ locStr s["Request Type"] ]
|
||||||
reqTypes
|
reqTypes
|
||||||
|> Seq.ofList
|
|> Seq.ofList
|
||||||
|> Seq.map (fun (typ, desc) -> PrayerRequestType.toCode typ, desc.Value)
|
|> Seq.map (fun (typ, desc) -> string typ, desc.Value)
|
||||||
|> selectList (nameof model.RequestType) (PrayerRequestType.toCode Announcement) []
|
|> selectList (nameof model.RequestType) (string Announcement) []
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
div [ _fieldRow ] [ submit [] "send" s["Send Announcement"] ]
|
div [ _fieldRow ] [ submit [] "send" s["Send Announcement"] ]
|
||||||
@@ -99,7 +99,7 @@ let edit (model : EditSmallGroup) (churches : Church list) ctx viewInfo =
|
|||||||
"", selectDefault s["Select Church"].Value
|
"", selectDefault s["Select Church"].Value
|
||||||
yield! churches |> List.map (fun c -> shortGuid c.Id.Value, c.Name)
|
yield! churches |> List.map (fun c -> shortGuid c.Id.Value, c.Name)
|
||||||
}
|
}
|
||||||
|> selectList (nameof model.ChurchId) model.ChurchId [ _required ]
|
|> selectList (nameof model.ChurchId) model.ChurchId [ _required ]
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
div [ _fieldRow ] [ submit [] "save" s["Save Group"] ]
|
div [ _fieldRow ] [ submit [] "save" s["Save Group"] ]
|
||||||
@@ -273,7 +273,7 @@ let members (members : Member list) (emailTypes : Map<string, LocalizedString>)
|
|||||||
div [ _class "cell" ] [ str mbr.Name ]
|
div [ _class "cell" ] [ str mbr.Name ]
|
||||||
div [ _class "cell" ] [ str mbr.Email ]
|
div [ _class "cell" ] [ str mbr.Email ]
|
||||||
div [ _class "cell" ] [
|
div [ _class "cell" ] [
|
||||||
locStr emailTypes[defaultArg (mbr.Format |> Option.map EmailFormat.toCode) ""]
|
locStr emailTypes[defaultArg (mbr.Format |> Option.map string) ""]
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
@@ -476,7 +476,7 @@ let preferences (model : EditPreferences) ctx viewInfo =
|
|||||||
locStr s["Custom Color"]
|
locStr s["Custom Color"]
|
||||||
]
|
]
|
||||||
space
|
space
|
||||||
input [ _type "color"
|
input [ _type "color"
|
||||||
_name (nameof model.LineColor)
|
_name (nameof model.LineColor)
|
||||||
_id $"{nameof model.LineColor}_Color"
|
_id $"{nameof model.LineColor}_Color"
|
||||||
_value (colorToHex model.LineColor)
|
_value (colorToHex model.LineColor)
|
||||||
@@ -589,7 +589,7 @@ let preferences (model : EditPreferences) ctx viewInfo =
|
|||||||
"", selectDefault s["Select"].Value
|
"", selectDefault s["Select"].Value
|
||||||
yield!
|
yield!
|
||||||
TimeZones.all
|
TimeZones.all
|
||||||
|> List.map (fun tz -> TimeZoneId.toString tz, (TimeZones.name tz s).Value)
|
|> List.map (fun tz -> string tz, (TimeZones.name tz s).Value)
|
||||||
}
|
}
|
||||||
|> selectList (nameof model.TimeZone) model.TimeZone [ _required ]
|
|> selectList (nameof model.TimeZone) model.TimeZone [ _required ]
|
||||||
]
|
]
|
||||||
@@ -5,7 +5,7 @@ open System
|
|||||||
open Giraffe
|
open Giraffe
|
||||||
|
|
||||||
/// Parse a short-GUID-based ID from a string
|
/// Parse a short-GUID-based ID from a string
|
||||||
let idFromShort<'T> (f : Guid -> 'T) strValue =
|
let idFromShort<'T> (f: Guid -> 'T) strValue =
|
||||||
(ShortGuid.toGuid >> f) strValue
|
(ShortGuid.toGuid >> f) strValue
|
||||||
|
|
||||||
/// Format a GUID as a short GUID
|
/// Format a GUID as a short GUID
|
||||||
@@ -19,19 +19,21 @@ let emptyGuid = shortGuid Guid.Empty
|
|||||||
module String =
|
module String =
|
||||||
|
|
||||||
/// string.Trim()
|
/// string.Trim()
|
||||||
let trim (str: string) = str.Trim ()
|
let trim (str: string) =
|
||||||
|
str.Trim()
|
||||||
|
|
||||||
/// 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 -> String.concat "" [ haystack[0..idx - 1]; replacement; haystack[idx + needle.Length..] ]
|
| idx -> String.concat "" [ haystack[0..idx - 1]; replacement; haystack[idx + needle.Length..] ]
|
||||||
|
|
||||||
/// Convert a string to an option, with null, blank, and whitespace becoming None
|
/// Convert a string to an option, with null, blank, and whitespace becoming None
|
||||||
let noneIfBlank (str : string) =
|
let noneIfBlank (str: string) =
|
||||||
match str with
|
match str with
|
||||||
| null -> None
|
| null -> None
|
||||||
| it when it.Trim () = "" -> None
|
| it when it.Trim () = "" -> None
|
||||||
@@ -46,12 +48,12 @@ let stripTags allowedTags input =
|
|||||||
let stripHtmlExp = Regex @"(<\/?[^>]+>)"
|
let stripHtmlExp = Regex @"(<\/?[^>]+>)"
|
||||||
let mutable output = input
|
let mutable output = input
|
||||||
for tag in stripHtmlExp.Matches input do
|
for tag in stripHtmlExp.Matches input do
|
||||||
let htmlTag = tag.Value.ToLower ()
|
let htmlTag = tag.Value.ToLower()
|
||||||
let shouldReplace =
|
let shouldReplace =
|
||||||
allowedTags
|
allowedTags
|
||||||
|> List.fold (fun acc t ->
|
|> List.fold (fun acc t ->
|
||||||
acc
|
acc
|
||||||
|| htmlTag.IndexOf $"<{t}>" = 0
|
|| htmlTag.IndexOf $"<%s{t}>" = 0
|
||||||
|| htmlTag.IndexOf $"<{t} " = 0
|
|| htmlTag.IndexOf $"<{t} " = 0
|
||||||
|| htmlTag.IndexOf $"</{t}" = 0) false
|
|| htmlTag.IndexOf $"</{t}" = 0) false
|
||||||
|> not
|
|> not
|
||||||
@@ -60,7 +62,7 @@ let stripTags allowedTags input =
|
|||||||
|
|
||||||
|
|
||||||
/// Wrap a string at the specified number of characters
|
/// Wrap a string at the specified number of characters
|
||||||
let wordWrap charPerLine (input : string) =
|
let wordWrap charPerLine (input: string) =
|
||||||
match input.Length with
|
match input.Length with
|
||||||
| len when len <= charPerLine -> input
|
| len when len <= charPerLine -> input
|
||||||
| _ ->
|
| _ ->
|
||||||
@@ -92,7 +94,7 @@ let wordWrap charPerLine (input : string) =
|
|||||||
|> String.concat "\n"
|
|> String.concat "\n"
|
||||||
|
|
||||||
/// Modify the text returned by CKEditor into the format we need for request and announcement text
|
/// Modify the text returned by CKEditor into the format we need for request and announcement text
|
||||||
let ckEditorToText (text : string) =
|
let ckEditorToText (text: string) =
|
||||||
[ "\n\t", ""
|
[ "\n\t", ""
|
||||||
" ", " "
|
" ", " "
|
||||||
" ", "  "
|
" ", "  "
|
||||||
@@ -100,7 +102,7 @@ let ckEditorToText (text : string) =
|
|||||||
"</p>", ""
|
"</p>", ""
|
||||||
"<p>", ""
|
"<p>", ""
|
||||||
]
|
]
|
||||||
|> List.fold (fun (txt : string) (x, y) -> String.replace x y txt) text
|
|> List.fold (fun (txt: string) (x, y) -> String.replace x y txt) text
|
||||||
|> String.trim
|
|> String.trim
|
||||||
|
|
||||||
|
|
||||||
@@ -119,8 +121,8 @@ let htmlToPlainText html =
|
|||||||
|> String.replace "\u00a0" " "
|
|> String.replace "\u00a0" " "
|
||||||
|
|
||||||
/// Get the second portion of a tuple as a string
|
/// Get the second portion of a tuple as a string
|
||||||
let sndAsString x = (snd >> string) x
|
let sndAsString x =
|
||||||
|
(snd >> string) x
|
||||||
|
|
||||||
/// Make a URL with query string parameters
|
/// Make a URL with query string parameters
|
||||||
let makeUrl url qs =
|
let makeUrl url qs =
|
||||||
@@ -10,32 +10,31 @@ open PrayerTracker.Entities
|
|||||||
module ReferenceList =
|
module ReferenceList =
|
||||||
|
|
||||||
/// A localized list of the AsOfDateDisplay DU cases
|
/// A localized list of the AsOfDateDisplay DU cases
|
||||||
let asOfDateList (s : IStringLocalizer) = [
|
let asOfDateList (s: IStringLocalizer) = [
|
||||||
AsOfDateDisplay.toCode NoDisplay, s["Do not display the “as of” date"]
|
string NoDisplay, s["Do not display the “as of” date"]
|
||||||
AsOfDateDisplay.toCode ShortDate, s["Display a short “as of” date"]
|
string ShortDate, s["Display a short “as of” date"]
|
||||||
AsOfDateDisplay.toCode LongDate, s["Display a full “as of” date"]
|
string LongDate, 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
|
||||||
let defaultType =
|
let defaultType =
|
||||||
s[match def with HtmlFormat -> "HTML Format" | PlainTextFormat -> "Plain-Text Format"].Value
|
s[match def with HtmlFormat -> "HTML Format" | PlainTextFormat -> "Plain-Text Format"].Value
|
||||||
seq {
|
seq {
|
||||||
"", LocalizedString ("", $"""{s["Group Default"].Value} ({defaultType})""")
|
"", LocalizedString ("", $"""{s["Group Default"].Value} ({defaultType})""")
|
||||||
EmailFormat.toCode HtmlFormat, s["HTML Format"]
|
string HtmlFormat, s["HTML Format"]
|
||||||
EmailFormat.toCode PlainTextFormat, s["Plain-Text Format"]
|
string PlainTextFormat, s["Plain-Text Format"]
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A list of expiration options
|
/// A list of expiration options
|
||||||
let expirationList (s : IStringLocalizer) includeExpireNow = [
|
let expirationList (s: IStringLocalizer) includeExpireNow =
|
||||||
Expiration.toCode Automatic, s["Expire Normally"]
|
[ string Automatic, s["Expire Normally"]
|
||||||
Expiration.toCode Manual, s["Request Never Expires"]
|
string Manual, s["Request Never Expires"]
|
||||||
if includeExpireNow then Expiration.toCode Forced, s["Expire Immediately"]
|
if includeExpireNow then string Forced, s["Expire Immediately"] ]
|
||||||
]
|
|
||||||
|
|
||||||
/// A list of request types
|
/// A list of request types
|
||||||
let requestTypeList (s : IStringLocalizer) = [
|
let requestTypeList (s: IStringLocalizer) = [
|
||||||
CurrentRequest, s["Current Requests"]
|
CurrentRequest, s["Current Requests"]
|
||||||
LongTermRequest, s["Long-Term Requests"]
|
LongTermRequest, s["Long-Term Requests"]
|
||||||
PraiseReport, s["Praise Reports"]
|
PraiseReport, s["Praise Reports"]
|
||||||
@@ -55,15 +54,15 @@ type MessageLevel =
|
|||||||
|
|
||||||
/// Support for the MessageLevel type
|
/// Support for the MessageLevel type
|
||||||
module MessageLevel =
|
module MessageLevel =
|
||||||
|
|
||||||
/// Convert a message level to its string representation
|
/// Convert a message level to its string representation
|
||||||
let toString =
|
let toString =
|
||||||
function
|
function
|
||||||
| Info -> "Info"
|
| Info -> "Info"
|
||||||
| Warning -> "WARNING"
|
| Warning -> "WARNING"
|
||||||
| Error -> "ERROR"
|
| Error -> "ERROR"
|
||||||
|
|
||||||
let toCssClass level = (toString level).ToLowerInvariant ()
|
let toCssClass level = (toString level).ToLowerInvariant()
|
||||||
|
|
||||||
|
|
||||||
/// This is used to create a message that is displayed to the user
|
/// This is used to create a message that is displayed to the user
|
||||||
@@ -71,31 +70,31 @@ module MessageLevel =
|
|||||||
type UserMessage =
|
type UserMessage =
|
||||||
{ /// The type
|
{ /// The type
|
||||||
Level : MessageLevel
|
Level : MessageLevel
|
||||||
|
|
||||||
/// The actual message
|
/// The actual message
|
||||||
Text : HtmlString
|
Text : HtmlString
|
||||||
|
|
||||||
/// The description (further information)
|
/// The description (further information)
|
||||||
Description : HtmlString option
|
Description : HtmlString option
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Support for the UserMessage type
|
/// Support for the UserMessage type
|
||||||
module UserMessage =
|
module UserMessage =
|
||||||
|
|
||||||
/// Error message template
|
/// Error message template
|
||||||
let error =
|
let error =
|
||||||
{ Level = Error
|
{ Level = Error
|
||||||
Text = HtmlString.Empty
|
Text = HtmlString.Empty
|
||||||
Description = None
|
Description = None
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Warning message template
|
/// Warning message template
|
||||||
let warning =
|
let warning =
|
||||||
{ Level = Warning
|
{ Level = Warning
|
||||||
Text = HtmlString.Empty
|
Text = HtmlString.Empty
|
||||||
Description = None
|
Description = None
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Info message template
|
/// Info message template
|
||||||
let info =
|
let info =
|
||||||
{ Level = Info
|
{ Level = Info
|
||||||
@@ -105,13 +104,13 @@ module UserMessage =
|
|||||||
|
|
||||||
/// The template with which the content will be rendered
|
/// The template with which the content will be rendered
|
||||||
type LayoutType =
|
type LayoutType =
|
||||||
|
|
||||||
/// A full page load
|
/// A full page load
|
||||||
| FullPage
|
| FullPage
|
||||||
|
|
||||||
/// A response that will provide a new body tag
|
/// A response that will provide a new body tag
|
||||||
| PartialPage
|
| PartialPage
|
||||||
|
|
||||||
/// A response that will replace the page content
|
/// A response that will replace the page content
|
||||||
| ContentOnly
|
| ContentOnly
|
||||||
|
|
||||||
@@ -123,38 +122,38 @@ open NodaTime
|
|||||||
type AppViewInfo =
|
type AppViewInfo =
|
||||||
{ /// CSS files for the page
|
{ /// CSS files for the page
|
||||||
Style : string list
|
Style : string list
|
||||||
|
|
||||||
/// The link for help on this page
|
/// The link for help on this page
|
||||||
HelpLink : string option
|
HelpLink : string option
|
||||||
|
|
||||||
/// Messages to be displayed to the user
|
/// Messages to be displayed to the user
|
||||||
Messages : UserMessage list
|
Messages : UserMessage list
|
||||||
|
|
||||||
/// The current version of PrayerTracker
|
/// The current version of PrayerTracker
|
||||||
Version : string
|
Version : string
|
||||||
|
|
||||||
/// The ticks when the request started
|
/// The ticks when the request started
|
||||||
RequestStart : Instant
|
RequestStart : Instant
|
||||||
|
|
||||||
/// The currently logged on user, if there is one
|
/// The currently logged on user, if there is one
|
||||||
User : User option
|
User : User option
|
||||||
|
|
||||||
/// The currently logged on small group, if there is one
|
/// The currently logged on small group, if there is one
|
||||||
Group : SmallGroup option
|
Group : SmallGroup option
|
||||||
|
|
||||||
/// The layout with which the content will be rendered
|
/// The layout with which the content will be rendered
|
||||||
Layout : LayoutType
|
Layout : LayoutType
|
||||||
|
|
||||||
/// Scoped styles for this view
|
/// Scoped styles for this view
|
||||||
ScopedStyle : string list
|
ScopedStyle : string list
|
||||||
|
|
||||||
/// A JavaScript function to run on page load
|
/// A JavaScript function to run on page load
|
||||||
OnLoadScript : string option
|
OnLoadScript : string option
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Support for the AppViewInfo type
|
/// Support for the AppViewInfo type
|
||||||
module AppViewInfo =
|
module AppViewInfo =
|
||||||
|
|
||||||
/// A fresh version that can be populated to process the current request
|
/// A fresh version that can be populated to process the current request
|
||||||
let fresh =
|
let fresh =
|
||||||
{ Style = []
|
{ Style = []
|
||||||
@@ -168,11 +167,11 @@ module AppViewInfo =
|
|||||||
ScopedStyle = []
|
ScopedStyle = []
|
||||||
OnLoadScript = None
|
OnLoadScript = None
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Add scoped styles to the given view info object
|
/// Add scoped styles to the given view info object
|
||||||
let withScopedStyles styles viewInfo =
|
let withScopedStyles styles viewInfo =
|
||||||
{ viewInfo with ScopedStyle = styles }
|
{ viewInfo with ScopedStyle = styles }
|
||||||
|
|
||||||
/// Add an onload action to the given view info object
|
/// Add an onload action to the given view info object
|
||||||
let withOnLoadScript script viewInfo =
|
let withOnLoadScript script viewInfo =
|
||||||
{ viewInfo with OnLoadScript = Some script }
|
{ viewInfo with OnLoadScript = Some script }
|
||||||
@@ -183,18 +182,18 @@ module AppViewInfo =
|
|||||||
type Announcement =
|
type Announcement =
|
||||||
{ /// Whether the announcement should be sent to the class or to PrayerTracker users
|
{ /// Whether the announcement should be sent to the class or to PrayerTracker users
|
||||||
SendToClass : string
|
SendToClass : string
|
||||||
|
|
||||||
/// The text of the announcement
|
/// The text of the announcement
|
||||||
Text : string
|
Text : string
|
||||||
|
|
||||||
/// Whether this announcement should be added to the "Announcements" of the prayer list
|
/// Whether this announcement should be added to the "Announcements" of the prayer list
|
||||||
AddToRequestList : bool option
|
AddToRequestList : bool option
|
||||||
|
|
||||||
/// The ID of the request type to which this announcement should be added
|
/// The ID of the request type to which this announcement should be added
|
||||||
RequestType : string option
|
RequestType : string option
|
||||||
}
|
}
|
||||||
with
|
with
|
||||||
|
|
||||||
/// The text of the announcement, in plain text
|
/// The text of the announcement, in plain text
|
||||||
member this.PlainText
|
member this.PlainText
|
||||||
with get () = (htmlToPlainText >> wordWrap 74) this.Text
|
with get () = (htmlToPlainText >> wordWrap 74) this.Text
|
||||||
@@ -205,19 +204,19 @@ with
|
|||||||
type AssignGroups =
|
type AssignGroups =
|
||||||
{ /// The Id of the user being assigned
|
{ /// The Id of the user being assigned
|
||||||
UserId : string
|
UserId : string
|
||||||
|
|
||||||
/// The full name of the user being assigned
|
/// The full name of the user being assigned
|
||||||
UserName : string
|
UserName : string
|
||||||
|
|
||||||
/// The Ids of the small groups to which the user is authorized
|
/// The Ids of the small groups to which the user is authorized
|
||||||
SmallGroups : string
|
SmallGroups : string
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Support for the AssignGroups type
|
/// Support for the AssignGroups type
|
||||||
module AssignGroups =
|
module AssignGroups =
|
||||||
|
|
||||||
/// Create an instance of this form from an existing user
|
/// Create an instance of this form from an existing user
|
||||||
let fromUser (user : User) =
|
let fromUser (user: User) =
|
||||||
{ UserId = shortGuid user.Id.Value
|
{ UserId = shortGuid user.Id.Value
|
||||||
UserName = user.Name
|
UserName = user.Name
|
||||||
SmallGroups = ""
|
SmallGroups = ""
|
||||||
@@ -229,10 +228,10 @@ module AssignGroups =
|
|||||||
type ChangePassword =
|
type ChangePassword =
|
||||||
{ /// The user's current password
|
{ /// The user's current password
|
||||||
OldPassword : string
|
OldPassword : string
|
||||||
|
|
||||||
/// The user's new password
|
/// The user's new password
|
||||||
NewPassword : string
|
NewPassword : string
|
||||||
|
|
||||||
/// The user's new password, confirmed
|
/// The user's new password, confirmed
|
||||||
NewPasswordConfirm : string
|
NewPasswordConfirm : string
|
||||||
}
|
}
|
||||||
@@ -243,29 +242,29 @@ type ChangePassword =
|
|||||||
type EditChurch =
|
type EditChurch =
|
||||||
{ /// The ID of the church
|
{ /// The ID of the church
|
||||||
ChurchId : string
|
ChurchId : string
|
||||||
|
|
||||||
/// The name of the church
|
/// The name of the church
|
||||||
Name : string
|
Name : string
|
||||||
|
|
||||||
/// The city for the church
|
/// The city for the church
|
||||||
City : string
|
City : string
|
||||||
|
|
||||||
/// The state or province for the church
|
/// The state or province for the church
|
||||||
State : string
|
State : string
|
||||||
|
|
||||||
/// Whether the church has an active Virtual Prayer Room interface
|
/// Whether the church has an active Virtual Prayer Room interface
|
||||||
HasInterface : bool option
|
HasInterface : bool option
|
||||||
|
|
||||||
/// The address for the interface
|
/// The address for the interface
|
||||||
InterfaceAddress : string option
|
InterfaceAddress : string option
|
||||||
}
|
}
|
||||||
with
|
with
|
||||||
|
|
||||||
/// Is this a new church?
|
/// Is this a new church?
|
||||||
member this.IsNew = emptyGuid = this.ChurchId
|
member this.IsNew = emptyGuid = this.ChurchId
|
||||||
|
|
||||||
/// Populate a church from this form
|
/// Populate a church from this form
|
||||||
member this.PopulateChurch (church : Church) =
|
member this.PopulateChurch (church: Church) =
|
||||||
{ church with
|
{ church with
|
||||||
Name = this.Name
|
Name = this.Name
|
||||||
City = this.City
|
City = this.City
|
||||||
@@ -276,9 +275,9 @@ with
|
|||||||
|
|
||||||
/// Support for the EditChurch type
|
/// Support for the EditChurch type
|
||||||
module EditChurch =
|
module EditChurch =
|
||||||
|
|
||||||
/// Create an instance from an existing church
|
/// Create an instance from an existing church
|
||||||
let fromChurch (church : Church) =
|
let fromChurch (church: Church) =
|
||||||
{ ChurchId = shortGuid church.Id.Value
|
{ ChurchId = shortGuid church.Id.Value
|
||||||
Name = church.Name
|
Name = church.Name
|
||||||
City = church.City
|
City = church.City
|
||||||
@@ -286,7 +285,7 @@ module EditChurch =
|
|||||||
HasInterface = match church.HasVpsInterface with true -> Some true | false -> None
|
HasInterface = match church.HasVpsInterface with true -> Some true | false -> None
|
||||||
InterfaceAddress = church.InterfaceAddress
|
InterfaceAddress = church.InterfaceAddress
|
||||||
}
|
}
|
||||||
|
|
||||||
/// An instance to use for adding churches
|
/// An instance to use for adding churches
|
||||||
let empty =
|
let empty =
|
||||||
{ ChurchId = emptyGuid
|
{ ChurchId = emptyGuid
|
||||||
@@ -297,38 +296,38 @@ module EditChurch =
|
|||||||
InterfaceAddress = None
|
InterfaceAddress = None
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// Form for adding/editing small group members
|
/// Form for adding/editing small group members
|
||||||
[<CLIMutable; NoComparison; NoEquality>]
|
[<CLIMutable; NoComparison; NoEquality>]
|
||||||
type EditMember =
|
type EditMember =
|
||||||
{ /// The Id for this small group member (not user-entered)
|
{ /// The Id for this small group member (not user-entered)
|
||||||
MemberId : string
|
MemberId : string
|
||||||
|
|
||||||
/// The name of the member
|
/// The name of the member
|
||||||
Name : string
|
Name : string
|
||||||
|
|
||||||
/// The e-mail address
|
/// The e-mail address
|
||||||
Email : string
|
Email : string
|
||||||
|
|
||||||
/// The e-mail format
|
/// The e-mail format
|
||||||
Format : string
|
Format : string
|
||||||
}
|
}
|
||||||
with
|
with
|
||||||
|
|
||||||
/// Is this a new member?
|
/// Is this a new member?
|
||||||
member this.IsNew = emptyGuid = this.MemberId
|
member this.IsNew = emptyGuid = this.MemberId
|
||||||
|
|
||||||
/// Support for the EditMember type
|
/// Support for the EditMember type
|
||||||
module EditMember =
|
module EditMember =
|
||||||
|
|
||||||
/// Create an instance from an existing member
|
/// Create an instance from an existing member
|
||||||
let fromMember (mbr : Member) =
|
let fromMember (mbr: Member) =
|
||||||
{ MemberId = shortGuid mbr.Id.Value
|
{ MemberId = shortGuid mbr.Id.Value
|
||||||
Name = mbr.Name
|
Name = mbr.Name
|
||||||
Email = mbr.Email
|
Email = mbr.Email
|
||||||
Format = match mbr.Format with Some fmt -> EmailFormat.toCode fmt | None -> ""
|
Format = mbr.Format |> Option.map string |> Option.defaultValue ""
|
||||||
}
|
}
|
||||||
|
|
||||||
/// An empty instance
|
/// An empty instance
|
||||||
let empty =
|
let empty =
|
||||||
{ MemberId = emptyGuid
|
{ MemberId = emptyGuid
|
||||||
@@ -343,68 +342,68 @@ module EditMember =
|
|||||||
type EditPreferences =
|
type EditPreferences =
|
||||||
{ /// The number of days after which requests are automatically expired
|
{ /// The number of days after which requests are automatically expired
|
||||||
ExpireDays : int
|
ExpireDays : int
|
||||||
|
|
||||||
/// The number of days requests are considered "new"
|
/// The number of days requests are considered "new"
|
||||||
DaysToKeepNew : int
|
DaysToKeepNew : int
|
||||||
|
|
||||||
/// The number of weeks after which a long-term requests is flagged as requiring an update
|
/// The number of weeks after which a long-term requests is flagged as requiring an update
|
||||||
LongTermUpdateWeeks : int
|
LongTermUpdateWeeks : int
|
||||||
|
|
||||||
/// Whether to sort by updated date or requestor/subject
|
/// Whether to sort by updated date or requestor/subject
|
||||||
RequestSort : string
|
RequestSort : string
|
||||||
|
|
||||||
/// The name from which e-mail will be sent
|
/// The name from which e-mail will be sent
|
||||||
EmailFromName : string
|
EmailFromName : string
|
||||||
|
|
||||||
/// The e-mail address from which e-mail will be sent
|
/// The e-mail address from which e-mail will be sent
|
||||||
EmailFromAddress : string
|
EmailFromAddress : string
|
||||||
|
|
||||||
/// The default e-mail type for this group
|
/// The default e-mail type for this group
|
||||||
DefaultEmailType : string
|
DefaultEmailType : string
|
||||||
|
|
||||||
/// Whether the heading line color uses named colors or R/G/B
|
/// Whether the heading line color uses named colors or R/G/B
|
||||||
LineColorType : string
|
LineColorType : string
|
||||||
|
|
||||||
/// The named color for the heading lines
|
/// The named color for the heading lines
|
||||||
LineColor : string
|
LineColor : string
|
||||||
|
|
||||||
/// Whether the heading text color uses named colors or R/G/B
|
/// Whether the heading text color uses named colors or R/G/B
|
||||||
HeadingColorType : string
|
HeadingColorType : string
|
||||||
|
|
||||||
/// The named color for the heading text
|
/// The named color for the heading text
|
||||||
HeadingColor : string
|
HeadingColor : string
|
||||||
|
|
||||||
/// Whether the class uses the native font stack
|
/// Whether the class uses the native font stack
|
||||||
IsNative : bool
|
IsNative : bool
|
||||||
|
|
||||||
/// The fonts to use for the list
|
/// The fonts to use for the list
|
||||||
Fonts : string option
|
Fonts : string option
|
||||||
|
|
||||||
/// The font size for the heading text
|
/// The font size for the heading text
|
||||||
HeadingFontSize : int
|
HeadingFontSize : int
|
||||||
|
|
||||||
/// The font size for the list text
|
/// The font size for the list text
|
||||||
ListFontSize : int
|
ListFontSize : int
|
||||||
|
|
||||||
/// The time zone for the class
|
/// The time zone for the class
|
||||||
TimeZone : string
|
TimeZone : string
|
||||||
|
|
||||||
/// The list visibility
|
/// The list visibility
|
||||||
Visibility : int
|
Visibility : int
|
||||||
|
|
||||||
/// The small group password
|
/// The small group password
|
||||||
GroupPassword : string option
|
GroupPassword : string option
|
||||||
|
|
||||||
/// The page size for search / inactive requests
|
/// The page size for search / inactive requests
|
||||||
PageSize : int
|
PageSize : int
|
||||||
|
|
||||||
/// How the as-of date should be displayed
|
/// How the as-of date should be displayed
|
||||||
AsOfDate : string
|
AsOfDate : string
|
||||||
}
|
}
|
||||||
with
|
with
|
||||||
|
|
||||||
/// Set the properties of a small group based on the form's properties
|
/// Set the properties of a small group based on the form's properties
|
||||||
member this.PopulatePreferences (prefs : ListPreferences) =
|
member this.PopulatePreferences (prefs: ListPreferences) =
|
||||||
let isPublic, grpPw =
|
let isPublic, grpPw =
|
||||||
if this.Visibility = GroupVisibility.PublicList then true, ""
|
if this.Visibility = GroupVisibility.PublicList then true, ""
|
||||||
elif this.Visibility = GroupVisibility.HasPassword then false, (defaultArg this.GroupPassword "")
|
elif this.Visibility = GroupVisibility.HasPassword then false, (defaultArg this.GroupPassword "")
|
||||||
@@ -413,10 +412,10 @@ with
|
|||||||
DaysToExpire = this.ExpireDays
|
DaysToExpire = this.ExpireDays
|
||||||
DaysToKeepNew = this.DaysToKeepNew
|
DaysToKeepNew = this.DaysToKeepNew
|
||||||
LongTermUpdateWeeks = this.LongTermUpdateWeeks
|
LongTermUpdateWeeks = this.LongTermUpdateWeeks
|
||||||
RequestSort = RequestSort.fromCode this.RequestSort
|
RequestSort = RequestSort.Parse this.RequestSort
|
||||||
EmailFromName = this.EmailFromName
|
EmailFromName = this.EmailFromName
|
||||||
EmailFromAddress = this.EmailFromAddress
|
EmailFromAddress = this.EmailFromAddress
|
||||||
DefaultEmailType = EmailFormat.fromCode this.DefaultEmailType
|
DefaultEmailType = EmailFormat.Parse this.DefaultEmailType
|
||||||
LineColor = this.LineColor
|
LineColor = this.LineColor
|
||||||
HeadingColor = this.HeadingColor
|
HeadingColor = this.HeadingColor
|
||||||
Fonts = if this.IsNative || Option.isNone this.Fonts then "native" else this.Fonts.Value
|
Fonts = if this.IsNative || Option.isNone this.Fonts then "native" else this.Fonts.Value
|
||||||
@@ -426,21 +425,21 @@ with
|
|||||||
IsPublic = isPublic
|
IsPublic = isPublic
|
||||||
GroupPassword = grpPw
|
GroupPassword = grpPw
|
||||||
PageSize = this.PageSize
|
PageSize = this.PageSize
|
||||||
AsOfDateDisplay = AsOfDateDisplay.fromCode this.AsOfDate
|
AsOfDateDisplay = AsOfDateDisplay.Parse this.AsOfDate
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Support for the EditPreferences type
|
/// Support for the EditPreferences type
|
||||||
module EditPreferences =
|
module EditPreferences =
|
||||||
/// Populate an edit form from existing preferences
|
/// Populate an edit form from existing preferences
|
||||||
let fromPreferences (prefs : ListPreferences) =
|
let fromPreferences (prefs: ListPreferences) =
|
||||||
let setType (x : string) = match x.StartsWith "#" with true -> "RGB" | false -> "Name"
|
let setType (x : string) = match x.StartsWith "#" with true -> "RGB" | false -> "Name"
|
||||||
{ ExpireDays = prefs.DaysToExpire
|
{ ExpireDays = prefs.DaysToExpire
|
||||||
DaysToKeepNew = prefs.DaysToKeepNew
|
DaysToKeepNew = prefs.DaysToKeepNew
|
||||||
LongTermUpdateWeeks = prefs.LongTermUpdateWeeks
|
LongTermUpdateWeeks = prefs.LongTermUpdateWeeks
|
||||||
RequestSort = RequestSort.toCode prefs.RequestSort
|
RequestSort = string prefs.RequestSort
|
||||||
EmailFromName = prefs.EmailFromName
|
EmailFromName = prefs.EmailFromName
|
||||||
EmailFromAddress = prefs.EmailFromAddress
|
EmailFromAddress = prefs.EmailFromAddress
|
||||||
DefaultEmailType = EmailFormat.toCode prefs.DefaultEmailType
|
DefaultEmailType = string prefs.DefaultEmailType
|
||||||
LineColorType = setType prefs.LineColor
|
LineColorType = setType prefs.LineColor
|
||||||
LineColor = prefs.LineColor
|
LineColor = prefs.LineColor
|
||||||
HeadingColorType = setType prefs.HeadingColor
|
HeadingColorType = setType prefs.HeadingColor
|
||||||
@@ -449,10 +448,10 @@ module EditPreferences =
|
|||||||
Fonts = if prefs.Fonts = "native" then None else Some prefs.Fonts
|
Fonts = if prefs.Fonts = "native" then None else Some prefs.Fonts
|
||||||
HeadingFontSize = prefs.HeadingFontSize
|
HeadingFontSize = prefs.HeadingFontSize
|
||||||
ListFontSize = prefs.TextFontSize
|
ListFontSize = prefs.TextFontSize
|
||||||
TimeZone = TimeZoneId.toString prefs.TimeZoneId
|
TimeZone = string prefs.TimeZoneId
|
||||||
GroupPassword = Some prefs.GroupPassword
|
GroupPassword = Some prefs.GroupPassword
|
||||||
PageSize = prefs.PageSize
|
PageSize = prefs.PageSize
|
||||||
AsOfDate = AsOfDateDisplay.toCode prefs.AsOfDateDisplay
|
AsOfDate = string prefs.AsOfDateDisplay
|
||||||
Visibility =
|
Visibility =
|
||||||
if prefs.IsPublic then GroupVisibility.PublicList
|
if prefs.IsPublic then GroupVisibility.PublicList
|
||||||
elif prefs.GroupPassword = "" then GroupVisibility.PrivateList
|
elif prefs.GroupPassword = "" then GroupVisibility.PrivateList
|
||||||
@@ -465,51 +464,51 @@ module EditPreferences =
|
|||||||
type EditRequest =
|
type EditRequest =
|
||||||
{ /// The ID of the request
|
{ /// The ID of the request
|
||||||
RequestId : string
|
RequestId : string
|
||||||
|
|
||||||
/// The type of the request
|
/// The type of the request
|
||||||
RequestType : string
|
RequestType : string
|
||||||
|
|
||||||
/// The date of the request
|
/// The date of the request
|
||||||
EnteredDate : string option
|
EnteredDate : string option
|
||||||
|
|
||||||
/// Whether to update the date or not
|
/// Whether to update the date or not
|
||||||
SkipDateUpdate : bool option
|
SkipDateUpdate : bool option
|
||||||
|
|
||||||
/// The requestor or subject
|
/// The requestor or subject
|
||||||
Requestor : string option
|
Requestor : string option
|
||||||
|
|
||||||
/// How this request is expired
|
/// How this request is expired
|
||||||
Expiration : string
|
Expiration : string
|
||||||
|
|
||||||
/// The text of the request
|
/// The text of the request
|
||||||
Text : string
|
Text : string
|
||||||
}
|
}
|
||||||
with
|
with
|
||||||
|
|
||||||
/// Is this a new request?
|
/// Is this a new request?
|
||||||
member this.IsNew = emptyGuid = this.RequestId
|
member this.IsNew = emptyGuid = this.RequestId
|
||||||
|
|
||||||
/// Support for the EditRequest type
|
/// Support for the EditRequest type
|
||||||
module EditRequest =
|
module EditRequest =
|
||||||
|
|
||||||
/// An empty instance to use for new requests
|
/// An empty instance to use for new requests
|
||||||
let empty =
|
let empty =
|
||||||
{ RequestId = emptyGuid
|
{ RequestId = emptyGuid
|
||||||
RequestType = PrayerRequestType.toCode CurrentRequest
|
RequestType = string CurrentRequest
|
||||||
EnteredDate = None
|
EnteredDate = None
|
||||||
SkipDateUpdate = None
|
SkipDateUpdate = None
|
||||||
Requestor = None
|
Requestor = None
|
||||||
Expiration = Expiration.toCode Automatic
|
Expiration = string Automatic
|
||||||
Text = ""
|
Text = ""
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Create an instance from an existing request
|
/// Create an instance from an existing request
|
||||||
let fromRequest (req : PrayerRequest) =
|
let fromRequest (req: PrayerRequest) =
|
||||||
{ empty with
|
{ empty with
|
||||||
RequestId = shortGuid req.Id.Value
|
RequestId = shortGuid req.Id.Value
|
||||||
RequestType = PrayerRequestType.toCode req.RequestType
|
RequestType = string req.RequestType
|
||||||
Requestor = req.Requestor
|
Requestor = req.Requestor
|
||||||
Expiration = Expiration.toCode req.Expiration
|
Expiration = string req.Expiration
|
||||||
Text = req.Text
|
Text = req.Text
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -519,20 +518,20 @@ module EditRequest =
|
|||||||
type EditSmallGroup =
|
type EditSmallGroup =
|
||||||
{ /// The ID of the small group
|
{ /// The ID of the small group
|
||||||
SmallGroupId : string
|
SmallGroupId : string
|
||||||
|
|
||||||
/// The name of the small group
|
/// The name of the small group
|
||||||
Name : string
|
Name : string
|
||||||
|
|
||||||
/// The ID of the church to which this small group belongs
|
/// The ID of the church to which this small group belongs
|
||||||
ChurchId : string
|
ChurchId : string
|
||||||
}
|
}
|
||||||
with
|
with
|
||||||
|
|
||||||
/// Is this a new small group?
|
/// Is this a new small group?
|
||||||
member this.IsNew = emptyGuid = this.SmallGroupId
|
member this.IsNew = emptyGuid = this.SmallGroupId
|
||||||
|
|
||||||
/// Populate a small group from this form
|
/// Populate a small group from this form
|
||||||
member this.populateGroup (grp : SmallGroup) =
|
member this.populateGroup (grp: SmallGroup) =
|
||||||
{ grp with
|
{ grp with
|
||||||
Name = this.Name
|
Name = this.Name
|
||||||
ChurchId = idFromShort ChurchId this.ChurchId
|
ChurchId = idFromShort ChurchId this.ChurchId
|
||||||
@@ -540,14 +539,14 @@ with
|
|||||||
|
|
||||||
/// Support for the EditSmallGroup type
|
/// Support for the EditSmallGroup type
|
||||||
module EditSmallGroup =
|
module EditSmallGroup =
|
||||||
|
|
||||||
/// Create an instance from an existing small group
|
/// Create an instance from an existing small group
|
||||||
let fromGroup (grp : SmallGroup) =
|
let fromGroup (grp: SmallGroup) =
|
||||||
{ SmallGroupId = shortGuid grp.Id.Value
|
{ SmallGroupId = shortGuid grp.Id.Value
|
||||||
Name = grp.Name
|
Name = grp.Name
|
||||||
ChurchId = shortGuid grp.ChurchId.Value
|
ChurchId = shortGuid grp.ChurchId.Value
|
||||||
}
|
}
|
||||||
|
|
||||||
/// An empty instance (used when adding a new group)
|
/// An empty instance (used when adding a new group)
|
||||||
let empty =
|
let empty =
|
||||||
{ SmallGroupId = emptyGuid
|
{ SmallGroupId = emptyGuid
|
||||||
@@ -561,32 +560,32 @@ module EditSmallGroup =
|
|||||||
type EditUser =
|
type EditUser =
|
||||||
{ /// The ID of the user
|
{ /// The ID of the user
|
||||||
UserId : string
|
UserId : string
|
||||||
|
|
||||||
/// The first name of the user
|
/// The first name of the user
|
||||||
FirstName : string
|
FirstName : string
|
||||||
|
|
||||||
/// The last name of the user
|
/// The last name of the user
|
||||||
LastName : string
|
LastName : string
|
||||||
|
|
||||||
/// The e-mail address for the user
|
/// The e-mail address for the user
|
||||||
Email : string
|
Email : string
|
||||||
|
|
||||||
/// The password for the user
|
/// The password for the user
|
||||||
Password : string
|
Password : string
|
||||||
|
|
||||||
/// The password hash for the user a second time
|
/// The password hash for the user a second time
|
||||||
PasswordConfirm : string
|
PasswordConfirm : string
|
||||||
|
|
||||||
/// Is this user a PrayerTracker administrator?
|
/// Is this user a PrayerTracker administrator?
|
||||||
IsAdmin : bool option
|
IsAdmin : bool option
|
||||||
}
|
}
|
||||||
with
|
with
|
||||||
|
|
||||||
/// Is this a new user?
|
/// Is this a new user?
|
||||||
member this.IsNew = emptyGuid = this.UserId
|
member this.IsNew = emptyGuid = this.UserId
|
||||||
|
|
||||||
/// Populate a user from the form
|
/// Populate a user from the form
|
||||||
member this.PopulateUser (user : User) hasher =
|
member this.PopulateUser (user: User) hasher =
|
||||||
{ user with
|
{ user with
|
||||||
FirstName = this.FirstName
|
FirstName = this.FirstName
|
||||||
LastName = this.LastName
|
LastName = this.LastName
|
||||||
@@ -599,7 +598,7 @@ with
|
|||||||
|
|
||||||
/// Support for the EditUser type
|
/// Support for the EditUser type
|
||||||
module EditUser =
|
module EditUser =
|
||||||
|
|
||||||
/// An empty instance
|
/// An empty instance
|
||||||
let empty =
|
let empty =
|
||||||
{ UserId = emptyGuid
|
{ UserId = emptyGuid
|
||||||
@@ -610,9 +609,9 @@ module EditUser =
|
|||||||
PasswordConfirm = ""
|
PasswordConfirm = ""
|
||||||
IsAdmin = None
|
IsAdmin = None
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Create an instance from an existing user
|
/// Create an instance from an existing user
|
||||||
let fromUser (user : User) =
|
let fromUser (user: User) =
|
||||||
{ empty with
|
{ empty with
|
||||||
UserId = shortGuid user.Id.Value
|
UserId = shortGuid user.Id.Value
|
||||||
FirstName = user.FirstName
|
FirstName = user.FirstName
|
||||||
@@ -627,17 +626,17 @@ module EditUser =
|
|||||||
type GroupLogOn =
|
type GroupLogOn =
|
||||||
{ /// The ID of the small group to which the user is logging on
|
{ /// The ID of the small group to which the user is logging on
|
||||||
SmallGroupId : string
|
SmallGroupId : string
|
||||||
|
|
||||||
/// The password entered
|
/// The password entered
|
||||||
Password : string
|
Password : string
|
||||||
|
|
||||||
/// Whether to remember the login
|
/// Whether to remember the login
|
||||||
RememberMe : bool option
|
RememberMe : bool option
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Support for the GroupLogOn type
|
/// Support for the GroupLogOn type
|
||||||
module GroupLogOn =
|
module GroupLogOn =
|
||||||
|
|
||||||
/// An empty instance
|
/// An empty instance
|
||||||
let empty =
|
let empty =
|
||||||
{ SmallGroupId = emptyGuid
|
{ SmallGroupId = emptyGuid
|
||||||
@@ -651,27 +650,27 @@ module GroupLogOn =
|
|||||||
type MaintainRequests =
|
type MaintainRequests =
|
||||||
{ /// The requests to be displayed
|
{ /// The requests to be displayed
|
||||||
Requests : PrayerRequest list
|
Requests : PrayerRequest list
|
||||||
|
|
||||||
/// The small group to which the requests belong
|
/// The small group to which the requests belong
|
||||||
SmallGroup : SmallGroup
|
SmallGroup : SmallGroup
|
||||||
|
|
||||||
/// Whether only active requests are included
|
/// Whether only active requests are included
|
||||||
OnlyActive : bool option
|
OnlyActive : bool option
|
||||||
|
|
||||||
/// The search term for the requests
|
/// The search term for the requests
|
||||||
SearchTerm : string option
|
SearchTerm : string option
|
||||||
|
|
||||||
/// The page number of the results
|
/// The page number of the results
|
||||||
PageNbr : int option
|
PageNbr : int option
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Support for the MaintainRequests type
|
/// Support for the MaintainRequests type
|
||||||
module MaintainRequests =
|
module MaintainRequests =
|
||||||
|
|
||||||
/// An empty instance
|
/// An empty instance
|
||||||
let empty =
|
let empty =
|
||||||
{ Requests = []
|
{ Requests = []
|
||||||
SmallGroup = SmallGroup.empty
|
SmallGroup = SmallGroup.Empty
|
||||||
OnlyActive = None
|
OnlyActive = None
|
||||||
SearchTerm = None
|
SearchTerm = None
|
||||||
PageNbr = None
|
PageNbr = None
|
||||||
@@ -683,16 +682,16 @@ module MaintainRequests =
|
|||||||
type Overview =
|
type Overview =
|
||||||
{ /// The total number of active requests
|
{ /// The total number of active requests
|
||||||
TotalActiveReqs : int
|
TotalActiveReqs : int
|
||||||
|
|
||||||
/// The numbers of active requests by request type
|
/// The numbers of active requests by request type
|
||||||
ActiveReqsByType : Map<PrayerRequestType, int>
|
ActiveReqsByType : Map<PrayerRequestType, int>
|
||||||
|
|
||||||
/// A count of all requests
|
/// A count of all requests
|
||||||
AllReqs : int
|
AllReqs : int
|
||||||
|
|
||||||
/// A count of all members
|
/// A count of all members
|
||||||
TotalMembers : int
|
TotalMembers : int
|
||||||
|
|
||||||
/// The users authorized to administer this group
|
/// The users authorized to administer this group
|
||||||
Admins : User list
|
Admins : User list
|
||||||
}
|
}
|
||||||
@@ -703,23 +702,23 @@ type Overview =
|
|||||||
type UserLogOn =
|
type UserLogOn =
|
||||||
{ /// The e-mail address of the user
|
{ /// The e-mail address of the user
|
||||||
Email : string
|
Email : string
|
||||||
|
|
||||||
/// The password entered
|
/// The password entered
|
||||||
Password : string
|
Password : string
|
||||||
|
|
||||||
/// The ID of the small group to which the user is logging on
|
/// The ID of the small group to which the user is logging on
|
||||||
SmallGroupId : string
|
SmallGroupId : string
|
||||||
|
|
||||||
/// Whether to remember the login
|
/// Whether to remember the login
|
||||||
RememberMe : bool option
|
RememberMe : bool option
|
||||||
|
|
||||||
/// The URL to which the user should be redirected once login is successful
|
/// The URL to which the user should be redirected once login is successful
|
||||||
RedirectUrl : string option
|
RedirectUrl : string option
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Support for the UserLogOn type
|
/// Support for the UserLogOn type
|
||||||
module UserLogOn =
|
module UserLogOn =
|
||||||
|
|
||||||
/// An empty instance
|
/// An empty instance
|
||||||
let empty =
|
let empty =
|
||||||
{ Email = ""
|
{ Email = ""
|
||||||
@@ -737,32 +736,32 @@ open Giraffe.ViewEngine
|
|||||||
type RequestList =
|
type RequestList =
|
||||||
{ /// The prayer request list
|
{ /// The prayer request list
|
||||||
Requests : PrayerRequest list
|
Requests : PrayerRequest list
|
||||||
|
|
||||||
/// The date for which this list is being generated
|
/// The date for which this list is being generated
|
||||||
Date : LocalDate
|
Date : LocalDate
|
||||||
|
|
||||||
/// The small group to which this list belongs
|
/// The small group to which this list belongs
|
||||||
SmallGroup : SmallGroup
|
SmallGroup : SmallGroup
|
||||||
|
|
||||||
/// Whether to show the class header
|
/// Whether to show the class header
|
||||||
ShowHeader : bool
|
ShowHeader : bool
|
||||||
|
|
||||||
/// The list of recipients (populated if requests are e-mailed)
|
/// The list of recipients (populated if requests are e-mailed)
|
||||||
Recipients : Member list
|
Recipients : Member list
|
||||||
|
|
||||||
/// Whether the user can e-mail this list
|
/// Whether the user can e-mail this list
|
||||||
CanEmail : bool
|
CanEmail : bool
|
||||||
}
|
}
|
||||||
with
|
with
|
||||||
|
|
||||||
/// Group requests by their type, along with the type and its localized string
|
/// Group requests by their type, along with the type and its localized string
|
||||||
member this.RequestsByType (s : IStringLocalizer) =
|
member this.RequestsByType (s: IStringLocalizer) =
|
||||||
ReferenceList.requestTypeList s
|
ReferenceList.requestTypeList s
|
||||||
|> List.map (fun (typ, name) ->
|
|> List.map (fun (typ, name) ->
|
||||||
let sort =
|
let sort =
|
||||||
match this.SmallGroup.Preferences.RequestSort with
|
match this.SmallGroup.Preferences.RequestSort with
|
||||||
| SortByDate -> Seq.sortByDescending (fun req -> req.UpdatedDate)
|
| SortByDate -> Seq.sortByDescending _.UpdatedDate
|
||||||
| SortByRequestor -> Seq.sortBy (fun req -> req.Requestor)
|
| SortByRequestor -> Seq.sortBy _.Requestor
|
||||||
let reqs =
|
let reqs =
|
||||||
this.Requests
|
this.Requests
|
||||||
|> Seq.ofList
|
|> Seq.ofList
|
||||||
@@ -771,14 +770,14 @@ with
|
|||||||
|> List.ofSeq
|
|> List.ofSeq
|
||||||
typ, name, reqs)
|
typ, name, reqs)
|
||||||
|> List.filter (fun (_, _, reqs) -> not (List.isEmpty reqs))
|
|> List.filter (fun (_, _, reqs) -> not (List.isEmpty reqs))
|
||||||
|
|
||||||
/// Is this request new?
|
/// Is this request new?
|
||||||
member this.IsNew (req : PrayerRequest) =
|
member this.IsNew (req: PrayerRequest) =
|
||||||
let reqDate = req.UpdatedDate.InZone(SmallGroup.timeZone this.SmallGroup).Date
|
let reqDate = req.UpdatedDate.InZone(this.SmallGroup.TimeZone).Date
|
||||||
Period.Between(reqDate, this.Date, PeriodUnits.Days).Days <= this.SmallGroup.Preferences.DaysToKeepNew
|
Period.Between(reqDate, this.Date, PeriodUnits.Days).Days <= this.SmallGroup.Preferences.DaysToKeepNew
|
||||||
|
|
||||||
/// Generate this list as HTML
|
/// Generate this list as HTML
|
||||||
member this.AsHtml (s : IStringLocalizer) =
|
member this.AsHtml (s: IStringLocalizer) =
|
||||||
let p = this.SmallGroup.Preferences
|
let p = this.SmallGroup.Preferences
|
||||||
let asOfSize = Math.Round (float p.TextFontSize * 0.8, 2)
|
let asOfSize = Math.Round (float p.TextFontSize * 0.8, 2)
|
||||||
[ if this.ShowHeader then
|
[ if this.ShowHeader then
|
||||||
@@ -804,7 +803,7 @@ with
|
|||||||
]
|
]
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
let tz = SmallGroup.timeZone this.SmallGroup
|
let tz = this.SmallGroup.TimeZone
|
||||||
reqs
|
reqs
|
||||||
|> List.map (fun req ->
|
|> List.map (fun req ->
|
||||||
let bullet = if this.IsNew req then "circle" else "disc"
|
let bullet = if this.IsNew req then "circle" else "disc"
|
||||||
@@ -822,8 +821,8 @@ with
|
|||||||
| LongDate ->
|
| LongDate ->
|
||||||
let dt =
|
let dt =
|
||||||
match p.AsOfDateDisplay with
|
match p.AsOfDateDisplay with
|
||||||
| ShortDate -> req.UpdatedDate.InZone(tz).Date.ToString ("d", null)
|
| ShortDate -> req.UpdatedDate.InZone(tz).Date.ToString("d", null)
|
||||||
| LongDate -> req.UpdatedDate.InZone(tz).Date.ToString ("D", null)
|
| LongDate -> req.UpdatedDate.InZone(tz).Date.ToString("D", null)
|
||||||
| _ -> ""
|
| _ -> ""
|
||||||
i [ _style $"font-size:%.2f{asOfSize}pt" ] [
|
i [ _style $"font-size:%.2f{asOfSize}pt" ] [
|
||||||
rawText " ("; str s["as of"].Value; str " "; str dt; rawText ")"
|
rawText " ("; str s["as of"].Value; str " "; str dt; rawText ")"
|
||||||
@@ -835,17 +834,17 @@ with
|
|||||||
|> RenderView.AsString.htmlNodes
|
|> RenderView.AsString.htmlNodes
|
||||||
|
|
||||||
/// Generate this list as plain text
|
/// Generate this list as plain text
|
||||||
member this.AsText (s : IStringLocalizer) =
|
member this.AsText (s: IStringLocalizer) =
|
||||||
let tz = SmallGroup.timeZone this.SmallGroup
|
let tz = this.SmallGroup.TimeZone
|
||||||
seq {
|
seq {
|
||||||
this.SmallGroup.Name
|
this.SmallGroup.Name
|
||||||
s["Prayer Requests"].Value
|
s["Prayer Requests"].Value
|
||||||
this.Date.ToString (s["MMMM d, yyyy"].Value, null)
|
this.Date.ToString(s["MMMM d, yyyy"].Value, null)
|
||||||
" "
|
" "
|
||||||
for _, name, reqs in this.RequestsByType s do
|
for _, name, reqs in this.RequestsByType s do
|
||||||
let dashes = String.replicate (name.Value.Length + 4) "-"
|
let dashes = String.replicate (name.Value.Length + 4) "-"
|
||||||
dashes
|
dashes
|
||||||
$" {name.Value.ToUpper ()}"
|
$" {name.Value.ToUpper()}"
|
||||||
dashes
|
dashes
|
||||||
for req in reqs do
|
for req in reqs do
|
||||||
let bullet = if this.IsNew req then "+" else "-"
|
let bullet = if this.IsNew req then "+" else "-"
|
||||||
@@ -855,8 +854,8 @@ with
|
|||||||
| _ ->
|
| _ ->
|
||||||
let dt =
|
let dt =
|
||||||
match this.SmallGroup.Preferences.AsOfDateDisplay with
|
match this.SmallGroup.Preferences.AsOfDateDisplay with
|
||||||
| ShortDate -> req.UpdatedDate.InZone(tz).Date.ToString ("d", null)
|
| ShortDate -> req.UpdatedDate.InZone(tz).Date.ToString("d", null)
|
||||||
| LongDate -> req.UpdatedDate.InZone(tz).Date.ToString ("D", null)
|
| LongDate -> req.UpdatedDate.InZone(tz).Date.ToString("D", null)
|
||||||
| _ -> ""
|
| _ -> ""
|
||||||
$""" ({s["as of"].Value} {dt})"""
|
$""" ({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)
|
||||||
Reference in New Issue
Block a user