Compare commits
2 Commits
817019ad16
...
05638e5deb
Author | SHA1 | Date | |
---|---|---|---|
05638e5deb | |||
238f519e0c |
@ -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.Blog
|
@using OliverBooth.Data
|
||||||
@using OliverBooth.Data.Web
|
@using OliverBooth.Data.Web
|
||||||
@using OliverBooth.Services
|
@using OliverBooth.Services
|
||||||
@inject ITutorialService TutorialService
|
@inject ITutorialService TutorialService
|
||||||
@ -64,7 +64,9 @@
|
|||||||
|
|
||||||
<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 && TutorialService.TryGetArticle(previousPartId, out ITutorialArticle? previousPart))
|
@if (article.PreviousPart is { } previousPartId &&
|
||||||
|
TutorialService.TryGetArticle(previousPartId, out ITutorialArticle? previousPart) &&
|
||||||
|
previousPart.Visibility == Visibility.Published)
|
||||||
{
|
{
|
||||||
<small>Previous Part</small>
|
<small>Previous Part</small>
|
||||||
<p class="lead">
|
<p class="lead">
|
||||||
@ -75,7 +77,9 @@
|
|||||||
}
|
}
|
||||||
</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 && TutorialService.TryGetArticle(nextPartId, out ITutorialArticle? nextPart))
|
@if (article.NextPart is { } nextPartId &&
|
||||||
|
TutorialService.TryGetArticle(nextPartId, out ITutorialArticle? nextPart) &&
|
||||||
|
nextPart.Visibility == Visibility.Published)
|
||||||
{
|
{
|
||||||
<small>Next Part</small>
|
<small>Next Part</small>
|
||||||
<p class="lead">
|
<p class="lead">
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
@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
|
||||||
@ -31,11 +32,16 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
<h1 class="display-4">@(currentFolder?.Title ?? "Tutorials")</h1>
|
<h1 class="display-4">@(currentFolder?.Title ?? "Tutorials")</h1>
|
||||||
@foreach (ITutorialFolder[] folders in TutorialService.GetFolders(currentFolder).Chunk(2))
|
@foreach (ITutorialFolder[] folders in TutorialService.GetFolders(currentFolder, Visibility.Published).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">
|
||||||
@ -54,7 +60,7 @@
|
|||||||
|
|
||||||
@if (currentFolder is not null)
|
@if (currentFolder is not null)
|
||||||
{
|
{
|
||||||
foreach (ITutorialArticle[] articles in TutorialService.GetArticles(currentFolder).Chunk(2))
|
foreach (ITutorialArticle[] articles in TutorialService.GetArticles(currentFolder, Visibility.Published).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)
|
||||||
|
@ -136,6 +136,11 @@ 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");
|
||||||
|
Loading…
Reference in New Issue
Block a user