]> git.ipfire.org Git - ipfire.org.git/commitdiff
blog: Refactor drafts page and add it to the navigation
authorMichael Tremer <michael.tremer@ipfire.org>
Wed, 26 Jul 2023 15:52:09 +0000 (15:52 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Wed, 26 Jul 2023 15:52:09 +0000 (15:52 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/templates/base.html
src/templates/blog/drafts.html
src/templates/blog/modules/list.html

index 3580f42c75ae4e6015ff86deafb78566e1052ebd..e8f9101ca792d4c74aefc72cced9ab01f5b87252 100644 (file)
                                                        <div class="navbar-end">
                                                                {# Show a search bar for blog #}
                                                                {% if request.path.startswith("/blog") %}
+                                                                       {# Navigation for Blog Authors #}
+                                                                       {% if current_user and current_user.is_blog_author() %}
+                                                                               <a class="navbar-item {% if request.path == "/blog/drafts" %}is-active{% end %}" href="/blog/drafts">
+                                                                                       {{ _("My Drafts") }}
+                                                                               </a>
+                                                                       {% end %}
+
                                                                        <div class="navbar-item">
                                                                                <form action="/blog" method="GET">
                                                                                        <div class="field">
index 6edfa8753155106257e2f6abbead74155020b2b0..4f60db69f5fce146e429dc3a50a657e2f44e0cd9 100644 (file)
@@ -2,40 +2,44 @@
 
 {% block title %}{{ _("My Drafts") }}{% end block %}
 
-{% block main %}
-       <div class="card">
-               <div class="card-body">
-                       <h5>{{ _("My Drafts") }}</h5>
+{% block container %}
+       <section class="hero is-primary">
+               <div class="hero-body">
+                       <div class="container">
+                               <nav class="breadcrumb is-medium" aria-label="breadcrumbs">
+                                       <ul>
+                                               <li>
+                                                       <a href="/">{{ _("Home") }}</a>
+                                               </li>
+                                               <li>
+                                                       <a href="/blog">{{ _("Blog") }}</a>
+                                               </li>
+                                               <li class="is-active">
+                                                       <a href="#" aria-current="page">{{ _("My Drafts") }}</a>
+                                               </li>
+                                       </ul>
+                               </nav>
 
-                       {% if drafts %}
-                               {% for post in drafts %}
-                                       <strong class="mb-0">
-                                               <a href="/post/{{ post.slug }}">{{ post.title }}</a>
-                                       </strong>
-
-                                       <p class="text-muted small">
-                                               {% if post.published_at %}
-                                                       <span class="text-danger">{{ _("Scheduled to be published %s") % locale.format_date(post.published_at, relative=False) }}</span>,
-                                               {% end %}
+                               <h1 class="title is-1">{{ _("My Drafts") }}</h1>
+                       </div>
+               </div>
+       </section>
 
-                                               {% if post.updated_at %}
-                                                       {{ _("Updated %s") % locale.format_date(post.updated_at) }}
-                                               {% else %}
-                                                       {{ _("Created %s") % locale.format_date(post.created_at) }}
-                                               {% end %}
-                                       </p>
-                               {% end %}
+       <section class="section">
+               <div class="container">
+                       {% if drafts %}
+                               {% module BlogList(drafts, show_author=False) %}
                        {% else %}
-                               <p class="text-center text-muted my-4">
-                                       {{ _("You currently do not have any drafts") }}
-                               </p>
+                               <div class="notification">
+                                       {{ _("You don't have any drafts, yet") }}
+                               </div>
                        {% end %}
 
-                       <div class="btn-toolbar justify-content-center">
-                               <a class="btn btn-primary" href="/compose">
-                                       {{ _("Write a new post") }}
+                       <div class="block">
+                               <a class="button is-primary is-fullwidth" href="/blog/compose">
+                                       {{ _("Write a New Post") }}
                                </a>
                        </div>
                </div>
-       </div>
+       </section>
 {% end block %}
index 3980591a985bf74926130296acd83a62d914b418..33ba7bf8649ae0418386ea2d9356137c70a9c888 100644 (file)
@@ -7,7 +7,11 @@
                </h5>
 
                <h6 class="subtitle is-6">
-                       {{ locale.format_date(post.published_at, shorter=True, relative=relative) }}
+                       {% if post.published_at %}
+                               {{ locale.format_date(post.published_at, shorter=True, relative=relative) }}
+                       {% elif post.created_at %}
+                               {{ _("Created %s") % locale.format_date(post.created_at, shorter=True, relative=True) }}
+                       {% end %}
 
                        {% if "lightningwirelabs.com" in post.tags %}
                                <span class="has-text-lwl">{{ _("by Lightning Wire Labs") }}</span>