style: hide empty section for articles with no other parts
This commit is contained in:
parent
91249029dc
commit
98c923b07b
@ -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>
|
||||||
|
@ -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; }
|
||||||
|
|
||||||
|
@ -60,36 +60,39 @@
|
|||||||
@Html.Raw(TutorialService.RenderArticle(article))
|
@Html.Raw(TutorialService.RenderArticle(article))
|
||||||
</article>
|
</article>
|
||||||
|
|
||||||
<hr>
|
@if (article.HasOtherParts)
|
||||||
|
{
|
||||||
|
<hr>
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-sm-12 col-md-6">
|
<div class="col-sm-12 col-md-6">
|
||||||
@if (article.PreviousPart is { } previousPartId &&
|
@if (article.PreviousPart is { } previousPartId &&
|
||||||
TutorialService.TryGetArticle(previousPartId, out ITutorialArticle? previousPart) &&
|
TutorialService.TryGetArticle(previousPartId, out ITutorialArticle? previousPart) &&
|
||||||
previousPart.Visibility == Visibility.Published)
|
previousPart.Visibility == Visibility.Published)
|
||||||
{
|
{
|
||||||
<small>Previous Part</small>
|
<small>Previous Part</small>
|
||||||
<p class="lead">
|
<p class="lead">
|
||||||
<a asp-page="Article" asp-route-slug="@TutorialService.GetFullSlug(previousPart)">
|
<a asp-page="Article" asp-route-slug="@TutorialService.GetFullSlug(previousPart)">
|
||||||
@previousPart.Title
|
@previousPart.Title
|
||||||
</a>
|
</a>
|
||||||
</p>
|
</p>
|
||||||
}
|
}
|
||||||
|
</div>
|
||||||
|
<div class="col-sm-12 col-md-6" style="text-align: right;">
|
||||||
|
@if (article.NextPart is { } nextPartId &&
|
||||||
|
TutorialService.TryGetArticle(nextPartId, out ITutorialArticle? nextPart) &&
|
||||||
|
nextPart.Visibility == Visibility.Published)
|
||||||
|
{
|
||||||
|
<small>Next Part</small>
|
||||||
|
<p class="lead">
|
||||||
|
<a asp-page="Article" asp-route-slug="@TutorialService.GetFullSlug(nextPart)">
|
||||||
|
@nextPart.Title
|
||||||
|
</a>
|
||||||
|
</p>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-sm-12 col-md-6" style="text-align: right;">
|
}
|
||||||
@if (article.NextPart is { } nextPartId &&
|
|
||||||
TutorialService.TryGetArticle(nextPartId, out ITutorialArticle? nextPart) &&
|
|
||||||
nextPart.Visibility == Visibility.Published)
|
|
||||||
{
|
|
||||||
<small>Next Part</small>
|
|
||||||
<p class="lead">
|
|
||||||
<a asp-page="Article" asp-route-slug="@TutorialService.GetFullSlug(nextPart)">
|
|
||||||
@nextPart.Title
|
|
||||||
</a>
|
|
||||||
</p>
|
|
||||||
}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<hr/>
|
<hr/>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user