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:
2017-08-30 14:04:15 +02:00
parent 62542f0329
commit 811236cff4
81 changed files with 17 additions and 17 deletions

View File

@@ -0,0 +1,142 @@
| {% block body %}
#node-container
section.node-preview.project
| {% if header_video_file %}
video#videoplayer.video-js.vjs-fluid(
controls,
data-setup="{}",
preload="auto",
poster="{% if header_video_node.picture %}{{ header_video_node.picture.thumbnail('l', api=api) }}{% endif %}")
| {% for source in header_video_file.variations %}
source(
src="{{ source.link | safe }}",
type="{{ source.content_type }}")
| {% endfor %}
p.vjs-no-js.
To view this video please enable JavaScript, and consider upgrading to a web browser that
<a href="http://videojs.com/html5-video-support/" target="_blank">supports HTML5 video</a>
| {% elif project.picture_header %}
a(href="{{ url_for( 'projects.view', project_url=project.url) }}")
img.header(src="{{ project.picture_header.thumbnail('l', api=api) }}")
| {% endif %}
section.node-details-container.project
| {# Hide for now
.node-details-header
.node-title-details
.date(title="Last updated {{ project._updated | pretty_date }}") {{ project._created | pretty_date }}
| {% if project.status %}
.status {{project.status}}
| {% endif %}
| #}
.node-details-title
h1
a(href="{{ url_for( 'projects.view', project_url=project.url) }}") {{ project.name }}
| {% if project.description %}
.node-details-description
| {{ project.description }}
| {% endif %}
| {# Until we implement urls for pages
a.learn-more(href="{{ url_for( 'projects.view', project_url=project.url) }}") LEARN MORE
| #}
.node-extra
| {% if activity_stream %}
.node-updates
ul.node-updates-list
| {% for n in activity_stream %}
| {% if n.node_type not in ['comment'] %}
li.node-updates-list-item(
data-node_id="{{ n._id }}",
class="{{ n.node_type }} {{ n.properties.content_type | hide_none }}")
a.image(href="{{ url_for_node(node=n) }}")
| {% if n.picture %}
img(src="{{ n.picture.thumbnail('l', api=api) }}")
| {% endif %}
| {% if n.node_type == 'post' %}
i.pi-newspaper
| {% elif n.node_type == 'texture' or n.node_type == 'group_texture' %}
i.pi-texture
| {% elif n.properties.content_type == 'video' %}
i.pi-film-thick
| {% elif n.properties.content_type == 'image' %}
i.pi-picture
| {% elif n.properties.content_type == 'file' %}
i.pi-file-archive
| {% else %}
i.pi-folder
| {% endif %}
| {% if n.permissions.world %}
.ribbon
span free
| {% endif %}
.info
a.title(href="{{ url_for_node(node=n) }}") {{ n.name }}
p.description(href="{{ url_for_node(node=n) }}")
| {% if n.node_type == 'post' %}
| {{ n.properties.content | markdown | striptags | truncate(140, end="... <small>read more</small>") | safe | hide_none }}
| {% else %}
| {{ n.description | markdown | striptags | truncate(140, end="... <small>read more</small>") | safe | hide_none }}
| {% endif %}
span.details
span.what {% if n.properties.content_type %}{{ n.properties.content_type | undertitle }}{% else %}{{ n.node_type | undertitle }}{% endif %} ·
span.when {{ n._updated | pretty_date }} by
span.who {{ n.user.full_name }}
| {% endif %}
| {% endfor %}
| {% endif %}
include _scripts
script(src="{{ url_for('static_pillar', filename='assets/js/vendor/jquery.montage.min.js') }}")
script.
function montage(){
var $container = $('#featured-list'),
$imgs = $container.find('img').hide(),
totalImgs = $imgs.length,
cnt = 0;
$imgs.each(function(i) {
var $img = $(this);
$('<img/>').on('load', function() {
++cnt;
if( cnt === totalImgs ) {
$imgs.show();
$container.montage({
fillLastRow : true,
alternateHeight : true,
alternateHeightRange : {
min : 180,
max : 240
},
margin : 3
});
}
}).attr('src',$img.attr('src'));
$img.parent().removeClass('hidden');
});
}
$(function() {
montage();
$(".node-updates-list-item.asset, .node-updates-list-item.group")
.unbind('click')
.click(function(e) {
e.preventDefault();
displayNode($(this).data('node_id'));
});
});
| {% endblock %}