- Rework page edit layout

- Add project template to bit-badger theme
- Add code styling to bit-badger theme
This commit is contained in:
Daniel J. Summers 2022-05-23 22:17:14 -04:00
parent 664704d3d5
commit 7219b65f4f
5 changed files with 59 additions and 19 deletions

View File

@ -11,7 +11,7 @@
value="{{ model.title }}"> value="{{ model.title }}">
<label for="title">Title</label> <label for="title">Title</label>
</div> </div>
<div class="form-floating"> <div class="form-floating pb-3">
<input type="text" name="permalink" id="permalink" class="form-control" required <input type="text" name="permalink" id="permalink" class="form-control" required
value="{{ model.permalink }}"> value="{{ model.permalink }}">
<label for="permalink">Permalink</label> <label for="permalink">Permalink</label>
@ -20,6 +20,18 @@
<span class="form-text"><a href="{{ perm_edit | relative_link }}">Manage Permalinks</a></span> <span class="form-text"><a href="{{ perm_edit | relative_link }}">Manage Permalinks</a></span>
{% endif -%} {% endif -%}
</div> </div>
<div class="mb-2">
<label for="text">Text</label> &nbsp; &nbsp;
<input type="radio" name="source" id="source_html" class="btn-check" value="HTML"
{%- if model.source == "HTML" %} checked="checked"{% endif %}>
<label class="btn btn-sm btn-outline-secondary" for="source_html">HTML</label>
<input type="radio" name="source" id="source_md" class="btn-check" value="Markdown"
{%- if model.source == "Markdown" %} checked="checked"{% endif %}>
<label class="btn btn-sm btn-outline-secondary" for="source_md">Markdown</label>
</div>
<div class="mb-3">
<textarea name="text" id="text" class="form-control">{{ model.text }}</textarea>
</div>
</div> </div>
<div class="col-3"> <div class="col-3">
<div class="form-floating pb-3"> <div class="form-floating pb-3">
@ -39,22 +51,6 @@
</div> </div>
</div> </div>
</div> </div>
<div class="row mb-2">
<div class="col">
<label for="text">Text</label> &nbsp; &nbsp;
<input type="radio" name="source" id="source_html" class="btn-check" value="HTML"
{%- if model.source == "HTML" %} checked="checked"{% endif %}>
<label class="btn btn-sm btn-outline-secondary" for="source_html">HTML</label>
<input type="radio" name="source" id="source_md" class="btn-check" value="Markdown"
{%- if model.source == "Markdown" %} checked="checked"{% endif %}>
<label class="btn btn-sm btn-outline-secondary" for="source_md">Markdown</label>
</div>
</div>
<div class="row mb-3">
<div class="col">
<textarea name="text" id="text" class="form-control" rows="10">{{ model.text }}</textarea>
</div>
</div>
<div class="row mb-3"> <div class="row mb-3">
<div class="col"> <div class="col">
<button type="submit" class="btn btn-primary">Save Changes</button> <button type="submit" class="btn btn-primary">Save Changes</button>

View File

@ -1,6 +1,6 @@
<h2 class="my-3">{{ page_title }}</h2> <h2 class="my-3">{{ page_title }}</h2>
<article class="container"> <article class="container">
<a href="{{ "/admin/post/new/edit" | relative_link }}" class="btn btn-primary btn-sm mb-3">Write a New Post</a> <a href="{{ "admin/post/new/edit" | relative_link }}" class="btn btn-primary btn-sm mb-3">Write a New Post</a>
<table class="table table-sm table-hover"> <table class="table table-sm table-hover">
<thead> <thead>
<tr> <tr>
@ -27,7 +27,7 @@
<span class="text-muted"> &bull; </span> <span class="text-muted"> &bull; </span>
<a href="{{ post | edit_post_link }}">Edit</a> <a href="{{ post | edit_post_link }}">Edit</a>
<span class="text-muted"> &bull; </span> <span class="text-muted"> &bull; </span>
{%- capture post_del %}admin/post/{{ pg.id }}/delete{% endcapture -%} {%- capture post_del %}admin/post/{{ post.id }}/delete{% endcapture -%}
{%- capture post_del_link %}{{ post_del | relative_link }}{% endcapture -%} {%- capture post_del_link %}{{ post_del | relative_link }}{% endcapture -%}
<a href="{{ post_del_link }}" class="text-danger" <a href="{{ post_del_link }}" class="text-danger"
onclick="return Admin.deletePost('{{ post.title }}', '{{ post_del_link }}')"> onclick="return Admin.deletePost('{{ post.title }}', '{{ post_del_link }}')">

View File

@ -0,0 +1,19 @@
<article class="content auto">
{%- assign parts = page.title | split: ' » ' -%}
{%- assign parts_count = parts | size -%}
{% if parts_count == 1 -%}
<h1>{{ page.title }}</h1>
{%- else -%}
<h1><small><small>{{ parts[0] }}</small></small><br>{{ parts[1] }}</h1>
{%- endif %}
{{ page.text }}
{% if parts_count > 1 -%}
{%- assign project = parts[0] | downcase | replace: '\.', '-' -%}
{%- capture project_url %}open-source/{{ project }}/{% endcapture -%}
{% comment %}{{ project_url | relative_link }}{% endcomment %}
<p><br><a href="." title="{{ parts[0] }} Home">&laquo; {{ parts[0] }} Home</a></p>
{%- endif %}
{% if logged_on -%}
<p><small><a href="{{ page | edit_page_link }}">Edit This Page</a></small></p>
{%- endif %}
</article>

View File

@ -51,6 +51,9 @@ textarea {
font-family: monospace; font-family: monospace;
font-size: .8rem !important; font-size: .8rem !important;
} }
#text {
min-height: 50vh;
}
.no-wrap { .no-wrap {
white-space: nowrap; white-space: nowrap;
} }

View File

@ -44,6 +44,28 @@ h2, h3 {
p { p {
margin: 1rem 0; margin: 1rem 0;
} }
code, pre {
font-family: "JetBrains Mono","SFMono-Regular",Consolas,"Liberation Mono",Menlo,Courier,monospace;
font-size: 80%;
}
code {
background-color: rgba(0, 0, 0, .1);
padding: 0 .25rem;
white-space: pre;
}
pre {
background-color: rgba(0, 0, 0, .9);
color: rgba(255, 255, 255, .9);
padding: .5rem;
border-radius: .5rem;
overflow: auto;
}
pre > code {
background-color: unset;
}
div[style="color:#DADADA;background-color:#1E1E1E;"] {
background-color: unset !important;
}
#content { #content {
margin: 0 1rem; margin: 0 1rem;
} }