60 lines
2.2 KiB
Plaintext
60 lines
2.2 KiB
Plaintext
@page
|
|
@using Models;
|
|
@using System.Globalization
|
|
@model WebApp.Pages.AnnouncementModel
|
|
@{
|
|
Announcement announcement = (Announcement)ViewData["announcement"];
|
|
ViewData["Title"] = $"{announcement.Title}";
|
|
}
|
|
<h1>@announcement.Title</h1>
|
|
<p>
|
|
Published @announcement.PublishDate.ToString("g") by @announcement.Author.Name
|
|
@Html.Raw((announcement.Author.Role == UserRole.ADMIN || announcement.Author.Role == UserRole.MANAGER)
|
|
? $"<b>({CultureInfo.CurrentCulture.TextInfo.ToTitleCase(announcement.Author.Role.ToString().ToLower())})</b>"
|
|
: "")
|
|
@(announcement.IsImportant ? "Important" : "") @(announcement.IsSticky ? "Sticky" : "")
|
|
</p>
|
|
<hr/>
|
|
<p>@Html.Raw(announcement.Description.Replace(Environment.NewLine, "<br />"))</p>
|
|
<br/>
|
|
<h3>Comments</h3>
|
|
@if (announcement.Comments.Count() == 0)
|
|
{
|
|
<p>No comments found</p>
|
|
}
|
|
else
|
|
{
|
|
foreach (Comment comment in announcement.Comments)
|
|
{
|
|
DisplayComment(comment, 0);
|
|
}
|
|
}
|
|
|
|
@{
|
|
void DisplayComment(Comment comment, int level)
|
|
{
|
|
<div class="d-flex flex-row">
|
|
@for (int i = 0; i < level; i++)
|
|
{
|
|
<a class="me-3" href="#"></a>
|
|
}
|
|
<div class="card flex-fill">
|
|
<div class="card-body">
|
|
<h5 class="card-title">@comment.Author.Name @Html.Raw((comment.Author.Role == UserRole.ADMIN || comment.Author.Role == UserRole.MANAGER) ? $"<b>({CultureInfo.CurrentCulture.TextInfo.ToTitleCase(comment.Author.Role.ToString().ToLower())})</b>" : "")</h5>
|
|
<h6>@comment.PublishDate.ToString("g")</h6>
|
|
<p class="card-text">@Html.Raw(comment.Description.Replace(Environment.NewLine, "<br />"))</p>
|
|
<a class="btn btn-outline-success" href="#">Like</a>
|
|
<a class="btn btn-outline-danger" href="#">Dislike</a>
|
|
<a class="btn btn-outline-primary" href="#">Reply</a>
|
|
</div>
|
|
@if (comment.Responses.Count != 0)
|
|
{
|
|
foreach (var response in comment.Responses)
|
|
{
|
|
DisplayComment(response, level + 1);
|
|
}
|
|
}
|
|
</div>
|
|
</div>
|
|
}
|
|
} |