Merge pull request #96 from mateuszskoczek/fetaures/picture_editor_fix

multiple person edit page fixes
This commit is contained in:
2024-10-05 20:00:45 +02:00
committed by GitHub
Unverified
6 changed files with 39 additions and 35 deletions

View File

@@ -80,7 +80,7 @@ public partial class PersonEditFormComponent : ComponentBase
void PostSuccess(PersonResponse data)
{
NavigationManager.NavigateTo($"person/{data.Id}/edit");
NavigationManager.NavigateTo($"person/{data.Id}/edit", true);
}
void BadRequest(IDictionary<string, string[]> errors)

View File

@@ -6,10 +6,12 @@
<InputFile class="form-control content-width" OnChange="Load" disabled="@(!Id.HasValue)" autocomplete="off"/>
@if (_pictureChanged || _pictureSaved is not null)
{
<div class="d-flex gap-1 content-width">
<div class="content-width">
@if (_pictureChanged)
{
<div class="flex-fill">
<div class="container-grid">
<div class="row gx-1">
<div class="col">
<button type="button" class="btn btn-secondary btn-block btn-stretch-x" @onclick="Save" disabled=@(!Id.HasValue || _pictureSaving || _pictureDeleting) autocomplete="off">
@if (!_pictureSaving)
{
@@ -22,13 +24,14 @@
}
</button>
</div>
<div class="flex-fill">
<div class="col">
<button type="button" class="btn btn-danger btn-block btn-stretch-x" @onclick="Cancel" disabled=@(!Id.HasValue || _pictureSaving || _pictureDeleting) autocomplete="off">Drop changes</button>
</div>
</div>
</div>
}
else if (_pictureSaved is not null)
{
<div class="flex-fill">
<button type="button" class="btn btn-danger btn-block btn-stretch-x" @onclick="Delete" disabled=@(!Id.HasValue || _pictureSaving || _pictureDeleting) autocomplete="off">
@if (!_pictureSaving)
{
@@ -40,7 +43,6 @@
<span>Deleting...</span>
}
</button>
</div>
}
</div>
}
@@ -60,6 +62,6 @@
/* CLASSES */
.content-width {
width: @(ContentWidth);
width: @(ContentWidth)px;
}
</style>

View File

@@ -51,6 +51,7 @@
PictureGetTask="@(async (id, action) => await PersonsWebAPIService.GetPersonPhoto(id, action))"
PicturePutTask="@(async (id, data, action) => await PersonsWebAPIService.PutPersonPhoto(id, new PersonPhotoRequest(data), action))"
PictureDeleteTask="@(async (id, action) => await PersonsWebAPIService.DeletePersonPhoto(id, action))"
PicturePlaceholder="/assets/person_picture.png"
Class="h-100"/>
</div>
<div class="col">

View File

@@ -10,6 +10,7 @@ public partial class PersonEditPage : ComponentBase
{
#region SERVICES
[Inject] private NavigationManager NavigationManager { get; set; } = default!;
[Inject] private IAuthenticationService AuthenticationService { get; set; } = default!;
[Inject] private IPersonsWebAPIService PersonsWebAPIService { get; set; } = default!;
@@ -61,7 +62,7 @@ public partial class PersonEditPage : ComponentBase
{
endTasks.AddRange(
[
PersonsWebAPIService.GetPerson(Id.Value, data => _person = data)
PersonsWebAPIService.GetPerson(Id.Value, data => _person = data, () => NavigationManager.NavigateTo("/person/new", true))
]);
}

View File

@@ -86,9 +86,9 @@
"PutPerson": "/{0}",
"DeletePerson": "/{0}",
"GetPersonsViewRank": "/view",
"GetPersonPhoto": "/{0}/poster",
"PutPersonPhoto": "/{0}/poster",
"DeletePersonPhoto": "/{0}/poster"
"GetPersonPhoto": "/{0}/photo",
"PutPersonPhoto": "/{0}/photo",
"DeletePersonPhoto": "/{0}/photo"
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 747 KiB