| {% extends 'layout.html' %}
| {% import 'nodes/custom/blog/_macros.html' as blogmacros %}
| {% set title = 'blog' %}

| {% block page_title %}Blog{% endblock%}

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

| {% block footer_scripts %}

include ../_scripts
script.
	hopToTop(); // Display jump to top button

	/* Expand images when their link points to a jpg/png/gif */
	/* TODO: De-duplicate code from view post */
	var page_overlay = document.getElementById('page-overlay');
	$('.blog_index-item .item-content a img').on('click', function(e){
		e.preventDefault();

		var href = $(this).parent().attr('href');
		var src = $(this).attr('src');

		if (href.match("jpg$") || href.match("png$") || href.match("gif$")) {
			$(page_overlay)
						.addClass('active')
						.html('<img src="' + src + '"/>');
		} else {
			window.location.href = href;
		}
	});

| {% endblock %}
