Migrate bit-badger theme
- Add generator string - Focus meta name when adding new item - Sort meta items
This commit is contained in:
@@ -58,6 +58,7 @@ open System.Collections.Generic
|
||||
module private Helpers =
|
||||
|
||||
open Microsoft.AspNetCore.Antiforgery
|
||||
open Microsoft.Extensions.Configuration
|
||||
open Microsoft.Extensions.DependencyInjection
|
||||
open System.Security.Claims
|
||||
open System.IO
|
||||
@@ -93,7 +94,17 @@ module private Helpers =
|
||||
return msg |> (List.rev >> Array.ofList)
|
||||
| None -> return [||]
|
||||
}
|
||||
|
||||
|
||||
/// Hold variable for the configured generator string
|
||||
let mutable private generatorString : string option = None
|
||||
|
||||
/// Get the generator string
|
||||
let private generator (ctx : HttpContext) =
|
||||
if Option.isNone generatorString then
|
||||
let cfg = ctx.RequestServices.GetRequiredService<IConfiguration> ()
|
||||
generatorString <- Option.ofObj cfg["Generator"]
|
||||
match generatorString with Some gen -> gen | None -> "generator not configured"
|
||||
|
||||
/// Either get the web log from the hash, or get it from the cache and add it to the hash
|
||||
let private deriveWebLogFromHash (hash : Hash) ctx =
|
||||
match hash.ContainsKey "web_log" with
|
||||
@@ -112,6 +123,7 @@ module private Helpers =
|
||||
hash.Add ("page_list", PageListCache.get ctx)
|
||||
hash.Add ("current_page", ctx.Request.Path.Value.Substring 1)
|
||||
hash.Add ("messages", messages)
|
||||
hash.Add ("generator", generator ctx)
|
||||
|
||||
do! commitSession ctx
|
||||
|
||||
@@ -343,7 +355,7 @@ module Page =
|
||||
let! pages = Data.Page.findPageOfPages webLog.id pageNbr (conn ctx)
|
||||
return!
|
||||
Hash.FromAnonymousObject
|
||||
{| pages = pages |> List.map (DisplayPage.fromPage webLog)
|
||||
{| pages = pages |> List.map (DisplayPage.fromPageMinimal webLog)
|
||||
page_title = "Pages"
|
||||
|}
|
||||
|> viewForTheme "admin" "page-list" next ctx
|
||||
@@ -414,6 +426,7 @@ module Page =
|
||||
metadata = Seq.zip model.metaNames model.metaValues
|
||||
|> Seq.filter (fun it -> fst it > "")
|
||||
|> Seq.map (fun it -> { name = fst it; value = snd it })
|
||||
|> Seq.sortBy (fun it -> $"{it.name.ToLower ()} {it.value.ToLower ()}")
|
||||
|> List.ofSeq
|
||||
revisions = revision :: page.revisions
|
||||
}
|
||||
@@ -482,7 +495,7 @@ module Post =
|
||||
match! Data.Page.findById (PageId pageId) webLog.id (conn ctx) with
|
||||
| Some page ->
|
||||
return!
|
||||
Hash.FromAnonymousObject {| page = page; page_title = page.title |}
|
||||
Hash.FromAnonymousObject {| page = DisplayPage.fromPage webLog page; page_title = page.title |}
|
||||
|> themedView (defaultArg page.template "single-page") next ctx
|
||||
| None -> return! Error.notFound next ctx
|
||||
}
|
||||
@@ -501,7 +514,7 @@ module Post =
|
||||
match! Data.Page.findByPermalink permalink webLog.id conn with
|
||||
| Some page ->
|
||||
return!
|
||||
Hash.FromAnonymousObject {| page = page; page_title = page.title |}
|
||||
Hash.FromAnonymousObject {| page = DisplayPage.fromPage webLog page; page_title = page.title |}
|
||||
|> themedView (defaultArg page.template "single-page") next ctx
|
||||
| None ->
|
||||
// Prior post
|
||||
|
||||
@@ -8,5 +8,6 @@
|
||||
"RethinkDB.DistributedCache": "Debug",
|
||||
"RethinkDb.Driver": "Debug"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Generator": "myWebLog 2.0-alpha01"
|
||||
}
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta name="viewport" content="width=device-width" />
|
||||
<meta name="viewport" content="width=device-width">
|
||||
<meta name="generator" content="{{ generator }}">
|
||||
<title>{{ page_title | escape }} « Admin « {{ web_log.name | escape }}</title>
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css"
|
||||
integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
<div class="form-floating pb-3">
|
||||
<select name="template" id="template" class="form-control">
|
||||
{% for tmpl in templates -%}
|
||||
<option value="{{ tmpl[0] }}"{% if model.template == tmpl %} selected="selected"{% endif %}>
|
||||
<option value="{{ tmpl[0] }}"{% if model.template == tmpl[0] %} selected="selected"{% endif %}>
|
||||
{{ tmpl[1] }}
|
||||
</option>
|
||||
{%- endfor %}
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">Title</th>
|
||||
<th scope="col">Permalink</th>
|
||||
<th scope="col">Last Updated</th>
|
||||
</tr>
|
||||
</thead>
|
||||
@@ -23,6 +24,7 @@
|
||||
<a href="#" class="text-danger">Delete</a>
|
||||
</small>
|
||||
</td>
|
||||
<td>/{% unless pg.is_default %}{{ pg.permalink }}{% endunless %}</td>
|
||||
<td>{{ pg.updated_on | date: "MMMM d, yyyy" }}</td>
|
||||
</tr>
|
||||
{%- endfor %}
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
<div class="home">
|
||||
<article class="content auto">
|
||||
{{ page.text }}
|
||||
{% if logged_on -%}
|
||||
<p><small><a href="/page/{{ page.id }}/edit">Edit This Page</a></small></p>
|
||||
{% endif %}
|
||||
</article>
|
||||
<aside class="app-sidebar">
|
||||
<div>
|
||||
@@ -9,7 +12,7 @@
|
||||
<p class="app-sidebar-name">
|
||||
<strong>PrayerTracker</strong><br>
|
||||
<a href="/solutions/prayer-tracker" title="About PrayerTracker • Bit Badger Solutions">About</a> •
|
||||
<a href="https://prayer.bitbadger.solutions" title="PrayerTracker" target="_blank">Visit</a>
|
||||
<a href="https://prayer.bitbadger.solutions" title="PrayerTracker" target="_blank" rel="noopener">Visit</a>
|
||||
</p>
|
||||
<p class="app-sidebar-description">
|
||||
A prayer request tracking website (Free for any church or Sunday School class!)
|
||||
@@ -19,14 +22,14 @@
|
||||
<p class="app-sidebar-name">
|
||||
<strong>myPrayerJournal</strong><br>
|
||||
<a href="/solutions/my-prayer-journal" title="About myPrayerJournal • Bit Badger Solutions">About</a> •
|
||||
<a href="https://prayerjournal.me" title="myPrayerJournal" target="_blank">Visit</a>
|
||||
<a href="https://prayerjournal.me" title="myPrayerJournal" target="_blank" rel="noopener">Visit</a>
|
||||
</p>
|
||||
<p class="app-sidebar-description">Minimalist personal prayer journal</p>
|
||||
</div>
|
||||
<div>
|
||||
<p class="app-sidebar-name">
|
||||
<strong>Linux Resources</strong><br>
|
||||
<a href="https://blog.bitbadger.solutions/linux/" title="Linux Resources" target="_blank">Visit</a>
|
||||
<a href="https://blog.bitbadger.solutions/linux/" title="Linux Resources" target="_blank" rel="noopener">Visit</a>
|
||||
</p>
|
||||
<p class="app-sidebar-description">Handy information for Linux folks</p>
|
||||
</div>
|
||||
@@ -37,7 +40,7 @@
|
||||
<p class="app-sidebar-name">
|
||||
<strong>Futility Closet</strong><br>
|
||||
<a href="/solutions/futility-closet" title="About Futility Closet • Bit Badger Solutions">About</a> •
|
||||
<a href="https://www.futilitycloset.com" title="Futility Closet" target="_blank">Visit</a>
|
||||
<a href="https://www.futilitycloset.com" title="Futility Closet" target="_blank" rel="noopener">Visit</a>
|
||||
</p>
|
||||
<p class="app-sidebar-description">An idler’s miscellany of compendious amusements</p>
|
||||
</div>
|
||||
@@ -45,7 +48,7 @@
|
||||
<p class="app-sidebar-name">
|
||||
<strong>Mindy Mackenzie</strong><br>
|
||||
<a href="/solutions/mindy-mackenzie" title="About Mindy Mackenzie • Bit Badger Solutions">About</a> •
|
||||
<a href="https://mindymackenzie.com" title="Mindy Mackenzie" target="_blank">Visit</a>
|
||||
<a href="https://mindymackenzie.com" title="Mindy Mackenzie" target="_blank" rel="noopener">Visit</a>
|
||||
</p>
|
||||
<p class="app-sidebar-description"><em>WSJ</em>-best-selling author of <em>The Courage Solution</em></p>
|
||||
</div>
|
||||
@@ -53,7 +56,7 @@
|
||||
<p class="app-sidebar-name">
|
||||
<strong>Riehl World News</strong><br>
|
||||
<a href="/solutions/riehl-world-news" title="About Riehl World News • Bit Badger Solutions">About</a> •
|
||||
<a href="http://riehlworldview.com" title="Riehl World News" target="_blank">Visit</a>
|
||||
<a href="http://riehlworldview.com" title="Riehl World News" target="_blank" rel="noopener">Visit</a>
|
||||
</p>
|
||||
<p class="app-sidebar-description">Riehl news for real people</p>
|
||||
</div>
|
||||
@@ -64,7 +67,7 @@
|
||||
<p class="app-sidebar-name">
|
||||
<strong>Bay Vista Baptist Church</strong><br>
|
||||
<a href="/solutions/bay-vista" title="About Bay Vista Baptist Church • Bit Badger Solutions">About</a> •
|
||||
<a href="https://bayvista.org" title="Bay Vista Baptist Church" target="_blank">Visit</a>
|
||||
<a href="https://bayvista.org" title="Bay Vista Baptist Church" target="_blank" rel="noopener">Visit</a>
|
||||
</p>
|
||||
<p class="app-sidebar-description">Biloxi, Mississippi</p>
|
||||
</div>
|
||||
@@ -72,7 +75,7 @@
|
||||
<p class="app-sidebar-name">
|
||||
<strong>The Bit Badger Blog</strong><br>
|
||||
<a href="/solutions/tech-blog" title="About The Bit Badger Blog • Bit Badger Solutions">About</a> •
|
||||
<a href="https://blog.bitbadger.solutions" title="The Bit Badger Blog" target="_blank">Visit</a>
|
||||
<a href="https://blog.bitbadger.solutions" title="The Bit Badger Blog" target="_blank" rel="noopener">Visit</a>
|
||||
</p>
|
||||
<p class="app-sidebar-description">Technical information (“geek stuff”) from Bit Badger Solutions</p>
|
||||
</div>
|
||||
@@ -82,14 +85,14 @@
|
||||
<div>
|
||||
<p class="app-sidebar-name">
|
||||
<strong>Daniel J. Summers</strong><br>
|
||||
<a href="https://daniel.summershome.org" title="Daniel J. Summers" target="_blank">Visit</a>
|
||||
<a href="https://daniel.summershome.org" title="Daniel J. Summers" target="_blank" rel="noopener">Visit</a>
|
||||
</p>
|
||||
<p class="app-sidebar-description">Daniel’s personal blog</p>
|
||||
</div>
|
||||
<div>
|
||||
<p class="app-sidebar-name">
|
||||
<strong>A Word from the Word</strong><br>
|
||||
<a href="https://devotions.summershome.org" title="A Word from the Word" target="_blank">Visit</a>
|
||||
<a href="https://devotions.summershome.org" title="A Word from the Word" target="_blank" rel="noopener">Visit</a>
|
||||
</p>
|
||||
<p class="app-sidebar-description">Devotions by Daniel</p>
|
||||
</div>
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta name="viewport" content="width=device-width" />
|
||||
<meta name="viewport" content="width=device-width">
|
||||
<meta name="generator" content="{{ generator }}">
|
||||
<title>{{ page_title }} » Bit Badger Solutions</title>
|
||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Oswald|Raleway">
|
||||
<link rel="stylesheet" href="/themes/{{ web_log.theme_path }}/style.css">
|
||||
<link rel="icon" href="/themes/{{ web_log.theme_path }}/favicon.ico">
|
||||
</head>
|
||||
<body>
|
||||
<header class="site-header">
|
||||
@@ -37,7 +39,7 @@
|
||||
{% endif %}
|
||||
</small>
|
||||
</div>
|
||||
<div>
|
||||
<div class="footer-by">
|
||||
A <strong><a href="/">Bit Badger Solutions</a></strong> original design
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
@@ -2,4 +2,7 @@
|
||||
<h1>{{ page.title }}</h1>
|
||||
{{ page.text }}
|
||||
<p><br><a href="/" title="Home">« Home</a></p>
|
||||
{% if logged_on -%}
|
||||
<p><small><a href="/page/{{ page.id }}/edit">Edit This Page</a></small></p>
|
||||
{% endif %}
|
||||
</article>
|
||||
|
||||
113
src/MyWebLog/themes/bit-badger/solution-page.liquid
Normal file
113
src/MyWebLog/themes/bit-badger/solution-page.liquid
Normal file
@@ -0,0 +1,113 @@
|
||||
<h1 class="solution-header">
|
||||
{{ page.title }}<br>
|
||||
<small><small>
|
||||
{%- assign url = page.metadata | value: "url" -%}
|
||||
{%- assign no_link = page.metadata | value: "no_link" -%}
|
||||
{%- assign archive = page.metadata | where: "name", "archive_url" | size -%}
|
||||
{% if no_link == "true" -%}
|
||||
{{ url }}
|
||||
{%- else -%}
|
||||
<a href="{{ url }}" target="_blank" rel="noopener">{{ url }}</a>
|
||||
{%- endif %}
|
||||
{% if archive > 0 -%}
|
||||
|
||||
<a href="{{ page.metadata | value: "archive_url" }}" target="_blank" rel="noopener"><small>(Archive)</small></a>
|
||||
{%- endif %}
|
||||
</small></small>
|
||||
</h1>
|
||||
<div class="app-info">
|
||||
<article class="content">
|
||||
<aside>
|
||||
<span> </span>
|
||||
<img src="/themes/{{ web_log.theme_path }}/screenshots/{{ page.permalink | split: "/" | last }}.png"
|
||||
alt="Screen shot of {{ page.title | escape }}">
|
||||
</aside>
|
||||
{{ page.text }}
|
||||
{%- assign curr_tech = page.metadata | where: "name", "tech" -%}
|
||||
{%- assign past_tech = page.metadata | where: "name", "past_tech" -%}
|
||||
{%- assign curr_count = curr_tech | size -%}
|
||||
{%- assign past_count = past_tech | size -%}
|
||||
{% if curr_count > 0 or past_count > 0 -%}
|
||||
{% comment %} TODO / WIP
|
||||
{% capture all_links -%}
|
||||
ASP.NET MVC|https://dotnet.microsoft.com/apps/aspnet/mvc,
|
||||
Azure|https://azure.microsoft.com/,
|
||||
BlogEngine.NET|http://www.dotnetblogengine.net/,
|
||||
Database Abstraction|https://github.com/danieljsummers/DatabaseAbstraction,
|
||||
Digital Ocean|https://www.digitalocean.com/,
|
||||
Giraffe|https://github.com/giraffe-fsharp/Giraffe,
|
||||
GitHub|https://github.com/,
|
||||
GitHub Pages|https://pages.github.com/,
|
||||
Hexo|https://hexo.io/,
|
||||
Hugo|https://gohugo.io/,
|
||||
Jekyll|https://jekyllrb.com/,
|
||||
MongoDB|https://www.mongodb.com/,
|
||||
MySQL|https://www.mysql.com/,
|
||||
myWebLog|https://github.com/bit-badger/myWebLog,
|
||||
nginx|http://nginx.org/,
|
||||
Orchard|https://orchardproject.net/,
|
||||
PHP|https://www.php.net/,
|
||||
PostgreSQL|https://www.postgresql.org/,
|
||||
Rackspace Cloud|https://www.rackspace.com/cloud,
|
||||
RavenDB|https://ravendb.net/,
|
||||
RethinkDB|https://rethinkdb.com/,
|
||||
SQL Server|https://www.microsoft.com/en-us/sql-server/,
|
||||
Vue.js|https://vuejs.org/,
|
||||
WordPress|https://wordpress.org
|
||||
{%- endcapture %}
|
||||
{% endcomment %}
|
||||
<section>
|
||||
<h3 onclick="toggle('techStack')">
|
||||
The Technology Stack<span id="techStackArrow" class="arrow">▼</span>
|
||||
</h3>
|
||||
<div id="techStack" style="display:none;">
|
||||
{% if curr_count > 0 -%}
|
||||
{% if past_count > 0 -%}
|
||||
<p><small><strong>Current:</strong></small></p>
|
||||
{%- endif %}
|
||||
<ul>
|
||||
{% for curr in curr_tech -%}
|
||||
{%- assign tech = curr.value | split: "|" -%}
|
||||
<li>
|
||||
{% comment %} <a v-if="hasLink(tech[0])" :href="techLinks[tech[0]]" target="_blank">{{ tech[0] }}</a> {% endcomment %}
|
||||
{{ tech[0] }} for {{ tech[1] }}
|
||||
</li>
|
||||
{%- endfor %}
|
||||
</ul>
|
||||
{%- endif %}
|
||||
{% if past_count > 0 -%}
|
||||
{% if curr_count > 0 %}
|
||||
<p><small><strong>Previously:</strong></small></p>
|
||||
{% endif %}
|
||||
<ul>
|
||||
{% for past in past_tech -%}
|
||||
{%- assign tech = past.value | split: "|" -%}
|
||||
<li>
|
||||
{% comment %} <a v-if="hasLink(tech[0])" :href="techLinks[tech[0]]" target="_blank">{{ tech[0] }}</a> {% endcomment %}
|
||||
{{ tech[0] }} for {{ tech[1] }}
|
||||
</li>
|
||||
{%- endfor %}
|
||||
</ul>
|
||||
{% endif %}
|
||||
</div>
|
||||
</section>
|
||||
{%- endif %}
|
||||
<p><br><a href="/solutions">« Back to All Solutions</a></p>
|
||||
{% if logged_on -%}
|
||||
<p><small><a href="/page/{{ page.id }}/edit">Edit This Page</a></small></p>
|
||||
{% endif %}
|
||||
</article>
|
||||
</div>
|
||||
<script>
|
||||
function toggle(id) {
|
||||
const section = document.getElementById(id)
|
||||
const arrow = document.getElementById(`${id}Arrow`)
|
||||
if (section.style.display === "none") {
|
||||
section.style.display = "block"
|
||||
arrow.innerHTML = "▲"
|
||||
} else {
|
||||
section.style.display = "none"
|
||||
arrow.innerHTML = "▼"
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -3,7 +3,7 @@
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width">
|
||||
<meta name="generator" content="myWebLog 2">
|
||||
<meta name="generator" content="{{ generator }}">
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css"
|
||||
integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
|
||||
<link rel="stylesheet" href="/themes/{{ web_log.theme_path }}/style.css">
|
||||
|
||||
@@ -77,6 +77,7 @@
|
||||
newRow.appendChild(valueCol)
|
||||
|
||||
document.getElementById("metaItems").appendChild(newRow)
|
||||
document.getElementById(nameField.id).focus()
|
||||
this.nextMetaIndex++
|
||||
},
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ a img {
|
||||
acronym {
|
||||
border-bottom: dotted 1px black;
|
||||
}
|
||||
header, h1, h2, h3, footer a {
|
||||
header, h1, h2, h3, .footer-by a {
|
||||
font-family: "Oswald", "Segoe UI", Ubuntu, "DejaVu Sans", "Liberation Sans", Arial, sans-serif;
|
||||
}
|
||||
h1 {
|
||||
@@ -201,6 +201,48 @@ abbr[title] {
|
||||
font-weight: bold;
|
||||
color: maroon;
|
||||
}
|
||||
/* Individual solution pages */
|
||||
h1.solution-header {
|
||||
line-height: 1.6rem;
|
||||
}
|
||||
.app-info aside {
|
||||
float: right;
|
||||
background-color: #FFFAFA;
|
||||
}
|
||||
.app-info aside > span {
|
||||
padding-left: .75rem;
|
||||
}
|
||||
.app-info aside > img {
|
||||
overflow: hidden;
|
||||
border: dotted 1px darkgray;
|
||||
border-radius: 10px;
|
||||
}
|
||||
.tech-stack p {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
.tech-stack ul {
|
||||
margin-top: 0;
|
||||
}
|
||||
blockquote {
|
||||
border-left: solid 1px darkgray;
|
||||
margin-left: 25px;
|
||||
padding-left: 15px;
|
||||
}
|
||||
.quote {
|
||||
font-style: italic;
|
||||
}
|
||||
.source {
|
||||
text-align: right;
|
||||
padding-right: 60px;
|
||||
}
|
||||
.app-info h3:hover {
|
||||
cursor: hand;
|
||||
cursor: pointer;
|
||||
}
|
||||
.app-info .arrow {
|
||||
font-size: .75rem;
|
||||
padding-left: 1rem;
|
||||
}
|
||||
/* Footer */
|
||||
footer {
|
||||
display: flex;
|
||||
|
||||
Reference in New Issue
Block a user