Merge pull request #96 from mateuszskoczek/fetaures/picture_editor_fix
multiple person edit page fixes
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -6,41 +6,43 @@
|
||||
<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">
|
||||
<button type="button" class="btn btn-secondary btn-block btn-stretch-x" @onclick="Save" disabled=@(!Id.HasValue || _pictureSaving || _pictureDeleting) autocomplete="off">
|
||||
@if (!_pictureSaving)
|
||||
{
|
||||
<span>Save</span>
|
||||
}
|
||||
else
|
||||
{
|
||||
<span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span>
|
||||
<span>Saving...</span>
|
||||
}
|
||||
</button>
|
||||
</div>
|
||||
<div class="flex-fill">
|
||||
<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 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)
|
||||
{
|
||||
<span>Save</span>
|
||||
}
|
||||
else
|
||||
{
|
||||
<span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span>
|
||||
<span>Saving...</span>
|
||||
}
|
||||
</button>
|
||||
</div>
|
||||
<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)
|
||||
{
|
||||
<span>Delete</span>
|
||||
}
|
||||
else
|
||||
{
|
||||
<span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span>
|
||||
<span>Deleting...</span>
|
||||
}
|
||||
</button>
|
||||
</div>
|
||||
<button type="button" class="btn btn-danger btn-block btn-stretch-x" @onclick="Delete" disabled=@(!Id.HasValue || _pictureSaving || _pictureDeleting) autocomplete="off">
|
||||
@if (!_pictureSaving)
|
||||
{
|
||||
<span>Delete</span>
|
||||
}
|
||||
else
|
||||
{
|
||||
<span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span>
|
||||
<span>Deleting...</span>
|
||||
}
|
||||
</button>
|
||||
}
|
||||
</div>
|
||||
}
|
||||
@@ -60,6 +62,6 @@
|
||||
/* CLASSES */
|
||||
|
||||
.content-width {
|
||||
width: @(ContentWidth);
|
||||
width: @(ContentWidth)px;
|
||||
}
|
||||
</style>
|
||||
@@ -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">
|
||||
|
||||
@@ -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))
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
@@ -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 |
Reference in New Issue
Block a user