style: hide empty section for articles with no other parts

This commit is contained in:
Oliver Booth 2024-04-27 17:00:20 +01:00
parent 91249029dc
commit 98c923b07b
Signed by: oliverbooth
GPG Key ID: E60B570D1B7557B5
3 changed files with 43 additions and 28 deletions

View File

@ -31,6 +31,12 @@ public interface ITutorialArticle
/// <value>The ID of the folder.</value> /// <value>The ID of the folder.</value>
int Folder { get; } int Folder { get; }
/// <summary>
/// Gets a value indicating whether this article is part of a multi-part series.
/// </summary>
/// <value><see langword="true" /> if this article has additional parts; otherwise, <see langword="false" />.</value>
bool HasOtherParts { get; }
/// <summary> /// <summary>
/// Gets the ID of this article. /// Gets the ID of this article.
/// </summary> /// </summary>

View File

@ -1,3 +1,5 @@
using System.ComponentModel.DataAnnotations.Schema;
namespace OliverBooth.Data.Web; namespace OliverBooth.Data.Web;
/// <summary> /// <summary>
@ -17,6 +19,10 @@ internal sealed class TutorialArticle : IEquatable<TutorialArticle>, ITutorialAr
/// <inheritdoc /> /// <inheritdoc />
public int Folder { get; private set; } public int Folder { get; private set; }
/// <inheritdoc />
[NotMapped]
public bool HasOtherParts => NextPart is not null || PreviousPart is not null;
/// <inheritdoc /> /// <inheritdoc />
public int Id { get; private set; } public int Id { get; private set; }

View File

@ -60,6 +60,8 @@
@Html.Raw(TutorialService.RenderArticle(article)) @Html.Raw(TutorialService.RenderArticle(article))
</article> </article>
@if (article.HasOtherParts)
{
<hr> <hr>
<div class="row"> <div class="row">
@ -90,6 +92,7 @@
} }
</div> </div>
</div> </div>
}
<hr/> <hr/>