2017-09-29 16:19:31 +02:00
|
|
|
//- ******************************************************* -//
|
|
|
|
| {% macro render_blog_post(node) %}
|
|
|
|
| {% if node.picture %}
|
|
|
|
.blog_index-header
|
|
|
|
img(src="{{ node.picture.thumbnail('l', api=api) }}")
|
|
|
|
| {% endif %}
|
|
|
|
.blog_index-item
|
|
|
|
a.item-title(
|
|
|
|
href="{{ url_for_node(node=node) }}")
|
|
|
|
| {{node.name}}
|
|
|
|
|
|
|
|
.item-info.
|
|
|
|
<span title="{{node._created}}">{{node._created | pretty_date }}</span>
|
|
|
|
{% if node._created != node._updated %}
|
|
|
|
<span title="{{node._updated}}">(updated {{node._updated | pretty_date }})</span>
|
|
|
|
{% endif %}
|
|
|
|
{% if node.properties.category %}| {{node.properties.category}}{% endif %}
|
|
|
|
| by {{node.user.full_name}}
|
|
|
|
| <a href="{{ url_for_node(node=node) }}#comments">Leave a comment</a>
|
|
|
|
{% if node.properties.status != 'published' %} | {{ node.properties.status}} {% endif %}
|
|
|
|
|
|
|
|
.item-content
|
|
|
|
| {{node.properties.content}}
|
|
|
|
|
|
|
|
.item-meta
|
|
|
|
a(href="{{ url_for_node(node=node) }}#comments") Leave a comment
|
|
|
|
| {% endmacro %}
|
|
|
|
|
|
|
|
//- ******************************************************* -//
|
2017-09-29 17:50:57 +02:00
|
|
|
| {% macro render_blog_list_item(node) %}
|
2017-09-29 16:19:31 +02:00
|
|
|
.blog_index-item.list
|
|
|
|
| {% if node.picture %}
|
|
|
|
.item-header
|
|
|
|
img.image(src="{{ node.picture.thumbnail('s', api=api) }}")
|
|
|
|
| {% else %}
|
|
|
|
.item-header.nothumb
|
|
|
|
i.pi-document-text
|
|
|
|
| {% endif %}
|
|
|
|
a.item-title(
|
|
|
|
href="{{ url_for_node(node=node) }}")
|
|
|
|
| {{node.name}}
|
|
|
|
|
|
|
|
.item-info.
|
|
|
|
<span title="{{node._created}}">{{node._created | pretty_date }}</span>
|
|
|
|
{% if node._created != node._updated %}
|
|
|
|
<span title="{{node._updated}}">(updated {{node._updated | pretty_date }})</span>
|
|
|
|
{% endif %}
|
|
|
|
{% if node.properties.category %}| {{node.properties.category}}{% endif %}
|
|
|
|
| by {{node.user.full_name}}
|
|
|
|
{% if node.properties.status != 'published' %} | {{ node.properties.status}} {% endif %}
|
2017-09-29 17:50:57 +02:00
|
|
|
| {% endmacro %}
|
|
|
|
|
|
|
|
|
|
|
|
//- ******************************************************* -//
|
|
|
|
| {% macro render_blog_index(project, posts, can_create_blog_posts, api, more_posts_available, posts_meta) %}
|
|
|
|
| {% if can_create_blog_posts %}
|
|
|
|
a.btn.btn-default.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]) }}
|
|
|
|
|
|
|
|
| {% for node in posts[1:] %}
|
|
|
|
| {% if loop.first %}
|
2017-10-05 16:38:53 +02:00
|
|
|
.blog-archive-navigation
|
|
|
|
span Blasts from the past
|
2017-09-29 17:50:57 +02:00
|
|
|
| {% endif %}
|
|
|
|
| {{ render_blog_list_item(node) }}
|
|
|
|
| {% endfor %}
|
|
|
|
|
|
|
|
| {% if more_posts_available %}
|
2017-10-05 16:38:53 +02:00
|
|
|
.blog-archive-navigation
|
2017-10-03 16:10:03 +02:00
|
|
|
a(href="{{ project.blog_archive_url }}")
|
|
|
|
| {{posts_meta.total - posts|length}} more blog posts over here
|
|
|
|
i.pi-angle-right
|
2017-09-29 17:50:57 +02:00
|
|
|
| {% endif %}
|
2017-09-29 16:19:31 +02:00
|
|
|
|
|
|
|
| {% else %}
|
|
|
|
|
|
|
|
.blog_index-item
|
|
|
|
.item-content No posts yet.
|
|
|
|
|
|
|
|
| {% endif %} {# posts #}
|
|
|
|
| {% endmacro %}
|
2017-09-29 17:50:57 +02:00
|
|
|
|
2017-10-03 16:10:03 +02:00
|
|
|
|
2017-10-05 16:38:53 +02:00
|
|
|
//- Macro for rendering the navigation buttons for prev/next pages -//
|
2017-10-03 16:10:03 +02:00
|
|
|
| {% macro render_archive_pagination(project) %}
|
2017-10-05 16:38:53 +02:00
|
|
|
.blog-archive-navigation
|
|
|
|
| {% if project.blog_archive_prev %}
|
|
|
|
a.archive-nav-button(
|
2017-10-03 16:10:03 +02:00
|
|
|
href="{{ project.blog_archive_prev }}", rel="prev")
|
|
|
|
i.pi-angle-left
|
|
|
|
| Previous page
|
2017-10-05 16:38:53 +02:00
|
|
|
| {% else %}
|
|
|
|
span.archive-nav-button
|
|
|
|
i.pi-angle-left
|
|
|
|
| Previous page
|
|
|
|
| {% endif %}
|
2017-10-03 16:10:03 +02:00
|
|
|
|
2017-10-05 16:38:53 +02:00
|
|
|
a.archive-nav-button(
|
|
|
|
href="{{ url_for('main.project_blog', project_url=project.url) }}")
|
2017-10-03 16:10:03 +02:00
|
|
|
| Blog Index
|
|
|
|
|
2017-10-05 16:38:53 +02:00
|
|
|
| {% if project.blog_archive_next %}
|
|
|
|
a.archive-nav-button(
|
2017-10-03 16:10:03 +02:00
|
|
|
href="{{ project.blog_archive_next }}", rel="next")
|
|
|
|
| Next page
|
|
|
|
i.pi-angle-right
|
2017-10-05 16:38:53 +02:00
|
|
|
| {% else %}
|
|
|
|
span.archive-nav-button
|
|
|
|
| Next page
|
|
|
|
i.pi-angle-right
|
|
|
|
| {% endif %}
|
|
|
|
|
2017-10-03 16:10:03 +02:00
|
|
|
| {% endmacro %}
|
|
|
|
|
2017-09-29 17:50:57 +02:00
|
|
|
| {% macro render_archive(project, posts, posts_meta) %}
|
2017-10-03 16:10:03 +02:00
|
|
|
|
|
|
|
| {{ render_archive_pagination(project) }}
|
2017-09-29 17:50:57 +02:00
|
|
|
|
|
|
|
| {% for node in posts %}
|
|
|
|
| {{ render_blog_list_item(node) }}
|
|
|
|
| {% endfor %}
|
|
|
|
|
2017-10-03 16:10:03 +02:00
|
|
|
| {{ render_archive_pagination(project) }}
|
2017-09-29 17:50:57 +02:00
|
|
|
|
|
|
|
| {% endmacro %}
|