From 4fcaca1a6e48980fd32305ef8027549175bf236b Mon Sep 17 00:00:00 2001 From: glax Date: Sat, 10 Jun 2023 14:45:04 +0200 Subject: [PATCH] Multiple authors resolves #7 --- Tranga/Publication.cs | 12 ++++++++++++ Website/interaction.js | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/Tranga/Publication.cs b/Tranga/Publication.cs index 60ea847..03ef85c 100644 --- a/Tranga/Publication.cs +++ b/Tranga/Publication.cs @@ -29,6 +29,18 @@ public readonly struct Publication private static readonly Regex LegalCharacters = new Regex(@"[A-Z]*[a-z]*[0-9]* *\.*-*,*'*\'*\)*\(*~*!*"); + [JsonConstructor] //Legacy + public Publication(string sortName, string? author, string? description, Dictionary altTitles, + string[] tags, string? posterUrl, string? coverFileNameInCache, Dictionary? links, int? year, + string? originalLanguage, string status, string publicationId) + { + List pAuthors = new(); + if(author is not null) + pAuthors.Add(author); + this = new Publication(sortName, pAuthors, description, altTitles, tags, posterUrl, + coverFileNameInCache, links, year, originalLanguage, status, publicationId); + } + public Publication(string sortName, List authors, string? description, Dictionary altTitles, string[] tags, string? posterUrl, string? coverFileNameInCache, Dictionary? links, int? year, string? originalLanguage, string status, string publicationId) { this.sortName = sortName; diff --git a/Website/interaction.js b/Website/interaction.js index d5c8c30..b92d63e 100644 --- a/Website/interaction.js +++ b/Website/interaction.js @@ -233,7 +233,7 @@ function ShowPublicationViewerWindow(publicationId, event, add){ publicationViewerName.innerText = publication.sortName; publicationViewerTags.innerText = publication.tags.join(", "); publicationViewerDescription.innerText = publication.description; - publicationViewerAuthor.innerText = publication.author; + publicationViewerAuthor.innerText = publication.authors.join(','); pubviewcover.src = `imageCache/${publication.coverFileNameInCache}`; toEditId = publicationId;