Compare commits

..

No commits in common. "05638e5debc7673b5dd65afbbea1e5d97c073359" and "817019ad1663a6c4b8f09c14487fcee4389a2cc4" have entirely different histories.

3 changed files with 5 additions and 20 deletions

View File

@ -1,7 +1,7 @@
@page "/tutorial/{**slug}" @page "/tutorial/{**slug}"
@using Humanizer @using Humanizer
@using Microsoft.AspNetCore.Mvc.TagHelpers @using Microsoft.AspNetCore.Mvc.TagHelpers
@using OliverBooth.Data @using OliverBooth.Data.Blog
@using OliverBooth.Data.Web @using OliverBooth.Data.Web
@using OliverBooth.Services @using OliverBooth.Services
@inject ITutorialService TutorialService @inject ITutorialService TutorialService
@ -64,9 +64,7 @@
<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)
{ {
<small>Previous Part</small> <small>Previous Part</small>
<p class="lead"> <p class="lead">
@ -77,9 +75,7 @@
} }
</div> </div>
<div class="col-sm-12 col-md-6" style="text-align: right;"> <div class="col-sm-12 col-md-6" style="text-align: right;">
@if (article.NextPart is { } nextPartId && @if (article.NextPart is { } nextPartId && TutorialService.TryGetArticle(nextPartId, out ITutorialArticle? nextPart))
TutorialService.TryGetArticle(nextPartId, out ITutorialArticle? nextPart) &&
nextPart.Visibility == Visibility.Published)
{ {
<small>Next Part</small> <small>Next Part</small>
<p class="lead"> <p class="lead">

View File

@ -1,6 +1,5 @@
@page "/tutorials/{**slug}" @page "/tutorials/{**slug}"
@using System.Text @using System.Text
@using OliverBooth.Data
@using OliverBooth.Data.Web @using OliverBooth.Data.Web
@using OliverBooth.Services @using OliverBooth.Services
@model Index @model Index
@ -32,16 +31,11 @@
} }
<h1 class="display-4">@(currentFolder?.Title ?? "Tutorials")</h1> <h1 class="display-4">@(currentFolder?.Title ?? "Tutorials")</h1>
@foreach (ITutorialFolder[] folders in TutorialService.GetFolders(currentFolder, Visibility.Published).Chunk(2)) @foreach (ITutorialFolder[] folders in TutorialService.GetFolders(currentFolder).Chunk(2))
{ {
<div class="card-group row" style="margin-top: 20px;"> <div class="card-group row" style="margin-top: 20px;">
@foreach (ITutorialFolder folder in folders) @foreach (ITutorialFolder folder in folders)
{ {
if (folder.Visibility != Visibility.Published)
{
continue;
}
<div class="col-xs-1 col-md-6 col-lg-6 d-flex align-items-stretch"> <div class="col-xs-1 col-md-6 col-lg-6 d-flex align-items-stretch">
<div class="project-card"> <div class="project-card">
<div class="project-image"> <div class="project-image">
@ -60,7 +54,7 @@
@if (currentFolder is not null) @if (currentFolder is not null)
{ {
foreach (ITutorialArticle[] articles in TutorialService.GetArticles(currentFolder, Visibility.Published).Chunk(2)) foreach (ITutorialArticle[] articles in TutorialService.GetArticles(currentFolder).Chunk(2))
{ {
<div class="card-group row" style="margin-top: 20px;"> <div class="card-group row" style="margin-top: 20px;">
@foreach (ITutorialArticle article in articles) @foreach (ITutorialArticle article in articles)

View File

@ -136,11 +136,6 @@ class UI {
public static addLineNumbers(element?: Element) { public static addLineNumbers(element?: Element) {
element = element || document.body; element = element || document.body;
element.querySelectorAll("pre code").forEach((block) => { element.querySelectorAll("pre code").forEach((block) => {
if (block.className.indexOf("|nolinenumbers") > 0) {
block.className = block.className.replaceAll("|nolinenumbers", "");
return;
}
let content = block.textContent; let content = block.textContent;
if (content.trim().split("\n").length > 1) { if (content.trim().split("\n").length > 1) {
block.parentElement.classList.add("line-numbers"); block.parentElement.classList.add("line-numbers");