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

Side by Side Diff: includes/product-topics-accordion.tmpl

Issue 29754555: Noissue - Use selectattr() filter to filter page metadata
Patch Set: Created April 17, 2018, 6:18 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | templates/product-home.tmpl » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <dl id="product-topics-accordion" class="accordion"> 1 <dl id="product-topics-accordion" class="accordion">
2 {% for category in product.help_categories %} 2 {% for category in product.help_categories %}
3 {% set articles = get_pages_metadata({ "product_id": product_id, "template": "article", "category": category.name }) %} 3 {% set articles = get_pages_metadata()|selectattr("product_id", "equalto", p roduct_id)
4 |selectattr("template", "equalto", "ar ticle")
5 |selectattr("category", "equalto", cat egory.name)|list %}
4 {% if articles %} 6 {% if articles %}
5 <dt role="heading" aria-level="3" class="accordion-heading"> 7 <dt role="heading" aria-level="3" class="accordion-heading">
6 <button aria-expanded="true" aria-controls="sect-{{ category.slug }}" id ="heading-{{ category.slug }}" class="accordion-toggle-button"> 8 <button aria-expanded="true" aria-controls="sect-{{ category.slug }}" id ="heading-{{ category.slug }}" class="accordion-toggle-button">
7 <img src="/dist/img/png/arrow-icon-secondary.png" srcset="/dist/img/sv g/arrow-icon-secondary.svg 2x" alt="{{ "Toggle arrow" | translate("accordion-tog gle-icon", "Image alt text") }}"> 9 <img src="/dist/img/png/arrow-icon-secondary.png" srcset="/dist/img/sv g/arrow-icon-secondary.svg 2x" alt="{{ "Toggle arrow" | translate("accordion-tog gle-icon", "Image alt text") }}">
8 {{ category.name | translate( category.slug + "-category-title", "Cate gory title") }} 10 {{ category.name | translate( category.slug + "-category-title", "Cate gory title") }}
9 </button> 11 </button>
10 </dt> 12 </dt>
11 <dd role="region" aria-labelledby="heading-{{ category.slug }}" id="sect-{ { category.slug }}" class="accordion-body"> 13 <dd role="region" aria-labelledby="heading-{{ category.slug }}" id="sect-{ { category.slug }}" class="accordion-body">
12 <ul class="underlined-list"> 14 <ul class="underlined-list">
13 {% for article in articles %} 15 {% for article in articles %}
14 <li> 16 <li>
15 <a href="{{ article["page"] }}"> 17 <a href="{{ article["page"] }}">
16 {{ article.title | translate( get_page_name( article["page"]) + "- title", "Article title") }} 18 {{ article.title | translate( get_page_name( article["page"]) + "- title", "Article title") }}
17 </a> 19 </a>
18 </li> 20 </li>
19 {% endfor %} 21 {% endfor %}
20 </ul> 22 </ul>
21 </dd> 23 </dd>
22 {% endif %} 24 {% endif %}
23 {% endfor %} 25 {% endfor %}
24 </dl> 26 </dl>
OLDNEW
« no previous file with comments | « no previous file | templates/product-home.tmpl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld