Added blog archive.

May still need some style tweaking.
This commit is contained in:
2017-09-29 17:50:57 +02:00
parent e724c9c2ad
commit 73b50556be
8 changed files with 116 additions and 23 deletions

View File

@@ -647,3 +647,9 @@
.blog_index-item
padding-top: 55px
font-size: .9em
.blog-archive h1
border-bottom: thin solid $color-background
padding-bottom: 0.3ex
text-align: center
color: $color-text-dark-secondary

View File

@@ -27,20 +27,7 @@
| {% endmacro %}
//- ******************************************************* -//
| {% macro render_blog_index(project, posts, can_create_blog_posts, api) %}
| {% 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 %}
h4.blog_index-title Blasts from the past
| {% endif %}
| {% macro render_blog_list_item(node) %}
.blog_index-item.list
| {% if node.picture %}
.item-header
@@ -61,7 +48,32 @@ h4.blog_index-title Blasts from the past
{% if node.properties.category %}| {{node.properties.category}}{% endif %}
| by {{node.user.full_name}}
{% if node.properties.status != 'published' %} | {{ node.properties.status}} {% endif %}
| {% endfor %} {# posts #}
| {% 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 %}
h4.blog_index-title Blasts from the past
| {% endif %}
| {{ render_blog_list_item(node) }}
| {% endfor %}
| {% if more_posts_available %}
.blog_index-item
a.item-title.blog-archive(href="{{ project.blog_archive_url }}")
| {{posts_meta.total - posts|length}} more blog posts live here
| {% endif %}
| {% else %}
@@ -70,3 +82,21 @@ h4.blog_index-title Blasts from the past
| {% endif %} {# posts #}
| {% endmacro %}
//- ******************************************************* -//
| {% macro render_archive(project, posts, posts_meta) %}
| {% if project.blog_archive_prev %}
.blog_index-item.list
a(href="{{ project.blog_archive_prev }}", rel="prev") Previous page
| {% endif %}
| {% for node in posts %}
| {{ render_blog_list_item(node) }}
| {% endfor %}
| {% if project.blog_archive_next %}
.blog_index-item.list
a(href="{{ project.blog_archive_next }}", rel="next") Next page
| {% endif %}
| {% endmacro %}

View File

@@ -0,0 +1,8 @@
| {% extends 'nodes/custom/blog/index.html' %}
| {% import 'nodes/custom/blog/_macros.html' as blogmacros %}
| {% block project_context %}
#blog_container.blog-archive
#blog_index-container.expand-image-links
| {{ blogmacros.render_archive(project, posts, posts_meta) }}
| {% endblock %}

View File

@@ -0,0 +1,11 @@
| {% extends 'nodes/custom/blog/index_main_project.html' %}
| {% import 'nodes/custom/blog/_macros.html' as blogmacros %}
| {% block body %}
.container.blog-archive
#blog_container.cloud-blog
#blog_index-container.expand-image-links
.blog_index-header
h1 Blog Archive
| {{ blogmacros.render_archive(project, posts, posts_meta) }}
| {% endblock %}

View File

@@ -11,7 +11,7 @@ link(href="{{ url_for('static_pillar', filename='assets/css/blog.css', v=1732017
| {% block project_context %}
#blog_container
#blog_index-container.expand-image-links
| {{ blogmacros.render_blog_index(project, posts, can_create_blog_posts, api) }}
| {{ blogmacros.render_blog_index(project, posts, can_create_blog_posts, api, more_posts_available, posts_meta) }}
| {% endblock %}
| {% block project_tree %}

View File

@@ -8,7 +8,7 @@
.container
#blog_container.cloud-blog
#blog_index-container.expand-image-links
| {{ blogmacros.render_blog_index(project, posts, can_create_blog_posts, api) }}
| {{ blogmacros.render_blog_index(project, posts, can_create_blog_posts, api, more_posts_available, posts_meta) }}
| {% endblock %}
| {% block footer_scripts %}