Add contact info to profiles and listings
This commit is contained in:
parent
683506d735
commit
266e265b7f
|
@ -340,7 +340,7 @@ module Listings =
|
||||||
let private toListingForView row =
|
let private toListingForView row =
|
||||||
{ Listing = toDocument<Listing> row
|
{ Listing = toDocument<Listing> row
|
||||||
ContinentName = row.string "continent_name"
|
ContinentName = row.string "continent_name"
|
||||||
ListedBy = Citizen.name (toDocumentFrom<Citizen> "cit_data" row)
|
Citizen = toDocumentFrom<Citizen> "cit_data" row
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Find all job listings posted by the given citizen
|
/// Find all job listings posted by the given citizen
|
||||||
|
|
|
@ -13,8 +13,8 @@ type ListingForView =
|
||||||
/// The name of the continent for the listing
|
/// The name of the continent for the listing
|
||||||
ContinentName : string
|
ContinentName : string
|
||||||
|
|
||||||
/// The display name of the citizen who owns the listing
|
/// The citizen who owns the listing
|
||||||
ListedBy : string
|
Citizen : Citizen
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -716,9 +716,7 @@ module Profile =
|
||||||
let! continent = Continents.findById profile.ContinentId
|
let! continent = Continents.findById profile.ContinentId
|
||||||
let continentName = match continent with Some c -> c.Name | None -> "not found"
|
let continentName = match continent with Some c -> c.Name | None -> "not found"
|
||||||
let title = $"Employment Profile for {Citizen.name citizen}"
|
let title = $"Employment Profile for {Citizen.name citizen}"
|
||||||
return!
|
return! Profile.view citizen profile continentName currentCitizen |> render title next ctx
|
||||||
Profile.view citizen profile continentName title currentCitizen
|
|
||||||
|> render title next ctx
|
|
||||||
| None -> return! Error.notFound next ctx
|
| None -> return! Error.notFound next ctx
|
||||||
| None -> return! Error.notFound next ctx
|
| None -> return! Error.notFound next ctx
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,9 +21,12 @@ let contactEdit (contacts : OtherContactForm array) =
|
||||||
div [ _class "form-floating" ] [
|
div [ _class "form-floating" ] [
|
||||||
select [ _id $"contactType{idx}"; _name $"Contacts[{idx}].ContactType"; _class "form-control"
|
select [ _id $"contactType{idx}"; _name $"Contacts[{idx}].ContactType"; _class "form-control"
|
||||||
_value contact.ContactType; _placeholder "Type"; _required ] [
|
_value contact.ContactType; _placeholder "Type"; _required ] [
|
||||||
option [ _value "Website" ] [ rawText "Website" ]
|
let optionFor value label =
|
||||||
option [ _value "Email" ] [ rawText "E-mail Address" ]
|
let typ = ContactType.toString value
|
||||||
option [ _value "Phone" ] [ rawText "Phone Number" ]
|
option [ _value typ; if contact.ContactType = typ then _selected ] [ rawText label ]
|
||||||
|
optionFor Website "Website"
|
||||||
|
optionFor Email "E-mail Address"
|
||||||
|
optionFor Phone "Phone Number"
|
||||||
]
|
]
|
||||||
label [ _class "jjj-required"; _for $"contactType{idx}" ] [ rawText "Type" ]
|
label [ _class "jjj-required"; _for $"contactType{idx}" ] [ rawText "Type" ]
|
||||||
]
|
]
|
||||||
|
|
|
@ -101,6 +101,28 @@ let yesOrNo value =
|
||||||
let md2html value =
|
let md2html value =
|
||||||
rawText (MarkdownString.toHtml value)
|
rawText (MarkdownString.toHtml 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" ] []; rawText " "
|
||||||
|
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" ] []; rawText " "
|
||||||
|
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" ] []; rawText " "; str contact.Value
|
||||||
|
match contact.Name with Some name -> str $" ({name})" | None -> ()
|
||||||
|
]
|
||||||
|
])
|
||||||
|
|
||||||
open NodaTime
|
open NodaTime
|
||||||
open NodaTime.Text
|
open NodaTime.Text
|
||||||
|
|
|
@ -234,7 +234,8 @@ let view (it : ListingForView) =
|
||||||
strong [] [ em [] [ rawText "NEEDED BY "; str ((neededBy needed).ToUpperInvariant ()) ] ]
|
strong [] [ em [] [ rawText "NEEDED BY "; str ((neededBy needed).ToUpperInvariant ()) ] ]
|
||||||
rawText " • "
|
rawText " • "
|
||||||
| None -> ()
|
| None -> ()
|
||||||
rawText "Listed by "; str it.ListedBy //<!-- a :href="profileUrl" target="_blank" -->{{citizenName(citizen)}}<!-- /a -->
|
rawText "Listed by "; strong [ _class "me-4" ] [ str (Citizen.name it.Citizen) ]; br []
|
||||||
|
span [ _class "ms-3" ] []; yield! contactInfo it.Citizen false
|
||||||
]
|
]
|
||||||
hr []
|
hr []
|
||||||
div [] [ md2html it.Listing.Text ]
|
div [] [ md2html it.Listing.Text ]
|
||||||
|
|
|
@ -290,18 +290,18 @@ let search (m : ProfileSearchForm) continents tz (results : ProfileSearchResult
|
||||||
|
|
||||||
|
|
||||||
/// Profile view template
|
/// Profile view template
|
||||||
let view (citizen : Citizen) (profile : Profile) (continentName : string) pageTitle currentId =
|
let view (citizen : Citizen) (profile : Profile) (continentName : string) currentId =
|
||||||
article [] [
|
article [] [
|
||||||
h3 [ _class "pb-3" ] [ str pageTitle ]
|
|
||||||
h2 [] [
|
h2 [] [
|
||||||
// TODO: link to preferred profile
|
str (Citizen.name citizen)
|
||||||
a [ _href "#"; _target "_blank"; _rel "noopener" ] [ str (Citizen.name citizen) ]
|
|
||||||
if profile.IsSeekingEmployment then
|
if profile.IsSeekingEmployment then
|
||||||
span [ _class "jjj-heading-label" ] [
|
span [ _class "jjj-heading-label" ] [
|
||||||
rawText " "; span [ _class "badge bg-dark" ] [ rawText "Currently Seeking Employment" ]
|
rawText " "; span [ _class "badge bg-dark" ] [ rawText "Currently Seeking Employment" ]
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
h4 [ _class "pb-3" ] [ str $"{continentName}, {profile.Region}" ]
|
h4 [] [ str $"{continentName}, {profile.Region}" ]
|
||||||
|
contactInfo citizen (Option.isNone currentId)
|
||||||
|
|> div [ _class "pb-3" ]
|
||||||
p [] [
|
p [] [
|
||||||
rawText (if profile.IsFullTime then "I" else "Not i"); rawText "nterested in full-time employment"
|
rawText (if profile.IsFullTime then "I" else "Not i"); rawText "nterested in full-time employment"
|
||||||
rawText " • "
|
rawText " • "
|
||||||
|
|
|
@ -84,6 +84,10 @@ label.jjj-required::after {
|
||||||
top: 3px;
|
top: 3px;
|
||||||
left: -3px
|
left: -3px
|
||||||
}
|
}
|
||||||
|
.mdi-sm::before {
|
||||||
|
font-size: 1rem;
|
||||||
|
line-height: unset;
|
||||||
|
}
|
||||||
/* Layout styling */
|
/* Layout styling */
|
||||||
.jjj-app {
|
.jjj-app {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user