diff --git a/docs/technical/theming/Theming.md b/docs/technical/theming/Theming.md
index 8955e9f3..521d26bd 100644
--- a/docs/technical/theming/Theming.md
+++ b/docs/technical/theming/Theming.md
@@ -179,6 +179,7 @@ Known page keys:
| `shared/audio-player/queue-item` | The queue item of the audio player bar. |
| `shared/audio-player/playlist-item` | The playlist item of the audio player bar. |
| `library/written-content-library/book-library/books/index` | The books browsing page. |
+| `library/written-content-library/book-library/books/item` | The details and editing page of a book. |
| `library/written-content-library/book-library/books/deleted-items` | The deleted items page of a book library, which restores deleted books. |
| `library/audio-library/music-library/deleted-items` | The deleted items page of a music library, which restores deleted artists, albums and tracks. |
| `playlists/index` | The page that lists and deletes the playlists of the current user. |
@@ -590,6 +591,27 @@ The page script renders the cards into `books-container` and drives these hooks:
| `.media-card`, `.card-actions-trigger` and `.card-actions-menu` | Render a book card and its actions menu. |
| `.card-action-delete` | Deletes the book of the card. |
+#### The Book Details and Editing Page
+
+`library/written-content-library/book-library/books/item` renders the details and editing page of a book. Its fallback is `Core/Views/Library/WrittenContentLibrary/BookLibrary/Books/Item.cshtml`. Both bundled themes ship `templates/library/written-content-library/book-library/books/item.html`.
+
+Page data:
+
+| Field | Content |
+| --- | --- |
+| `bookId` | The Id of the book shown. |
+| `libraryId` | The Id of the library the book belongs to. |
+| `antiforgeryToken` | The anti-forgery request token for the save, delete and cover upload requests. |
+| `saveUrl` | The route that saves the book. The trailing `00000000-0000-0000-0000-000000000000` is replaced by the Id of the book. |
+| `deleteUrl` | The route that deletes the book. The trailing `00000000-0000-0000-0000-000000000000` is replaced by the Id of the book, and `libraryId` is appended as a query parameter. |
+| `coverUrl` | The route that uploads the cover of the book. The trailing `00000000-0000-0000-0000-000000000000` is replaced by the Id of the book. |
+| `backUrl` | The route of the books page of the library. |
+| `bookJson` | The full details of the book, serialized as JSON. It carries the same fields as the book details response, including `metadata`, identifiers, ISBNs, `contributors`, `ratings` and `coverPath`. |
+| `strings` | The localized strings of the page, keyed by their resource names. |
+| `stringsJson` | The same localized strings serialized as JSON, with camel case keys, for the page script. |
+
+The `contributors` of `bookJson` are references to the contributors table, each with the shape `{ contributorId, role }`, where `contributorId` is the Id of the contributor. A theme that needs a contributor's name resolves it from the contributors table using that Id.
+
#### The Deleted Items Page
`library/written-content-library/book-library/books/deleted-items` lists the books that were deleted from a book library and lets the user restore them. Its fallback is `Core/Views/Library/WrittenContentLibrary/BookLibrary/Books/DeletedItems.cshtml`. The bundled themes ship their own `templates/library/written-content-library/book-library/books/deleted-items.html`; when a theme has no template for the page, the application renders the fallback view.
diff --git a/src/Nemera.Presentation.Api/Core/Themes/Bundled/editorial-paper.zip b/src/Nemera.Presentation.Api/Core/Themes/Bundled/editorial-paper.zip
index a4dca3c6..80621fc5 100644
Binary files a/src/Nemera.Presentation.Api/Core/Themes/Bundled/editorial-paper.zip and b/src/Nemera.Presentation.Api/Core/Themes/Bundled/editorial-paper.zip differ
diff --git a/src/Nemera.Presentation.Api/Core/Themes/Bundled/nemera-default.zip b/src/Nemera.Presentation.Api/Core/Themes/Bundled/nemera-default.zip
index 92edc598..e8105d15 100644
Binary files a/src/Nemera.Presentation.Api/Core/Themes/Bundled/nemera-default.zip and b/src/Nemera.Presentation.Api/Core/Themes/Bundled/nemera-default.zip differ
diff --git a/src/Nemera.Presentation.Web/Common/DTO/MediaContributors/MediaContributorDto.cs b/src/Nemera.Presentation.Web/Common/DTO/MediaContributors/MediaContributorDto.cs
deleted file mode 100644
index bc6a4507..00000000
--- a/src/Nemera.Presentation.Web/Common/DTO/MediaContributors/MediaContributorDto.cs
+++ /dev/null
@@ -1,23 +0,0 @@
-#region ========================================================================= USING =====================================================================================
-using Nemera.Presentation.Web.Common.Enums.MediaContributors;
-using System.Diagnostics;
-#endregion
-
-namespace Nemera.Presentation.Web.Common.DTO.MediaContributors;
-
-///
-/// Data transfer object for a media contributor.
-///
-[DebuggerDisplay("Name: {Name}")]
-public class MediaContributorDto
-{
- ///
- /// Gets the name of the contributor.
- ///
- public MediaContributorNameDto? Name { get; set; }
-
- ///
- /// Gets the canonical role of the contributor, used as the key of its localized display string.
- ///
- public MediaContributorRole? Role { get; set; }
-}
diff --git a/src/Nemera.Presentation.Web/Common/DTO/MediaContributors/MediaContributorNameDto.cs b/src/Nemera.Presentation.Web/Common/DTO/MediaContributors/MediaContributorNameDto.cs
deleted file mode 100644
index 3eae83f3..00000000
--- a/src/Nemera.Presentation.Web/Common/DTO/MediaContributors/MediaContributorNameDto.cs
+++ /dev/null
@@ -1,22 +0,0 @@
-#region ========================================================================= USING =====================================================================================
-using System.Diagnostics;
-#endregion
-
-namespace Nemera.Presentation.Web.Common.DTO.MediaContributors;
-
-///
-/// Data transfer object for a media contributor name.
-///
-[DebuggerDisplay("DisplayName: {DisplayName}")]
-public class MediaContributorNameDto
-{
- ///
- /// Gets the name by which the contributor is popularly known.
- ///
- public string? DisplayName { get; set; }
-
- ///
- /// Gets the legal name of the contributor.
- ///
- public string? LegalName { get; set; }
-}
diff --git a/src/Nemera.Presentation.Web/Common/DTO/WrittenContentLibrary/BookLibrary/BookDetailsDto.cs b/src/Nemera.Presentation.Web/Common/DTO/WrittenContentLibrary/BookLibrary/BookDetailsDto.cs
index 610daf1c..5be632ac 100644
--- a/src/Nemera.Presentation.Web/Common/DTO/WrittenContentLibrary/BookLibrary/BookDetailsDto.cs
+++ b/src/Nemera.Presentation.Web/Common/DTO/WrittenContentLibrary/BookLibrary/BookDetailsDto.cs
@@ -102,9 +102,9 @@ public class BookDetailsDto
public List? ISBNs { get; set; }
///
- /// Gets or sets the list of media contributors of the book.
+ /// Gets or sets the list of references to the media contributors of the book, each with the role they played.
///
- public List? Contributors { get; set; }
+ public List? Contributors { get; set; }
///
/// Gets or sets the list of ratings of the book.
diff --git a/src/Nemera.Presentation.Web/Common/Http/HttpContextItemKeys.cs b/src/Nemera.Presentation.Web/Common/Http/HttpContextItemKeys.cs
index b794f3b0..5f3af176 100644
--- a/src/Nemera.Presentation.Web/Common/Http/HttpContextItemKeys.cs
+++ b/src/Nemera.Presentation.Web/Common/Http/HttpContextItemKeys.cs
@@ -29,4 +29,9 @@ public static class HttpContextItemKeys
/// The Cache-Control value chosen by the endpoint, restored when the response starts.
///
public const string CACHE_CONTROL = "CacheControl";
+
+ ///
+ /// The key under which the flag indicating that the endpoint bound its request and started executing is stored.
+ ///
+ public const string ENDPOINT_STARTED = "EndpointStarted";
}
diff --git a/src/Nemera.Presentation.Web/Common/Http/JsonBindingFailureClientErrorMetadata.cs b/src/Nemera.Presentation.Web/Common/Http/JsonBindingFailureClientErrorMetadata.cs
new file mode 100644
index 00000000..6762b105
--- /dev/null
+++ b/src/Nemera.Presentation.Web/Common/Http/JsonBindingFailureClientErrorMetadata.cs
@@ -0,0 +1,8 @@
+namespace Nemera.Presentation.Web.Common.Http;
+
+///
+/// Marks an endpoint whose malformed JSON request bodies are answered with a client error ProblemDetails instead of the default JSON error envelope.
+///
+public sealed class JsonBindingFailureClientErrorMetadata
+{
+}
diff --git a/src/Nemera.Presentation.Web/Common/Middlewares/ExceptionHandlingMiddleware.cs b/src/Nemera.Presentation.Web/Common/Middlewares/ExceptionHandlingMiddleware.cs
index e3929f49..77b85bbc 100644
--- a/src/Nemera.Presentation.Web/Common/Middlewares/ExceptionHandlingMiddleware.cs
+++ b/src/Nemera.Presentation.Web/Common/Middlewares/ExceptionHandlingMiddleware.cs
@@ -1,11 +1,13 @@
#region ========================================================================= USING =====================================================================================
using Nemera.Presentation.Web.Common.Exceptions;
+using Nemera.Presentation.Web.Common.Http;
using Microsoft.AspNetCore.Authentication;
using Microsoft.AspNetCore.Authentication.Cookies;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Localization;
using Microsoft.Extensions.Logging;
using System;
+using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Net;
@@ -61,6 +63,11 @@ public class ExceptionHandlingMiddleware
{
await HandleApiExceptionAsync(context, apiException);
}
+ catch (JsonException jsonException) when (IsOptedInJsonBindingFailure(context, jsonException))
+ {
+ // The JSON request body failed to bind before the endpoint ran, so the caller sent a body that does not match the request contract.
+ await HandleJsonBindingExceptionAsync(context, jsonException);
+ }
catch (Exception ex) // Other cases.
{
if (_logger.IsEnabled(LogLevel.Error))
@@ -100,6 +107,63 @@ public class ExceptionHandlingMiddleware
}
}
+ ///
+ /// Determines whether a JSON exception is a request body binding failure of an endpoint that opted into client error responses.
+ ///
+ /// The for the current request.
+ /// The JSON exception thrown while processing the request.
+ /// when the exception is a JSON body binding failure that should be reported as a client error.
+ private static bool IsOptedInJsonBindingFailure(HttpContext context, JsonException jsonException)
+ {
+ return jsonException is not FastEndpoints.JsonBindException
+ && !context.Items.ContainsKey(HttpContextItemKeys.ENDPOINT_STARTED)
+ && context.GetEndpoint()?.Metadata.GetMetadata() is not null;
+ }
+
+ ///
+ /// Handles a JSON request body that could not be deserialized into the request contract.
+ ///
+ /// The for the current request.
+ /// The exception thrown while binding the request body.
+ private async Task HandleJsonBindingExceptionAsync(HttpContext context, JsonException jsonException)
+ {
+ if (_logger.IsEnabled(LogLevel.Warning))
+ _logger.LogWarning(jsonException, "The JSON request body could not be deserialized: {Message}", jsonException.Message);
+
+ // Once the response has started, its status and headers are already on the wire, so they can no longer be replaced.
+ if (context.Response.HasStarted)
+ {
+ context.Abort();
+ return;
+ }
+
+ string errorMessage = _stringLocalizer["OneOrMoreValidationErrorsOccurred"].Value;
+ string? trimmedPath = jsonException.Path?.TrimStart('$', '.');
+ string fieldName = string.IsNullOrWhiteSpace(trimmedPath) ? "request" : trimmedPath;
+ if (IsJsonRequest(context))
+ {
+ context.Response.StatusCode = StatusCodes.Status400BadRequest;
+ await context.Response.WriteAsJsonAsync(
+ new
+ {
+ type = "https://tools.ietf.org/html/rfc9110#section-15.5.1",
+ title = "General.Validation",
+ status = StatusCodes.Status400BadRequest,
+ detail = "OneOrMoreValidationErrorsOccurred",
+ instance = context.Request.Path.ToString(),
+ errors = new Dictionary { [fieldName] = [errorMessage] },
+ errorMessage
+ },
+ options: null,
+ contentType: "application/problem+json",
+ cancellationToken: context.RequestAborted).ConfigureAwait(false);
+ }
+ else if (IsNavigationRequest(context))
+ await WriteHtmlErrorResponseAsync(context, StatusCodes.Status400BadRequest, errorMessage).ConfigureAwait(false);
+ else
+ await WriteStatusOnlyResponseAsync(context, StatusCodes.Status400BadRequest).ConfigureAwait(false);
+ }
+
///
/// Handles exceptions specific to the API, including problem details.
///
diff --git a/src/Nemera.Presentation.Web/Common/Requests/Library/WrittenContentLibrary/BookLibrary/Books/UpdateBookRequest.cs b/src/Nemera.Presentation.Web/Common/Requests/Library/WrittenContentLibrary/BookLibrary/Books/UpdateBookRequest.cs
index 873fc017..e2de40b0 100644
--- a/src/Nemera.Presentation.Web/Common/Requests/Library/WrittenContentLibrary/BookLibrary/Books/UpdateBookRequest.cs
+++ b/src/Nemera.Presentation.Web/Common/Requests/Library/WrittenContentLibrary/BookLibrary/Books/UpdateBookRequest.cs
@@ -30,7 +30,7 @@ namespace Nemera.Presentation.Web.Common.Requests.Library.WrittenContentLibrary.
/// The Barnes & Noble Id of the book. Optional.
/// The Apple Books Id of the book. Optional.
/// The list of ISBN (International Standard Book Number) of the book. Required.
-/// The list of media contributors of the book. Required.
+/// The list of references to the media contributors of the book, each with the role they played. Required.
/// The list of ratings of the book. Required.
[DebuggerDisplay("Title: {Metadata?.Title}")]
public record UpdateBookRequest(
@@ -51,6 +51,6 @@ public record UpdateBookRequest(
string? BarnesAndNobleId,
string? AppleBooksId,
List? ISBNs,
- List? Contributors,
+ List? Contributors,
List? Ratings
);
diff --git a/src/Nemera.Presentation.Web/Core/Endpoints/Common/BaseEndpoint.cs b/src/Nemera.Presentation.Web/Core/Endpoints/Common/BaseEndpoint.cs
index 413638a5..8947363a 100644
--- a/src/Nemera.Presentation.Web/Core/Endpoints/Common/BaseEndpoint.cs
+++ b/src/Nemera.Presentation.Web/Core/Endpoints/Common/BaseEndpoint.cs
@@ -3,6 +3,8 @@ using FastEndpoints;
using Nemera.Presentation.Web.Common.Http;
using Microsoft.AspNetCore.Http;
using System.Collections.Generic;
+using System.Threading;
+using System.Threading.Tasks;
#endregion
namespace Nemera.Presentation.Web.Core.Endpoints.Common;
@@ -31,6 +33,25 @@ public abstract class BaseEndpoint : Endpoint
+ /// Marks the endpoint so that malformed JSON request bodies are answered with a client error ProblemDetails instead of the default JSON error envelope.
+ ///
+ protected void ReportJsonBindingFailuresAsClientErrors()
+ {
+ Metadata(new JsonBindingFailureClientErrorMetadata());
+ }
+
+ ///
+ /// Marks the request as past request binding, so that JSON binding failures can be told apart from JSON failures thrown while the endpoint runs.
+ ///
+ /// The request bound from the incoming request.
+ /// Cancellation token that can be used to stop the execution.
+ public override Task OnBeforeHandleAsync(TRequest request, CancellationToken cancellationToken)
+ {
+ HttpContext.Items[HttpContextItemKeys.ENDPOINT_STARTED] = true;
+ return Task.CompletedTask;
+ }
+
///
/// Sets the Cache-Control header, and remembers the chosen value so that it can be restored after later components overwrite it.
///
diff --git a/src/Nemera.Presentation.Web/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/SaveBook/SaveBookEndpoint.cs b/src/Nemera.Presentation.Web/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/SaveBook/SaveBookEndpoint.cs
index 25c79ed0..05fa33c4 100644
--- a/src/Nemera.Presentation.Web/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/SaveBook/SaveBookEndpoint.cs
+++ b/src/Nemera.Presentation.Web/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/SaveBook/SaveBookEndpoint.cs
@@ -41,6 +41,7 @@ public class SaveBookEndpoint : BaseEndpoint
DontAutoTag();
Options(options => options.WithTags("Books"));
EnableAntiforgery();
+ ReportJsonBindingFailuresAsClientErrors();
}
///
diff --git a/src/Nemera.Presentation.Web/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/SaveBook/SaveBookEndpointSummary.cs b/src/Nemera.Presentation.Web/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/SaveBook/SaveBookEndpointSummary.cs
index 8347dd54..1ba53d0f 100644
--- a/src/Nemera.Presentation.Web/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/SaveBook/SaveBookEndpointSummary.cs
+++ b/src/Nemera.Presentation.Web/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/SaveBook/SaveBookEndpointSummary.cs
@@ -69,7 +69,7 @@ public class SaveBookEndpointSummary : Summary r.BarnesAndNobleId, "The Barnes & Noble Id of the book. Optional.");
RequestParam(r => r.AppleBooksId, "The Apple Books Id of the book. Optional.");
RequestParam(r => r.ISBNs, "The list of ISBN (International Standard Book Number) of the book. Required.");
- RequestParam(r => r.Contributors, "The list of media contributors of the book. Required.");
+ RequestParam(r => r.Contributors, "The list of references to the media contributors of the book, each with the role they played. Required.");
RequestParam(r => r.Ratings, "The list of ratings of the book. Required.");
ExampleRequest = new UpdateBookRequest(
@@ -139,14 +139,14 @@ public class SaveBookEndpointSummary : Summaryتغيير الغلاف
-
- الاسم
-
الأشخاص الذين ساهموا في الكتاب، مثل مؤلفيه.
diff --git a/src/Nemera.Presentation.Web/Core/Resources/Views/Library/WrittenContentLibrary/BookLibrary/Books/Item.de-DE.resx b/src/Nemera.Presentation.Web/Core/Resources/Views/Library/WrittenContentLibrary/BookLibrary/Books/Item.de-DE.resx
index 9d77b677..5a6d356f 100644
--- a/src/Nemera.Presentation.Web/Core/Resources/Views/Library/WrittenContentLibrary/BookLibrary/Books/Item.de-DE.resx
+++ b/src/Nemera.Presentation.Web/Core/Resources/Views/Library/WrittenContentLibrary/BookLibrary/Books/Item.de-DE.resx
@@ -51,9 +51,6 @@
Titelbild ändern
-
- Name
-
Die Personen, die zum Buch beigetragen haben, wie seine Autoren.
diff --git a/src/Nemera.Presentation.Web/Core/Resources/Views/Library/WrittenContentLibrary/BookLibrary/Books/Item.en-US.resx b/src/Nemera.Presentation.Web/Core/Resources/Views/Library/WrittenContentLibrary/BookLibrary/Books/Item.en-US.resx
index 5dcdd2e5..8fb933eb 100644
--- a/src/Nemera.Presentation.Web/Core/Resources/Views/Library/WrittenContentLibrary/BookLibrary/Books/Item.en-US.resx
+++ b/src/Nemera.Presentation.Web/Core/Resources/Views/Library/WrittenContentLibrary/BookLibrary/Books/Item.en-US.resx
@@ -150,9 +150,6 @@
Contributors
-
- Name
-
Role
diff --git a/src/Nemera.Presentation.Web/Core/Resources/Views/Library/WrittenContentLibrary/BookLibrary/Books/Item.es-ES.resx b/src/Nemera.Presentation.Web/Core/Resources/Views/Library/WrittenContentLibrary/BookLibrary/Books/Item.es-ES.resx
index 38c6d124..d1ac1572 100644
--- a/src/Nemera.Presentation.Web/Core/Resources/Views/Library/WrittenContentLibrary/BookLibrary/Books/Item.es-ES.resx
+++ b/src/Nemera.Presentation.Web/Core/Resources/Views/Library/WrittenContentLibrary/BookLibrary/Books/Item.es-ES.resx
@@ -51,9 +51,6 @@
Cambiar portada
-
- Nombre
-
Las personas que contribuyeron al libro, como sus autores.
diff --git a/src/Nemera.Presentation.Web/Core/Resources/Views/Library/WrittenContentLibrary/BookLibrary/Books/Item.fr-FR.resx b/src/Nemera.Presentation.Web/Core/Resources/Views/Library/WrittenContentLibrary/BookLibrary/Books/Item.fr-FR.resx
index c736b831..02ef6d95 100644
--- a/src/Nemera.Presentation.Web/Core/Resources/Views/Library/WrittenContentLibrary/BookLibrary/Books/Item.fr-FR.resx
+++ b/src/Nemera.Presentation.Web/Core/Resources/Views/Library/WrittenContentLibrary/BookLibrary/Books/Item.fr-FR.resx
@@ -51,9 +51,6 @@
Changer la couverture
-
- Nom
-
Les personnes ayant contribué au livre, comme ses auteurs.
diff --git a/src/Nemera.Presentation.Web/Core/Resources/Views/Library/WrittenContentLibrary/BookLibrary/Books/Item.it-IT.resx b/src/Nemera.Presentation.Web/Core/Resources/Views/Library/WrittenContentLibrary/BookLibrary/Books/Item.it-IT.resx
index da54e758..cabf50e4 100644
--- a/src/Nemera.Presentation.Web/Core/Resources/Views/Library/WrittenContentLibrary/BookLibrary/Books/Item.it-IT.resx
+++ b/src/Nemera.Presentation.Web/Core/Resources/Views/Library/WrittenContentLibrary/BookLibrary/Books/Item.it-IT.resx
@@ -51,9 +51,6 @@
Cambia copertina
-
- Nome
-
Le persone che hanno contribuito al libro, come i suoi autori.
diff --git a/src/Nemera.Presentation.Web/Core/Resources/Views/Library/WrittenContentLibrary/BookLibrary/Books/Item.ja-JP.resx b/src/Nemera.Presentation.Web/Core/Resources/Views/Library/WrittenContentLibrary/BookLibrary/Books/Item.ja-JP.resx
index 392a94a4..9a8a5f2d 100644
--- a/src/Nemera.Presentation.Web/Core/Resources/Views/Library/WrittenContentLibrary/BookLibrary/Books/Item.ja-JP.resx
+++ b/src/Nemera.Presentation.Web/Core/Resources/Views/Library/WrittenContentLibrary/BookLibrary/Books/Item.ja-JP.resx
@@ -51,9 +51,6 @@
表紙を変更
-
- 名前
-
著者など、本に貢献した人々。
diff --git a/src/Nemera.Presentation.Web/Core/Resources/Views/Library/WrittenContentLibrary/BookLibrary/Books/Item.resx b/src/Nemera.Presentation.Web/Core/Resources/Views/Library/WrittenContentLibrary/BookLibrary/Books/Item.resx
index cd50688c..c753047a 100644
--- a/src/Nemera.Presentation.Web/Core/Resources/Views/Library/WrittenContentLibrary/BookLibrary/Books/Item.resx
+++ b/src/Nemera.Presentation.Web/Core/Resources/Views/Library/WrittenContentLibrary/BookLibrary/Books/Item.resx
@@ -150,9 +150,6 @@
Contributors
-
- Name
-
Role
diff --git a/src/Nemera.Presentation.Web/Core/Resources/Views/Library/WrittenContentLibrary/BookLibrary/Books/Item.ro-RO.resx b/src/Nemera.Presentation.Web/Core/Resources/Views/Library/WrittenContentLibrary/BookLibrary/Books/Item.ro-RO.resx
index d4ad4a1e..eea515ca 100644
--- a/src/Nemera.Presentation.Web/Core/Resources/Views/Library/WrittenContentLibrary/BookLibrary/Books/Item.ro-RO.resx
+++ b/src/Nemera.Presentation.Web/Core/Resources/Views/Library/WrittenContentLibrary/BookLibrary/Books/Item.ro-RO.resx
@@ -51,9 +51,6 @@
Schimbă coperta
-
- Nume
-
Persoanele care au contribuit la carte, precum autorii ei.
diff --git a/src/Nemera.Presentation.Web/Core/Resources/Views/Library/WrittenContentLibrary/BookLibrary/Books/Item.uk-UA.resx b/src/Nemera.Presentation.Web/Core/Resources/Views/Library/WrittenContentLibrary/BookLibrary/Books/Item.uk-UA.resx
index ac11ec59..677de677 100644
--- a/src/Nemera.Presentation.Web/Core/Resources/Views/Library/WrittenContentLibrary/BookLibrary/Books/Item.uk-UA.resx
+++ b/src/Nemera.Presentation.Web/Core/Resources/Views/Library/WrittenContentLibrary/BookLibrary/Books/Item.uk-UA.resx
@@ -51,9 +51,6 @@
Змінити обкладинку
-
- Ім'я
-
Люди, які долучилися до створення книги, як-от її автори.
diff --git a/src/Nemera.Presentation.Web/Core/Resources/Views/Library/WrittenContentLibrary/BookLibrary/Books/Item.zh-CN.resx b/src/Nemera.Presentation.Web/Core/Resources/Views/Library/WrittenContentLibrary/BookLibrary/Books/Item.zh-CN.resx
index 720a9569..a478c6ea 100644
--- a/src/Nemera.Presentation.Web/Core/Resources/Views/Library/WrittenContentLibrary/BookLibrary/Books/Item.zh-CN.resx
+++ b/src/Nemera.Presentation.Web/Core/Resources/Views/Library/WrittenContentLibrary/BookLibrary/Books/Item.zh-CN.resx
@@ -51,9 +51,6 @@
更换封面
-
- 姓名
-
为图书作出贡献的人,例如其作者。
diff --git a/src/Nemera.Presentation.Web/Core/Views/Library/WrittenContentLibrary/BookLibrary/Books/Item.cshtml b/src/Nemera.Presentation.Web/Core/Views/Library/WrittenContentLibrary/BookLibrary/Books/Item.cshtml
index 86242c5e..4a22935b 100644
--- a/src/Nemera.Presentation.Web/Core/Views/Library/WrittenContentLibrary/BookLibrary/Books/Item.cshtml
+++ b/src/Nemera.Presentation.Web/Core/Views/Library/WrittenContentLibrary/BookLibrary/Books/Item.cshtml
@@ -34,7 +34,7 @@
var genres = metadata?.Genres ?? [];
var tags = metadata?.Tags ?? [];
var isbns = Model.ISBNs ?? [];
- var contributors = Model.Contributors ?? [];
+ var contributors = Model.Contributors ?? [];
var ratings = Model.Ratings ?? [];
// The full set of canonical media contributor roles, mirroring the MediaContributorRole enum members, offered by the role combobox.
var contributorRoles = new[]
@@ -42,7 +42,7 @@
"Other", "Author", "Translator", "Illustrator", "Publisher", "Narrator", "Actor", "Director", "Screenwriter",
"Composer", "Lyricist", "Arranger", "Conductor", "Producer", "ExecutiveProducer", "Engineer", "Mixer", "Remixer",
"RecordLabel", "Vocals", "BackingVocals", "Guitar", "BassGuitar", "Drums", "Percussion", "Keyboards", "Piano",
- "Synthesizer", "Strings", "Woodwinds", "Brass", "Choir", "Orchestrator"
+ "Synthesizer", "Strings", "Woodwinds", "Brass", "Choir", "Orchestrator", "Performer"
};
// Resolves the localized label of a contributor role, keyed by its canonical value.
Func roleLabel = role => role switch
@@ -441,7 +441,7 @@
-
@_localizer["ContributorName"]
+
@_localizer["ContributorId"]
@_localizer["Role"]
@@ -451,7 +451,7 @@
@foreach (var contributor in contributors)
{
-
+
@@ -637,7 +637,7 @@
Format: readRowComboboxValue(row, '.isbn-format-combobox') || null
})),
Contributors: Array.from(contributorsBody.querySelectorAll('.contributor-row')).map(row => ({
- Name: { DisplayName: row.querySelector('.contributor-name').value.trim() || null },
+ ContributorId: row.querySelector('.contributor-id').value.trim() || '00000000-0000-0000-0000-000000000000',
Role: readRowComboboxValue(row, '.contributor-role-combobox') || null
})),
Ratings: Array.from(ratingsBody.querySelectorAll('.rating-row')).map(row => ({
@@ -787,15 +787,13 @@
await updateContentAsync(`${libraryIndexUrl}?libraryId=${encodeURIComponent(libraryId)}`, true);
}
- // Builds the HTML of an enlightenment combobox of a row, with the provided option values.
- function buildRowCombobox(optionValues, selectedValue) {
+ // Builds the HTML of an enlightenment combobox of a row, with the provided option values and an optional wrapper class.
+ function buildRowCombobox(optionValues, selectedValue, wrapperClass) {
const id = `row-combobox-${generatedId++}`;
- const options = optionValues.map(option => {
- const selected = option.value === selectedValue ? ' selected' : '';
- return `