Add real name to profile form (#12)
This commit is contained in:
parent
1b2540e5d2
commit
8350d0bddf
|
@ -11,6 +11,16 @@
|
|||
<Loading OnLoad=@SetUpProfile Message=@(new MarkupString("Loading Your Profile…"))>
|
||||
<EditForm Model=@ProfileForm OnValidSubmit=@SaveProfile>
|
||||
<DataAnnotationsValidator />
|
||||
<div class="form-row">
|
||||
<div class="col col-xs-12 col-sm-10 col-md-8 col-lg-6">
|
||||
<div class="form-group">
|
||||
<label for="realName" class="jjj-label">Real Name</label>
|
||||
<InputText id="realName" @bind-Value=@ProfileForm.RealName class="form-control"
|
||||
placeholder="Leave blank to use your NAS display name" />
|
||||
<ValidationMessage For=@(() => ProfileForm.RealName) />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<div class="col">
|
||||
<div class="form-check">
|
||||
|
|
|
@ -48,6 +48,7 @@ namespace JobsJobsJobs.Client.Pages.Citizen
|
|||
ServerApi.SetJwt(http, state);
|
||||
var continentTask = state.GetContinents(http);
|
||||
var profileTask = ServerApi.RetrieveProfile(http, state);
|
||||
//var citizenTask = ServerApi.RetrieveOne<Citizen>(http,)
|
||||
|
||||
await Task.WhenAll(continentTask, profileTask);
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
</div>
|
||||
<div class="col col-xs-10 col-sm-10 col-md-6">
|
||||
<div class="form-group">
|
||||
<label for="skillDesc@(Skill.Id)">Skill</label>
|
||||
<label for="skillDesc@(Skill.Id)" class="jjj-label">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)" />
|
||||
|
@ -13,7 +13,7 @@
|
|||
</div>
|
||||
<div class="col col-xs-12 col-sm-12 col-md-5">
|
||||
<div class="form-group">
|
||||
<label for="skillNotes@(Skill.Id)">Notes</label>
|
||||
<label for="skillNotes@(Skill.Id)" class="jjj-label">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)" />
|
||||
|
|
|
@ -66,6 +66,7 @@ label.jjj-required::after {
|
|||
content: ' *';
|
||||
}
|
||||
|
||||
label.jjj-label {
|
||||
label.jjj-label,
|
||||
::placeholder {
|
||||
font-style: italic;
|
||||
}
|
||||
|
|
|
@ -46,7 +46,7 @@ namespace JobsJobsJobs.Server.Areas.Api.Controllers
|
|||
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
|
||||
// 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()
|
||||
|
@ -89,6 +89,10 @@ namespace JobsJobsJobs.Server.Areas.Api.Controllers
|
|||
foreach (var skill in skills) await _db.SaveSkill(skill);
|
||||
await _db.DeleteMissingSkills(CurrentCitizenId, skills.Select(s => s.Id));
|
||||
|
||||
// Real Name
|
||||
_db.Update((await _db.FindCitizenById(CurrentCitizenId))!
|
||||
with { RealName = string.IsNullOrWhiteSpace(form.RealName) ? null : form.RealName });
|
||||
|
||||
await _db.SaveChangesAsync();
|
||||
return Ok();
|
||||
}
|
||||
|
|
|
@ -19,6 +19,12 @@ namespace JobsJobsJobs.Shared.Api
|
|||
/// </summary>
|
||||
public bool IsPublic { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The user's real name
|
||||
/// </summary>
|
||||
[StringLength(255)]
|
||||
public string RealName { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// The ID of the continent on which the citizen is located
|
||||
/// </summary>
|
||||
|
|
Loading…
Reference in New Issue
Block a user