| {% extends 'projects/view.html' %}
| {% import 'nodes/custom/blog/_macros.html' as blogmacros %}
| {% set title = 'blog' %}
| {% block page_title %}Blog{% endblock%}

| {% block css %}
| {{ super() }}
link(href="{{ url_for('static_pillar', filename='assets/css/blog.css') }}", rel="stylesheet")
| {% endblock %}

| {% block project_context %}
#blog_container
	#blog_index-container.expand-image-links
		| {{ blogmacros.render_blog_index(project, posts, can_create_blog_posts, api, more_posts_available, posts_meta) }}
| {% endblock %}

| {% block project_tree %}
#project_tree.jstree.jstree-default.blog
	ul.jstree-container-ul.jstree-children
		li.jstree-node(data-node-type="page")
			a.jstree-anchor(
				href="{{ url_for('projects.view', project_url=project.url) }}")
				| Browse Project

		li.jstree-node(data-node-type="page")
			a.jstree-anchor.jstree-clicked(
				href="{{ url_for('main.project_blog', project_url=project.url) }}") Blog

		| {% for post in posts %}
		li.jstree-node
			a.jstree-anchor.tree-item.post(
				href="{{ node.url }}")
				.tree-item-thumbnail
					| {% if post.picture %}
					img(src="{{ post.picture.thumbnail('s', api=api) }}")
					| {% else %}
					i.pi-document-text
					| {% endif %}
				span.tree-item-title {{ post.name }}
				span.tree-item-info {{ post._created | pretty_date }}
		| {% endfor %}
| {% endblock %}

| {% block footer_scripts %}
include ../_scripts
script.
	/* UI Stuff */
	var project_container = document.getElementById('project-container');

	$(window).on("load resize",function(){
		containerResizeY($(window).height());

		if ($(window).width() > 480) {
			project_container.style.height = (window.innerHeight - project_container.offsetTop) + "px";
		}
	});

| {% endblock %}
