Homepage Random Featured: Show project more prominently for first item
This commit is contained in:
@@ -233,7 +233,9 @@ def get_random_featured_nodes() -> typing.List[dict]:
|
|||||||
{'$match': {'is_private': False}},
|
{'$match': {'is_private': False}},
|
||||||
{'$project': {'nodes_featured': True,
|
{'$project': {'nodes_featured': True,
|
||||||
'url': True,
|
'url': True,
|
||||||
'name': True}},
|
'name': True,
|
||||||
|
'summary': True,
|
||||||
|
'picture_square': True}},
|
||||||
{'$unwind': {'path': '$nodes_featured'}},
|
{'$unwind': {'path': '$nodes_featured'}},
|
||||||
{'$sample': {'size': 3}},
|
{'$sample': {'size': 3}},
|
||||||
{'$lookup': {'from': 'nodes',
|
{'$lookup': {'from': 'nodes',
|
||||||
@@ -243,6 +245,8 @@ def get_random_featured_nodes() -> typing.List[dict]:
|
|||||||
{'$unwind': {'path': '$node'}},
|
{'$unwind': {'path': '$node'}},
|
||||||
{'$project': {'url': True,
|
{'$project': {'url': True,
|
||||||
'name': True,
|
'name': True,
|
||||||
|
'summary': True,
|
||||||
|
'picture_square': True,
|
||||||
'node._id': True,
|
'node._id': True,
|
||||||
'node.name': True,
|
'node.name': True,
|
||||||
'node.permissions': True,
|
'node.permissions': True,
|
||||||
@@ -261,6 +265,8 @@ def get_random_featured_nodes() -> typing.List[dict]:
|
|||||||
node = Node(node_document)
|
node = Node(node_document)
|
||||||
node.picture = get_file(node.picture, api=api)
|
node.picture = get_file(node.picture, api=api)
|
||||||
node.url = url_for_node(node=node)
|
node.url = url_for_node(node=node)
|
||||||
|
node.project.url = url_for('projects.view', project_url=node.project.url)
|
||||||
|
node.project.picture_square = get_file(node.project.picture_square, api=api)
|
||||||
featured_node_documents.append(node)
|
featured_node_documents.append(node)
|
||||||
|
|
||||||
return featured_node_documents
|
return featured_node_documents
|
||||||
|
@@ -208,6 +208,19 @@ meta(name="twitter:image", content="{% if main_project.picture_header %}{{ main_
|
|||||||
ul.random-asset__list
|
ul.random-asset__list
|
||||||
| {% for n in random_featured %}
|
| {% for n in random_featured %}
|
||||||
| {% if n.picture and loop.first %}
|
| {% if n.picture and loop.first %}
|
||||||
|
li.random-asset__list-item.project
|
||||||
|
| {% if n.project.picture_square %}
|
||||||
|
a.random-asset__list-thumbnail(
|
||||||
|
href="{{ n.project.url }}")
|
||||||
|
img.image(src="{{ n.project.picture_square.thumbnail('s', api=api) }}")
|
||||||
|
| {% endif %}
|
||||||
|
.random-asset__list-details
|
||||||
|
a.title(href="{{ n.project.url }}") {{ n.project.name }}
|
||||||
|
| {% if n.project.summary %}
|
||||||
|
ul.meta
|
||||||
|
li.what {{ n.project.summary }}
|
||||||
|
| {% endif %}
|
||||||
|
|
||||||
li.random-asset__list-item.featured
|
li.random-asset__list-item.featured
|
||||||
| {% if n.permissions.world %}
|
| {% if n.permissions.world %}
|
||||||
.ribbon
|
.ribbon
|
||||||
@@ -232,7 +245,7 @@ meta(name="twitter:image", content="{% if main_project.picture_header %}{{ main_
|
|||||||
a(href="{{ n.url }}")
|
a(href="{{ n.url }}")
|
||||||
| {% if n.properties.content_type %}{{ n.properties.content_type }}{% else %}Folder{% endif %}
|
| {% if n.properties.content_type %}{{ n.properties.content_type }}{% else %}Folder{% endif %}
|
||||||
li.where
|
li.where
|
||||||
a(href="{{ url_for('projects.view', project_url=n.project.url) }}")
|
a(href="{{ n.project.url }}")
|
||||||
| {{ n.project.name }}
|
| {{ n.project.name }}
|
||||||
| {% else %}
|
| {% else %}
|
||||||
|
|
||||||
@@ -264,7 +277,7 @@ meta(name="twitter:image", content="{% if main_project.picture_header %}{{ main_
|
|||||||
a(href="{{ n.url }}")
|
a(href="{{ n.url }}")
|
||||||
| {% if n.properties.content_type %}{{ n.properties.content_type }}{% else %}Folder{% endif %}
|
| {% if n.properties.content_type %}{{ n.properties.content_type }}{% else %}Folder{% endif %}
|
||||||
li.where
|
li.where
|
||||||
a(href="{{ url_for('projects.view', project_url=n.project.url) }}") {{ n.project.name }}
|
a(href="{{ n.project.url }}") {{ n.project.name }}
|
||||||
|
|
||||||
| {% endif %}
|
| {% endif %}
|
||||||
| {% endfor %}
|
| {% endfor %}
|
||||||
|
Reference in New Issue
Block a user