Use list-asset() mixin component for project index

This commit is contained in:
2018-09-10 19:02:27 +02:00
parent ecace8c55b
commit 5df92ca4cf
6 changed files with 70 additions and 64 deletions

View File

@@ -62,8 +62,28 @@ mixin card-deck(columns)
// +card(data-url="{{ url_for('projects.view', project_url=project.url) }}", tabindex='{{ loop.index }}')
// #}
mixin card()
.card.card-fade.cursor-pointer.mb-4.js-project-go&attributes(attributes)
.card&attributes(attributes)
if block
block
else
p No card content defined.
mixin list-asset(name, url, image, type, date)
a(href=url).card.asset&attributes(attributes)
if image
.embed-responsive.embed-responsive-16by9
.card-img-top.embed-responsive-item(style="background-image: url(" + image + ")")
.card-body
if name
h6.card-title.mb-1
=name
ul.card-text.list-unstyled.d-flex.text-black-50
if type
li.pr-2=type
if date
li=date
if block
block

View File

@@ -1,5 +1,6 @@
| {% block body %}
include ../mixins/components
| {% block body %}
#node-container
section.node-preview.project
| {% if header_video_file %}
@@ -34,54 +35,19 @@
a.learn-more(href="{{ url_for( 'projects.view', project_url=project.url) }}") LEARN MORE
| #}
.node-extra
.p-4
| {% 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 | markdowned('content') | striptags | truncate(140, end="... <small>read more</small>") | safe | hide_none }}
| {% else %}
| {{ n | markdowned('description') | 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 %}
+card-deck(3)
| {% for n in activity_stream %}
| {% if n.node_type not in ['comment'] %}
+list-asset(
'{{ n.name }}',
'{{ url_for_node(node=n) }}',
"{% if n.picture %}{{ n.picture.thumbnail('l', api=api) }}{% endif %}",
"{% if n.properties.content_type %}{{ n.properties.content_type | undertitle }}{% else %}{{ n.node_type | undertitle }}{% endif %}",
"{{ n._updated | pretty_date }}")(class="{% if n.permissions.world %}free{% endif %}")
| {% endif %}
| {% endfor %}
| {% endif %}
include _scripts