Pug: Move blog macros to blender-cloud
This commit is contained in:
@@ -1,142 +0,0 @@
|
|||||||
//- ******************************************************* -//
|
|
||||||
| {% import 'projects/_macros.html' as projectmacros %}
|
|
||||||
| {% macro render_blog_post(node, project=None, pages=None) %}
|
|
||||||
| {% if node.picture %}
|
|
||||||
a.blog_index-header(href="{{ node.url }}")
|
|
||||||
img(src="{{ node.picture.thumbnail('h', api=api) }}")
|
|
||||||
| {% endif %}
|
|
||||||
| {% if project and project._id != config.MAIN_PROJECT_ID %}
|
|
||||||
| {{ projectmacros.render_secondary_navigation(project, pages=pages) }}
|
|
||||||
| {% endif %}
|
|
||||||
.blog_index-item.mx-auto
|
|
||||||
h2.pt-4.px-4
|
|
||||||
a.text-muted(href="{{ node.url }}")
|
|
||||||
| {{ node.name }}
|
|
||||||
ul.meta
|
|
||||||
| {% if node.project.name %}
|
|
||||||
li {{ node.project.name }}
|
|
||||||
| {% endif %}
|
|
||||||
| {% if node.user.full_name%}
|
|
||||||
li.who
|
|
||||||
| by {{ node.user.full_name }}
|
|
||||||
| {% endif %}
|
|
||||||
li.when
|
|
||||||
a(href="{{ node.url }}",
|
|
||||||
title="Updated {{ node._updated | pretty_date }}")
|
|
||||||
| {{ node._created | pretty_date }}
|
|
||||||
li
|
|
||||||
a(href="{{ node.url }}#comments")
|
|
||||||
| comment
|
|
||||||
|
|
||||||
|
|
||||||
.item-content
|
|
||||||
| {{ node.properties | markdowned('content') }}
|
|
||||||
|
|
||||||
| {% endmacro %}
|
|
||||||
|
|
||||||
//- ******************************************************* -//
|
|
||||||
| {% macro render_blog_list_item(node) %}
|
|
||||||
.blog_index-item.list
|
|
||||||
|
|
||||||
| {% if node.picture %}
|
|
||||||
a.item-header(href="{{ node.url }}")
|
|
||||||
img.image(src="{{ node.picture.thumbnail('s', api=api) }}")
|
|
||||||
| {% else %}
|
|
||||||
a.item-header.nothumb(href="{{ node.url }}")
|
|
||||||
i.pi-document-text
|
|
||||||
| {% endif %}
|
|
||||||
|
|
||||||
a.item-title.text-muted(
|
|
||||||
href="{{ node.url }}")
|
|
||||||
| {{node.name}}
|
|
||||||
|
|
||||||
.item-info.
|
|
||||||
#[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 %}
|
|
||||||
.blog-action
|
|
||||||
a.btn.btn-outline-primary.button-create(href="{{url_for('nodes.posts_create', project_id=project._id)}}")
|
|
||||||
i.pi-plus
|
|
||||||
| Create New Post
|
|
||||||
| {% endif %}
|
|
||||||
|
|
||||||
| {% if posts %}
|
|
||||||
| {{ render_blog_post(posts[0], project=project, pages=pages) }}
|
|
||||||
|
|
||||||
| {% for node in posts[1:] %}
|
|
||||||
| {% if loop.first %}
|
|
||||||
.blog-archive-navigation
|
|
||||||
span 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 %}
|
|
||||||
|
|
||||||
.blog_index-item
|
|
||||||
.item-content No posts... yet!
|
|
||||||
|
|
||||||
| {% endif %} {# posts #}
|
|
||||||
| {% endmacro %}
|
|
||||||
|
|
||||||
|
|
||||||
//- Macro for rendering the navigation buttons for prev/next pages -//
|
|
||||||
| {% macro render_archive_pagination(project) %}
|
|
||||||
.blog-archive-navigation
|
|
||||||
| {% 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 %}
|
|
Reference in New Issue
Block a user