Compare commits
No commits in common. "main" and "v0.8" have entirely different histories.
|
@ -1,5 +0,0 @@
|
|||
{
|
||||
"version": 1,
|
||||
"isRoot": true,
|
||||
"tools": {}
|
||||
}
|
5
.gitignore
vendored
5
.gitignore
vendored
|
@ -1,9 +1,6 @@
|
|||
.ionide
|
||||
.idea
|
||||
.fake
|
||||
src/**/bin
|
||||
src/**/obj
|
||||
src/**/appsettings.*.json
|
||||
src/.vs
|
||||
src/.idea
|
||||
|
||||
.fake
|
3
.vscode/settings.json
vendored
3
.vscode/settings.json
vendored
|
@ -1,3 +0,0 @@
|
|||
{
|
||||
"editor.inlayHints.enabled": "offUnlessPressed"
|
||||
}
|
|
@ -1,5 +1,3 @@
|
|||
# Jobs, Jobs, Jobs <small>_(and Jobs - Let's Vote for Jobs!)_</small>
|
||||
# jobs-jobs-jobs
|
||||
|
||||
Source repository for **Jobs, Jobs, Jobs**, the jobs and career site for No Agenda nation.
|
||||
|
||||
What is No Agenda? [So glad you asked!](https://noagendashow.net)
|
||||
Repository for the development of No Agenda Jobs - currently parked [here](http://jobs.bitbadger.solutions)
|
||||
|
|
|
@ -1,29 +0,0 @@
|
|||
# Jobs, Jobs, Jobs Version 3
|
||||
|
||||
Version 3 of Jobs, Jobs, Jobs is now available! This major release covers:
|
||||
|
||||
- Separating accounts from their Mastodon dependence
|
||||
- Supporting chronological employment history in profiles
|
||||
- Allowing profiles to be shared publicly
|
||||
- Printing employment profiles
|
||||
- Simplifying the infrastructure on which it runs
|
||||
|
||||
## Come One, Come All, Human Resources!
|
||||
|
||||
Previous versions utilized Mastodon and its API to authorize users with No Agenda-affiliated instances. This ended up being both too restrictive and unreliable. Version 3 handles user accounts itself, so registration is not tied to another service.
|
||||
|
||||
## Migrating Your Information from v2
|
||||
|
||||
The content from v2 is available in v3, but will not be visible until it is associated with a v3-created account. If you had content in v2, you should have received a message from @danieljsummers on No Agenda Social with instructions. _(NOTE: ITM, Slaves! and Liberty Woof have closed, so these people could not be reached directly.)_ The process is:
|
||||
|
||||
- [Create an account](https://noagendacareers.com/citizen/register)
|
||||
- Verify that account
|
||||
- Reply to the private message on Mastodon with the information requested
|
||||
|
||||
v2 data will be removed at some point after June 1st, 2023.
|
||||
|
||||
## How Does It Work?
|
||||
|
||||
Jobs, Jobs, Jobs is a job site that supports both employment profiles and job listings, allowing its users to either look for or recruit qualified people from the No Agenda tribe. The best way to get started would be to [look over the help files](https://noagendacareers.com/how-it-works). Then, register for an account, copy/paste your résumé there, or take a bit more time and fill out a full employment profile. If you are a person who hires or recruits, post your open positions.
|
||||
|
||||
In short - **use it**; a site like this only works if it provides value, and it has no value without your participation.
|
|
@ -1,2 +0,0 @@
|
|||
**/bin
|
||||
**/obj
|
|
@ -1,26 +0,0 @@
|
|||
FROM mcr.microsoft.com/dotnet/sdk:8.0-alpine AS build
|
||||
WORKDIR /jjj
|
||||
COPY ./JobsJobsJobs.sln ./
|
||||
COPY ./JobsJobsJobs/Directory.Build.props ./JobsJobsJobs/
|
||||
COPY ./JobsJobsJobs/Application/JobsJobsJobs.Application.fsproj ./JobsJobsJobs/Application/
|
||||
COPY ./JobsJobsJobs/Citizens/JobsJobsJobs.Citizens.fsproj ./JobsJobsJobs/Citizens/
|
||||
COPY ./JobsJobsJobs/Common/JobsJobsJobs.Common.fsproj ./JobsJobsJobs/Common/
|
||||
COPY ./JobsJobsJobs/Home/JobsJobsJobs.Home.fsproj ./JobsJobsJobs/Home/
|
||||
COPY ./JobsJobsJobs/Listings/JobsJobsJobs.Listings.fsproj ./JobsJobsJobs/Listings/
|
||||
COPY ./JobsJobsJobs/Profiles/JobsJobsJobs.Profiles.fsproj ./JobsJobsJobs/Profiles/
|
||||
COPY ./JobsJobsJobs/SuccessStories/JobsJobsJobs.SuccessStories.fsproj ./JobsJobsJobs/SuccessStories/
|
||||
RUN dotnet restore
|
||||
|
||||
COPY . ./
|
||||
WORKDIR /jjj/JobsJobsJobs/Application
|
||||
RUN dotnet publish -c Release -r linux-x64
|
||||
RUN rm bin/Release/net8.0/linux-x64/publish/appsettings.*.json
|
||||
|
||||
FROM mcr.microsoft.com/dotnet/aspnet:8.0-alpine as final
|
||||
WORKDIR /app
|
||||
RUN apk add --no-cache icu-libs
|
||||
ENV DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=false
|
||||
COPY --from=build /jjj/JobsJobsJobs/Application/bin/Release/net8.0/linux-x64/publish/ ./
|
||||
|
||||
EXPOSE 80
|
||||
CMD [ "dotnet", "/app/JobsJobsJobs.Application.dll" ]
|
|
@ -3,64 +3,36 @@ Microsoft Visual Studio Solution File, Format Version 12.00
|
|||
# Visual Studio Version 16
|
||||
VisualStudioVersion = 16.0.30717.126
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JobsJobsJobs.Server", "JobsJobsJobs\Server\JobsJobsJobs.Server.csproj", "{35AEECBF-489D-41C5-9BA3-6E43AD7A8196}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JobsJobsJobs.Client", "JobsJobsJobs\Client\JobsJobsJobs.Client.csproj", "{16771650-F0F4-4B9C-8C63-D9BFFC94F90A}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JobsJobsJobs.Shared", "JobsJobsJobs\Shared\JobsJobsJobs.Shared.csproj", "{AE329284-47DA-4E76-B542-47489B271130}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{50B51580-9F09-41E2-BC78-DAD38C37B583}"
|
||||
ProjectSection(SolutionItems) = preProject
|
||||
.dockerignore = .dockerignore
|
||||
..\.gitignore = ..\.gitignore
|
||||
JobsJobsJobs\Directory.Build.props = JobsJobsJobs\Directory.Build.props
|
||||
Dockerfile = Dockerfile
|
||||
database\tables.sql = database\tables.sql
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "JobsJobsJobs", "JobsJobsJobs", "{FA833B24-B8F6-4CE6-A044-99257EAC02FF}"
|
||||
EndProject
|
||||
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "Application", "JobsJobsJobs\Application\JobsJobsJobs.Application.fsproj", "{8F5A3D1E-562B-4F27-9787-6CB14B35E69E}"
|
||||
EndProject
|
||||
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "Citizens", "JobsJobsJobs\Citizens\JobsJobsJobs.Citizens.fsproj", "{4C184AB8-DDA7-4545-BC84-A4ACCBE29764}"
|
||||
EndProject
|
||||
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "Common", "JobsJobsJobs\Common\JobsJobsJobs.Common.fsproj", "{D6E4A943-5113-41ED-A547-8D3BE5516DC0}"
|
||||
EndProject
|
||||
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "Home", "JobsJobsJobs\Home\JobsJobsJobs.Home.fsproj", "{974AC330-FA47-479D-8927-D40E82EFE223}"
|
||||
EndProject
|
||||
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "Listings", "JobsJobsJobs\Listings\JobsJobsJobs.Listings.fsproj", "{0BE66D08-95AC-4E0F-8A79-0A97602A3E08}"
|
||||
EndProject
|
||||
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "Profiles", "JobsJobsJobs\Profiles\JobsJobsJobs.Profiles.fsproj", "{0B89D606-A094-4E82-8F8A-9D72D6A0E805}"
|
||||
EndProject
|
||||
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "SuccessStories", "JobsJobsJobs\SuccessStories\JobsJobsJobs.SuccessStories.fsproj", "{8DAFA6F6-0415-4507-B31C-7FEBE0D2E9D7}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{8F5A3D1E-562B-4F27-9787-6CB14B35E69E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{8F5A3D1E-562B-4F27-9787-6CB14B35E69E}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{8F5A3D1E-562B-4F27-9787-6CB14B35E69E}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{8F5A3D1E-562B-4F27-9787-6CB14B35E69E}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{D6E4A943-5113-41ED-A547-8D3BE5516DC0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{D6E4A943-5113-41ED-A547-8D3BE5516DC0}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{D6E4A943-5113-41ED-A547-8D3BE5516DC0}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{D6E4A943-5113-41ED-A547-8D3BE5516DC0}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{4C184AB8-DDA7-4545-BC84-A4ACCBE29764}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{4C184AB8-DDA7-4545-BC84-A4ACCBE29764}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{4C184AB8-DDA7-4545-BC84-A4ACCBE29764}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{4C184AB8-DDA7-4545-BC84-A4ACCBE29764}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{0B89D606-A094-4E82-8F8A-9D72D6A0E805}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{0B89D606-A094-4E82-8F8A-9D72D6A0E805}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{0B89D606-A094-4E82-8F8A-9D72D6A0E805}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{0B89D606-A094-4E82-8F8A-9D72D6A0E805}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{8DAFA6F6-0415-4507-B31C-7FEBE0D2E9D7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{8DAFA6F6-0415-4507-B31C-7FEBE0D2E9D7}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{8DAFA6F6-0415-4507-B31C-7FEBE0D2E9D7}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{8DAFA6F6-0415-4507-B31C-7FEBE0D2E9D7}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{974AC330-FA47-479D-8927-D40E82EFE223}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{974AC330-FA47-479D-8927-D40E82EFE223}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{974AC330-FA47-479D-8927-D40E82EFE223}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{974AC330-FA47-479D-8927-D40E82EFE223}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{0BE66D08-95AC-4E0F-8A79-0A97602A3E08}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{0BE66D08-95AC-4E0F-8A79-0A97602A3E08}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{0BE66D08-95AC-4E0F-8A79-0A97602A3E08}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{0BE66D08-95AC-4E0F-8A79-0A97602A3E08}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{35AEECBF-489D-41C5-9BA3-6E43AD7A8196}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{35AEECBF-489D-41C5-9BA3-6E43AD7A8196}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{35AEECBF-489D-41C5-9BA3-6E43AD7A8196}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{35AEECBF-489D-41C5-9BA3-6E43AD7A8196}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{16771650-F0F4-4B9C-8C63-D9BFFC94F90A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{16771650-F0F4-4B9C-8C63-D9BFFC94F90A}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{16771650-F0F4-4B9C-8C63-D9BFFC94F90A}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{16771650-F0F4-4B9C-8C63-D9BFFC94F90A}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{AE329284-47DA-4E76-B542-47489B271130}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{AE329284-47DA-4E76-B542-47489B271130}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{AE329284-47DA-4E76-B542-47489B271130}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{AE329284-47DA-4E76-B542-47489B271130}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
@ -68,13 +40,4 @@ Global
|
|||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {5E9ECDBF-634E-43A9-8F89-625A2213831C}
|
||||
EndGlobalSection
|
||||
GlobalSection(NestedProjects) = preSolution
|
||||
{8F5A3D1E-562B-4F27-9787-6CB14B35E69E} = {FA833B24-B8F6-4CE6-A044-99257EAC02FF}
|
||||
{D6E4A943-5113-41ED-A547-8D3BE5516DC0} = {FA833B24-B8F6-4CE6-A044-99257EAC02FF}
|
||||
{4C184AB8-DDA7-4545-BC84-A4ACCBE29764} = {FA833B24-B8F6-4CE6-A044-99257EAC02FF}
|
||||
{0B89D606-A094-4E82-8F8A-9D72D6A0E805} = {FA833B24-B8F6-4CE6-A044-99257EAC02FF}
|
||||
{8DAFA6F6-0415-4507-B31C-7FEBE0D2E9D7} = {FA833B24-B8F6-4CE6-A044-99257EAC02FF}
|
||||
{974AC330-FA47-479D-8927-D40E82EFE223} = {FA833B24-B8F6-4CE6-A044-99257EAC02FF}
|
||||
{0BE66D08-95AC-4E0F-8A79-0A97602A3E08} = {FA833B24-B8F6-4CE6-A044-99257EAC02FF}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
|
|
|
@ -1,24 +0,0 @@
|
|||
/// Route handlers for Giraffe endpoints
|
||||
module JobsJobsJobs.Api.Handlers
|
||||
|
||||
open System.IO
|
||||
open Giraffe
|
||||
open JobsJobsJobs.Common.Handlers
|
||||
open JobsJobsJobs.Domain
|
||||
|
||||
// POST: /api/markdown-preview
|
||||
let markdownPreview : HttpHandler = requireUser >=> fun next ctx -> task {
|
||||
let _ = ctx.Request.Body.Seek(0L, SeekOrigin.Begin)
|
||||
use reader = new StreamReader (ctx.Request.Body)
|
||||
let! preview = reader.ReadToEndAsync ()
|
||||
return! htmlString (MarkdownString.toHtml (Text preview)) next ctx
|
||||
}
|
||||
|
||||
|
||||
open Giraffe.EndpointRouting
|
||||
|
||||
/// All API endpoints
|
||||
let endpoints =
|
||||
subRoute "/api" [
|
||||
POST [ route "/markdown-preview" markdownPreview ]
|
||||
]
|
|
@ -1,91 +0,0 @@
|
|||
/// The main web server application for Jobs, Jobs, Jobs
|
||||
module JobsJobsJobs.App
|
||||
|
||||
open System
|
||||
open System.Text
|
||||
open BitBadger.AspNetCore.CanonicalDomains
|
||||
open Giraffe
|
||||
open Giraffe.EndpointRouting
|
||||
open JobsJobsJobs.Common.Data
|
||||
open Microsoft.AspNetCore.Authentication.Cookies
|
||||
open Microsoft.AspNetCore.Builder
|
||||
open Microsoft.AspNetCore.Http
|
||||
open Microsoft.AspNetCore.HttpOverrides
|
||||
open Microsoft.Extensions.Caching.Distributed
|
||||
open Microsoft.Extensions.Configuration
|
||||
open Microsoft.Extensions.DependencyInjection
|
||||
open Microsoft.Extensions.Hosting
|
||||
open NodaTime
|
||||
|
||||
|
||||
/// Enable buffering on the request body
|
||||
type BufferedBodyMiddleware (next : RequestDelegate) =
|
||||
|
||||
member _.InvokeAsync (ctx : HttpContext) = task {
|
||||
ctx.Request.EnableBuffering ()
|
||||
return! next.Invoke ctx
|
||||
}
|
||||
|
||||
|
||||
[<EntryPoint>]
|
||||
let main args =
|
||||
|
||||
let builder = WebApplication.CreateBuilder args
|
||||
let _ = builder.Configuration.AddEnvironmentVariables "JJJ_"
|
||||
let svc = builder.Services
|
||||
|
||||
let _ = svc.AddGiraffe ()
|
||||
let _ = svc.AddSingleton<IClock> SystemClock.Instance
|
||||
let _ = svc.AddLogging ()
|
||||
let _ = svc.AddCors ()
|
||||
let _ = svc.AddSingleton<Json.ISerializer> (SystemTextJson.Serializer Json.options)
|
||||
let _ = svc.Configure<ForwardedHeadersOptions>(fun (opts : ForwardedHeadersOptions) ->
|
||||
opts.ForwardedHeaders <- ForwardedHeaders.XForwardedFor ||| ForwardedHeaders.XForwardedProto)
|
||||
let _ = svc.AddAuthentication(CookieAuthenticationDefaults.AuthenticationScheme)
|
||||
.AddCookie(fun o ->
|
||||
o.ExpireTimeSpan <- TimeSpan.FromMinutes 60
|
||||
o.SlidingExpiration <- true
|
||||
o.AccessDeniedPath <- "/error/not-authorized"
|
||||
o.ClaimsIssuer <- "https://noagendacareers.com")
|
||||
let _ = svc.AddAuthorization ()
|
||||
let _ = svc.AddAntiforgery ()
|
||||
|
||||
// Set up the data store
|
||||
let cfg = svc.BuildServiceProvider().GetRequiredService<IConfiguration> ()
|
||||
let _ = setUp cfg |> Async.AwaitTask |> Async.RunSynchronously
|
||||
let _ = svc.AddSingleton<IDistributedCache> (fun _ -> DistributedCache () :> IDistributedCache)
|
||||
let _ = svc.AddSession(fun opts ->
|
||||
opts.IdleTimeout <- TimeSpan.FromMinutes 60
|
||||
opts.Cookie.HttpOnly <- true
|
||||
opts.Cookie.IsEssential <- true)
|
||||
|
||||
let emailCfg = cfg.GetSection "Email"
|
||||
if (emailCfg.GetChildren >> Seq.isEmpty >> not) () then ConfigurationBinder.Bind(emailCfg, Email.options)
|
||||
|
||||
let app = builder.Build ()
|
||||
|
||||
// Unify the endpoints from all features
|
||||
let endpoints = [
|
||||
Citizens.Handlers.endpoints
|
||||
yield! Home.Handlers.endpoints
|
||||
yield! Listings.Handlers.endpoints
|
||||
Profiles.Handlers.endpoints
|
||||
SuccessStories.Handlers.endpoints
|
||||
Api.Handlers.endpoints
|
||||
]
|
||||
|
||||
let _ = app.UseForwardedHeaders ()
|
||||
let _ = app.UseCanonicalDomains ()
|
||||
let _ = app.UseCookiePolicy (CookiePolicyOptions (MinimumSameSitePolicy = SameSiteMode.Strict))
|
||||
let _ = app.UseStaticFiles ()
|
||||
let _ = app.UseRouting ()
|
||||
let _ = app.UseMiddleware<BufferedBodyMiddleware> ()
|
||||
let _ = app.UseAuthentication ()
|
||||
let _ = app.UseAuthorization ()
|
||||
let _ = app.UseSession ()
|
||||
let _ = app.UseGiraffeErrorHandler Common.Handlers.Error.unexpectedError
|
||||
let _ = app.UseEndpoints (fun e -> e.MapGiraffeEndpoints endpoints |> ignore)
|
||||
|
||||
app.Run ()
|
||||
|
||||
0
|
|
@ -1,36 +0,0 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<PublishSingleFile>false</PublishSingleFile>
|
||||
<SelfContained>false</SelfContained>
|
||||
<WarnOn>3390;$(WarnOn)</WarnOn>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Include="ApiHandlers.fs" />
|
||||
<Compile Include="App.fs" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include=".\wwwroot" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Citizens\JobsJobsJobs.Citizens.fsproj" />
|
||||
<ProjectReference Include="..\Common\JobsJobsJobs.Common.fsproj" />
|
||||
<ProjectReference Include="..\Home\JobsJobsJobs.Home.fsproj" />
|
||||
<ProjectReference Include="..\Listings\JobsJobsJobs.Listings.fsproj" />
|
||||
<ProjectReference Include="..\Profiles\JobsJobsJobs.Profiles.fsproj" />
|
||||
<ProjectReference Include="..\SuccessStories\JobsJobsJobs.SuccessStories.fsproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Update="FSharp.Core" Version="8.0.300" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="BitBadger.AspNetCore.CanonicalDomains" Version="1.0.0" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
|
@ -1,15 +0,0 @@
|
|||
{
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"JobsJobsJobs.Api.Handlers.Citizen": "Information",
|
||||
"Microsoft.AspNetCore.StaticFiles": "Warning"
|
||||
}
|
||||
},
|
||||
"Kestrel": {
|
||||
"EndPoints": {
|
||||
"Http": {
|
||||
"Url": "http://0.0.0.0:80"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,303 +0,0 @@
|
|||
/** Script for Jobs, Jobs, Jobs */
|
||||
this.jjj = {
|
||||
/**
|
||||
* Play an audio file
|
||||
* @param {HTMLElement} elt The element which was clicked
|
||||
*/
|
||||
playFile(elt) {
|
||||
elt.querySelector("audio").play()
|
||||
},
|
||||
|
||||
/**
|
||||
* Hide the offcanvas menu if it displayed
|
||||
*/
|
||||
hideMenu() {
|
||||
/** @type {HTMLElement} */
|
||||
const menu = document.querySelector(".jjj-mobile-menu")
|
||||
if (menu.style.display !== "none") bootstrap.Offcanvas.getOrCreateInstance(menu).hide()
|
||||
},
|
||||
|
||||
/**
|
||||
* Show a message via an alert
|
||||
* @param {string} message The message to show
|
||||
*/
|
||||
showAlert (message) {
|
||||
const [level, msg] = message.split("|||")
|
||||
|
||||
/** @type {HTMLTemplateElement} */
|
||||
const alertTemplate = document.getElementById("alertTemplate")
|
||||
/** @type {HTMLDivElement} */
|
||||
const alert = alertTemplate.content.firstElementChild.cloneNode(true)
|
||||
alert.classList.add(`alert-${level === "error" ? "danger" : level}`)
|
||||
|
||||
const prefix = level === "success" ? "" : `<strong>${level.toUpperCase()}: </strong>`
|
||||
alert.querySelector("p").innerHTML = `${prefix}${msg}`
|
||||
|
||||
const alerts = document.getElementById("alerts")
|
||||
alerts.appendChild(alert)
|
||||
alerts.scrollIntoView()
|
||||
},
|
||||
|
||||
/**
|
||||
* The time zone of the current browser
|
||||
* @type {string}
|
||||
*/
|
||||
timeZone: undefined,
|
||||
|
||||
/**
|
||||
* Derive the time zone from the current browser
|
||||
*/
|
||||
deriveTimeZone () {
|
||||
try {
|
||||
this.timeZone = (new Intl.DateTimeFormat()).resolvedOptions().timeZone
|
||||
} catch (_) { }
|
||||
},
|
||||
|
||||
/**
|
||||
* Set up the onClick event for the preview button
|
||||
* @param {string} editorId The ID of the editor to wire up
|
||||
*/
|
||||
markdownOnLoad(editorId) {
|
||||
document.getElementById(`${editorId}PreviewButton`).addEventListener("click", () => { this.showPreview(editorId) })
|
||||
},
|
||||
|
||||
/**
|
||||
* Show a preview of the Markdown in the given editor
|
||||
* @param {string} editorId The ID of the Markdown editor whose preview should be shown
|
||||
*/
|
||||
async showPreview(editorId) {
|
||||
/** @type {HTMLButtonElement} */
|
||||
const editBtn = document.getElementById(`${editorId}EditButton`)
|
||||
/** @type {HTMLDivElement} */
|
||||
const editDiv = document.getElementById(`${editorId}Edit`)
|
||||
/** @type {HTMLTextAreaElement} */
|
||||
const editor = document.getElementById(editorId)
|
||||
/** @type {HTMLButtonElement} */
|
||||
const previewBtn = document.getElementById(`${editorId}PreviewButton`)
|
||||
/** @type {HTMLDivElement} */
|
||||
const previewDiv = document.getElementById(`${editorId}Preview`)
|
||||
|
||||
editBtn.classList.remove("btn-primary")
|
||||
editBtn.classList.add("btn-outline-secondary")
|
||||
editBtn.addEventListener("click", () => { this.showEditor(editorId) })
|
||||
previewBtn.classList.remove("btn-outline-secondary")
|
||||
previewBtn.classList.add("btn-primary")
|
||||
previewBtn.removeEventListener("click", () => { this.showPreview(editorId) })
|
||||
|
||||
const preview = await fetch("/api/markdown-preview", { method: "POST", body: editor.value })
|
||||
let text
|
||||
if (preview.ok) {
|
||||
text = await preview.text()
|
||||
} else {
|
||||
text = `<p class="text-danger"><strong> ERROR ${preview.status}</strong> – ${preview.statusText}`
|
||||
}
|
||||
previewDiv.innerHTML = text
|
||||
|
||||
editDiv.classList.remove("jjj-shown")
|
||||
editDiv.classList.add("jjj-not-shown")
|
||||
previewDiv.classList.remove("jjj-not-shown")
|
||||
previewDiv.classList.add("jjj-shown")
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* Show the Markdown editor (hides preview)
|
||||
* @param {string} editorId The ID of the Markdown editor to show
|
||||
*/
|
||||
showEditor(editorId) {
|
||||
/** @type {HTMLButtonElement} */
|
||||
const editBtn = document.getElementById(`${editorId}EditButton`)
|
||||
/** @type {HTMLDivElement} */
|
||||
const editDiv = document.getElementById(`${editorId}Edit`)
|
||||
/** @type {HTMLTextAreaElement} */
|
||||
const editor = document.getElementById(editorId)
|
||||
/** @type {HTMLButtonElement} */
|
||||
const previewBtn = document.getElementById(`${editorId}PreviewButton`)
|
||||
/** @type {HTMLDivElement} */
|
||||
const previewDiv = document.getElementById(`${editorId}Preview`)
|
||||
|
||||
previewBtn.classList.remove("btn-primary")
|
||||
previewBtn.classList.add("btn-outline-secondary")
|
||||
this.markdownOnLoad(editorId)
|
||||
editBtn.classList.remove("btn-outline-secondary")
|
||||
editBtn.classList.add("btn-primary")
|
||||
editBtn.removeEventListener("click", () => { this.showEditor(editorId) })
|
||||
|
||||
previewDiv.classList.remove("jjj-shown")
|
||||
previewDiv.classList.add("jjj-not-shown")
|
||||
previewDiv.innerHTML = ""
|
||||
editDiv.classList.remove("jjj-not-shown")
|
||||
editDiv.classList.add("jjj-shown")
|
||||
},
|
||||
|
||||
citizen: {
|
||||
|
||||
/**
|
||||
* The next index for a newly-added contact
|
||||
* @type {number}
|
||||
*/
|
||||
nextIndex: 0,
|
||||
|
||||
/**
|
||||
* Add a contact to the account form
|
||||
*/
|
||||
addContact() {
|
||||
const next = this.nextIndex
|
||||
|
||||
/** @type {HTMLTemplateElement} */
|
||||
const newContactTemplate = document.getElementById("newContact")
|
||||
/** @type {HTMLDivElement} */
|
||||
const newContact = newContactTemplate.content.firstElementChild.cloneNode(true)
|
||||
newContact.setAttribute("id", `contactRow${next}`)
|
||||
|
||||
const cols = newContact.children
|
||||
// Button column
|
||||
cols[0].querySelector("button").setAttribute("onclick", `jjj.citizen.removeContact(${next})`)
|
||||
// Contact Type column
|
||||
const typeField = cols[1].querySelector("select")
|
||||
typeField.setAttribute("id", `contactType${next}`)
|
||||
typeField.setAttribute("name", `Contacts[${this.nextIndex}].ContactType`)
|
||||
cols[1].querySelector("label").setAttribute("for", `contactType${next}`)
|
||||
// Name column
|
||||
const nameField = cols[2].querySelector("input")
|
||||
nameField.setAttribute("id", `contactName${next}`)
|
||||
nameField.setAttribute("name", `Contacts[${this.nextIndex}].Name`)
|
||||
cols[2].querySelector("label").setAttribute("for", `contactName${next}`)
|
||||
if (next > 0) cols[2].querySelector("div.form-text").remove()
|
||||
// Value column
|
||||
const valueField = cols[3].querySelector("input")
|
||||
valueField.setAttribute("id", `contactValue${next}`)
|
||||
valueField.setAttribute("name", `Contacts[${this.nextIndex}].Value`)
|
||||
cols[3].querySelector("label").setAttribute("for", `contactName${next}`)
|
||||
if (next > 0) cols[3].querySelector("div.form-text").remove()
|
||||
// Is Public column
|
||||
const isPublicField = cols[4].querySelector("input")
|
||||
isPublicField.setAttribute("id", `contactIsPublic${next}`)
|
||||
isPublicField.setAttribute("name", `Contacts[${this.nextIndex}].IsPublic`)
|
||||
cols[4].querySelector("label").setAttribute("for", `contactIsPublic${next}`)
|
||||
|
||||
// Add the row
|
||||
const contacts = document.querySelectorAll("div[id^=contactRow]")
|
||||
const sibling = contacts.length > 0 ? contacts[contacts.length - 1] : newContactTemplate
|
||||
sibling.insertAdjacentElement('afterend', newContact)
|
||||
|
||||
this.nextIndex++
|
||||
},
|
||||
|
||||
/**
|
||||
* Remove a contact row from the profile form
|
||||
* @param {number} idx The index of the contact row to remove
|
||||
*/
|
||||
removeContact(idx) {
|
||||
document.getElementById(`contactRow${idx}`).remove()
|
||||
},
|
||||
|
||||
/**
|
||||
* Register a comparison validation between a password and a "confirm password" field
|
||||
* @param {string} pwId The ID for the password field
|
||||
* @param {string} confirmId The ID for the "confirm password" field
|
||||
* @param {boolean} isRequired Whether these fields are required
|
||||
*/
|
||||
validatePasswords(pwId, confirmId, isRequired) {
|
||||
const pw = document.getElementById(pwId)
|
||||
const pwConfirm = document.getElementById(confirmId)
|
||||
pwConfirm.addEventListener("input", () => {
|
||||
if (!pw.validity.valid) {
|
||||
pwConfirm.setCustomValidity("")
|
||||
} else if ((!pwConfirm.validity.valueMissing || !isRequired) && pw.value !== pwConfirm.value) {
|
||||
pwConfirm.setCustomValidity("Confirmation password does not match")
|
||||
} else {
|
||||
pwConfirm.setCustomValidity("")
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Script for listing pages
|
||||
*/
|
||||
listing: {
|
||||
|
||||
/**
|
||||
* Show or hide the success story prompt based on whether a job was filled here
|
||||
*/
|
||||
toggleFromHere() {
|
||||
/** @type {HTMLInputElement} */
|
||||
const isFromHere = document.getElementById("FromHere")
|
||||
const display = isFromHere.checked ? "unset" : "none"
|
||||
document.getElementById("successRow").style.display = display
|
||||
document.getElementById("SuccessStoryEditRow").style.display = display
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Script for profile pages
|
||||
*/
|
||||
profile: {
|
||||
|
||||
/**
|
||||
* The next index for a newly-added skill
|
||||
* @type {number}
|
||||
*/
|
||||
nextIndex: 0,
|
||||
|
||||
/**
|
||||
* Add a skill to the profile form
|
||||
*/
|
||||
addSkill() {
|
||||
const next = this.nextIndex
|
||||
|
||||
/** @type {HTMLTemplateElement} */
|
||||
const newSkillTemplate = document.getElementById("newSkill")
|
||||
/** @type {HTMLDivElement} */
|
||||
const newSkill = newSkillTemplate.content.firstElementChild.cloneNode(true)
|
||||
newSkill.setAttribute("id", `skillRow${next}`)
|
||||
|
||||
const cols = newSkill.children
|
||||
// Button column
|
||||
cols[0].querySelector("button").setAttribute("onclick", `jjj.profile.removeSkill(${next})`)
|
||||
// Skill column
|
||||
const skillField = cols[1].querySelector("input")
|
||||
skillField.setAttribute("id", `skillDesc${next}`)
|
||||
skillField.setAttribute("name", `Skills[${this.nextIndex}].Description`)
|
||||
cols[1].querySelector("label").setAttribute("for", `skillDesc${next}`)
|
||||
if (this.nextIndex > 0) cols[1].querySelector("div.form-text").remove()
|
||||
// Notes column
|
||||
const notesField = cols[2].querySelector("input")
|
||||
notesField.setAttribute("id", `skillNotes${next}`)
|
||||
notesField.setAttribute("name", `Skills[${this.nextIndex}].Notes`)
|
||||
cols[2].querySelector("label").setAttribute("for", `skillNotes${next}`)
|
||||
if (this.nextIndex > 0) cols[2].querySelector("div.form-text").remove()
|
||||
|
||||
// Add the row
|
||||
const skills = document.querySelectorAll("div[id^=skillRow]")
|
||||
const sibling = skills.length > 0 ? skills[skills.length - 1] : newSkillTemplate
|
||||
sibling.insertAdjacentElement('afterend', newSkill)
|
||||
|
||||
this.nextIndex++
|
||||
},
|
||||
|
||||
/**
|
||||
* Remove a skill row from the profile form
|
||||
* @param {number} idx The index of the skill row to remove
|
||||
*/
|
||||
removeSkill(idx) {
|
||||
document.getElementById(`skillRow${idx}`).remove()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
htmx.on("htmx:configRequest", function (evt) {
|
||||
// Send the user's current time zone so that we can display local time
|
||||
if (jjj.timeZone) {
|
||||
evt.detail.headers["X-Time-Zone"] = jjj.timeZone
|
||||
}
|
||||
})
|
||||
|
||||
htmx.on("htmx:responseError", function (evt) {
|
||||
/** @type {XMLHttpRequest} */
|
||||
const xhr = evt.detail.xhr
|
||||
jjj.showAlert(`error|||${xhr.status}: ${xhr.statusText}`)
|
||||
})
|
||||
|
||||
jjj.deriveTimeZone()
|
|
@ -1,248 +0,0 @@
|
|||
/* Overall styling */
|
||||
html {
|
||||
scroll-behavior: smooth;
|
||||
}
|
||||
a:link,
|
||||
a:visited {
|
||||
text-decoration: none;
|
||||
}
|
||||
a:not(.btn):hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
label.jjj-required::after {
|
||||
color: red;
|
||||
content: ' *';
|
||||
}
|
||||
label[for]:hover {
|
||||
cursor: pointer;
|
||||
}
|
||||
.jjj-heading-label {
|
||||
display: inline-block;
|
||||
font-size: 1rem;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
.material-icons {
|
||||
vertical-align: bottom;
|
||||
}
|
||||
@media print {
|
||||
.jjj-hide-from-printer {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
/* Material Design Icon / Bootstrap styling */
|
||||
.mdi::before {
|
||||
font-size: 24px;
|
||||
line-height: 14px;
|
||||
}
|
||||
.btn .mdi::before {
|
||||
position: relative;
|
||||
top: 4px;
|
||||
}
|
||||
.btn-xs .mdi::before {
|
||||
font-size: 18px;
|
||||
top: 3px;
|
||||
}
|
||||
.btn-sm .mdi::before {
|
||||
font-size: 18px;
|
||||
top: 3px;
|
||||
}
|
||||
.dropdown-menu .mdi {
|
||||
width: 18px;
|
||||
}
|
||||
.dropdown-menu .mdi::before {
|
||||
position: relative;
|
||||
top: 4px;
|
||||
left: -8px;
|
||||
}
|
||||
.nav .mdi::before {
|
||||
position: relative;
|
||||
top: 4px;
|
||||
}
|
||||
.navbar .navbar-toggle .mdi::before {
|
||||
position: relative;
|
||||
top: 4px;
|
||||
color: #FFF;
|
||||
}
|
||||
.breadcrumb .mdi::before {
|
||||
position: relative;
|
||||
top: 4px;
|
||||
}
|
||||
.breadcrumb a:hover {
|
||||
text-decoration: none;
|
||||
}
|
||||
.breadcrumb a:hover span {
|
||||
text-decoration: underline;
|
||||
}
|
||||
.alert .mdi::before {
|
||||
position: relative;
|
||||
top: 4px;
|
||||
margin-right: 2px;
|
||||
}
|
||||
.input-group-addon .mdi::before {
|
||||
position: relative;
|
||||
top: 3px;
|
||||
}
|
||||
.navbar-brand .mdi::before {
|
||||
position: relative;
|
||||
top: 2px;
|
||||
margin-right: 2px;
|
||||
}
|
||||
.list-group-item .mdi::before {
|
||||
position: relative;
|
||||
top: 3px;
|
||||
left: -3px
|
||||
}
|
||||
.mdi-sm::before {
|
||||
font-size: 1rem;
|
||||
line-height: unset;
|
||||
}
|
||||
/* Layout styling */
|
||||
.jjj-app {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
}
|
||||
.jjj-main {
|
||||
flex-grow: 1;
|
||||
display: flex;
|
||||
flex-flow: column;
|
||||
min-height: 100vh;
|
||||
}
|
||||
.jjj-content {
|
||||
flex-grow: 2;
|
||||
}
|
||||
/* Menu styling */
|
||||
.jjj-full-menu,
|
||||
.jjj-mobile-menu {
|
||||
background-image: linear-gradient(180deg, darkgreen 0%, green 70%);
|
||||
color: white;
|
||||
font-size: 1.2rem;
|
||||
}
|
||||
.jjj-full-menu {
|
||||
min-height: 100vh;
|
||||
width: 250px;
|
||||
min-width: 250px;
|
||||
position: sticky;
|
||||
top: 0;
|
||||
display: none;
|
||||
}
|
||||
.jjj-full-menu .home-link {
|
||||
font-size: 1.2rem;
|
||||
text-align: center;
|
||||
background-color: rgba(0, 0, 0, .4);
|
||||
margin: -1rem;
|
||||
padding: 1rem;
|
||||
}
|
||||
.jjj-full-menu a:link,
|
||||
.jjj-full-menu a:visited {
|
||||
text-decoration: none;
|
||||
color: white;
|
||||
}
|
||||
#jjjMenu {
|
||||
flex-direction: column;
|
||||
flex-grow: 1;
|
||||
}
|
||||
@media (min-width: 768px) {
|
||||
.jjj-full-menu {
|
||||
display: unset;
|
||||
}
|
||||
.jjj-mobile-menu {
|
||||
display: none;
|
||||
}
|
||||
.navbar-expand-md .navbar-nav {
|
||||
flex-direction: column;
|
||||
}
|
||||
}
|
||||
.jjj-nav a:link,
|
||||
.jjj-nav a:visited {
|
||||
text-decoration: none;
|
||||
color: white;
|
||||
}
|
||||
nav.jjj-nav > a {
|
||||
display: block;
|
||||
width: 100%;
|
||||
border-radius: .25rem;
|
||||
padding: .5rem;
|
||||
margin: .5rem 0;
|
||||
font-size: 1rem;
|
||||
}
|
||||
nav.jjj-nav > a > i {
|
||||
vertical-align: top;
|
||||
margin-right: .25rem;
|
||||
}
|
||||
nav.jjj-nav > a > i.mdi::before {
|
||||
line-height: 24px;
|
||||
}
|
||||
nav.jjj-nav > a.jjj-current-page {
|
||||
background-color: rgba(255, 255, 255, .2);
|
||||
}
|
||||
nav.jjj-nav > a:hover {
|
||||
background-color: rgba(255, 255, 255, .5);
|
||||
color: black;
|
||||
text-decoration: none;
|
||||
}
|
||||
nav.jjj-nav > div.separator {
|
||||
border-bottom: solid 1px rgba(255, 255, 255, .75);
|
||||
height: 1px;
|
||||
}
|
||||
/* Title bar styling */
|
||||
.jjj-main .navbar-dark {
|
||||
background-image: linear-gradient(0deg, green 0%, darkgreen 70%);
|
||||
padding-left: 1rem;
|
||||
padding-right: 1rem;
|
||||
}
|
||||
.jjj-main .navbar-dark button {
|
||||
padding: 0;
|
||||
}
|
||||
.jjj-main .navbar-dark .navbar-text {
|
||||
font-weight: bold;
|
||||
color: white;
|
||||
}
|
||||
.jjj-main .navbar-light .navbar-text {
|
||||
font-style: italic;
|
||||
padding: 0 1rem 0 0;
|
||||
}
|
||||
/* Audio Clip styling */
|
||||
.jjj-audio-clip audio {
|
||||
display: none;
|
||||
}
|
||||
span.jjj-audio-clip {
|
||||
border-bottom: dotted 1px lightgray;
|
||||
}
|
||||
span.jjj-audio-clip:hover {
|
||||
cursor: pointer;
|
||||
}
|
||||
/* Markdown Editor styling */
|
||||
.jjj-not-shown {
|
||||
display: none;
|
||||
}
|
||||
.jjj-shown {
|
||||
display: inherit;
|
||||
}
|
||||
.jjj-markdown-editor {
|
||||
width: 100%;
|
||||
/* When wrapping this with Bootstrap's floating label, it shrinks the input down to what a normal one-line input
|
||||
would be; this overrides that for this textarea specifically */
|
||||
height: inherit !important;
|
||||
}
|
||||
.jjj-markdown-preview {
|
||||
border: solid 1px lightgray;
|
||||
border-radius: .5rem;
|
||||
}
|
||||
/* Collapse Panel styling */
|
||||
a[data-bs-toggle] {
|
||||
color: var(--bs-body-color);
|
||||
}
|
||||
a[data-bs-toggle]:hover {
|
||||
text-decoration: none;
|
||||
}
|
||||
/* Footer styling */
|
||||
footer {
|
||||
display: flex;
|
||||
flex-direction: row-reverse;
|
||||
}
|
||||
footer p {
|
||||
padding-top: 2rem;
|
||||
padding-right: .5rem;
|
||||
font-style: italic;
|
||||
font-size: .8rem;
|
||||
}
|
|
@ -1,150 +0,0 @@
|
|||
module JobsJobsJobs.Citizens.Data
|
||||
|
||||
open BitBadger.Npgsql.FSharp.Documents
|
||||
open JobsJobsJobs.Common.Data
|
||||
open JobsJobsJobs.Domain
|
||||
open NodaTime
|
||||
open Npgsql.FSharp
|
||||
|
||||
/// The last time a token purge check was run
|
||||
let mutable private lastPurge = Instant.MinValue
|
||||
|
||||
/// Lock access to the above
|
||||
let private locker = obj ()
|
||||
|
||||
/// Delete a citizen by their ID
|
||||
let deleteById citizenId = backgroundTask {
|
||||
let citId = CitizenId.toString citizenId
|
||||
do! Custom.nonQuery
|
||||
$"{Query.Delete.byContains Table.Success};
|
||||
{Query.Delete.byContains Table.Listing};
|
||||
{Query.Delete.byId Table.Citizen}"
|
||||
[ "@criteria", Query.jsonbDocParam {| citizenId = citId |}; "@id", Sql.string citId ]
|
||||
}
|
||||
|
||||
/// Save a citizen
|
||||
let private saveCitizen (citizen : Citizen) =
|
||||
save Table.Citizen (CitizenId.toString citizen.Id) citizen
|
||||
|
||||
/// Save security information for a citizen
|
||||
let saveSecurityInfo (security : SecurityInfo) =
|
||||
save Table.SecurityInfo (CitizenId.toString security.Id) security
|
||||
|
||||
/// Purge expired tokens
|
||||
let private purgeExpiredTokens now = backgroundTask {
|
||||
let! info =
|
||||
Custom.list $"{Query.selectFromTable Table.SecurityInfo} WHERE data ->> 'tokenExpires' IS NOT NULL" []
|
||||
fromData<SecurityInfo>
|
||||
for expired in info |> List.filter (fun it -> it.TokenExpires.Value < now) do
|
||||
if expired.TokenUsage.Value = "confirm" then
|
||||
// Unconfirmed account; delete the entire thing
|
||||
do! deleteById expired.Id
|
||||
else
|
||||
// Some other use; just clear the token
|
||||
do! saveSecurityInfo { expired with Token = None; TokenUsage = None; TokenExpires = None }
|
||||
}
|
||||
|
||||
/// Check for tokens to purge if it's been more than 10 minutes since we last checked
|
||||
let private checkForPurge skipCheck =
|
||||
lock locker (fun () -> backgroundTask {
|
||||
let now = SystemClock.Instance.GetCurrentInstant ()
|
||||
if skipCheck || (now - lastPurge).TotalMinutes >= 10 then
|
||||
do! purgeExpiredTokens now
|
||||
lastPurge <- now
|
||||
})
|
||||
|
||||
/// Find a citizen by their ID
|
||||
let findById citizenId =
|
||||
Find.byId Table.Citizen (CitizenId.toString citizenId)
|
||||
|
||||
/// Save a citizen
|
||||
let save citizen =
|
||||
saveCitizen citizen
|
||||
|
||||
/// Register a citizen (saves citizen and security settings); returns false if the e-mail is already taken
|
||||
let register (citizen : Citizen) (security : SecurityInfo) = backgroundTask {
|
||||
try
|
||||
let! _ =
|
||||
Configuration.dataSource ()
|
||||
|> Sql.fromDataSource
|
||||
|> Sql.executeTransactionAsync
|
||||
[ Query.save Table.Citizen, [ Query.docParameters (CitizenId.toString citizen.Id) citizen ]
|
||||
Query.save Table.SecurityInfo, [ Query.docParameters (CitizenId.toString citizen.Id) security ]
|
||||
]
|
||||
return true
|
||||
with
|
||||
| :? Npgsql.PostgresException as ex when ex.SqlState = "23505" && ex.ConstraintName = "uk_citizen_email" ->
|
||||
return false
|
||||
}
|
||||
|
||||
/// Try to find the security information matching a confirmation token
|
||||
let private tryConfirmToken (token : string) =
|
||||
Find.firstByContains<SecurityInfo> Table.SecurityInfo {| token = token; tokenUsage = "confirm" |}
|
||||
|
||||
/// Confirm a citizen's account
|
||||
let confirmAccount token = backgroundTask {
|
||||
do! checkForPurge true
|
||||
match! tryConfirmToken token with
|
||||
| Some info ->
|
||||
do! saveSecurityInfo { info with AccountLocked = false; Token = None; TokenUsage = None; TokenExpires = None }
|
||||
return true
|
||||
| None -> return false
|
||||
}
|
||||
|
||||
/// Deny a citizen's account (user-initiated; used if someone used their e-mail address without their consent)
|
||||
let denyAccount token = backgroundTask {
|
||||
do! checkForPurge true
|
||||
match! tryConfirmToken token with
|
||||
| Some info ->
|
||||
do! deleteById info.Id
|
||||
return true
|
||||
| None -> return false
|
||||
}
|
||||
|
||||
/// Attempt a user log on
|
||||
let tryLogOn (email : string) password (pwVerify : Citizen -> string -> bool option)
|
||||
(pwHash : Citizen -> string -> string) now = backgroundTask {
|
||||
do! checkForPurge false
|
||||
match! Find.firstByContains<Citizen> Table.Citizen {| email = email |} with
|
||||
| Some citizen ->
|
||||
let citizenId = CitizenId.toString citizen.Id
|
||||
let! tryInfo = Find.byId<SecurityInfo> Table.SecurityInfo citizenId
|
||||
let! info = backgroundTask {
|
||||
match tryInfo with
|
||||
| Some it -> return it
|
||||
| None ->
|
||||
let it = { SecurityInfo.empty with Id = citizen.Id }
|
||||
do! saveSecurityInfo it
|
||||
return it
|
||||
}
|
||||
if info.AccountLocked then return Error "Log on unsuccessful (Account Locked)"
|
||||
else
|
||||
match pwVerify citizen password with
|
||||
| Some rehash ->
|
||||
let hash = if rehash then pwHash citizen password else citizen.PasswordHash
|
||||
do! saveSecurityInfo { info with FailedLogOnAttempts = 0 }
|
||||
do! saveCitizen { citizen with LastSeenOn = now; PasswordHash = hash }
|
||||
return Ok { citizen with LastSeenOn = now }
|
||||
| None ->
|
||||
let locked = info.FailedLogOnAttempts >= 4
|
||||
do! { info with FailedLogOnAttempts = info.FailedLogOnAttempts + 1; AccountLocked = locked }
|
||||
|> saveSecurityInfo
|
||||
return Error $"""Log on unsuccessful{if locked then " - Account is now locked" else ""}"""
|
||||
| None -> return Error "Log on unsuccessful"
|
||||
}
|
||||
|
||||
/// Try to retrieve a citizen and their security information by their e-mail address
|
||||
let tryByEmailWithSecurity email =
|
||||
Custom.single
|
||||
$"SELECT c.*, s.data AS sec_data
|
||||
FROM {Table.Citizen} c
|
||||
INNER JOIN {Table.SecurityInfo} s ON s.id = c.id
|
||||
WHERE c.data @> @criteria"
|
||||
[ "@criteria", Query.jsonbDocParam {| email = email |} ]
|
||||
(fun row -> (fromData<Citizen> row, fromDocument<SecurityInfo> "sec_data" row))
|
||||
|
||||
/// Try to retrieve security information by the given token
|
||||
let trySecurityByToken (token : string) = backgroundTask {
|
||||
do! checkForPurge false
|
||||
return! Find.firstByContains<SecurityInfo> Table.SecurityInfo {| token = token |}
|
||||
}
|
|
@ -1,153 +0,0 @@
|
|||
module JobsJobsJobs.Citizens.Domain
|
||||
|
||||
open JobsJobsJobs.Domain
|
||||
|
||||
/// The data to add or update an other contact
|
||||
[<CLIMutable; NoComparison; NoEquality>]
|
||||
type OtherContactForm =
|
||||
{ /// The type of the contact
|
||||
ContactType : string
|
||||
|
||||
/// The name of the contact
|
||||
Name : string
|
||||
|
||||
/// The value of the contact (URL, e-mail address, phone, etc.)
|
||||
Value : string
|
||||
|
||||
/// Whether this contact is displayed for public employment profiles and job listings
|
||||
IsPublic : bool
|
||||
}
|
||||
|
||||
/// Support functions for the contact form
|
||||
module OtherContactForm =
|
||||
|
||||
/// Create a contact form from a contact
|
||||
let fromContact (contact : OtherContact) =
|
||||
{ ContactType = ContactType.toString contact.ContactType
|
||||
Name = defaultArg contact.Name ""
|
||||
Value = contact.Value
|
||||
IsPublic = contact.IsPublic
|
||||
}
|
||||
|
||||
|
||||
/// The data available to update an account profile
|
||||
[<CLIMutable; NoComparison; NoEquality>]
|
||||
type AccountProfileForm =
|
||||
{ /// The first name of the citizen
|
||||
FirstName : string
|
||||
|
||||
/// The last name of the citizen
|
||||
LastName : string
|
||||
|
||||
/// The display name for the citizen
|
||||
DisplayName : string
|
||||
|
||||
/// The citizen's new password
|
||||
NewPassword : string
|
||||
|
||||
/// Confirmation of the citizen's new password
|
||||
NewPasswordConfirm : string
|
||||
|
||||
/// The contacts for this profile
|
||||
Contacts : OtherContactForm array
|
||||
}
|
||||
|
||||
/// Support functions for the account profile form
|
||||
module AccountProfileForm =
|
||||
|
||||
/// Create an account profile form from a citizen
|
||||
let fromCitizen (citizen : Citizen) =
|
||||
{ FirstName = citizen.FirstName
|
||||
LastName = citizen.LastName
|
||||
DisplayName = defaultArg citizen.DisplayName ""
|
||||
NewPassword = ""
|
||||
NewPasswordConfirm = ""
|
||||
Contacts = citizen.OtherContacts |> List.map OtherContactForm.fromContact |> Array.ofList
|
||||
}
|
||||
|
||||
|
||||
/// Form for the forgot / reset password page
|
||||
[<CLIMutable; NoComparison; NoEquality>]
|
||||
type ForgotPasswordForm =
|
||||
{ /// The e-mail address for the account wishing to reset their password
|
||||
Email : string
|
||||
}
|
||||
|
||||
|
||||
/// Form for the log on page
|
||||
[<CLIMutable; NoComparison; NoEquality>]
|
||||
type LogOnForm =
|
||||
{ /// A message regarding an error encountered during a log on attempt
|
||||
ErrorMessage : string option
|
||||
|
||||
/// The e-mail address for the user attempting to log on
|
||||
Email : string
|
||||
|
||||
/// The password of the user attempting to log on
|
||||
Password : string
|
||||
|
||||
/// The URL where the user should be redirected after logging on
|
||||
ReturnTo : string option
|
||||
}
|
||||
|
||||
|
||||
/// Form for the registration page
|
||||
[<CLIMutable; NoComparison; NoEquality>]
|
||||
type RegisterForm =
|
||||
{ /// The user's first name
|
||||
FirstName : string
|
||||
|
||||
/// The user's last name
|
||||
LastName : string
|
||||
|
||||
/// The user's display name
|
||||
DisplayName : string option
|
||||
|
||||
/// The user's e-mail address
|
||||
Email : string
|
||||
|
||||
/// The user's desired password
|
||||
Password : string
|
||||
|
||||
/// The index of the first question asked
|
||||
Question1Index : int
|
||||
|
||||
/// The answer for the first question asked
|
||||
Question1Answer : string
|
||||
|
||||
/// The index of the second question asked
|
||||
Question2Index : int
|
||||
|
||||
/// The answer for the second question asked
|
||||
Question2Answer : string
|
||||
}
|
||||
|
||||
/// Support for the registration page view model
|
||||
module RegisterForm =
|
||||
|
||||
/// An empty view model
|
||||
let empty =
|
||||
{ FirstName = ""
|
||||
LastName = ""
|
||||
DisplayName = None
|
||||
Email = ""
|
||||
Password = ""
|
||||
Question1Index = 0
|
||||
Question1Answer = ""
|
||||
Question2Index = 0
|
||||
Question2Answer = ""
|
||||
}
|
||||
|
||||
|
||||
/// The form for a user resetting their password
|
||||
[<CLIMutable; NoComparison; NoEquality>]
|
||||
type ResetPasswordForm =
|
||||
{ /// The ID of the citizen whose password is being reset
|
||||
Id : string
|
||||
|
||||
/// The verification token for the password reset
|
||||
Token : string
|
||||
|
||||
/// The new password for the account
|
||||
Password : string
|
||||
}
|
|
@ -1,355 +0,0 @@
|
|||
module JobsJobsJobs.Citizens.Handlers
|
||||
|
||||
open System
|
||||
open System.Security.Claims
|
||||
open Giraffe
|
||||
open JobsJobsJobs
|
||||
open JobsJobsJobs.Citizens.Domain
|
||||
open JobsJobsJobs.Common.Handlers
|
||||
open JobsJobsJobs.Domain
|
||||
open Microsoft.AspNetCore.Authentication
|
||||
open Microsoft.AspNetCore.Authentication.Cookies
|
||||
open Microsoft.Extensions.Logging
|
||||
open NodaTime
|
||||
|
||||
/// Authorization functions
|
||||
module private Auth =
|
||||
|
||||
open System.Text
|
||||
|
||||
/// Create a confirmation or password reset token for a user
|
||||
let createToken (citizen : Citizen) =
|
||||
Convert.ToBase64String (Guid.NewGuid().ToByteArray () |> Array.append (Encoding.UTF8.GetBytes citizen.Email))
|
||||
|
||||
/// The challenge questions and answers from the configuration
|
||||
let mutable private challenges : (string * string)[] option = None
|
||||
|
||||
/// The challenge questions and answers
|
||||
let questions ctx =
|
||||
match challenges with
|
||||
| Some it -> it
|
||||
| None ->
|
||||
let qs = (config ctx).GetSection "ChallengeQuestions"
|
||||
let qAndA =
|
||||
seq {
|
||||
for idx in 0..4 do
|
||||
let section = qs.GetSection(string idx)
|
||||
yield section["Question"], (section["Answer"].ToLowerInvariant ())
|
||||
}
|
||||
|> Array.ofSeq
|
||||
challenges <- Some qAndA
|
||||
qAndA
|
||||
|
||||
/// Password hashing and verification
|
||||
module Passwords =
|
||||
|
||||
open Microsoft.AspNetCore.Identity
|
||||
|
||||
/// The password hasher to use for the application
|
||||
let private hasher = PasswordHasher<Citizen> ()
|
||||
|
||||
/// Hash a password for a user
|
||||
let hash citizen password =
|
||||
hasher.HashPassword (citizen, password)
|
||||
|
||||
/// Verify a password (returns true if the password needs to be rehashed)
|
||||
let verify citizen password =
|
||||
match hasher.VerifyHashedPassword (citizen, citizen.PasswordHash, password) with
|
||||
| PasswordVerificationResult.Success -> Some false
|
||||
| PasswordVerificationResult.SuccessRehashNeeded -> Some true
|
||||
| _ -> None
|
||||
|
||||
|
||||
// GET: /citizen/account
|
||||
let account : HttpHandler = fun next ctx -> task {
|
||||
match! Data.findById (currentCitizenId ctx) with
|
||||
| Some citizen ->
|
||||
return!
|
||||
Views.account (AccountProfileForm.fromCitizen citizen) (isHtmx ctx) (csrf ctx)
|
||||
|> render "Account Profile" next ctx
|
||||
| None -> return! Error.notFound next ctx
|
||||
}
|
||||
|
||||
// GET: /citizen/cancel-reset/[token]
|
||||
let cancelReset token : HttpHandler = fun next ctx -> task {
|
||||
let! wasCanceled = task {
|
||||
match! Data.trySecurityByToken token with
|
||||
| Some security ->
|
||||
do! Data.saveSecurityInfo { security with Token = None; TokenUsage = None; TokenExpires = None }
|
||||
return true
|
||||
| None -> return false
|
||||
}
|
||||
return! Views.resetCanceled wasCanceled |> render "Password Reset Cancellation" next ctx
|
||||
}
|
||||
|
||||
// GET: /citizen/confirm/[token]
|
||||
let confirm token : HttpHandler = fun next ctx -> task {
|
||||
let! isConfirmed = Data.confirmAccount token
|
||||
return! Views.confirmAccount isConfirmed |> render "Account Confirmation" next ctx
|
||||
}
|
||||
|
||||
// GET: /citizen/dashboard
|
||||
let dashboard : HttpHandler = requireUser >=> fun next ctx -> task {
|
||||
let citizenId = currentCitizenId ctx
|
||||
let! citizen = Data.findById citizenId
|
||||
let! profile = Profiles.Data.findById citizenId
|
||||
let! prfCount = Profiles.Data.count ()
|
||||
return! Views.dashboard citizen.Value profile prfCount (timeZone ctx) |> render "Dashboard" next ctx
|
||||
}
|
||||
|
||||
// POST: /citizen/delete
|
||||
let delete : HttpHandler = requireUser >=> validateCsrf >=> fun next ctx -> task {
|
||||
do! Data.deleteById (currentCitizenId ctx)
|
||||
do! ctx.SignOutAsync ()
|
||||
return! render "Account Deleted Successfully" next ctx Views.deleted
|
||||
}
|
||||
|
||||
// GET: /citizen/deny/[token]
|
||||
let deny token : HttpHandler = fun next ctx -> task {
|
||||
let! wasDeleted = Data.denyAccount token
|
||||
return! Views.denyAccount wasDeleted |> render "Account Deletion" next ctx
|
||||
}
|
||||
|
||||
// GET: /citizen/forgot-password
|
||||
let forgotPassword : HttpHandler = fun next ctx ->
|
||||
Views.forgotPassword (csrf ctx) |> render "Forgot Password" next ctx
|
||||
|
||||
// POST: /citizen/forgot-password
|
||||
let doForgotPassword : HttpHandler = validateCsrf >=> fun next ctx -> task {
|
||||
let! form = ctx.BindFormAsync<ForgotPasswordForm> ()
|
||||
match! Data.tryByEmailWithSecurity form.Email with
|
||||
| Some (citizen, security) ->
|
||||
let withToken =
|
||||
{ security with
|
||||
Token = Some (Auth.createToken citizen)
|
||||
TokenUsage = Some "reset"
|
||||
TokenExpires = Some (now ctx + (Duration.FromDays 3))
|
||||
}
|
||||
do! Data.saveSecurityInfo withToken
|
||||
let! emailResponse = Email.sendPasswordReset citizen withToken
|
||||
let logFac = logger ctx
|
||||
let log = logFac.CreateLogger "JobsJobsJobs.Handlers.Citizen"
|
||||
log.LogInformation $"Password reset e-mail for {citizen.Email} received {emailResponse}"
|
||||
| None -> ()
|
||||
return! Views.forgotPasswordSent form |> render "Reset Request Processed" next ctx
|
||||
}
|
||||
|
||||
// GET: /citizen/log-off
|
||||
let logOff : HttpHandler = requireUser >=> fun next ctx -> task {
|
||||
do! ctx.SignOutAsync CookieAuthenticationDefaults.AuthenticationScheme
|
||||
do! addSuccess "Log off successful" ctx
|
||||
return! redirectToGet "/" next ctx
|
||||
}
|
||||
|
||||
// GET: /citizen/log-on
|
||||
let logOn : HttpHandler = fun next ctx ->
|
||||
let returnTo =
|
||||
if ctx.Request.Query.ContainsKey "returnUrl" then Some ctx.Request.Query["returnUrl"].[0] else None
|
||||
Views.logOn { ErrorMessage = None; Email = ""; Password = ""; ReturnTo = returnTo } (csrf ctx)
|
||||
|> render "Log On" next ctx
|
||||
|
||||
|
||||
// POST: /citizen/log-on
|
||||
let doLogOn : HttpHandler = validateCsrf >=> fun next ctx -> task {
|
||||
let! form = ctx.BindFormAsync<LogOnForm> ()
|
||||
match! Data.tryLogOn form.Email form.Password Auth.Passwords.verify Auth.Passwords.hash (now ctx) with
|
||||
| Ok citizen ->
|
||||
let claims = seq {
|
||||
Claim (ClaimTypes.NameIdentifier, CitizenId.toString citizen.Id)
|
||||
Claim (ClaimTypes.Name, Citizen.name citizen)
|
||||
}
|
||||
let identity = ClaimsIdentity (claims, CookieAuthenticationDefaults.AuthenticationScheme)
|
||||
|
||||
do! ctx.SignInAsync (identity.AuthenticationType, ClaimsPrincipal identity,
|
||||
AuthenticationProperties (IssuedUtc = DateTimeOffset.UtcNow))
|
||||
do! addSuccess "Log on successful" ctx
|
||||
return! redirectToGet (defaultArg form.ReturnTo "/citizen/dashboard") next ctx
|
||||
| Error msg ->
|
||||
do! addError msg ctx
|
||||
return! Views.logOn { form with Password = "" } (csrf ctx) |> render "Log On" next ctx
|
||||
}
|
||||
|
||||
// GET: /citizen/register
|
||||
let register next ctx =
|
||||
// Get two different indexes for NA-knowledge challenge questions
|
||||
let q1Index = System.Random.Shared.Next(0, 5)
|
||||
let mutable q2Index = System.Random.Shared.Next(0, 5)
|
||||
while q1Index = q2Index do
|
||||
q2Index <- System.Random.Shared.Next(0, 5)
|
||||
let qAndA = Auth.questions ctx
|
||||
Views.register (fst qAndA[q1Index]) (fst qAndA[q2Index])
|
||||
{ RegisterForm.empty with Question1Index = q1Index; Question2Index = q2Index } (isHtmx ctx) (csrf ctx)
|
||||
|> render "Register" next ctx
|
||||
|
||||
// POST: /citizen/register
|
||||
#nowarn "3511"
|
||||
let doRegistration : HttpHandler = validateCsrf >=> fun next ctx -> task {
|
||||
let! form = ctx.BindFormAsync<RegisterForm> ()
|
||||
let qAndA = Auth.questions ctx
|
||||
let mutable badForm = false
|
||||
let errors = [
|
||||
if form.FirstName.Length < 1 then "First name is required"
|
||||
if form.LastName.Length < 1 then "Last name is required"
|
||||
if form.Email.Length < 1 then "E-mail address is required"
|
||||
if form.Password.Length < 8 then "Password is too short"
|
||||
if form.Question1Index < 0 || form.Question1Index > 4
|
||||
|| form.Question2Index < 0 || form.Question2Index > 4
|
||||
|| form.Question1Index = form.Question2Index then
|
||||
badForm <- true
|
||||
else if (snd qAndA[form.Question1Index]) <> (form.Question1Answer.Trim().ToLowerInvariant ())
|
||||
|| (snd qAndA[form.Question2Index]) <> (form.Question2Answer.Trim().ToLowerInvariant ()) then
|
||||
"Question answers are incorrect"
|
||||
]
|
||||
let refreshPage () =
|
||||
Views.register (fst qAndA[form.Question1Index]) (fst qAndA[form.Question2Index]) { form with Password = "" }
|
||||
(isHtmx ctx) (csrf ctx)
|
||||
|> renderHandler "Register"
|
||||
|
||||
if badForm then
|
||||
do! addError "The form posted was invalid; please complete it again" ctx
|
||||
return! register next ctx
|
||||
else if List.isEmpty errors then
|
||||
let now = now ctx
|
||||
let noPass =
|
||||
{ Citizen.empty with
|
||||
Id = CitizenId.create ()
|
||||
Email = form.Email
|
||||
FirstName = form.FirstName
|
||||
LastName = form.LastName
|
||||
DisplayName = noneIfBlank form.DisplayName
|
||||
JoinedOn = now
|
||||
LastSeenOn = now
|
||||
}
|
||||
let citizen = { noPass with PasswordHash = Auth.Passwords.hash noPass form.Password }
|
||||
let security =
|
||||
{ SecurityInfo.empty with
|
||||
Id = citizen.Id
|
||||
AccountLocked = true
|
||||
Token = Some (Auth.createToken citizen)
|
||||
TokenUsage = Some "confirm"
|
||||
TokenExpires = Some (now + (Duration.FromDays 3))
|
||||
}
|
||||
let! success = Data.register citizen security
|
||||
if success then
|
||||
let! emailResponse = Email.sendAccountConfirmation citizen security
|
||||
let logFac = logger ctx
|
||||
let log = logFac.CreateLogger "JobsJobsJobs.Handlers.Citizen"
|
||||
log.LogInformation $"Confirmation e-mail for {citizen.Email} received {emailResponse}"
|
||||
return! Views.registered |> render "Registration Successful" next ctx
|
||||
else
|
||||
do! addError "There is already an account registered to the e-mail address provided" ctx
|
||||
return! refreshPage () next ctx
|
||||
else
|
||||
do! addErrors errors ctx
|
||||
return! refreshPage () next ctx
|
||||
}
|
||||
|
||||
// GET: /citizen/reset-password/[token]
|
||||
let resetPassword token : HttpHandler = fun next ctx -> task {
|
||||
match! Data.trySecurityByToken token with
|
||||
| Some security ->
|
||||
return!
|
||||
Views.resetPassword { Id = CitizenId.toString security.Id; Token = token; Password = "" } (isHtmx ctx)
|
||||
(csrf ctx)
|
||||
|> render "Reset Password" next ctx
|
||||
| None -> return! Error.notFound next ctx
|
||||
}
|
||||
|
||||
// POST: /citizen/reset-password
|
||||
let doResetPassword : HttpHandler = validateCsrf >=> fun next ctx -> task {
|
||||
let! form = ctx.BindFormAsync<ResetPasswordForm> ()
|
||||
let errors = [
|
||||
if form.Id = "" then "Request invalid; please return to the link in your e-mail and try again"
|
||||
if form.Token = "" then "Request invalid; please return to the link in your e-mail and try again"
|
||||
if form.Password.Length < 8 then "Password too short"
|
||||
]
|
||||
if List.isEmpty errors then
|
||||
match! Data.trySecurityByToken form.Token with
|
||||
| Some security when security.Id = CitizenId.ofString form.Id ->
|
||||
match! Data.findById security.Id with
|
||||
| Some citizen ->
|
||||
do! Data.saveSecurityInfo { security with Token = None; TokenUsage = None; TokenExpires = None }
|
||||
do! Data.save { citizen with PasswordHash = Auth.Passwords.hash citizen form.Password }
|
||||
do! addSuccess "Password reset successfully; you may log on with your new credentials" ctx
|
||||
return! redirectToGet "/citizen/log-on" next ctx
|
||||
| None -> return! Error.notFound next ctx
|
||||
| Some _
|
||||
| None -> return! Error.notFound next ctx
|
||||
else
|
||||
do! addErrors errors ctx
|
||||
return! Views.resetPassword form (isHtmx ctx) (csrf ctx) |> render "Reset Password" next ctx
|
||||
}
|
||||
|
||||
// POST: /citizen/save-account
|
||||
let saveAccount : HttpHandler = requireUser >=> validateCsrf >=> fun next ctx -> task {
|
||||
let! theForm = ctx.BindFormAsync<AccountProfileForm> ()
|
||||
let form = { theForm with Contacts = theForm.Contacts |> Array.filter (box >> isNull >> not) }
|
||||
let errors = [
|
||||
if form.FirstName = "" then "First Name is required"
|
||||
if form.LastName = "" then "Last Name is required"
|
||||
if form.NewPassword <> form.NewPassword then "New passwords do not match"
|
||||
if form.Contacts |> Array.exists (fun c -> c.ContactType = "") then "All Contact Types are required"
|
||||
if form.Contacts |> Array.exists (fun c -> c.Value = "") then "All Contacts are required"
|
||||
]
|
||||
if List.isEmpty errors then
|
||||
match! Data.findById (currentCitizenId ctx) with
|
||||
| Some citizen ->
|
||||
let password =
|
||||
if form.NewPassword = "" then citizen.PasswordHash
|
||||
else Auth.Passwords.hash citizen form.NewPassword
|
||||
do! Data.save
|
||||
{ citizen with
|
||||
FirstName = form.FirstName
|
||||
LastName = form.LastName
|
||||
DisplayName = noneIfEmpty form.DisplayName
|
||||
PasswordHash = password
|
||||
OtherContacts = form.Contacts
|
||||
|> Array.map (fun c ->
|
||||
{ OtherContact.Name = noneIfEmpty c.Name
|
||||
ContactType = ContactType.parse c.ContactType
|
||||
Value = c.Value
|
||||
IsPublic = c.IsPublic
|
||||
})
|
||||
|> List.ofArray
|
||||
}
|
||||
let extraMsg = if form.NewPassword = "" then "" else " and password changed"
|
||||
do! addSuccess $"Account profile updated{extraMsg} successfully" ctx
|
||||
return! redirectToGet "/citizen/account" next ctx
|
||||
| None -> return! Error.notFound next ctx
|
||||
else
|
||||
do! addErrors errors ctx
|
||||
return! Views.account form (isHtmx ctx) (csrf ctx) |> render "Account Profile" next ctx
|
||||
}
|
||||
|
||||
// GET: /citizen/so-long
|
||||
let soLong : HttpHandler = requireUser >=> fun next ctx ->
|
||||
Views.deletionOptions (csrf ctx) |> render "Account Deletion Options" next ctx
|
||||
|
||||
|
||||
open Giraffe.EndpointRouting
|
||||
|
||||
/// All endpoints for this feature
|
||||
let endpoints =
|
||||
subRoute "/citizen" [
|
||||
GET_HEAD [
|
||||
route "/account" account
|
||||
routef "/cancel-reset/%s" cancelReset
|
||||
routef "/confirm/%s" confirm
|
||||
route "/dashboard" dashboard
|
||||
routef "/deny/%s" deny
|
||||
route "/forgot-password" forgotPassword
|
||||
route "/log-off" logOff
|
||||
route "/log-on" logOn
|
||||
route "/register" register
|
||||
routef "/reset-password/%s" resetPassword
|
||||
route "/so-long" soLong
|
||||
]
|
||||
POST [
|
||||
route "/delete" delete
|
||||
route "/forgot-password" doForgotPassword
|
||||
route "/log-on" doLogOn
|
||||
route "/register" doRegistration
|
||||
route "/reset-password" doResetPassword
|
||||
route "/save-account" saveAccount
|
||||
]
|
||||
]
|
|
@ -1,23 +0,0 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net7.0</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Include="Domain.fs" />
|
||||
<Compile Include="Data.fs" />
|
||||
<Compile Include="Views.fs" />
|
||||
<Compile Include="Handlers.fs" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Common\JobsJobsJobs.Common.fsproj" />
|
||||
<ProjectReference Include="..\Profiles\JobsJobsJobs.Profiles.fsproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Update="FSharp.Core" Version="8.0.300" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
|
@ -1,395 +0,0 @@
|
|||
/// Views for URLs beginning with /citizen
|
||||
module JobsJobsJobs.Citizens.Views
|
||||
|
||||
open Giraffe.ViewEngine
|
||||
open Giraffe.ViewEngine.Htmx
|
||||
open JobsJobsJobs.Citizens.Domain
|
||||
open JobsJobsJobs.Common.Views
|
||||
open JobsJobsJobs.Domain
|
||||
|
||||
/// The form to add or edit a means of contact
|
||||
let contactEdit (contacts : OtherContactForm array) =
|
||||
let mapToInputs (idx : int) (contact : OtherContactForm) =
|
||||
div [ _id $"contactRow{idx}"; _class "row pb-3" ] [
|
||||
div [ _class "col-2 col-md-1" ] [
|
||||
button [ _type "button"; _class "btn btn-sm btn-outline-danger rounded-pill mt-3"; _title "Delete"
|
||||
_onclick $"jjj.citizen.removeContact({idx})" ] [ txt " − " ]
|
||||
]
|
||||
div [ _class "col-10 col-md-4 col-xl-3" ] [
|
||||
div [ _class "form-floating" ] [
|
||||
select [ _id $"contactType{idx}"; _name $"Contacts[{idx}].ContactType"; _class "form-control"
|
||||
_value contact.ContactType; _placeholder "Type"; _required ] [
|
||||
let optionFor value label =
|
||||
let typ = ContactType.toString value
|
||||
option [ _value typ; if contact.ContactType = typ then _selected ] [ txt label ]
|
||||
optionFor Website "Website"
|
||||
optionFor Email "E-mail Address"
|
||||
optionFor Phone "Phone Number"
|
||||
]
|
||||
label [ _class "jjj-required"; _for $"contactType{idx}" ] [ txt "Type" ]
|
||||
]
|
||||
]
|
||||
div [ _class "col-12 col-md-4 col-xl-3" ] [
|
||||
div [ _class "form-floating" ] [
|
||||
input [ _type "text"; _id $"contactName{idx}"; _name $"Contacts[{idx}].Name"; _class "form-control"
|
||||
_maxlength "1000"; _value contact.Name; _placeholder "Name" ]
|
||||
label [ _class "jjj-label"; _for $"contactName{idx}" ] [ txt "Name" ]
|
||||
]
|
||||
if idx < 1 then
|
||||
div [ _class "form-text" ] [ txt "Optional; will link sites and e-mail, qualify phone numbers" ]
|
||||
]
|
||||
div [ _class "col-12 col-md-7 offset-md-1 col-xl-4 offset-xl-0" ] [
|
||||
div [ _class "form-floating" ] [
|
||||
input [ _type "text"; _id $"contactValue{idx}"; _name $"Contacts[{idx}].Value"
|
||||
_class "form-control"; _maxlength "1000"; _value contact.Value; _placeholder "Contact"
|
||||
_required ]
|
||||
label [ _class "jjj-required"; _for "contactValue{idx}" ] [ txt "Contact" ]
|
||||
]
|
||||
if idx < 1 then div [ _class "form-text"] [ txt "The URL, e-mail address, or phone number" ]
|
||||
]
|
||||
div [ _class "col-12 col-md-3 offset-md-1 col-xl-1 offset-xl-0" ] [
|
||||
div [ _class "form-check mt-3" ] [
|
||||
input [ _type "checkbox"; _id $"contactIsPublic{idx}"; _name $"Contacts[{idx}].IsPublic";
|
||||
_class "form-check-input"; _value "true"; if contact.IsPublic then _checked ]
|
||||
label [ _class "form-check-label"; _for $"contactIsPublic{idx}" ] [ txt "Public" ]
|
||||
]
|
||||
]
|
||||
]
|
||||
template [ _id "newContact" ] [
|
||||
mapToInputs -1 { ContactType = "Website"; Name = ""; Value = ""; IsPublic = false }
|
||||
]
|
||||
:: (contacts |> Array.mapi mapToInputs |> List.ofArray)
|
||||
|
||||
/// The account edit page
|
||||
let account (m : AccountProfileForm) isHtmx csrf =
|
||||
pageWithTitle "Account Profile" [
|
||||
p [] [
|
||||
txt "This information is visible to all fellow logged-on citizens. For publicly-visible employment "
|
||||
txt "profiles and job listings, the “Display Name” fields and any public contacts will be "
|
||||
txt "displayed."
|
||||
]
|
||||
form [ _class "row g-3"; _method "POST"; _action "/citizen/save-account" ] [
|
||||
antiForgery csrf
|
||||
div [ _class "col-6 col-xl-4" ] [
|
||||
textBox [ _type "text"; _autofocus ] (nameof m.FirstName) m.FirstName "First Name" true
|
||||
]
|
||||
div [ _class "col-6 col-xl-4" ] [
|
||||
textBox [ _type "text" ] (nameof m.LastName) m.LastName "Last Name" true
|
||||
]
|
||||
div [ _class "col-6 col-xl-4" ] [
|
||||
textBox [ _type "text" ] (nameof m.DisplayName) m.DisplayName "Display Name" false
|
||||
div [ _class "form-text" ] [ em [] [ txt "Optional; overrides first/last for display" ] ]
|
||||
]
|
||||
div [ _class "col-6 col-xl-4" ] [
|
||||
textBox [ _type "password"; _minlength "8" ] (nameof m.NewPassword) "" "New Password" false
|
||||
div [ _class "form-text" ] [ txt "Leave blank to keep your current password" ]
|
||||
]
|
||||
div [ _class "col-6 col-xl-4" ] [
|
||||
textBox [ _type "password"; _minlength "8" ] (nameof m.NewPasswordConfirm) "" "Confirm New Password"
|
||||
false
|
||||
div [ _class "form-text" ] [ txt "Leave blank to keep your current password" ]
|
||||
]
|
||||
div [ _class "col-12" ] [
|
||||
hr []
|
||||
h4 [ _class "pb-2" ] [
|
||||
txt "Ways to Be Contacted "
|
||||
button [ _type "button"; _class "btn btn-sm btn-outline-primary rounded-pill"
|
||||
_onclick "jjj.citizen.addContact()" ] [ txt "Add a Contact Method" ]
|
||||
]
|
||||
]
|
||||
yield! contactEdit m.Contacts
|
||||
div [ _class "col-12" ] [ submitButton "content-save-outline" "Save" ]
|
||||
]
|
||||
hr []
|
||||
p [ _class "text-muted fst-italic" ] [
|
||||
txt "(If you want to delete your profile, or your entire account, "
|
||||
a [ _href "/citizen/so-long" ] [ rawText "see your deletion options here" ]; txt ".)"
|
||||
]
|
||||
jsOnLoad $"
|
||||
jjj.citizen.nextIndex = {m.Contacts.Length}
|
||||
jjj.citizen.validatePasswords('{nameof m.NewPassword}', '{nameof m.NewPasswordConfirm}', false)" isHtmx
|
||||
]
|
||||
|
||||
|
||||
/// The account confirmation page
|
||||
let confirmAccount isConfirmed =
|
||||
pageWithTitle "Account Confirmation" [
|
||||
p [] [
|
||||
if isConfirmed then
|
||||
txt "Your account was confirmed successfully! You may "
|
||||
a [ _href "/citizen/log-on" ] [ rawText "log on here" ]; txt "."
|
||||
else
|
||||
txt "The confirmation token did not match any pending accounts. Confirmation tokens are only valid for "
|
||||
txt "3 days; if the token expired, you will need to re-register, which "
|
||||
a [ _href "/citizen/register" ] [ txt "you can do here" ]; txt "."
|
||||
]
|
||||
]
|
||||
|
||||
/// The citizen's dashboard page
|
||||
let dashboard (citizen : Citizen) (profile : Profile option) profileCount tz =
|
||||
article [ _class "container" ] [
|
||||
h3 [ _class "pb-4" ] [ str $"ITM, {citizen.FirstName}!" ]
|
||||
div [ _class "row row-cols-1 row-cols-md-2" ] [
|
||||
div [ _class "col" ] [
|
||||
div [ _class "card h-100" ] [
|
||||
h5 [ _class "card-header" ] [ txt "Your Profile" ]
|
||||
div [ _class "card-body" ] [
|
||||
match profile with
|
||||
| Some prfl ->
|
||||
h6 [ _class "card-subtitle mb-3 text-muted fst-italic" ] [
|
||||
str $"Last updated {fullDateTime prfl.LastUpdatedOn tz}"
|
||||
]
|
||||
p [ _class "card-text" ] [
|
||||
txt $"Your profile currently lists {List.length prfl.Skills} skill"
|
||||
txt (if List.length prfl.Skills <> 1 then "s" else ""); txt "."
|
||||
if prfl.IsSeekingEmployment then
|
||||
br []; br []
|
||||
txt "Your profile indicates that you are seeking employment. Once you find it, "
|
||||
a [ _href "/success-story/add" ] [ txt "tell your fellow citizens about it!" ]
|
||||
]
|
||||
| None ->
|
||||
p [ _class "card-text" ] [
|
||||
txt "You do not have an employment profile established; click below (or “Edit "
|
||||
txt "Profile” in the menu) to get started!"
|
||||
]
|
||||
]
|
||||
div [ _class "card-footer" ] [
|
||||
match profile with
|
||||
| Some _ ->
|
||||
a [ _href $"/profile/{CitizenId.toString citizen.Id}/view"
|
||||
_class "btn btn-outline-secondary" ] [ txt "View Profile" ]; txt " "
|
||||
a [ _href "/profile/edit"; _class "btn btn-outline-secondary" ] [ txt "Edit Profile" ]
|
||||
| None ->
|
||||
a [ _href "/profile/edit"; _class "btn btn-primary" ] [ txt "Create Profile" ]
|
||||
]
|
||||
]
|
||||
]
|
||||
div [ _class "col" ] [
|
||||
div [ _class "card h-100" ] [
|
||||
h5 [ _class "card-header" ] [ txt "Other Citizens" ]
|
||||
div [ _class "card-body" ] [
|
||||
h6 [ _class "card-subtitle mb-3 text-muted fst-italic" ] [
|
||||
txt (if profileCount = 0L then "No" else $"{profileCount} Total")
|
||||
txt " Employment Profile"; txt (if profileCount <> 1 then "s" else "")
|
||||
]
|
||||
p [ _class "card-text" ] [
|
||||
if profileCount = 1 && Option.isSome profile then
|
||||
"It looks like, for now, it’s just you…"
|
||||
else if profileCount > 0 then "Take a look around and see if you can help them find work!"
|
||||
else "You can click below, but you will not find anything…"
|
||||
|> txt
|
||||
]
|
||||
]
|
||||
div [ _class "card-footer" ] [
|
||||
a [ _href "/profile/search"; _class "btn btn-outline-secondary" ] [ txt "Search Profiles" ]
|
||||
]
|
||||
]
|
||||
]
|
||||
]
|
||||
emptyP
|
||||
p [] [
|
||||
txt "To see how this application works, check out “How It Works” in the sidebar (last updated "
|
||||
txt "February 2<sup>nd</sup>, 2023)."
|
||||
]
|
||||
]
|
||||
|
||||
|
||||
/// The account deletion success page
|
||||
let deleted =
|
||||
pageWithTitle "Account Deletion Success" [
|
||||
emptyP; p [] [ txt "Your account has been successfully deleted." ]
|
||||
emptyP; p [] [ txt "Thank you for participating, and thank you for your courage. #GitmoNation" ]
|
||||
]
|
||||
|
||||
|
||||
/// The profile or account deletion page
|
||||
let deletionOptions csrf =
|
||||
pageWithTitle "Account Deletion Options" [
|
||||
h4 [ _class "pb-3" ] [ txt "Option 1 – Delete Your Profile" ]
|
||||
p [] [
|
||||
txt "Utilizing this option will remove your current employment profile and skills. This will preserve any "
|
||||
txt "job listings you may have posted, or any success stories you may have written, and preserves this "
|
||||
txt "this application’s knowledge of you. This is what you want to use if you want to clear out your "
|
||||
txt "profile and start again (and remove the current one from others’ view)."
|
||||
]
|
||||
form [ _class "text-center"; _method "POST"; _action "/profile/delete" ] [
|
||||
antiForgery csrf
|
||||
button [ _type "submit"; _class "btn btn-danger" ] [ txt "Delete Your Profile" ]
|
||||
]
|
||||
hr []
|
||||
h4 [ _class "pb-3" ] [ txt "Option 2 – Delete Your Account" ]
|
||||
p [] [
|
||||
txt "This option will make it like you never visited this site. It will delete your profile, skills, job "
|
||||
txt "listings, success stories, and account. This is what you want to use if you want to disappear from "
|
||||
txt "this application."
|
||||
]
|
||||
form [ _class "text-center"; _method "POST"; _action "/citizen/delete" ] [
|
||||
antiForgery csrf
|
||||
button [ _type "submit"; _class "btn btn-danger" ] [ txt "Delete Your Entire Account" ]
|
||||
]
|
||||
]
|
||||
|
||||
|
||||
/// The account denial page
|
||||
let denyAccount wasDeleted =
|
||||
pageWithTitle "Account Deletion" [
|
||||
p [] [
|
||||
if wasDeleted then txt "The account was deleted successfully; sorry for the trouble."
|
||||
else
|
||||
txt "The confirmation token did not match any pending accounts; if this was an inadvertently created "
|
||||
txt "account, it has likely already been deleted."
|
||||
]
|
||||
]
|
||||
|
||||
|
||||
/// The forgot / reset password page
|
||||
let forgotPassword csrf =
|
||||
let m = { Email = "" }
|
||||
pageWithTitle "Forgot Password" [
|
||||
p [] [
|
||||
txt "Enter your e-mail address below; if it matches the e-mail address of an account, we will send a "
|
||||
txt "password reset link."
|
||||
]
|
||||
form [ _class "row g-3 pb-3"; _method "POST"; _action "/citizen/forgot-password" ] [
|
||||
antiForgery csrf
|
||||
div [ _class "col-12 col-md-6 offset-md-3" ] [
|
||||
textBox [ _type "email"; _autofocus ] (nameof m.Email) m.Email "E-mail Address" true
|
||||
]
|
||||
div [ _class "col-12" ] [ submitButton "send-lock-outline" "Send Reset Link" ]
|
||||
]
|
||||
]
|
||||
|
||||
|
||||
/// The page displayed after a forgotten / reset request has been processed
|
||||
let forgotPasswordSent (m : ForgotPasswordForm) =
|
||||
pageWithTitle "Reset Request Processed" [
|
||||
p [] [
|
||||
txt $"The reset link request has been processed. If the e-mail address {m.Email} matched an account, "
|
||||
txt "further instructions were sent to that address."
|
||||
]
|
||||
]
|
||||
|
||||
|
||||
/// The log on page
|
||||
let logOn (m : LogOnForm) csrf =
|
||||
pageWithTitle "Log On" [
|
||||
match m.ErrorMessage with
|
||||
| Some msg ->
|
||||
p [ _class "pb-3 text-center" ] [
|
||||
span [ _class "text-danger" ] [ txt msg ]; br []
|
||||
if msg.IndexOf("ocked") > -1 then
|
||||
txt "If this is a new account, it must be confirmed before it can be used; otherwise, you need to "
|
||||
a [ _href "/citizen/forgot-password" ] [ txt "request an unlock code" ]
|
||||
txt " before you may log on."
|
||||
]
|
||||
| None -> ()
|
||||
form [ _class "row g-3 pb-3"; _hxPost "/citizen/log-on" ] [
|
||||
antiForgery csrf
|
||||
match m.ReturnTo with
|
||||
| Some returnTo -> input [ _type "hidden"; _name (nameof m.ReturnTo); _value returnTo ]
|
||||
| None -> ()
|
||||
div [ _class "col-12 col-md-6" ] [
|
||||
textBox [ _type "email"; _autofocus ] (nameof m.Email) m.Email "E-mail Address" true
|
||||
]
|
||||
div [ _class "col-12 col-md-6" ] [
|
||||
textBox [ _type "password" ] (nameof m.Password) "" "Password" true
|
||||
]
|
||||
div [ _class "col-12" ] [ submitButton "login" "Log On" ]
|
||||
]
|
||||
p [ _class "text-center" ] [
|
||||
txt "Need an account? "; a [ _href "/citizen/register" ] [ txt "Register for one!" ]
|
||||
]
|
||||
p [ _class "text-center" ] [
|
||||
txt "Forgot your password? "; a [ _href "/citizen/forgot-password" ] [ txt "Request a reset." ]
|
||||
]
|
||||
]
|
||||
|
||||
/// The registration page
|
||||
let register q1 q2 (m : RegisterForm) isHtmx csrf =
|
||||
pageWithTitle "Register" [
|
||||
form [ _class "row g-3"; _hxPost "/citizen/register" ] [
|
||||
antiForgery csrf
|
||||
div [ _class "col-6 col-xl-4" ] [
|
||||
textBox [ _type "text"; _autofocus ] (nameof m.FirstName) m.FirstName "First Name" true
|
||||
]
|
||||
div [ _class "col-6 col-xl-4" ] [
|
||||
textBox [ _type "text" ] (nameof m.LastName) m.LastName "Last Name" true
|
||||
]
|
||||
div [ _class "col-6 col-xl-4" ] [
|
||||
textBox [ _type "text" ] (nameof m.DisplayName) (defaultArg m.DisplayName "") "Display Name" false
|
||||
div [ _class "form-text fst-italic" ] [ txt "Optional; overrides first/last for display" ]
|
||||
]
|
||||
div [ _class "col-6 col-xl-4" ] [
|
||||
textBox [ _type "text" ] (nameof m.Email) m.Email "E-mail Address" true
|
||||
]
|
||||
div [ _class "col-6 col-xl-4" ] [
|
||||
textBox [ _type "password"; _minlength "8" ] (nameof m.Password) "" "Password" true
|
||||
]
|
||||
div [ _class "col-6 col-xl-4" ] [
|
||||
textBox [ _type "password"; _minlength "8" ] "ConfirmPassword" "" "Confirm Password" true
|
||||
]
|
||||
div [ _class "col-12" ] [
|
||||
hr []
|
||||
p [ _class "mb-0 text-muted fst-italic" ] [
|
||||
txt "Before your account request is through, you must answer these questions two…"
|
||||
]
|
||||
]
|
||||
div [ _class "col-12 col-xl-6" ] [
|
||||
textBox [ _type "text"; _maxlength "30" ] (nameof m.Question1Answer) m.Question1Answer q1 true
|
||||
input [ _type "hidden"; _name (nameof m.Question1Index); _value (string m.Question1Index ) ]
|
||||
]
|
||||
div [ _class "col-12 col-xl-6" ] [
|
||||
textBox [ _type "text"; _maxlength "30" ] (nameof m.Question2Answer) m.Question2Answer q2 true
|
||||
input [ _type "hidden"; _name (nameof m.Question2Index); _value (string m.Question2Index ) ]
|
||||
]
|
||||
div [ _class "col-12" ] [ submitButton "content-save-outline" "Save" ]
|
||||
jsOnLoad $"jjj.citizen.validatePasswords('{nameof m.Password}', 'ConfirmPassword', true)" isHtmx
|
||||
]
|
||||
]
|
||||
|
||||
/// The confirmation page for user registration
|
||||
let registered =
|
||||
pageWithTitle "Registration Successful" [
|
||||
p [] [
|
||||
txt "You have been successfully registered with Jobs, Jobs, Jobs. Check your e-mail for a confirmation "
|
||||
txt "link; it will be valid for the next 72 hours (3 days). Once you confirm your account, you will be "
|
||||
txt "able to log on using the e-mail address and password you provided."
|
||||
]
|
||||
p [] [
|
||||
txt "If the account is not confirmed within the 72-hour window, it will be deleted, and you will need to "
|
||||
txt "register again."
|
||||
]
|
||||
p [] [
|
||||
txt "If you encounter issues, feel free to reach out to @daniel@fedi.summershome.org for assistance."
|
||||
]
|
||||
]
|
||||
|
||||
/// The confirmation page for canceling a reset request
|
||||
let resetCanceled wasCanceled =
|
||||
let pgTitle = if wasCanceled then "Password Reset Request Canceled" else "Reset Request Not Found"
|
||||
pageWithTitle pgTitle [
|
||||
p [] [
|
||||
if wasCanceled then txt "Your password reset request has been canceled."
|
||||
else txt "There was no active password reset request found; it may have already expired."
|
||||
]
|
||||
]
|
||||
|
||||
|
||||
/// The password reset page
|
||||
let resetPassword (m : ResetPasswordForm) isHtmx csrf =
|
||||
pageWithTitle "Reset Password" [
|
||||
p [] [ txt "Enter your new password in the fields below" ]
|
||||
form [ _class "row g-3"; _method "POST"; _action "/citizen/reset-password" ] [
|
||||
antiForgery csrf
|
||||
input [ _type "hidden"; _name (nameof m.Id); _value m.Id ]
|
||||
input [ _type "hidden"; _name (nameof m.Token); _value m.Token ]
|
||||
div [ _class "col-12 col-md-6 col-xl-4 offset-xl-2" ] [
|
||||
textBox [ _type "password"; _minlength "8"; _autofocus ] (nameof m.Password) "" "New Password" true
|
||||
]
|
||||
div [ _class "col-12 col-md-6 col-xl-4" ] [
|
||||
textBox [ _type "password"; _minlength "8" ] "ConfirmPassword" "" "Confirm New Password" true
|
||||
]
|
||||
div [ _class "col-12" ] [ submitButton "lock-reset" "Reset Password" ]
|
||||
jsOnLoad $"jjj.citizen.validatePasswords('{nameof m.Password}', 'ConfirmPassword', true)" isHtmx
|
||||
]
|
||||
]
|
10
src/JobsJobsJobs/Client/App.razor
Normal file
10
src/JobsJobsJobs/Client/App.razor
Normal file
|
@ -0,0 +1,10 @@
|
|||
<Router AppAssembly="@typeof(Program).Assembly">
|
||||
<Found Context="routeData">
|
||||
<RouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)" />
|
||||
</Found>
|
||||
<NotFound>
|
||||
<LayoutView Layout="@typeof(MainLayout)">
|
||||
<p>Sorry, there's nothing at this address.</p>
|
||||
</LayoutView>
|
||||
</NotFound>
|
||||
</Router>
|
82
src/JobsJobsJobs/Client/AppState.cs
Normal file
82
src/JobsJobsJobs/Client/AppState.cs
Normal file
|
@ -0,0 +1,82 @@
|
|||
using JobsJobsJobs.Shared;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Net.Http;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace JobsJobsJobs.Client
|
||||
{
|
||||
/// <summary>
|
||||
/// Information about a user
|
||||
/// </summary>
|
||||
public record UserInfo(CitizenId Id, string Name);
|
||||
|
||||
/// <summary>
|
||||
/// Client-side application state for Jobs, Jobs, Jobs
|
||||
/// </summary>
|
||||
public class AppState
|
||||
{
|
||||
public event Action OnChange = () => { };
|
||||
|
||||
private UserInfo? _user = null;
|
||||
|
||||
/// <summary>
|
||||
/// The information of the currently logged-in user
|
||||
/// </summary>
|
||||
public UserInfo? User
|
||||
{
|
||||
get => _user;
|
||||
set
|
||||
{
|
||||
_user = value;
|
||||
NotifyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
private string _jwt = "";
|
||||
|
||||
/// <summary>
|
||||
/// The JSON Web Token (JWT) for the currently logged-on user
|
||||
/// </summary>
|
||||
public string Jwt
|
||||
{
|
||||
get => _jwt;
|
||||
set
|
||||
{
|
||||
_jwt = value;
|
||||
NotifyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
private IEnumerable<Continent>? _continents = null;
|
||||
|
||||
/// <summary>
|
||||
/// Get a list of continents (only retrieves once per application load)
|
||||
/// </summary>
|
||||
/// <param name="http">The HTTP client to use to obtain continents the first time</param>
|
||||
/// <returns>The list of continents</returns>
|
||||
/// <exception cref="ApplicationException">If the continents cannot be loaded</exception>
|
||||
public async Task<IEnumerable<Continent>> GetContinents(HttpClient http)
|
||||
{
|
||||
if (_continents == null)
|
||||
{
|
||||
ServerApi.SetJwt(http, this);
|
||||
var continentResult = await ServerApi.RetrieveMany<Continent>(http, "continent/all");
|
||||
|
||||
if (continentResult.IsOk)
|
||||
{
|
||||
_continents = continentResult.Ok;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new ApplicationException($"Could not load continents - {continentResult.Error}");
|
||||
}
|
||||
}
|
||||
return _continents;
|
||||
}
|
||||
|
||||
public AppState() { }
|
||||
|
||||
private void NotifyChanged() => OnChange.Invoke();
|
||||
}
|
||||
}
|
29
src/JobsJobsJobs/Client/JobsJobsJobs.Client.csproj
Normal file
29
src/JobsJobsJobs/Client/JobsJobsJobs.Client.csproj
Normal file
|
@ -0,0 +1,29 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk.BlazorWebAssembly">
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Blazored.Toast" Version="3.1.2" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="5.0.1" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="5.0.1" PrivateAssets="all" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.WebUtilities" Version="2.2.0" />
|
||||
<PackageReference Include="NodaTime.Serialization.SystemTextJson" Version="1.0.0" />
|
||||
<PackageReference Include="System.Net.Http.Json" Version="5.0.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Shared\JobsJobsJobs.Shared.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="wwwroot\audio\" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Content Update="wwwroot\audio\pelosi-jobs.mp3">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Update="wwwroot\audio\thats-true.mp3">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
11
src/JobsJobsJobs/Client/JobsJobsJobs.Client.csproj.user
Normal file
11
src/JobsJobsJobs/Client/JobsJobsJobs.Client.csproj.user
Normal file
|
@ -0,0 +1,11 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<RazorPage_SelectedScaffolderID>RazorPageScaffolder</RazorPage_SelectedScaffolderID>
|
||||
<RazorPage_SelectedScaffolderCategoryPath>root/Common/RazorPage</RazorPage_SelectedScaffolderCategoryPath>
|
||||
<ActiveDebugProfile>JobsJobsJobs</ActiveDebugProfile>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
||||
<DebuggerFlavor>ProjectDebugger</DebuggerFlavor>
|
||||
</PropertyGroup>
|
||||
</Project>
|
8
src/JobsJobsJobs/Client/Pages/Citizen/Authorized.razor
Normal file
8
src/JobsJobsJobs/Client/Pages/Citizen/Authorized.razor
Normal file
|
@ -0,0 +1,8 @@
|
|||
@page "/citizen/authorized"
|
||||
@inject HttpClient http
|
||||
@inject NavigationManager nav
|
||||
@inject AppState state
|
||||
|
||||
<PageTitle Title="Logging in..." />
|
||||
|
||||
<p>@Message</p>
|
40
src/JobsJobsJobs/Client/Pages/Citizen/Authorized.razor.cs
Normal file
40
src/JobsJobsJobs/Client/Pages/Citizen/Authorized.razor.cs
Normal file
|
@ -0,0 +1,40 @@
|
|||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.AspNetCore.WebUtilities;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace JobsJobsJobs.Client.Pages.Citizen
|
||||
{
|
||||
public partial class Authorized : ComponentBase
|
||||
{
|
||||
/// <summary>
|
||||
/// The message to be displayed on this page
|
||||
/// </summary>
|
||||
private string Message { get; set; } = "Logging you on with No Agenda Social...";
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
// Exchange authorization code for a JWT
|
||||
var query = QueryHelpers.ParseQuery(nav.ToAbsoluteUri(nav.Uri).Query);
|
||||
if (query.TryGetValue("code", out var authCode))
|
||||
{
|
||||
var logOnResult = await ServerApi.LogOn(http, authCode);
|
||||
|
||||
if (logOnResult.IsOk)
|
||||
{
|
||||
var logOn = logOnResult.Ok;
|
||||
state.User = new UserInfo(logOn.CitizenId, logOn.Name);
|
||||
state.Jwt = logOn.Jwt;
|
||||
nav.NavigateTo("/citizen/dashboard");
|
||||
}
|
||||
else
|
||||
{
|
||||
Message = logOnResult.Error;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Message = "Did not receive a token from No Agenda Social (perhaps you clicked \"Cancel\"?)";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
102
src/JobsJobsJobs/Client/Pages/Citizen/Dashboard.razor
Normal file
102
src/JobsJobsJobs/Client/Pages/Citizen/Dashboard.razor
Normal file
|
@ -0,0 +1,102 @@
|
|||
@page "/citizen/dashboard"
|
||||
@inject HttpClient http
|
||||
@inject AppState state
|
||||
|
||||
<PageTitle Title="Dashboard" />
|
||||
|
||||
<h3>Welcome, @state.User!.Name!</h3>
|
||||
|
||||
@if (RetrievingData)
|
||||
{
|
||||
<p>Retrieving your employment profile...</p>
|
||||
}
|
||||
else
|
||||
{
|
||||
<ErrorList Errors=@ErrorMessages>
|
||||
@if (Profile != null)
|
||||
{
|
||||
<p>
|
||||
Your employment profile was last updated <FullDateTime TheDate=@Profile.LastUpdatedOn />. Your profile currently
|
||||
lists @Profile.Skills.Length skill@(Profile.Skills.Length != 1 ? "s" : "").
|
||||
</p>
|
||||
<p><a href="/profile/view/@state.User.Id">View Your Employment Profile</a></p>
|
||||
}
|
||||
else
|
||||
{
|
||||
<p>
|
||||
You do not have an employment profile established; click “Edit Profile” in the menu to get
|
||||
started!
|
||||
</p>
|
||||
}
|
||||
<hr>
|
||||
<p>
|
||||
There @(ProfileCount == 1 ? "is" : "are") @(ProfileCount == 0 ? "no" : ProfileCount) employment
|
||||
profile@(ProfileCount != 1 ? "s" : "") from citizens of Gitmo Nation.
|
||||
@if (ProfileCount > 0)
|
||||
{
|
||||
<text>Take a look around and see if you can help them find work!</text>
|
||||
}
|
||||
</p>
|
||||
</ErrorList>
|
||||
}
|
||||
<hr>
|
||||
<h4>
|
||||
<a href="https://github.com/bit-badger/jobs-jobs-jobs/issues/3" target="_blank">Phase 3</a> – What Works
|
||||
<small><em>(v0.8 – Last Updated January 19<sup>th</sup>, 2021)</em></small>
|
||||
</h4>
|
||||
<p>
|
||||
The “View Profiles” link at the side now allows you to search for profiles by continent, the
|
||||
citizen’s desire for remote work, a skill, or any text in their professional biography and experience. If you
|
||||
find someone with whom you’d like to discuss potential opportunities, the name at the top of the profile links
|
||||
to their No Agenda Social account, where you can use its features to get in touch.
|
||||
</p>
|
||||
<hr>
|
||||
<h4>Phase 2 – What Works <small><em>(v0.7 – Last Updated January 8<sup>th</sup>, 2021)</em></small></h4>
|
||||
<p>
|
||||
If you’ve gotten this far, you’ve already passed
|
||||
<a href="https://github.com/bit-badger/jobs-jobs-jobs/issues/1" target="_blank">Phase 1</a>, which enabled users of
|
||||
No Agenda Social to create accounts here, simply by allowing the application read access to their profiles. Unless
|
||||
there are requests for tighter integration with that site, this is the only access to your NAS information that this
|
||||
application will require.
|
||||
</p>
|
||||
<p>
|
||||
<a href="https://github.com/bit-badger/jobs-jobs-jobs/issues/2" target="_blank">Phase 2</a> allows you to complete
|
||||
your employment profile. Much of this is straightforward, but there are a few things you might want to know before
|
||||
you fill it out:
|
||||
</p>
|
||||
<ul>
|
||||
<li>
|
||||
The “View Your Employment Profile” link (which you”ll see on this page, once your profile is
|
||||
established) shows your profile the way all other validated users will be able to see it (once
|
||||
<a href="https://github.com/bit-badger/jobs-jobs-jobs/issues/3" target="_blank">Phase 3</a> is complete). While
|
||||
this site does not perform communication with others over No Agenda Social, the name on employment profiles is a
|
||||
link to that user’s profile; from there, others can communicate further with you using the tools Mastodon
|
||||
provides.
|
||||
</li>
|
||||
<li>
|
||||
The “Professional Biography” and “Experience” sections support Markdown, a plain-text way
|
||||
to specify formatting quite similar to that provided by word processors. The
|
||||
<a href="https://daringfireball.net/projects/markdown/" target="_blank">original page</a> for the project is a good
|
||||
overview of its capabilities, and the pages at <a href="https://www.markdownguide.org/" target="_blank">Markdown
|
||||
Guide</a> give in-depth lessons to make the most of this language. The version of Markdown employed here supports
|
||||
many popular extensions, include smart quotes (turning "a quote" into “a quote”), tables,
|
||||
super/subscripts, and more.
|
||||
</li>
|
||||
<li>
|
||||
Skills are optional, but they are the place to record skills you have. Along with the skill, there is a
|
||||
“Notes” section, which can be used to indicate the time you’ve practiced a particular skill, the
|
||||
mastery you have of that skill, etc. It is free-form text, so it is all up to you how you utilize the field.
|
||||
</li>
|
||||
<li>
|
||||
The “Experience” field is intended to capture a chronological or topical employment history; with this
|
||||
“quick-n-dirty” implementation, this Markdown box can be used to capture that information however you
|
||||
would like it presented to fellow citizens.
|
||||
</li>
|
||||
<li>
|
||||
<a href="https://github.com/bit-badger/jobs-jobs-jobs/issues/5" target="_blank">Phase 5</a> includes allowing
|
||||
public access to the continent, region, and skills fields of Gitmo Nation citizens who indicate that they are both
|
||||
seeking employment <strong>and</strong> want their information disclosed to public users. The “Allow my
|
||||
profile to be searched publicly” checkbox, at the bottom of the page where you edit your employment profile,
|
||||
is how you opt your profile in to this list.
|
||||
</li>
|
||||
</ul>
|
66
src/JobsJobsJobs/Client/Pages/Citizen/Dashboard.razor.cs
Normal file
66
src/JobsJobsJobs/Client/Pages/Citizen/Dashboard.razor.cs
Normal file
|
@ -0,0 +1,66 @@
|
|||
using JobsJobsJobs.Shared.Api;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using Domain = JobsJobsJobs.Shared;
|
||||
|
||||
namespace JobsJobsJobs.Client.Pages.Citizen
|
||||
{
|
||||
/// <summary>
|
||||
/// The first page a user sees after signing in
|
||||
/// </summary>
|
||||
public partial class Dashboard : ComponentBase
|
||||
{
|
||||
/// <summary>
|
||||
/// Whether the data is being retrieved
|
||||
/// </summary>
|
||||
private bool RetrievingData { get; set; } = true;
|
||||
|
||||
/// <summary>
|
||||
/// The user's profile
|
||||
/// </summary>
|
||||
private Domain.Profile? Profile { get; set; } = null;
|
||||
|
||||
/// <summary>
|
||||
/// The number of profiles
|
||||
/// </summary>
|
||||
private int ProfileCount { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Error messages from data access
|
||||
/// </summary>
|
||||
private IList<string> ErrorMessages { get; } = new List<string>();
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
if (state.User != null)
|
||||
{
|
||||
ServerApi.SetJwt(http, state);
|
||||
var profileTask = ServerApi.RetrieveProfile(http, state);
|
||||
var profileCountTask = ServerApi.RetrieveOne<Count>(http, "profile/count");
|
||||
|
||||
await Task.WhenAll(profileTask, profileCountTask);
|
||||
|
||||
if (profileTask.Result.IsOk)
|
||||
{
|
||||
Profile = profileTask.Result.Ok;
|
||||
}
|
||||
else
|
||||
{
|
||||
ErrorMessages.Add(profileTask.Result.Error);
|
||||
}
|
||||
|
||||
if (profileCountTask.Result.IsOk)
|
||||
{
|
||||
ProfileCount = profileCountTask.Result.Ok?.Value ?? 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
ErrorMessages.Add(profileCountTask.Result.Error);
|
||||
}
|
||||
|
||||
RetrievingData = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
119
src/JobsJobsJobs/Client/Pages/Citizen/EditProfile.razor
Normal file
119
src/JobsJobsJobs/Client/Pages/Citizen/EditProfile.razor
Normal file
|
@ -0,0 +1,119 @@
|
|||
@page "/citizen/profile"
|
||||
@inject HttpClient http
|
||||
@inject AppState state
|
||||
@inject NavigationManager nav
|
||||
@inject IToastService toast
|
||||
|
||||
<PageTitle Title="Edit Profile" />
|
||||
|
||||
<h3>Employment Profile</h3>
|
||||
|
||||
@if (AllLoaded)
|
||||
{
|
||||
<ErrorList Errors=@ErrorMessages>
|
||||
<EditForm Model=@ProfileForm OnValidSubmit=@SaveProfile>
|
||||
<DataAnnotationsValidator />
|
||||
<div class="form-row">
|
||||
<div class="col">
|
||||
<div class="form-check">
|
||||
<InputCheckbox id="seeking" class="form-check-input" @bind-Value=@ProfileForm.IsSeekingEmployment />
|
||||
<label for="seeking" class="form-check-label">I am currently seeking employment</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<div class="col col-xs-12 col-sm-6 col-md-4">
|
||||
<div class="form-group">
|
||||
<label for="continentId" class="jjj-required">Continent</label>
|
||||
<InputSelect id="continentId" @bind-Value=@ProfileForm.ContinentId class="form-control">
|
||||
<option>– Select –</option>
|
||||
@foreach (var (id, name) in Continents)
|
||||
{
|
||||
<option value="@id">@name</option>
|
||||
}
|
||||
</InputSelect>
|
||||
<ValidationMessage For=@(() => ProfileForm.ContinentId) />
|
||||
</div>
|
||||
</div>
|
||||
<div class="col col-xs-12 col-sm-6 col-md-8">
|
||||
<div class="form-group">
|
||||
<label for="region" class="jjj-required">Region</label>
|
||||
<InputText id="region" @bind-Value=@ProfileForm.Region class="form-control"
|
||||
placeholder="Country, state, geographic area, etc." />
|
||||
<ValidationMessage For=@(() => ProfileForm.Region) />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<div class="col">
|
||||
<div class="form-group">
|
||||
<label for="bio" class="jjj-required">Professional Biography</label>
|
||||
<MarkdownEditor Id="bio" @bind-Text=@ProfileForm.Biography />
|
||||
<ValidationMessage For=@(() => ProfileForm.Biography) />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<div class="col col-xs-12 col-sm-12 offset-md-2 col-md-4">
|
||||
<div class="form-check">
|
||||
<InputCheckbox id="isRemote" class="form-check-input" @bind-Value=@ProfileForm.RemoteWork />
|
||||
<label for="isRemote" class="form-check-label">I am looking for remote work</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col col-xs-12 col-sm-12 col-md-4">
|
||||
<div class="form-check">
|
||||
<InputCheckbox id="isFull" class="form-check-input" @bind-Value=@ProfileForm.FullTime />
|
||||
<label for="isFull" class="form-check-label">I am looking for full-time work</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<hr>
|
||||
<h4>
|
||||
Skills
|
||||
<button type="button" class="btn btn-outline-primary" @onclick=@AddNewSkill>Add a Skill</button>
|
||||
</h4>
|
||||
@foreach (var skill in ProfileForm.Skills)
|
||||
{
|
||||
<SkillEdit Skill=@skill OnRemove=@RemoveSkill />
|
||||
}
|
||||
<hr>
|
||||
<h4>Experience</h4>
|
||||
<p>
|
||||
This application does not have a place to individually list your chronological job history; however, you can
|
||||
use this area to list prior jobs, their dates, and anything else you want to include that’s not already a
|
||||
part of your Professional Biography above.
|
||||
</p>
|
||||
<div class="form-row">
|
||||
<div class="col">
|
||||
<MarkdownEditor Id="experience" @bind-Text=@ProfileForm.Experience />
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<div class="col">
|
||||
<div class="form-check">
|
||||
<InputCheckbox id="isPublic" class="form-check-input" @bind-Value=@ProfileForm.IsPublic />
|
||||
<label for="isPublic" class="form-check-label">
|
||||
Allow my profile to be searched publicly (outside NA Social)
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<div class="col">
|
||||
<br>
|
||||
<button type="submit" class="btn btn-outline-primary">Save</button>
|
||||
</div>
|
||||
</div>
|
||||
</EditForm>
|
||||
@if (!IsNew)
|
||||
{
|
||||
<p>
|
||||
<br><a href="/profile/view/@state.User!.Id"><span class="oi oi-file"></span> View Your User Profile</a>
|
||||
</p>
|
||||
}
|
||||
</ErrorList>
|
||||
}
|
||||
else
|
||||
{
|
||||
<p>Loading your profile...</p>
|
||||
}
|
116
src/JobsJobsJobs/Client/Pages/Citizen/EditProfile.razor.cs
Normal file
116
src/JobsJobsJobs/Client/Pages/Citizen/EditProfile.razor.cs
Normal file
|
@ -0,0 +1,116 @@
|
|||
using JobsJobsJobs.Shared;
|
||||
using JobsJobsJobs.Shared.Api;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net.Http.Json;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace JobsJobsJobs.Client.Pages.Citizen
|
||||
{
|
||||
/// <summary>
|
||||
/// Profile edit page (called EditProfile so as not to create naming conflicts)
|
||||
/// </summary>
|
||||
public partial class EditProfile : ComponentBase
|
||||
{
|
||||
/// <summary>
|
||||
/// Counter for IDs when "Add a Skill" button is clicked
|
||||
/// </summary>
|
||||
private int _newSkillCounter = 0;
|
||||
|
||||
/// <summary>
|
||||
/// A flag that indicates all the required API calls have completed, and the form is ready to be displayed
|
||||
/// </summary>
|
||||
private bool AllLoaded { get; set; } = false;
|
||||
|
||||
/// <summary>
|
||||
/// The form for this page
|
||||
/// </summary>
|
||||
private ProfileForm ProfileForm { get; set; } = new ProfileForm();
|
||||
|
||||
/// <summary>
|
||||
/// All continents
|
||||
/// </summary>
|
||||
private IEnumerable<Continent> Continents { get; set; } = Enumerable.Empty<Continent>();
|
||||
|
||||
/// <summary>
|
||||
/// Whether this is a new profile or not
|
||||
/// </summary>
|
||||
private bool IsNew { get; set; } = false;
|
||||
|
||||
/// <summary>
|
||||
/// Error messages from API access
|
||||
/// </summary>
|
||||
private IList<string> ErrorMessages { get; } = new List<string>();
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
ServerApi.SetJwt(http, state);
|
||||
var continentTask = state.GetContinents(http);
|
||||
var profileTask = ServerApi.RetrieveProfile(http, state);
|
||||
|
||||
await Task.WhenAll(continentTask, profileTask);
|
||||
|
||||
Continents = continentTask.Result;
|
||||
|
||||
if (profileTask.Result.IsOk)
|
||||
{
|
||||
if (profileTask.Result.Ok == null)
|
||||
{
|
||||
ProfileForm = new ProfileForm();
|
||||
IsNew = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
ProfileForm = ProfileForm.FromProfile(profileTask.Result.Ok);
|
||||
}
|
||||
if (ProfileForm.Skills.Count == 0) AddNewSkill();
|
||||
}
|
||||
else
|
||||
{
|
||||
ErrorMessages.Add(profileTask.Result.Error);
|
||||
}
|
||||
|
||||
AllLoaded = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Add a new skill to the form
|
||||
/// </summary>
|
||||
private void AddNewSkill() =>
|
||||
ProfileForm.Skills.Add(new SkillForm { Id = $"new{_newSkillCounter++}" });
|
||||
|
||||
/// <summary>
|
||||
/// Remove the skill for the given ID
|
||||
/// </summary>
|
||||
/// <param name="skillId">The ID of the skill to remove</param>
|
||||
private void RemoveSkill(string skillId) =>
|
||||
ProfileForm.Skills.Remove(ProfileForm.Skills.First(s => s.Id == skillId));
|
||||
|
||||
/// <summary>
|
||||
/// Save changes to the current profile
|
||||
/// </summary>
|
||||
public async Task SaveProfile()
|
||||
{
|
||||
// Remove any skills left blank
|
||||
var blankSkills = ProfileForm.Skills
|
||||
.Where(s => string.IsNullOrEmpty(s.Description) && string.IsNullOrEmpty(s.Notes))
|
||||
.ToList();
|
||||
foreach (var blankSkill in blankSkills) ProfileForm.Skills.Remove(blankSkill);
|
||||
|
||||
var res = await http.PostAsJsonAsync("/api/profile/save", ProfileForm);
|
||||
if (res.IsSuccessStatusCode)
|
||||
{
|
||||
toast.ShowSuccess("Profile Saved Successfully");
|
||||
nav.NavigateTo($"/profile/view/{state.User!.Id}");
|
||||
}
|
||||
else
|
||||
{
|
||||
var error = await res.Content.ReadAsStringAsync();
|
||||
if (!string.IsNullOrEmpty(error)) error = $"- {error}";
|
||||
toast.ShowError($"{(int)res.StatusCode} {error}");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
13
src/JobsJobsJobs/Client/Pages/Citizen/LogOff.razor
Normal file
13
src/JobsJobsJobs/Client/Pages/Citizen/LogOff.razor
Normal file
|
@ -0,0 +1,13 @@
|
|||
@page "/citizen/log-off"
|
||||
@inject NavigationManager nav
|
||||
@inject AppState state
|
||||
@inject IToastService toast
|
||||
@code {
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
state.Jwt = "";
|
||||
state.User = null;
|
||||
toast.ShowSuccess("Have a Nice Day!", "Log Off Successful");
|
||||
nav.NavigateTo("/");
|
||||
}
|
||||
}
|
23
src/JobsJobsJobs/Client/Pages/Index.razor
Normal file
23
src/JobsJobsJobs/Client/Pages/Index.razor
Normal file
|
@ -0,0 +1,23 @@
|
|||
@page "/"
|
||||
@inject IJSRuntime js
|
||||
|
||||
<PageTitle Title="Welcome!" />
|
||||
|
||||
<p>
|
||||
Future home of No Agenda Jobs, where citizens of Gitmo Nation can assist one another in finding or enhancing their
|
||||
employment. This will enable them to continue providing value for value to Adam and John, as they continue their work
|
||||
deconstructing the misinformation that passes for news on a day-to-day basis.
|
||||
</p>
|
||||
<p>
|
||||
Do you not understand the terms in the paragraph above? No worries; just head over to
|
||||
<a href="https://noagendashow.net">
|
||||
The Best Podcast in the Universe
|
||||
</a> <em><a class="audio" @onclick=@PlayTrue>(that’s true!)</a></em> and find out what you’re missing.
|
||||
</p>
|
||||
<audio id="thatstrue">
|
||||
<source src="/audio/thats-true.mp3">
|
||||
</audio>
|
||||
|
||||
@code {
|
||||
async void PlayTrue() => await js.InvokeVoidAsync("Audio.play", "thatstrue");
|
||||
}
|
57
src/JobsJobsJobs/Client/Pages/Profile/Search.razor
Normal file
57
src/JobsJobsJobs/Client/Pages/Profile/Search.razor
Normal file
|
@ -0,0 +1,57 @@
|
|||
@page "/profile/search"
|
||||
@inject HttpClient http
|
||||
@inject NavigationManager nav
|
||||
@inject AppState state
|
||||
|
||||
<PageTitle Title="Search Profiles" />
|
||||
<h3>Search Profiles</h3>
|
||||
|
||||
<ErrorList Errors=@ErrorMessages>
|
||||
@if (Searching)
|
||||
{
|
||||
<p>Searching profiles...</p>
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!Searched)
|
||||
{
|
||||
<p>Enter one or more criteria to filter results, or just click “Search” to list all profiles.</p>
|
||||
}
|
||||
<Collapsible HeaderText="Search Criteria" Collapsed=@(Searched && SearchResults.Any())>
|
||||
<ProfileSearchForm Criteria=@Criteria OnSearch=@DoSearch Continents=@Continents />
|
||||
</Collapsible>
|
||||
<br>
|
||||
@if (SearchResults.Any())
|
||||
{
|
||||
<table class="table table-sm table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">Profile</th>
|
||||
<th scope="col">Name</th>
|
||||
<th scope="col" class="text-center">Seeking?</th>
|
||||
<th scope="col" class="text-center">Remote?</th>
|
||||
<th scope="col" class="text-center">Full-Time?</th>
|
||||
<th scope="col">Last Updated</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var profile in SearchResults)
|
||||
{
|
||||
<tr>
|
||||
<td><a href="/profile/view/@profile.CitizenId">View</a></td>
|
||||
<td class=@IsSeeking(profile)>@profile.DisplayName</td>
|
||||
<td class="text-center">@YesOrNo(profile.SeekingEmployment)</td>
|
||||
<td class="text-center">@YesOrNo(profile.RemoteWork)</td>
|
||||
<td class="text-center">@YesOrNo(profile.FullTime)</td>
|
||||
<td><FullDate TheDate=@profile.LastUpdated /></td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
}
|
||||
else if (Searched)
|
||||
{
|
||||
<p>No results found for the specified criteria</p>
|
||||
}
|
||||
}
|
||||
</ErrorList>
|
135
src/JobsJobsJobs/Client/Pages/Profile/Search.razor.cs
Normal file
135
src/JobsJobsJobs/Client/Pages/Profile/Search.razor.cs
Normal file
|
@ -0,0 +1,135 @@
|
|||
using JobsJobsJobs.Shared;
|
||||
using JobsJobsJobs.Shared.Api;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.AspNetCore.WebUtilities;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace JobsJobsJobs.Client.Pages.Profile
|
||||
{
|
||||
public partial class Search : ComponentBase
|
||||
{
|
||||
/// <summary>
|
||||
/// Whether a search has been performed
|
||||
/// </summary>
|
||||
private bool Searched { get; set; } = false;
|
||||
|
||||
/// <summary>
|
||||
/// Indicates whether a request for matching profiles is in progress
|
||||
/// </summary>
|
||||
private bool Searching { get; set; } = false;
|
||||
|
||||
/// <summary>
|
||||
/// The search criteria
|
||||
/// </summary>
|
||||
private ProfileSearch Criteria { get; set; } = new ProfileSearch();
|
||||
|
||||
/// <summary>
|
||||
/// Error messages encountered while searching for profiles
|
||||
/// </summary>
|
||||
private IList<string> ErrorMessages { get; } = new List<string>();
|
||||
|
||||
/// <summary>
|
||||
/// All continents
|
||||
/// </summary>
|
||||
private IEnumerable<Continent> Continents { get; set; } = Enumerable.Empty<Continent>();
|
||||
|
||||
/// <summary>
|
||||
/// The search results
|
||||
/// </summary>
|
||||
private IEnumerable<ProfileSearchResult> SearchResults { get; set; } = Enumerable.Empty<ProfileSearchResult>();
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
Continents = await state.GetContinents(http);
|
||||
|
||||
// Determine if we have searched before
|
||||
var query = QueryHelpers.ParseQuery(nav.ToAbsoluteUri(nav.Uri).Query);
|
||||
|
||||
if (query.TryGetValue("Searched", out var searched))
|
||||
{
|
||||
Searched = Convert.ToBoolean(searched);
|
||||
void setPart(string part, Action<string> func)
|
||||
{
|
||||
if (query.TryGetValue(part, out var partValue)) func(partValue);
|
||||
}
|
||||
setPart("ContinentId", x => Criteria.ContinentId = x);
|
||||
setPart("Skill", x => Criteria.Skill = x);
|
||||
setPart("BioExperience", x => Criteria.BioExperience = x);
|
||||
setPart("RemoteWork", x => Criteria.RemoteWork = x);
|
||||
|
||||
await RetrieveProfiles();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Do a search
|
||||
/// </summary>
|
||||
/// <remarks>This navigates with the parameters in the URL; this should trigger a search</remarks>
|
||||
private async Task DoSearch()
|
||||
{
|
||||
var query = SearchQuery();
|
||||
query.Add("Searched", "True");
|
||||
nav.NavigateTo(QueryHelpers.AddQueryString("/profile/search", query));
|
||||
await RetrieveProfiles();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Retreive profiles matching the current search criteria
|
||||
/// </summary>
|
||||
private async Task RetrieveProfiles()
|
||||
{
|
||||
Searching = true;
|
||||
|
||||
var searchResult = await ServerApi.RetrieveMany<ProfileSearchResult>(http,
|
||||
QueryHelpers.AddQueryString("profile/search", SearchQuery()));
|
||||
|
||||
if (searchResult.IsOk)
|
||||
{
|
||||
SearchResults = searchResult.Ok;
|
||||
}
|
||||
else
|
||||
{
|
||||
ErrorMessages.Add(searchResult.Error);
|
||||
}
|
||||
|
||||
Searched = true;
|
||||
Searching = false;
|
||||
}
|
||||
|
||||
private static string? IsSeeking(ProfileSearchResult profile) =>
|
||||
profile.SeekingEmployment ? "font-weight-bold" : null;
|
||||
|
||||
/// <summary>
|
||||
/// Return "Yes" for true and "No" for false
|
||||
/// </summary>
|
||||
/// <param name="condition">The condition in question</param>
|
||||
/// <returns>"Yes" for true, "No" for false</returns>
|
||||
private static string YesOrNo(bool condition) => condition ? "Yes" : "No";
|
||||
|
||||
/// <summary>
|
||||
/// Create a search query string from the currently-entered criteria
|
||||
/// </summary>
|
||||
/// <returns>The query string for the currently-entered criteria</returns>
|
||||
private IDictionary<string, string?> SearchQuery()
|
||||
{
|
||||
var dict = new Dictionary<string, string?>();
|
||||
if (Criteria.IsEmptySearch) return dict;
|
||||
|
||||
void part(string name, Func<ProfileSearch, string?> func)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(func(Criteria))) dict.Add(name, func(Criteria));
|
||||
}
|
||||
|
||||
part("ContinentId", it => it.ContinentId);
|
||||
part("Skill", it => it.Skill);
|
||||
part("BioExperience", it => it.BioExperience);
|
||||
part("RemoteWork", it => it.RemoteWork);
|
||||
|
||||
return dict;
|
||||
}
|
||||
}
|
||||
}
|
52
src/JobsJobsJobs/Client/Pages/Profile/View.razor
Normal file
52
src/JobsJobsJobs/Client/Pages/Profile/View.razor
Normal file
|
@ -0,0 +1,52 @@
|
|||
@page "/profile/view/{Id}"
|
||||
@inject HttpClient http
|
||||
@inject AppState state
|
||||
|
||||
@if (IsLoading)
|
||||
{
|
||||
<p>Loading profile...</p>
|
||||
}
|
||||
else
|
||||
{
|
||||
<PageTitle Title=@($"Employment Profile for {Citizen.DisplayName}") />
|
||||
<ErrorList Errors=@ErrorMessages>
|
||||
<h2><a href="@Citizen.ProfileUrl" target="_blank">@Citizen.DisplayName</a></h2>
|
||||
<h4>@Profile.Continent!.Name, @Profile.Region</h4>
|
||||
<p>@WorkTypes</p>
|
||||
|
||||
<hr>
|
||||
|
||||
<div>
|
||||
@(new MarkupString(Profile.Biography.ToHtml()))
|
||||
</div>
|
||||
|
||||
|
||||
@if (Profile.Skills.Length > 0)
|
||||
{
|
||||
<hr>
|
||||
<h4>Skills</h4>
|
||||
<ul>
|
||||
@foreach (var skill in Profile.Skills)
|
||||
{
|
||||
var notes = skill.Notes == null ? "" : $" ({skill.Notes})";
|
||||
<li>@skill.Description@notes</li>
|
||||
}
|
||||
</ul>
|
||||
}
|
||||
|
||||
@if (Profile.Experience != null)
|
||||
{
|
||||
<hr>
|
||||
<h4>Experience / Employment History</h4>
|
||||
<div>
|
||||
@(new MarkupString(Profile.Experience.ToHtml()))
|
||||
</div>
|
||||
}
|
||||
|
||||
@if (Id == state.User!.Id.ToString())
|
||||
{
|
||||
<hr>
|
||||
<p><a href="/citizen/profile"><span class="oi oi-pencil"></span> Edit Your Profile</a></p>
|
||||
}
|
||||
</ErrorList>
|
||||
}
|
99
src/JobsJobsJobs/Client/Pages/Profile/View.razor.cs
Normal file
99
src/JobsJobsJobs/Client/Pages/Profile/View.razor.cs
Normal file
|
@ -0,0 +1,99 @@
|
|||
using Microsoft.AspNetCore.Components;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Domain = JobsJobsJobs.Shared;
|
||||
|
||||
namespace JobsJobsJobs.Client.Pages.Profile
|
||||
{
|
||||
public partial class View : ComponentBase
|
||||
{
|
||||
/// <summary>
|
||||
/// Whether data for this component is loading
|
||||
/// </summary>
|
||||
private bool IsLoading { get; set; } = true;
|
||||
|
||||
/// <summary>
|
||||
/// The citizen whose profile is being displayed
|
||||
/// </summary>
|
||||
private Domain.Citizen Citizen { get; set; } = default!;
|
||||
|
||||
/// <summary>
|
||||
/// The profile to display
|
||||
/// </summary>
|
||||
private Domain.Profile Profile { get; set; } = default!;
|
||||
|
||||
/// <summary>
|
||||
/// The work types for the top of the page
|
||||
/// </summary>
|
||||
private MarkupString WorkTypes
|
||||
{
|
||||
get
|
||||
{
|
||||
IEnumerable<string> parts()
|
||||
{
|
||||
if (Profile.SeekingEmployment)
|
||||
{
|
||||
yield return "<strong><em>CURRENTLY SEEKING EMPLOYMENT</em></strong>";
|
||||
}
|
||||
else
|
||||
{
|
||||
yield return "Not actively seeking employment";
|
||||
}
|
||||
yield return $"{(Profile.FullTime ? "I" : "Not i")}nterested in full-time employment";
|
||||
yield return $"{(Profile.RemoteWork ? "I" : "Not i")}nterested in remote opportunities";
|
||||
}
|
||||
|
||||
return new MarkupString(string.Join(" • ", parts()));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Error messages from data retrieval
|
||||
/// </summary>
|
||||
private IList<string> ErrorMessages { get; } = new List<string>();
|
||||
|
||||
/// <summary>
|
||||
/// The ID of the citizen whose profile should be displayed
|
||||
/// </summary>
|
||||
[Parameter]
|
||||
public string Id { get; set; } = default!;
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
ServerApi.SetJwt(http, state);
|
||||
var citizenTask = ServerApi.RetrieveOne<Domain.Citizen>(http, $"citizen/get/{Id}");
|
||||
var profileTask = ServerApi.RetrieveOne<Domain.Profile>(http, $"profile/get/{Id}");
|
||||
|
||||
await Task.WhenAll(citizenTask, profileTask);
|
||||
|
||||
if (citizenTask.Result.IsOk && citizenTask.Result.Ok != null)
|
||||
{
|
||||
Citizen = citizenTask.Result.Ok;
|
||||
}
|
||||
else if (citizenTask.Result.IsOk)
|
||||
{
|
||||
ErrorMessages.Add("Citizen not found");
|
||||
}
|
||||
else
|
||||
{
|
||||
ErrorMessages.Add(citizenTask.Result.Error);
|
||||
}
|
||||
|
||||
if (profileTask.Result.IsOk && profileTask.Result.Ok != null)
|
||||
{
|
||||
Profile = profileTask.Result.Ok;
|
||||
}
|
||||
else if (profileTask.Result.IsOk)
|
||||
{
|
||||
ErrorMessages.Add("Profile not found");
|
||||
}
|
||||
else
|
||||
{
|
||||
ErrorMessages.Add(profileTask.Result.Error);
|
||||
}
|
||||
|
||||
IsLoading = false;
|
||||
}
|
||||
}
|
||||
}
|
27
src/JobsJobsJobs/Client/Program.cs
Normal file
27
src/JobsJobsJobs/Client/Program.cs
Normal file
|
@ -0,0 +1,27 @@
|
|||
using Blazored.Toast;
|
||||
using Microsoft.AspNetCore.Components.WebAssembly.Hosting;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using NodaTime;
|
||||
using NodaTime.Serialization.SystemTextJson;
|
||||
using System;
|
||||
using System.Net.Http;
|
||||
using System.Text.Json;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace JobsJobsJobs.Client
|
||||
{
|
||||
public class Program
|
||||
{
|
||||
public static async Task Main(string[] args)
|
||||
{
|
||||
var builder = WebAssemblyHostBuilder.CreateDefault(args);
|
||||
builder.RootComponents.Add<App>("#app");
|
||||
|
||||
builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) });
|
||||
builder.Services.AddSingleton(new AppState());
|
||||
builder.Services.AddSingleton(new JsonSerializerOptions().ConfigureForNodaTime(DateTimeZoneProviders.Tzdb));
|
||||
builder.Services.AddBlazoredToast();
|
||||
await builder.Build().RunAsync();
|
||||
}
|
||||
}
|
||||
}
|
30
src/JobsJobsJobs/Client/Properties/launchSettings.json
Normal file
30
src/JobsJobsJobs/Client/Properties/launchSettings.json
Normal file
|
@ -0,0 +1,30 @@
|
|||
{
|
||||
"iisSettings": {
|
||||
"windowsAuthentication": false,
|
||||
"anonymousAuthentication": true,
|
||||
"iisExpress": {
|
||||
"applicationUrl": "http://localhost:49363",
|
||||
"sslPort": 44308
|
||||
}
|
||||
},
|
||||
"profiles": {
|
||||
"IIS Express": {
|
||||
"commandName": "IISExpress",
|
||||
"launchBrowser": true,
|
||||
"inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
},
|
||||
"JobsJobsJobs": {
|
||||
"commandName": "Project",
|
||||
"dotnetRunMessages": "true",
|
||||
"launchBrowser": true,
|
||||
"inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
|
||||
"applicationUrl": "https://localhost:5001;http://localhost:5000",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
183
src/JobsJobsJobs/Client/ServerApi.cs
Normal file
183
src/JobsJobsJobs/Client/ServerApi.cs
Normal file
|
@ -0,0 +1,183 @@
|
|||
using JobsJobsJobs.Shared;
|
||||
using JobsJobsJobs.Shared.Api;
|
||||
using NodaTime;
|
||||
using NodaTime.Serialization.SystemTextJson;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Net.Http.Headers;
|
||||
using System.Net.Http.Json;
|
||||
using System.Text.Json;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace JobsJobsJobs.Client
|
||||
{
|
||||
/// <summary>
|
||||
/// Functions used to access the API
|
||||
/// </summary>
|
||||
public static class ServerApi
|
||||
{
|
||||
/// <summary>
|
||||
/// System.Text.Json options configured for NodaTime
|
||||
/// </summary>
|
||||
private static readonly JsonSerializerOptions _serializerOptions;
|
||||
|
||||
/// <summary>
|
||||
/// Static constructor
|
||||
/// </summary>
|
||||
static ServerApi()
|
||||
{
|
||||
|
||||
var options = new JsonSerializerOptions
|
||||
{
|
||||
PropertyNamingPolicy = JsonNamingPolicy.CamelCase
|
||||
};
|
||||
options.ConfigureForNodaTime(DateTimeZoneProviders.Tzdb);
|
||||
_serializerOptions = options;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create an API URL
|
||||
/// </summary>
|
||||
/// <param name="url">The URL to append to the API base URL</param>
|
||||
/// <returns>The full URL to be used in HTTP requests</returns>
|
||||
private static string ApiUrl(string url) => $"/api/{url}";
|
||||
|
||||
/// <summary>
|
||||
/// Create an HTTP request with an authorization header
|
||||
/// </summary>
|
||||
/// <param name="state">The current application state</param>
|
||||
/// <param name="url">The URL for the request (will be appended to the API root)</param>
|
||||
/// <param name="method">The request method (optional, defaults to GET)</param>
|
||||
/// <returns>A request with the header attached, ready for further manipulation</returns>
|
||||
private static HttpRequestMessage WithHeader(AppState state, string url, HttpMethod? method = null)
|
||||
{
|
||||
var req = new HttpRequestMessage(method ?? HttpMethod.Get, ApiUrl(url));
|
||||
req.Headers.Authorization = new AuthenticationHeaderValue("Bearer", state.Jwt);
|
||||
return req;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set the JSON Web Token (JWT) bearer header for the given HTTP client
|
||||
/// </summary>
|
||||
/// <param name="http">The HTTP client whose authentication header should be set</param>
|
||||
/// <param name="state">The current application state</param>
|
||||
public static void SetJwt(HttpClient http, AppState state)
|
||||
{
|
||||
if (state.User != null)
|
||||
{
|
||||
http.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", state.Jwt);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Log on a user with the authorization code received from No Agenda Social
|
||||
/// </summary>
|
||||
/// <param name="http">The HTTP client to use for server communication</param>
|
||||
/// <param name="authCode">The authorization code received from NAS</param>
|
||||
/// <returns>The log on details if successful, an error if not</returns>
|
||||
public static async Task<Result<LogOnSuccess>> LogOn(HttpClient http, string authCode)
|
||||
{
|
||||
try
|
||||
{
|
||||
var logOn = await http.GetFromJsonAsync<LogOnSuccess>(ApiUrl($"citizen/log-on/{authCode}"));
|
||||
if (logOn == null) {
|
||||
return Result<LogOnSuccess>.AsError(
|
||||
"Unable to log on with No Agenda Social. This should never happen; contact @danieljsummers");
|
||||
}
|
||||
return Result<LogOnSuccess>.AsOk(logOn);
|
||||
}
|
||||
catch (HttpRequestException ex)
|
||||
{
|
||||
return Result<LogOnSuccess>.AsError($"Unable to log on with No Agenda Social: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Retrieve a citizen's profile
|
||||
/// </summary>
|
||||
/// <param name="http">The HTTP client to use for server communication</param>
|
||||
/// <param name="state">The current application state</param>
|
||||
/// <returns>The citizen's profile, null if it is not found, or an error message if one occurs</returns>
|
||||
public static async Task<Result<Profile?>> RetrieveProfile(HttpClient http, AppState state)
|
||||
{
|
||||
var req = WithHeader(state, "profile/");
|
||||
var res = await http.SendAsync(req);
|
||||
return true switch
|
||||
{
|
||||
_ when res.StatusCode == HttpStatusCode.NoContent => Result<Profile?>.AsOk(null),
|
||||
_ when res.IsSuccessStatusCode => Result<Profile?>.AsOk(
|
||||
await res.Content.ReadFromJsonAsync<Profile>(_serializerOptions)),
|
||||
_ => Result<Profile?>.AsError(await res.Content.ReadAsStringAsync()),
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Retrieve all continents
|
||||
/// </summary>
|
||||
/// <param name="http">The HTTP client to use for server communication</param>
|
||||
/// <param name="state">The current application state</param>
|
||||
/// <returns>The continents, or an error message if one occurs</returns>
|
||||
public static async Task<Result<IEnumerable<Continent>>> AllContinents(HttpClient http, AppState state)
|
||||
{
|
||||
var req = WithHeader(state, "continent/all");
|
||||
var res = await http.SendAsync(req);
|
||||
if (res.IsSuccessStatusCode) {
|
||||
var continents = await res.Content.ReadFromJsonAsync<IEnumerable<Continent>>();
|
||||
return Result<IEnumerable<Continent>>.AsOk(continents ?? Enumerable.Empty<Continent>());
|
||||
}
|
||||
return Result<IEnumerable<Continent>>.AsError(await res.Content.ReadAsStringAsync());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Retrieve many items from the given URL
|
||||
/// </summary>
|
||||
/// <typeparam name="T">The type of item expected</typeparam>
|
||||
/// <param name="http">The HTTP client to use for server communication</param>
|
||||
/// <param name="url">The API URL to call</param>
|
||||
/// <returns>A result with the items, or an error if one occurs</returns>
|
||||
/// <remarks>The caller is responsible for setting the JWT on the HTTP client</remarks>
|
||||
public static async Task<Result<IEnumerable<T>>> RetrieveMany<T>(HttpClient http, string url)
|
||||
{
|
||||
try
|
||||
{
|
||||
var results = await http.GetFromJsonAsync<IEnumerable<T>>($"/api/{url}", _serializerOptions);
|
||||
return Result<IEnumerable<T>>.AsOk(results ?? Enumerable.Empty<T>());
|
||||
}
|
||||
catch (HttpRequestException ex)
|
||||
{
|
||||
return Result<IEnumerable<T>>.AsError(ex.Message);
|
||||
}
|
||||
catch (JsonException ex)
|
||||
{
|
||||
return Result<IEnumerable<T>>.AsError($"Unable to parse result: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Retrieve one item from the given URL
|
||||
/// </summary>
|
||||
/// <typeparam name="T">The type of item expected</typeparam>
|
||||
/// <param name="http">The HTTP client to use for server communication</param>
|
||||
/// <param name="url">The API URL to call</param>
|
||||
/// <returns>A result with the item (possibly null), or an error if one occurs</returns>
|
||||
/// <remarks>The caller is responsible for setting the JWT on the HTTP client</remarks>
|
||||
public static async Task<Result<T?>> RetrieveOne<T>(HttpClient http, string url)
|
||||
{
|
||||
try
|
||||
{
|
||||
return Result<T?>.AsOk(await http.GetFromJsonAsync<T>($"/api/{url}", _serializerOptions));
|
||||
}
|
||||
catch (HttpRequestException ex)
|
||||
{
|
||||
return Result<T?>.AsError(ex.Message);
|
||||
}
|
||||
catch (JsonException ex)
|
||||
{
|
||||
return Result<T?>.AsError($"Unable to parse result: {ex.Message}");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
25
src/JobsJobsJobs/Client/Shared/Collapsible.razor
Normal file
25
src/JobsJobsJobs/Client/Shared/Collapsible.razor
Normal file
|
@ -0,0 +1,25 @@
|
|||
<div class="card">
|
||||
<div class="card-header">
|
||||
<a href="#" class="@(Collapsed ? "jjj-c-collapsed" : "jjj-c-open")"
|
||||
@onclick=@Toggle @onclick:preventDefault>
|
||||
@HeaderText
|
||||
</a>
|
||||
</div>
|
||||
@if (!Collapsed)
|
||||
{
|
||||
<div class="card-body">@ChildContent</div>
|
||||
}
|
||||
</div>
|
||||
|
||||
@code {
|
||||
[Parameter]
|
||||
public RenderFragment ChildContent { get; set; } = default!;
|
||||
|
||||
[Parameter]
|
||||
public bool Collapsed { get; set; } = false;
|
||||
|
||||
[Parameter]
|
||||
public string HeaderText { get; set; } = "Toggle";
|
||||
|
||||
private void Toggle() => Collapsed = !Collapsed;
|
||||
}
|
16
src/JobsJobsJobs/Client/Shared/Collapsible.razor.css
Normal file
16
src/JobsJobsJobs/Client/Shared/Collapsible.razor.css
Normal file
|
@ -0,0 +1,16 @@
|
|||
a.jjj-c-collapsed,
|
||||
a.jjj-c-open {
|
||||
text-decoration: none;
|
||||
font-weight: bold;
|
||||
color: black;
|
||||
}
|
||||
a.jjj-c-collapsed:hover,
|
||||
a.jjj-c-open:hover {
|
||||
cursor: pointer;
|
||||
}
|
||||
.jjj-c-collapsed::before {
|
||||
content: '\2b9e \00a0';
|
||||
}
|
||||
.jjj-c-open::before {
|
||||
content: '\2b9f \00a0';
|
||||
}
|
22
src/JobsJobsJobs/Client/Shared/ErrorList.razor
Normal file
22
src/JobsJobsJobs/Client/Shared/ErrorList.razor
Normal file
|
@ -0,0 +1,22 @@
|
|||
@if (Errors.Count == 0)
|
||||
{
|
||||
@ChildContent
|
||||
}
|
||||
else
|
||||
{
|
||||
<p>The following error@(Errors.Count == 1 ? "" : "s") occurred:</p>
|
||||
<ul>
|
||||
@foreach (var msg in Errors)
|
||||
{
|
||||
<li><pre>@msg</pre></li>
|
||||
}
|
||||
</ul>
|
||||
}
|
||||
|
||||
@code {
|
||||
[Parameter]
|
||||
public IList<string> Errors { get; set; } = default!;
|
||||
|
||||
[Parameter]
|
||||
public RenderFragment ChildContent { get; set; } = default!;
|
||||
}
|
23
src/JobsJobsJobs/Client/Shared/FullDate.razor
Normal file
23
src/JobsJobsJobs/Client/Shared/FullDate.razor
Normal file
|
@ -0,0 +1,23 @@
|
|||
@using NodaTime
|
||||
@using NodaTime.Text
|
||||
@using System.Globalization
|
||||
|
||||
@Translated
|
||||
|
||||
@code {
|
||||
/// <summary>
|
||||
/// The pattern with which dates will be formatted
|
||||
/// </summary>
|
||||
private static InstantPattern pattern = InstantPattern.Create("ld<MMMM d, yyyy>", CultureInfo.CurrentCulture);
|
||||
|
||||
/// <summary>
|
||||
/// The date to be formatted
|
||||
/// </summary>
|
||||
[Parameter]
|
||||
public Instant TheDate { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The formatted date
|
||||
/// </summary>
|
||||
private string Translated => pattern.Format(TheDate);
|
||||
}
|
23
src/JobsJobsJobs/Client/Shared/FullDateTime.razor
Normal file
23
src/JobsJobsJobs/Client/Shared/FullDateTime.razor
Normal file
|
@ -0,0 +1,23 @@
|
|||
@using NodaTime
|
||||
@using NodaTime.Text
|
||||
@using System.Globalization
|
||||
|
||||
@Translated
|
||||
|
||||
@code {
|
||||
/// <summary>
|
||||
/// The pattern with which dates will be formatted
|
||||
/// </summary>
|
||||
private static InstantPattern pattern = InstantPattern.Create("ld<D> ' at ' lt<t>", CultureInfo.CurrentCulture);
|
||||
|
||||
/// <summary>
|
||||
/// The date to be formatted
|
||||
/// </summary>
|
||||
[Parameter]
|
||||
public Instant TheDate { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The formatted date
|
||||
/// </summary>
|
||||
private string Translated => pattern.Format(TheDate);
|
||||
}
|
41
src/JobsJobsJobs/Client/Shared/MainLayout.razor
Normal file
41
src/JobsJobsJobs/Client/Shared/MainLayout.razor
Normal file
|
@ -0,0 +1,41 @@
|
|||
@inherits LayoutComponentBase
|
||||
@using System.Reflection
|
||||
@inject IJSRuntime js
|
||||
@using Blazored.Toast.Configuration
|
||||
|
||||
<div class="page">
|
||||
<div class="sidebar">
|
||||
<NavMenu />
|
||||
</div>
|
||||
|
||||
<div class="main">
|
||||
<div class="top-row px-4">
|
||||
<em>(...and Jobs - <a class="audio" @onclick="PlayJobs">Let's Vote for Jobs!</a>)</em>
|
||||
</div>
|
||||
|
||||
<div class="content px-4">
|
||||
@Body
|
||||
</div>
|
||||
<audio id="pelosijobs">
|
||||
<source src="/audio/pelosi-jobs.mp3">
|
||||
</audio>
|
||||
|
||||
<div class="app-version">Jobs, Jobs, Jobs @Version</div>
|
||||
</div>
|
||||
</div>
|
||||
<BlazoredToasts Position="ToastPosition.BottomRight"
|
||||
ShowProgressBar="true" />
|
||||
|
||||
@code {
|
||||
async void PlayJobs() => await js.InvokeVoidAsync("Audio.play", "pelosijobs");
|
||||
|
||||
private string Version { get; set; } = "";
|
||||
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
var version = Assembly.GetExecutingAssembly().GetName().Version!;
|
||||
Version = $"v{version.Major}.{version.Minor}";
|
||||
if (version.Build > 0) Version += $".{version.Build}";
|
||||
base.OnInitialized();
|
||||
}
|
||||
}
|
79
src/JobsJobsJobs/Client/Shared/MainLayout.razor.css
Normal file
79
src/JobsJobsJobs/Client/Shared/MainLayout.razor.css
Normal file
|
@ -0,0 +1,79 @@
|
|||
.page {
|
||||
position: relative;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.main {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.sidebar {
|
||||
background-image: linear-gradient(180deg, darkgreen 0%, green 70%);
|
||||
}
|
||||
|
||||
.top-row {
|
||||
background-color: #f7f7f7;
|
||||
border-bottom: 1px solid #d6d5d5;
|
||||
justify-content: flex-end;
|
||||
height: 3.5rem;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
color: rgba(0, 0, 0, .5);
|
||||
}
|
||||
|
||||
.top-row ::deep a, .top-row .btn-link {
|
||||
white-space: nowrap;
|
||||
/* margin-left: 1.5rem; */
|
||||
}
|
||||
|
||||
.top-row a:first-child {
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
@media (max-width: 640.98px) {
|
||||
.top-row:not(.auth) {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.top-row.auth {
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.top-row a, .top-row .btn-link {
|
||||
margin-left: 0;
|
||||
}
|
||||
}
|
||||
|
||||
@media (min-width: 641px) {
|
||||
.page {
|
||||
flex-direction: row;
|
||||
}
|
||||
|
||||
.sidebar {
|
||||
width: 250px;
|
||||
height: 100vh;
|
||||
position: sticky;
|
||||
top: 0;
|
||||
}
|
||||
|
||||
.top-row {
|
||||
position: sticky;
|
||||
top: 0;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
.main > div {
|
||||
padding-left: 2rem !important;
|
||||
padding-right: 1.5rem !important;
|
||||
}
|
||||
}
|
||||
|
||||
.app-version {
|
||||
padding-top: 2rem;
|
||||
text-align: right;
|
||||
color: rgba(0, 0, 0, .25);
|
||||
font-style: italic;
|
||||
font-size: .8rem;
|
||||
}
|
15
src/JobsJobsJobs/Client/Shared/MarkdownEditor.razor
Normal file
15
src/JobsJobsJobs/Client/Shared/MarkdownEditor.razor
Normal file
|
@ -0,0 +1,15 @@
|
|||
<nav class="nav nav-pills">
|
||||
<a href="#" class="nav-link @MarkdownClass" @onclick="ShowMarkdown" @onclick:preventDefault>Markdown</a>
|
||||
<a href="#" class="nav-link @PreviewClass" @onclick="ShowPreview" @onclick:preventDefault>Preview</a>
|
||||
</nav>
|
||||
@if (_showPreview)
|
||||
{
|
||||
<section class="preview">
|
||||
@PreviewText
|
||||
</section>
|
||||
}
|
||||
else
|
||||
{
|
||||
<textarea id="@Id" @bind="@PlainText" @bind:event="oninput" class="form-control" rows="10">
|
||||
</textarea>
|
||||
}
|
88
src/JobsJobsJobs/Client/Shared/MarkdownEditor.razor.cs
Normal file
88
src/JobsJobsJobs/Client/Shared/MarkdownEditor.razor.cs
Normal file
|
@ -0,0 +1,88 @@
|
|||
using Markdig;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
|
||||
namespace JobsJobsJobs.Client.Shared
|
||||
{
|
||||
/// <summary>
|
||||
/// Code-behind for the Markdown Editor component
|
||||
/// </summary>
|
||||
public partial class MarkdownEditor : ComponentBase
|
||||
{
|
||||
/// <summary>
|
||||
/// Pipeline with most extensions enabled
|
||||
/// </summary>
|
||||
private readonly MarkdownPipeline _pipeline = new MarkdownPipelineBuilder()
|
||||
.UseSmartyPants().UseAdvancedExtensions().Build();
|
||||
|
||||
/// <summary>
|
||||
/// Whether the preview should be shown
|
||||
/// </summary>
|
||||
private bool _showPreview = false;
|
||||
|
||||
/// <summary>
|
||||
/// Backing field for the plain-text representation of this document
|
||||
/// </summary>
|
||||
private string _text = "";
|
||||
|
||||
/// <summary>
|
||||
/// The plain-text (Markdown source)
|
||||
/// </summary>
|
||||
private string PlainText {
|
||||
get => _text;
|
||||
set
|
||||
{
|
||||
_text = value;
|
||||
TextChanged.InvokeAsync(_text).ConfigureAwait(false).GetAwaiter().GetResult();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The rendered HTML
|
||||
/// </summary>
|
||||
private MarkupString PreviewText => (MarkupString)Markdown.ToHtml(_text, _pipeline);
|
||||
|
||||
/// <summary>
|
||||
/// CSS class for the "Markdown" tab (active if preview not shown)
|
||||
/// </summary>
|
||||
private string MarkdownClass => _showPreview ? "" : "active";
|
||||
|
||||
/// <summary>
|
||||
/// CSS class for the "Preview" tab (active if preview shown)
|
||||
/// </summary>
|
||||
private string PreviewClass => _showPreview ? "active" : "";
|
||||
|
||||
/// <summary>
|
||||
/// The ID used for the textarea; allows for a label to be assigned
|
||||
/// </summary>
|
||||
[Parameter]
|
||||
public string Id { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// The text value of the Markdown
|
||||
/// </summary>
|
||||
[Parameter]
|
||||
public string Text { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// Event fired when the text is changed
|
||||
/// </summary>
|
||||
[Parameter]
|
||||
public EventCallback<string> TextChanged { get; set; }
|
||||
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
base.OnInitialized();
|
||||
_text = Text;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Show the Markdown editor
|
||||
/// </summary>
|
||||
private void ShowMarkdown() => _showPreview = false;
|
||||
|
||||
/// <summary>
|
||||
/// Show the Markdown preview
|
||||
/// </summary>
|
||||
private void ShowPreview() => _showPreview = true;
|
||||
}
|
||||
}
|
5
src/JobsJobsJobs/Client/Shared/MarkdownEditor.razor.css
Normal file
5
src/JobsJobsJobs/Client/Shared/MarkdownEditor.razor.css
Normal file
|
@ -0,0 +1,5 @@
|
|||
section.preview {
|
||||
border: solid 1px darkgray;
|
||||
border-radius: .5rem;
|
||||
padding: .25rem;
|
||||
}
|
96
src/JobsJobsJobs/Client/Shared/NavMenu.razor
Normal file
96
src/JobsJobsJobs/Client/Shared/NavMenu.razor
Normal file
|
@ -0,0 +1,96 @@
|
|||
@inject AppState state
|
||||
@inject NavigationManager nav
|
||||
@implements IDisposable
|
||||
|
||||
<div class="top-row pl-4 navbar navbar-dark">
|
||||
<a class="navbar-brand" href="">Jobs, Jobs, Jobs</a>
|
||||
<button class="navbar-toggler" @onclick="ToggleNavMenu">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="@NavMenuCssClass" @onclick="ToggleNavMenu">
|
||||
<ul class="nav flex-column">
|
||||
<li class="nav-item px-3">
|
||||
<NavLink class="nav-link" href="" Match="NavLinkMatch.All">
|
||||
<span class="oi oi-home" aria-hidden="true"></span> Home
|
||||
</NavLink>
|
||||
</li>
|
||||
@if (state.User == null)
|
||||
{
|
||||
<li class="nav-item px-3">
|
||||
<a class="nav-link" href="@AuthUrl">
|
||||
<span class="oi oi-account-login" aria-hidden="true"></span> Log On
|
||||
</a>
|
||||
</li>
|
||||
}
|
||||
else
|
||||
{
|
||||
<li class="nav-item px-3">
|
||||
<NavLink class="nav-link" href="/citizen/dashboard">
|
||||
<span class="oi oi-dashboard" aria-hidden="true"></span> Dashboard
|
||||
</NavLink>
|
||||
</li>
|
||||
<li class="nav-item px-3">
|
||||
<NavLink class="nav-link" href="/citizen/profile">
|
||||
<span class="oi oi-pencil" aria-hidden="true"></span> Edit Your Profile
|
||||
</NavLink>
|
||||
</li>
|
||||
<li class="nav-item px-3">
|
||||
<NavLink class="nav-link" href="/profile/search">
|
||||
<span class="oi oi-spreadsheet" aria-hidden="true"></span> View Profiles
|
||||
</NavLink>
|
||||
</li>
|
||||
<li class="nav-item px-3">
|
||||
<NavLink class="nav-link" href="/citizen/log-off">
|
||||
<span class="oi oi-plus" aria-hidden="true"></span> Log Off
|
||||
</NavLink>
|
||||
</li>
|
||||
}
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
@code {
|
||||
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
base.OnInitialized();
|
||||
state.OnChange += StateHasChanged;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The client ID for Jobs, Jobs, Jobs at No Agenda Social
|
||||
/// </summary>
|
||||
// TODO: move to config
|
||||
private readonly string _clientId = "k_06zlMy0N451meL4AqlwMQzs5PYr6g3d2Q_dCT-OjU";
|
||||
|
||||
/// <summary>
|
||||
/// The authorization URL to which the user should be directed
|
||||
/// </summary>
|
||||
private string AuthUrl
|
||||
{
|
||||
get
|
||||
{
|
||||
var client = $"client_id={_clientId}";
|
||||
var scope = "scope=read:accounts";
|
||||
var redirect = $"redirect_uri=https://{new Uri(nav.Uri).Authority}/citizen/authorized";
|
||||
var respType = "response_type=code";
|
||||
// TODO: move NAS base URL to config
|
||||
return $"https://noagendasocial.com/oauth/authorize?{client}&{scope}&{redirect}&{respType}";
|
||||
}
|
||||
}
|
||||
|
||||
private bool collapseNavMenu = true;
|
||||
|
||||
private string? NavMenuCssClass => collapseNavMenu ? "collapse" : null;
|
||||
|
||||
private void ToggleNavMenu()
|
||||
{
|
||||
collapseNavMenu = !collapseNavMenu;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
state.OnChange -= StateHasChanged;
|
||||
}
|
||||
}
|
62
src/JobsJobsJobs/Client/Shared/NavMenu.razor.css
Normal file
62
src/JobsJobsJobs/Client/Shared/NavMenu.razor.css
Normal file
|
@ -0,0 +1,62 @@
|
|||
.navbar-toggler {
|
||||
background-color: rgba(255, 255, 255, 0.1);
|
||||
}
|
||||
|
||||
.top-row {
|
||||
height: 3.5rem;
|
||||
background-color: rgba(0,0,0,0.4);
|
||||
}
|
||||
|
||||
.navbar-brand {
|
||||
font-size: 1.1rem;
|
||||
}
|
||||
|
||||
.oi {
|
||||
width: 2rem;
|
||||
font-size: 1.1rem;
|
||||
vertical-align: text-top;
|
||||
top: -2px;
|
||||
}
|
||||
|
||||
.nav-item {
|
||||
font-size: 0.9rem;
|
||||
padding-bottom: 0.5rem;
|
||||
}
|
||||
|
||||
.nav-item:first-of-type {
|
||||
padding-top: 1rem;
|
||||
}
|
||||
|
||||
.nav-item:last-of-type {
|
||||
padding-bottom: 1rem;
|
||||
}
|
||||
|
||||
.nav-item ::deep a {
|
||||
color: #d7d7d7;
|
||||
border-radius: 4px;
|
||||
height: 3rem;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
line-height: 3rem;
|
||||
}
|
||||
|
||||
.nav-item ::deep a.active {
|
||||
background-color: rgba(255,255,255,0.25);
|
||||
color: white;
|
||||
}
|
||||
|
||||
.nav-item ::deep a:hover {
|
||||
background-color: rgba(255,255,255,0.1);
|
||||
color: white;
|
||||
}
|
||||
|
||||
@media (min-width: 641px) {
|
||||
.navbar-toggler {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.collapse {
|
||||
/* Never collapse the sidebar for wide screens */
|
||||
display: block;
|
||||
}
|
||||
}
|
11
src/JobsJobsJobs/Client/Shared/PageTitle.razor
Normal file
11
src/JobsJobsJobs/Client/Shared/PageTitle.razor
Normal file
|
@ -0,0 +1,11 @@
|
|||
@inject IJSRuntime js
|
||||
@code {
|
||||
[Parameter]
|
||||
public string Title { get; set; } = default!;
|
||||
|
||||
protected override async Task OnAfterRenderAsync(bool firstRender)
|
||||
{
|
||||
await base.OnAfterRenderAsync(firstRender);
|
||||
await js.InvokeVoidAsync("setPageTitle", $"{Title} ~ Jobs, Jobs, Jobs");
|
||||
}
|
||||
}
|
60
src/JobsJobsJobs/Client/Shared/ProfileSearchForm.razor
Normal file
60
src/JobsJobsJobs/Client/Shared/ProfileSearchForm.razor
Normal file
|
@ -0,0 +1,60 @@
|
|||
@using JobsJobsJobs.Shared.Api
|
||||
|
||||
<EditForm Model=@Criteria OnValidSubmit=@OnSearch>
|
||||
<div class="form-row">
|
||||
<div class="col col-12 col-sm-6 col-md-4 col-lg-3">
|
||||
<label for="continentId" class="jjj-label">Continent</label>
|
||||
<InputSelect id="continentId" @bind-Value=@Criteria.ContinentId class="form-control form-control-sm">
|
||||
<option value="">– Any –</option>
|
||||
@foreach (var (id, name) in Continents)
|
||||
{
|
||||
<option value="@id">@name</option>
|
||||
}
|
||||
</InputSelect>
|
||||
</div>
|
||||
<div class="col col-12 col-sm-6 offset-md-2 col-lg-3 offset-lg-0">
|
||||
<label class="jjj-label">Seeking Remote Work?</label><br>
|
||||
<InputRadioGroup @bind-Value=@Criteria.RemoteWork>
|
||||
<div class="form-check form-check-inline">
|
||||
<InputRadio id="remoteNull" Value=@("") class="form-check-input" />
|
||||
<label for="remoteNull" class="form-check-label">No Selection</label>
|
||||
</div>
|
||||
<div class="form-check form-check-inline">
|
||||
<InputRadio id="remoteYes" Value=@("yes") class="form-check-input" />
|
||||
<label for="remoteYes" class="form-check-label">Yes</label>
|
||||
</div>
|
||||
<div class="form-check form-check-inline">
|
||||
<InputRadio id="remoteNo" Value=@("no") class="form-check-input" />
|
||||
<label for="remoteNo" class="form-check-label">No</label>
|
||||
</div>
|
||||
</InputRadioGroup>
|
||||
</div>
|
||||
<div class="col col-12 col-sm-6 col-lg-3">
|
||||
<label for="skillSearch" class="jjj-label">Skill</label>
|
||||
<InputText id="skillSearch" @bind-Value=@Criteria.Skill class="form-control form-control-sm"
|
||||
placeholder="(free-form text)" />
|
||||
</div>
|
||||
<div class="col col-12 col-sm-6 col-lg-3">
|
||||
<label for="bioSearch" class="jjj-label">Bio / Experience</label>
|
||||
<InputText id="bioSearch" @bind-Value=@Criteria.BioExperience class="form-control form-control-sm"
|
||||
placeholder="(free-form text)" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<div class="col">
|
||||
<br>
|
||||
<button type="submit" class="btn btn-sm btn-outline-primary">Search</button>
|
||||
</div>
|
||||
</div>
|
||||
</EditForm>
|
||||
|
||||
@code {
|
||||
[Parameter]
|
||||
public ProfileSearch Criteria { get; set; } = default!;
|
||||
|
||||
[Parameter]
|
||||
public EventCallback OnSearch { get; set; } = default!;
|
||||
|
||||
[Parameter]
|
||||
public IEnumerable<Continent> Continents { get; set; } = default!;
|
||||
}
|
22
src/JobsJobsJobs/Client/Shared/SkillEdit.razor
Normal file
22
src/JobsJobsJobs/Client/Shared/SkillEdit.razor
Normal file
|
@ -0,0 +1,22 @@
|
|||
<div class="form-row">
|
||||
<div class="col col-xs-2 col-sm-2 col-md-1">
|
||||
<br>
|
||||
<button type="button" class="btn btn-outline-danger" title="Delete" @onclick="@RemoveMe">−</button>
|
||||
</div>
|
||||
<div class="col col-xs-10 col-sm-10 col-md-6">
|
||||
<div class="form-group">
|
||||
<label for="skillDesc@(Skill.Id)">Skill</label>
|
||||
<input type="text" id="skillDesc@(Skill.Id)" @bind="@Skill.Description" class="form-control" maxlength="100"
|
||||
placeholder="A skill (language, design technique, process, etc.)">
|
||||
<ValidationMessage For="@(() => Skill.Description)" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="col col-xs-12 col-sm-12 col-md-5">
|
||||
<div class="form-group">
|
||||
<label for="skillNotes@(Skill.Id)">Notes</label>
|
||||
<input type="text" id="skillNotes@(Skill.Id)" @bind="@Skill.Notes" class="form-control" maxlength="100"
|
||||
placeholder="A further description of the skill (100 characters max)">
|
||||
<ValidationMessage For="@(() => Skill.Notes)" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
29
src/JobsJobsJobs/Client/Shared/SkillEdit.razor.cs
Normal file
29
src/JobsJobsJobs/Client/Shared/SkillEdit.razor.cs
Normal file
|
@ -0,0 +1,29 @@
|
|||
using JobsJobsJobs.Shared.Api;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace JobsJobsJobs.Client.Shared
|
||||
{
|
||||
/// <summary>
|
||||
/// A component that allows a skill to be edited
|
||||
/// </summary>
|
||||
public partial class SkillEdit : ComponentBase
|
||||
{
|
||||
/// <summary>
|
||||
/// The skill being edited
|
||||
/// </summary>
|
||||
[Parameter]
|
||||
public SkillForm Skill { get; set; } = default!;
|
||||
|
||||
/// <summary>
|
||||
/// Callback used if the remove button is clicked
|
||||
/// </summary>
|
||||
[Parameter]
|
||||
public EventCallback<string> OnRemove { get; set; } = default!;
|
||||
|
||||
/// <summary>
|
||||
/// Remove this skill from the skill collection
|
||||
/// </summary>
|
||||
private Task RemoveMe() => OnRemove.InvokeAsync(Skill.Id);
|
||||
}
|
||||
}
|
14
src/JobsJobsJobs/Client/_Imports.razor
Normal file
14
src/JobsJobsJobs/Client/_Imports.razor
Normal file
|
@ -0,0 +1,14 @@
|
|||
@using Blazored.Toast
|
||||
@using Blazored.Toast.Services
|
||||
@using System.Net.Http
|
||||
@using System.Net.Http.Json
|
||||
@using Microsoft.AspNetCore.Components.Forms
|
||||
@using Microsoft.AspNetCore.Components.Routing
|
||||
@using Microsoft.AspNetCore.Components.Web
|
||||
@using Microsoft.AspNetCore.Components.Web.Virtualization
|
||||
@using Microsoft.AspNetCore.Components.WebAssembly.Http
|
||||
@using Microsoft.AspNetCore.WebUtilities
|
||||
@using Microsoft.JSInterop
|
||||
@using JobsJobsJobs.Client
|
||||
@using JobsJobsJobs.Client.Shared
|
||||
@using JobsJobsJobs.Shared
|
71
src/JobsJobsJobs/Client/wwwroot/css/app.css
Normal file
71
src/JobsJobsJobs/Client/wwwroot/css/app.css
Normal file
|
@ -0,0 +1,71 @@
|
|||
@import url('open-iconic/font/css/open-iconic-bootstrap.min.css');
|
||||
|
||||
html, body {
|
||||
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
|
||||
}
|
||||
|
||||
a, .btn-link {
|
||||
color: #0366d6;
|
||||
}
|
||||
|
||||
.btn-primary {
|
||||
color: #fff;
|
||||
background-color: #1b6ec2;
|
||||
border-color: #1861ac;
|
||||
}
|
||||
|
||||
.content {
|
||||
padding-top: 1.1rem;
|
||||
}
|
||||
|
||||
.valid.modified:not([type=checkbox]) {
|
||||
outline: 1px solid #26b050;
|
||||
}
|
||||
|
||||
.invalid {
|
||||
outline: 1px solid red;
|
||||
}
|
||||
|
||||
.validation-message {
|
||||
color: red;
|
||||
}
|
||||
|
||||
#blazor-error-ui {
|
||||
background: lightyellow;
|
||||
bottom: 0;
|
||||
box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
|
||||
display: none;
|
||||
left: 0;
|
||||
padding: 0.6rem 1.25rem 0.7rem 1.25rem;
|
||||
position: fixed;
|
||||
width: 100%;
|
||||
z-index: 1000;
|
||||
}
|
||||
|
||||
#blazor-error-ui .dismiss {
|
||||
cursor: pointer;
|
||||
position: absolute;
|
||||
right: 0.75rem;
|
||||
top: 0.5rem;
|
||||
}
|
||||
a.audio {
|
||||
color: inherit;
|
||||
border-bottom: dotted 1px lightgray;
|
||||
}
|
||||
|
||||
a.audio:hover {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
label.jjj-required {
|
||||
font-weight:bold;
|
||||
}
|
||||
|
||||
label.jjj-required::after {
|
||||
color: red;
|
||||
content: ' *';
|
||||
}
|
||||
|
||||
label.jjj-label {
|
||||
font-style: italic;
|
||||
}
|
7
src/JobsJobsJobs/Client/wwwroot/css/bootstrap/bootstrap.min.css
vendored
Normal file
7
src/JobsJobsJobs/Client/wwwroot/css/bootstrap/bootstrap.min.css
vendored
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
86
src/JobsJobsJobs/Client/wwwroot/css/open-iconic/FONT-LICENSE
Normal file
86
src/JobsJobsJobs/Client/wwwroot/css/open-iconic/FONT-LICENSE
Normal file
|
@ -0,0 +1,86 @@
|
|||
SIL OPEN FONT LICENSE Version 1.1
|
||||
|
||||
Copyright (c) 2014 Waybury
|
||||
|
||||
PREAMBLE
|
||||
The goals of the Open Font License (OFL) are to stimulate worldwide
|
||||
development of collaborative font projects, to support the font creation
|
||||
efforts of academic and linguistic communities, and to provide a free and
|
||||
open framework in which fonts may be shared and improved in partnership
|
||||
with others.
|
||||
|
||||
The OFL allows the licensed fonts to be used, studied, modified and
|
||||
redistributed freely as long as they are not sold by themselves. The
|
||||
fonts, including any derivative works, can be bundled, embedded,
|
||||
redistributed and/or sold with any software provided that any reserved
|
||||
names are not used by derivative works. The fonts and derivatives,
|
||||
however, cannot be released under any other type of license. The
|
||||
requirement for fonts to remain under this license does not apply
|
||||
to any document created using the fonts or their derivatives.
|
||||
|
||||
DEFINITIONS
|
||||
"Font Software" refers to the set of files released by the Copyright
|
||||
Holder(s) under this license and clearly marked as such. This may
|
||||
include source files, build scripts and documentation.
|
||||
|
||||
"Reserved Font Name" refers to any names specified as such after the
|
||||
copyright statement(s).
|
||||
|
||||
"Original Version" refers to the collection of Font Software components as
|
||||
distributed by the Copyright Holder(s).
|
||||
|
||||
"Modified Version" refers to any derivative made by adding to, deleting,
|
||||
or substituting -- in part or in whole -- any of the components of the
|
||||
Original Version, by changing formats or by porting the Font Software to a
|
||||
new environment.
|
||||
|
||||
"Author" refers to any designer, engineer, programmer, technical
|
||||
writer or other person who contributed to the Font Software.
|
||||
|
||||
PERMISSION & CONDITIONS
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of the Font Software, to use, study, copy, merge, embed, modify,
|
||||
redistribute, and sell modified and unmodified copies of the Font
|
||||
Software, subject to the following conditions:
|
||||
|
||||
1) Neither the Font Software nor any of its individual components,
|
||||
in Original or Modified Versions, may be sold by itself.
|
||||
|
||||
2) Original or Modified Versions of the Font Software may be bundled,
|
||||
redistributed and/or sold with any software, provided that each copy
|
||||
contains the above copyright notice and this license. These can be
|
||||
included either as stand-alone text files, human-readable headers or
|
||||
in the appropriate machine-readable metadata fields within text or
|
||||
binary files as long as those fields can be easily viewed by the user.
|
||||
|
||||
3) No Modified Version of the Font Software may use the Reserved Font
|
||||
Name(s) unless explicit written permission is granted by the corresponding
|
||||
Copyright Holder. This restriction only applies to the primary font name as
|
||||
presented to the users.
|
||||
|
||||
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
|
||||
Software shall not be used to promote, endorse or advertise any
|
||||
Modified Version, except to acknowledge the contribution(s) of the
|
||||
Copyright Holder(s) and the Author(s) or with their explicit written
|
||||
permission.
|
||||
|
||||
5) The Font Software, modified or unmodified, in part or in whole,
|
||||
must be distributed entirely under this license, and must not be
|
||||
distributed under any other license. The requirement for fonts to
|
||||
remain under this license does not apply to any document created
|
||||
using the Font Software.
|
||||
|
||||
TERMINATION
|
||||
This license becomes null and void if any of the above conditions are
|
||||
not met.
|
||||
|
||||
DISCLAIMER
|
||||
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
|
||||
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
|
||||
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
|
||||
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
|
||||
OTHER DEALINGS IN THE FONT SOFTWARE.
|
21
src/JobsJobsJobs/Client/wwwroot/css/open-iconic/ICON-LICENSE
Normal file
21
src/JobsJobsJobs/Client/wwwroot/css/open-iconic/ICON-LICENSE
Normal file
|
@ -0,0 +1,21 @@
|
|||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2014 Waybury
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
114
src/JobsJobsJobs/Client/wwwroot/css/open-iconic/README.md
Normal file
114
src/JobsJobsJobs/Client/wwwroot/css/open-iconic/README.md
Normal file
|
@ -0,0 +1,114 @@
|
|||
[Open Iconic v1.1.1](http://useiconic.com/open)
|
||||
===========
|
||||
|
||||
### Open Iconic is the open source sibling of [Iconic](http://useiconic.com). It is a hyper-legible collection of 223 icons with a tiny footprint—ready to use with Bootstrap and Foundation. [View the collection](http://useiconic.com/open#icons)
|
||||
|
||||
|
||||
|
||||
## What's in Open Iconic?
|
||||
|
||||
* 223 icons designed to be legible down to 8 pixels
|
||||
* Super-light SVG files - 61.8 for the entire set
|
||||
* SVG sprite—the modern replacement for icon fonts
|
||||
* Webfont (EOT, OTF, SVG, TTF, WOFF), PNG and WebP formats
|
||||
* Webfont stylesheets (including versions for Bootstrap and Foundation) in CSS, LESS, SCSS and Stylus formats
|
||||
* PNG and WebP raster images in 8px, 16px, 24px, 32px, 48px and 64px.
|
||||
|
||||
|
||||
## Getting Started
|
||||
|
||||
#### For code samples and everything else you need to get started with Open Iconic, check out our [Icons](http://useiconic.com/open#icons) and [Reference](http://useiconic.com/open#reference) sections.
|
||||
|
||||
### General Usage
|
||||
|
||||
#### Using Open Iconic's SVGs
|
||||
|
||||
We like SVGs and we think they're the way to display icons on the web. Since Open Iconic are just basic SVGs, we suggest you display them like you would any other image (don't forget the `alt` attribute).
|
||||
|
||||
```
|
||||
<img src="/open-iconic/svg/icon-name.svg" alt="icon name">
|
||||
```
|
||||
|
||||
#### Using Open Iconic's SVG Sprite
|
||||
|
||||
Open Iconic also comes in a SVG sprite which allows you to display all the icons in the set with a single request. It's like an icon font, without being a hack.
|
||||
|
||||
Adding an icon from an SVG sprite is a little different than what you're used to, but it's still a piece of cake. *Tip: To make your icons easily style able, we suggest adding a general class to the* `<svg>` *tag and a unique class name for each different icon in the* `<use>` *tag.*
|
||||
|
||||
```
|
||||
<svg class="icon">
|
||||
<use xlink:href="open-iconic.svg#account-login" class="icon-account-login"></use>
|
||||
</svg>
|
||||
```
|
||||
|
||||
Sizing icons only needs basic CSS. All the icons are in a square format, so just set the `<svg>` tag with equal width and height dimensions.
|
||||
|
||||
```
|
||||
.icon {
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
}
|
||||
```
|
||||
|
||||
Coloring icons is even easier. All you need to do is set the `fill` rule on the `<use>` tag.
|
||||
|
||||
```
|
||||
.icon-account-login {
|
||||
fill: #f00;
|
||||
}
|
||||
```
|
||||
|
||||
To learn more about SVG Sprites, read [Chris Coyier's guide](http://css-tricks.com/svg-sprites-use-better-icon-fonts/).
|
||||
|
||||
#### Using Open Iconic's Icon Font...
|
||||
|
||||
|
||||
##### …with Bootstrap
|
||||
|
||||
You can find our Bootstrap stylesheets in `font/css/open-iconic-bootstrap.{css, less, scss, styl}`
|
||||
|
||||
|
||||
```
|
||||
<link href="/open-iconic/font/css/open-iconic-bootstrap.css" rel="stylesheet">
|
||||
```
|
||||
|
||||
|
||||
```
|
||||
<span class="oi oi-icon-name" title="icon name" aria-hidden="true"></span>
|
||||
```
|
||||
|
||||
##### …with Foundation
|
||||
|
||||
You can find our Foundation stylesheets in `font/css/open-iconic-foundation.{css, less, scss, styl}`
|
||||
|
||||
```
|
||||
<link href="/open-iconic/font/css/open-iconic-foundation.css" rel="stylesheet">
|
||||
```
|
||||
|
||||
|
||||
```
|
||||
<span class="fi-icon-name" title="icon name" aria-hidden="true"></span>
|
||||
```
|
||||
|
||||
##### …on its own
|
||||
|
||||
You can find our default stylesheets in `font/css/open-iconic.{css, less, scss, styl}`
|
||||
|
||||
```
|
||||
<link href="/open-iconic/font/css/open-iconic.css" rel="stylesheet">
|
||||
```
|
||||
|
||||
```
|
||||
<span class="oi" data-glyph="icon-name" title="icon name" aria-hidden="true"></span>
|
||||
```
|
||||
|
||||
|
||||
## License
|
||||
|
||||
### Icons
|
||||
|
||||
All code (including SVG markup) is under the [MIT License](http://opensource.org/licenses/MIT).
|
||||
|
||||
### Fonts
|
||||
|
||||
All fonts are under the [SIL Licensed](http://scripts.sil.org/cms/scripts/page.php?item_id=OFL_web).
|
1
src/JobsJobsJobs/Client/wwwroot/css/open-iconic/font/css/open-iconic-bootstrap.min.css
vendored
Normal file
1
src/JobsJobsJobs/Client/wwwroot/css/open-iconic/font/css/open-iconic-bootstrap.min.css
vendored
Normal file
File diff suppressed because one or more lines are too long
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1,543 @@
|
|||
<?xml version="1.0" standalone="no"?>
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" >
|
||||
<!--
|
||||
2014-7-1: Created.
|
||||
-->
|
||||
<svg xmlns="http://www.w3.org/2000/svg">
|
||||
<metadata>
|
||||
Created by FontForge 20120731 at Tue Jul 1 20:39:22 2014
|
||||
By P.J. Onori
|
||||
Created by P.J. Onori with FontForge 2.0 (http://fontforge.sf.net)
|
||||
</metadata>
|
||||
<defs>
|
||||
<font id="open-iconic" horiz-adv-x="800" >
|
||||
<font-face
|
||||
font-family="Icons"
|
||||
font-weight="400"
|
||||
font-stretch="normal"
|
||||
units-per-em="800"
|
||||
panose-1="2 0 5 3 0 0 0 0 0 0"
|
||||
ascent="800"
|
||||
descent="0"
|
||||
bbox="-0.5 -101 802 800.126"
|
||||
underline-thickness="50"
|
||||
underline-position="-100"
|
||||
unicode-range="U+E000-E0DE"
|
||||
/>
|
||||
<missing-glyph />
|
||||
<glyph glyph-name="" unicode=""
|
||||
d="M300 700h500v-700h-500v100h400v500h-400v100zM400 500l200 -150l-200 -150v100h-400v100h400v100z" />
|
||||
<glyph glyph-name="1" unicode=""
|
||||
d="M300 700h500v-700h-500v100h400v500h-400v100zM200 500v-100h400v-100h-400v-100l-200 150z" />
|
||||
<glyph glyph-name="2" unicode=""
|
||||
d="M350 700c193 0 350 -157 350 -350v-50h100l-200 -200l-200 200h100v50c0 138 -112 250 -250 250s-250 -112 -250 -250c0 193 157 350 350 350z" />
|
||||
<glyph glyph-name="3" unicode=""
|
||||
d="M450 700c193 0 350 -157 350 -350c0 138 -112 250 -250 250s-250 -112 -250 -250v-50h100l-200 -200l-200 200h100v50c0 193 157 350 350 350z" />
|
||||
<glyph glyph-name="4" unicode=""
|
||||
d="M0 700h800v-100h-800v100zM100 500h600v-100h-600v100zM0 300h800v-100h-800v100zM100 100h600v-100h-600v100z" />
|
||||
<glyph glyph-name="5" unicode=""
|
||||
d="M0 700h800v-100h-800v100zM0 500h600v-100h-600v100zM0 300h800v-100h-800v100zM0 100h600v-100h-600v100z" />
|
||||
<glyph glyph-name="6" unicode=""
|
||||
d="M0 700h800v-100h-800v100zM200 500h600v-100h-600v100zM0 300h800v-100h-800v100zM200 100h600v-100h-600v100z" />
|
||||
<glyph glyph-name="7" unicode=""
|
||||
d="M400 700c75 0 146 -23 206 -59l-75 -225l-322 234c57 31 122 50 191 50zM125 588l191 -138l-310 -222c-4 24 -6 47 -6 72c0 114 49 215 125 288zM688 575c69 -72 112 -168 112 -275c0 -35 -8 -68 -16 -100h-218zM216 253l112 -347c-128 23 -232 109 -287 222zM372 100
|
||||
h372c-64 -109 -177 -185 -310 -197z" />
|
||||
<glyph glyph-name="8" unicode="" horiz-adv-x="600"
|
||||
d="M200 800h100v-500h200l-247 -300l-253 300h200v500z" />
|
||||
<glyph glyph-name="9" unicode=""
|
||||
d="M400 800c221 0 400 -179 400 -400s-179 -400 -400 -400s-400 179 -400 400s179 400 400 400zM300 700v-300h-200l300 -300l300 300h-200v300h-200z" />
|
||||
<glyph glyph-name="a" unicode=""
|
||||
d="M400 800c221 0 400 -179 400 -400s-179 -400 -400 -400s-400 179 -400 400s179 400 400 400zM400 700l-300 -300l300 -300v200h300v200h-300v200z" />
|
||||
<glyph glyph-name="b" unicode=""
|
||||
d="M400 800c221 0 400 -179 400 -400s-179 -400 -400 -400s-400 179 -400 400s179 400 400 400zM400 700v-200h-300v-200h300v-200l300 300z" />
|
||||
<glyph glyph-name="c" unicode=""
|
||||
d="M400 800c221 0 400 -179 400 -400s-179 -400 -400 -400s-400 179 -400 400s179 400 400 400zM400 700l-300 -300h200v-300h200v300h200z" />
|
||||
<glyph glyph-name="d" unicode=""
|
||||
d="M300 600v-200h500v-100h-500v-200l-300 247z" />
|
||||
<glyph glyph-name="e" unicode=""
|
||||
d="M500 600l300 -247l-300 -253v200h-500v100h500v200z" />
|
||||
<glyph glyph-name="f" unicode="" horiz-adv-x="600"
|
||||
d="M200 800h200v-500h200l-297 -300l-303 300h200v500z" />
|
||||
<glyph glyph-name="10" unicode=""
|
||||
d="M300 700v-200h500v-200h-500v-200l-300 297z" />
|
||||
<glyph glyph-name="11" unicode=""
|
||||
d="M500 700l300 -297l-300 -303v200h-500v200h500v200z" />
|
||||
<glyph glyph-name="12" unicode="" horiz-adv-x="600"
|
||||
d="M297 800l303 -300h-200v-500h-200v500h-200z" />
|
||||
<glyph glyph-name="13" unicode="" horiz-adv-x="600"
|
||||
d="M247 800l253 -300h-200v-500h-100v500h-200z" />
|
||||
<glyph glyph-name="14" unicode=""
|
||||
d="M400 800h100v-800h-100v800zM200 700h100v-600h-100v600zM600 600h100v-400h-100v400zM0 500h100v-200h-100v200z" />
|
||||
<glyph glyph-name="15" unicode=""
|
||||
d="M116 600l72 -72c-54 -54 -88 -126 -88 -209s34 -159 88 -213l-72 -72c-72 72 -116 175 -116 285s44 209 116 281zM684 600c72 -72 116 -171 116 -281s-44 -213 -116 -285l-72 72c54 54 88 130 88 213s-34 155 -88 209zM259 460l69 -72c-18 -18 -28 -41 -28 -69
|
||||
s10 -54 28 -72l-69 -72c-36 36 -59 89 -59 144s23 105 59 141zM541 459c36 -36 59 -85 59 -140s-23 -108 -59 -144l-69 72c18 18 28 44 28 72s-10 51 -28 69z" />
|
||||
<glyph glyph-name="16" unicode="" horiz-adv-x="400"
|
||||
d="M200 800c110 0 200 -90 200 -200s-90 -200 -200 -200s-200 90 -200 200s90 200 200 200zM100 319c31 -11 65 -19 100 -19s68 8 100 19v-319l-100 100l-100 -100v319z" />
|
||||
<glyph glyph-name="17" unicode=""
|
||||
d="M400 800c220 0 400 -180 400 -400s-180 -400 -400 -400s-400 180 -400 400s180 400 400 400zM400 700c-166 0 -300 -134 -300 -300c0 -66 21 -126 56 -175l419 419c-49 35 -109 56 -175 56zM644 575l-419 -419c49 -35 109 -56 175 -56c166 0 300 134 300 300
|
||||
c0 66 -21 126 -56 175z" />
|
||||
<glyph glyph-name="18" unicode=""
|
||||
d="M0 700h100v-600h700v-100h-800v700zM500 700h200v-500h-200v500zM200 500h200v-300h-200v300z" />
|
||||
<glyph glyph-name="19" unicode=""
|
||||
d="M397 800c13 1 23 -4 34 -13c2 -2 214 -254 241 -287h128v-100h-100v-366c0 -18 -16 -34 -34 -34h-532c-18 0 -34 16 -34 34v366h-100v100h128l234 281c9 11 22 18 35 19zM400 672l-144 -172h288zM250 300c-28 0 -50 -22 -50 -50v-100c0 -28 22 -50 50 -50s50 22 50 50
|
||||
v100c0 28 -22 50 -50 50zM550 300c-28 0 -50 -22 -50 -50v-100c0 -28 22 -50 50 -50s50 22 50 50v100c0 28 -22 50 -50 50z" />
|
||||
<glyph glyph-name="1a" unicode=""
|
||||
d="M9 700h682c6 0 9 -4 9 -10v-190h100v-200h-100v-191c0 -6 -3 -9 -9 -9h-682c-6 0 -9 3 -9 9v582c0 6 3 9 9 9zM100 600v-400h500v400h-500z" />
|
||||
<glyph glyph-name="1b" unicode=""
|
||||
d="M9 700h682c6 0 9 -4 9 -10v-190h100v-200h-100v-191c0 -6 -3 -9 -9 -9h-682c-6 0 -9 3 -9 9v582c0 6 3 9 9 9z" />
|
||||
<glyph glyph-name="1c" unicode=""
|
||||
d="M92 650c0 23 19 50 45 50h3h5h5h500c28 0 50 -22 50 -50s-22 -50 -50 -50h-50v-141c9 -17 120 -231 166 -309c16 -26 34 -61 34 -106c0 -39 -15 -77 -41 -103h-3c-26 -25 -62 -41 -100 -41h-512c-39 0 -77 15 -103 41s-41 64 -41 103c0 46 18 80 34 106
|
||||
c46 78 157 292 166 309v141h-50c-2 0 -6 -1 -8 -1c-28 0 -50 23 -50 51zM500 600h-200v-162l-6 -10s-63 -123 -119 -228h450c-56 105 -119 228 -119 228l-6 10v162z" />
|
||||
<glyph glyph-name="1d" unicode=""
|
||||
d="M400 800c110 0 200 -90 200 -200c0 -104 52 -198 134 -266c41 -34 66 -82 66 -134h-800c0 52 25 100 66 134c82 68 134 162 134 266c0 110 90 200 200 200zM300 100h200c0 -55 -45 -100 -100 -100s-100 45 -100 100z" />
|
||||
<glyph glyph-name="1e" unicode="" horiz-adv-x="600"
|
||||
d="M150 800h50l350 -250l-225 -147l225 -153l-350 -250h-50v250l-75 -75l-75 75l150 150l-150 150l75 75l75 -75v250zM250 650v-200l150 100zM250 350v-200l150 100z" />
|
||||
<glyph glyph-name="1f" unicode=""
|
||||
d="M0 800h500c110 0 200 -90 200 -200c0 -47 -17 -91 -44 -125c85 -40 144 -125 144 -225c0 -138 -112 -250 -250 -250h-550v100c55 0 100 45 100 100v400c0 55 -45 100 -100 100v100zM300 700v-200h100c55 0 100 45 100 100s-45 100 -100 100h-100zM300 400v-300h150
|
||||
c83 0 150 67 150 150s-67 150 -150 150h-150z" />
|
||||
<glyph glyph-name="20" unicode="" horiz-adv-x="600"
|
||||
d="M300 800v-300h200l-300 -500v300h-200z" />
|
||||
<glyph glyph-name="21" unicode=""
|
||||
d="M100 800h300v-300l100 100l100 -100v300h50c28 0 50 -22 50 -50v-550h-550c-28 0 -50 -22 -50 -50s22 -50 50 -50h550v-100h-550c-83 0 -150 67 -150 150v550l3 19c8 39 39 70 78 78z" />
|
||||
<glyph glyph-name="22" unicode="" horiz-adv-x="400"
|
||||
d="M0 800h400v-800l-200 200l-200 -200v800z" />
|
||||
<glyph glyph-name="23" unicode=""
|
||||
d="M0 800h800v-100h-800v100zM0 600h300v-103h203v103h297v-591c0 -6 -3 -9 -9 -9h-782c-6 0 -9 3 -9 9v591z" />
|
||||
<glyph glyph-name="24" unicode=""
|
||||
d="M300 800h200c55 0 100 -45 100 -100v-100h191c6 0 9 -3 9 -9v-241c0 -28 -22 -50 -50 -50h-700c-28 0 -50 22 -50 50v241c0 6 3 9 9 9h191v100c0 55 45 100 100 100zM300 700v-100h200v100h-200zM0 209c16 -6 32 -9 50 -9h700c18 0 34 3 50 9v-200c0 -6 -3 -9 -9 -9h-782
|
||||
c-6 0 -9 3 -9 9v200z" />
|
||||
<glyph glyph-name="25" unicode="" horiz-adv-x="600"
|
||||
d="M300 800c58 0 110 -16 147 -53s53 -89 53 -147h-100c0 39 -11 61 -25 75s-36 25 -75 25c-35 0 -55 -10 -72 -31s-28 -55 -28 -94c0 -51 20 -107 28 -175h172v-100h-178c-14 -60 -49 -127 -113 -200h491v-100h-600v122l16 12c69 69 95 121 106 166h-122v100h125
|
||||
c-8 50 -25 106 -25 175c0 58 16 114 50 156c34 43 88 69 150 69z" />
|
||||
<glyph glyph-name="26" unicode=""
|
||||
d="M34 700h4h3h4h5h700c28 0 50 -22 50 -50v-700c0 -28 -22 -50 -50 -50h-700c-28 0 -50 22 -50 50v700v2c0 20 15 42 34 48zM150 600c-28 0 -50 -22 -50 -50s22 -50 50 -50s50 22 50 50s-22 50 -50 50zM350 600c-28 0 -50 -22 -50 -50s22 -50 50 -50h300c28 0 50 22 50 50
|
||||
s-22 50 -50 50h-300zM100 400v-400h600v400h-600z" />
|
||||
<glyph glyph-name="27" unicode=""
|
||||
d="M744 797l6 -3l44 -44c4 -4 3 -8 0 -12l-266 -375l-15 -13l-25 -12c-23 72 -78 127 -150 150l12 25l13 15l375 266zM266 400c74 0 134 -60 134 -134c0 -147 -119 -266 -266 -266c-48 0 -95 12 -134 34c80 46 134 133 134 232c0 74 58 134 132 134z" />
|
||||
<glyph glyph-name="28" unicode=""
|
||||
d="M9 451c0 23 19 50 46 50c8 0 19 -3 26 -7l131 -66l29 22c-79 81 -1 250 118 250s197 -167 119 -250l28 -22l131 66c6 4 12 7 21 7c28 0 50 -22 50 -50c0 -17 -12 -37 -27 -45l-115 -56c9 -16 19 -33 25 -50h68c28 0 50 -22 50 -50s-22 -50 -50 -50h-50
|
||||
c0 -23 -2 -45 -6 -66l78 -40c21 -5 37 -28 37 -49c0 -28 -22 -50 -50 -50c-10 0 -23 5 -31 11l-65 35c-24 -46 -62 -86 -103 -110c-35 19 -60 45 -60 72v135v4v5v6v5v5v87c0 28 -22 50 -50 50c-24 0 -45 -17 -50 -40c1 -3 1 -8 1 -11s0 -8 -1 -11v-82v-4v-5v-144
|
||||
c0 -28 -24 -53 -59 -72c-41 25 -79 64 -103 110l-66 -35c-8 -6 -21 -11 -31 -11c-28 0 -50 22 -50 50c0 21 16 44 37 49l78 40c-4 21 -6 43 -6 66h-50h-5c-28 0 -50 22 -50 50c0 26 22 50 50 50h5h69c6 17 16 34 25 50l-116 56c-16 7 -28 27 -28 45z" />
|
||||
<glyph glyph-name="29" unicode=""
|
||||
d="M600 700h91c6 0 9 -3 9 -9v-582c0 -6 -3 -9 -9 -9h-91v600zM210 503l290 147v-500l-250 125v-3c-15 0 -25 -8 -28 -22l75 -178c11 -25 0 -58 -25 -69s-58 0 -69 25l-103 272h-91c-6 0 -9 3 -9 9v182c0 6 3 9 9 9h182z" />
|
||||
<glyph glyph-name="2a" unicode=""
|
||||
d="M9 800h682c6 0 9 -3 9 -9v-782c0 -6 -3 -9 -9 -9h-682c-6 0 -9 3 -9 9v782c0 6 3 9 9 9zM100 700v-200h500v200h-500zM100 400v-100h100v100h-100zM300 400v-100h100v100h-100zM500 400v-300h100v300h-100zM100 200v-100h100v100h-100zM300 200v-100h100v100h-100z" />
|
||||
<glyph glyph-name="2b" unicode=""
|
||||
d="M0 800h700v-200h-700v200zM0 500h700v-491c0 -6 -3 -9 -9 -9h-682c-6 0 -9 3 -9 9v491zM100 400v-100h100v100h-100zM300 400v-100h100v100h-100zM500 400v-100h100v100h-100zM100 200v-100h100v100h-100zM300 200v-100h100v100h-100z" />
|
||||
<glyph glyph-name="2c" unicode=""
|
||||
d="M409 800h182c6 0 10 -4 12 -9l94 -182c2 -5 6 -9 12 -9h82c6 0 9 -3 9 -9v-582c0 -6 -3 -9 -9 -9h-782c-6 0 -9 3 -9 9v441c0 83 67 150 150 150h141c6 0 10 4 12 9l94 182c2 5 6 9 12 9zM150 500c-28 0 -50 -22 -50 -50s22 -50 50 -50s50 22 50 50s-22 50 -50 50z
|
||||
M500 500c-110 0 -200 -90 -200 -200s90 -200 200 -200s200 90 200 200s-90 200 -200 200zM500 400c55 0 100 -45 100 -100s-45 -100 -100 -100s-100 45 -100 100s45 100 100 100z" />
|
||||
<glyph glyph-name="2d" unicode=""
|
||||
d="M0 600h800l-400 -400z" />
|
||||
<glyph glyph-name="2e" unicode="" horiz-adv-x="400"
|
||||
d="M400 800v-800l-400 400z" />
|
||||
<glyph glyph-name="2f" unicode="" horiz-adv-x="400"
|
||||
d="M0 800l400 -400l-400 -400v800z" />
|
||||
<glyph glyph-name="30" unicode=""
|
||||
d="M400 600l400 -400h-800z" />
|
||||
<glyph glyph-name="31" unicode=""
|
||||
d="M0 550c0 23 20 50 46 50h3h5h4h200c17 0 37 -13 44 -28l38 -72h444c14 0 19 -12 15 -25l-81 -250c-4 -13 -21 -25 -35 -25h-350c-14 0 -30 12 -34 25c-27 83 -54 167 -81 250l-10 25h-150c-2 0 -5 -1 -7 -1c-28 0 -51 23 -51 51zM358 100c28 0 50 -22 50 -50
|
||||
s-22 -50 -50 -50s-50 22 -50 50s22 50 50 50zM658 100c28 0 50 -22 50 -50s-22 -50 -50 -50s-50 22 -50 50s22 50 50 50z" />
|
||||
<glyph glyph-name="32" unicode=""
|
||||
d="M0 700h500v-100h-300v-300h-100l-100 -100v500zM300 500h500v-500l-100 100h-400v400z" />
|
||||
<glyph glyph-name="33" unicode=""
|
||||
d="M641 700l143 -141l-493 -493c-71 76 -146 148 -219 222l-72 71l141 141c50 -51 101 -101 153 -150c116 117 234 231 347 350z" />
|
||||
<glyph glyph-name="34" unicode=""
|
||||
d="M150 600l250 -250l250 250l150 -150l-400 -400l-400 400z" />
|
||||
<glyph glyph-name="35" unicode="" horiz-adv-x="600"
|
||||
d="M400 800l150 -150l-250 -250l250 -250l-150 -150l-400 400z" />
|
||||
<glyph glyph-name="36" unicode="" horiz-adv-x="600"
|
||||
d="M150 800l400 -400l-400 -400l-150 150l250 250l-250 250z" />
|
||||
<glyph glyph-name="37" unicode=""
|
||||
d="M400 600l400 -400l-150 -150l-250 250l-250 -250l-150 150z" />
|
||||
<glyph glyph-name="38" unicode=""
|
||||
d="M400 800c221 0 400 -179 400 -400s-179 -400 -400 -400s-400 179 -400 400s179 400 400 400zM600 622l-250 -250l-100 100l-72 -72l172 -172l322 322z" />
|
||||
<glyph glyph-name="39" unicode=""
|
||||
d="M400 800c221 0 400 -179 400 -400s-179 -400 -400 -400s-400 179 -400 400s179 400 400 400zM250 622l-72 -72l150 -150l-150 -150l72 -72l150 150l150 -150l72 72l-150 150l150 150l-72 72l-150 -150z" />
|
||||
<glyph glyph-name="3a" unicode=""
|
||||
d="M350 800c28 0 50 -22 50 -50v-50h75c14 0 25 -11 25 -25v-75h-300v75c0 14 11 25 25 25h75v50c0 28 22 50 50 50zM25 700h75v-200h500v200h75c14 0 25 -11 25 -25v-650c0 -14 -11 -25 -25 -25h-650c-14 0 -25 11 -25 25v650c0 14 11 25 25 25z" />
|
||||
<glyph glyph-name="3b" unicode=""
|
||||
d="M400 800c220 0 400 -180 400 -400s-180 -400 -400 -400s-400 180 -400 400s180 400 400 400zM400 700c-166 0 -300 -134 -300 -300s134 -300 300 -300s300 134 300 300s-134 300 -300 300zM350 600h100v-181c23 -24 47 -47 72 -69l-72 -72c-27 30 -55 59 -84 88l-16 12
|
||||
v222z" />
|
||||
<glyph glyph-name="3c" unicode=""
|
||||
d="M450 800c138 0 250 -112 250 -250v-50c58 -21 100 -85 100 -150c0 -18 -3 -34 -9 -50h-191v50c0 83 -67 150 -150 150s-150 -67 -150 -150v-50h-272c-17 30 -28 63 -28 100c0 110 90 200 200 200c23 114 129 200 250 200zM434 400h3h4c3 0 6 1 9 1c28 0 50 -22 50 -50v-1
|
||||
v-150h150l-200 -200l-200 200h150v150v2c0 20 15 42 34 48z" />
|
||||
<glyph glyph-name="3d" unicode=""
|
||||
d="M450 800c138 0 250 -112 250 -250v-50c58 -21 100 -85 100 -150c0 -18 -3 -34 -9 -50h-141l-200 200l-200 -200h-222c-17 30 -28 63 -28 100c0 110 90 200 200 200c23 114 129 200 250 200zM450 350l250 -250h-200v-50c0 -28 -22 -50 -50 -50s-50 22 -50 50v50h-200z" />
|
||||
<glyph glyph-name="3e" unicode=""
|
||||
d="M450 700c138 0 250 -112 250 -250v-50c58 -21 100 -85 100 -150c0 -83 -67 -150 -150 -150h-450c-110 0 -200 90 -200 200s90 200 200 200c23 114 129 200 250 200z" />
|
||||
<glyph glyph-name="3f" unicode=""
|
||||
d="M250 800c82 0 154 -40 200 -100c-143 0 -270 -85 -325 -209c-36 -10 -70 -25 -100 -47c-16 33 -25 67 -25 106c0 138 112 250 250 250zM450 600c138 0 250 -112 250 -250v-50c58 -21 100 -85 100 -150c0 -83 -67 -150 -150 -150h-450c-110 0 -200 90 -200 200
|
||||
s90 200 200 200c23 114 129 200 250 200z" />
|
||||
<glyph glyph-name="40" unicode=""
|
||||
d="M500 700h100l-300 -600h-100zM100 600h100l-100 -200l100 -200h-100l-100 200zM600 600h100l100 -200l-100 -200h-100l100 200z" />
|
||||
<glyph glyph-name="41" unicode=""
|
||||
d="M350 800h100l50 -119l28 -12l119 50l72 -72l-50 -119l12 -28l119 -50v-100l-119 -50l-12 -28l50 -119l-72 -72l-119 50l-28 -12l-50 -119h-100l-50 119l-28 12l-119 -50l-72 72l50 119l-12 28l-119 50v100l119 50l12 28l-50 119l72 72l119 -50l28 12zM400 550
|
||||
c-83 0 -150 -67 -150 -150s67 -150 150 -150s150 67 150 150s-67 150 -150 150z" />
|
||||
<glyph glyph-name="42" unicode=""
|
||||
d="M0 800h800v-200h-800v200zM200 500h400l-200 -200zM0 100h800v-100h-800v100z" />
|
||||
<glyph glyph-name="43" unicode=""
|
||||
d="M0 800h100v-800h-100v800zM600 800h200v-800h-200v800zM500 600v-400l-200 200z" />
|
||||
<glyph glyph-name="44" unicode=""
|
||||
d="M0 800h200v-800h-200v800zM700 800h100v-800h-100v800zM300 600l200 -200l-200 -200v400z" />
|
||||
<glyph glyph-name="45" unicode=""
|
||||
d="M0 800h800v-100h-800v100zM400 500l200 -200h-400zM0 200h800v-200h-800v200z" />
|
||||
<glyph glyph-name="46" unicode=""
|
||||
d="M150 700c83 0 150 -67 150 -150v-50h100v50c0 83 67 150 150 150s150 -67 150 -150s-67 -150 -150 -150h-50v-100h50c83 0 150 -67 150 -150s-67 -150 -150 -150s-150 67 -150 150v50h-100v-50c0 -83 -67 -150 -150 -150s-150 67 -150 150s67 150 150 150h50v100h-50
|
||||
c-83 0 -150 67 -150 150s67 150 150 150zM150 600c-28 0 -50 -22 -50 -50s22 -50 50 -50h50v50c0 28 -22 50 -50 50zM550 600c-28 0 -50 -22 -50 -50v-50h50c28 0 50 22 50 50s-22 50 -50 50zM300 400v-100h100v100h-100zM150 200c-28 0 -50 -22 -50 -50s22 -50 50 -50
|
||||
s50 22 50 50v50h-50zM500 200v-50c0 -28 22 -50 50 -50s50 22 50 50s-22 50 -50 50h-50z" />
|
||||
<glyph glyph-name="47" unicode=""
|
||||
d="M0 791c0 5 4 9 9 9h782c6 0 9 -4 9 -10v-790l-200 200h-591c-6 0 -9 3 -9 9v582z" />
|
||||
<glyph glyph-name="48" unicode=""
|
||||
d="M400 800c220 0 400 -180 400 -400s-180 -400 -400 -400s-400 180 -400 400s180 400 400 400zM400 700c-166 0 -300 -134 -300 -300s134 -300 300 -300s300 134 300 300s-134 300 -300 300zM600 600l-100 -300l-300 -100l100 300zM400 450c-28 0 -50 -22 -50 -50
|
||||
s22 -50 50 -50s50 22 50 50s-22 50 -50 50z" />
|
||||
<glyph glyph-name="49" unicode=""
|
||||
d="M400 800c220 0 400 -180 400 -400s-180 -400 -400 -400s-400 180 -400 400s180 400 400 400zM400 700v-600c166 0 300 134 300 300s-134 300 -300 300z" />
|
||||
<glyph glyph-name="4a" unicode=""
|
||||
d="M0 800h800v-100h-800v100zM0 600h500v-100h-500v100zM0 300h800v-100h-800v100zM0 100h600v-100h-600v100zM750 100c28 0 50 -22 50 -50s-22 -50 -50 -50s-50 22 -50 50s22 50 50 50z" />
|
||||
<glyph glyph-name="4b" unicode=""
|
||||
d="M25 700h750c14 0 25 -11 25 -25v-75h-800v75c0 14 11 25 25 25zM0 500h800v-375c0 -14 -11 -25 -25 -25h-750c-14 0 -25 11 -25 25v375zM100 300v-100h100v100h-100zM300 300v-100h100v100h-100z" />
|
||||
<glyph glyph-name="4c" unicode=""
|
||||
d="M100 800h100v-100h450l100 100l50 -50l-100 -100v-450h100v-100h-100v-100h-100v100h-500v500h-100v100h100v100zM200 600v-350l350 350h-350zM600 550l-350 -350h350v350z" />
|
||||
<glyph glyph-name="4d" unicode=""
|
||||
d="M400 800c220 0 400 -180 400 -400s-180 -400 -400 -400s-400 180 -400 400s180 400 400 400zM400 700c-166 0 -300 -134 -300 -300s134 -300 300 -300s300 134 300 300s-134 300 -300 300zM400 600c28 0 50 -22 50 -50s-22 -50 -50 -50s-50 22 -50 50s22 50 50 50z
|
||||
M200 452c0 20 15 42 34 48h3h3h8c12 0 28 -7 36 -16l91 -90l25 6c55 0 100 -45 100 -100s-45 -100 -100 -100s-100 45 -100 100l6 25l-90 91c-9 8 -16 24 -16 36zM550 500c28 0 50 -22 50 -50s-22 -50 -50 -50s-50 22 -50 50s22 50 50 50z" />
|
||||
<glyph glyph-name="4e" unicode=""
|
||||
d="M300 800h200v-300h200l-300 -300l-300 300h200v300zM0 100h800v-100h-800v100z" />
|
||||
<glyph glyph-name="4f" unicode=""
|
||||
d="M0 800h800v-100h-800v100zM400 600l300 -300h-200v-300h-200v300h-200z" />
|
||||
<glyph glyph-name="50" unicode=""
|
||||
d="M200 700h600v-600h-600l-200 300zM350 622l-72 -72l150 -150l-150 -150l72 -72l150 150l150 -150l72 72l-150 150l150 150l-72 72l-150 -150z" />
|
||||
<glyph glyph-name="51" unicode=""
|
||||
d="M400 700c220 0 400 -180 400 -400h-100c0 166 -134 300 -300 300s-300 -134 -300 -300h-100c0 220 180 400 400 400zM341 491l59 -88l59 88c81 -25 141 -101 141 -191c0 -110 -90 -200 -200 -200s-200 90 -200 200c0 90 60 166 141 191z" />
|
||||
<glyph glyph-name="52" unicode=""
|
||||
d="M0 800h300v-400h400v-400h-700v800zM400 800l300 -300h-300v300zM100 600v-100h100v100h-100zM100 400v-100h100v100h-100zM100 200v-100h400v100h-400z" />
|
||||
<glyph glyph-name="53" unicode="" horiz-adv-x="600"
|
||||
d="M200 700h100v-100h75c30 0 58 -6 81 -22s44 -44 44 -78v-100h-100v94c-4 3 -13 6 -25 6h-250c-14 0 -25 -11 -25 -25v-50c0 -15 20 -40 34 -44l257 -65c66 -16 109 -73 109 -141v-50c0 -68 -57 -125 -125 -125h-75v-100h-100v100h-75c-30 0 -58 6 -81 22s-44 44 -44 78
|
||||
v100h100v-94c4 -3 13 -6 25 -6h250c14 0 25 11 25 25v50c0 15 -20 40 -34 44l-257 65c-66 16 -109 73 -109 141v50c0 68 57 125 125 125h75v100z" />
|
||||
<glyph glyph-name="54" unicode=""
|
||||
d="M0 700h300v-300l-300 -300v600zM500 700h300v-300l-300 -300v600z" />
|
||||
<glyph glyph-name="55" unicode=""
|
||||
d="M300 700v-600h-300v300zM800 700v-600h-300v300z" />
|
||||
<glyph glyph-name="56" unicode=""
|
||||
d="M300 700v-100c-111 0 -200 -89 -200 -200h200v-300h-300v300c0 165 135 300 300 300zM800 700v-100c-111 0 -200 -89 -200 -200h200v-300h-300v300c0 165 135 300 300 300z" />
|
||||
<glyph glyph-name="57" unicode=""
|
||||
d="M0 700h300v-300c0 -165 -135 -300 -300 -300v100c111 0 200 89 200 200h-200v300zM500 700h300v-300c0 -165 -135 -300 -300 -300v100c111 0 200 89 200 200h-200v300z" />
|
||||
<glyph glyph-name="58" unicode="" horiz-adv-x="600"
|
||||
d="M300 800l34 -34c11 -11 266 -270 266 -488c0 -165 -135 -300 -300 -300s-300 135 -300 300c0 218 255 477 266 488zM150 328c-28 0 -50 -22 -50 -50c0 -110 90 -200 200 -200c28 0 50 22 50 50s-22 50 -50 50c-55 0 -100 45 -100 100c0 28 -22 50 -50 50z" />
|
||||
<glyph glyph-name="59" unicode=""
|
||||
d="M400 800l400 -500h-800zM0 200h800v-200h-800v200z" />
|
||||
<glyph glyph-name="5a" unicode="" horiz-adv-x="600"
|
||||
d="M300 800l300 -300h-600zM0 300h600l-300 -300z" />
|
||||
<glyph glyph-name="5b" unicode=""
|
||||
d="M0 500h200v-200h-200v200zM300 500h200v-200h-200v200zM600 500h200v-200h-200v200z" />
|
||||
<glyph glyph-name="5c" unicode=""
|
||||
d="M0 700h800v-100l-400 -200l-400 200v100zM0 500l400 -200l400 200v-400h-800v400z" />
|
||||
<glyph glyph-name="5d" unicode=""
|
||||
d="M400 800l400 -200v-600h-800v600zM400 688l-300 -150v-188l300 -150l300 150v188zM200 500h400v-100l-200 -100l-200 100v100z" />
|
||||
<glyph glyph-name="5e" unicode=""
|
||||
d="M600 700c69 0 134 -19 191 -50l-16 -106c-49 35 -109 56 -175 56c-131 0 -240 -84 -281 -200h331l-16 -100h-334c0 -36 8 -68 19 -100h297l-16 -100h-222c55 -61 133 -100 222 -100c78 0 147 30 200 78v-122c-59 -35 -127 -56 -200 -56c-147 0 -274 82 -344 200h-256
|
||||
l19 100h197c-8 32 -16 66 -16 100h-200l25 100h191c45 172 198 300 384 300z" />
|
||||
<glyph glyph-name="5f" unicode=""
|
||||
d="M0 700h700v-100h-700v100zM0 500h500v-100h-500v100zM0 300h800v-100h-800v100zM0 100h100v-100h-100v100zM200 100h100v-100h-100v100zM400 100h100v-100h-100v100z" />
|
||||
<glyph glyph-name="60" unicode=""
|
||||
d="M0 800h800v-100h-800v100zM200 600h400l-200 -200zM0 200h800v-200h-800v200z" />
|
||||
<glyph glyph-name="61" unicode=""
|
||||
d="M0 800h100v-800h-100v800zM600 800h200v-800h-200v800zM200 600l200 -200l-200 -200v400z" />
|
||||
<glyph glyph-name="62" unicode=""
|
||||
d="M0 800h200v-800h-200v800zM700 800h100v-800h-100v800zM600 600v-400l-200 200z" />
|
||||
<glyph glyph-name="63" unicode=""
|
||||
d="M0 800h800v-200h-800v200zM400 400l200 -200h-400zM0 100h800v-100h-800v100z" />
|
||||
<glyph glyph-name="64" unicode=""
|
||||
d="M0 800h200v-100h-100v-600h600v100h100v-200h-800v800zM400 800h400v-400l-150 150l-250 -250l-100 100l250 250z" />
|
||||
<glyph glyph-name="65" unicode=""
|
||||
d="M403 700c247 0 397 -300 397 -300s-150 -300 -397 -300c-253 0 -403 300 -403 300s150 300 403 300zM400 600c-110 0 -200 -90 -200 -200s90 -200 200 -200s200 90 200 200s-90 200 -200 200zM400 500c10 0 19 -3 28 -6c-16 -8 -28 -24 -28 -44c0 -28 22 -50 50 -50
|
||||
c20 0 36 12 44 28c3 -9 6 -18 6 -28c0 -55 -45 -100 -100 -100s-100 45 -100 100s45 100 100 100z" />
|
||||
<glyph glyph-name="66" unicode="" horiz-adv-x="900"
|
||||
d="M331 700h3h3c3 1 7 1 10 1c12 0 29 -8 37 -17l94 -93l66 65c57 57 155 57 212 0c58 -58 58 -154 0 -212l-65 -66l93 -94c10 -8 18 -25 18 -38c0 -28 -22 -50 -50 -50c-13 0 -32 9 -40 20l-62 65l-381 -381h-269v272l375 381l-63 63c-9 8 -16 24 -16 36c0 20 16 42 35 48z
|
||||
M447 481l-313 -315l128 -132l316 316z" />
|
||||
<glyph glyph-name="67" unicode=""
|
||||
d="M0 800h300v-400h400v-400h-700v800zM400 800l300 -300h-300v300z" />
|
||||
<glyph glyph-name="68" unicode=""
|
||||
d="M200 800c0 0 200 -100 200 -300s-298 -302 -200 -500c0 0 -200 100 -200 300s300 300 200 500zM500 500c0 0 200 -100 200 -300c0 -150 -60 -200 -100 -200h-300c0 200 300 300 200 500z" />
|
||||
<glyph glyph-name="69" unicode=""
|
||||
d="M0 800h100v-800h-100v800zM200 800h300v-100h300l-200 -203l200 -197h-400v100h-200v400z" />
|
||||
<glyph glyph-name="6a" unicode="" horiz-adv-x="400"
|
||||
d="M150 800h150l-100 -200h200l-150 -300h150l-300 -300l-100 300h134l66 200h-200z" />
|
||||
<glyph glyph-name="6b" unicode=""
|
||||
d="M0 800h300v-100h500v-100h-800v200zM0 500h800v-450c0 -28 -22 -50 -50 -50h-700c-28 0 -50 22 -50 50v450z" />
|
||||
<glyph glyph-name="6c" unicode=""
|
||||
d="M150 800c83 0 150 -67 150 -150c0 -66 -41 -121 -100 -141v-118c15 5 33 9 50 9h200c28 0 50 22 50 50v59c-59 20 -100 75 -100 141c0 83 67 150 150 150s150 -67 150 -150c0 -66 -41 -121 -100 -141v-59c0 -82 -68 -150 -150 -150h-200c-14 0 -25 -7 -34 -16
|
||||
c50 -24 84 -74 84 -134c0 -83 -67 -150 -150 -150s-150 67 -150 150c0 66 41 121 100 141v218c-59 20 -100 75 -100 141c0 83 67 150 150 150z" />
|
||||
<glyph glyph-name="6d" unicode=""
|
||||
d="M0 800h400l-150 -150l150 -150l-100 -100l-150 150l-150 -150v400zM500 400l150 -150l150 150v-400h-400l150 150l-150 150z" />
|
||||
<glyph glyph-name="6e" unicode=""
|
||||
d="M100 800l150 -150l150 150v-400h-400l150 150l-150 150zM400 400h400l-150 -150l150 -150l-100 -100l-150 150l-150 -150v400z" />
|
||||
<glyph glyph-name="6f" unicode=""
|
||||
d="M400 800c221 0 400 -179 400 -400s-179 -400 -400 -400s-400 179 -400 400s179 400 400 400zM400 700c-56 0 -108 -17 -153 -44l22 -19c33 -18 13 -48 -13 -59c-30 -13 -77 10 -65 -41c13 -55 -27 -3 -47 -15c-42 -26 49 -152 31 -156l-59 34c-8 0 -13 -5 -16 -10
|
||||
c1 -30 10 -57 19 -84c28 -11 77 -2 100 -25c47 -28 97 -115 75 -159c34 -13 68 -22 106 -22c101 0 193 48 247 125c3 24 -8 44 -50 44c-69 0 -156 13 -153 97c2 46 101 108 66 143c-30 30 12 39 12 66c0 37 -65 32 -69 50s20 36 41 56c-30 10 -60 19 -94 19zM631 591
|
||||
c-38 -11 -94 -35 -87 -53c6 -15 52 -1 65 -13c11 -10 16 -59 44 -31l22 22v3c-11 26 -26 50 -44 72z" />
|
||||
<glyph glyph-name="70" unicode=""
|
||||
d="M703 800l97 -100l-400 -400l-100 100l-200 -203l-100 100l300 303l100 -100zM0 100h800v-100h-800v100z" />
|
||||
<glyph glyph-name="71" unicode=""
|
||||
d="M0 700h100v-100h-100v100zM200 700h100v-100h-100v100zM400 700h100v-100h-100v100zM600 700h100v-100h-100v100zM0 500h100v-100h-100v100zM200 500h100v-100h-100v100zM400 500h100v-100h-100v100zM600 500h100v-100h-100v100zM0 300h100v-100h-100v100zM200 300h100
|
||||
v-100h-100v100zM400 300h100v-100h-100v100zM600 300h100v-100h-100v100zM0 100h100v-100h-100v100zM200 100h100v-100h-100v100zM400 100h100v-100h-100v100zM600 100h100v-100h-100v100z" />
|
||||
<glyph glyph-name="72" unicode=""
|
||||
d="M0 800h200v-200h-200v200zM300 800h200v-200h-200v200zM600 800h200v-200h-200v200zM0 500h200v-200h-200v200zM300 500h200v-200h-200v200zM600 500h200v-200h-200v200zM0 200h200v-200h-200v200zM300 200h200v-200h-200v200zM600 200h200v-200h-200v200z" />
|
||||
<glyph glyph-name="73" unicode=""
|
||||
d="M0 800h300v-300h-300v300zM500 800h300v-300h-300v300zM0 300h300v-300h-300v300zM500 300h300v-300h-300v300z" />
|
||||
<glyph glyph-name="74" unicode=""
|
||||
d="M19 800h662c11 0 19 -8 19 -19v-331c0 -28 -22 -50 -50 -50h-600c-28 0 -50 22 -50 50v331c0 11 8 19 19 19zM0 309c16 -6 32 -9 50 -9h600c18 0 34 3 50 9v-290c0 -11 -8 -19 -19 -19h-662c-11 0 -19 8 -19 19v290zM550 200c-28 0 -50 -22 -50 -50s22 -50 50 -50
|
||||
s50 22 50 50s-22 50 -50 50z" />
|
||||
<glyph glyph-name="75" unicode=""
|
||||
d="M0 700h300v-100h-50c-28 0 -50 -22 -50 -50v-150h300v150c0 28 -22 50 -50 50h-50v100h300v-100h-50c-28 0 -50 -22 -50 -50v-400c0 -28 22 -50 50 -50h50v-100h-300v100h50c28 0 50 22 50 50v150h-300v-150c0 -28 22 -50 50 -50h50v-100h-300v100h50c28 0 50 22 50 50
|
||||
v400c0 28 -22 50 -50 50h-50v100z" />
|
||||
<glyph glyph-name="76" unicode=""
|
||||
d="M400 700c165 0 300 -135 300 -300v-100h50c28 0 50 -22 50 -50v-200c0 -28 -22 -50 -50 -50h-100c-28 0 -50 22 -50 50v350c0 111 -89 200 -200 200s-200 -89 -200 -200v-350c0 -28 -22 -50 -50 -50h-100c-28 0 -50 22 -50 50v200c0 28 22 50 50 50h50v100
|
||||
c0 165 135 300 300 300z" />
|
||||
<glyph glyph-name="77" unicode=""
|
||||
d="M0 500c0 109 91 200 200 200s200 -91 200 -200c0 109 91 200 200 200s200 -91 200 -200c0 -55 -23 -105 -59 -141l-341 -340l-341 340c-36 36 -59 86 -59 141z" />
|
||||
<glyph glyph-name="78" unicode=""
|
||||
d="M400 700l400 -300l-100 3v-403h-200v200h-200v-200h-200v400h-100z" />
|
||||
<glyph glyph-name="79" unicode=""
|
||||
d="M0 800h800v-800h-800v800zM100 700v-300l100 100l400 -400h100v100l-200 200l100 100l100 -100v300h-600z" />
|
||||
<glyph glyph-name="7a" unicode=""
|
||||
d="M19 800h762c11 0 19 -8 19 -19v-762c0 -11 -8 -19 -19 -19h-762c-11 0 -19 8 -19 19v762c0 11 8 19 19 19zM100 600v-300h100l100 -100h200l100 100h100v300h-600z" />
|
||||
<glyph glyph-name="7b" unicode=""
|
||||
d="M200 600c80 0 142 -56 200 -122c58 66 119 122 200 122c131 0 200 -101 200 -200s-69 -200 -200 -200c-81 0 -142 56 -200 122c-58 -66 -121 -122 -200 -122c-131 0 -200 101 -200 200s69 200 200 200zM200 500c-74 0 -100 -54 -100 -100s26 -100 100 -100
|
||||
c42 0 88 47 134 100c-46 53 -92 100 -134 100zM600 500c-43 0 -88 -47 -134 -100c46 -53 91 -100 134 -100c74 0 100 54 100 100s-26 100 -100 100z" />
|
||||
<glyph glyph-name="7c" unicode="" horiz-adv-x="400"
|
||||
d="M300 800c55 0 100 -45 100 -100s-45 -100 -100 -100s-100 45 -100 100s45 100 100 100zM150 550c83 0 150 -69 150 -150c0 -66 -100 -214 -100 -250c0 -28 22 -50 50 -50s50 22 50 50h100c0 -83 -67 -150 -150 -150s-150 64 -150 150s100 222 100 250s-22 50 -50 50
|
||||
s-50 -22 -50 -50h-100c0 83 67 150 150 150z" />
|
||||
<glyph glyph-name="7d" unicode=""
|
||||
d="M200 800h500v-100h-122c-77 -197 -156 -392 -234 -588l-6 -12h162v-100h-500v100h122c77 197 156 392 234 588l7 12h-163v100z" />
|
||||
<glyph glyph-name="7e" unicode=""
|
||||
d="M0 700h800v-100h-800v100zM0 500h800v-100h-800v100zM0 300h800v-100h-800v100zM100 100h600v-100h-600v100z" />
|
||||
<glyph glyph-name="7f" unicode=""
|
||||
d="M0 700h800v-100h-800v100zM0 500h800v-100h-800v100zM0 300h800v-100h-800v100zM0 100h600v-100h-600v100z" />
|
||||
<glyph glyph-name="80" unicode=""
|
||||
d="M0 700h800v-100h-800v100zM0 500h800v-100h-800v100zM0 300h800v-100h-800v100zM200 100h600v-100h-600v100z" />
|
||||
<glyph glyph-name="81" unicode=""
|
||||
d="M550 800c138 0 250 -112 250 -250s-112 -250 -250 -250c-16 0 -32 0 -47 3l-3 -3v-100h-200v-200h-300v200l303 303c-3 15 -3 31 -3 47c0 138 112 250 250 250zM600 700c-55 0 -100 -45 -100 -100s45 -100 100 -100s100 45 100 100s-45 100 -100 100z" />
|
||||
<glyph glyph-name="82" unicode=""
|
||||
d="M134 600h3h4h4h5h500c28 0 50 -22 50 -50v-350h100v-150c0 -28 -22 -50 -50 -50h-700c-28 0 -50 22 -50 50v150h100v350v2c0 20 15 42 34 48zM200 500v-300h100v-100h200v100h100v300h-400z" />
|
||||
<glyph glyph-name="83" unicode=""
|
||||
d="M0 800h400v-400h-400v400zM500 600h100v-400h-400v100h300v300zM700 400h100v-400h-400v100h300v300z" />
|
||||
<glyph glyph-name="84" unicode="" horiz-adv-x="600"
|
||||
d="M337 694c6 4 12 7 21 7c28 0 50 -22 50 -50c0 -17 -12 -37 -27 -45l-300 -150c-8 -6 -21 -11 -31 -11c-28 0 -50 22 -50 50c0 21 16 44 37 49zM437 544c6 4 12 7 21 7c28 0 50 -22 50 -50c0 -17 -12 -37 -27 -45l-400 -200c-8 -6 -21 -11 -31 -11c-28 0 -50 22 -50 50
|
||||
c0 21 16 44 37 49zM437 344c6 4 12 7 21 7c28 0 50 -22 50 -50c0 -17 -12 -37 -27 -45l-106 -56c24 -4 43 -26 43 -50c0 -28 -23 -51 -51 -51c-2 0 -6 1 -8 1h-200c-26 1 -48 24 -48 50c0 16 12 36 26 44zM151 -50c0 23 20 50 46 50h3h4h5h100c28 0 50 -22 50 -50
|
||||
s-22 -50 -50 -50h-100c-2 0 -6 -1 -8 -1c-28 0 -50 23 -50 51z" />
|
||||
<glyph glyph-name="85" unicode=""
|
||||
d="M199 800h100v-200h-200v100h100v100zM586 797h1c18 1 38 1 56 -3c36 -8 69 -26 97 -54c78 -78 78 -203 0 -281l-150 -150c-8 -13 -28 -24 -43 -24c-28 0 -50 22 -50 50c0 15 11 35 24 43l150 150c40 40 39 105 0 144c-41 41 -110 34 -144 0l-44 -44
|
||||
c-8 -13 -27 -24 -42 -24c-28 0 -50 22 -50 50c0 15 11 35 24 43l43 44c32 33 72 53 128 56zM208 490c4 5 14 16 22 16h3c2 0 6 1 8 1c28 0 50 -22 50 -50c0 -11 -6 -27 -14 -35l-150 -150c-40 -40 -39 -105 0 -144c41 -41 110 -34 144 0l44 44c8 13 27 24 42 24
|
||||
c28 0 50 -22 50 -50c0 -15 -11 -35 -24 -43l-43 -44c-22 -22 -48 -37 -75 -47c-70 -25 -151 -9 -207 47c-78 78 -78 203 0 281zM499 200h200v-100h-100v-100h-100v200z" />
|
||||
<glyph glyph-name="86" unicode=""
|
||||
d="M586 797c18 1 39 1 57 -3c36 -8 69 -26 97 -54c78 -78 78 -203 0 -281l-150 -150c-62 -62 -132 -81 -182 -78s-69 17 -84 25s-26 27 -26 44c0 28 22 51 50 51c8 0 19 -3 26 -7c0 0 15 -11 41 -13s62 3 106 47l150 150c40 40 39 105 0 144c-41 41 -110 34 -144 0
|
||||
c-8 -13 -28 -24 -43 -24c-28 0 -50 22 -50 50c0 15 11 35 24 43c32 33 72 53 128 56zM386 566c50 -2 64 -17 85 -22s37 -28 37 -49c0 -28 -22 -50 -50 -50c-10 0 -23 5 -31 11c0 0 -19 9 -47 10s-63 -4 -103 -44l-150 -150c-40 -40 -39 -105 0 -144c41 -41 110 -34 144 0
|
||||
c8 13 27 24 42 24c28 0 50 -22 50 -50c0 -15 -10 -35 -23 -43c-22 -22 -48 -37 -75 -47c-70 -25 -151 -9 -207 47c-78 78 -78 203 0 281l150 150c60 60 128 78 178 76z" />
|
||||
<glyph glyph-name="87" unicode=""
|
||||
d="M0 700h300v-300h-300v300zM400 700h400v-100h-400v100zM400 500h300v-100h-300v100zM0 300h300v-300h-300v300zM400 300h400v-100h-400v100zM400 100h300v-100h-300v100z" />
|
||||
<glyph glyph-name="88" unicode=""
|
||||
d="M50 700c28 0 50 -22 50 -50s-22 -50 -50 -50s-50 22 -50 50s22 50 50 50zM200 700h600v-100h-600v100zM50 500c28 0 50 -22 50 -50s-22 -50 -50 -50s-50 22 -50 50s22 50 50 50zM200 500h600v-100h-600v100zM50 300c28 0 50 -22 50 -50s-22 -50 -50 -50s-50 22 -50 50
|
||||
s22 50 50 50zM200 300h600v-100h-600v100zM50 100c28 0 50 -22 50 -50s-22 -50 -50 -50s-50 22 -50 50s22 50 50 50zM200 100h600v-100h-600v100z" />
|
||||
<glyph glyph-name="89" unicode=""
|
||||
d="M800 800l-400 -800l-100 300l-300 100z" />
|
||||
<glyph glyph-name="8a" unicode="" horiz-adv-x="600"
|
||||
d="M300 700c110 0 200 -90 200 -200v-100h100v-400h-600v400h100v100c0 110 90 200 200 200zM300 600c-56 0 -100 -44 -100 -100v-100h200v100c0 56 -44 100 -100 100z" />
|
||||
<glyph glyph-name="8b" unicode="" horiz-adv-x="600"
|
||||
d="M300 800c110 0 200 -90 200 -200v-200h100v-400h-600v400h400v200c0 56 -44 100 -100 100s-100 -44 -100 -100h-100c0 110 90 200 200 200z" />
|
||||
<glyph glyph-name="8c" unicode=""
|
||||
d="M400 700v-100c-111 0 -200 -89 -200 -200h100l-150 -200l-150 200h100c0 165 135 300 300 300zM650 600l150 -200h-100c0 -165 -135 -300 -300 -300v100c111 0 200 89 200 200h-100z" />
|
||||
<glyph glyph-name="8d" unicode=""
|
||||
d="M100 800h600v-300h100l-150 -250l-150 250h100v200h-400v-100h-100v200zM150 550l150 -250h-100v-200h400v100h100v-200h-600v300h-100z" />
|
||||
<glyph glyph-name="8e" unicode=""
|
||||
d="M600 700l200 -150l-200 -150v100h-500v-100h-100v100c0 55 45 100 100 100h500v100zM200 300v-100h500v100h100v-100c0 -55 -45 -100 -100 -100h-500v-100l-200 150z" />
|
||||
<glyph glyph-name="8f" unicode="" horiz-adv-x="900"
|
||||
d="M350 800c193 0 350 -157 350 -350c0 -60 -17 -117 -44 -166c5 -3 12 -8 16 -12l100 -100c16 -16 30 -49 30 -72c0 -56 -46 -102 -102 -102c-23 0 -56 14 -72 30l-100 100c-4 3 -9 9 -12 13c-49 -26 -107 -41 -166 -41c-193 0 -350 157 -350 350s157 350 350 350zM350 200
|
||||
c142 0 250 108 250 250c0 139 -111 250 -250 250s-250 -111 -250 -250s111 -250 250 -250z" />
|
||||
<glyph glyph-name="90" unicode="" horiz-adv-x="600"
|
||||
d="M300 800c166 0 300 -134 300 -300c0 -200 -300 -500 -300 -500s-300 300 -300 500c0 166 134 300 300 300zM300 700c-110 0 -200 -90 -200 -200s90 -200 200 -200s200 90 200 200s-90 200 -200 200z" />
|
||||
<glyph glyph-name="91" unicode="" horiz-adv-x="900"
|
||||
d="M0 800h800v-541c1 -3 1 -8 1 -11s0 -7 -1 -10v-238h-800v800zM495 250c0 26 22 50 50 50h5h150v400h-600v-600h600v100h-150h-5c-28 0 -50 22 -50 50zM350 600c83 0 150 -67 150 -150c0 -100 -150 -250 -150 -250s-150 150 -150 250c0 83 67 150 150 150zM350 500
|
||||
c-28 0 -50 -22 -50 -50s22 -50 50 -50s50 22 50 50s-22 50 -50 50z" />
|
||||
<glyph glyph-name="92" unicode="" horiz-adv-x="600"
|
||||
d="M0 700h200v-600h-200v600zM400 700h200v-600h-200v600z" />
|
||||
<glyph glyph-name="93" unicode="" horiz-adv-x="600"
|
||||
d="M0 700l600 -300l-600 -300v600z" />
|
||||
<glyph glyph-name="94" unicode="" horiz-adv-x="600"
|
||||
d="M300 700c166 0 300 -134 300 -300s-134 -300 -300 -300s-300 134 -300 300s134 300 300 300z" />
|
||||
<glyph glyph-name="95" unicode=""
|
||||
d="M400 700v-600l-400 300zM400 400l400 300v-600z" />
|
||||
<glyph glyph-name="96" unicode=""
|
||||
d="M0 700l400 -300l-400 -300v600zM400 100v600l400 -300z" />
|
||||
<glyph glyph-name="97" unicode=""
|
||||
d="M0 700h200v-600h-200v600zM200 400l500 300v-600z" />
|
||||
<glyph glyph-name="98" unicode=""
|
||||
d="M0 700l500 -300l-500 -300v600zM500 100v600h200v-600h-200z" />
|
||||
<glyph glyph-name="99" unicode="" horiz-adv-x="600"
|
||||
d="M0 700h600v-600h-600v600z" />
|
||||
<glyph glyph-name="9a" unicode=""
|
||||
d="M200 800h400v-200h200v-400h-200v-200h-400v200h-200v400h200v200z" />
|
||||
<glyph glyph-name="9b" unicode=""
|
||||
d="M0 700h800v-100h-800v100zM0 403h800v-100h-800v100zM0 103h800v-100h-800v100z" />
|
||||
<glyph glyph-name="9c" unicode="" horiz-adv-x="600"
|
||||
d="M278 700c7 2 13 4 22 4c55 0 100 -45 100 -100v-4v-200c0 -55 -45 -100 -100 -100s-100 45 -100 100v200v2c0 44 35 88 78 98zM34 500h4h3c3 0 6 1 9 1c28 0 50 -22 50 -50v-1v-50c0 -111 89 -200 200 -200s200 89 200 200v50c0 28 22 50 50 50s50 -22 50 -50v-50
|
||||
c0 -148 -109 -270 -250 -294v-106h50c55 0 100 -45 100 -100h-400c0 55 45 100 100 100h50v106c-141 24 -250 146 -250 294v50v2c0 20 15 42 34 48z" />
|
||||
<glyph glyph-name="9d" unicode=""
|
||||
d="M0 500h800v-200h-800v200z" />
|
||||
<glyph glyph-name="9e" unicode=""
|
||||
d="M34 700h4h3h4h5h700c28 0 50 -22 50 -50v-500c0 -28 -22 -50 -50 -50h-250v-100h100c55 0 100 -45 100 -100h-600c0 55 45 100 100 100h100v100h-250c-28 0 -50 22 -50 50v500v2c0 20 15 42 34 48zM100 600v-400h600v400h-600z" />
|
||||
<glyph glyph-name="9f" unicode=""
|
||||
d="M272 700c-14 -40 -22 -83 -22 -128c0 -221 179 -400 400 -400c45 0 88 8 128 22c-53 -158 -202 -272 -378 -272c-221 0 -400 179 -400 400c0 176 114 325 272 378z" />
|
||||
<glyph glyph-name="a0" unicode=""
|
||||
d="M350 700l150 -150h-100v-150h150v100l150 -150l-150 -150v100h-150v-150h100l-150 -150l-150 150h100v150h-150v-100l-150 150l150 150v-100h150v150h-100z" />
|
||||
<glyph glyph-name="a1" unicode=""
|
||||
d="M800 800v-550c0 -83 -67 -150 -150 -150s-150 67 -150 150s67 150 150 150c17 0 35 -4 50 -9v206c-201 -6 -327 -27 -400 -50v-397c0 -83 -67 -150 -150 -150s-150 67 -150 150s67 150 150 150c17 0 35 -4 50 -9v409s100 100 600 100z" />
|
||||
<glyph glyph-name="a2" unicode="" horiz-adv-x="700"
|
||||
d="M499 700c51 0 102 -20 141 -59c78 -78 78 -203 0 -281l-250 -244c-48 -48 -127 -48 -175 0s-48 127 0 175l96 97l69 -69l-90 -94l-7 -3c-10 -10 -10 -28 0 -38s28 -10 38 0l250 247c37 40 39 102 0 141s-104 40 -144 0l-278 -275c-66 -69 -68 -179 0 -247
|
||||
c69 -69 181 -69 250 0l9 12l116 113l69 -69l-125 -125c-107 -107 -281 -107 -388 0s-107 281 0 388l278 272c39 39 90 59 141 59z" />
|
||||
<glyph glyph-name="a3" unicode=""
|
||||
d="M600 800l200 -200l-100 -100l-200 200zM400 600l200 -200l-400 -400h-200v200z" />
|
||||
<glyph glyph-name="a4" unicode=""
|
||||
d="M550 800c83 0 150 -90 150 -200s-67 -200 -150 -200c-22 0 -40 8 -59 19c6 26 9 52 9 81c0 84 -27 158 -72 212c27 52 71 88 122 88zM250 700c83 0 150 -90 150 -200s-67 -200 -150 -200s-150 90 -150 200s67 200 150 200zM725 384c44 -22 75 -66 75 -118v-166h-200v66
|
||||
c0 50 -17 96 -44 134c66 2 126 33 169 84zM75 284c45 -53 106 -84 175 -84s130 31 175 84c44 -22 75 -66 75 -118v-166h-500v166c0 52 31 96 75 118z" />
|
||||
<glyph glyph-name="a5" unicode=""
|
||||
d="M400 800c110 0 200 -112 200 -250s-90 -250 -200 -250s-200 112 -200 250s90 250 200 250zM191 300c54 -61 128 -100 209 -100s155 39 209 100c106 -5 191 -92 191 -200v-100h-800v100c0 108 85 195 191 200z" />
|
||||
<glyph glyph-name="a6" unicode="" horiz-adv-x="600"
|
||||
d="M19 800h462c11 0 19 -8 19 -19v-762c0 -11 -8 -19 -19 -19h-462c-11 0 -19 8 -19 19v762c0 11 8 19 19 19zM100 700v-500h300v500h-300zM250 150c-28 0 -50 -22 -50 -50s22 -50 50 -50s50 22 50 50s-22 50 -50 50z" />
|
||||
<glyph glyph-name="a7" unicode=""
|
||||
d="M350 800c17 0 34 -1 50 -3v-397l-297 297c63 64 150 103 247 103zM500 694c169 -25 300 -168 300 -344c0 -193 -157 -350 -350 -350c-85 0 -161 31 -222 81l272 272v341zM91 562l237 -234l-212 -212c-70 55 -116 138 -116 234c0 84 35 158 91 212z" />
|
||||
<glyph glyph-name="a8" unicode=""
|
||||
d="M92 650c0 23 20 50 46 50h3h4h5h400c28 0 50 -22 50 -50s-22 -50 -50 -50h-50v-200h100c55 0 100 -45 100 -100h-300v-300l-56 -100l-44 100v300h-300c0 55 45 100 100 100h100v200h-50c-2 0 -6 -1 -8 -1c-28 0 -50 23 -50 51z" />
|
||||
<glyph glyph-name="a9" unicode=""
|
||||
d="M400 800c221 0 400 -179 400 -400s-179 -400 -400 -400s-400 179 -400 400s179 400 400 400zM300 600v-400l300 200z" />
|
||||
<glyph glyph-name="aa" unicode=""
|
||||
d="M300 800h200v-300h300v-200h-300v-300h-200v300h-300v200h300v300z" />
|
||||
<glyph glyph-name="ab" unicode=""
|
||||
d="M300 800h100v-400h-100v400zM172 656l62 -78l-40 -31c-58 -46 -94 -117 -94 -197c0 -139 111 -250 250 -250s250 111 250 250c0 80 -39 151 -97 197l-37 31l62 78l38 -31c82 -64 134 -164 134 -275c0 -193 -157 -350 -350 -350s-350 157 -350 350c0 111 53 211 134 275z
|
||||
" />
|
||||
<glyph glyph-name="ac" unicode=""
|
||||
d="M200 800h400v-200h-400v200zM9 500h782c6 0 9 -3 9 -9v-282c0 -6 -3 -9 -9 -9h-91v200h-600v-200h-91c-6 0 -9 3 -9 9v282c0 6 3 9 9 9zM200 300h400v-300h-400v300z" />
|
||||
<glyph glyph-name="ad" unicode=""
|
||||
d="M0 700h100v-700h-100v700zM700 700h100v-700h-100v700zM200 600h200v-100h-200v100zM300 400h200v-100h-200v100zM400 200h200v-100h-200v100z" />
|
||||
<glyph glyph-name="ae" unicode=""
|
||||
d="M325 700c42 -141 87 -280 131 -419c29 74 59 148 88 222c30 -57 58 -114 87 -172h169v-100h-231l-13 28c-37 -92 -74 -184 -112 -275c-38 129 -79 257 -119 385c-42 -133 -83 -267 -125 -400c-28 88 -56 175 -84 262h-116v100h188l9 -34l3 -6c42 137 83 273 125 409z" />
|
||||
<glyph glyph-name="af" unicode=""
|
||||
d="M200 600c0 57 43 100 100 100s100 -43 100 -100c0 -28 -18 -48 -28 -72c-3 -6 -3 -16 -3 -28h231v-231c12 0 22 0 28 3c24 10 44 28 72 28c57 0 100 -43 100 -100s-43 -100 -100 -100c-28 0 -48 18 -72 28c-6 3 -16 3 -28 3v-231h-231c0 12 0 22 3 28c10 24 28 44 28 72
|
||||
c0 57 -43 100 -100 100s-100 -43 -100 -100c0 -28 18 -48 28 -72c3 -6 3 -16 3 -28h-231v600h231c0 12 0 22 -3 28c-10 24 -28 44 -28 72z" />
|
||||
<glyph glyph-name="b0" unicode="" horiz-adv-x="500"
|
||||
d="M247 700c84 0 148 -20 191 -59s59 -93 59 -141c0 -117 -69 -181 -119 -225s-81 -67 -81 -150v-25h-100v25c0 117 65 181 115 225s85 67 85 150c0 25 -8 48 -28 66s-56 34 -122 34s-97 -18 -116 -37s-27 -43 -31 -69l-100 12c5 38 19 88 59 128s103 66 188 66zM197 0h100
|
||||
v-100h-100v100z" />
|
||||
<glyph glyph-name="b1" unicode=""
|
||||
d="M450 800c138 0 250 -112 250 -250v-50c58 -21 100 -85 100 -150c0 -69 -48 -127 -112 -144c-22 55 -75 94 -138 94c-20 0 -39 -5 -56 -12c-17 64 -75 112 -144 112s-127 -48 -144 -112c-17 7 -36 12 -56 12c-37 0 -71 -12 -97 -34c-33 36 -53 82 -53 134
|
||||
c0 110 90 200 200 200c23 114 129 200 250 200zM334 300h4h3c3 0 6 1 9 1c28 0 50 -22 50 -50v-1v-200c0 -28 -22 -50 -50 -50s-50 22 -50 50v200v2c0 20 15 42 34 48zM134 200h4h3c3 0 6 1 9 1c28 0 50 -22 50 -50v-1v-100c0 -28 -22 -50 -50 -50s-50 22 -50 50v100v2
|
||||
c0 20 15 42 34 48zM534 200h3h4c3 0 6 1 9 1c28 0 50 -22 50 -50v-1v-100c0 -28 -22 -50 -50 -50s-50 22 -50 50v100v2c0 20 15 42 34 48z" />
|
||||
<glyph glyph-name="b2" unicode=""
|
||||
d="M600 800l200 -150l-200 -150v100h-50l-153 -191l175 -206l6 -3h22v100l200 -150l-200 -150v100h-25c-35 0 -56 12 -78 38l-166 190l-153 -190c-22 -27 -43 -38 -78 -38h-100v100h100l166 206l-163 191l-3 3h-100v100h100c34 0 56 -12 78 -38l153 -178l141 178
|
||||
c22 27 43 38 78 38h50v100z" />
|
||||
<glyph glyph-name="b3" unicode=""
|
||||
d="M400 800c110 0 209 -47 281 -119l119 119v-300h-300l109 109c-54 55 -126 91 -209 91c-166 0 -300 -134 -300 -300s134 -300 300 -300c83 0 158 34 212 88l72 -72c-72 -72 -174 -116 -284 -116c-220 0 -400 180 -400 400s180 400 400 400z" />
|
||||
<glyph glyph-name="b4" unicode=""
|
||||
d="M400 800h400v-400l-166 166l-400 -400l166 -166h-400v400l166 -166l400 400z" />
|
||||
<glyph glyph-name="b5" unicode="" horiz-adv-x="600"
|
||||
d="M250 800l250 -300h-200v-200h200l-250 -300l-250 300h200v200h-200z" />
|
||||
<glyph glyph-name="b6" unicode=""
|
||||
d="M300 600v-200h200v200l300 -250l-300 -250v200h-200v-200l-300 250z" />
|
||||
<glyph glyph-name="b7" unicode=""
|
||||
d="M0 800c441 0 800 -359 800 -800h-200c0 333 -267 600 -600 600v200zM0 500c275 0 500 -225 500 -500h-200c0 167 -133 300 -300 300v200zM0 200c110 0 200 -90 200 -200h-200v200z" />
|
||||
<glyph glyph-name="b8" unicode=""
|
||||
d="M100 800c386 0 700 -314 700 -700h-100c0 332 -268 600 -600 600v100zM100 600c276 0 500 -224 500 -500h-100c0 222 -178 400 -400 400v100zM100 400c165 0 300 -135 300 -300h-100c0 111 -89 200 -200 200v100zM100 200c55 0 100 -45 100 -100s-45 -100 -100 -100
|
||||
s-100 45 -100 100s45 100 100 100z" />
|
||||
<glyph glyph-name="b9" unicode=""
|
||||
d="M300 800h400c55 0 100 -45 100 -100v-200h-400v150c0 28 -22 50 -50 50s-50 -22 -50 -50v-250h400v-300c0 -55 -45 -100 -100 -100h-500c-55 0 -100 45 -100 100v200h100v-150c0 -28 22 -50 50 -50s50 22 50 50v550c0 55 45 100 100 100z" />
|
||||
<glyph glyph-name="ba" unicode=""
|
||||
d="M75 700h225v-100h-200v-500h400v100h100v-125c0 -41 -34 -75 -75 -75h-450c-41 0 -75 34 -75 75v550c0 41 34 75 75 75zM600 700l200 -200l-200 -200v100h-200c-94 0 -173 -65 -194 -153c23 199 189 353 394 353v100z" />
|
||||
<glyph glyph-name="bb" unicode=""
|
||||
d="M500 700l300 -284l-300 -316v200h-100c-200 0 -348 -102 -400 -300c0 295 100 500 500 500v200z" />
|
||||
<glyph glyph-name="bc" unicode=""
|
||||
d="M381 791l19 9l19 -9c127 -53 253 -108 381 -160v-31c0 -166 -67 -313 -147 -419c-40 -53 -83 -97 -125 -128s-82 -53 -128 -53s-86 22 -128 53s-85 75 -125 128c-80 107 -147 253 -147 419v31c128 52 254 107 381 160zM400 100v591l-294 -122c8 -126 58 -243 122 -328
|
||||
c35 -46 73 -86 106 -110s62 -31 66 -31z" />
|
||||
<glyph glyph-name="bd" unicode=""
|
||||
d="M600 800h100v-800h-100v800zM400 700h100v-700h-100v700zM200 500h100v-500h-100v500zM0 300h100v-300h-100v300z" />
|
||||
<glyph glyph-name="be" unicode=""
|
||||
d="M300 800h100v-200h200l100 -100l-100 -100h-200v-400h-100v500h-200l-100 100l100 100h200v100z" />
|
||||
<glyph glyph-name="bf" unicode=""
|
||||
d="M200 800h100v-600h200l-250 -200l-250 200h200v600zM400 800h200v-100h-200v100zM400 600h300v-100h-300v100zM400 400h400v-100h-400v100z" />
|
||||
<glyph glyph-name="c0" unicode=""
|
||||
d="M200 800h100v-600h200l-250 -200l-250 200h200v600zM400 800h400v-100h-400v100zM400 600h300v-100h-300v100zM400 400h200v-100h-200v100z" />
|
||||
<glyph glyph-name="c1" unicode=""
|
||||
d="M75 700h650c41 0 75 -34 75 -75v-550c0 -41 -34 -75 -75 -75h-650c-41 0 -75 34 -75 75v550c0 41 34 75 75 75zM100 600v-100h100v100h-100zM300 600v-100h400v100h-400zM100 400v-100h100v100h-100zM300 400v-100h400v100h-400zM100 200v-100h100v100h-100zM300 200
|
||||
v-100h400v100h-400z" />
|
||||
<glyph glyph-name="c2" unicode=""
|
||||
d="M400 800l100 -300h300l-250 -200l100 -300l-250 200l-250 -200l100 300l-250 200h300z" />
|
||||
<glyph glyph-name="c3" unicode=""
|
||||
d="M400 800c28 0 50 -22 50 -50s-22 -50 -50 -50s-50 22 -50 50s22 50 50 50zM150 700c28 0 50 -22 50 -50s-22 -50 -50 -50s-50 22 -50 50s22 50 50 50zM650 700c28 0 50 -22 50 -50s-22 -50 -50 -50s-50 22 -50 50s22 50 50 50zM400 600c110 0 200 -90 200 -200
|
||||
s-90 -200 -200 -200s-200 90 -200 200s90 200 200 200zM50 450c28 0 50 -22 50 -50s-22 -50 -50 -50s-50 22 -50 50s22 50 50 50zM750 450c28 0 50 -22 50 -50s-22 -50 -50 -50s-50 22 -50 50s22 50 50 50zM150 200c28 0 50 -22 50 -50s-22 -50 -50 -50s-50 22 -50 50
|
||||
s22 50 50 50zM650 200c28 0 50 -22 50 -50s-22 -50 -50 -50s-50 22 -50 50s22 50 50 50zM400 100c28 0 50 -22 50 -50s-22 -50 -50 -50s-50 22 -50 50s22 50 50 50z" />
|
||||
<glyph glyph-name="c4" unicode=""
|
||||
d="M34 800h632c18 0 34 -16 34 -34v-732c0 -18 -16 -34 -34 -34h-632c-18 0 -34 16 -34 34v732c0 18 16 34 34 34zM100 700v-500h500v500h-500zM350 150c-38 0 -63 -42 -44 -75s69 -33 88 0s-6 75 -44 75z" />
|
||||
<glyph glyph-name="c5" unicode=""
|
||||
d="M0 800h300l500 -500l-300 -300l-500 500v300zM200 700c-55 0 -100 -45 -100 -100s45 -100 100 -100s100 45 100 100s-45 100 -100 100z" />
|
||||
<glyph glyph-name="c6" unicode=""
|
||||
d="M0 600h200l300 -300l-200 -200l-300 300v200zM340 600h160l300 -300l-200 -200l-78 78l119 122zM150 500c-28 0 -50 -22 -50 -50s22 -50 50 -50s50 22 50 50s-22 50 -50 50z" />
|
||||
<glyph glyph-name="c7" unicode=""
|
||||
d="M400 800c220 0 400 -180 400 -400s-180 -400 -400 -400s-400 180 -400 400s180 400 400 400zM400 700c-166 0 -300 -134 -300 -300s134 -300 300 -300s300 134 300 300s-134 300 -300 300zM400 600c110 0 200 -90 200 -200s-90 -200 -200 -200s-200 90 -200 200
|
||||
s90 200 200 200zM400 500c-56 0 -100 -44 -100 -100s44 -100 100 -100s100 44 100 100s-44 100 -100 100z" />
|
||||
<glyph glyph-name="c8" unicode=""
|
||||
d="M0 700h559l-100 -100h-359v-500h500v159l100 100v-359h-700v700zM700 700l100 -100l-400 -400l-200 200l100 100l100 -100z" />
|
||||
<glyph glyph-name="c9" unicode=""
|
||||
d="M9 800h782c6 0 9 -3 9 -9v-782c0 -6 -3 -9 -9 -9h-782c-6 0 -9 3 -9 9v782c0 6 3 9 9 9zM150 722l-72 -72l100 -100l-100 -100l72 -72l172 172zM400 500v-100h300v100h-300z" />
|
||||
<glyph glyph-name="ca" unicode=""
|
||||
d="M0 800h800v-200h-50c0 55 -45 100 -100 100h-150v-550c0 -28 22 -50 50 -50h50v-100h-400v100h50c28 0 50 22 50 50v550h-150c-55 0 -100 -45 -100 -100h-50v200z" />
|
||||
<glyph glyph-name="cb" unicode=""
|
||||
d="M0 700h100v-400h-100v400zM200 700h350c21 0 39 -13 47 -31c0 0 103 -291 103 -319s-22 -50 -50 -50h-150c-28 0 -50 -25 -50 -50s39 -158 47 -184s-5 -55 -31 -63s-52 5 -66 31s-109 219 -128 238s-44 28 -72 28v400z" />
|
||||
<glyph glyph-name="cc" unicode=""
|
||||
d="M400 666c10 19 28 32 47 34l19 -3c26 -8 39 -37 31 -63s-47 -159 -47 -184s22 -50 50 -50h150c28 0 50 -22 50 -50s-103 -319 -103 -319c-8 -18 -26 -31 -47 -31h-350v400c28 0 53 9 72 28s114 212 128 238zM0 400h100v-400h-100v400z" />
|
||||
<glyph glyph-name="cd" unicode=""
|
||||
d="M200 700h300v-100h-100v-6c25 -4 50 -8 72 -16l-34 -94c-28 11 -58 16 -88 16c-139 0 -250 -111 -250 -250s111 -250 250 -250s250 111 250 250c0 31 -5 60 -16 88l91 37c14 -38 25 -81 25 -125c0 -193 -157 -350 -350 -350s-350 157 -350 350c0 176 130 323 300 347v3
|
||||
h-100v100zM700 584c0 0 -296 -348 -316 -368s-48 -20 -68 0s-20 48 0 68s384 300 384 300z" />
|
||||
<glyph glyph-name="ce" unicode=""
|
||||
d="M600 700l200 -150l-200 -150v100h-600v100h600v100zM200 300v-100h600v-100h-600v-100l-200 150z" />
|
||||
<glyph glyph-name="cf" unicode=""
|
||||
d="M300 800h100c55 0 100 -45 100 -100h100c55 0 100 -45 100 -100h-700c0 55 45 100 100 100h100c0 55 45 100 100 100zM100 500h100v-350c0 -28 22 -50 50 -50s50 22 50 50v350h100v-350c0 -28 22 -50 50 -50s50 22 50 50v350h100v-481c0 -11 -8 -19 -19 -19h-462
|
||||
c-11 0 -19 8 -19 19v481z" />
|
||||
<glyph glyph-name="d0" unicode=""
|
||||
d="M100 800h200v-400c0 -55 45 -100 100 -100s100 45 100 100v400h100v-400c0 -110 -90 -200 -200 -200h-50c-138 0 -250 90 -250 200v400zM0 100h700v-100h-700v100z" />
|
||||
<glyph glyph-name="d1" unicode=""
|
||||
d="M9 700h182c6 0 9 -3 9 -9v-482c0 -6 -3 -9 -9 -9h-182c-6 0 -9 3 -9 9v482c0 6 3 9 9 9zM609 700h182c6 0 9 -3 9 -9v-482c0 -6 -3 -9 -9 -9h-182c-6 0 -9 3 -9 9v482c0 6 3 9 9 9zM309 500h182c6 0 9 -3 9 -9v-282c0 -6 -3 -9 -9 -9h-182c-6 0 -9 3 -9 9v282
|
||||
c0 6 3 9 9 9zM0 100h800v-100h-800v100z" />
|
||||
<glyph glyph-name="d2" unicode=""
|
||||
d="M10 700h181c6 0 9 -3 9 -9v-191h-200v191c0 6 4 9 10 9zM610 700h181c6 0 9 -3 9 -9v-191h-200v191c0 6 5 9 10 9zM310 600h181c6 0 9 -3 9 -9v-91h-200v91c0 6 4 9 10 9zM0 400h800v-100h-800v100zM0 200h200v-191c0 -6 -3 -9 -9 -9h-182c-6 0 -9 3 -9 9v191zM300 200
|
||||
h200v-91c0 -6 -3 -9 -9 -9h-181c-6 0 -10 3 -10 9v91zM600 200h200v-191c0 -6 -3 -9 -9 -9h-181c-6 0 -10 3 -10 9v191z" />
|
||||
<glyph glyph-name="d3" unicode=""
|
||||
d="M0 700h800v-100h-800v100zM9 500h182c6 0 9 -3 9 -9v-482c0 -6 -3 -9 -9 -9h-182c-6 0 -9 3 -9 9v482c0 6 3 9 9 9zM309 500h182c6 0 9 -3 9 -9v-282c0 -6 -3 -9 -9 -9h-182c-6 0 -9 3 -9 9v282c0 6 3 9 9 9zM609 500h182c6 0 9 -3 9 -9v-482c0 -6 -3 -9 -9 -9h-182
|
||||
c-6 0 -9 3 -9 9v482c0 6 3 9 9 9z" />
|
||||
<glyph glyph-name="d4" unicode=""
|
||||
d="M50 600h500c28 0 50 -22 50 -50v-150l100 100h100v-300h-100l-100 100v-150c0 -28 -22 -50 -50 -50h-500c-28 0 -50 22 -50 50v400c0 28 22 50 50 50z" />
|
||||
<glyph glyph-name="d5" unicode=""
|
||||
d="M334 800h66v-800h-66l-134 200h-200v400h200zM500 600v100c26 0 52 -4 75 -10c130 -33 225 -150 225 -290s-95 -258 -225 -291h-3c-23 -6 -47 -9 -72 -9v100c17 0 34 2 50 6c86 22 150 100 150 194s-64 172 -150 194c-16 4 -33 6 -50 6zM500 500l25 -3
|
||||
c44 -11 75 -51 75 -97s-32 -86 -75 -97l-25 -3v200z" />
|
||||
<glyph glyph-name="d6" unicode="" horiz-adv-x="600"
|
||||
d="M334 800h66v-800h-66l-134 200h-200v400h200zM500 500l25 -3c44 -11 75 -51 75 -97s-32 -86 -75 -97l-25 -3v200z" />
|
||||
<glyph glyph-name="d7" unicode="" horiz-adv-x="400"
|
||||
d="M334 800h66v-800h-66l-134 200h-200v400h200z" />
|
||||
<glyph glyph-name="d8" unicode=""
|
||||
d="M309 800h82c6 0 10 -4 12 -9l294 -682l3 -19v-81c0 -6 -3 -9 -9 -9h-682c-6 0 -9 3 -9 9v81l3 19l294 682c2 5 6 9 12 9zM300 500v-200h100v200h-100zM300 200v-100h100v100h-100z" />
|
||||
<glyph glyph-name="d9" unicode=""
|
||||
d="M375 800c138 0 269 -39 378 -109l-53 -82c-93 60 -205 91 -325 91c-119 0 -229 -32 -322 -91l-53 82c109 70 237 109 375 109zM375 500c78 0 154 -23 216 -62l-53 -85c-46 30 -104 47 -163 47c-60 0 -112 -17 -159 -47l-54 85c62 40 134 62 213 62zM375 200
|
||||
c55 0 100 -45 100 -100s-45 -100 -100 -100s-100 45 -100 100s45 100 100 100z" />
|
||||
<glyph glyph-name="da" unicode="" horiz-adv-x="900"
|
||||
d="M551 800c16 0 32 0 47 -3l-97 -97v-200h200l97 97c3 -15 3 -31 3 -47c0 -138 -112 -250 -250 -250c-32 0 -62 8 -90 19l-288 -291c-20 -20 -46 -28 -72 -28s-52 8 -72 28c-39 39 -39 105 0 144l291 287c-11 28 -19 59 -19 91c0 138 112 250 250 250zM101 150
|
||||
c-28 0 -50 -22 -50 -50s22 -50 50 -50s50 22 50 50s-22 50 -50 50z" />
|
||||
<glyph glyph-name="db" unicode=""
|
||||
d="M141 700c84 -84 169 -167 253 -250c82 83 167 165 247 250l143 -141l-253 -253c84 -82 167 -166 253 -247l-143 -143c-81 86 -165 169 -247 253l-253 -253l-141 143c85 80 167 164 250 247c-83 84 -166 169 -250 253z" />
|
||||
<glyph glyph-name="dc" unicode=""
|
||||
d="M0 800h100l231 -300h38l231 300h100l-225 -300h225v-100h-300v-100h300v-100h-300v-200h-100v200h-300v100h300v100h-300v100h225z" />
|
||||
<glyph glyph-name="dd" unicode="" horiz-adv-x="900"
|
||||
d="M350 800c193 0 350 -157 350 -350c0 -61 -17 -119 -44 -169c4 -2 10 -6 13 -9l103 -100c16 -16 30 -49 30 -72c0 -56 -46 -102 -102 -102c-23 0 -56 14 -72 30l-100 103c-3 3 -7 9 -9 13c-50 -28 -108 -44 -169 -44c-193 0 -350 157 -350 350s157 350 350 350zM350 700
|
||||
c-139 0 -250 -111 -250 -250s111 -250 250 -250c62 0 119 23 163 60c7 11 19 25 31 31l3 3c34 43 53 97 53 156c0 139 -111 250 -250 250zM300 600h100v-100h100v-100h-100v-100h-100v100h-100v100h100v100z" />
|
||||
<glyph glyph-name="de" unicode="" horiz-adv-x="900"
|
||||
d="M350 800c193 0 350 -157 350 -350c0 -61 -17 -119 -44 -169c4 -2 10 -6 13 -9l103 -100c16 -16 30 -49 30 -72c0 -56 -46 -102 -102 -102c-23 0 -56 14 -72 30l-100 103c-3 3 -7 9 -9 13c-50 -28 -108 -44 -169 -44c-193 0 -350 157 -350 350s157 350 350 350zM350 700
|
||||
c-139 0 -250 -111 -250 -250s111 -250 250 -250c62 0 119 23 163 60c7 11 19 25 31 31l3 3c34 43 53 97 53 156c0 139 -111 250 -250 250zM200 500h300v-100h-300v100z" />
|
||||
</font>
|
||||
</defs></svg>
|
After Width: | Height: | Size: 54 KiB |
Binary file not shown.
Binary file not shown.
BIN
src/JobsJobsJobs/Client/wwwroot/favicon.ico
Normal file
BIN
src/JobsJobsJobs/Client/wwwroot/favicon.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.3 KiB |
49
src/JobsJobsJobs/Client/wwwroot/index.html
Normal file
49
src/JobsJobsJobs/Client/wwwroot/index.html
Normal file
|
@ -0,0 +1,49 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
|
||||
<title>JobsJobsJobs</title>
|
||||
<base href="/">
|
||||
<link href="css/bootstrap/bootstrap.min.css" rel="stylesheet">
|
||||
<link href="css/app.css" rel="stylesheet">
|
||||
<link href="JobsJobsJobs.Client.styles.css" rel="stylesheet">
|
||||
<link href="_content/Blazored.Toast/blazored-toast.min.css" rel="stylesheet">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="app">Loading...</div>
|
||||
|
||||
<div id="blazor-error-ui">
|
||||
An unhandled error has occurred.
|
||||
<a href="" class="reload">Reload</a>
|
||||
<a class="dismiss">🗙</a>
|
||||
</div>
|
||||
<script src="_framework/blazor.webassembly.js"></script>
|
||||
<script>
|
||||
/**
|
||||
* Function to play audio files.
|
||||
*/
|
||||
var Audio = {
|
||||
/**
|
||||
* Play the target audio clip.
|
||||
*
|
||||
* @param {string} audio The ID of the audio element to play
|
||||
*/
|
||||
play(audio) {
|
||||
document.getElementById(audio).play()
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Set the title of the document. (called by PageTitle component)
|
||||
*
|
||||
* @param theTitle The title to be set
|
||||
*/
|
||||
function setPageTitle(theTitle) {
|
||||
document.title = theTitle
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
|
@ -1,204 +0,0 @@
|
|||
namespace JobsJobsJobs
|
||||
|
||||
open NodaTime
|
||||
open Npgsql.FSharp
|
||||
|
||||
/// Helper types and functions for the cache
|
||||
[<AutoOpen>]
|
||||
module private CacheHelpers =
|
||||
|
||||
open System
|
||||
open System.Threading.Tasks
|
||||
open Npgsql
|
||||
|
||||
/// 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 a non-standard type
|
||||
let typedParam<'T> name (it : 'T) =
|
||||
$"@%s{name}", Sql.parameter (NpgsqlParameter ($"@{name}", it))
|
||||
|
||||
/// Create a parameter for a possibly-missing non-standard 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
|
||||
|
||||
/// Create a parameter for the expire-at time
|
||||
let expireParam =
|
||||
typedParam "expireAt"
|
||||
|
||||
|
||||
open System.Threading
|
||||
open BitBadger.Npgsql.FSharp.Documents
|
||||
open JobsJobsJobs.Common.Data
|
||||
open Microsoft.Extensions.Caching.Distributed
|
||||
|
||||
// getEntry isn't resumable
|
||||
#nowarn "3511"
|
||||
|
||||
/// A distributed cache implementation in PostgreSQL used to handle sessions for Jobs, Jobs, Jobs
|
||||
type DistributedCache () =
|
||||
|
||||
// ~~~ INITIALIZATION ~~~
|
||||
|
||||
do
|
||||
task {
|
||||
let! exists =
|
||||
Custom.scalar
|
||||
$"SELECT EXISTS
|
||||
(SELECT 1 FROM pg_tables WHERE schemaname = 'jjj' AND tablename = 'session')
|
||||
AS does_exist"
|
||||
[] (fun row -> row.bool "does_exist")
|
||||
if not exists then
|
||||
do! Custom.nonQuery
|
||||
"CREATE TABLE jjj.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 jjj.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 jjj.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 jjj.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 jjj.session WHERE expire_at < @expireAt" [ expireParam now ]
|
||||
lastPurge <- now
|
||||
}
|
||||
|
||||
/// Remove a cache entry
|
||||
let removeEntry key =
|
||||
Custom.nonQuery "DELETE FROM jjj.session WHERE id = @id" [ "@id", Sql.string key ]
|
||||
|
||||
/// Save an entry
|
||||
let saveEntry (opts : DistributedCacheEntryOptions) key payload = backgroundTask {
|
||||
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 1 hour sliding expiration
|
||||
let slide = Duration.FromHours 1
|
||||
now.Plus slide, Some slide, None
|
||||
do! Custom.nonQuery
|
||||
"INSERT INTO jjj.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 _.Get key = get key CancellationToken.None |> sync
|
||||
member _.GetAsync (key, token) = get key token
|
||||
member _.Refresh key = refresh key CancellationToken.None |> sync
|
||||
member _.RefreshAsync (key, token) = refresh key token
|
||||
member _.Remove key = remove key CancellationToken.None |> sync
|
||||
member _.RemoveAsync (key, token) = remove key token
|
||||
member _.Set (key, value, options) = set key value options CancellationToken.None |> sync
|
||||
member _.SetAsync (key, value, options, token) = set key value options token
|
|
@ -1,141 +0,0 @@
|
|||
module JobsJobsJobs.Common.Data
|
||||
|
||||
/// Constants for tables used by Jobs, Jobs, Jobs
|
||||
[<RequireQualifiedAccess>]
|
||||
module Table =
|
||||
|
||||
/// Citizens
|
||||
[<Literal>]
|
||||
let Citizen = "jjj.citizen"
|
||||
|
||||
/// Continents
|
||||
[<Literal>]
|
||||
let Continent = "jjj.continent"
|
||||
|
||||
/// Job Listings
|
||||
[<Literal>]
|
||||
let Listing = "jjj.listing"
|
||||
|
||||
/// Employment Profiles
|
||||
[<Literal>]
|
||||
let Profile = "jjj.profile"
|
||||
|
||||
/// User Security Information
|
||||
[<Literal>]
|
||||
let SecurityInfo = "jjj.security_info"
|
||||
|
||||
/// Success Stories
|
||||
[<Literal>]
|
||||
let Success = "jjj.success"
|
||||
|
||||
|
||||
open BitBadger.Npgsql.FSharp.Documents
|
||||
open Npgsql.FSharp
|
||||
|
||||
/// Connection management for the document store
|
||||
[<AutoOpen>]
|
||||
module DataConnection =
|
||||
|
||||
open System.Text.Json
|
||||
open BitBadger.Npgsql.Documents
|
||||
open JobsJobsJobs
|
||||
open Microsoft.Extensions.Configuration
|
||||
open Npgsql
|
||||
|
||||
/// Create tables
|
||||
let private createTables () = backgroundTask {
|
||||
do! Custom.nonQuery "CREATE SCHEMA IF NOT EXISTS jjj" []
|
||||
do! Definition.ensureTable Table.Citizen
|
||||
do! Definition.ensureTable Table.Continent
|
||||
do! Definition.ensureTable Table.Listing
|
||||
do! Definition.ensureTable Table.Success
|
||||
// Tables that use more than the default document configuration, key indexes, and text search index
|
||||
do! Custom.nonQuery
|
||||
$"CREATE TABLE IF NOT EXISTS {Table.Profile}
|
||||
(id TEXT NOT NULL PRIMARY KEY, data JSONB NOT NULL, text_search TSVECTOR NOT NULL,
|
||||
CONSTRAINT fk_profile_citizen FOREIGN KEY (id) REFERENCES {Table.Citizen} (id) ON DELETE CASCADE);
|
||||
CREATE TABLE IF NOT EXISTS {Table.SecurityInfo} (id TEXT NOT NULL PRIMARY KEY, data JSONB NOT NULL,
|
||||
CONSTRAINT fk_security_info_citizen
|
||||
FOREIGN KEY (id) REFERENCES {Table.Citizen} (id) ON DELETE CASCADE);
|
||||
CREATE UNIQUE INDEX IF NOT EXISTS uk_citizen_email ON {Table.Citizen} ((data -> 'email'));
|
||||
CREATE INDEX IF NOT EXISTS idx_listing_citizen ON {Table.Listing} ((data -> 'citizenId'));
|
||||
CREATE INDEX IF NOT EXISTS idx_listing_continent ON {Table.Listing} ((data -> 'continentId'));
|
||||
CREATE INDEX IF NOT EXISTS idx_profile_continent ON {Table.Profile} ((data -> 'continentId'));
|
||||
CREATE INDEX IF NOT EXISTS idx_success_citizen ON {Table.Success} ((data -> 'citizenId'));
|
||||
CREATE INDEX IF NOT EXISTS idx_profile_search ON {Table.Profile} USING GIN(text_search)"
|
||||
[]
|
||||
}
|
||||
|
||||
/// Create functions and triggers required to keep the search index current
|
||||
let private createTriggers () = backgroundTask {
|
||||
let! functions =
|
||||
Custom.list
|
||||
"SELECT p.proname
|
||||
FROM pg_catalog.pg_proc p
|
||||
LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace
|
||||
WHERE n.nspname = 'jjj'"
|
||||
[] (fun row -> row.string "proname")
|
||||
if not (functions |> List.contains "indexable_array_string") then
|
||||
do! Custom.nonQuery
|
||||
"""CREATE FUNCTION jjj.indexable_array_string(target jsonb, path jsonpath) RETURNS text AS $$
|
||||
BEGIN
|
||||
RETURN REPLACE(REPLACE(REPLACE(REPLACE(jsonb_path_query_array(target, path)::text,
|
||||
'["', ''), '", "', ' '), '"]', ''), '[]', '');
|
||||
END;
|
||||
$$ LANGUAGE plpgsql;""" []
|
||||
if not (functions |> List.contains "set_text_search") then
|
||||
do! Custom.nonQuery
|
||||
$"CREATE FUNCTION jjj.set_text_search() RETURNS trigger AS $$
|
||||
BEGIN
|
||||
NEW.text_search := to_tsvector('english',
|
||||
COALESCE(NEW.data ->> 'region', '') || ' '
|
||||
|| COALESCE(NEW.data ->> 'biography', '') || ' '
|
||||
|| COALESCE(NEW.data ->> 'experience', '') || ' '
|
||||
|| jjj.indexable_array_string(NEW.data, '$.skills[*].description') || ' '
|
||||
|| jjj.indexable_array_string(NEW.data, '$.history[*].employer') || ' '
|
||||
|| jjj.indexable_array_string(NEW.data, '$.history[*].position') || ' '
|
||||
|| jjj.indexable_array_string(NEW.data, '$.history[*].description'));
|
||||
RETURN NEW;
|
||||
END;
|
||||
$$ LANGUAGE plpgsql;
|
||||
CREATE TRIGGER set_text_search BEFORE INSERT OR UPDATE ON {Table.Profile}
|
||||
FOR EACH ROW EXECUTE FUNCTION jjj.set_text_search();" []
|
||||
}
|
||||
|
||||
/// Set up the data connection from the given configuration
|
||||
let setUp (cfg : IConfiguration) = backgroundTask {
|
||||
let builder = NpgsqlDataSourceBuilder (cfg.GetConnectionString "PostgreSQL")
|
||||
let _ = builder.UseNodaTime ()
|
||||
Configuration.useDataSource (builder.Build ())
|
||||
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)
|
||||
}
|
||||
do! createTables ()
|
||||
do! createTriggers ()
|
||||
}
|
||||
|
||||
|
||||
/// Create a match-anywhere clause for a LIKE or ILIKE clause
|
||||
let like value =
|
||||
Sql.string $"%%%s{value}%%"
|
||||
|
||||
/// Get the SQL for a search WHERE clause
|
||||
let searchSql criteria =
|
||||
let sql = criteria |> List.map fst |> String.concat " AND "
|
||||
if sql = "" then "" else $"AND {sql}"
|
||||
|
||||
/// Continent data access functions
|
||||
[<RequireQualifiedAccess>]
|
||||
module Continents =
|
||||
|
||||
open JobsJobsJobs.Domain
|
||||
|
||||
/// Retrieve all continents
|
||||
let all () =
|
||||
Custom.list $"{Query.selectFromTable Table.Continent} ORDER BY data ->> 'name'" [] fromData<Continent>
|
||||
|
||||
/// Retrieve a continent by its ID
|
||||
let findById continentId =
|
||||
Find.byId<Continent> Table.Continent (ContinentId.toString continentId)
|
|
@ -1,484 +0,0 @@
|
|||
namespace JobsJobsJobs.Domain
|
||||
|
||||
open System
|
||||
open Giraffe
|
||||
open NodaTime
|
||||
|
||||
// ~~~ SUPPORT TYPES ~~~ //
|
||||
|
||||
/// The ID of a user (a citizen of Gitmo Nation)
|
||||
type CitizenId = CitizenId of Guid
|
||||
|
||||
/// Support functions for citizen IDs
|
||||
module CitizenId =
|
||||
|
||||
/// Create a new citizen ID
|
||||
let create () = (Guid.NewGuid >> CitizenId) ()
|
||||
|
||||
/// A string representation of a citizen ID
|
||||
let toString = function CitizenId it -> ShortGuid.fromGuid it
|
||||
|
||||
/// Parse a string into a citizen ID
|
||||
let ofString = ShortGuid.toGuid >> CitizenId
|
||||
|
||||
/// Get the GUID value of a citizen ID
|
||||
let value = function CitizenId guid -> guid
|
||||
|
||||
|
||||
/// Types of contacts supported by Jobs, Jobs, Jobs
|
||||
type ContactType =
|
||||
/// E-mail addresses
|
||||
| Email
|
||||
/// Phone numbers (home, work, cell, etc.)
|
||||
| Phone
|
||||
/// Websites (personal, social, etc.)
|
||||
| Website
|
||||
|
||||
/// Functions to support contact types
|
||||
module ContactType =
|
||||
|
||||
/// Parse a contact type from a string
|
||||
let parse typ =
|
||||
match typ with
|
||||
| "Email" -> Email
|
||||
| "Phone" -> Phone
|
||||
| "Website" -> Website
|
||||
| it -> invalidOp $"{it} is not a valid contact type"
|
||||
|
||||
/// Convert a contact type to its string representation
|
||||
let toString =
|
||||
function
|
||||
| Email -> "Email"
|
||||
| Phone -> "Phone"
|
||||
| Website -> "Website"
|
||||
|
||||
|
||||
/// The ID of a continent
|
||||
type ContinentId = ContinentId of Guid
|
||||
|
||||
/// Support functions for continent IDs
|
||||
module ContinentId =
|
||||
|
||||
/// Create a new continent ID
|
||||
let create () = (Guid.NewGuid >> ContinentId) ()
|
||||
|
||||
/// A string representation of a continent ID
|
||||
let toString = function ContinentId it -> ShortGuid.fromGuid it
|
||||
|
||||
/// Parse a string into a continent ID
|
||||
let ofString = ShortGuid.toGuid >> ContinentId
|
||||
|
||||
/// Get the GUID value of a continent ID
|
||||
let value = function ContinentId guid -> guid
|
||||
|
||||
|
||||
/// A string of Markdown text
|
||||
type MarkdownString = Text of string
|
||||
|
||||
/// Support functions for Markdown strings
|
||||
module MarkdownString =
|
||||
|
||||
open Markdig
|
||||
|
||||
/// The Markdown conversion pipeline (enables all advanced features)
|
||||
let private pipeline = MarkdownPipelineBuilder().UseAdvancedExtensions().Build ()
|
||||
|
||||
/// Convert this Markdown string to HTML
|
||||
let toHtml = function Text text -> Markdown.ToHtml (text, pipeline)
|
||||
|
||||
/// Convert a Markdown string to its string representation
|
||||
let toString = function Text text -> text
|
||||
|
||||
|
||||
/// An employment history entry
|
||||
[<NoComparison; NoEquality>]
|
||||
type EmploymentHistory =
|
||||
{ /// The employer for this period of employment
|
||||
Employer : string
|
||||
|
||||
/// The date employment started
|
||||
StartDate : LocalDate
|
||||
|
||||
/// The date employment ended (None implies ongoing employment)
|
||||
EndDate : LocalDate option
|
||||
|
||||
/// The title / position held
|
||||
Position : string option
|
||||
|
||||
/// A description of the duties entailed during this employment
|
||||
Description : MarkdownString option
|
||||
}
|
||||
|
||||
/// Support functions for employment history entries
|
||||
module EmploymentHistory =
|
||||
|
||||
let empty =
|
||||
{ Employer = ""
|
||||
StartDate = LocalDate.FromDateTime DateTime.Today
|
||||
EndDate = None
|
||||
Position = None
|
||||
Description = None
|
||||
}
|
||||
|
||||
|
||||
/// The ID of a job listing
|
||||
type ListingId = ListingId of Guid
|
||||
|
||||
/// Support functions for listing IDs
|
||||
module ListingId =
|
||||
|
||||
/// Create a new job listing ID
|
||||
let create () = (Guid.NewGuid >> ListingId) ()
|
||||
|
||||
/// A string representation of a listing ID
|
||||
let toString = function ListingId it -> ShortGuid.fromGuid it
|
||||
|
||||
/// Parse a string into a listing ID
|
||||
let ofString = ShortGuid.toGuid >> ListingId
|
||||
|
||||
/// Get the GUID value of a listing ID
|
||||
let value = function ListingId guid -> guid
|
||||
|
||||
|
||||
/// Another way to contact a citizen from this site
|
||||
[<NoComparison; NoEquality>]
|
||||
type OtherContact =
|
||||
{ /// The type of contact
|
||||
ContactType : ContactType
|
||||
|
||||
/// The name of the contact (Email, Mastodon, LinkedIn, etc.)
|
||||
Name : string option
|
||||
|
||||
/// The value for the contact (e-mail address, user name, URL, etc.)
|
||||
Value : string
|
||||
|
||||
/// Whether this contact is visible in public employment profiles and job listings
|
||||
IsPublic : bool
|
||||
}
|
||||
|
||||
|
||||
/// Visibility options for an employment profile
|
||||
type ProfileVisibility =
|
||||
/// Profile is only visible to the citizen to whom it belongs
|
||||
| Hidden
|
||||
/// Profile is only visible to authenticated users
|
||||
| Private
|
||||
/// Anonymous information is visible to public users
|
||||
| Anonymous
|
||||
/// The full employment profile is visible to public users
|
||||
| Public
|
||||
|
||||
/// Support functions for profile visibility
|
||||
module ProfileVisibility =
|
||||
|
||||
/// Parse a string into a profile visibility
|
||||
let parse viz =
|
||||
match viz with
|
||||
| "Hidden" -> Hidden
|
||||
| "Private" -> Private
|
||||
| "Anonymous" -> Anonymous
|
||||
| "Public" -> Public
|
||||
| it -> invalidOp $"{it} is not a valid profile visibility value"
|
||||
|
||||
/// Convert a profile visibility to its string representation
|
||||
let toString =
|
||||
function
|
||||
| Hidden -> "Hidden"
|
||||
| Private -> "Private"
|
||||
| Anonymous -> "Anonymous"
|
||||
| Public -> "Public"
|
||||
|
||||
|
||||
/// A skill the job seeker possesses
|
||||
[<NoComparison; NoEquality>]
|
||||
type Skill =
|
||||
{ /// A description of the skill
|
||||
Description : string
|
||||
|
||||
/// Notes regarding this skill (level, duration, etc.)
|
||||
Notes : string option
|
||||
}
|
||||
|
||||
|
||||
/// The ID of a success report
|
||||
type SuccessId = SuccessId of Guid
|
||||
|
||||
/// Support functions for success report IDs
|
||||
module SuccessId =
|
||||
|
||||
/// Create a new success report ID
|
||||
let create () = (Guid.NewGuid >> SuccessId) ()
|
||||
|
||||
/// A string representation of a success report ID
|
||||
let toString = function SuccessId it -> ShortGuid.fromGuid it
|
||||
|
||||
/// Parse a string into a success report ID
|
||||
let ofString = ShortGuid.toGuid >> SuccessId
|
||||
|
||||
/// Get the GUID value of a success ID
|
||||
let value = function SuccessId guid -> guid
|
||||
|
||||
// ~~~ DOCUMENT TYPES ~~~ //
|
||||
|
||||
/// A user of Jobs, Jobs, Jobs; a citizen of Gitmo Nation
|
||||
[<NoComparison; NoEquality>]
|
||||
type Citizen =
|
||||
{ /// The ID of the user
|
||||
Id : CitizenId
|
||||
|
||||
/// When the user joined Jobs, Jobs, Jobs
|
||||
JoinedOn : Instant
|
||||
|
||||
/// When the user last logged in
|
||||
LastSeenOn : Instant
|
||||
|
||||
/// The user's e-mail address
|
||||
Email : string
|
||||
|
||||
/// The user's first name
|
||||
FirstName : string
|
||||
|
||||
/// The user's last name
|
||||
LastName : string
|
||||
|
||||
/// The hash of the user's password
|
||||
PasswordHash : string
|
||||
|
||||
/// The name displayed for this user throughout the site
|
||||
DisplayName : string option
|
||||
|
||||
/// The other contacts for this user
|
||||
OtherContacts : OtherContact list
|
||||
}
|
||||
|
||||
/// Support functions for citizens
|
||||
module Citizen =
|
||||
|
||||
/// An empty citizen
|
||||
let empty = {
|
||||
Id = CitizenId Guid.Empty
|
||||
JoinedOn = Instant.MinValue
|
||||
LastSeenOn = Instant.MinValue
|
||||
Email = ""
|
||||
FirstName = ""
|
||||
LastName = ""
|
||||
PasswordHash = ""
|
||||
DisplayName = None
|
||||
OtherContacts = []
|
||||
}
|
||||
|
||||
/// Get the name of the citizen (either their preferred display name or first/last names)
|
||||
let name x =
|
||||
match x.DisplayName with Some it -> it | None -> $"{x.FirstName} {x.LastName}"
|
||||
|
||||
|
||||
/// A continent
|
||||
[<NoComparison; NoEquality>]
|
||||
type Continent =
|
||||
{ /// The ID of the continent
|
||||
Id : ContinentId
|
||||
|
||||
/// The name of the continent
|
||||
Name : string
|
||||
}
|
||||
|
||||
/// Support functions for continents
|
||||
module Continent =
|
||||
|
||||
/// An empty continent
|
||||
let empty ={
|
||||
Id = ContinentId Guid.Empty
|
||||
Name = ""
|
||||
}
|
||||
|
||||
|
||||
/// A job listing
|
||||
[<NoComparison; NoEquality>]
|
||||
type Listing =
|
||||
{ /// The ID of the job listing
|
||||
Id : ListingId
|
||||
|
||||
/// The ID of the citizen who posted the job listing
|
||||
CitizenId : CitizenId
|
||||
|
||||
/// When this job listing was created
|
||||
CreatedOn : Instant
|
||||
|
||||
/// The short title of the job listing
|
||||
Title : string
|
||||
|
||||
/// The ID of the continent on which the job is located
|
||||
ContinentId : ContinentId
|
||||
|
||||
/// The region in which the job is located
|
||||
Region : string
|
||||
|
||||
/// Whether this listing is for remote work
|
||||
IsRemote : bool
|
||||
|
||||
/// Whether this listing has expired
|
||||
IsExpired : bool
|
||||
|
||||
/// When this listing was last updated
|
||||
UpdatedOn : Instant
|
||||
|
||||
/// The details of this job
|
||||
Text : MarkdownString
|
||||
|
||||
/// When this job needs to be filled
|
||||
NeededBy : LocalDate option
|
||||
|
||||
/// Was this job filled as part of its appearance on Jobs, Jobs, Jobs?
|
||||
WasFilledHere : bool option
|
||||
}
|
||||
|
||||
/// Support functions for job listings
|
||||
module Listing =
|
||||
|
||||
/// An empty job listing
|
||||
let empty = {
|
||||
Id = ListingId Guid.Empty
|
||||
CitizenId = CitizenId Guid.Empty
|
||||
CreatedOn = Instant.MinValue
|
||||
Title = ""
|
||||
ContinentId = ContinentId Guid.Empty
|
||||
Region = ""
|
||||
IsRemote = false
|
||||
IsExpired = false
|
||||
UpdatedOn = Instant.MinValue
|
||||
Text = Text ""
|
||||
NeededBy = None
|
||||
WasFilledHere = None
|
||||
}
|
||||
|
||||
|
||||
/// Security settings for a user
|
||||
[<NoComparison; NoEquality>]
|
||||
type SecurityInfo =
|
||||
{ /// The ID of the citizen to whom these settings apply
|
||||
Id : CitizenId
|
||||
|
||||
/// The number of failed log on attempts (reset to 0 on successful log on)
|
||||
FailedLogOnAttempts : int
|
||||
|
||||
/// Whether the account is locked
|
||||
AccountLocked : bool
|
||||
|
||||
/// The token the user must provide to take their desired action
|
||||
Token : string option
|
||||
|
||||
/// The action to which the token applies
|
||||
TokenUsage : string option
|
||||
|
||||
/// When the token expires
|
||||
TokenExpires : Instant option
|
||||
}
|
||||
|
||||
/// Functions to support security info
|
||||
module SecurityInfo =
|
||||
|
||||
/// An empty set of security info
|
||||
let empty = {
|
||||
Id = CitizenId Guid.Empty
|
||||
FailedLogOnAttempts = 0
|
||||
AccountLocked = false
|
||||
Token = None
|
||||
TokenUsage = None
|
||||
TokenExpires = None
|
||||
}
|
||||
|
||||
|
||||
/// A job seeker profile
|
||||
[<NoComparison; NoEquality>]
|
||||
type Profile =
|
||||
{ /// The ID of the citizen to whom this profile belongs
|
||||
Id : CitizenId
|
||||
|
||||
/// The ID of the continent on which the citizen resides
|
||||
ContinentId : ContinentId
|
||||
|
||||
/// The region in which the citizen resides
|
||||
Region : string
|
||||
|
||||
/// Whether this citizen is actively seeking employment
|
||||
IsSeekingEmployment : bool
|
||||
|
||||
/// Whether the citizen is interested in remote work
|
||||
IsRemote : bool
|
||||
|
||||
/// Whether the citizen is interested in full-time work
|
||||
IsFullTime : bool
|
||||
|
||||
/// The citizen's professional biography
|
||||
Biography : MarkdownString
|
||||
|
||||
/// Skills this citizen possesses
|
||||
Skills : Skill list
|
||||
|
||||
/// The citizen's employment history
|
||||
History : EmploymentHistory list
|
||||
|
||||
/// The citizen's experience (topical / chronological)
|
||||
Experience : MarkdownString option
|
||||
|
||||
/// The visibility of this profile
|
||||
Visibility : ProfileVisibility
|
||||
|
||||
/// When the citizen last updated their profile
|
||||
LastUpdatedOn : Instant
|
||||
}
|
||||
|
||||
/// Support functions for Profiles
|
||||
module Profile =
|
||||
|
||||
// An empty profile
|
||||
let empty = {
|
||||
Id = CitizenId Guid.Empty
|
||||
ContinentId = ContinentId Guid.Empty
|
||||
Region = ""
|
||||
IsSeekingEmployment = false
|
||||
IsRemote = false
|
||||
IsFullTime = false
|
||||
Biography = Text ""
|
||||
Skills = []
|
||||
History = []
|
||||
Experience = None
|
||||
Visibility = Private
|
||||
LastUpdatedOn = Instant.MinValue
|
||||
}
|
||||
|
||||
|
||||
/// A record of success finding employment
|
||||
[<NoComparison; NoEquality>]
|
||||
type Success =
|
||||
{ /// The ID of the success report
|
||||
Id : SuccessId
|
||||
|
||||
/// The ID of the citizen who wrote this success report
|
||||
CitizenId : CitizenId
|
||||
|
||||
/// When this success report was recorded
|
||||
RecordedOn : Instant
|
||||
|
||||
/// Whether the success was due, at least in part, to Jobs, Jobs, Jobs
|
||||
IsFromHere : bool
|
||||
|
||||
/// The source of this success (listing or profile)
|
||||
Source : string
|
||||
|
||||
/// The success story
|
||||
Story : MarkdownString option
|
||||
}
|
||||
|
||||
/// Support functions for success stories
|
||||
module Success =
|
||||
|
||||
/// An empty success story
|
||||
let empty = {
|
||||
Id = SuccessId Guid.Empty
|
||||
CitizenId = CitizenId Guid.Empty
|
||||
RecordedOn = Instant.MinValue
|
||||
IsFromHere = false
|
||||
Source = ""
|
||||
Story = None
|
||||
}
|
|
@ -1,123 +0,0 @@
|
|||
module JobsJobsJobs.Email
|
||||
|
||||
open System.Net
|
||||
open JobsJobsJobs.Domain
|
||||
open MailKit.Net.Smtp
|
||||
open MimeKit
|
||||
|
||||
/// Options to use when sending e-mail
|
||||
type EmailOptions() =
|
||||
/// The hostname of the SMTP server
|
||||
member val SmtpHost : string = "localhost" with get, set
|
||||
|
||||
/// The port over which SMTP communication should occur
|
||||
member val Port : int = 25 with get, set
|
||||
|
||||
/// Whether to use SSL when communicating with the SMTP server
|
||||
member val UseSsl : bool = false with get, set
|
||||
|
||||
/// The authentication to use with the SMTP server
|
||||
member val Authentication : string = "" with get, set
|
||||
|
||||
/// The e-mail address from which messages should be sent
|
||||
member val FromAddress : string = "nobody@noagendacareers.com" with get, set
|
||||
|
||||
/// The name from which messages should be sent
|
||||
member val FromName : string = "Jobs, Jobs, Jobs" with get, set
|
||||
|
||||
|
||||
/// The options for the SMTP server
|
||||
let mutable options = EmailOptions ()
|
||||
|
||||
/// Private functions for sending e-mail
|
||||
[<AutoOpen>]
|
||||
module private Helpers =
|
||||
|
||||
/// Create an SMTP client
|
||||
let createClient () = backgroundTask {
|
||||
let client = new SmtpClient ()
|
||||
do! client.ConnectAsync (options.SmtpHost, options.Port, options.UseSsl)
|
||||
do! client.AuthenticateAsync (options.FromAddress, options.Authentication)
|
||||
return client
|
||||
}
|
||||
|
||||
/// Create a message with to, from, and subject completed
|
||||
let createMessage citizen subject =
|
||||
let msg = new MimeMessage ()
|
||||
msg.From.Add (MailboxAddress ("Jobs, Jobs, Jobs", "daniel@bitbadger.solutions"))
|
||||
msg.To.Add (MailboxAddress (Citizen.name citizen, citizen.Email))
|
||||
msg.Subject <- subject
|
||||
msg
|
||||
|
||||
/// Send a message
|
||||
let sendMessage msg = backgroundTask {
|
||||
use! client = createClient ()
|
||||
let! result = client.SendAsync msg
|
||||
do! client.DisconnectAsync true
|
||||
return result
|
||||
}
|
||||
|
||||
/// Send an account confirmation e-mail
|
||||
let sendAccountConfirmation citizen security = backgroundTask {
|
||||
let token = WebUtility.UrlEncode security.Token.Value
|
||||
use msg = createMessage citizen "Account Confirmation Request"
|
||||
|
||||
let text =
|
||||
[ $"ITM, {Citizen.name citizen}!"
|
||||
""
|
||||
"This e-mail address was recently used to establish an account on"
|
||||
"Jobs, Jobs, Jobs (noagendacareers.com). Before this account can be"
|
||||
"used, it needs to be verified. Please click the link below to do so;"
|
||||
"it will work for the next 72 hours (3 days)."
|
||||
""
|
||||
$"https://noagendacareers.com/citizen/confirm/{token}"
|
||||
""
|
||||
"If you did not take this action, you can do nothing, and the account"
|
||||
"will be deleted at the end of that time. If you wish to delete it"
|
||||
"immediately, use the link below (also valid for 72 hours)."
|
||||
""
|
||||
$"https://noagendacareers.com/citizen/deny/{token}"
|
||||
""
|
||||
"TYFYC!"
|
||||
""
|
||||
"--"
|
||||
"Jobs, Jobs, Jobs"
|
||||
"https://noagendacareers.com"
|
||||
] |> String.concat "\n"
|
||||
use msgText = new TextPart (Text = text)
|
||||
msg.Body <- msgText
|
||||
|
||||
return! sendMessage msg
|
||||
}
|
||||
|
||||
/// Send a password reset link
|
||||
let sendPasswordReset citizen security = backgroundTask {
|
||||
let token = WebUtility.UrlEncode security.Token.Value
|
||||
use msg = createMessage citizen "Reset Password for Jobs, Jobs, Jobs"
|
||||
|
||||
let text =
|
||||
[ $"ITM, {Citizen.name citizen}!"
|
||||
""
|
||||
"We recently receive a request to reset the password for your account"
|
||||
"on Jobs, Jobs, Jobs (noagendacareers.com). Use the link below to"
|
||||
"do so; it will work for the next 72 hours (3 days)."
|
||||
""
|
||||
$"https://noagendacareers.com/citizen/reset-password/{token}"
|
||||
""
|
||||
"If you did not take this action, you can do nothing, and the link"
|
||||
"will expire normally. If you wish to expire the token immediately,"
|
||||
"use the link below (also valid for 72 hours)."
|
||||
""
|
||||
$"https://noagendacareers.com/citizen/cancel-reset/{token}"
|
||||
""
|
||||
"TYFYC!"
|
||||
""
|
||||
"--"
|
||||
"Jobs, Jobs, Jobs"
|
||||
"https://noagendacareers.com"
|
||||
] |> String.concat "\n"
|
||||
use msgText = new TextPart (Text = text)
|
||||
msg.Body <- msgText
|
||||
|
||||
return! sendMessage msg
|
||||
}
|
|
@ -1,206 +0,0 @@
|
|||
/// Common helper functions for views
|
||||
module JobsJobsJobs.Common.Handlers
|
||||
|
||||
open Giraffe
|
||||
open Giraffe.Htmx
|
||||
open Microsoft.AspNetCore.Http
|
||||
open Microsoft.Extensions.Logging
|
||||
|
||||
[<AutoOpen>]
|
||||
module HtmxHelpers =
|
||||
|
||||
/// Is the request from htmx?
|
||||
let isHtmx (ctx : HttpContext) =
|
||||
ctx.Request.IsHtmx && not ctx.Request.IsHtmxRefresh
|
||||
|
||||
|
||||
/// Handlers for error conditions
|
||||
module Error =
|
||||
|
||||
open System.Net
|
||||
|
||||
/// Handler that will return a status code 404 and the text "Not Found"
|
||||
let notFound : HttpHandler = fun _ ctx ->
|
||||
let fac = ctx.GetService<ILoggerFactory> ()
|
||||
let log = fac.CreateLogger "Handler"
|
||||
let path = string ctx.Request.Path
|
||||
log.LogInformation "Returning 404"
|
||||
RequestErrors.NOT_FOUND $"The URL {path} was not recognized as a valid URL" earlyReturn ctx
|
||||
|
||||
|
||||
/// Handle unauthorized actions, redirecting to log on for GETs, otherwise returning a 401 Not Authorized response
|
||||
let notAuthorized : HttpHandler = fun next ctx ->
|
||||
if ctx.Request.Method = "GET" then
|
||||
let redirectUrl = $"/citizen/log-on?returnUrl={WebUtility.UrlEncode ctx.Request.Path}"
|
||||
if isHtmx ctx then (withHxRedirect redirectUrl >=> redirectTo false redirectUrl) next ctx
|
||||
else redirectTo false redirectUrl next ctx
|
||||
else
|
||||
if isHtmx ctx then
|
||||
(setHttpHeader "X-Toast" $"error|||You are not authorized to access the URL {ctx.Request.Path.Value}"
|
||||
>=> setStatusCode 401) earlyReturn ctx
|
||||
else setStatusCode 401 earlyReturn ctx
|
||||
|
||||
/// Handler to log 500s and return a message we can display in the application
|
||||
let unexpectedError (ex: exn) (log : ILogger) =
|
||||
log.LogError(ex, "An unexpected error occurred")
|
||||
clearResponse >=> ServerErrors.INTERNAL_ERROR ex.Message
|
||||
|
||||
|
||||
open System
|
||||
open System.Security.Claims
|
||||
open System.Text.Json
|
||||
open System.Text.RegularExpressions
|
||||
open JobsJobsJobs.Domain
|
||||
open Microsoft.AspNetCore.Antiforgery
|
||||
open Microsoft.Extensions.Configuration
|
||||
open Microsoft.Extensions.DependencyInjection
|
||||
open NodaTime
|
||||
|
||||
/// Get the NodaTime clock from the request context
|
||||
let now (ctx : HttpContext) = ctx.GetService<IClock>().GetCurrentInstant ()
|
||||
|
||||
/// Get the application configuration from the request context
|
||||
let config (ctx : HttpContext) = ctx.GetService<IConfiguration> ()
|
||||
|
||||
/// Get the logger factory from the request context
|
||||
let logger (ctx : HttpContext) = ctx.GetService<ILoggerFactory> ()
|
||||
|
||||
/// `None` if a `string option` is `None`, whitespace, or empty
|
||||
let noneIfBlank (s : string option) =
|
||||
s |> Option.map (fun x -> match x.Trim () with "" -> None | _ -> Some x) |> Option.flatten
|
||||
|
||||
/// `None` if a `string` is null, empty, or whitespace; otherwise, `Some` and the trimmed string
|
||||
let noneIfEmpty = Option.ofObj >> noneIfBlank
|
||||
|
||||
/// Try to get the current user
|
||||
let tryUser (ctx : HttpContext) =
|
||||
ctx.User.FindFirst ClaimTypes.NameIdentifier
|
||||
|> Option.ofObj
|
||||
|> Option.map (fun x -> x.Value)
|
||||
|
||||
/// Get the ID of the currently logged in citizen
|
||||
// NOTE: if no one is logged in, this will raise an exception
|
||||
let currentCitizenId ctx = (tryUser >> Option.get >> CitizenId.ofString) ctx
|
||||
|
||||
let antiForgerySvc (ctx : HttpContext) =
|
||||
ctx.RequestServices.GetRequiredService<IAntiforgery> ()
|
||||
|
||||
/// Obtain an anti-forgery token set
|
||||
let csrf ctx =
|
||||
(antiForgerySvc ctx).GetAndStoreTokens ctx
|
||||
|
||||
/// Get the time zone from the citizen's browser
|
||||
let timeZone (ctx : HttpContext) =
|
||||
let tz = string ctx.Request.Headers["X-Time-Zone"]
|
||||
defaultArg (noneIfEmpty tz) "Etc/UTC"
|
||||
|
||||
/// The key to use to indicate if we have loaded the session
|
||||
let private sessionLoadedKey = "session-loaded"
|
||||
|
||||
/// Load the session if we have not yet
|
||||
let private loadSession (ctx : HttpContext) = task {
|
||||
if not (ctx.Items.ContainsKey sessionLoadedKey) then
|
||||
do! ctx.Session.LoadAsync ()
|
||||
ctx.Items.Add (sessionLoadedKey, "yes")
|
||||
}
|
||||
|
||||
/// Save the session if we have loaded it
|
||||
let private saveSession (ctx : HttpContext) = task {
|
||||
if ctx.Items.ContainsKey sessionLoadedKey then do! ctx.Session.CommitAsync ()
|
||||
}
|
||||
|
||||
/// Get the messages from the session (destructively)
|
||||
let popMessages ctx = task {
|
||||
do! loadSession ctx
|
||||
let msgs =
|
||||
match ctx.Session.GetString "messages" with
|
||||
| null -> []
|
||||
| m -> JsonSerializer.Deserialize<string list> m
|
||||
if not (List.isEmpty msgs) then ctx.Session.Remove "messages"
|
||||
return List.rev msgs
|
||||
}
|
||||
|
||||
/// Add a message to the response
|
||||
let addMessage (level : string) (msg : string) ctx = task {
|
||||
do! loadSession ctx
|
||||
let! msgs = popMessages ctx
|
||||
ctx.Session.SetString ("messages", JsonSerializer.Serialize ($"{level}|||{msg}" :: msgs))
|
||||
}
|
||||
|
||||
/// Add a success message to the response
|
||||
let addSuccess msg ctx = task {
|
||||
do! addMessage "success" msg ctx
|
||||
}
|
||||
|
||||
/// Add an error message to the response
|
||||
let addError msg ctx = task {
|
||||
do! addMessage "error" msg ctx
|
||||
}
|
||||
|
||||
/// Add a list of errors to the response
|
||||
let addErrors (errors : string list) ctx = task {
|
||||
let errMsg = String.Join ("</li><li>", errors)
|
||||
do! addError $"Please correct the following errors:<ul><li>{errMsg}</li></ul>" ctx
|
||||
}
|
||||
|
||||
open JobsJobsJobs.Common.Views
|
||||
|
||||
/// Create the render context for an HTML response
|
||||
let private createContext (ctx : HttpContext) pageTitle content messages : Layout.PageRenderContext =
|
||||
{ IsLoggedOn = Option.isSome (tryUser ctx)
|
||||
CurrentUrl = ctx.Request.Path.Value
|
||||
PageTitle = pageTitle
|
||||
Content = content
|
||||
Messages = messages
|
||||
}
|
||||
|
||||
/// Render a page-level view
|
||||
let render pageTitle (_ : HttpFunc) (ctx : HttpContext) content = task {
|
||||
let! messages = popMessages ctx
|
||||
let renderCtx = createContext ctx pageTitle content messages
|
||||
let renderFunc = if isHtmx ctx then Layout.partial else Layout.full
|
||||
return! ctx.WriteHtmlViewAsync (renderFunc renderCtx)
|
||||
}
|
||||
|
||||
/// Render a printable view (content with styles, but no layout)
|
||||
let renderPrint pageTitle (_ : HttpFunc) (ctx : HttpContext) content =
|
||||
createContext ctx pageTitle content []
|
||||
|> Layout.print
|
||||
|> ctx.WriteHtmlViewAsync
|
||||
|
||||
/// Render a bare (component) view
|
||||
let renderBare (_ : HttpFunc) (ctx : HttpContext) content =
|
||||
createContext ctx "" content []
|
||||
|> Layout.bare
|
||||
|> ctx.WriteHtmlViewAsync
|
||||
|
||||
/// Render as a composable HttpHandler
|
||||
let renderHandler pageTitle content : HttpHandler = fun next ctx ->
|
||||
render pageTitle next ctx content
|
||||
|
||||
/// Validate the anti cross-site request forgery token in the current request
|
||||
let validateCsrf : HttpHandler = fun next ctx -> task {
|
||||
match! (antiForgerySvc ctx).IsRequestValidAsync ctx with
|
||||
| true -> return! next ctx
|
||||
| false -> return! RequestErrors.BAD_REQUEST "CSRF token invalid" earlyReturn ctx
|
||||
}
|
||||
|
||||
/// Require a user to be logged on for a route
|
||||
let requireUser : HttpHandler = requiresAuthentication Error.notAuthorized
|
||||
|
||||
/// Regular expression to validate that a URL is a local URL
|
||||
let isLocal = Regex """^/[^\/\\].*"""
|
||||
|
||||
/// Redirect to another page, saving the session before redirecting
|
||||
let redirectToGet (url : string) next ctx = task {
|
||||
do! saveSession ctx
|
||||
let action =
|
||||
if Option.isSome (noneIfEmpty url) && (url = "/" || isLocal.IsMatch url) then
|
||||
if isHtmx ctx then withHxRedirect url else redirectTo false url
|
||||
else RequestErrors.BAD_REQUEST "Invalid redirect URL"
|
||||
return! action next ctx
|
||||
}
|
||||
|
||||
/// Shorthand for Error.notFound for use in handler functions
|
||||
let notFound ctx =
|
||||
Error.notFound earlyReturn ctx
|
|
@ -1,33 +0,0 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net7.0</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Include="Domain.fs" />
|
||||
<Compile Include="Email.fs" />
|
||||
<Compile Include="Json.fs" />
|
||||
<Compile Include="Data.fs" />
|
||||
<Compile Include="Views.fs" />
|
||||
<Compile Include="Handlers.fs" />
|
||||
<Compile Include="Cache.fs" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="BitBadger.Npgsql.FSharp.Documents" Version="1.0.0-beta3" />
|
||||
<PackageReference Include="FSharp.SystemTextJson" Version="1.3.13" />
|
||||
<PackageReference Include="Giraffe" Version="6.4.0" />
|
||||
<PackageReference Include="Giraffe.Htmx" Version="2.0.0" />
|
||||
<PackageReference Include="Giraffe.ViewEngine" Version="1.4.0" />
|
||||
<PackageReference Include="Giraffe.ViewEngine.Htmx" Version="2.0.0" />
|
||||
<PackageReference Include="MailKit" Version="4.6.0" />
|
||||
<PackageReference Include="Markdig" Version="0.37.0" />
|
||||
<PackageReference Include="NodaTime.Serialization.JsonNet" Version="3.1.0" />
|
||||
<PackageReference Include="NodaTime.Serialization.SystemTextJson" Version="1.2.0" />
|
||||
<PackageReference Include="Npgsql.FSharp" Version="5.7.0" />
|
||||
<PackageReference Include="Npgsql.NodaTime" Version="8.0.3" />
|
||||
<PackageReference Update="FSharp.Core" Version="8.0.300" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
|
@ -1,34 +0,0 @@
|
|||
/// JSON serializer options
|
||||
module JobsJobsJobs.Json
|
||||
|
||||
open System.Text.Json
|
||||
open System.Text.Json.Serialization
|
||||
open JobsJobsJobs.Domain
|
||||
|
||||
/// 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 NodaTime
|
||||
open NodaTime.Serialization.SystemTextJson
|
||||
|
||||
/// JsonSerializer options that use the custom converters
|
||||
let options =
|
||||
let opts = JsonSerializerOptions ()
|
||||
[ WrappedJsonConverter (CitizenId.ofString, CitizenId.toString) :> JsonConverter
|
||||
WrappedJsonConverter (ContactType.parse, ContactType.toString)
|
||||
WrappedJsonConverter (ContinentId.ofString, ContinentId.toString)
|
||||
WrappedJsonConverter (ListingId.ofString, ListingId.toString)
|
||||
WrappedJsonConverter (Text, MarkdownString.toString)
|
||||
WrappedJsonConverter (ProfileVisibility.parse, ProfileVisibility.toString)
|
||||
WrappedJsonConverter (SuccessId.ofString, SuccessId.toString)
|
||||
JsonFSharpConverter ()
|
||||
]
|
||||
|> List.iter opts.Converters.Add
|
||||
let _ = opts.ConfigureForNodaTime DateTimeZoneProviders.Tzdb
|
||||
opts.PropertyNamingPolicy <- JsonNamingPolicy.CamelCase
|
||||
opts
|
|
@ -1,393 +0,0 @@
|
|||
/// Common functions for views
|
||||
module JobsJobsJobs.Common.Views
|
||||
|
||||
open Giraffe.ViewEngine
|
||||
open Giraffe.ViewEngine.Accessibility
|
||||
open Microsoft.AspNetCore.Antiforgery
|
||||
open JobsJobsJobs.Domain
|
||||
|
||||
/// Create an audio clip with the specified text node
|
||||
let audioClip clip text =
|
||||
span [ _class "jjj-audio-clip"; _onclick "jjj.playFile(this)" ] [
|
||||
text; audio [ _id clip ] [ source [ _src $"/audio/{clip}.mp3" ] ]
|
||||
]
|
||||
|
||||
/// Create an anti-forgery hidden input
|
||||
let antiForgery (csrf : AntiforgeryTokenSet) =
|
||||
input [ _type "hidden"; _name csrf.FormFieldName; _value csrf.RequestToken ]
|
||||
|
||||
/// Alias for rawText
|
||||
let txt = rawText
|
||||
|
||||
/// Create a page with a title displayed on the page
|
||||
let pageWithTitle title content =
|
||||
article [] [
|
||||
h3 [ _class "pb-3" ] [ txt title ]
|
||||
yield! content
|
||||
]
|
||||
|
||||
/// Create a floating-label text input box
|
||||
let textBox attrs name value fieldLabel isRequired =
|
||||
div [ _class "form-floating" ] [
|
||||
List.append attrs [
|
||||
_id name; _name name; _class "form-control"; _placeholder fieldLabel; _value value
|
||||
if isRequired then _required
|
||||
] |> input
|
||||
label [ _class (if isRequired then "jjj-required" else "jjj-label"); _for name ] [ txt fieldLabel ]
|
||||
]
|
||||
|
||||
/// Create a checkbox that will post "true" if checked
|
||||
let checkBox attrs name isChecked checkLabel =
|
||||
div [ _class "form-check" ] [
|
||||
List.append attrs
|
||||
[ _type "checkbox"; _id name; _name name; _class "form-check-input"; _value "true"
|
||||
if isChecked then _checked ]
|
||||
|> input
|
||||
label [ _class "form-check-label"; _for name ] [ txt checkLabel ]
|
||||
]
|
||||
|
||||
/// Create a select list of continents
|
||||
let continentList attrs name (continents : Continent list) emptyLabel selectedValue isRequired =
|
||||
div [ _class "form-floating" ] [
|
||||
select (List.append attrs [ _id name; _name name; _class "form-select"; if isRequired then _required ]) (
|
||||
option [ _value ""; if selectedValue = "" then _selected ] [
|
||||
rawText $"""– {defaultArg emptyLabel "Select"} –""" ]
|
||||
:: (continents
|
||||
|> List.map (fun c ->
|
||||
let theId = ContinentId.toString c.Id
|
||||
option [ _value theId; if theId = selectedValue then _selected ] [ str c.Name ])))
|
||||
label [ _class (if isRequired then "jjj-required" else "jjj-label"); _for name ] [ txt "Continent" ]
|
||||
]
|
||||
|
||||
/// Create a submit button with the given icon and text
|
||||
let submitButton icon text =
|
||||
button [ _type "submit"; _class "btn btn-primary" ] [ i [ _class $"mdi mdi-%s{icon}" ] []; txt $" %s{text}" ]
|
||||
|
||||
/// An empty paragraph
|
||||
let emptyP =
|
||||
p [] [ txt " " ]
|
||||
|
||||
/// Register JavaScript code to run in the DOMContentLoaded event on the page
|
||||
let jsOnLoad js isHtmx =
|
||||
script [] [
|
||||
let (target, event) = if isHtmx then "document.body", "htmx:afterSettle" else "document", "DOMContentLoaded"
|
||||
txt (sprintf """%s.addEventListener("%s", () => { %s }, { once: true })""" target event js)
|
||||
]
|
||||
|
||||
/// Create a Markdown editor
|
||||
let markdownEditor attrs name value editorLabel isHtmx =
|
||||
div [ _class "col-12"; _id $"{name}EditRow" ] [
|
||||
nav [ _class "nav nav-pills pb-1" ] [
|
||||
button [ _type "button"; _id $"{name}EditButton"; _class "btn btn-primary btn-sm rounded-pill" ] [
|
||||
txt "Markdown"
|
||||
]
|
||||
rawText " "
|
||||
button [ _type "button"; _id $"{name}PreviewButton"
|
||||
_class "btn btn-outline-secondary btn-sm rounded-pill" ] [
|
||||
txt "Preview"
|
||||
]
|
||||
]
|
||||
section [ _id $"{name}Preview"; _class "jjj-not-shown jjj-markdown-preview px-2 pt-2"
|
||||
_ariaLabel "Rendered Markdown preview" ] []
|
||||
div [ _id $"{name}Edit"; _class "form-floating jjj-shown" ] [
|
||||
textarea (List.append attrs
|
||||
[ _id name; _name name; _class "form-control jjj-markdown-editor"; _rows "10" ]) [
|
||||
txt value
|
||||
]
|
||||
label [ _for name ] [ txt editorLabel ]
|
||||
]
|
||||
jsOnLoad $"jjj.markdownOnLoad('{name}')" isHtmx
|
||||
]
|
||||
|
||||
/// Wrap content in a collapsing panel
|
||||
let collapsePanel header isShown content =
|
||||
let showClass = if isShown then " show" else ""
|
||||
div [ _class "card" ] [
|
||||
div [ _class "card-header" ] [
|
||||
h6 [ _class "mb-0 card-title" ] [
|
||||
a [ _href "#jjjCollapse"; _data "bs-toggle" "collapse"; _roleButton; _ariaControls "#jjjCollapse"
|
||||
_ariaExpanded (isShown.ToString().ToLowerInvariant ()) ] [ txt header ]
|
||||
]
|
||||
]
|
||||
div [ _id "jjjCollapse"; _class $"card-body collapse{showClass}" ] content
|
||||
]
|
||||
|
||||
/// "Yes" or "No" based on a boolean value
|
||||
let yesOrNo value =
|
||||
if value then "Yes" else "No"
|
||||
|
||||
/// Markdown as a raw HTML text node
|
||||
let md2html value =
|
||||
(MarkdownString.toHtml >> txt) value
|
||||
|
||||
/// Display a citizen's contact information
|
||||
let contactInfo citizen isPublic =
|
||||
citizen.OtherContacts
|
||||
|> List.filter (fun it -> (isPublic && it.IsPublic) || not isPublic)
|
||||
|> List.collect (fun contact ->
|
||||
match contact.ContactType with
|
||||
| Website ->
|
||||
[ i [ _class "mdi mdi-sm mdi-web" ] []; txt " "
|
||||
a [ _href contact.Value; _target "_blank"; _rel "noopener"; _class "me-4" ] [
|
||||
str (defaultArg contact.Name "Website")
|
||||
]
|
||||
]
|
||||
| Email ->
|
||||
[ i [ _class "mdi mdi-sm mdi-email-outline" ] []; txt " "
|
||||
a [ _href $"mailto:{contact.Value}"; _class "me-4" ] [ str (defaultArg contact.Name "E-mail") ]
|
||||
]
|
||||
| Phone ->
|
||||
[ span [ _class "me-4" ] [
|
||||
i [ _class "mdi mdi-sm mdi-phone" ] []; txt " "; str contact.Value
|
||||
match contact.Name with Some name -> str $" ({name})" | None -> ()
|
||||
]
|
||||
])
|
||||
|
||||
/// Display a citizen's contact information
|
||||
let contactInfoPrint citizen isPublic =
|
||||
citizen.OtherContacts
|
||||
|> List.filter (fun it -> (isPublic && it.IsPublic) || not isPublic)
|
||||
|> List.collect (fun contact ->
|
||||
match contact.ContactType with
|
||||
| Website ->
|
||||
[ i [ _class "mdi mdi-sm mdi-web" ] []; txt " "; str (defaultArg contact.Name "Website"); txt " – "
|
||||
str contact.Value; br []
|
||||
]
|
||||
| Email ->
|
||||
[ i [ _class "mdi mdi-sm mdi-email-outline" ] []; txt " "; str (defaultArg contact.Name "E-mail")
|
||||
txt " – "; str contact.Value; br []
|
||||
]
|
||||
| Phone ->
|
||||
[ span [ _class "me-4" ] [
|
||||
i [ _class "mdi mdi-sm mdi-phone" ] []; rawText " "
|
||||
match contact.Name with Some name -> str name; txt " – " | None -> ()
|
||||
str contact.Value; br []
|
||||
]
|
||||
])
|
||||
|
||||
open NodaTime
|
||||
open NodaTime.Text
|
||||
|
||||
/// Generate a full date in the citizen's local time zone
|
||||
let fullDate (value : Instant) tz =
|
||||
(ZonedDateTimePattern.CreateWithCurrentCulture ("MMMM d, yyyy", DateTimeZoneProviders.Tzdb))
|
||||
.Format(value.InZone DateTimeZoneProviders.Tzdb[tz])
|
||||
|
||||
/// Generate a full date/time in the citizen's local time
|
||||
let fullDateTime (value : Instant) tz =
|
||||
let dtPattern = ZonedDateTimePattern.CreateWithCurrentCulture ("MMMM d, yyyy h:mm", DateTimeZoneProviders.Tzdb)
|
||||
let amPmPattern = ZonedDateTimePattern.CreateWithCurrentCulture ("tt", DateTimeZoneProviders.Tzdb)
|
||||
let tzValue = value.InZone DateTimeZoneProviders.Tzdb[tz]
|
||||
$"{dtPattern.Format(tzValue)}{amPmPattern.Format(tzValue).ToLowerInvariant()}"
|
||||
|
||||
|
||||
/// Layout generation functions
|
||||
[<RequireQualifiedAccess>]
|
||||
module Layout =
|
||||
|
||||
open Giraffe.ViewEngine.Htmx
|
||||
|
||||
/// Data items needed to render a view
|
||||
type PageRenderContext =
|
||||
{ /// Whether a user is logged on
|
||||
IsLoggedOn : bool
|
||||
|
||||
/// The current URL
|
||||
CurrentUrl : string
|
||||
|
||||
/// The title of this page
|
||||
PageTitle : string
|
||||
|
||||
/// The page content
|
||||
Content : XmlNode
|
||||
|
||||
/// User messages to be displayed
|
||||
Messages : string list
|
||||
}
|
||||
|
||||
/// Append the application name to the page title
|
||||
let private constructTitle ctx =
|
||||
seq {
|
||||
if ctx.PageTitle <> "" then
|
||||
ctx.PageTitle; " | "
|
||||
"Jobs, Jobs, Jobs"
|
||||
}
|
||||
|> Seq.reduce (+)
|
||||
|> str
|
||||
|> List.singleton
|
||||
|> title []
|
||||
|
||||
/// Generate the HTML head tag
|
||||
let private htmlHead ctx =
|
||||
head [] [
|
||||
meta [ _name "viewport"; _content "width=device-width, initial-scale=1" ]
|
||||
constructTitle ctx
|
||||
link [ _href "https://cdn.jsdelivr.net/npm/bootstrap@5.2.0/dist/css/bootstrap.min.css"
|
||||
_rel "stylesheet"
|
||||
_integrity "sha384-gH2yIJqKdNHPEq0n4Mqa/HGKIhSkIHeL5AyhkYV8i59U5AR6csBvApHHNl/vI1Bx"
|
||||
_crossorigin "anonymous" ]
|
||||
link [ _href "https://cdn.jsdelivr.net/npm/@mdi/font@6.9.96/css/materialdesignicons.min.css"
|
||||
_rel "stylesheet" ]
|
||||
link [ _href "/style.css"; _rel "stylesheet" ]
|
||||
]
|
||||
|
||||
/// Display the links available to the current user
|
||||
let private links ctx =
|
||||
let navLink url icon text =
|
||||
a [ _href url
|
||||
_onclick "jjj.hideMenu()"
|
||||
if url = ctx.CurrentUrl then _class "jjj-current-page"
|
||||
] [ i [ _class $"mdi mdi-{icon}"; _ariaHidden "true" ] []; txt text ]
|
||||
nav [ _class "jjj-nav" ] [
|
||||
if ctx.IsLoggedOn then
|
||||
navLink "/citizen/dashboard" "view-dashboard-variant" "Dashboard"
|
||||
navLink "/help-wanted" "newspaper-variant-multiple-outline" "Help Wanted!"
|
||||
navLink "/profile/search" "view-list-outline" "Job Seekers"
|
||||
navLink "/success-stories" "thumb-up" "Success Stories"
|
||||
div [ _class "separator" ] []
|
||||
navLink "/citizen/account" "account-edit" "My Account"
|
||||
navLink "/listings/mine" "sign-text" "My Job Listings"
|
||||
navLink "/profile/edit" "pencil" "My Employment Profile"
|
||||
div [ _class "separator" ] []
|
||||
navLink "/citizen/log-off" "logout-variant" "Log Off"
|
||||
else
|
||||
navLink "/" "home" "Home"
|
||||
navLink "/profile/search" "view-list-outline" "Job Seekers"
|
||||
navLink "/citizen/log-on" "login-variant" "Log On"
|
||||
navLink "/how-it-works" "help-circle-outline" "How It Works"
|
||||
]
|
||||
|
||||
/// Generate mobile and desktop side navigation areas
|
||||
let private sideNavs ctx = [
|
||||
div [ _id "mobileMenu"; _class "jjj-mobile-menu offcanvas offcanvas-end"; _tabindex "-1"
|
||||
_ariaLabelledBy "mobileMenuLabel" ] [
|
||||
div [ _class "offcanvas-header" ] [
|
||||
h5 [ _id "mobileMenuLabel" ] [ txt "Menu" ]
|
||||
button [
|
||||
_class "btn-close text-reset"; _type "button"; _data "bs-dismiss" "offcanvas"; _ariaLabel "Close"
|
||||
] []
|
||||
]
|
||||
div [ _class "offcanvas-body" ] [ links ctx ]
|
||||
]
|
||||
aside [ _class "jjj-full-menu d-none d-md-block p-3" ] [
|
||||
p [ _class "home-link pb-3" ] [ a [ _href "/" ] [ txt "Jobs, Jobs, Jobs" ] ]
|
||||
emptyP
|
||||
links ctx
|
||||
]
|
||||
]
|
||||
|
||||
/// Title bars for mobile and desktop
|
||||
let private titleBars = [
|
||||
nav [ _class "d-flex d-md-none navbar navbar-dark" ] [
|
||||
span [ _class "navbar-text" ] [ a [ _href "/" ] [ txt "Jobs, Jobs, Jobs" ] ]
|
||||
button [ _class "btn"; _data "bs-toggle" "offcanvas"; _data "bs-target" "#mobileMenu"
|
||||
_ariaControls "mobileMenu" ] [ i [ _class "mdi mdi-menu" ] [] ]
|
||||
]
|
||||
nav [ _class "d-none d-md-flex navbar navbar-light bg-light"] [
|
||||
span [] [ txt " " ]
|
||||
span [ _class "navbar-text" ] [
|
||||
txt "(…and Jobs – "; audioClip "pelosi-jobs" (txt "Let’s Vote for Jobs!"); txt ")"
|
||||
]
|
||||
]
|
||||
]
|
||||
|
||||
/// The HTML footer for the page
|
||||
let private htmlFoot =
|
||||
let v = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version
|
||||
let version =
|
||||
seq {
|
||||
string v.Major
|
||||
if v.Minor > 0 || v.Build > 0 then
|
||||
"."; string v.Minor
|
||||
if v.Build > 0 then
|
||||
"."; string v.Build
|
||||
} |> Seq.reduce (+)
|
||||
footer [] [
|
||||
p [ _class "text-muted" ] [
|
||||
txt $"Jobs, Jobs, Jobs v{version} • "
|
||||
a [ _href "/privacy-policy" ] [ txt "Privacy Policy" ]; txt " • "
|
||||
a [ _href "/terms-of-service" ] [ txt "Terms of Service" ]
|
||||
]
|
||||
]
|
||||
|
||||
/// Render any messages
|
||||
let private messages ctx =
|
||||
ctx.Messages
|
||||
|> List.map (fun msg ->
|
||||
let parts = msg.Split "|||"
|
||||
let level = if parts[0] = "error" then "danger" else parts[0]
|
||||
let message = parts[1]
|
||||
div [ _class $"alert alert-{level} alert-dismissable fade show d-flex justify-content-between p-2 mb-1 mt-1"
|
||||
_roleAlert ] [
|
||||
p [ _class "mb-0" ] [
|
||||
if level <> "success" then strong [] [ txt $"{parts[0].ToUpperInvariant ()}: " ]
|
||||
txt message
|
||||
]
|
||||
button [ _type "button"; _class "btn-close"; _data "bs-dismiss" "alert"; _ariaLabel "Close" ] []
|
||||
])
|
||||
|> div [ _id "alerts" ]
|
||||
|
||||
/// Create a full view
|
||||
let full ctx =
|
||||
html [ _lang "en" ] [
|
||||
htmlHead ctx
|
||||
body [] [
|
||||
div [ _class "jjj-app"; _hxBoost; _hxTarget "this" ] [
|
||||
yield! sideNavs ctx
|
||||
div [ _class "jjj-main" ] [
|
||||
yield! titleBars
|
||||
main [ _class "jjj-content container-fluid" ] [
|
||||
messages ctx
|
||||
ctx.Content
|
||||
]
|
||||
htmlFoot
|
||||
]
|
||||
]
|
||||
Script.minified
|
||||
script [ _async
|
||||
_src "https://cdn.jsdelivr.net/npm/bootstrap@5.2.0/dist/js/bootstrap.bundle.min.js"
|
||||
_integrity "sha384-A3rJD856KowSb7dwlZdYEkO39Gagi7vIsF0jrRAoQmDKKtQBHUuLZ9AsSv4jD4Xa"
|
||||
_crossorigin "anonymous" ] []
|
||||
script [ _src "/script.js" ] []
|
||||
template [ _id "alertTemplate" ] [
|
||||
div [ _class $"alert alert-dismissable fade show d-flex justify-content-between p-2 mb-1 mt-1"
|
||||
_roleAlert ] [
|
||||
p [ _class "mb-0" ] []
|
||||
button [ _type "button"; _class "btn-close"; _data "bs-dismiss" "alert"; _ariaLabel "Close" ] []
|
||||
]
|
||||
]
|
||||
]
|
||||
]
|
||||
|
||||
/// Create a partial (boosted response) view
|
||||
let partial ctx =
|
||||
html [ _lang "en" ] [
|
||||
head [] [
|
||||
constructTitle ctx
|
||||
]
|
||||
body [] [
|
||||
yield! sideNavs ctx
|
||||
div [ _class "jjj-main" ] [
|
||||
yield! titleBars
|
||||
main [ _class "jjj-content container-fluid" ] [
|
||||
messages ctx
|
||||
ctx.Content
|
||||
]
|
||||
htmlFoot
|
||||
]
|
||||
]
|
||||
]
|
||||
|
||||
/// Render a print view (styles, but no other layout)
|
||||
let print ctx =
|
||||
html [ _lang "en" ] [
|
||||
htmlHead ctx
|
||||
body [ _class "m-1" ] [ ctx.Content ]
|
||||
]
|
||||
|
||||
/// Render a bare view (used for components)
|
||||
let bare ctx =
|
||||
html [ _lang "en" ] [
|
||||
head [] [ title [] [] ]
|
||||
body [] [ ctx.Content ]
|
||||
]
|
|
@ -1,10 +1,8 @@
|
|||
<Project>
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<TargetFramework>net5.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<DebugType>embedded</DebugType>
|
||||
<GenerateDocumentationFile>false</GenerateDocumentationFile>
|
||||
<AssemblyVersion>3.2.0.0</AssemblyVersion>
|
||||
<FileVersion>3.2.0.0</FileVersion>
|
||||
<AssemblyVersion>0.8.0.0</AssemblyVersion>
|
||||
<FileVersion>0.8.0.0</FileVersion>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
|
|
|
@ -1,53 +0,0 @@
|
|||
/// Handlers for the home page, legal stuff, and help
|
||||
module JobsJobsJobs.Home.Handlers
|
||||
|
||||
open Giraffe
|
||||
open JobsJobsJobs.Common.Handlers
|
||||
|
||||
// GET: /
|
||||
let home : HttpHandler =
|
||||
renderHandler "Welcome" Views.home
|
||||
|
||||
// GET: /privacy-policy
|
||||
let privacyPolicy : HttpHandler =
|
||||
renderHandler "Privacy Policy" Views.privacyPolicy
|
||||
|
||||
// GET: /terms-of-service
|
||||
let termsOfService : HttpHandler =
|
||||
renderHandler "Terms of Service" Views.termsOfService
|
||||
|
||||
// GET: /how-it-works
|
||||
let howItWorks : HttpHandler =
|
||||
renderHandler "How It Works" Views.Help.index
|
||||
|
||||
// GET: /how-it-works/accounts
|
||||
let accountHelp : HttpHandler =
|
||||
renderHandler "Accounts | How It Works" Views.Help.accounts
|
||||
|
||||
// GET: /how-it-works/listings
|
||||
let listingHelp : HttpHandler =
|
||||
renderHandler "Job Listings | How It Works" Views.Help.listings
|
||||
|
||||
// GET: /how-it-works/profiles
|
||||
let profileHelp : HttpHandler =
|
||||
renderHandler "Employment Profiles | How It Works" Views.Help.profiles
|
||||
|
||||
|
||||
open Giraffe.EndpointRouting
|
||||
|
||||
/// All endpoints for this feature
|
||||
let endpoints =
|
||||
[ GET_HEAD [
|
||||
route "/" home
|
||||
route "/privacy-policy" privacyPolicy
|
||||
route "/terms-of-service" termsOfService
|
||||
]
|
||||
subRoute "/how-it-works" [
|
||||
GET_HEAD [
|
||||
route "" howItWorks
|
||||
route "/accounts" accountHelp
|
||||
route "/listings" listingHelp
|
||||
route "/profiles" profileHelp
|
||||
]
|
||||
]
|
||||
]
|
|
@ -1,20 +0,0 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net7.0</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Include="Views.fs" />
|
||||
<Compile Include="Handlers.fs" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Common\JobsJobsJobs.Common.fsproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Update="FSharp.Core" Version="8.0.300" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
|
@ -1,992 +0,0 @@
|
|||
module JobsJobsJobs.Home.Views
|
||||
|
||||
open Giraffe.ViewEngine
|
||||
open JobsJobsJobs.Common.Views
|
||||
|
||||
/// The home page
|
||||
let home =
|
||||
article [] [
|
||||
emptyP
|
||||
p [] [
|
||||
txt "Welcome to Jobs, Jobs, Jobs (AKA No Agenda Careers), where citizens of Gitmo Nation can assist one "
|
||||
txt "another in finding employment. This will enable them to continue providing value-for-value to Adam "
|
||||
txt "and John, as they continue their work deconstructing the misinformation that passes for news on a "
|
||||
txt "day-to-day basis."
|
||||
]
|
||||
p [] [
|
||||
txt "Do you not understand the terms in the paragraph above? No worries; just head over to "
|
||||
a [ _href "https://noagendashow.net"; _target "_blank"; _rel "noopener" ] [
|
||||
txt "The Best Podcast in the Universe"
|
||||
]
|
||||
txt " "; em [] [ audioClip "thats-true" (txt "(that’s true!)") ]
|
||||
txt " and find out what you’re missing."
|
||||
]
|
||||
]
|
||||
|
||||
/// The privacy policy
|
||||
let privacyPolicy =
|
||||
let appName = txt "Jobs, Jobs, Jobs"
|
||||
article [] [
|
||||
h3 [] [ txt "Privacy Policy" ]
|
||||
p [ _class "fst-italic" ] [ txt "(as of February 2<sup>nd</sup>, 2023)" ]
|
||||
|
||||
p [] [
|
||||
appName; txt " (“we,” “our,” or “us”) is committed to protecting your "
|
||||
txt "privacy. This Privacy Policy explains how your personal information is collected, used, and disclosed "
|
||||
txt "disclosed by "; appName; txt "."
|
||||
]
|
||||
p [] [
|
||||
txt "This Privacy Policy applies to our website, and its associated subdomains (collectively, our "
|
||||
txt "“Service”) alongside our application, "; appName; rawText ". By accessing or using our "
|
||||
txt "Service, you signify that you have read, understood, and agree to our collection, storage, use, and "
|
||||
txt "disclosure of your personal information as described in this Privacy Policy and our Terms of Service."
|
||||
]
|
||||
|
||||
h4 [] [ txt "Definitions and key terms" ]
|
||||
p [] [
|
||||
txt "To help explain things as clearly as possible in this Privacy Policy, every time any of these terms "
|
||||
txt "are referenced, are strictly defined as:"
|
||||
]
|
||||
ul [] [
|
||||
li [] [
|
||||
txt "Cookie: small amount of data generated by a website and saved by your web browser. It is used to "
|
||||
txt "identify your browser, provide analytics, remember information about you such as your language "
|
||||
txt "preference or login information."
|
||||
]
|
||||
li [] [
|
||||
txt "Company: when this policy mentions “Company,” “we,” “us,” or "
|
||||
txt "“our,” it refers to "; appName; txt ", that is responsible for your information under "
|
||||
txt "this Privacy Policy."
|
||||
]
|
||||
li [] [
|
||||
txt "Country: where "; appName; txt " or the owners/founders of "; appName
|
||||
txt " are based, in this case is US."
|
||||
]
|
||||
li [] [
|
||||
txt "Customer: refers to the company, organization or person that signs up to use the "; appName
|
||||
txt " Service to manage the relationships with your consumers or service users."
|
||||
]
|
||||
li [] [
|
||||
txt "Device: any internet connected device such as a phone, tablet, computer or any other device that "
|
||||
txt "can be used to visit "; appName; txt " and use the services."
|
||||
]
|
||||
li [] [
|
||||
txt "IP address: Every device connected to the Internet is assigned a number known as an Internet "
|
||||
txt "protocol (IP) address. These numbers are usually assigned in geographic blocks. An IP address can "
|
||||
txt "often be used to identify the location from which a device is connecting to the Internet."
|
||||
]
|
||||
li [] [
|
||||
txt "Personnel: refers to those individuals who are employed by "; appName; txt " or are under "
|
||||
txt "contract to perform a service on behalf of one of the parties."
|
||||
]
|
||||
li [] [
|
||||
txt "Personal Data: any information that directly, indirectly, or in connection with other information "
|
||||
txt "— including a personal identification number — allows for the identification or identifiability "
|
||||
txt "of a natural person."
|
||||
]
|
||||
li [] [
|
||||
txt "Service: refers to the service provided by "; appName; txt " as described in the relative terms "
|
||||
txt "(if available) and on this platform."
|
||||
]
|
||||
li [] [
|
||||
txt "Third-party service: refers to advertisers, contest sponsors, promotional and marketing partners, "
|
||||
txt "and others who provide our content or whose products or services we think may interest you."
|
||||
]
|
||||
li [] [
|
||||
txt "Website: "; appName; txt "’s site, which can be accessed via this URL: "
|
||||
a [ _href "/" ] [ txt "https://noagendacareers.com/" ]
|
||||
]
|
||||
li [] [
|
||||
txt "You: a person or entity that is registered with "; appName; txt " to use the Services."
|
||||
]
|
||||
]
|
||||
|
||||
h4 [] [ txt "What Information Do We Collect?" ]
|
||||
p [] [
|
||||
txt "We collect information from you when you visit our website, register on our site, or fill out a form."
|
||||
]
|
||||
ul [] [
|
||||
li [] [ txt "Name / Username" ]
|
||||
li [] [ txt "Coarse Geographic Location" ]
|
||||
li [] [ txt "Employment History" ]
|
||||
li [] [ txt "Job Listing Information" ]
|
||||
]
|
||||
|
||||
h4 [] [ txt "How Do We Use The Information We Collect?" ]
|
||||
p [] [ txt "Any of the information we collect from you may be used in one of the following ways:" ]
|
||||
ul [] [
|
||||
li [] [
|
||||
txt "To personalize your experience (your information helps us to better respond to your individual "
|
||||
txt "needs)"
|
||||
]
|
||||
li [] [
|
||||
txt "To improve our website (we continually strive to improve our website offerings based on the "
|
||||
txt "information and feedback we receive from you)"
|
||||
]
|
||||
li [] [
|
||||
txt "To improve customer service (your information helps us to more effectively respond to your "
|
||||
txt "customer service requests and support needs)"
|
||||
]
|
||||
]
|
||||
|
||||
h4 [] [ txt "When does "; appName; txt " use end user information from third parties?" ]
|
||||
p [] [
|
||||
appName; txt " will collect End User Data necessary to provide the "; appName
|
||||
txt " services to our customers."
|
||||
]
|
||||
p [] [
|
||||
txt "End users may voluntarily provide us with information they have made available on social media "
|
||||
txt "websites. If you provide us with any such information, we may collect publicly available information "
|
||||
txt "from the social media websites you have indicated. You can control how much of your information "
|
||||
txt "social media websites make public by visiting these websites and changing your privacy settings."
|
||||
]
|
||||
|
||||
h4 [] [ txt "When does "; appName; txt " use customer information from third parties?" ]
|
||||
p [] [ txt "We do not utilize third party information apart from the end-user data described above." ]
|
||||
|
||||
h4 [] [ txt "Do we share the information we collect with third parties?" ]
|
||||
p [] [
|
||||
txt "We may disclose personal and non-personal information about you to government or law enforcement "
|
||||
txt "officials or private parties as we, in our sole discretion, believe necessary or appropriate in order "
|
||||
txt "to respond to claims, legal process (including subpoenas), to protect our rights and interests or "
|
||||
txt "those of a third party, the safety of the public or any person, to prevent or stop any illegal, "
|
||||
txt "unethical, or legally actionable activity, or to otherwise comply with applicable court orders, laws, "
|
||||
txt "rules and regulations."
|
||||
]
|
||||
|
||||
h4 [] [ txt "Where and when is information collected from customers and end users?" ]
|
||||
p [] [
|
||||
appName; txt " will collect personal information that you submit to us. We may also receive personal "
|
||||
txt "information about you from third parties as described above."
|
||||
]
|
||||
|
||||
h4 [] [ txt "How Do We Use Your E-mail Address?" ]
|
||||
p [] [
|
||||
appName; txt " uses your e-mail address to identify you, along with your password, as an authorized user "
|
||||
txt "of this site. E-mail addresses are verified via a time-sensitive link, and may also be used to send "
|
||||
txt "password reset authorization codes. We do not display this e-mail address to users. If you choose to "
|
||||
txt "add an e-mail address as a contact type, that e-mail address will be visible to other authorized "
|
||||
txt "users."
|
||||
]
|
||||
|
||||
h4 [] [ txt "How Long Do We Keep Your Information?" ]
|
||||
p [] [
|
||||
txt "We keep your information only so long as we need it to provide "; appName; txt " to you and fulfill "
|
||||
txt "the purposes described in this policy. When we no longer need to use your information and there is no "
|
||||
txt "need for us to keep it to comply with our legal or regulatory obligations, we’ll either remove it "
|
||||
txt "from our systems or depersonalize it so that we can’t identify you."
|
||||
]
|
||||
|
||||
h4 [] [ txt "How Do We Protect Your Information?" ]
|
||||
p [] [
|
||||
txt "We implement a variety of security measures to maintain the safety of your personal information when "
|
||||
txt "you enter, submit, or access your personal information. We mandate the use of a secure server. We "
|
||||
txt "cannot, however, ensure or warrant the absolute security of any information you transmit to "; appName
|
||||
txt " or guarantee that your information on the Service may not be accessed, disclosed, altered, or "
|
||||
txt "destroyed by a breach of any of our physical, technical, or managerial safeguards."
|
||||
]
|
||||
|
||||
h4 [] [ txt "Could my information be transferred to other countries?" ]
|
||||
p [] [
|
||||
appName; txt " is hosted in the US. Information collected via our website may be viewed and hosted "
|
||||
txt "anywhere in the world, including countries that may not have laws of general applicability regulating "
|
||||
txt "the use and transfer of such data. To the fullest extent allowed by applicable law, by using any of "
|
||||
txt "the above, you voluntarily consent to the trans-border transfer and hosting of such information."
|
||||
]
|
||||
|
||||
h4 [] [ txt "Is the information collected through the "; appName; txt " Service secure?" ]
|
||||
p [] [
|
||||
txt "We take precautions to protect the security of your information. We have physical, electronic, and "
|
||||
txt "managerial procedures to help safeguard, prevent unauthorized access, maintain data security, and "
|
||||
txt "correctly use your information. However, neither people nor security systems are foolproof, including "
|
||||
txt "encryption systems. In addition, people can commit intentional crimes, make mistakes, or fail to "
|
||||
txt "follow policies. Therefore, while we use reasonable efforts to protect your personal information, we "
|
||||
txt "cannot guarantee its absolute security. If applicable law imposes any non-disclaimable duty to "
|
||||
txt "protect your personal information, you agree that intentional misconduct will be the standards used "
|
||||
txt "to measure our compliance with that duty."
|
||||
]
|
||||
|
||||
h4 [] [ txt "Can I update or correct my information?" ]
|
||||
p [] [
|
||||
txt "The rights you have to request updates or corrections to the information "; appName
|
||||
txt " collects depend on your relationship with "; appName; txt "."
|
||||
]
|
||||
p [] [
|
||||
txt "Customers have the right to request the restriction of certain uses and disclosures of personally "
|
||||
txt "identifiable information as follows. You can contact us in order to (1) update or correct your "
|
||||
txt "personally identifiable information, or (3) delete the personally identifiable information maintained "
|
||||
txt "about you on our systems (subject to the following paragraph), by cancelling your account. Such "
|
||||
txt "updates, corrections, changes and deletions will have no effect on other information that we maintain "
|
||||
txt "in accordance with this Privacy Policy prior to such update, correction, change, or deletion. You are "
|
||||
txt "responsible for maintaining the secrecy of your unique password and account information at all times."
|
||||
]
|
||||
p [] [
|
||||
appName; txt " also provides ways for users to modify or remove the information we have collected from "
|
||||
txt "them from the application; these actions will have the same effect as contacting us to modify or "
|
||||
txt "remove data."
|
||||
]
|
||||
p [] [
|
||||
txt "You should be aware that it is not technologically possible to remove each and every record of the "
|
||||
txt "information you have provided to us from our system. The need to back up our systems to protect "
|
||||
txt "information from inadvertent loss means that a copy of your information may exist in a non-erasable "
|
||||
txt "form that will be difficult or impossible for us to locate. Promptly after receiving your request, "
|
||||
txt "all personal information stored in databases we actively use, and other readily searchable media will "
|
||||
txt "be updated, corrected, changed, or deleted, as appropriate, as soon as and to the extent reasonably "
|
||||
txt "and technically practicable."
|
||||
]
|
||||
p [] [
|
||||
txt "If you are an end user and wish to update, delete, or receive any information we have about you, you "
|
||||
txt "may do so by contacting the organization of which you are a customer."
|
||||
]
|
||||
|
||||
h4 [] [ txt "Governing Law" ]
|
||||
p [] [
|
||||
txt "This Privacy Policy is governed by the laws of US without regard to its conflict of laws provision. "
|
||||
txt "You consent to the exclusive jurisdiction of the courts in connection with any action or dispute "
|
||||
txt "arising between the parties under or in connection with this Privacy Policy except for those "
|
||||
txt "individuals who may have rights to make claims under Privacy Shield, or the Swiss-US framework."
|
||||
]
|
||||
p [] [
|
||||
txt "The laws of US, excluding its conflicts of law rules, shall govern this Agreement and your use of the "
|
||||
txt "website. Your use of the website may also be subject to other local, state, national, or "
|
||||
txt "international laws."
|
||||
]
|
||||
p [] [
|
||||
txt "By using "; appName; txt " or contacting us directly, you signify your acceptance of this Privacy "
|
||||
txt "Policy. If you do not agree to this Privacy Policy, you should not engage with our website, or use "
|
||||
txt "our services. Continued use of the website, direct engagement with us, or following the posting of "
|
||||
txt "changes to this Privacy Policy that do not significantly affect the use or disclosure of your "
|
||||
txt "personal information will mean that you accept those changes."
|
||||
]
|
||||
|
||||
h4 [] [ txt "Your Consent" ]
|
||||
p [] [
|
||||
txt "We’ve updated our Privacy Policy to provide you with complete transparency into what is being "
|
||||
txt "set when you visit our site and how it’s being used. By using our website, registering an "
|
||||
txt "account, or making a purchase, you hereby consent to our Privacy Policy and agree to its terms."
|
||||
]
|
||||
|
||||
h4 [] [ txt "Links to Other Websites" ]
|
||||
p [] [
|
||||
txt "This Privacy Policy applies only to the Services. The Services may contain links to other websites "
|
||||
txt "not operated or controlled by "; appName; txt ". We are not responsible for the content, accuracy, or "
|
||||
txt "opinions expressed in such websites, and such websites are not investigated, monitored, or checked "
|
||||
txt "for accuracy or completeness by us. Please remember that when you use a link to from the Services to "
|
||||
txt "another website, our Privacy Policy is no longer in effect. Your browsing and interaction on any "
|
||||
txt "other website, including those that have a link on our platform, is subject to that website’s own "
|
||||
txt "rules and policies. Such third parties may use their own cookies or other methods to collect "
|
||||
txt "information about you."
|
||||
]
|
||||
|
||||
h4 [] [ txt "Cookies" ]
|
||||
p [] [
|
||||
appName; txt " uses a session Cookie to identify an active, logged-on session. This Cookie is removed when "
|
||||
txt "when You explicitly log off; is not accessible via script; and must be transferred over a secured, "
|
||||
txt "encrypted connection."
|
||||
]
|
||||
p [] [ appName; txt " uses no persistent or Third-Party Cookies." ]
|
||||
|
||||
h4 [] [ txt "Kids’ Privacy" ]
|
||||
p [] [
|
||||
txt "We do not address anyone under the age of 13. We do not knowingly collect personally identifiable "
|
||||
txt "information from anyone under the age of 13. If You are a parent or guardian and You are aware that "
|
||||
txt "Your child has provided Us with Personal Data, please contact Us. If We become aware that We have "
|
||||
txt "collected Personal Data from anyone under the age of 13 without verification of parental consent, We "
|
||||
txt "take steps to remove that information from Our servers."
|
||||
]
|
||||
|
||||
h4 [] [ txt "Changes To Our Privacy Policy" ]
|
||||
p [] [
|
||||
txt "We may change our Service and policies, and we may need to make changes to this Privacy Policy so "
|
||||
txt "that they accurately reflect our Service and policies. Unless otherwise required by law, we will "
|
||||
txt "notify you (for example, through our Service) before we make changes to this Privacy Policy and give "
|
||||
txt "you an opportunity to review them before they go into effect. Then, if you continue to use the "
|
||||
txt "Service, you will be bound by the updated Privacy Policy. If you do not want to agree to this or any "
|
||||
txt "updated Privacy Policy, you can delete your account."
|
||||
]
|
||||
|
||||
h4 [] [ txt "Third-Party Services" ]
|
||||
p [] [
|
||||
txt "We may display, include or make available third-party content (including data, information, "
|
||||
txt "applications and other products services) or provide links to third-party websites or services "
|
||||
txt "(“Third-Party Services”)."
|
||||
]
|
||||
p [] [
|
||||
txt "You acknowledge and agree that "; appName; txt " shall not be responsible for any Third-Party "
|
||||
txt "Services, including their accuracy, completeness, timeliness, validity, copyright compliance, "
|
||||
txt "legality, decency, quality or any other aspect thereof. "; appName; txt " does not assume and shall "
|
||||
txt "not have any liability or responsibility to you or any other person or entity for any Third-Party "
|
||||
txt "Services."
|
||||
]
|
||||
p [] [
|
||||
txt "Third-Party Services and links thereto are provided solely as a convenience to you and you access and "
|
||||
txt "use them entirely at your own risk and subject to such third parties’ terms and conditions."
|
||||
]
|
||||
|
||||
h4 [] [ txt "Tracking Technologies" ]
|
||||
p [] [ appName; txt " does not use any tracking technologies." ]
|
||||
|
||||
h4 [] [ txt "Information about General Data Protection Regulation (GDPR)" ]
|
||||
p [] [
|
||||
txt "We may be collecting and using information from you if you are from the European Economic Area (EEA), "
|
||||
txt "and in this section of our Privacy Policy we are going to explain exactly how and why is this data "
|
||||
txt "collected, and how we maintain this data under protection from being replicated or used in the wrong "
|
||||
txt "way."
|
||||
]
|
||||
|
||||
h5 [] [ txt "What is GDPR?" ]
|
||||
p [] [
|
||||
txt "GDPR is an EU-wide privacy and data protection law that regulates how EU residents’ data is "
|
||||
txt "protected by companies and enhances the control the EU residents have, over their personal data."
|
||||
]
|
||||
p [] [
|
||||
txt "The GDPR is relevant to any globally operating company and not just the EU-based businesses and EU "
|
||||
txt "residents. Our customers’ data is important irrespective of where they are located, which is why we "
|
||||
txt "have implemented GDPR controls as our baseline standard for all our operations worldwide."
|
||||
]
|
||||
|
||||
h5 [] [ txt "What is personal data?" ]
|
||||
p [] [
|
||||
txt "Any data that relates to an identifiable or identified individual. GDPR covers a broad spectrum of "
|
||||
txt "information that could be used on its own, or in combination with other pieces of information, to "
|
||||
txt "identify a person. Personal data extends beyond a person’s name or email address. Some examples "
|
||||
txt "include financial information, political opinions, genetic data, biometric data, IP addresses, "
|
||||
txt "physical address, sexual orientation, and ethnicity."
|
||||
]
|
||||
p [] [ txt "The Data Protection Principles include requirements such as:" ]
|
||||
ul [] [
|
||||
li [] [
|
||||
txt "Personal data collected must be processed in a fair, legal, and transparent way and should only "
|
||||
txt "be used in a way that a person would reasonably expect."
|
||||
]
|
||||
li [] [
|
||||
txt "Personal data should only be collected to fulfil a specific purpose and it should only be used "
|
||||
txt "for that purpose. Organizations must specify why they need the personal data when they collect it."
|
||||
]
|
||||
li [] [ txt "Personal data should be held no longer than necessary to fulfil its purpose." ]
|
||||
li [] [
|
||||
txt "People covered by the GDPR have the right to access their own personal data. They can also "
|
||||
txt "request a copy of their data, and that their data be updated, deleted, restricted, or moved to "
|
||||
txt "another organization."
|
||||
]
|
||||
]
|
||||
|
||||
h5 [] [ txt "Why is GDPR important?" ]
|
||||
p [] [
|
||||
txt "GDPR adds some new requirements regarding how companies should protect individuals’ personal "
|
||||
txt "data that they collect and process. It also raises the stakes for compliance by increasing "
|
||||
txt "enforcement and imposing greater fines for breach. Beyond these facts, it’s simply the right "
|
||||
txt "thing to do. At "; appName; txt " we strongly believe that your data privacy is very important and we "
|
||||
txt "already have solid security and privacy practices in place that go beyond the requirements of this "
|
||||
txt "regulation."
|
||||
]
|
||||
|
||||
h5 [] [ txt "Individual Data Subject’s Rights - Data Access, Portability, and Deletion" ]
|
||||
p [] [
|
||||
txt "We are committed to helping our customers meet the data subject rights requirements of GDPR. "
|
||||
appName; txt " processes or stores all personal data in fully vetted, DPA compliant vendors. We do store "
|
||||
txt "all conversation and personal data for up to 6 years unless your account is deleted. In which case, "
|
||||
txt "we dispose of all data in accordance with our Terms of Service and Privacy Policy, but we will not "
|
||||
txt "hold it longer than 60 days."
|
||||
]
|
||||
p [] [
|
||||
txt "We are aware that if you are working with EU customers, you need to be able to provide them with the "
|
||||
txt "ability to access, update, retrieve and remove personal data. We got you! We’ve been set up as "
|
||||
txt "self service from the start and have always given you access to your data. Our customer support team "
|
||||
txt "is here for you to answer any questions you might have about working with the API."
|
||||
]
|
||||
|
||||
h4 [] [ txt "California Residents" ]
|
||||
p [] [
|
||||
txt "The California Consumer Privacy Act (CCPA) requires us to disclose categories of Personal Information "
|
||||
txt "we collect and how we use it, the categories of sources from whom we collect Personal Information, "
|
||||
txt "and the third parties with whom we share it, which we have explained above."
|
||||
]
|
||||
p [] [
|
||||
txt "We are also required to communicate information about rights California residents have under "
|
||||
txt "California law. You may exercise the following rights:"
|
||||
]
|
||||
ul [] [
|
||||
li [] [
|
||||
txt "Right to Know and Access. You may submit a verifiable request for information regarding the: (1) "
|
||||
txt "categories of Personal Information we collect, use, or share; (2) purposes for which categories "
|
||||
txt "of Personal Information are collected or used by us; (3) categories of sources from which we "
|
||||
txt "collect Personal Information; and (4) specific pieces of Personal Information we have collected "
|
||||
txt "about you."
|
||||
]
|
||||
li [] [
|
||||
txt "Right to Equal Service. We will not discriminate against you if you exercise your privacy rights."
|
||||
]
|
||||
li [] [
|
||||
txt "Right to Delete. You may submit a verifiable request to close your account and we will delete "
|
||||
txt "Personal Information about you that we have collected."
|
||||
]
|
||||
li [] [
|
||||
txt "Request that a business that sells a consumer’s personal data, not sell the "
|
||||
txt "consumer’s personal data."
|
||||
]
|
||||
]
|
||||
p [] [
|
||||
txt "If you make a request, we have one month to respond to you. If you would like to exercise any of "
|
||||
txt "these rights, please contact us."
|
||||
]
|
||||
p [] [ txt "We do not sell the Personal Information of our users." ]
|
||||
p [] [ txt "For more information about these rights, please contact us." ]
|
||||
|
||||
h5 [] [ txt "California Online Privacy Protection Act (CalOPPA)" ]
|
||||
p [] [
|
||||
txt "CalOPPA requires us to disclose categories of Personal Information we collect and how we use it, the "
|
||||
txt "categories of sources from whom we collect Personal Information, and the third parties with whom we "
|
||||
txt "share it, which we have explained above."
|
||||
]
|
||||
p [] [ txt "CalOPPA users have the following rights:" ]
|
||||
ul [] [
|
||||
li [] [
|
||||
txt "Right to Know and Access. You may submit a verifiable request for information regarding the: (1) "
|
||||
txt "categories of Personal Information we collect, use, or share; (2) purposes for which categories "
|
||||
txt "of Personal Information are collected or used by us; (3) categories of sources from which we "
|
||||
txt "collect Personal Information; and (4) specific pieces of Personal Information we have collected "
|
||||
txt "about you."
|
||||
]
|
||||
li [] [
|
||||
txt "Right to Equal Service. We will not discriminate against you if you exercise your privacy rights."
|
||||
]
|
||||
li [] [
|
||||
txt "Right to Delete. You may submit a verifiable request to close your account and we will delete "
|
||||
txt "Personal Information about you that we have collected."
|
||||
]
|
||||
li [] [
|
||||
txt "Right to request that a business that sells a consumer’s personal data, not sell the "
|
||||
txt "consumer’s personal data."
|
||||
]
|
||||
]
|
||||
p [] [
|
||||
txt "If you make a request, we have one month to respond to you. If you would like to exercise any of "
|
||||
txt "these rights, please contact us."
|
||||
]
|
||||
p [] [ txt "We do not sell the Personal Information of our users." ]
|
||||
p [] [ txt "For more information about these rights, please contact us." ]
|
||||
|
||||
h4 [] [ txt "Contact Us" ]
|
||||
p [] [ txt "Don’t hesitate to contact us if you have any questions." ]
|
||||
ul [] [
|
||||
li [] [
|
||||
txt "Via this Link: "; a [ _href "/how-it-works" ] [ txt "https://noagendacareers.com/how-it-works" ]
|
||||
]
|
||||
]
|
||||
|
||||
hr []
|
||||
|
||||
p [ _class "fst-italic" ] [ txt "Changes for "; appName; txt " v3 (February 2<sup>nd</sup>, 2023)" ]
|
||||
ul [] [
|
||||
li [ _class "fst-italic" ] [ txt "Removed references to Mastodon" ]
|
||||
li [ _class "fst-italic" ] [ txt "Added references to job listings" ]
|
||||
li [ _class "fst-italic" ] [ txt "Changed information regarding e-mail addresses" ]
|
||||
li [ _class "fst-italic" ] [ txt "Updated cookie / tracking sections for new architecture" ]
|
||||
]
|
||||
p [ _class "fst-italic" ] [
|
||||
txt "Change on September 6<sup>th</sup>, 2021 – replaced “No Agenda Social” with generic "
|
||||
txt "terms for any authorized Mastodon instance."
|
||||
]
|
||||
]
|
||||
|
||||
/// The page for terms of service
|
||||
let termsOfService =
|
||||
article [] [
|
||||
h3 [] [ txt "Terms of Service" ]
|
||||
p [ _class "fst-italic" ] [ txt "(as of February 2<sup>nd</sup>, 2023)" ]
|
||||
h4 [] [ txt "Acceptance of Terms" ]
|
||||
p [] [
|
||||
txt "By accessing this web site, you are agreeing to be bound by these Terms and Conditions, and that you "
|
||||
txt "are responsible to ensure that your use of this site complies with all applicable laws. Your "
|
||||
txt "continued use of this site implies your acceptance of these terms."
|
||||
]
|
||||
h4 [] [ txt "Description of Service and Registration" ]
|
||||
p [] [
|
||||
txt "Jobs, Jobs, Jobs is a service that allows individuals to enter and amend employment profiles and job "
|
||||
txt "listings, restricting access to the details of these to other users of this site, unless the "
|
||||
txt "individual specifies that this information should be visible publicly. See our "
|
||||
a [ _href "/privacy-policy" ] [ txt "privacy policy" ]
|
||||
txt " for details on the personal (user) information we maintain."
|
||||
]
|
||||
h4 [] [ txt "Liability" ]
|
||||
p [] [
|
||||
txt "This service is provided “as is”, and no warranty (express or implied) exists. The "
|
||||
txt "service and its developers may not be held liable for any damages that may arise through the use of "
|
||||
txt "this service."
|
||||
]
|
||||
h4 [] [ txt "Updates to Terms" ]
|
||||
p [] [
|
||||
txt "These terms and conditions may be updated at any time. When these terms are updated, users will be "
|
||||
txt "notified via a notice on the dashboard page. Additionally, the date at the top of this page will be "
|
||||
txt "updated, and any substantive updates will also be accompanied by a summary of those changes."
|
||||
]
|
||||
hr []
|
||||
p [] [
|
||||
txt "You may also wish to review our "; a [ _href "/privacy-policy" ] [ txt "privacy policy" ]
|
||||
txt " to learn how we handle your data."
|
||||
]
|
||||
hr []
|
||||
p [ _class "fst-italic" ] [
|
||||
txt "Change on February 2<sup>nd</sup>, 2023 – added references to job listings, removed references "
|
||||
txt "to Mastodon instances."
|
||||
]
|
||||
p [ _class "fst-italic" ] [
|
||||
txt "Change on September 6<sup>th</sup>, 2021 – replaced “No Agenda Social” with a list "
|
||||
txt "of all No Agenda-affiliated Mastodon instances."
|
||||
]
|
||||
]
|
||||
|
||||
/// Help page templates
|
||||
module Help =
|
||||
|
||||
/// CSS classes to indicate a reference to a particular page within Jobs, Jobs, Jobs
|
||||
let private linkedPage = _class "badge text-light bg-success"
|
||||
|
||||
/// CSS classes to indicate a reference to a named button
|
||||
let private actionButton = _class "badge text-light bg-secondary rounded-pill"
|
||||
|
||||
/// CSS classes for main headings within the documentation
|
||||
let private mainHeading = _class "border-top border-2 mt-4 pt-1"
|
||||
|
||||
/// A link to return to the help index
|
||||
let private backToIndex =
|
||||
p [] [ a [ _href "/how-it-works" ] [ txt "« Back to Help Index" ] ]
|
||||
|
||||
/// Account help page
|
||||
let accounts =
|
||||
[ backToIndex
|
||||
p [] [
|
||||
span [ _class "fst-italic" ] [
|
||||
txt "On this page: "; a [ _href "#registration" ] [ txt "Registration" ]; txt " • "
|
||||
a [ _href "#log-on" ] [ txt "Logging On" ]; txt " • "
|
||||
a [ _href "#updating" ] [ txt "Updating Your Account" ]; txt " • "
|
||||
a [ _href "#deleting" ] [ txt "Deleting Your Account" ]
|
||||
]
|
||||
]
|
||||
|
||||
h4 [ _id "registration"; mainHeading ] [ txt "Registering for an Account" ]
|
||||
p [] [
|
||||
txt "To register for an account, go to the "; span [ linkedPage ] [ txt "Log On" ]; txt " page; just "
|
||||
txt "below the "; span [ actionButton ] [ txt "Log On" ]; txt " button, there is a link that leads to "
|
||||
txt "the registration page. The first three fields are name fields, the fourth is an e-mail address, "
|
||||
txt "and the final two are for your password. Your password must be at least 8 characters long."
|
||||
]
|
||||
p [] [
|
||||
txt "As Jobs, Jobs, Jobs is targeted towards "
|
||||
a [ _href "https://noagendashow.net"; _target "_blank"; _rel "noopener" ] [ txt "No Agenda" ]
|
||||
txt " listeners, there are also two questions that test your knowledge of the show. The answers to "
|
||||
txt "these questions are not case-sensitive, and should pose no significant challenge to those who "
|
||||
txt "have listened to an episode or two "; em [] [ txt "(including the donation segments!)" ]; txt "."
|
||||
]
|
||||
p [] [
|
||||
txt "Once you click the "; span [ actionButton ] [ txt "Register" ]; txt " button, the system will "
|
||||
txt "send an e-mail to you with a confirmation link. This link must be visited within 72 hours, or the "
|
||||
txt "account request will be deleted. Once the account is confirmed, though, you are ready to…"
|
||||
]
|
||||
|
||||
h4 [ _id "log-on"; mainHeading ] [ txt "Log On" ]
|
||||
p [] [
|
||||
txt "Logging on to Jobs, Jobs, Jobs is a straightforward process; enter your e-mail address and "
|
||||
txt "password. Beside visiting the page directly, you may also be directed to it if you click a link "
|
||||
txt "that requires you to be logged on to view. In these cases, instead of being directed to the "
|
||||
txt "dashboard page, you would instead be directed back to the page you were trying to view."
|
||||
]
|
||||
|
||||
h4 [ _id "updating"; mainHeading ] [ txt "Updating Your Account and Contact Information" ]
|
||||
p [] [
|
||||
txt "When you are logged on, clicking "; span [ linkedPage ] [ txt "My Account" ]; txt " in the menu "
|
||||
txt "will take you to the Account Profile page. This page allows you to change any of the three name "
|
||||
txt "fields. You can also change your password from this page; if you do not want to change it, "
|
||||
txt "though, leave both of those fields blank."
|
||||
]
|
||||
p [] [
|
||||
txt "This page is also where you can enter contact information. Clicking the "
|
||||
span [ actionButton ] [ txt "Add a Contact Method" ]; txt " button will add a row to the table, and in "
|
||||
txt "each row, clicking the "; span [ actionButton ] [ txt "−" ]; txt " button will remove that "
|
||||
txt "row. When others view your employment profile, or any job listings you may create, this contact "
|
||||
txt "information is displayed along with it. Each contact can be marked as “Public”; if "
|
||||
txt "you opt to allow public access to your employment profile, the contacts marked as public will be "
|
||||
txt "displayed, but the others will be excluded."
|
||||
]
|
||||
p [] [
|
||||
txt "For each contact, you may specify a name. For websites and e-mail addresses, this name will be "
|
||||
txt "the text of the link generated for that item; otherwise, the links will be “Website” "
|
||||
txt "and “E-mail”, respectively. For phone numbers, the name will appear in parentheses "
|
||||
txt "after the number."
|
||||
]
|
||||
|
||||
h4 [ _id "deleting"; mainHeading ] [ txt "Deleting Your Account" ]
|
||||
p [] [
|
||||
txt "Though we hate to see it, we realize that there may come a time when you want to delete either "
|
||||
txt "your employment profile or your complete account. On both the "
|
||||
span [ linkedPage ] [ txt "Account Update" ]; txt " and "; span [ linkedPage ] [ txt "Profile Edit" ]
|
||||
txt " pages, there is a link to a page with deletion options."
|
||||
]
|
||||
p [] [
|
||||
txt "The first red button will delete your employment profile. This means that no searches for "
|
||||
txt "employment profiles will return your information. If you had shared a direct link to your "
|
||||
txt "profile, it will return a “Not Found” page – unless you take steps to create "
|
||||
txt "your employment profile again, in which case the same link will work again. If you want to "
|
||||
txt "obtain the same effect without deleting your profile, update it and select the "
|
||||
txt "“Invisible” visibility option."
|
||||
]
|
||||
p [] [
|
||||
txt "The second red button will delete your entire account. In addition to your employment profile "
|
||||
txt "being deleted, it will delete any job listings you may have posted, any success stories you may "
|
||||
txt "have recorded, and your account information. It will make it like you were never a user of this "
|
||||
txt "system. If you re-register, you will be given a different ID, so direct links to your previous "
|
||||
txt "employment profile will not work, even if you create an employment profile for your new account."
|
||||
]
|
||||
p [] [
|
||||
strong [] [ txt "Use both these options with extreme care!" ]; txt " There is no “undo” "
|
||||
txt "for these actions; if you change your mind, you will have to recreate what you have deleted."
|
||||
]
|
||||
]
|
||||
|> pageWithTitle "How It Works: Accounts"
|
||||
|
||||
/// Job listings help page
|
||||
let listings =
|
||||
[ backToIndex
|
||||
p [] [
|
||||
span [ _class "fst-italic" ] [
|
||||
txt "On this page: "
|
||||
a [ _href "#creating" ] [ txt "Creating a Job Listing" ]; txt " • "
|
||||
a [ _href "#maintaining" ] [ txt "Maintaining" ]; txt " • "
|
||||
a [ _href "#searching" ] [ txt "Searching" ]
|
||||
]
|
||||
]
|
||||
|
||||
h4 [ _id "creating"; mainHeading ] [ txt "Creating a Job Listing" ]
|
||||
p [] [
|
||||
txt "The "; span [ linkedPage] [ txt "My Job Listings" ]; txt " page shows all of the job listings you "
|
||||
txt "have created. To add a new one, click the "; span [ actionButton] [ txt "Add a New Listing" ]
|
||||
txt " button. This page allows you to specify a title for the listing; the continent and region; "
|
||||
txt "whether it is a remote opportunity; the date by which a job needs to be filled; and a full "
|
||||
txt "description of the position, using "; a [ _href "/how-it-works#markdown" ] [ txt "Markdown" ]
|
||||
txt ". Once you save the listing, it will be visible to the other citizens here."
|
||||
]
|
||||
|
||||
h4 [ _id "maintaining"; mainHeading ] [ txt "Maintaining and Sharing Your Job Listings" ]
|
||||
p [] [
|
||||
txt "The "; span [ linkedPage] [ txt "My Job Listings" ]; txt " page will show you all of your active "
|
||||
txt "job listings just below the "; span [ actionButton] [ txt "Add a Job Listing" ]; txt " button. "
|
||||
txt "Within this table, you can edit the listing, view it, or expire it (more on that below). The "
|
||||
span [ linkedPage] [ txt "View" ]; txt " link will show you the job listing just as other users will "
|
||||
txt "see it. You can share the link from your browser, and other Jobs, Jobs, Jobs users will be able "
|
||||
txt "to log on and view it."
|
||||
]
|
||||
|
||||
h5 [] [ txt "Expire a Job Listing" ]
|
||||
p [] [
|
||||
txt "Once the job is filled, or the opportunity has passed, you will want to expire the listing; this "
|
||||
txt "is what the "; span [ linkedPage] [ txt "Expire" ]; txt " link allows you to do. When you click "
|
||||
txt "it, you will be presented with a single question – was the job filled due to its listing "
|
||||
txt "here? If not, leave that blank, click the "; span [ actionButton] [ txt "Expire" ]; txt " button, "
|
||||
txt "and the listing will be expired. If you click that box, though, another Markdown editor will "
|
||||
txt "appear, where you can share a story of the experience. This is not required, but if you put text "
|
||||
txt "there, it will be recorded as a Success Story, and other users will be able to read about your "
|
||||
txt "success."
|
||||
]
|
||||
p [] [
|
||||
txt "Once you have at least one expired job listing, the "; span [ linkedPage] [ txt "My Job Listing" ]
|
||||
txt " page will have a new section below your active listings, where you can see your expired ones. "
|
||||
txt "You can still view the expired listing, and links that you may have shared will still pull up the "
|
||||
txt "listing; there will be an “expired” label beside the title, so that whoever is "
|
||||
txt "viewing it knows that they are reading about a job that is no longer available."
|
||||
]
|
||||
|
||||
h4 [ _id "searching"; mainHeading] [ txt "Searching Job Listings" ]
|
||||
p [] [
|
||||
txt "Active job listings are found on the "; span [ linkedPage ] [ txt "Help Wanted!" ]; txt " page. "
|
||||
txt "When you first bring up this page, you will see several criteria by which you can narrow your "
|
||||
txt "results, though none are required. When you click the "; span [ actionButton ] [ txt "Search" ]
|
||||
txt " button, you will see open job listings filtered by whatever criteria you specified. Each job "
|
||||
txt "displays its title, its location, whether it is a remote opportunity, and (if specified) the date "
|
||||
txt "by which the job needs to be filled."
|
||||
]
|
||||
p [] [
|
||||
txt "Clicking the "; span [ linkedPage] [ txt "View" ]; txt " link on a listing brings up the full "
|
||||
txt "view page for a listing. This page displays all of the information from the search results, along "
|
||||
txt "with the citizen who posted it, and the full details of the job. All the citizen’s contact "
|
||||
txt "information is displayed, and you can use any of these means to get in touch with them to inquire "
|
||||
txt "about the position."
|
||||
]
|
||||
]
|
||||
|> pageWithTitle "How It Works: Job Listings"
|
||||
|
||||
/// Profile help page
|
||||
let profiles =
|
||||
[ backToIndex
|
||||
p [] [
|
||||
span [ _class "fst-italic" ] [
|
||||
txt "On this page: "
|
||||
a [ _href "#creating" ] [ txt "Creating and Editing Your Employment Profile" ]
|
||||
txt " • "; a [ _href "#searching" ] [ txt "Searching" ]; txt " • "
|
||||
a [ _href "#viewing" ] [ txt "Viewing, Printing, and Sharing" ]; txt " • "
|
||||
a [ _href "#finding" ] [ txt "Finding Employment" ]
|
||||
]
|
||||
]
|
||||
|
||||
h4 [ _id "creating"; mainHeading ] [ txt "Creating and Editing Your Employment Profile" ]
|
||||
p [] [
|
||||
txt "The employment profile is your résumé, visible to other citizens here. On your "
|
||||
txt "dashboard, there we be either a "; span [ actionButton ] [ txt "Create Profile" ]; txt " or an "
|
||||
span [ actionButton ] [ txt "Edit Profile" ]; txt " button, depending on whether you have a profile "
|
||||
txt "established yet. There is also a "; span [ linkedPage ] [ txt "My Employment Profile" ]
|
||||
txt " entry in the menu when you are logged on."
|
||||
]
|
||||
p [] [
|
||||
txt "The employment profile itself is divided into three sections, and the main edit page serves as a "
|
||||
txt "menu for them. If you have a profile established, there is a button labeled "
|
||||
span [ actionButton ] [ txt "View Your Employment Profile" ]; txt " which will show you your profile "
|
||||
txt "the way other users will see it."
|
||||
]
|
||||
|
||||
h5 [] [ txt "General Information" ]
|
||||
p [] [
|
||||
txt "The "; span [ linkedPage ] [ txt "General Information" ]; txt " section of the Employment Profile "
|
||||
txt "contains the following fields:"
|
||||
]
|
||||
ul [] [
|
||||
li [] [
|
||||
strong [] [ txt "Continent" ]; txt " (required): The continent on which you most frequently reside"
|
||||
]
|
||||
li [] [
|
||||
strong [] [ txt "Region" ]; txt " (required): A smaller geographic area within the continent you "
|
||||
txt "selected. This is free-form text; describe it as narrowly or broadly as you like."
|
||||
]
|
||||
li [] [
|
||||
strong [] [ txt "Three Yes/No Questions" ]; txt ": If you are actively seeking work, check the "
|
||||
txt "“I am currently seeking employment” box; if you are interested in full-time or "
|
||||
txt "remote work, check those boxes. Leaving them unchecked implies “No”."
|
||||
]
|
||||
li [] [
|
||||
strong [] [ txt "Professional Biography" ]; txt " (required): Your description of what type of job "
|
||||
txt "you are seeking, an overview of your professional history, etc. This is the main "
|
||||
txt "résumé portion of the profile. It supports "
|
||||
a [ _href "/how-it-works#markdown" ] [ txt "Markdown" ]; txt " formatting, which allows you to add "
|
||||
txt "headings, bold/emphasized text, links, etc."
|
||||
]
|
||||
li [] [
|
||||
strong [] [ txt "Experience" ]; txt ": This Markdown block will be placed at the bottom of the "
|
||||
txt "employment profile, below your skills and employment history. It is optional (as are skills "
|
||||
txt "and employment history). This area can be omitted; used to display skills or employment "
|
||||
txt "history in a different way than this application provides; or used to provide a closing "
|
||||
txt "appeal, the text “References available upon request”, or any other information "
|
||||
txt "you want displayed at the bottom of your profile."
|
||||
]
|
||||
li [] [
|
||||
strong [] [ txt "Visibility" ]; txt " (required):"
|
||||
ul [] [
|
||||
li [] [
|
||||
em [] [ txt "Hidden" ]; txt " will restrict your profile to yourself only; this "
|
||||
txt "can be used while you are initially building your profile, or to remove your profile "
|
||||
txt "from search results without deleting it."
|
||||
]
|
||||
li [] [
|
||||
em [] [ txt "Private" ]; txt " (the default) will restrict your profile to logged-on users "
|
||||
txt "of this community."
|
||||
]
|
||||
li [] [
|
||||
em [] [ txt "Anonymous"]; txt " will allow your continent, region, and skills to be "
|
||||
txt "displayed in public searches, without linking to your profile or disclosing any "
|
||||
txt "additional information."
|
||||
]
|
||||
li [] [
|
||||
em [] [ txt "Public" ]; txt " will allow public users to search, view, and print your "
|
||||
txt "profile, just as you or logged-on users can. It also allows you to share the link to "
|
||||
txt "your employment profile with the general public."
|
||||
]
|
||||
]
|
||||
]
|
||||
]
|
||||
|
||||
h5 [] [ txt "Skills" ]
|
||||
p [] [
|
||||
txt "The "; span [ linkedPage ] [ txt "Skills" ]; txt " section allows you to record skills you have "
|
||||
txt "obtained. Each skill has an associated “Notes” field, which can be used to document "
|
||||
txt "your level of proficiency, years practiced, etc. Skills will be sorted alphabetically, and "
|
||||
txt "displayed in the profile just below the “Professional Biography”."
|
||||
]
|
||||
p [] [
|
||||
txt "Note that if you select “Anonymous” visibility, what you enter in these fields will "
|
||||
txt "visible in public search results. In this case, be sure to omit any identifying information from "
|
||||
txt "either field."
|
||||
]
|
||||
|
||||
h5 [] [ txt "Employment History" ]
|
||||
p [] [
|
||||
txt "The "; span [ linkedPage ] [ txt "Employment History" ]; txt " section allows you to record a "
|
||||
txt "chronological listing of your previous or current employment. This section is sorted descendingly "
|
||||
txt "(most recent first) by end date, with ongoing jobs listed first. If any entries are present, "
|
||||
txt "they will be displayed below the list of skills (or below the “Professional "
|
||||
txt "Biography”, if no skills are present)."
|
||||
]
|
||||
p [] [
|
||||
txt "Each employment history entry consists of the following fields:"
|
||||
]
|
||||
ul [] [
|
||||
li [] [
|
||||
strong [] [ txt "Employer" ]; txt " (required): The name of the entity by which you were employed"
|
||||
]
|
||||
li [] [
|
||||
strong [] [ txt "Title or Position" ]; txt " (required): The title or job position you held with "
|
||||
txt "the employer, usually the most recent or senior"
|
||||
]
|
||||
li [] [
|
||||
strong [] [ txt "Start Date" ]; txt " (required): The date you began this period of employment. "
|
||||
txt "While you will see a full calendar, only the month and year will be displayed on the "
|
||||
txt "employment profile, so you may select any day within the month."
|
||||
]
|
||||
li [] [
|
||||
strong [] [ txt "End Date" ]; txt ": The date you ended this period of employment. As with the "
|
||||
txt "“Start Date” field, it will only display month and year. Also, if you still have "
|
||||
txt "this job, leave this blank, and “to Present” will be displayed for the end date."
|
||||
]
|
||||
li [] [
|
||||
strong [] [ txt "Description" ]; txt ": An optional description of your employment. This field "
|
||||
txt "supports Markdown, and will appear below the employer, position, and dates if present."
|
||||
]
|
||||
]
|
||||
|
||||
h4 [ _id "searching"; mainHeading ] [ txt "Searching Employment Profiles" ]
|
||||
|
||||
h5 [] [ txt "Search Criteria" ]
|
||||
p [] [
|
||||
txt "The "; span [ linkedPage ] [ txt "Job Seekers" ]; txt " page and its search form is the same "
|
||||
txt "whether there is a user logged on or not; however, the results are different. There are three "
|
||||
txt "sections to the search form. "; strong [] [ txt "Continent" ]; txt " will select profiles from "
|
||||
txt "the selected continent, while "; strong [] [ txt "Seeking Remote Work?" ]; txt " will select "
|
||||
txt "profiles based whether the citizen has selected remote work in their profile. "
|
||||
strong [] [ txt "Text Search" ]; txt " will search several aspects of the employment profile for "
|
||||
txt "matches; it is case-insensitive and will match using English stemming rules (ex. searching for "
|
||||
txt "“force” will match words like “force”, “forced”, or "
|
||||
txt "“forcing”)."
|
||||
]
|
||||
p [] [
|
||||
txt "If more than one field has a value selected, profiles must match all of those selections to be "
|
||||
txt "returned. Additionally, “Hidden” profiles will never be returned in searches, and "
|
||||
txt "if no user is logged on, only “Public” and “Anonymous” profiles will be "
|
||||
txt "considered as candidates for search results."
|
||||
]
|
||||
|
||||
h5 [] [ txt "Search Results" ]
|
||||
p [] [
|
||||
txt "If the visibility of the profile allows you to view it, the first column will contain a "
|
||||
span [ linkedPage ] [ txt "View" ]; txt " link. The remaining columns will display other attributes "
|
||||
txt "of the employment profile. In public search results for profiles with “Anonymous” "
|
||||
txt "visibility, the last column of the search results will show the citizen’s skills."
|
||||
]
|
||||
|
||||
h4 [ _id "viewing"; mainHeading ] [ txt "Viewing, Printing, and Sharing Employment Profiles" ]
|
||||
p [] [
|
||||
txt "An employment profile can be viewed via the "; span [ linkedPage ] [ txt "View" ]; txt " link in "
|
||||
txt "search results, and logged-on users can find this view via the "
|
||||
span [ actionButton ] [ txt "View Your Employment Profile" ]; txt " button on the "
|
||||
span [ linkedPage ] [ txt "My Employment Profile" ]; txt " page. The profile view page displays the "
|
||||
txt "following information in order:"
|
||||
]
|
||||
ul [] [
|
||||
li [] [
|
||||
txt "Display Name "; em [] [ txt "(with a tag if the citizen is actively seeking employment)" ]
|
||||
]
|
||||
li [] [ txt "Continent / Region" ]
|
||||
li [] [ txt "Contact Information "; em [] [ txt "(only public items if viewing publicly)" ] ]
|
||||
li [] [ txt "Remote / Full-Time selections" ]
|
||||
li [] [ txt "Professional Biography" ]
|
||||
li [] [ txt "Skill list" ]
|
||||
li [] [ txt "Employment History" ]
|
||||
li [] [ txt "Experience" ]
|
||||
]
|
||||
p [] [
|
||||
txt "If a user is logged on and is viewing their own profile, there will be an "
|
||||
span [ actionButton ] [ txt "Edit Your Profile" ]; txt " button at the bottom of the page. Either way, "
|
||||
txt "there will also be a "; span [ actionButton ] [ txt "View Print Version" ]; txt " button that "
|
||||
txt "will open a printable version in a new browser tab. This version is constructed the same way as "
|
||||
txt "the previous page; however, contact information will be fully displayed rather than linked. There "
|
||||
txt "will be no menu, header, or footer on the page, but there will be a "
|
||||
span [ actionButton ] [ txt "Print" ]; txt " button at the bottom of the page, which will not show on "
|
||||
txt "the actual printed version."
|
||||
]
|
||||
p [] [
|
||||
txt "Both the view and print versions may be shared by copying the full URL from the browser’s "
|
||||
txt "address bar. When using this URL, “Public” visibility profiles will display for "
|
||||
txt "anyone, while “Anonymous” and “Private” visibility profiles will require "
|
||||
txt "a citizen to log on first. “Hidden” visibility profiles will return a “page not "
|
||||
txt "found” error for anyone other than the citizen to which they belong."
|
||||
]
|
||||
|
||||
h4 [ _id "finding"; mainHeading ] [ txt "Finding Employment" ]
|
||||
p [] [
|
||||
txt "If your profile indicates that you are seeking employment, and you secure employment, you will "
|
||||
txt "want to update that (and – congratulations!). From both the "
|
||||
span [ linkedPage ] [ txt "Dashboard" ]; txt " and the "
|
||||
span [ linkedPage ] [ txt "General Information" ]; txt " Employment Profile pages, you will see a link "
|
||||
txt "that encourages you to tell us about it. Click either of those links, and you will be brought to "
|
||||
txt "a page that allows you to indicate whether your employment actually came from hosting your "
|
||||
txt "employment profile on Jobs, Jobs, Jobs, and gives you a place to write about the experience. "
|
||||
txt "These stories are only viewable by logged-on citizens, so feel free to use as much (or as little) "
|
||||
txt "identifying information as you’d like. You can also submit this page with all the fields "
|
||||
txt "blank; in that case, your “Seeking Employment” flag is cleared, and the blank story "
|
||||
txt "is recorded."
|
||||
]
|
||||
p [] [
|
||||
txt "As a validated user, you can also view others’ success stories from both their employment "
|
||||
txt "profiles or job listings. Clicking "; span [ linkedPage ] [ txt "Success Stories" ]; txt " in the "
|
||||
txt "sidebar will display a list of all the stories that have been recorded. If there is a story to be "
|
||||
txt "read, there will be a link to read it; if you submitted the story, there will also be an "
|
||||
span [ linkedPage ] [ txt "Edit" ]; txt " link."
|
||||
]
|
||||
]
|
||||
|> pageWithTitle "How It Works: Employment Profiles"
|
||||
|
||||
/// Online help / documentation index page
|
||||
let index =
|
||||
article [] [
|
||||
h3 [ _class "mb-0" ] [ txt "How It Works" ]
|
||||
h6 [ _class "mb-3 text-muted fst-italic" ] [ txt "Last Updated February 2<sup>nd</sup>, 2023" ]
|
||||
|
||||
p [ _class "fst-italic" ] [
|
||||
txt "Show me how to "; a [ _href "/how-it-works/listings#searching" ] [ txt "find a job" ]
|
||||
txt " • "; a [ _href "/how-it-works/listings#creating" ] [ txt "list a job opportunity" ]
|
||||
txt " • "; a [ _href "/how-it-works/profiles#searching" ] [ txt "find people to hire" ]
|
||||
txt " • "; a [ _href "/how-it-works/profiles#creating" ] [ txt "create an employment profile" ]
|
||||
]
|
||||
|
||||
p [] [
|
||||
strong [] [ a [ _href "/how-it-works/accounts" ] [ txt "Accounts" ] ]; br []
|
||||
txt "How to sign up as a user, get logged on, update your information, or remove your account"
|
||||
]
|
||||
p [] [
|
||||
strong [] [ a [ _href "/how-it-works/listings" ] [ txt "Job Listings" ] ]; br []
|
||||
txt "Creating, maintaining, and sharing job opportunities with fellow citizens"
|
||||
]
|
||||
p [] [
|
||||
strong [] [ a [ _href "/how-it-works/profiles" ] [ txt "Employment Profiles" ] ]; br []
|
||||
txt "Creating, updating, and sharing your own employment profile; and searching, viewing, and printing "
|
||||
txt "profiles for yourself or your fellow citizens"
|
||||
]
|
||||
|
||||
h4 [ _id "markdown"; mainHeading ] [ txt "A Bit about Markdown" ]
|
||||
p [] [
|
||||
txt "Markdown is a plain-text way to specify formatting quite similar to that provided by word processors. "
|
||||
txt "The "
|
||||
a [ _href "https://daringfireball.net/projects/markdown/"; _target "_blank"; _rel "noopener" ] [
|
||||
txt "original page"
|
||||
]; txt " for the project is a good overview of its capabilities, and the pages at "
|
||||
a [ _href "https://www.markdownguide.org/"; _target "_blank"; _rel "noopener" ] [ txt "Markdown Guide" ]
|
||||
txt " give in-depth lessons to make the most of this language. The version of Markdown employed here "
|
||||
txt "supports many popular extensions, include smart quotes (turning "a quote" into “a "
|
||||
txt "quote”), tables, super/subscripts, and more."
|
||||
]
|
||||
|
||||
h4 [ mainHeading ] [ txt "Help / Suggestions" ]
|
||||
p [] [
|
||||
txt "This is open-source software "
|
||||
a [ _href "https://git.bitbadger.solutions/bit-badger/jobs-jobs-jobs"; _target "_blank"
|
||||
_rel "noopener" ] [ txt "developed in Git" ]
|
||||
txt "; feel free to ping @daniel@fedi.summershome.org if you run into any issues."
|
||||
]
|
||||
]
|
||||
|
|
@ -1,60 +0,0 @@
|
|||
module JobsJobsJobs.Listings.Data
|
||||
|
||||
open BitBadger.Npgsql.FSharp.Documents
|
||||
open JobsJobsJobs.Common.Data
|
||||
open JobsJobsJobs.Domain
|
||||
open JobsJobsJobs.Listings.Domain
|
||||
open Npgsql.FSharp
|
||||
|
||||
/// The SQL to select a listing view
|
||||
let viewSql =
|
||||
$"SELECT l.*, c.data ->> 'name' AS continent_name, u.data AS cit_data
|
||||
FROM {Table.Listing} l
|
||||
INNER JOIN {Table.Continent} c ON c.id = l.data ->> 'continentId'
|
||||
INNER JOIN {Table.Citizen} u ON u.id = l.data ->> 'citizenId'"
|
||||
|
||||
/// Map a result for a listing view
|
||||
let private toListingForView row =
|
||||
{ Listing = fromData<Listing> row
|
||||
ContinentName = row.string "continent_name"
|
||||
Citizen = fromDocument<Citizen> "cit_data" row
|
||||
}
|
||||
|
||||
/// Find all job listings posted by the given citizen
|
||||
let findByCitizen citizenId =
|
||||
Custom.list<ListingForView>
|
||||
$"{viewSql} WHERE l.data @> @criteria"
|
||||
[ "@criteria", Query.jsonbDocParam {| citizenId = CitizenId.toString citizenId |} ]
|
||||
toListingForView
|
||||
|
||||
/// Find a listing by its ID
|
||||
let findById listingId =
|
||||
Find.byId<Listing> Table.Listing (ListingId.toString listingId)
|
||||
|
||||
/// Find a listing by its ID for viewing (includes continent information)
|
||||
let findByIdForView listingId =
|
||||
Custom.single<ListingForView>
|
||||
$"{viewSql} WHERE l.id = @id" [ "@id", Sql.string (ListingId.toString listingId) ] toListingForView
|
||||
|
||||
/// Save a listing
|
||||
let save (listing : Listing) =
|
||||
save Table.Listing (ListingId.toString listing.Id) listing
|
||||
|
||||
/// Search job listings
|
||||
let search (search : ListingSearchForm) =
|
||||
let searches = [
|
||||
if search.ContinentId <> "" then
|
||||
"l.data @> @continent", [ "@continent", Query.jsonbDocParam {| continentId = search.ContinentId |} ]
|
||||
if search.Region <> "" then
|
||||
"l.data ->> 'region' ILIKE @region", [ "@region", like search.Region ]
|
||||
if search.RemoteWork <> "" then
|
||||
"l.data @> @remote", [ "@remote", Query.jsonbDocParam {| isRemote = search.RemoteWork = "yes" |} ]
|
||||
if search.Text <> "" then
|
||||
"l.data ->> 'text' ILIKE @text", [ "@text", like search.Text ]
|
||||
]
|
||||
Custom.list<ListingForView>
|
||||
$"""{viewSql}
|
||||
WHERE l.data @> '{{ "isExpired": false }}'::jsonb
|
||||
{searchSql searches}"""
|
||||
(searches |> List.collect snd)
|
||||
toListingForView
|
|
@ -1,94 +0,0 @@
|
|||
module JobsJobsJobs.Listings.Domain
|
||||
|
||||
open JobsJobsJobs.Domain
|
||||
|
||||
/// The data required to add or edit a job listing
|
||||
[<CLIMutable; NoComparison; NoEquality>]
|
||||
type EditListingForm =
|
||||
{ /// The ID of the listing
|
||||
Id : string
|
||||
|
||||
/// The listing title
|
||||
Title : string
|
||||
|
||||
/// The ID of the continent on which this opportunity exists
|
||||
ContinentId : string
|
||||
|
||||
/// The region in which this opportunity exists
|
||||
Region : string
|
||||
|
||||
/// Whether this is a remote work opportunity
|
||||
RemoteWork : bool
|
||||
|
||||
/// The text of the job listing
|
||||
Text : string
|
||||
|
||||
/// The date by which this job listing is needed
|
||||
NeededBy : string
|
||||
}
|
||||
|
||||
/// Support functions to support listings
|
||||
module EditListingForm =
|
||||
|
||||
open NodaTime.Text
|
||||
|
||||
/// Create a listing form from an existing listing
|
||||
let fromListing (listing : Listing) theId =
|
||||
let neededBy =
|
||||
match listing.NeededBy with
|
||||
| Some dt -> (LocalDatePattern.CreateWithCurrentCulture "yyyy-MM-dd").Format dt
|
||||
| None -> ""
|
||||
{ Id = theId
|
||||
Title = listing.Title
|
||||
ContinentId = ContinentId.toString listing.ContinentId
|
||||
Region = listing.Region
|
||||
RemoteWork = listing.IsRemote
|
||||
Text = MarkdownString.toString listing.Text
|
||||
NeededBy = neededBy
|
||||
}
|
||||
|
||||
|
||||
/// The form submitted to expire a listing
|
||||
[<CLIMutable; NoComparison; NoEquality>]
|
||||
type ExpireListingForm =
|
||||
{ /// The ID of the listing to expire
|
||||
Id : string
|
||||
|
||||
/// Whether the job was filled from here
|
||||
FromHere : bool
|
||||
|
||||
/// The success story written by the user
|
||||
SuccessStory : string
|
||||
}
|
||||
|
||||
|
||||
/// The data needed to display a listing
|
||||
[<NoComparison; NoEquality>]
|
||||
type ListingForView =
|
||||
{ /// The listing itself
|
||||
Listing : Listing
|
||||
|
||||
/// The name of the continent for the listing
|
||||
ContinentName : string
|
||||
|
||||
/// The citizen who owns the listing
|
||||
Citizen : Citizen
|
||||
}
|
||||
|
||||
|
||||
/// The various ways job listings can be searched
|
||||
[<CLIMutable; NoComparison; NoEquality>]
|
||||
type ListingSearchForm =
|
||||
{ /// Retrieve job listings for this continent
|
||||
ContinentId : string
|
||||
|
||||
/// Text for a search within a region
|
||||
Region : string
|
||||
|
||||
/// Whether to retrieve job listings for remote work
|
||||
RemoteWork : string
|
||||
|
||||
/// Text for a search with the job listing description
|
||||
Text : string
|
||||
}
|
||||
|
|
@ -1,162 +0,0 @@
|
|||
module JobsJobsJobs.Listings.Handlers
|
||||
|
||||
open System
|
||||
open Giraffe
|
||||
open JobsJobsJobs
|
||||
open JobsJobsJobs.Common.Handlers
|
||||
open JobsJobsJobs.Domain
|
||||
open JobsJobsJobs.Listings.Domain
|
||||
open NodaTime
|
||||
|
||||
/// Parse the string we receive from JSON into a NodaTime local date
|
||||
let private parseDate = DateTime.Parse >> LocalDate.FromDateTime
|
||||
|
||||
// GET: /listing/[id]/edit
|
||||
let edit listId : HttpHandler = requireUser >=> fun next ctx -> task {
|
||||
let citizenId = currentCitizenId ctx
|
||||
let! theListing = task {
|
||||
match listId with
|
||||
| "new" -> return Some { Listing.empty with CitizenId = citizenId }
|
||||
| _ -> return! Data.findById (ListingId.ofString listId)
|
||||
}
|
||||
match theListing with
|
||||
| Some listing when listing.CitizenId = citizenId ->
|
||||
let! continents = Common.Data.Continents.all ()
|
||||
return!
|
||||
Views.edit (EditListingForm.fromListing listing listId) continents (listId = "new") (isHtmx ctx) (csrf ctx)
|
||||
|> render $"""{if listId = "new" then "Add a" else "Edit"} Job Listing""" next ctx
|
||||
| Some _ -> return! Error.notAuthorized next ctx
|
||||
| None -> return! Error.notFound next ctx
|
||||
}
|
||||
|
||||
// GET: /listing/[id]/expire
|
||||
let expire listingId : HttpHandler = requireUser >=> fun next ctx -> task {
|
||||
match! Data.findById (ListingId listingId) with
|
||||
| Some listing when listing.CitizenId = currentCitizenId ctx ->
|
||||
if listing.IsExpired then
|
||||
do! addError $"The listing “{listing.Title}” is already expired" ctx
|
||||
return! redirectToGet "/listings/mine" next ctx
|
||||
else
|
||||
let form = { Id = ListingId.toString listing.Id; FromHere = false; SuccessStory = "" }
|
||||
return! Views.expire form listing (isHtmx ctx) (csrf ctx) |> render "Expire Job Listing" next ctx
|
||||
| Some _ -> return! Error.notAuthorized next ctx
|
||||
| None -> return! Error.notFound next ctx
|
||||
}
|
||||
|
||||
// POST: /listing/expire
|
||||
let doExpire : HttpHandler = requireUser >=> validateCsrf >=> fun next ctx -> task {
|
||||
let citizenId = currentCitizenId ctx
|
||||
let now = now ctx
|
||||
let! form = ctx.BindFormAsync<ExpireListingForm> ()
|
||||
match! Data.findById (ListingId.ofString form.Id) with
|
||||
| Some listing when listing.CitizenId = citizenId ->
|
||||
if listing.IsExpired then
|
||||
return! RequestErrors.BAD_REQUEST "Request is already expired" next ctx
|
||||
else
|
||||
do! Data.save
|
||||
{ listing with
|
||||
IsExpired = true
|
||||
WasFilledHere = Some form.FromHere
|
||||
UpdatedOn = now
|
||||
}
|
||||
if form.SuccessStory <> "" then
|
||||
do! SuccessStories.Data.save
|
||||
{ Id = SuccessId.create()
|
||||
CitizenId = citizenId
|
||||
RecordedOn = now
|
||||
IsFromHere = form.FromHere
|
||||
Source = "listing"
|
||||
Story = (Text >> Some) form.SuccessStory
|
||||
}
|
||||
let extraMsg = if form.SuccessStory <> "" then " and success story recorded" else ""
|
||||
do! addSuccess $"Job listing expired{extraMsg} successfully" ctx
|
||||
return! redirectToGet "/listings/mine" next ctx
|
||||
| Some _ -> return! Error.notAuthorized next ctx
|
||||
| None -> return! Error.notFound next ctx
|
||||
}
|
||||
|
||||
// GET: /listings/mine
|
||||
let mine : HttpHandler = requireUser >=> fun next ctx -> task {
|
||||
let! listings = Data.findByCitizen (currentCitizenId ctx)
|
||||
return! Views.mine listings (timeZone ctx) |> render "My Job Listings" next ctx
|
||||
}
|
||||
|
||||
// POST: /listing/save
|
||||
let save : HttpHandler = requireUser >=> validateCsrf >=> fun next ctx -> task {
|
||||
let citizenId = currentCitizenId ctx
|
||||
let now = now ctx
|
||||
let! form = ctx.BindFormAsync<EditListingForm> ()
|
||||
let! theListing = task {
|
||||
match form.Id with
|
||||
| "new" ->
|
||||
return Some
|
||||
{ Listing.empty with
|
||||
Id = ListingId.create ()
|
||||
CitizenId = currentCitizenId ctx
|
||||
CreatedOn = now
|
||||
IsExpired = false
|
||||
WasFilledHere = None
|
||||
}
|
||||
| _ -> return! Data.findById (ListingId.ofString form.Id)
|
||||
}
|
||||
match theListing with
|
||||
| Some listing when listing.CitizenId = citizenId ->
|
||||
do! Data.save
|
||||
{ listing with
|
||||
Title = form.Title
|
||||
ContinentId = ContinentId.ofString form.ContinentId
|
||||
Region = form.Region
|
||||
IsRemote = form.RemoteWork
|
||||
Text = Text form.Text
|
||||
NeededBy = noneIfEmpty form.NeededBy |> Option.map parseDate
|
||||
UpdatedOn = now
|
||||
}
|
||||
do! addSuccess $"""Job listing {if form.Id = "new" then "add" else "updat"}ed successfully""" ctx
|
||||
return! redirectToGet $"/listing/{ListingId.toString listing.Id}/edit" next ctx
|
||||
| Some _ -> return! Error.notAuthorized next ctx
|
||||
| None -> return! Error.notFound next ctx
|
||||
|
||||
}
|
||||
|
||||
// GET: /help-wanted
|
||||
let search : HttpHandler = requireUser >=> fun next ctx -> task {
|
||||
let! continents = Common.Data.Continents.all ()
|
||||
let form =
|
||||
match ctx.TryBindQueryString<ListingSearchForm> () with
|
||||
| Ok f -> f
|
||||
| Error _ -> { ContinentId = ""; Region = ""; RemoteWork = ""; Text = "" }
|
||||
let! results = task {
|
||||
if string ctx.Request.Query["searched"] = "true" then
|
||||
let! it = Data.search form
|
||||
return Some it
|
||||
else return None
|
||||
}
|
||||
return! Views.search form continents results |> render "Help Wanted" next ctx
|
||||
}
|
||||
|
||||
// GET: /listing/[id]/view
|
||||
let view listingId : HttpHandler = requireUser >=> fun next ctx -> task {
|
||||
match! Data.findByIdForView (ListingId listingId) with
|
||||
| Some listing -> return! Views.view listing |> render $"{listing.Listing.Title} | Job Listing" next ctx
|
||||
| None -> return! Error.notFound next ctx
|
||||
}
|
||||
|
||||
|
||||
open Giraffe.EndpointRouting
|
||||
|
||||
/// All endpoints for this feature
|
||||
let endpoints = [
|
||||
GET_HEAD [ route "/help-wanted" search ]
|
||||
subRoute "/listing" [
|
||||
GET_HEAD [
|
||||
route "s/mine" mine
|
||||
routef "/%s/edit" edit
|
||||
routef "/%O/expire" expire
|
||||
routef "/%O/view" view
|
||||
]
|
||||
POST [
|
||||
route "/expire" doExpire
|
||||
route "/save" save
|
||||
]
|
||||
]
|
||||
]
|
|
@ -1,23 +0,0 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net7.0</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Include="Domain.fs" />
|
||||
<Compile Include="Data.fs" />
|
||||
<Compile Include="Views.fs" />
|
||||
<Compile Include="Handlers.fs" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Common\JobsJobsJobs.Common.fsproj" />
|
||||
<ProjectReference Include="..\SuccessStories\JobsJobsJobs.SuccessStories.fsproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Update="FSharp.Core" Version="8.0.300" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
|
@ -1,234 +0,0 @@
|
|||
/// Views for /profile URLs
|
||||
module JobsJobsJobs.Listings.Views
|
||||
|
||||
open Giraffe.ViewEngine
|
||||
open JobsJobsJobs.Common.Views
|
||||
open JobsJobsJobs.Domain
|
||||
open JobsJobsJobs.Listings.Domain
|
||||
|
||||
|
||||
/// Job listing edit page
|
||||
let edit (m : EditListingForm) continents isNew isHtmx csrf =
|
||||
form [ _class "row g-3"; _method "POST"; _action "/listing/save" ] [
|
||||
antiForgery csrf
|
||||
input [ _type "hidden"; _name (nameof m.Id); _value m.Id ]
|
||||
div [ _class "col-12 col-sm-10 col-md-8 col-lg-6" ] [
|
||||
textBox [ _type "text"; _maxlength "255"; _autofocus ] (nameof m.Title) m.Title "Title" true
|
||||
div [ _class "form-text" ] [
|
||||
txt "No need to put location here; it will always be show to seekers with continent and region"
|
||||
]
|
||||
]
|
||||
div [ _class "col-12 col-sm-6 col-md-4" ] [
|
||||
continentList [] (nameof m.ContinentId) continents None m.ContinentId true
|
||||
]
|
||||
div [ _class "col-12 col-sm-6 col-md-8" ] [
|
||||
textBox [ _type "text"; _maxlength "255" ] (nameof m.Region) m.Region "Region" true
|
||||
div [ _class "form-text" ] [ txt "Country, state, geographic area, etc." ]
|
||||
]
|
||||
div [ _class "col-12" ] [
|
||||
checkBox [] (nameof m.RemoteWork) m.RemoteWork "This opportunity is for remote work"
|
||||
]
|
||||
markdownEditor [ _required ] (nameof m.Text) m.Text "Job Description" isHtmx
|
||||
div [ _class "col-12 col-md-4" ] [
|
||||
textBox [ _type "date" ] (nameof m.NeededBy) m.NeededBy "Needed By" false
|
||||
]
|
||||
div [ _class "col-12" ] [ submitButton "content-save-outline" "Save" ]
|
||||
]
|
||||
|> List.singleton
|
||||
|> pageWithTitle $"""{if isNew then "Add a" else "Edit"} Job Listing"""
|
||||
|
||||
|
||||
open System.Net
|
||||
|
||||
/// Page to expire a job listing
|
||||
let expire (m : ExpireListingForm) (listing : Listing) isHtmx csrf =
|
||||
[ p [ _class "fst-italic" ] [
|
||||
txt "Expiring this listing will remove it from search results. You will be able to see it via your "
|
||||
txt "“My Job Listings” page, but you will not be able to “un-expire” it."
|
||||
]
|
||||
form [ _class "row g-3"; _method "POST"; _action "/listing/expire" ] [
|
||||
antiForgery csrf
|
||||
input [ _type "hidden"; _name (nameof m.Id); _value m.Id ]
|
||||
div [ _class "col-12" ] [
|
||||
checkBox [ _onclick "jjj.listing.toggleFromHere()" ] (nameof m.FromHere) m.FromHere
|
||||
"This job was filled due to its listing here"
|
||||
]
|
||||
div [ _class "col-12"; _id "successRow" ] [
|
||||
p [] [
|
||||
txt "Consider telling your fellow citizens about your experience! Comments entered here will be "
|
||||
txt "visible to logged-on users here, but not to the general public."
|
||||
]
|
||||
]
|
||||
markdownEditor [] (nameof m.SuccessStory) m.SuccessStory "Your Success Story" isHtmx
|
||||
div [ _class "col-12" ] [ submitButton "text-box-remove-outline" "Expire Listing" ]
|
||||
]
|
||||
jsOnLoad "jjj.listing.toggleFromHere()" isHtmx
|
||||
]
|
||||
|> pageWithTitle $"Expire Job Listing ({WebUtility.HtmlEncode listing.Title})"
|
||||
|
||||
|
||||
/// "My Listings" page
|
||||
let mine (listings : ListingForView list) tz =
|
||||
let active = listings |> List.filter (fun it -> not it.Listing.IsExpired)
|
||||
let expired = listings |> List.filter (fun it -> it.Listing.IsExpired)
|
||||
[ p [] [ a [ _href "/listing/new/edit"; _class "btn btn-outline-primary" ] [ txt "Add a New Job Listing" ] ]
|
||||
if not (List.isEmpty expired) then h4 [ _class "pb-2" ] [ txt "Active Job Listings" ]
|
||||
if List.isEmpty active then p [ _class "pb-3 fst-italic" ] [ txt "You have no active job listings" ]
|
||||
else
|
||||
table [ _class "pb-3 table table-sm table-hover pt-3" ] [
|
||||
thead [] [
|
||||
[ "Action"; "Title"; "Continent / Region"; "Created"; "Updated" ]
|
||||
|> List.map (fun it -> th [ _scope "col" ] [ txt it ])
|
||||
|> tr []
|
||||
]
|
||||
active
|
||||
|> List.map (fun it ->
|
||||
let listId = ListingId.toString it.Listing.Id
|
||||
tr [] [
|
||||
td [] [
|
||||
a [ _href $"/listing/{listId}/edit" ] [ txt "Edit" ]; txt " ~ "
|
||||
a [ _href $"/listing/{listId}/view" ] [ txt "View" ]; txt " ~ "
|
||||
a [ _href $"/listing/{listId}/expire" ] [ txt "Expire" ]
|
||||
]
|
||||
td [] [ str it.Listing.Title ]
|
||||
td [] [ str it.ContinentName; rawText " / "; str it.Listing.Region ]
|
||||
td [] [ str (fullDateTime it.Listing.CreatedOn tz) ]
|
||||
td [] [ str (fullDateTime it.Listing.UpdatedOn tz) ]
|
||||
])
|
||||
|> tbody []
|
||||
]
|
||||
if not (List.isEmpty expired) then
|
||||
h4 [ _class "pb-2" ] [ txt "Expired Job Listings" ]
|
||||
table [ _class "table table-sm table-hover pt-3" ] [
|
||||
thead [] [
|
||||
[ "Action"; "Title"; "Filled Here?"; "Expired" ]
|
||||
|> List.map (fun it -> th [ _scope "col" ] [ txt it ])
|
||||
|> tr []
|
||||
]
|
||||
expired
|
||||
|> List.map (fun it ->
|
||||
tr [] [
|
||||
td [] [ a [ _href $"/listing/{ListingId.toString it.Listing.Id}/view" ] [ txt "View" ] ]
|
||||
td [] [ str it.Listing.Title ]
|
||||
td [] [ str (yesOrNo (defaultArg it.Listing.WasFilledHere false)) ]
|
||||
td [] [ str (fullDateTime it.Listing.UpdatedOn tz) ]
|
||||
])
|
||||
|> tbody []
|
||||
]
|
||||
]
|
||||
|> pageWithTitle "My Job Listings"
|
||||
|
||||
open NodaTime.Text
|
||||
|
||||
/// Format the needed by date
|
||||
let private neededBy dt =
|
||||
(LocalDatePattern.CreateWithCurrentCulture "MMMM d, yyyy").Format dt
|
||||
|
||||
let search (m : ListingSearchForm) continents (listings : ListingForView list option) =
|
||||
[ if Option.isNone listings then
|
||||
p [] [
|
||||
txt "Enter relevant criteria to find results, or just click “Search” to see all active job "
|
||||
txt "listings."
|
||||
]
|
||||
collapsePanel "Search Criteria" (List.isEmpty (defaultArg listings [])) [
|
||||
form [ _class "container"; _method "GET"; _action "/help-wanted" ] [
|
||||
input [ _type "hidden"; _name "searched"; _value "true" ]
|
||||
div [ _class "row" ] [
|
||||
div [ _class "col-12 col-sm-6 col-md-4 col-lg-3" ] [
|
||||
continentList [] "ContinentId" continents (Some "Any") m.ContinentId false
|
||||
]
|
||||
div [ _class "col-12 col-sm-6 col-md-4 col-lg-3" ] [
|
||||
textBox [ _maxlength "1000" ] (nameof m.Region) m.Region "Region" false
|
||||
div [ _class "form-text" ] [ txt "(free-form text)" ]
|
||||
]
|
||||
div [ _class "col-12 col-sm-6 col-offset-md-2 col-lg-3 col-offset-lg-0" ] [
|
||||
label [ _class "jjj-label" ] [ txt "Seeking Remote Work?" ]; br []
|
||||
div [ _class "form-check form-check-inline" ] [
|
||||
input [ _type "radio"; _id "remoteNull"; _name (nameof m.RemoteWork); _value ""
|
||||
_class "form-check-input"; if m.RemoteWork = "" then _checked ]
|
||||
label [ _class "form-check-label"; _for "remoteNull" ] [ txt "No Selection" ]
|
||||
]
|
||||
div [ _class "form-check form-check-inline" ] [
|
||||
input [ _type "radio"; _id "remoteYes"; _name (nameof m.RemoteWork); _value "yes"
|
||||
_class "form-check-input"; if m.RemoteWork = "yes" then _checked ]
|
||||
label [ _class "form-check-label"; _for "remoteYes" ] [ txt "Yes" ]
|
||||
]
|
||||
div [ _class "form-check form-check-inline" ] [
|
||||
input [ _type "radio"; _id "remoteNo"; _name (nameof m.RemoteWork); _value "no"
|
||||
_class "form-check-input"; if m.RemoteWork = "no" then _checked ]
|
||||
label [ _class "form-check-label"; _for "remoteNo" ] [ txt "No" ]
|
||||
]
|
||||
]
|
||||
div [ _class "col-12 col-sm-6 col-lg-3" ] [
|
||||
textBox [ _maxlength "1000" ] (nameof m.Text) m.Text "Job Listing Text" false
|
||||
div [ _class "form-text" ] [ txt "(free-form text)" ]
|
||||
]
|
||||
]
|
||||
div [ _class "row" ] [
|
||||
div [ _class "col" ] [
|
||||
br []
|
||||
button [ _type "submit"; _class "btn btn-outline-primary" ] [ txt "Search" ]
|
||||
]
|
||||
]
|
||||
]
|
||||
]
|
||||
match listings with
|
||||
| Some r when List.isEmpty r ->
|
||||
p [ _class "pt-3" ] [ txt "No job listings found for the specified criteria" ]
|
||||
| Some r ->
|
||||
table [ _class "table table-sm table-hover pt-3" ] [
|
||||
thead [] [
|
||||
tr [] [
|
||||
th [ _scope "col" ] [ txt "Listing" ]
|
||||
th [ _scope "col" ] [ txt "Title" ]
|
||||
th [ _scope "col" ] [ txt "Location" ]
|
||||
th [ _scope "col"; _class "text-center" ] [ txt "Remote?" ]
|
||||
th [ _scope "col"; _class "text-center" ] [ txt "Needed By" ]
|
||||
]
|
||||
]
|
||||
r |> List.map (fun it ->
|
||||
tr [] [
|
||||
td [] [ a [ _href $"/listing/{ListingId.toString it.Listing.Id}/view" ] [ txt "View" ] ]
|
||||
td [] [ str it.Listing.Title ]
|
||||
td [] [ str it.ContinentName; rawText " / "; str it.Listing.Region ]
|
||||
td [ _class "text-center" ] [ str (yesOrNo it.Listing.IsRemote) ]
|
||||
td [ _class "text-center" ] [
|
||||
match it.Listing.NeededBy with Some needed -> str (neededBy needed) | None -> txt "N/A"
|
||||
]
|
||||
])
|
||||
|> tbody []
|
||||
]
|
||||
| None -> ()
|
||||
]
|
||||
|> pageWithTitle "Help Wanted"
|
||||
|
||||
/// The job listing view page
|
||||
let view (it : ListingForView) =
|
||||
article [] [
|
||||
h3 [ _class "mb-1" ] [
|
||||
str it.Listing.Title
|
||||
if it.Listing.IsExpired then
|
||||
span [ _class "jjj-heading-label" ] [
|
||||
txt " "; span [ _class "badge bg-warning text-dark" ] [ txt "Expired" ]
|
||||
if defaultArg it.Listing.WasFilledHere false then
|
||||
txt " "; span [ _class "badge bg-success" ] [ txt "Filled via Jobs, Jobs, Jobs" ]
|
||||
]
|
||||
]
|
||||
h4 [ _class "mb-3 text-muted" ] [
|
||||
str $"{it.ContinentName} / {it.Listing.Region}"
|
||||
if it.Listing.IsRemote then
|
||||
span [ _class "jjj-heading-label" ] [
|
||||
txt " "; span [ _class "badge text-bg-info" ] [ txt "Remote" ]
|
||||
]
|
||||
]
|
||||
p [] [
|
||||
match it.Listing.NeededBy with
|
||||
| Some needed ->
|
||||
strong [] [ em [] [ txt "NEEDED BY "; str ((neededBy needed).ToUpperInvariant ()) ] ]; br [] // txt " • "
|
||||
| None -> ()
|
||||
txt "Listed by "; strong [ _class "me-4" ] [ str (Citizen.name it.Citizen) ]; br []
|
||||
span [ _class "ms-3" ] []; yield! contactInfo it.Citizen false
|
||||
]
|
||||
hr []
|
||||
div [] [ md2html it.Listing.Text ]
|
||||
]
|
|
@ -1,70 +0,0 @@
|
|||
module JobsJobsJobs.Profiles.Data
|
||||
|
||||
open BitBadger.Npgsql.FSharp.Documents
|
||||
open JobsJobsJobs.Common.Data
|
||||
open JobsJobsJobs.Domain
|
||||
open JobsJobsJobs.Profiles.Domain
|
||||
open Npgsql.FSharp
|
||||
|
||||
/// Count the current profiles
|
||||
let count () =
|
||||
Count.all Table.Profile
|
||||
|
||||
/// Delete a profile by its ID
|
||||
let deleteById citizenId =
|
||||
Delete.byId Table.Profile (CitizenId.toString citizenId)
|
||||
|
||||
/// Find a profile by citizen ID
|
||||
let findById citizenId =
|
||||
Find.byId<Profile> Table.Profile (CitizenId.toString citizenId)
|
||||
|
||||
/// Convert a data row to a profile for viewing
|
||||
let private toProfileForView row =
|
||||
{ Profile = fromData<Profile> row
|
||||
Citizen = fromDocument<Citizen> "cit_data" row
|
||||
Continent = fromDocument<Continent> "cont_data" row
|
||||
}
|
||||
|
||||
/// Find a profile by citizen ID for viewing (includes citizen and continent information)
|
||||
let findByIdForView citizenId =
|
||||
Custom.single<ProfileForView>
|
||||
$"SELECT p.*, c.data AS cit_data, o.data AS cont_data
|
||||
FROM {Table.Profile} p
|
||||
INNER JOIN {Table.Citizen} c ON c.id = p.id
|
||||
INNER JOIN {Table.Continent} o ON o.id = p.data ->> 'continentId'
|
||||
WHERE p.id = @id"
|
||||
[ "@id", Sql.string (CitizenId.toString citizenId) ]
|
||||
toProfileForView
|
||||
|
||||
/// Save a profile
|
||||
let save (profile : Profile) =
|
||||
save Table.Profile (CitizenId.toString profile.Id) profile
|
||||
|
||||
/// Search profiles
|
||||
let search (search : ProfileSearchForm) isPublic = backgroundTask {
|
||||
let searches = [
|
||||
if search.ContinentId <> "" then
|
||||
"p.data @> @continent", [ "@continent", Query.jsonbDocParam {| continentId = search.ContinentId |} ]
|
||||
if search.RemoteWork <> "" then
|
||||
"p.data @> @remote", [ "@remote", Query.jsonbDocParam {| isRemote = search.RemoteWork = "yes" |} ]
|
||||
if search.Text <> "" then
|
||||
"p.text_search @@ plainto_tsquery(@text_search)", [ "@text_search", Sql.string search.Text ]
|
||||
]
|
||||
let vizSql =
|
||||
if isPublic then
|
||||
sprintf "(p.data @> '%s'::jsonb OR p.data @> '%s'::jsonb)"
|
||||
(Configuration.serializer().Serialize {| visibility = ProfileVisibility.toString Public |})
|
||||
(Configuration.serializer().Serialize {| visibility = ProfileVisibility.toString Anonymous |})
|
||||
else sprintf "p.data ->> 'visibility' <> '%s'" (ProfileVisibility.toString Hidden)
|
||||
let! results =
|
||||
Custom.list<ProfileForView>
|
||||
$" SELECT p.*, c.data AS cit_data, o.data AS cont_data
|
||||
FROM {Table.Profile} p
|
||||
INNER JOIN {Table.Citizen} c ON c.id = p.id
|
||||
INNER JOIN {Table.Continent} o ON o.id = p.data ->> 'continentId'
|
||||
WHERE {vizSql}
|
||||
{searchSql searches}"
|
||||
(searches |> List.collect snd)
|
||||
toProfileForView
|
||||
return results |> List.sortBy (fun pfv -> (Citizen.name pfv.Citizen).ToLowerInvariant ())
|
||||
}
|
|
@ -1,206 +0,0 @@
|
|||
module JobsJobsJobs.Profiles.Domain
|
||||
|
||||
open JobsJobsJobs.Domain
|
||||
open NodaTime
|
||||
|
||||
/// The data required to update a profile
|
||||
[<CLIMutable; NoComparison; NoEquality>]
|
||||
type EditProfileForm =
|
||||
{ /// The ID of the continent on which the citizen is located
|
||||
ContinentId : string
|
||||
|
||||
/// The area within that continent where the citizen is located
|
||||
Region : string
|
||||
|
||||
/// Whether the citizen to whom this profile belongs is actively seeking employment
|
||||
IsSeekingEmployment : bool
|
||||
|
||||
/// If the citizen is available for remote work
|
||||
RemoteWork : bool
|
||||
|
||||
/// If the citizen is seeking full-time employment
|
||||
FullTime : bool
|
||||
|
||||
/// The user's professional biography
|
||||
Biography : string
|
||||
|
||||
/// The user's past experience
|
||||
Experience : string option
|
||||
|
||||
/// The visibility for this profile
|
||||
Visibility : string
|
||||
}
|
||||
|
||||
/// Support functions for the ProfileForm type
|
||||
module EditProfileForm =
|
||||
|
||||
/// An empty view model (used for new profiles)
|
||||
let empty =
|
||||
{ ContinentId = ""
|
||||
Region = ""
|
||||
IsSeekingEmployment = false
|
||||
RemoteWork = false
|
||||
FullTime = false
|
||||
Biography = ""
|
||||
Experience = None
|
||||
Visibility = ProfileVisibility.toString Private
|
||||
}
|
||||
|
||||
/// Create an instance of this form from the given profile
|
||||
let fromProfile (profile : Profile) =
|
||||
{ ContinentId = ContinentId.toString profile.ContinentId
|
||||
Region = profile.Region
|
||||
IsSeekingEmployment = profile.IsSeekingEmployment
|
||||
RemoteWork = profile.IsRemote
|
||||
FullTime = profile.IsFullTime
|
||||
Biography = MarkdownString.toString profile.Biography
|
||||
Experience = profile.Experience |> Option.map MarkdownString.toString
|
||||
Visibility = ProfileVisibility.toString profile.Visibility
|
||||
}
|
||||
|
||||
|
||||
/// The form used to add or edit employment history entries
|
||||
[<CLIMutable; NoComparison; NoEquality>]
|
||||
type HistoryForm =
|
||||
{ /// The name of the employer
|
||||
Employer : string
|
||||
|
||||
StartDate : string
|
||||
|
||||
EndDate : string
|
||||
|
||||
Position : string
|
||||
|
||||
Description : string
|
||||
}
|
||||
|
||||
/// Support functions for the employment history form
|
||||
module HistoryForm =
|
||||
|
||||
open System
|
||||
|
||||
/// The date format expected by the browser's date input field
|
||||
let dateFormat = Text.LocalDatePattern.CreateWithInvariantCulture "yyyy-MM-dd"
|
||||
|
||||
/// Create an employment history form from an employment history entry
|
||||
let fromHistory (history : EmploymentHistory) =
|
||||
{ Employer = history.Employer
|
||||
StartDate = dateFormat.Format history.StartDate
|
||||
EndDate = match history.EndDate with Some dt -> dateFormat.Format dt | None -> ""
|
||||
Position = defaultArg history.Position ""
|
||||
Description = match history.Description with Some d -> MarkdownString.toString d | None -> ""
|
||||
}
|
||||
|
||||
/// Create an employment history entry from an employment history form
|
||||
let toHistory (history : HistoryForm) : EmploymentHistory =
|
||||
{ Employer = history.Employer
|
||||
StartDate = (dateFormat.Parse history.StartDate).Value
|
||||
EndDate = if history.EndDate = "" then None else Some (dateFormat.Parse history.EndDate).Value
|
||||
Position = if history.Position = "" then None else Some history.Position
|
||||
Description = if history.Description = "" then None else Some (Text history.Description)
|
||||
}
|
||||
|
||||
|
||||
/// The various ways profiles can be searched
|
||||
[<CLIMutable; NoComparison; NoEquality>]
|
||||
type ProfileSearchForm =
|
||||
{ /// Retrieve citizens from this continent
|
||||
ContinentId : string
|
||||
|
||||
/// Whether to retrieve citizens who do or do not want remote work
|
||||
RemoteWork : string
|
||||
|
||||
/// Text for a search within a citizen's region, professional bio, skills, experience, and employment history
|
||||
Text : string
|
||||
}
|
||||
|
||||
|
||||
/// A user matching the profile search
|
||||
[<NoComparison; NoEquality>]
|
||||
type ProfileSearchResult =
|
||||
{ /// The ID of the citizen
|
||||
CitizenId : CitizenId
|
||||
|
||||
/// The citizen's display name
|
||||
DisplayName : string
|
||||
|
||||
/// Whether this citizen is currently seeking employment
|
||||
SeekingEmployment : bool
|
||||
|
||||
/// Whether this citizen is looking for remote work
|
||||
RemoteWork : bool
|
||||
|
||||
/// Whether this citizen is looking for full-time work
|
||||
FullTime : bool
|
||||
|
||||
/// When this profile was last updated
|
||||
LastUpdatedOn : Instant
|
||||
}
|
||||
|
||||
|
||||
/// The data required to show a viewable profile
|
||||
type ProfileForView =
|
||||
{ /// The profile itself
|
||||
Profile : Profile
|
||||
|
||||
/// The citizen to whom the profile belongs
|
||||
Citizen : Citizen
|
||||
|
||||
/// The continent for the profile
|
||||
Continent : Continent
|
||||
}
|
||||
|
||||
|
||||
/// The parameters for a public job search
|
||||
[<CLIMutable; NoComparison; NoEquality>]
|
||||
type PublicSearchForm =
|
||||
{ /// Retrieve citizens from this continent
|
||||
ContinentId : string
|
||||
|
||||
/// Retrieve citizens from this region
|
||||
Region : string
|
||||
|
||||
/// Text for a search within a citizen's skills
|
||||
Skill : string
|
||||
|
||||
/// Whether to retrieve citizens who do or do not want remote work
|
||||
RemoteWork : string
|
||||
}
|
||||
|
||||
|
||||
/// A public profile search result
|
||||
[<NoComparison; NoEquality>]
|
||||
type PublicSearchResult =
|
||||
{ /// The name of the continent on which the citizen resides
|
||||
Continent : string
|
||||
|
||||
/// The region in which the citizen resides
|
||||
Region : string
|
||||
|
||||
/// Whether this citizen is seeking remote work
|
||||
RemoteWork : bool
|
||||
|
||||
/// The skills this citizen has identified
|
||||
Skills : string list
|
||||
}
|
||||
|
||||
|
||||
/// The fields required for a skill
|
||||
[<CLIMutable; NoComparison; NoEquality>]
|
||||
type SkillForm =
|
||||
{ Description : string
|
||||
|
||||
/// Notes regarding the skill
|
||||
Notes : string
|
||||
}
|
||||
|
||||
/// Functions to support skill forms
|
||||
module SkillForm =
|
||||
|
||||
/// Create a skill form from a skill
|
||||
let fromSkill (skill : Skill) =
|
||||
{ SkillForm.Description = skill.Description; Notes = defaultArg skill.Notes "" }
|
||||
|
||||
/// Create a skill from a skill form
|
||||
let toSkill (form : SkillForm) =
|
||||
{ Skill.Description = form.Description; Notes = if form.Notes = "" then None else Some form.Notes }
|
|
@ -1,259 +0,0 @@
|
|||
module JobsJobsJobs.Profiles.Handlers
|
||||
|
||||
open Giraffe
|
||||
open JobsJobsJobs
|
||||
open JobsJobsJobs.Common.Handlers
|
||||
open JobsJobsJobs.Domain
|
||||
open JobsJobsJobs.Profiles.Domain
|
||||
|
||||
// POST: /profile/delete
|
||||
let delete : HttpHandler = requireUser >=> validateCsrf >=> fun next ctx -> task {
|
||||
do! Data.deleteById (currentCitizenId ctx)
|
||||
do! addSuccess "Profile deleted successfully" ctx
|
||||
return! redirectToGet "/citizen/dashboard" next ctx
|
||||
}
|
||||
|
||||
// GET: /profile/edit
|
||||
let edit : HttpHandler = requireUser >=> fun next ctx -> task {
|
||||
let citizenId = currentCitizenId ctx
|
||||
let! profile = Data.findById citizenId
|
||||
let display = match profile with Some p -> p | None -> { Profile.empty with Id = citizenId }
|
||||
return! Views.edit display |> render "Employment Profile" next ctx
|
||||
}
|
||||
|
||||
// GET: /profile/edit/general
|
||||
let editGeneralInfo : HttpHandler = requireUser >=> fun next ctx -> task {
|
||||
let! profile = Data.findById (currentCitizenId ctx)
|
||||
let! continents = Common.Data.Continents.all ()
|
||||
let form = if Option.isNone profile then EditProfileForm.empty else EditProfileForm.fromProfile profile.Value
|
||||
return!
|
||||
Views.editGeneralInfo form continents (isHtmx ctx) (csrf ctx)
|
||||
|> render "General Information | Employment Profile" next ctx
|
||||
}
|
||||
|
||||
// POST: /profile/save
|
||||
let saveGeneralInfo : HttpHandler = requireUser >=> fun next ctx -> task {
|
||||
let citizenId = currentCitizenId ctx
|
||||
let! form = ctx.BindFormAsync<EditProfileForm> ()
|
||||
let errors = [
|
||||
if form.ContinentId = "" then "Continent is required"
|
||||
if form.Region = "" then "Region is required"
|
||||
if form.Biography = "" then "Professional Biography is required"
|
||||
]
|
||||
let! profile = task {
|
||||
match! Data.findById citizenId with
|
||||
| Some p -> return p
|
||||
| None -> return { Profile.empty with Id = citizenId }
|
||||
}
|
||||
let isNew = profile.Region = ""
|
||||
if List.isEmpty errors then
|
||||
do! Data.save
|
||||
{ profile with
|
||||
ContinentId = ContinentId.ofString form.ContinentId
|
||||
Region = form.Region
|
||||
IsSeekingEmployment = form.IsSeekingEmployment
|
||||
IsRemote = form.RemoteWork
|
||||
IsFullTime = form.FullTime
|
||||
Biography = Text form.Biography
|
||||
LastUpdatedOn = now ctx
|
||||
Experience = noneIfBlank form.Experience |> Option.map Text
|
||||
Visibility = ProfileVisibility.parse form.Visibility
|
||||
}
|
||||
let action = if isNew then "cre" else "upd"
|
||||
do! addSuccess $"Employment Profile {action}ated successfully" ctx
|
||||
return! redirectToGet "/profile/edit" next ctx
|
||||
else
|
||||
do! addErrors errors ctx
|
||||
let! continents = Common.Data.Continents.all ()
|
||||
return!
|
||||
Views.editGeneralInfo form continents (isHtmx ctx) (csrf ctx)
|
||||
|> render "General Information | Employment Profile" next ctx
|
||||
}
|
||||
|
||||
// GET: /profile/search
|
||||
let search : HttpHandler = fun next ctx -> task {
|
||||
let! continents = Common.Data.Continents.all ()
|
||||
let form =
|
||||
match ctx.TryBindQueryString<ProfileSearchForm> () with
|
||||
| Ok f -> f
|
||||
| Error _ -> { ContinentId = ""; RemoteWork = ""; Text = "" }
|
||||
let isPublic = tryUser ctx |> Option.isNone
|
||||
let! results = task {
|
||||
if string ctx.Request.Query["searched"] = "true" then
|
||||
let! it = Data.search form isPublic
|
||||
return Some it
|
||||
else return None
|
||||
}
|
||||
return! Views.search form continents (timeZone ctx) results isPublic |> render "Profile Search" next ctx
|
||||
}
|
||||
|
||||
// GET: /profile/edit/skills
|
||||
let skills : HttpHandler = requireUser >=> fun next ctx -> task {
|
||||
match! Data.findById (currentCitizenId ctx) with
|
||||
| Some profile -> return! Views.skills profile.Skills (csrf ctx) |> render "Skills | Employment Profile" next ctx
|
||||
| None -> return! notFound ctx
|
||||
}
|
||||
|
||||
// GET: /profile/edit/skills/list
|
||||
let skillList : HttpHandler = requireUser >=> fun next ctx -> task {
|
||||
match! Data.findById (currentCitizenId ctx) with
|
||||
| Some profile -> return! Views.skillTable profile.Skills None (csrf ctx) |> renderBare next ctx
|
||||
| None -> return! notFound ctx
|
||||
}
|
||||
|
||||
// GET: /profile/edit/skill/[idx]
|
||||
let editSkill idx : HttpHandler = requireUser >=> fun next ctx -> task {
|
||||
match! Data.findById (currentCitizenId ctx) with
|
||||
| Some profile ->
|
||||
if idx < -1 || idx >= List.length profile.Skills then return! notFound ctx
|
||||
else return! Views.editSkill profile.Skills idx (csrf ctx) |> renderBare next ctx
|
||||
| None -> return! notFound ctx
|
||||
}
|
||||
|
||||
// POST: /profile/edit/skill/[idx]
|
||||
let saveSkill idx : HttpHandler = requireUser >=> validateCsrf >=> fun next ctx -> task {
|
||||
match! Data.findById (currentCitizenId ctx) with
|
||||
| Some profile ->
|
||||
if idx < -1 || idx >= List.length profile.Skills then return! notFound ctx
|
||||
else
|
||||
let! form = ctx.BindFormAsync<SkillForm> ()
|
||||
let skill = SkillForm.toSkill form
|
||||
let skills =
|
||||
if idx = -1 then skill :: profile.Skills
|
||||
else profile.Skills |> List.mapi (fun skillIdx it -> if skillIdx = idx then skill else it)
|
||||
|> List.sortBy (fun it -> it.Description.ToLowerInvariant ())
|
||||
do! Data.save { profile with Skills = skills }
|
||||
return! Views.skillTable skills None (csrf ctx) |> renderBare next ctx
|
||||
| None -> return! notFound ctx
|
||||
}
|
||||
|
||||
// POST: /profile/edit/skill/[idx]/delete
|
||||
let deleteSkill idx : HttpHandler = requireUser >=> validateCsrf >=> fun next ctx -> task {
|
||||
match! Data.findById (currentCitizenId ctx) with
|
||||
| Some profile ->
|
||||
if idx < 0 || idx >= List.length profile.Skills then return! notFound ctx
|
||||
else
|
||||
let skills = profile.Skills |> List.indexed |> List.filter (fun it -> fst it <> idx) |> List.map snd
|
||||
do! Data.save { profile with Skills = skills }
|
||||
return! Views.skillTable skills None (csrf ctx) |> renderBare next ctx
|
||||
| None -> return! notFound ctx
|
||||
}
|
||||
|
||||
// GET: /profile/edit/history
|
||||
let history : HttpHandler = requireUser >=> fun next ctx -> task {
|
||||
match! Data.findById (currentCitizenId ctx) with
|
||||
| Some profile ->
|
||||
return!
|
||||
Views.history profile.History (isHtmx ctx) (csrf ctx)
|
||||
|> render "Employment History | Employment Profile" next ctx
|
||||
| None -> return! notFound ctx
|
||||
}
|
||||
|
||||
// GET: /profile/edit/history/list
|
||||
let historyList : HttpHandler = requireUser >=> fun next ctx -> task {
|
||||
match! Data.findById (currentCitizenId ctx) with
|
||||
| Some profile -> return! Views.historyTable profile.History None (isHtmx ctx) (csrf ctx) |> renderBare next ctx
|
||||
| None -> return! notFound ctx
|
||||
}
|
||||
|
||||
// GET: /profile/edit/history/[idx]
|
||||
let editHistory idx : HttpHandler = requireUser >=> fun next ctx -> task {
|
||||
match! Data.findById (currentCitizenId ctx) with
|
||||
| Some profile ->
|
||||
if idx < -1 || idx >= List.length profile.History then return! notFound ctx
|
||||
else return! Views.editHistory profile.History idx (isHtmx ctx) (csrf ctx) |> renderBare next ctx
|
||||
| None -> return! notFound ctx
|
||||
}
|
||||
|
||||
// POST: /profile/edit/history/[idx]
|
||||
let saveHistory idx : HttpHandler = requireUser >=> validateCsrf >=> fun next ctx -> task {
|
||||
match! Data.findById (currentCitizenId ctx) with
|
||||
| Some profile ->
|
||||
if idx < -1 || idx >= List.length profile.History then return! notFound ctx
|
||||
else
|
||||
let! form = ctx.BindFormAsync<HistoryForm> ()
|
||||
let entry = HistoryForm.toHistory form
|
||||
let history =
|
||||
if idx = -1 then entry :: profile.History
|
||||
else profile.History |> List.mapi (fun histIdx it -> if histIdx = idx then entry else it)
|
||||
|> List.sortByDescending (fun it -> defaultArg it.EndDate NodaTime.LocalDate.MaxIsoValue)
|
||||
do! Data.save { profile with History = history }
|
||||
return! Views.historyTable history None (isHtmx ctx) (csrf ctx) |> renderBare next ctx
|
||||
| None -> return! notFound ctx
|
||||
}
|
||||
|
||||
// POST: /profile/edit/history/[idx]/delete
|
||||
let deleteHistory idx : HttpHandler = requireUser >=> validateCsrf >=> fun next ctx -> task {
|
||||
match! Data.findById (currentCitizenId ctx) with
|
||||
| Some profile ->
|
||||
if idx < 0 || idx >= List.length profile.History then return! notFound ctx
|
||||
else
|
||||
let history = profile.History |> List.indexed |> List.filter (fun it -> fst it <> idx) |> List.map snd
|
||||
do! Data.save { profile with History = history }
|
||||
return! Views.historyTable history None (isHtmx ctx) (csrf ctx) |> renderBare next ctx
|
||||
| None -> return! notFound ctx
|
||||
}
|
||||
|
||||
/// Get a profile for view, and enforce visibility restrictions against the current user
|
||||
let private getProfileForView citizenId ctx = task {
|
||||
let citId = CitizenId citizenId
|
||||
match! Data.findByIdForView citId with
|
||||
| Some profile ->
|
||||
let currentCitizen = tryUser ctx |> Option.map CitizenId.ofString
|
||||
let canView =
|
||||
match profile.Profile.Visibility, currentCitizen with
|
||||
| Private, Some _
|
||||
| Anonymous, Some _
|
||||
| Public, _ -> true
|
||||
| Hidden, Some citizenId when profile.Citizen.Id = citizenId -> true
|
||||
| _ -> false
|
||||
return if canView then Some (profile, currentCitizen) else None
|
||||
| None -> return None
|
||||
}
|
||||
|
||||
// GET: /profile/[id]/view
|
||||
let view citizenId : HttpHandler = fun next ctx -> task {
|
||||
match! getProfileForView citizenId ctx with
|
||||
| Some (profile, currentCitizen) ->
|
||||
let title = $"Employment Profile for {Citizen.name profile.Citizen}"
|
||||
return! Views.view profile currentCitizen |> render title next ctx
|
||||
| None -> return! notFound ctx
|
||||
}
|
||||
|
||||
// GET: /profile/[id]/print
|
||||
let print citizenId : HttpHandler = fun next ctx -> task {
|
||||
match! getProfileForView citizenId ctx with
|
||||
| Some (profile, currentCitizen) ->
|
||||
let pageTitle = $"Employment Profile for {Citizen.name profile.Citizen}"
|
||||
return! Views.print profile (Option.isNone currentCitizen) |> renderPrint pageTitle next ctx
|
||||
| None -> return! notFound ctx
|
||||
}
|
||||
|
||||
|
||||
open Giraffe.EndpointRouting
|
||||
|
||||
/// All endpoints for this feature
|
||||
let endpoints =
|
||||
subRoute "/profile" [
|
||||
GET_HEAD [
|
||||
routef "/%O/view" view
|
||||
routef "/%O/print" print
|
||||
route "/edit" edit
|
||||
route "/edit/general" editGeneralInfo
|
||||
routef "/edit/history/%i" editHistory
|
||||
route "/edit/history" history
|
||||
route "/edit/history/list" historyList
|
||||
routef "/edit/skill/%i" editSkill
|
||||
route "/edit/skills" skills
|
||||
route "/edit/skills/list" skillList
|
||||
route "/search" search
|
||||
]
|
||||
POST [
|
||||
route "/delete" delete
|
||||
routef "/edit/history/%i" saveHistory
|
||||
routef "/edit/history/%i/delete" deleteHistory
|
||||
routef "/edit/skill/%i" saveSkill
|
||||
routef "/edit/skill/%i/delete" deleteSkill
|
||||
route "/save" saveGeneralInfo
|
||||
]
|
||||
]
|
|
@ -1,22 +0,0 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net7.0</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Include="Domain.fs" />
|
||||
<Compile Include="Data.fs" />
|
||||
<Compile Include="Views.fs" />
|
||||
<Compile Include="Handlers.fs" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Common\JobsJobsJobs.Common.fsproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Update="FSharp.Core" Version="8.0.300" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
|
@ -1,566 +0,0 @@
|
|||
/// Views for /profile URLs
|
||||
module JobsJobsJobs.Profiles.Views
|
||||
|
||||
open Giraffe.Htmx.Common
|
||||
open Giraffe.ViewEngine
|
||||
open Giraffe.ViewEngine.Htmx
|
||||
open JobsJobsJobs.Common.Views
|
||||
open JobsJobsJobs.Domain
|
||||
open JobsJobsJobs.Profiles.Domain
|
||||
|
||||
// ~~~ PROFILE EDIT ~~~ //
|
||||
|
||||
/// The profile edit menu page
|
||||
let edit (profile : Profile) =
|
||||
let hasProfile = profile.Region <> ""
|
||||
pageWithTitle "Employment Profile" [
|
||||
p [] [ txt "There are three different sections to the employment profile." ]
|
||||
ul [] [
|
||||
li [ _class "mb-2" ] [
|
||||
a [ _href $"/profile/edit/general" ] [ strong [] [ txt "General Information" ] ]; br []
|
||||
txt "contains your location, professional biography, and information about the type of employment you "
|
||||
txt "may be seeking."
|
||||
if not hasProfile then txt " Entering information here will create your profile."
|
||||
]
|
||||
if hasProfile then
|
||||
li [ _class "mb-2" ] [
|
||||
let skillCount = List.length profile.Skills
|
||||
a [ _href $"/profile/edit/skills" ] [ strong [] [ txt "Skills" ] ]; br []
|
||||
txt "is where you can list skills you have acquired through education or experience."
|
||||
em [] [
|
||||
txt $" (Your profile currently lists {skillCount} skill"; if skillCount <> 1 then txt "s"
|
||||
txt ".)"
|
||||
]
|
||||
]
|
||||
li [ _class "mb-2" ] [
|
||||
let historyCount = List.length profile.History
|
||||
a [ _href $"/profile/edit/history" ] [ strong [] [ txt "Employment History" ] ]; br []
|
||||
txt "is where you can record a chronological history of your employment."
|
||||
em [] [
|
||||
txt $" (Your profile contains {historyCount} employment history entr"
|
||||
txt (if historyCount <> 1 then "ies" else "y"); txt ".)"
|
||||
]
|
||||
]
|
||||
]
|
||||
if hasProfile then
|
||||
p [] [
|
||||
a [ _class "btn btn-primary"; _href $"/profile/{CitizenId.toString profile.Id}/view" ] [
|
||||
i [ _class "mdi mdi-file-account-outline" ] []; txt " View Your Employment Profile"
|
||||
]
|
||||
]
|
||||
hr []
|
||||
p [ _class "text-muted" ] [
|
||||
txt "If you want to delete your profile, or your entire account, "
|
||||
a [ _href "/citizen/so-long" ] [ txt "see your deletion options here" ]; txt "."
|
||||
]
|
||||
]
|
||||
|
||||
|
||||
/// A link to allow the user to return to the profile edit menu page
|
||||
let backToEdit =
|
||||
p [ _class "mx-3" ] [ a [ _href "/profile/edit" ] [ txt "« Back to Profile Edit Menu" ] ]
|
||||
|
||||
|
||||
/// The profile edit page
|
||||
let editGeneralInfo (m : EditProfileForm) continents isHtmx csrf =
|
||||
pageWithTitle "Employment Profile: General Information" [
|
||||
backToEdit
|
||||
form [ _class "row g-3"; _action "/profile/save"; _hxPost "/profile/save" ] [
|
||||
antiForgery csrf
|
||||
div [ _class "col-12 col-sm-6 col-md-4" ] [
|
||||
continentList [] (nameof m.ContinentId) continents None m.ContinentId true
|
||||
]
|
||||
div [ _class "col-12 col-sm-6 col-md-8" ] [
|
||||
textBox [ _type "text"; _maxlength "255" ] (nameof m.Region) m.Region "Region" true
|
||||
div [ _class "form-text" ] [ txt "Country, state, geographic area, etc." ]
|
||||
]
|
||||
div [ _class "col-12" ] [
|
||||
checkBox [] (nameof m.IsSeekingEmployment) m.IsSeekingEmployment "I am currently seeking employment"
|
||||
if m.IsSeekingEmployment then
|
||||
p [ _class "fst-italic " ] [
|
||||
txt "If you have found employment, consider "
|
||||
a [ _href "/success-story/new/edit" ] [ txt "telling your fellow citizens about it!" ]
|
||||
]
|
||||
]
|
||||
div [ _class "col-12 col-offset-md-2 col-md-4" ] [
|
||||
checkBox [] (nameof m.RemoteWork) m.RemoteWork "I am interested in remote work"
|
||||
]
|
||||
div [ _class "col-12 col-md-4" ] [
|
||||
checkBox [] (nameof m.FullTime) m.FullTime "I am interested in full-time work"
|
||||
]
|
||||
markdownEditor [ _required ] (nameof m.Biography) m.Biography "Professional Biography" isHtmx
|
||||
div [ _class "col-12" ] [
|
||||
hr []
|
||||
h4 [] [ txt "Experience" ]
|
||||
p [] [
|
||||
txt "The information in this box is displayed after the list of skills and chronological job "
|
||||
txt "history, with no heading; it can be used to highlight your experiences apart from the history "
|
||||
txt "entries, provide closing notes, etc."
|
||||
]
|
||||
]
|
||||
markdownEditor [] (nameof m.Experience) (defaultArg m.Experience "") "Experience" isHtmx
|
||||
div [ _class "col-12" ] [
|
||||
hr []
|
||||
h4 [] [ txt "Visibility" ]
|
||||
div [ _class "form-check" ] [
|
||||
let hid = ProfileVisibility.toString Hidden
|
||||
input [ _type "radio"; _id $"{nameof m.Visibility}Hidden"; _name (nameof m.Visibility)
|
||||
_class "form-check-input"; _value hid; if m.Visibility = hid then _checked ]
|
||||
label [ _class "form-check-label"; _for $"{nameof m.Visibility}Hidden" ] [
|
||||
strong [] [ txt "Hidden" ]
|
||||
txt " – do not show my employment profile to anyone else"
|
||||
]
|
||||
]
|
||||
div [ _class "form-check" ] [
|
||||
let pvt = ProfileVisibility.toString Private
|
||||
input [ _type "radio"; _id $"{nameof m.Visibility}Private"; _name (nameof m.Visibility)
|
||||
_class "form-check-input"; _value pvt; if m.Visibility = pvt then _checked ]
|
||||
label [ _class "form-check-label"; _for $"{nameof m.Visibility}Private" ] [
|
||||
strong [] [ txt "Private" ]
|
||||
txt " – only show my employment profile to other authenticated users"
|
||||
]
|
||||
]
|
||||
div [ _class "form-check" ] [
|
||||
let anon = ProfileVisibility.toString Anonymous
|
||||
input [ _type "radio"; _id $"{nameof m.Visibility}Anonymous"; _name (nameof m.Visibility)
|
||||
_class "form-check-input"; _value anon; if m.Visibility = anon then _checked ]
|
||||
label [ _class "form-check-label"; _for $"{nameof m.Visibility}Anonymous" ] [
|
||||
strong [] [ txt "Anonymous" ]
|
||||
txt " – show my location and skills to public users anonymously"
|
||||
]
|
||||
]
|
||||
div [ _class "form-check" ] [
|
||||
let pub = ProfileVisibility.toString Public
|
||||
input [ _type "radio"; _id $"{nameof m.Visibility}Public"; _name (nameof m.Visibility)
|
||||
_class "form-check-input"; _value pub; if m.Visibility = pub then _checked ]
|
||||
label [ _class "form-check-label"; _for $"{nameof m.Visibility}Public" ] [
|
||||
strong [] [ txt "Public" ]; txt " – show my full profile to public users"
|
||||
]
|
||||
]
|
||||
]
|
||||
div [ _class "col-12" ] [ submitButton "content-save-outline" "Save" ]
|
||||
]
|
||||
]
|
||||
|
||||
|
||||
/// Render the skill edit template
|
||||
let skillForm (m : SkillForm) isNew =
|
||||
[ h4 [] [ txt $"""{if isNew then "Add a" else "Edit"} Skill""" ]
|
||||
div [ _class "col-12 col-md-6" ] [
|
||||
textBox [ _type "text"; _maxlength "200"; _autofocus ] (nameof m.Description) m.Description "Skill" true
|
||||
div [ _class "form-text" ] [ txt "A skill (language, design technique, process, etc.)" ]
|
||||
]
|
||||
div [ _class "col-12 col-md-6" ] [
|
||||
textBox [ _type "text"; _maxlength "1000" ] (nameof m.Notes) m.Notes "Notes" false
|
||||
div [ _class "form-text" ] [ txt "A further description of the skill" ]
|
||||
]
|
||||
div [ _class "col-12" ] [
|
||||
submitButton "content-save-outline" "Save"; txt " "
|
||||
a [ _href "/profile/edit/skills/list"; _hxGet "/profile/edit/skills/list"; _hxTarget "#skillList"
|
||||
_class "btn btn-secondary" ] [ i [ _class "mdi mdi-cancel"] []; txt " Cancel" ]
|
||||
]
|
||||
]
|
||||
|
||||
|
||||
/// List the skills for an employment profile
|
||||
let skillTable (skills : Skill list) editIdx csrf =
|
||||
let editingIdx = defaultArg editIdx -2
|
||||
let isEditing = editingIdx >= -1
|
||||
let renderTable () =
|
||||
let editSkillForm skill idx =
|
||||
tr [] [
|
||||
td [ _colspan "3" ] [
|
||||
form [ _class "row g-3"; _hxPost $"/profile/edit/skill/{idx}"; _hxTarget "#skillList" ] [
|
||||
antiForgery csrf
|
||||
yield! skillForm (SkillForm.fromSkill skill) (idx = -1)
|
||||
]
|
||||
]
|
||||
]
|
||||
table [ _class "table table-sm table-hover pt-3" ] [
|
||||
thead [] [
|
||||
[ "Action"; "Skill"; "Notes" ]
|
||||
|> List.map (fun it -> th [ _scope "col" ] [ txt it ])
|
||||
|> tr []
|
||||
]
|
||||
tbody [] [
|
||||
if isEditing && editingIdx = -1 then editSkillForm { Skill.Description = ""; Notes = None } -1
|
||||
yield! skills |> List.mapi (fun idx skill ->
|
||||
if isEditing && editingIdx = idx then editSkillForm skill idx
|
||||
else
|
||||
tr [] [
|
||||
td [ if isEditing then _class "text-muted" ] [
|
||||
if isEditing then txt "Edit ~ Delete"
|
||||
else
|
||||
let link = $"/profile/edit/skill/{idx}"
|
||||
a [ _href link; _hxGet link ] [ txt "Edit" ]; txt " ~ "
|
||||
a [ _href $"{link}/delete"; _hxPost $"{link}/delete"; _class "text-danger"
|
||||
_hxConfirm "Are you sure you want to delete this skill?" ] [ txt "Delete" ]
|
||||
]
|
||||
td [] [ str skill.Description ]
|
||||
td [ if Option.isNone skill.Notes then _class "text-muted fst-italic" ] [
|
||||
str (defaultArg skill.Notes "None")
|
||||
]
|
||||
])
|
||||
]
|
||||
]
|
||||
|
||||
if List.isEmpty skills && not isEditing then
|
||||
p [ _id "skillList"; _class "text-muted fst-italic pt-3" ] [ txt "Your profile has no skills defined" ]
|
||||
else if List.isEmpty skills then
|
||||
form [ _id "skillList"; _hxTarget "this"; _hxPost "/profile/edit/skill/-1"; _hxSwap HxSwap.OuterHtml
|
||||
_class "row g-3" ] [
|
||||
antiForgery csrf
|
||||
yield! skillForm { Description = ""; Notes = "" } true
|
||||
]
|
||||
else if isEditing then div [ _id "skillList" ] [ renderTable () ]
|
||||
else // not editing, there are skills to show
|
||||
form [ _id "skillList"; _hxTarget "this"; _hxSwap HxSwap.OuterHtml ] [
|
||||
antiForgery csrf
|
||||
renderTable ()
|
||||
]
|
||||
|
||||
|
||||
/// The profile skills maintenance page
|
||||
let skills (skills : Skill list) csrf =
|
||||
pageWithTitle "Employment Profile: Skills" [
|
||||
backToEdit
|
||||
p [] [
|
||||
a [ _href "/profile/edit/skill/-1"; _hxGet "/profile/edit/skill/-1"; _hxTarget "#skillList"
|
||||
_hxSwap HxSwap.OuterHtml; _class "btn btn-sm btn-outline-primary rounded-pill" ] [ txt "Add a Skill" ]
|
||||
]
|
||||
skillTable skills None csrf
|
||||
]
|
||||
|
||||
|
||||
/// The skill edit component
|
||||
let editSkill (skills : Skill list) idx csrf =
|
||||
skillTable skills (Some idx) csrf
|
||||
|
||||
open NodaTime
|
||||
|
||||
/// Render the employment history edit template
|
||||
let historyForm (m : HistoryForm) isNew isHtmx =
|
||||
let maxDate = HistoryForm.dateFormat.Format (LocalDate.FromDateTime System.DateTime.Today)
|
||||
[ h4 [] [ txt $"""{if isNew then "Add" else "Edit"} Employment History""" ]
|
||||
div [ _class "col-12 col-md-6" ] [
|
||||
textBox [ _type "text"; _maxlength "200"; _autofocus ] (nameof m.Employer) m.Employer "Employer" true
|
||||
]
|
||||
div [ _class "col-12 col-md-6" ] [
|
||||
textBox [ _type "text"; _maxlength "200" ] (nameof m.Position) m.Position "Title or Position" true
|
||||
]
|
||||
p [ _class "col-12 text-center mb-0" ] [
|
||||
txt "Select any date within the month; only the month and year will be displayed"
|
||||
]
|
||||
div [ _class "col-12 col-md-6 col-xl-4 offset-xl-1" ] [
|
||||
textBox [ _type "date"; _max maxDate ] (nameof m.StartDate) m.StartDate "Start Date" true
|
||||
]
|
||||
div [ _class "col-12 col-md-6 col-xl-4 offset-xl-2" ] [
|
||||
textBox [ _type "date"; _max maxDate ] (nameof m.EndDate) m.EndDate "End Date" false
|
||||
]
|
||||
markdownEditor [] (nameof m.Description) m.Description "Description" isHtmx
|
||||
div [ _class "col-12" ] [
|
||||
submitButton "content-save-outline" "Save"; txt " "
|
||||
a [ _href "/profile/edit/history/list"; _hxGet "/profile/edit/history/list"; _hxTarget "#historyList"
|
||||
_class "btn btn-secondary" ] [ i [ _class "mdi mdi-cancel"] []; txt " Cancel" ]
|
||||
]
|
||||
]
|
||||
|
||||
let private monthAndYear = Text.LocalDatePattern.CreateWithInvariantCulture "MMMM yyyy"
|
||||
|
||||
/// List the employment history entries for an employment profile
|
||||
let historyTable (history : EmploymentHistory list) editIdx isHtmx csrf =
|
||||
let editingIdx = defaultArg editIdx -2
|
||||
let isEditing = editingIdx >= -1
|
||||
let renderTable () =
|
||||
let editHistoryForm entry idx =
|
||||
tr [] [
|
||||
td [ _colspan "4" ] [
|
||||
form [ _class "row g-3"; _hxPost $"/profile/edit/history/{idx}"; _hxTarget "#historyList" ] [
|
||||
antiForgery csrf
|
||||
yield! historyForm (HistoryForm.fromHistory entry) (idx = -1) isHtmx
|
||||
]
|
||||
]
|
||||
]
|
||||
table [ _class "table table-sm table-hover pt-3" ] [
|
||||
thead [] [
|
||||
[ "Action"; "Employer"; "Dates"; "Position" ]
|
||||
|> List.map (fun it -> th [ _scope "col" ] [ txt it ])
|
||||
|> tr []
|
||||
]
|
||||
tbody [] [
|
||||
if isEditing && editingIdx = -1 then editHistoryForm EmploymentHistory.empty -1
|
||||
yield! history |> List.mapi (fun idx entry ->
|
||||
if isEditing && editingIdx = idx then editHistoryForm entry idx
|
||||
else
|
||||
tr [] [
|
||||
td [ if isEditing then _class "text-muted" ] [
|
||||
if isEditing then txt "Edit ~ Delete"
|
||||
else
|
||||
let link = $"/profile/edit/history/{idx}"
|
||||
a [ _href link; _hxGet link ] [ txt "Edit" ]; txt " ~ "
|
||||
a [ _href $"{link}/delete"; _hxPost $"{link}/delete"; _class "text-danger"
|
||||
_hxConfirm "Are you sure you want to delete this employment history entry?" ] [
|
||||
txt "Delete"
|
||||
]
|
||||
]
|
||||
td [] [ str entry.Employer ]
|
||||
td [] [
|
||||
str (monthAndYear.Format entry.StartDate); txt " to "
|
||||
match entry.EndDate with Some dt -> str (monthAndYear.Format dt) | None -> txt "Present"
|
||||
]
|
||||
td [ if Option.isNone entry.Position then _class "text-muted fst-italic" ] [
|
||||
str (defaultArg entry.Position "None")
|
||||
]
|
||||
])
|
||||
]
|
||||
]
|
||||
|
||||
if List.isEmpty history && not isEditing then
|
||||
p [ _id "historyList"; _class "text-muted fst-italic pt-3" ] [
|
||||
txt "Your profile has no employment history defined"
|
||||
]
|
||||
else if List.isEmpty history then
|
||||
form [ _id "historyList"; _hxTarget "this"; _hxPost "/profile/edit/history/-1"; _hxSwap HxSwap.OuterHtml
|
||||
_class "row g-3" ] [
|
||||
antiForgery csrf
|
||||
yield! historyForm (HistoryForm.fromHistory EmploymentHistory.empty) true isHtmx
|
||||
]
|
||||
else if isEditing then div [ _id "historyList" ] [ renderTable () ]
|
||||
else // not editing, there is history to show
|
||||
form [ _id "historyList"; _hxTarget "this"; _hxSwap HxSwap.OuterHtml ] [
|
||||
antiForgery csrf
|
||||
renderTable ()
|
||||
]
|
||||
|
||||
|
||||
/// The employment history maintenance page
|
||||
let history (history : EmploymentHistory list) isHtmx csrf =
|
||||
pageWithTitle "Employment Profile: Employment History" [
|
||||
backToEdit
|
||||
p [] [
|
||||
a [ _href "/profile/edit/history/-1"; _hxGet "/profile/edit/history/-1"; _hxTarget "#historyList"
|
||||
_hxSwap HxSwap.OuterHtml; _class "btn btn-sm btn-outline-primary rounded-pill" ] [
|
||||
txt "Add an Employment History Entry"
|
||||
]
|
||||
]
|
||||
historyTable history None isHtmx csrf
|
||||
]
|
||||
|
||||
|
||||
/// The employment history edit component
|
||||
let editHistory (history : EmploymentHistory list) idx csrf =
|
||||
historyTable history (Some idx) csrf
|
||||
|
||||
// ~~~ PROFILE SEARCH ~~~ //
|
||||
|
||||
/// The search form
|
||||
let private searchForm (m : ProfileSearchForm) continents isShown =
|
||||
collapsePanel "Search Criteria" isShown [
|
||||
form [ _class "container"; _method "GET"; _action "/profile/search" ] [
|
||||
input [ _type "hidden"; _name "searched"; _value "true" ]
|
||||
div [ _class "row" ] [
|
||||
div [ _class "col-12 col-sm-6 col-md-4 col-lg-3 mb-3" ] [
|
||||
continentList [] "ContinentId" continents (Some "Any") m.ContinentId false
|
||||
]
|
||||
div [ _class "col-12 col-sm-6 col-offset-md-2 col-lg-3 col-offset-lg-0 mb-3" ] [
|
||||
label [ _class "jjj-label" ] [ txt "Seeking Remote Work?" ]; br []
|
||||
div [ _class "form-check form-check-inline" ] [
|
||||
input [ _type "radio"; _id "remoteNull"; _name (nameof m.RemoteWork); _value ""
|
||||
_class "form-check-input"; if m.RemoteWork = "" then _checked ]
|
||||
label [ _class "form-check-label"; _for "remoteNull" ] [ txt "No Selection" ]
|
||||
]
|
||||
div [ _class "form-check form-check-inline" ] [
|
||||
input [ _type "radio"; _id "remoteYes"; _name (nameof m.RemoteWork); _value "yes"
|
||||
_class "form-check-input"; if m.RemoteWork = "yes" then _checked ]
|
||||
label [ _class "form-check-label"; _for "remoteYes" ] [ txt "Yes" ]
|
||||
]
|
||||
div [ _class "form-check form-check-inline" ] [
|
||||
input [ _type "radio"; _id "remoteNo"; _name (nameof m.RemoteWork); _value "no"
|
||||
_class "form-check-input"; if m.RemoteWork = "no" then _checked ]
|
||||
label [ _class "form-check-label"; _for "remoteNo" ] [ txt "No" ]
|
||||
]
|
||||
]
|
||||
div [ _class "col-12 col-sm-12 col-lg-6 mb-3" ] [
|
||||
textBox [ _maxlength "1000" ] (nameof m.Text) m.Text "Text Search" false
|
||||
div [ _class "form-text" ] [
|
||||
txt "searches Region, Professional Biography, Skills, Employment History, and Experience"
|
||||
]
|
||||
]
|
||||
]
|
||||
div [ _class "row" ] [
|
||||
div [ _class "col" ] [
|
||||
br []
|
||||
button [ _type "submit"; _class "btn btn-outline-primary" ] [ txt "Search" ]
|
||||
]
|
||||
]
|
||||
]
|
||||
]
|
||||
|
||||
/// Display search results for public users
|
||||
let private publicResults (results : ProfileForView list) =
|
||||
[ p [ _class "py-3" ] [
|
||||
txt "These profiles match your search criteria. To learn more about these people, join the merry band "
|
||||
txt "of human resources in the "
|
||||
a [ _href "https://noagendashow.net"; _target "_blank"; _rel "noopener" ] [ txt "No Agenda" ]
|
||||
txt " tribe!"
|
||||
]
|
||||
table [ _class "table table-sm table-hover" ] [
|
||||
thead [] [
|
||||
tr [] [
|
||||
th [ _scope "col" ] [ txt "Profile" ]
|
||||
th [ _scope "col" ] [ txt "Continent / Region" ]
|
||||
th [ _scope "col"; _class "text-center" ] [ txt "Remote?" ]
|
||||
th [ _scope "col"; _class "text-center" ] [ txt "Skills" ]
|
||||
]
|
||||
]
|
||||
results
|
||||
|> List.map (fun it ->
|
||||
tr [] [
|
||||
td [] [
|
||||
match it.Profile.Visibility with
|
||||
| Public -> a [ _href $"/profile/{CitizenId.toString it.Profile.Id}/view" ] [ txt "View" ]
|
||||
| _ -> txt " "
|
||||
]
|
||||
td [] [ txt $"{it.Continent.Name} / "; str it.Profile.Region ]
|
||||
td [ _class "text-center" ] [ txt (yesOrNo it.Profile.IsRemote) ]
|
||||
match it.Profile.Visibility with
|
||||
| Public -> td [ _class "text-muted fst-italic" ] [ txt "See Profile" ]
|
||||
| _ when List.isEmpty it.Profile.Skills ->
|
||||
td [ _class "text-muted fst-italic" ] [ txt "None Listed" ]
|
||||
| _ ->
|
||||
it.Profile.Skills
|
||||
|> List.collect (fun skill ->
|
||||
let notes = match skill.Notes with Some n -> $" ({n})" | None -> ""
|
||||
[ str $"{skill.Description}{notes}"; br [] ])
|
||||
|> td []
|
||||
])
|
||||
|> tbody []
|
||||
]
|
||||
]
|
||||
|
||||
/// Display search results for logged-on users
|
||||
let private privateResults (results : ProfileForView list) tz =
|
||||
// Bootstrap utility classes to only show at medium or above
|
||||
let isWide = "d-none d-md-table-cell"
|
||||
table [ _class "table table-sm table-hover pt-3" ] [
|
||||
thead [] [
|
||||
tr [] [
|
||||
th [ _scope "col" ] [ txt "Profile" ]
|
||||
th [ _scope "col" ] [ txt "Name" ]
|
||||
th [ _scope "col"; _class $"{isWide} text-center" ] [ txt "Seeking?" ]
|
||||
th [ _scope "col"; _class "text-center" ] [ txt "Remote?" ]
|
||||
th [ _scope "col"; _class $"{isWide} text-center" ] [ txt "Full-Time?" ]
|
||||
th [ _scope "col"; _class isWide ] [ txt "Last Updated" ]
|
||||
]
|
||||
]
|
||||
results
|
||||
|> List.map (fun it ->
|
||||
tr [] [
|
||||
td [] [ a [ _href $"/profile/{CitizenId.toString it.Profile.Id}/view" ] [ txt "View" ] ]
|
||||
td [ if it.Profile.IsSeekingEmployment then _class "fw-bold" ] [ str (Citizen.name it.Citizen) ]
|
||||
td [ _class $"{isWide} text-center" ] [ txt (yesOrNo it.Profile.IsSeekingEmployment) ]
|
||||
td [ _class "text-center" ] [ txt (yesOrNo it.Profile.IsRemote) ]
|
||||
td [ _class $"{isWide} text-center" ] [ txt (yesOrNo it.Profile.IsFullTime) ]
|
||||
td [ _class isWide ] [ str (fullDate it.Profile.LastUpdatedOn tz) ]
|
||||
])
|
||||
|> tbody []
|
||||
]
|
||||
|
||||
/// Logged-on search page
|
||||
let search m continents tz (results : ProfileForView list option) isPublic =
|
||||
[ if Option.isNone results then
|
||||
p [] [
|
||||
txt "Enter one or more criteria to filter results, or just click “Search” to list all "
|
||||
if isPublic then txt "publicly searchable or viewable "
|
||||
txt "profiles."
|
||||
]
|
||||
searchForm m continents (List.isEmpty (defaultArg results []))
|
||||
match results with
|
||||
| Some r when List.isEmpty r -> p [ _class "pt-3" ] [ txt "No results found for the specified criteria" ]
|
||||
| Some r -> if isPublic then yield! publicResults r else privateResults r tz
|
||||
| None -> ()
|
||||
]
|
||||
|> pageWithTitle "Search Profiles"
|
||||
|
||||
|
||||
/// Display a profile
|
||||
let private displayProfile (it : ProfileForView) isPublic isPrint =
|
||||
[ h2 [] [
|
||||
str (Citizen.name it.Citizen)
|
||||
if it.Profile.IsSeekingEmployment then
|
||||
span [ _class "jjj-heading-label" ] [
|
||||
txt " "; span [ _class "badge bg-dark" ] [ txt "Currently Seeking Employment" ]
|
||||
]
|
||||
]
|
||||
h4 [] [ str $"{it.Continent.Name}, {it.Profile.Region}" ]
|
||||
(if isPrint then contactInfoPrint else contactInfo) it.Citizen isPublic
|
||||
|> div [ _class "pb-3" ]
|
||||
p [] [
|
||||
txt (if it.Profile.IsFullTime then "I" else "Not i"); txt "nterested in full-time employment • "
|
||||
txt (if it.Profile.IsRemote then "I" else "Not i"); txt "nterested in remote opportunities"
|
||||
]
|
||||
div [] [ md2html it.Profile.Biography ]
|
||||
if not (List.isEmpty it.Profile.Skills) then
|
||||
h4 [ _class "pb-3 border-top border-3" ] [ txt "Skills" ]
|
||||
it.Profile.Skills
|
||||
|> List.map (fun skill ->
|
||||
li [] [
|
||||
str skill.Description
|
||||
match skill.Notes with Some notes -> txt " ("; str notes; txt ")" | None -> ()
|
||||
])
|
||||
|> ul []
|
||||
if not (List.isEmpty it.Profile.History) then
|
||||
h4 [ _class "mb-3 border-top border-3" ] [ txt "Employment History" ]
|
||||
yield!
|
||||
it.Profile.History
|
||||
|> List.indexed
|
||||
|> List.collect (fun (idx, entry) -> [
|
||||
let maybeBorder = if idx > 0 then " border-top" else ""
|
||||
div [ _class $"d-flex flex-row flex-wrap justify-content-between align-items-start mt-4 mb-2{maybeBorder}" ] [
|
||||
div [] [
|
||||
strong [] [ str entry.Employer ]
|
||||
match entry.Position with Some pos -> br []; str pos | None -> ()
|
||||
]
|
||||
div [ _class "text-end" ] [
|
||||
span [ _class "text-nowrap" ] [ str (monthAndYear.Format entry.StartDate) ]
|
||||
span [ _class "text-nowrap" ] [
|
||||
txt " to "
|
||||
match entry.EndDate with
|
||||
| Some dt -> str (monthAndYear.Format dt)
|
||||
| None -> txt "Present"
|
||||
]
|
||||
]
|
||||
]
|
||||
match entry.Description with Some d -> div [] [ md2html d ] | None -> ()
|
||||
])
|
||||
match it.Profile.Experience with
|
||||
| Some exp -> div [ _class "border-top border-3" ] [ md2html exp ]
|
||||
| None -> ()
|
||||
]
|
||||
|
||||
|
||||
/// Profile view template
|
||||
let view (it : ProfileForView) currentId =
|
||||
article [] [
|
||||
yield! displayProfile it (Option.isNone currentId) false
|
||||
if Option.isSome currentId && currentId.Value = it.Citizen.Id then
|
||||
br []; br []
|
||||
a [ _href "/profile/edit"; _class "btn btn-primary" ] [
|
||||
i [ _class "mdi mdi-pencil" ] []; txt " Edit Your Profile"
|
||||
]
|
||||
txt " "
|
||||
a [ _href $"/profile/{CitizenId.toString it.Profile.Id}/print"; _target "_blank"
|
||||
_class "btn btn-outline-secondary" ] [
|
||||
i [ _class "mdi mdi-printer-outline" ] []; txt " View Print Version"
|
||||
]
|
||||
]
|
||||
|
||||
|
||||
/// Printable profile view template
|
||||
let print (it : ProfileForView) isPublic =
|
||||
article [] [
|
||||
yield! displayProfile it isPublic true
|
||||
button [ _type "button"; _class "btn btn-sm btn-secondary jjj-hide-from-printer"; _onclick "window.print()" ] [
|
||||
i [ _class "mdi mdi-printer-outline" ] []; txt " Print"
|
||||
]
|
||||
]
|
12
src/JobsJobsJobs/Server/.config/dotnet-tools.json
Normal file
12
src/JobsJobsJobs/Server/.config/dotnet-tools.json
Normal file
|
@ -0,0 +1,12 @@
|
|||
{
|
||||
"version": 1,
|
||||
"isRoot": true,
|
||||
"tools": {
|
||||
"dotnet-ef": {
|
||||
"version": "5.0.1",
|
||||
"commands": [
|
||||
"dotnet-ef"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,91 @@
|
|||
using JobsJobsJobs.Server.Data;
|
||||
using JobsJobsJobs.Shared;
|
||||
using JobsJobsJobs.Shared.Api;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using NodaTime;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace JobsJobsJobs.Server.Areas.Api.Controllers
|
||||
{
|
||||
/// <summary>
|
||||
/// API controller for citizen information
|
||||
/// </summary>
|
||||
[Route("api/[controller]")]
|
||||
[ApiController]
|
||||
public class CitizenController : ControllerBase
|
||||
{
|
||||
/// <summary>
|
||||
/// Authorization configuration section
|
||||
/// </summary>
|
||||
private readonly IConfigurationSection _config;
|
||||
|
||||
/// <summary>
|
||||
/// NodaTime clock
|
||||
/// </summary>
|
||||
private readonly IClock _clock;
|
||||
|
||||
/// <summary>
|
||||
/// The data context to use for this request
|
||||
/// </summary>
|
||||
private readonly JobsDbContext _db;
|
||||
|
||||
/// <summary>
|
||||
/// Constructor
|
||||
/// </summary>
|
||||
/// <param name="config">The authorization configuration section</param>
|
||||
/// <param name="clock">The NodaTime clock instance</param>
|
||||
/// <param name="db">The data context to use for this request</param>
|
||||
public CitizenController(IConfiguration config, IClock clock, JobsDbContext db)
|
||||
{
|
||||
_config = config.GetSection("Auth");
|
||||
_clock = clock;
|
||||
_db = db;
|
||||
}
|
||||
|
||||
[HttpGet("log-on/{authCode}")]
|
||||
public async Task<IActionResult> LogOn([FromRoute] string authCode)
|
||||
{
|
||||
// Step 1 - Verify with Mastodon
|
||||
var accountResult = await Auth.VerifyWithMastodon(authCode, _config);
|
||||
|
||||
if (accountResult.IsError) return BadRequest(accountResult.Error);
|
||||
|
||||
// Step 2 - Find / establish Jobs, Jobs, Jobs account
|
||||
var account = accountResult.Ok;
|
||||
var now = _clock.GetCurrentInstant();
|
||||
|
||||
var citizen = await _db.FindCitizenByNAUser(account.Username);
|
||||
if (citizen == null)
|
||||
{
|
||||
citizen = new Citizen(await CitizenId.Create(), account.Username, account.DisplayName, account.Url,
|
||||
now, now);
|
||||
await _db.AddCitizen(citizen);
|
||||
}
|
||||
else
|
||||
{
|
||||
citizen = citizen with
|
||||
{
|
||||
DisplayName = account.DisplayName,
|
||||
LastSeenOn = now
|
||||
};
|
||||
_db.UpdateCitizen(citizen);
|
||||
}
|
||||
await _db.SaveChangesAsync();
|
||||
|
||||
// Step 3 - Generate JWT
|
||||
var jwt = Auth.CreateJwt(citizen, _config);
|
||||
|
||||
return new JsonResult(new LogOnSuccess(jwt, citizen.Id.ToString(), citizen.DisplayName));
|
||||
}
|
||||
|
||||
[Authorize]
|
||||
[HttpGet("get/{id}")]
|
||||
public async Task<IActionResult> GetCitizenById([FromRoute] string id)
|
||||
{
|
||||
var citizen = await _db.FindCitizenById(CitizenId.Parse(id));
|
||||
return citizen == null ? NotFound() : Ok(citizen);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
using JobsJobsJobs.Server.Data;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace JobsJobsJobs.Server.Areas.Api.Controllers
|
||||
{
|
||||
/// <summary>
|
||||
/// API endpoint for continent information
|
||||
/// </summary>
|
||||
[Route("api/[controller]")]
|
||||
[Authorize]
|
||||
[ApiController]
|
||||
public class ContinentController : ControllerBase
|
||||
{
|
||||
/// <summary>
|
||||
/// The data context to use for this request
|
||||
/// </summary>
|
||||
private readonly JobsDbContext _db;
|
||||
|
||||
/// <summary>
|
||||
/// Constructor
|
||||
/// </summary>
|
||||
/// <param name="db">The data context to use for this request</param>
|
||||
public ContinentController(JobsDbContext db)
|
||||
{
|
||||
_db = db;
|
||||
}
|
||||
|
||||
[HttpGet("all")]
|
||||
public async Task<IActionResult> All() =>
|
||||
Ok(await _db.AllContinents());
|
||||
}
|
||||
}
|
|
@ -0,0 +1,118 @@
|
|||
using JobsJobsJobs.Server.Data;
|
||||
using JobsJobsJobs.Shared;
|
||||
using JobsJobsJobs.Shared.Api;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using NodaTime;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Security.Claims;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace JobsJobsJobs.Server.Areas.Api.Controllers
|
||||
{
|
||||
/// <summary>
|
||||
/// API controller for employment profile information
|
||||
/// </summary>
|
||||
[Route("api/[controller]")]
|
||||
[Authorize]
|
||||
[ApiController]
|
||||
public class ProfileController : ControllerBase
|
||||
{
|
||||
/// <summary>
|
||||
/// The data context
|
||||
/// </summary>
|
||||
private readonly JobsDbContext _db;
|
||||
|
||||
/// <summary>
|
||||
/// The NodaTime clock instance
|
||||
/// </summary>
|
||||
private readonly IClock _clock;
|
||||
|
||||
/// <summary>
|
||||
/// Constructor
|
||||
/// </summary>
|
||||
/// <param name="db">The data context to use for this request</param>
|
||||
public ProfileController(JobsDbContext db, IClock clock)
|
||||
{
|
||||
_db = db;
|
||||
_clock = clock;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The current citizen ID
|
||||
/// </summary>
|
||||
private CitizenId CurrentCitizenId => CitizenId.Parse(User.FindFirst(ClaimTypes.NameIdentifier)!.Value);
|
||||
|
||||
// This returns 204 to indicate that there is no profile data for the current citizen (if, of course, that is
|
||||
// the case. The version where an ID is specified returns 404, which is an error condition, as it should not
|
||||
// occur unless someone is messing with a URL.
|
||||
[HttpGet("")]
|
||||
public async Task<IActionResult> Get()
|
||||
{
|
||||
var profile = await _db.FindProfileByCitizen(CurrentCitizenId);
|
||||
return profile == null ? NoContent() : Ok(profile);
|
||||
}
|
||||
|
||||
[HttpPost("save")]
|
||||
public async Task<IActionResult> Save(ProfileForm form)
|
||||
{
|
||||
// Profile
|
||||
var existing = await _db.FindProfileByCitizen(CurrentCitizenId);
|
||||
var profile = existing == null
|
||||
? new Profile(CurrentCitizenId, form.IsSeekingEmployment, form.IsPublic,
|
||||
ContinentId.Parse(form.ContinentId), form.Region, form.RemoteWork, form.FullTime,
|
||||
new MarkdownString(form.Biography), _clock.GetCurrentInstant(),
|
||||
string.IsNullOrEmpty(form.Experience) ? null : new MarkdownString(form.Experience))
|
||||
: existing with
|
||||
{
|
||||
SeekingEmployment = form.IsSeekingEmployment,
|
||||
IsPublic = form.IsPublic,
|
||||
ContinentId = ContinentId.Parse(form.ContinentId),
|
||||
Region = form.Region,
|
||||
RemoteWork = form.RemoteWork,
|
||||
FullTime = form.FullTime,
|
||||
Biography = new MarkdownString(form.Biography),
|
||||
LastUpdatedOn = _clock.GetCurrentInstant(),
|
||||
Experience = string.IsNullOrEmpty(form.Experience) ? null : new MarkdownString(form.Experience)
|
||||
};
|
||||
await _db.SaveProfile(profile);
|
||||
|
||||
// Skills
|
||||
var skills = new List<Skill>();
|
||||
foreach (var skill in form.Skills) {
|
||||
skills.Add(new Skill(skill.Id.StartsWith("new") ? await SkillId.Create() : SkillId.Parse(skill.Id),
|
||||
CurrentCitizenId, skill.Description, string.IsNullOrEmpty(skill.Notes) ? null : skill.Notes));
|
||||
}
|
||||
|
||||
foreach (var skill in skills) await _db.SaveSkill(skill);
|
||||
await _db.DeleteMissingSkills(CurrentCitizenId, skills.Select(s => s.Id));
|
||||
|
||||
await _db.SaveChangesAsync();
|
||||
return Ok();
|
||||
}
|
||||
|
||||
[HttpGet("skills")]
|
||||
public async Task<IActionResult> GetSkills() =>
|
||||
Ok(await _db.FindSkillsByCitizen(CurrentCitizenId));
|
||||
|
||||
[HttpGet("count")]
|
||||
public async Task<IActionResult> GetProfileCount() =>
|
||||
Ok(new Count(await _db.CountProfiles()));
|
||||
|
||||
[HttpGet("skill-count")]
|
||||
public async Task<IActionResult> GetSkillCount() =>
|
||||
Ok(new Count(await _db.CountSkillsByCitizen(CurrentCitizenId)));
|
||||
|
||||
[HttpGet("get/{id}")]
|
||||
public async Task<IActionResult> GetProfileForCitizen([FromRoute] string id)
|
||||
{
|
||||
var profile = await _db.FindProfileByCitizen(CitizenId.Parse(id));
|
||||
return profile == null ? NotFound() : Ok(profile);
|
||||
}
|
||||
|
||||
[HttpGet("search")]
|
||||
public async Task<IActionResult> Search([FromQuery] ProfileSearch search) =>
|
||||
Ok(await _db.SearchProfiles(search));
|
||||
}
|
||||
}
|
112
src/JobsJobsJobs/Server/Auth.cs
Normal file
112
src/JobsJobsJobs/Server/Auth.cs
Normal file
|
@ -0,0 +1,112 @@
|
|||
using JobsJobsJobs.Server.Models;
|
||||
using JobsJobsJobs.Shared;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.IdentityModel.Tokens;
|
||||
using System;
|
||||
using System.IdentityModel.Tokens.Jwt;
|
||||
using System.Net.Http;
|
||||
using System.Net.Http.Headers;
|
||||
using System.Net.Http.Json;
|
||||
using System.Security.Claims;
|
||||
using System.Text;
|
||||
using System.Text.Json;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace JobsJobsJobs.Server
|
||||
{
|
||||
/// <summary>
|
||||
/// Authentication / authorization utility methods
|
||||
/// </summary>
|
||||
public static class Auth
|
||||
{
|
||||
/// <summary>
|
||||
/// Verify the authorization code with Mastodon and get the user's profile
|
||||
/// </summary>
|
||||
/// <param name="authCode">The code from the authorization flow</param>
|
||||
/// <param name="config">The authorization configuration section</param>
|
||||
/// <returns>The Mastodon account (or an error if one is encountered)</returns>
|
||||
public static async Task<Result<MastodonAccount>> VerifyWithMastodon(string authCode,
|
||||
IConfigurationSection config)
|
||||
{
|
||||
using var http = new HttpClient();
|
||||
|
||||
// Use authorization code to get an access token from NAS
|
||||
using var codeResult = await http.PostAsJsonAsync("https://noagendasocial.com/oauth/token", new
|
||||
{
|
||||
client_id = config["ClientId"],
|
||||
client_secret = config["Secret"],
|
||||
redirect_uri = $"{config["ReturnHost"]}/citizen/authorized",
|
||||
grant_type = "authorization_code",
|
||||
code = authCode,
|
||||
scope = "read"
|
||||
});
|
||||
if (!codeResult.IsSuccessStatusCode)
|
||||
{
|
||||
Console.WriteLine($"ERR: {await codeResult.Content.ReadAsStringAsync()}");
|
||||
return Result<MastodonAccount>.AsError(
|
||||
$"Could not get token ({codeResult.StatusCode:D}: {codeResult.ReasonPhrase})");
|
||||
}
|
||||
|
||||
using var tokenResponse = JsonSerializer.Deserialize<JsonDocument>(
|
||||
new ReadOnlySpan<byte>(await codeResult.Content.ReadAsByteArrayAsync()));
|
||||
if (tokenResponse == null)
|
||||
{
|
||||
return Result<MastodonAccount>.AsError("Could not parse authorization code result");
|
||||
}
|
||||
|
||||
var accessToken = tokenResponse.RootElement.GetProperty("access_token").GetString();
|
||||
|
||||
// Use access token to get profile from NAS
|
||||
using var req = new HttpRequestMessage(HttpMethod.Get, $"{config["ApiUrl"]}accounts/verify_credentials");
|
||||
req.Headers.Authorization = new AuthenticationHeaderValue("Bearer", accessToken);
|
||||
|
||||
using var profileResult = await http.SendAsync(req);
|
||||
if (!profileResult.IsSuccessStatusCode)
|
||||
{
|
||||
return Result<MastodonAccount>.AsError(
|
||||
$"Could not get profile ({profileResult.StatusCode:D}: {profileResult.ReasonPhrase})");
|
||||
}
|
||||
|
||||
var profileResponse = JsonSerializer.Deserialize<MastodonAccount>(
|
||||
new ReadOnlySpan<byte>(await profileResult.Content.ReadAsByteArrayAsync()));
|
||||
if (profileResponse == null)
|
||||
{
|
||||
return Result<MastodonAccount>.AsError("Could not parse profile result");
|
||||
}
|
||||
|
||||
if (profileResponse.Username != profileResponse.AccountName)
|
||||
{
|
||||
return Result<MastodonAccount>.AsError(
|
||||
$"Profiles must be from noagendasocial.com; yours is {profileResponse.AccountName}");
|
||||
}
|
||||
|
||||
return Result<MastodonAccount>.AsOk(profileResponse);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create a JSON Web Token for this citizen to use for further requests to this API
|
||||
/// </summary>
|
||||
/// <param name="citizen">The citizen for which the token should be generated</param>
|
||||
/// <param name="config">The authorization configuration section</param>
|
||||
/// <returns>The JWT</returns>
|
||||
public static string CreateJwt(Citizen citizen, IConfigurationSection config)
|
||||
{
|
||||
var tokenHandler = new JwtSecurityTokenHandler();
|
||||
var token = tokenHandler.CreateToken(new SecurityTokenDescriptor
|
||||
{
|
||||
Subject = new ClaimsIdentity(new[]
|
||||
{
|
||||
new Claim(ClaimTypes.NameIdentifier, citizen.Id.ToString()),
|
||||
new Claim(ClaimTypes.Name, citizen.DisplayName),
|
||||
}),
|
||||
Expires = DateTime.UtcNow.AddHours(2),
|
||||
Issuer = "https://noagendacareers.com",
|
||||
Audience = "https://noagendacareers.com",
|
||||
SigningCredentials = new SigningCredentials(
|
||||
new SymmetricSecurityKey(Encoding.UTF8.GetBytes(config["ServerSecret"])),
|
||||
SecurityAlgorithms.HmacSha256Signature)
|
||||
});
|
||||
return tokenHandler.WriteToken(token);
|
||||
}
|
||||
}
|
||||
}
|
46
src/JobsJobsJobs/Server/Data/CitizenExtensions.cs
Normal file
46
src/JobsJobsJobs/Server/Data/CitizenExtensions.cs
Normal file
|
@ -0,0 +1,46 @@
|
|||
using JobsJobsJobs.Shared;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace JobsJobsJobs.Server.Data
|
||||
{
|
||||
/// <summary>
|
||||
/// Extensions to JobsDbContext supporting the manipulation of citizens
|
||||
/// </summary>
|
||||
public static class CitizenExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Retrieve a citizen by their Jobs, Jobs, Jobs ID
|
||||
/// </summary>
|
||||
/// <param name="citizenId">The ID of the citizen to retrieve</param>
|
||||
/// <returns>The citizen, or null if not found</returns>
|
||||
public static async Task<Citizen?> FindCitizenById(this JobsDbContext db, CitizenId citizenId) =>
|
||||
await db.Citizens.AsNoTracking()
|
||||
.SingleOrDefaultAsync(c => c.Id == citizenId)
|
||||
.ConfigureAwait(false);
|
||||
|
||||
/// <summary>
|
||||
/// Retrieve a citizen by their No Agenda Social user name
|
||||
/// </summary>
|
||||
/// <param name="naUser">The NAS user name</param>
|
||||
/// <returns>The citizen, or null if not found</returns>
|
||||
public static async Task<Citizen?> FindCitizenByNAUser(this JobsDbContext db, string naUser) =>
|
||||
await db.Citizens.AsNoTracking()
|
||||
.SingleOrDefaultAsync(c => c.NaUser == naUser)
|
||||
.ConfigureAwait(false);
|
||||
|
||||
/// <summary>
|
||||
/// Add a citizen
|
||||
/// </summary>
|
||||
/// <param name="citizen">The citizen to be added</param>
|
||||
public static async Task AddCitizen(this JobsDbContext db, Citizen citizen) =>
|
||||
await db.Citizens.AddAsync(citizen);
|
||||
|
||||
/// <summary>
|
||||
/// Update a citizen after they have logged on (update last seen, sync display name)
|
||||
/// </summary>
|
||||
/// <param name="citizen">The updated citizen</param>
|
||||
public static void UpdateCitizen(this JobsDbContext db, Citizen citizen) =>
|
||||
db.Entry(citizen).State = EntityState.Modified;
|
||||
}
|
||||
}
|
31
src/JobsJobsJobs/Server/Data/ContinentExtensions.cs
Normal file
31
src/JobsJobsJobs/Server/Data/ContinentExtensions.cs
Normal file
|
@ -0,0 +1,31 @@
|
|||
using JobsJobsJobs.Shared;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace JobsJobsJobs.Server.Data
|
||||
{
|
||||
/// <summary>
|
||||
/// Data extensions for manipulation of continent objects
|
||||
/// </summary>
|
||||
public static class ContinentExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Retrieve all continents
|
||||
/// </summary>
|
||||
/// <returns>All continents</returns>
|
||||
public static async Task<IEnumerable<Continent>> AllContinents(this JobsDbContext db) =>
|
||||
await db.Continents.AsNoTracking().OrderBy(c => c.Name).ToListAsync().ConfigureAwait(false);
|
||||
|
||||
/// <summary>
|
||||
/// Retrieve a continent by its ID
|
||||
/// </summary>
|
||||
/// <param name="continentId">The ID of the continent to retrieve</param>
|
||||
/// <returns>The continent matching the ID</returns>
|
||||
public static async Task<Continent> FindContinentById(this JobsDbContext db, ContinentId continentId) =>
|
||||
await db.Continents.AsNoTracking()
|
||||
.SingleAsync(c => c.Id == continentId)
|
||||
.ConfigureAwait(false);
|
||||
}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user