Migrate Jade to Pug template engine
Jade templates engine has been renamed to Pug. We are using Pug already on the Blender Cloud repository, following is Flamenco and Attract
This commit is contained in:
150
src/templates/nodes/custom/blog/index.pug
Normal file
150
src/templates/nodes/custom/blog/index.pug
Normal file
@@ -0,0 +1,150 @@
|
||||
| {% extends 'projects/view.html' %}
|
||||
| {% set title = 'blog' %}
|
||||
| {% block page_title %}Blog{% endblock%}
|
||||
|
||||
| {% block css %}
|
||||
link(href="{{ url_for('static_pillar', filename='assets/css/font-pillar.css', v=17320171) }}", rel="stylesheet")
|
||||
link(href="{{ url_for('static_pillar', filename='assets/css/base.css', v=17320171) }}", rel="stylesheet")
|
||||
link(href="{{ url_for('static_pillar', filename='assets/css/project-main.css', v=17320171) }}", rel="stylesheet")
|
||||
link(href="{{ url_for('static_pillar', filename='assets/css/blog.css', v=17320171) }}", rel="stylesheet")
|
||||
| {% endblock %}
|
||||
|
||||
| {% block project_context %}
|
||||
|
||||
#blog_container
|
||||
|
||||
#blog_index-container
|
||||
|
||||
| {% if project.node_type_has_method('post', 'POST', api=api) %}
|
||||
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 %}
|
||||
|
||||
| {% for node in posts %}
|
||||
|
||||
| {% if loop.first %}
|
||||
| {% 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
|
||||
|
||||
| {% else %}
|
||||
|
||||
| {% if loop.index == 2 %}
|
||||
h4.blog_index-title Blasts from the past
|
||||
| {% endif %}
|
||||
|
||||
.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 %}
|
||||
|
||||
| {% endif %} {# loop #}
|
||||
|
||||
| {% endfor %} {# posts #}
|
||||
|
||||
| {% else %}
|
||||
|
||||
.blog_index-item
|
||||
.item-content No posts yet.
|
||||
|
||||
| {% endif %} {# posts #}
|
||||
|
||||
| {% 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.jstree-leaf(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(
|
||||
href="{{ url_for_node(node=post) }}")
|
||||
.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 }} · {{ post.user.full_name }}
|
||||
| {% endfor %}
|
||||
| {% endblock %}
|
||||
|
||||
| {% block footer_scripts %}
|
||||
include ../_scripts
|
||||
script.
|
||||
/* Expand images when their link points to a jpg/png/gif */
|
||||
$('.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;
|
||||
}
|
||||
});
|
||||
|
||||
/* UI Stuff */
|
||||
$(window).on("load resize",function(){
|
||||
containerResizeY($(window).height());
|
||||
|
||||
if ($(window).width() > 480) {
|
||||
project_container.style.height = (window.innerHeight - project_container.offsetTop) + "px";
|
||||
}
|
||||
});
|
||||
|
||||
| {% endblock %}
|
Reference in New Issue
Block a user