chiark / gitweb /
theme: display article draft status more prominently.
authorVladimír Vondruš <mosra@centrum.cz>
Thu, 13 Sep 2018 09:55:49 +0000 (11:55 +0200)
committerVladimír Vondruš <mosra@centrum.cz>
Thu, 13 Sep 2018 13:54:13 +0000 (15:54 +0200)
So I can submit clearly marked draft articles for review and I don't
accidentally leave the draft status enabled when publishing.

pelican-theme/templates/article.html
pelican-theme/templates/article_header.html
pelican-theme/test/blog_draft/article-jumbo.html [new file with mode: 0644]
pelican-theme/test/blog_draft/article-jumbo.rst [new file with mode: 0644]
pelican-theme/test/blog_draft/article.html
pelican-theme/test/test_blog.py

index b3023b5d5605217d6a4b65f98e6bf0501f7a3831..266e132ca67dadbd5bd490a41ed3bd3ee5b9451d 100644 (file)
@@ -56,7 +56,7 @@
         <div id="m-jumbo-cover">
           <div class="m-container">
             <div class="m-row">
-              <div class="{% if article.authors %}m-col-t-6 m-col-s-5{% else %}m-col-t-12 m-col-s-10{% endif %} m-push-s-1 m-text-left">{{ article.locale_date|e }}</div>
+              <div class="{% if article.authors %}m-col-t-6 m-col-s-5{% else %}m-col-t-12 m-col-s-10{% endif %} m-push-s-1 m-text-left">{{ article.locale_date|e }}{% if article.status == 'draft' %} <span class="m-label m-dim">draft</span>{% endif %}</div>
               {% if article.authors %}
               <div class="m-col-t-6 m-col-s-5 m-push-s-1 m-text-right">{% for author in article.authors %}<a href="{{ author.url|format_siteurl|e }}">{{ author|e }}</a>{% endfor %}</div>
               {% endif %}
index 610762ad3a3e04dafabbe4afbfbff8747d6e1663..57ec83c627f41bc7b628bd695e645495a8fa9038 100644 (file)
@@ -5,6 +5,9 @@
       {{ month }} <span class="m-date-day">{{ day }}</span> {{year}}
     </time>
     {{ article.title }}
+    {% if article.status == 'draft' %}
+    <span class="m-label m-dim">draft</span>
+    {% endif %}
   </a></h1>
   {# Display summary only if:
     - we're on article listing page (either the articles_page is defined by
diff --git a/pelican-theme/test/blog_draft/article-jumbo.html b/pelican-theme/test/blog_draft/article-jumbo.html
new file mode 100644 (file)
index 0000000..105019a
--- /dev/null
@@ -0,0 +1,56 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+  <meta charset="UTF-8" />
+  <title>An article | A Pelican Blog</title>
+  <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:400,400i,600,600i" />
+  <link rel="stylesheet" href="static/m-dark.css" />
+  <link rel="canonical" href="article-jumbo.html" />
+  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
+</head>
+<body>
+<header><nav id="navigation" class="m-navbar-cover">
+  <div class="m-container">
+    <div class="m-row">
+      <a href="./" id="m-navbar-brand" class="m-col-t-9 m-col-m-none m-left-m">A Pelican Blog</a>
+    </div>
+  </div>
+</nav></header>
+<main>
+  <article id="m-jumbo">
+    <header>
+      <div id="m-jumbo-image" style="background-image: url('image.jpg');">
+        <div id="m-jumbo-cover">
+          <div class="m-container">
+            <div class="m-row">
+              <div class="m-col-t-12 m-col-s-10 m-push-s-1 m-text-left">Dec 09, 2017 <span class="m-label m-dim">draft</span></div>
+            </div>
+            <div class="m-row">
+              <div class="m-col-t-12 m-col-s-10 m-push-s-1 m-col-m-8 m-push-m-2">
+                <h1><a href="article-jumbo.html" rel="bookmark" title="Permalink to An article">An article</a></h1>
+              </div>
+            </div>
+          </div>
+        </div>
+      </div>
+    </header>
+    <footer class="m-container">
+      <div class="m-row">
+        <div class="m-col-m-10 m-push-m-1 m-nopadb">
+          <p>Posted on <time datetime="2017-12-09T00:00:00+00:00">Dec 09, 2017</time> in <a href="category-misc.html">misc</a>. <span class="m-label m-dim">draft</span></p>
+        </div>
+      </div>
+    </footer>
+  </article>
+  <nav class="m-navpanel m-container">
+    <div class="m-row">
+      <div class="m-col-s-4 m-col-l-2 m-push-s-4 m-push-l-5">
+        <h3>Categories</h3>
+        <ol class="m-block-bar-s">
+        </ol>
+      </div>
+    </div>
+  </nav>
+</main>
+</body>
+</html>
diff --git a/pelican-theme/test/blog_draft/article-jumbo.rst b/pelican-theme/test/blog_draft/article-jumbo.rst
new file mode 100644 (file)
index 0000000..0ecb0c0
--- /dev/null
@@ -0,0 +1,6 @@
+An article
+##########
+
+:date: 2017-12-09
+:cover: image.jpg
+:status: draft
index 900f0eb9b52f289215eb81af69a18a8b7dfd5f58..91a1e00007b61230e03cd56e7e388bc9d369c933 100644 (file)
@@ -26,6 +26,7 @@
             Dec <span class="m-date-day">09</span> 2017
           </time>
           An article
+          <span class="m-label m-dim">draft</span>
         </a></h1>
       </header>
       <div class="m-clearfix-l"></div>
index cc595a36997f244e1c14d73c1f459364e302c008..a0f74f9e74c502f7e2211810917b7bfe13af4de5 100644 (file)
@@ -549,3 +549,4 @@ class Draft(BlogTestCase):
         })
 
         self.assertEqual(*self.actual_expected_contents('article.html'))
+        self.assertEqual(*self.actual_expected_contents('article-jumbo.html'))