Files
blender-cloud/src/templates/homepage.pug
Tobias Johansson 37fe235d47 Lazy Home: Lazy load latest blog posts and assets and group by week and
project.

Javascript tutti.js and timeline.js is needed, and then the following to
init the timeline:

$('.timeline')
    .timeline({
        url: '/api/timeline'
    });

# Javascript Notes:
## ES6 transpile:
* Files in src/scripts/js/es6/common will be transpiled from
modern es6 js to old es5 js, and then added to tutti.js
* Files in src/scripts/js/es6/individual will be transpiled from
modern es6 js to old es5 js to individual module files
## JS Testing
* Added the Jest test framework to write javascript tests.
* `npm test` will run all the javascript tests

Thanks to Sybren for reviewing
2018-11-12 12:57:24 +01:00

130 lines
4.1 KiB
Plaintext

| {% extends 'layout.html' %}
| {% from '_macros/_navigation.html' import navigation_homepage %}
| {% from '_macros/_asset_list_item.html' import asset_list_item %}
| {% from 'nodes/custom/blog/_macros.html' import render_blog_post %}
include ../../../pillar/src/templates/mixins/components
| {% set title = 'homepage' %}
| {% block og %}
meta(property="og:type", content="website")
meta(property="og:url", content="{{ request.url }}")
meta(property="og:title", content="Blender Cloud")
meta(name="twitter:title", content="Blender Cloud")
meta(property="og:description", content="Blender Cloud is a web based service developed by Blender Institute that allows people to access the training videos and all the data from the open projects.")
meta(name="twitter:description", content="Blender Cloud is a web based service developed by Blender Institute that allows people to access the training videos and all the data from the open projects.")
meta(property="og:image", content="{% if main_project.picture_header %}{{ main_project.picture_header.thumbnail('l', api=api) }}{% else %}{{ url_for('static', filename='assets/img/backgrounds/background_agent327_04.jpg')}}{% endif %}")
meta(name="twitter:image", content="{% if main_project.picture_header %}{{ main_project.picture_header.thumbnail('l', api=api) }}{% else %}{{ url_for('static', filename='assets/img/backgrounds/background_agent327_04.jpg')}}{% endif %}")
| {% endblock %}
| {% block navigation_tabs %}
| {{ navigation_homepage(title) }}
| {% endblock navigation_tabs %}
| {% block body %}
.container-fluid.dashboard-container.imgs-fluid
.row
.col-md-8.col-xl-9
section.timeline
.d-block.text-center
a.d-inline-block.p-3.text-muted(href="{{ url_for('main.main_blog') }}")
| See All Blog Posts
a.d-inline-block.p-3.text-muted(
href="{{ url_for('main.feeds_blogs') }}",
title="Blogs Feed",
data-toggle="tooltip",
data-placement="left")
i.pi-rss
| RSS Feed
.col-md-4.col-xl-3
section.pt-3
h6.title-underline
a.text-muted(href="{{ url_for('cloud.open_projects') }}")
| Films In Production
a(href="/p/spring/")
img.rounded(
alt="Spring Open Movie Project",
src="{{ url_for('static', filename='assets/img/projects/spring_sidebar_01.jpg')}}")
p.text-muted.pt-2.
A poetic short film about a mountain spirit and her wise little dog. #[a.text-muted(href="/p/spring/") Check it out].
section.py-3.border-bottom.mb-3
h6.title-underline
a.text-muted(href="{{ url_for('main.nodes_search_index') }}")
| Random Awesome
| {% if random_featured %}
+card-deck()(class='card-deck-vertical pl-3')
| {% for child in random_featured %}
| {% if child.node_type not in ['comment'] %}
| {{ asset_list_item(child, current_user) }}
| {% endif %}
| {% endfor %}
| {% else %}
.card
.card-body
h6.card-title
| No random featured.
| {% endif %}
section.py-3
h6.title-underline Latest Comments
ul.list-unstyled.pt-2
| {% if latest_comments %}
| {% for n in latest_comments %}
li.pb-2.mb-2.border-bottom.text-truncate
a.js-comment-content.text-muted(href="{{ n.url }}")
| {{ n.properties.content | striptags | truncate(200) }}
| {% if n.attached_to %}
.d-flex.align-items-baseline
a.text-muted.text-truncate(href="{{ n.attached_to.url }}")
small.pr-2.font-weight-bold {{ n.project.name }}
small {{ n.attached_to.name }}
| {% endif %}
.d-flex.align-items-baseline
small.pr-2.font-weight-bold {{ n.user.full_name }}
a.text-muted(href="{{ n.url }}", title="{{ n._created }}")
small {{ n._created | pretty_date }}
| {% endfor %}
| {% else %}
span
| No comments... yet!
| {% endif %}
| {% endblock %}
| {% block footer_scripts %}
script.
$(function () {
/* cleanup mentions in comments */
$('.js-comment-content').each(function(){
$(this).text($(this).text().replace(/\*|\@|\<(.*?)\>/g, ''));
});
$('.timeline')
.timeline({
url: '/api/timeline'
});
hopToTop(); // Display jump to top button
});
| {% endblock %}