Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: templates/product-home.tmpl

Issue 29754555: Noissue - Use selectattr() filter to filter page metadata
Patch Set: Created April 17, 2018, 6:18 a.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « includes/product-topics-accordion.tmpl ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: templates/product-home.tmpl
diff --git a/templates/product-home.tmpl b/templates/product-home.tmpl
index a25cb11d211e20dd49287ad1359f6fd301c60560..0a494b364e3380242719075ae840ede2a1c94b05 100644
--- a/templates/product-home.tmpl
+++ b/templates/product-home.tmpl
@@ -12,7 +12,9 @@
</h1>
</header>
- {% set popular_topics = get_pages_metadata({ "product_id": product_id, "template": "article", "popular": "true" }) %}
+ {% set product_topics = get_pages_metadata()|selectattr("product_id", "equalto", product_id)
+ |selectattr("template", "equalto", "article")|list %}
+ {% set popular_topics = product_topics|selectattr("popular", "equalto", "true")|list %}
{% if popular_topics %}
<section class="card {{ product_id }}-card section">
<h2 class="card-heading has-pre-icon">
@@ -34,7 +36,7 @@
<div class="row">
{% for category in product.help_categories %}
- {% set articles = get_pages_metadata({ "product_id": product_id, "template": "article", "category": category.name }) %}
+ {% set articles = product_topics|selectattr("category", "equalto", category.name)|list %}
{% if articles and category.name != 'Popular Topics' %}
<section class="section column one-half">
<h2 class="h4 has-pre-icon">
« no previous file with comments | « includes/product-topics-accordion.tmpl ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld