166 lines
4.2 KiB
Plaintext
166 lines
4.2 KiB
Plaintext
include ../../../../../../pillar/src/templates/mixins/components
|
|
|
|
| {% import 'projects/_macros.html' as projectmacros %}
|
|
| {% macro render_blog_post(node, project=None, pages=None) %}
|
|
|
|
.expand-image-links.imgs-fluid
|
|
| {% if node.picture %}
|
|
+jumbotron(
|
|
"{{ node.name }}",
|
|
"{{ node._created | pretty_date }}",
|
|
"{{ node.picture.thumbnail('h', api=api) }}",
|
|
"{{ node.url }}")(class="row")
|
|
| {% else %}
|
|
.pt-5.text-center.text-muted
|
|
h2.pb-2
|
|
a.text-muted(href="{{ node.url }}")
|
|
| {{ node.name }}
|
|
ul.d-flex.list-unstyled.justify-content-center
|
|
| {% if node.project.name %}
|
|
li.pr-2 {{ node.project.name }}
|
|
| {% endif %}
|
|
| {% if node.user.full_name %}
|
|
li.pr-2
|
|
| {{ node.user.full_name }}
|
|
| {% endif %}
|
|
li
|
|
a.px-2.text-muted(href="{{ node.url }}",
|
|
title="Updated {{ node._updated | pretty_date }}")
|
|
| {{ node._created | pretty_date }}
|
|
li
|
|
a.px-2(href="{{ node.url }}#comments")
|
|
| Leave a comment
|
|
|
|
| {% if node.has_method('PUT') %}
|
|
li
|
|
a.px-2(href="{{url_for('nodes.edit', node_id=node._id)}}")
|
|
i.pi-edit
|
|
| Edit Post
|
|
| {% endif %}
|
|
| {% endif %}
|
|
|
|
.row
|
|
.col-md-9.mx-auto
|
|
|
|
.item-content.pt-4
|
|
| {{ node.properties | markdowned('content') }}
|
|
|
|
hr.my-4
|
|
|
|
.mx-auto
|
|
#comments-embed
|
|
.comments-list-loading
|
|
i.pi-spin
|
|
| {% endmacro %}
|
|
|
|
//- ******************************************************* -//
|
|
| {% macro render_blog_list_item(node) %}
|
|
.row.position-relative.py-2
|
|
.col-md-1
|
|
| {% if node.picture %}
|
|
a.imgs-fluid(href="{{ node.url }}")
|
|
img(src="{{ node.picture.thumbnail('s', api=api) }}")
|
|
| {% else %}
|
|
.bg-primary.rounded.h-100
|
|
a.d-flex.align-items-center.justify-content-center.h-100.text-white(href="{{ node.url }}")
|
|
i.pi-document-text
|
|
| {% endif %}
|
|
|
|
.col-md-11
|
|
h5
|
|
a.text-muted(href="{{ node.url }}") {{node.name}}
|
|
|
|
.text-muted.
|
|
#[span(title="{{node._created}}") {{node._created | pretty_date }}]
|
|
{% if node._created != node._updated %}
|
|
#[span(title="{{node._updated}}") (updated {{node._updated | pretty_date }})]
|
|
{% endif %}
|
|
{% if node.properties.category %} · {{node.properties.category}}{% endif %}
|
|
· {{node.user.full_name}}
|
|
{% if node.properties.status != 'published' %} · {{ node.properties.status}} {% endif %}
|
|
|
|
| {% endmacro %}
|
|
|
|
|
|
//- ******************************************************* -//
|
|
| {% macro render_blog_index(project, posts, can_create_blog_posts, api, more_posts_available, posts_meta, pages=None) %}
|
|
| {% if can_create_blog_posts %}
|
|
+nav-secondary
|
|
+nav-secondary-link(href="{{url_for('nodes.posts_create', project_id=project._id)}}")
|
|
span.text-success
|
|
i.pi-plus
|
|
| Create New Blog Post
|
|
| {% endif %}
|
|
|
|
| {% if posts %}
|
|
| {{ render_blog_post(posts[0], project=project, pages=pages) }}
|
|
|
|
.container
|
|
.row
|
|
.col-md-9.mx-auto
|
|
| {% for node in posts[1:] %}
|
|
| {% if loop.first %}
|
|
h5.text-muted.text-center Blasts from the past
|
|
| {% endif %}
|
|
| {{ render_blog_list_item(node) }}
|
|
| {% endfor %}
|
|
|
|
| {% if more_posts_available %}
|
|
.blog-archive-navigation
|
|
a(href="{{ project.blog_archive_url }}")
|
|
| {{posts_meta.total - posts|length}} more blog posts over here
|
|
i.pi-angle-right
|
|
| {% endif %}
|
|
|
|
| {% else %}
|
|
|
|
.text-center
|
|
p No posts... yet!
|
|
|
|
| {% endif %} {# posts #}
|
|
| {% endmacro %}
|
|
|
|
|
|
//- Macro for rendering the navigation buttons for prev/next pages -//
|
|
| {% macro render_archive_pagination(project) %}
|
|
.blog-archive-navigation.mb-4
|
|
| {% if project.blog_archive_prev %}
|
|
a.archive-nav-button(
|
|
href="{{ project.blog_archive_prev }}", rel="prev")
|
|
i.pi-angle-left
|
|
| Previous page
|
|
| {% else %}
|
|
span.archive-nav-button
|
|
i.pi-angle-left
|
|
| Previous page
|
|
| {% endif %}
|
|
|
|
a.archive-nav-button(
|
|
href="{{ url_for('main.project_blog', project_url=project.url) }}")
|
|
| Blog Index
|
|
|
|
| {% if project.blog_archive_next %}
|
|
a.archive-nav-button(
|
|
href="{{ project.blog_archive_next }}", rel="next")
|
|
| Next page
|
|
i.pi-angle-right
|
|
| {% else %}
|
|
span.archive-nav-button
|
|
| Next page
|
|
i.pi-angle-right
|
|
| {% endif %}
|
|
|
|
| {% endmacro %}
|
|
|
|
| {% macro render_archive(project, posts, posts_meta) %}
|
|
|
|
| {{ render_archive_pagination(project) }}
|
|
|
|
| {% for node in posts %}
|
|
| {{ render_blog_list_item(node) }}
|
|
| {% endfor %}
|
|
|
|
| {{ render_archive_pagination(project) }}
|
|
|
|
| {% endmacro %}
|