From a342335668a22cc0df0dc557e95adb9064a3bd7a Mon Sep 17 00:00:00 2001 From: rbrands Date: Sat, 3 Oct 2020 10:58:28 +0200 Subject: [PATCH] Enable links to InfoCards --- MeetUpPlanner/Client/Pages/InfoComment.razor | 2 +- MeetUpPlanner/Client/Shared/AddComment.razor | 19 +++++++++++++++++++ MeetUpPlanner/Client/Shared/InfoCard.razor | 10 +++++++++- MeetUpPlanner/Shared/CalendarComment.cs | 16 +++++++++++++++- 4 files changed, 44 insertions(+), 3 deletions(-) diff --git a/MeetUpPlanner/Client/Pages/InfoComment.razor b/MeetUpPlanner/Client/Pages/InfoComment.razor index 706b458..a2d7561 100644 --- a/MeetUpPlanner/Client/Pages/InfoComment.razor +++ b/MeetUpPlanner/Client/Pages/InfoComment.razor @@ -8,7 +8,7 @@ @using Microsoft.AspNetCore.SignalR.Client - +
diff --git a/MeetUpPlanner/Client/Shared/AddComment.razor b/MeetUpPlanner/Client/Shared/AddComment.razor index 19e55be..f77f2ef 100644 --- a/MeetUpPlanner/Client/Shared/AddComment.razor +++ b/MeetUpPlanner/Client/Shared/AddComment.razor @@ -10,6 +10,23 @@ Über die Kommentarfunktion können wir uns weiter abstimmen. + @if (EnableLink) + { +
+ + + + Optional: Link zu weiteren Infos, z.B. Fotos, Artikel usw.. + +
+
+ + + + Optional: Kurze Bezeichnung zu dem Link oben, falls der Standardtext nicht passt. + +
+ } @@ -19,6 +36,8 @@ public EventCallback OnSaveComment { get; set; } [Parameter] public EventCallback OnCancel { get; set; } + [Parameter] + public Boolean EnableLink { get; set; } = false; CalendarComment comment = new CalendarComment() { AuthorFirstName = "NN", AuthorLastName = "NN" }; private Boolean saveDisabled = false; diff --git a/MeetUpPlanner/Client/Shared/InfoCard.razor b/MeetUpPlanner/Client/Shared/InfoCard.razor index 47fcd83..4f0d8a4 100644 --- a/MeetUpPlanner/Client/Shared/InfoCard.razor +++ b/MeetUpPlanner/Client/Shared/InfoCard.razor @@ -23,7 +23,15 @@
    @foreach (CalendarComment c in InfoItem.CommentsList) { -
  • @c.AuthorDisplayName (@c.DisplayDate): @c.Comment
  • +
  • + + @c.AuthorDisplayName (@c.DisplayDate): @c.Comment + @if (!String.IsNullOrEmpty(c.Link)) + { + @c.DisplayLinkTitle + } + +
  • }

diff --git a/MeetUpPlanner/Shared/CalendarComment.cs b/MeetUpPlanner/Shared/CalendarComment.cs index fdd5db4..59f4978 100644 --- a/MeetUpPlanner/Shared/CalendarComment.cs +++ b/MeetUpPlanner/Shared/CalendarComment.cs @@ -20,8 +20,12 @@ public class CalendarComment : CosmosDBEntity public string AuthorLastName { get; set; } [JsonProperty(PropertyName = "commentDate")] public DateTime CommentDate { get; set; } - [JsonProperty(PropertyName = "comment"), MaxLength(200, ErrorMessage = "Kommentar zu lang.")] + [JsonProperty(PropertyName = "comment"), MaxLength(250, ErrorMessage = "Kommentar zu lang.")] public string Comment { get; set; } + [JsonProperty(PropertyName = "link", NullValueHandling = NullValueHandling.Ignore), MaxLength(200, ErrorMessage = "Link zu lang.")] + public string Link { get; set; } + [JsonProperty(PropertyName = "linkTitle", NullValueHandling = NullValueHandling.Ignore), MaxLength(80, ErrorMessage = "Link-Titel zu lang.")] + public string LinkTitle { get; set; } [JsonIgnore] public string AuthorDisplayName { @@ -32,6 +36,7 @@ public string AuthorDisplayName return AuthorFirstName + " " + AuthorLastName[0] + "."; } } + [JsonIgnore] public string DisplayDate { get @@ -39,6 +44,15 @@ public string DisplayDate return (null != CommentDate) ? CommentDate.ToString("dd.MM. HH:mm") : String.Empty; } } + [JsonIgnore] + + public string DisplayLinkTitle + { + get + { + return String.IsNullOrEmpty(LinkTitle) ? "Link ..." : LinkTitle; + } + } } }