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}},
|
||||
{'$project': {'nodes_featured': True,
|
||||
'url': True,
|
||||
'name': True}},
|
||||
'name': True,
|
||||
'summary': True,
|
||||
'picture_square': True}},
|
||||
{'$unwind': {'path': '$nodes_featured'}},
|
||||
{'$sample': {'size': 3}},
|
||||
{'$lookup': {'from': 'nodes',
|
||||
@@ -243,6 +245,8 @@ def get_random_featured_nodes() -> typing.List[dict]:
|
||||
{'$unwind': {'path': '$node'}},
|
||||
{'$project': {'url': True,
|
||||
'name': True,
|
||||
'summary': True,
|
||||
'picture_square': True,
|
||||
'node._id': True,
|
||||
'node.name': True,
|
||||
'node.permissions': True,
|
||||
@@ -261,6 +265,8 @@ def get_random_featured_nodes() -> typing.List[dict]:
|
||||
node = Node(node_document)
|
||||
node.picture = get_file(node.picture, api=api)
|
||||
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)
|
||||
|
||||
return featured_node_documents
|
||||
|
@@ -208,6 +208,19 @@ meta(name="twitter:image", content="{% if main_project.picture_header %}{{ main_
|
||||
ul.random-asset__list
|
||||
| {% for n in random_featured %}
|
||||
| {% 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
|
||||
| {% if n.permissions.world %}
|
||||
.ribbon
|
||||
@@ -232,7 +245,7 @@ meta(name="twitter:image", content="{% if main_project.picture_header %}{{ main_
|
||||
a(href="{{ n.url }}")
|
||||
| {% if n.properties.content_type %}{{ n.properties.content_type }}{% else %}Folder{% endif %}
|
||||
li.where
|
||||
a(href="{{ url_for('projects.view', project_url=n.project.url) }}")
|
||||
a(href="{{ n.project.url }}")
|
||||
| {{ n.project.name }}
|
||||
| {% else %}
|
||||
|
||||
@@ -264,7 +277,7 @@ meta(name="twitter:image", content="{% if main_project.picture_header %}{{ main_
|
||||
a(href="{{ n.url }}")
|
||||
| {% if n.properties.content_type %}{{ n.properties.content_type }}{% else %}Folder{% endif %}
|
||||
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 %}
|
||||
| {% endfor %}
|
||||
|
Reference in New Issue
Block a user