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

Unified Diff: includes/subscriptionList.tmpl

Issue 29326085: Issue 2823 - Display new subscription types on subscriptions page (Closed)
Patch Set: Refactored display_subscriptions macro Created Sept. 15, 2015, 1:10 p.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 | « no previous file | locales/en/subscriptions.json » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: includes/subscriptionList.tmpl
===================================================================
--- a/includes/subscriptionList.tmpl
+++ b/includes/subscriptionList.tmpl
@@ -17,7 +17,7 @@
{%- macro process_subscription(subscription, parent=None) %}
<tr{% if subscription["deprecated"] %} class="deprecated"{% endif %}>
- {%- if subscription["supplements"] %}
+ {%- if parent and subscription["supplements"] %}
<td rowspan="2" class="dummy"></td>
<td rowspan="2">
{%- else %}
@@ -68,20 +68,20 @@
{%- endmacro %}
{% macro display_subscriptions(subscriptions) %}
- {%- set current_type = subscriptions[0]["type"] -%}
- <h2>{{ get_string("type_" + current_type, "subscriptions") }}</h2>
-
- <table class="subscriptions">
+ {%- set current_type = None -%}
kzar 2015/09/15 15:54:55 Subscriptions always have a type right? If so we c
Thomas Greiner 2015/09/16 12:06:28 Done. It was just a personal preference to make th
{%- for subscription in subscriptions|subscription_sort -%}
- {%- if not subscription["supplements"] -%}
+ {%- if not subscription["supplements"] or current_type != subscription["type"] -%}
kzar 2015/09/15 15:54:55 How about an application of De Morgan's law? {% i
Thomas Greiner 2015/09/16 12:06:28 Done. Haven't heard about that theorem yet so than
{%- if current_type != subscription["type"] -%}
+ {%- if current_type != None %}
kzar 2015/09/15 15:54:55 Nit: In Python I think you should use `is` for che
Thomas Greiner 2015/09/16 12:06:28 Done. `is not` was throwing a Jinja2 exception whe
+ </table>
+ {%- endif -%}
{%- set current_type = subscription["type"] %}
- </table>
-
- <h2>{{ get_string("type_" + current_type, "subscriptions") }}</h2>
+ <h2 id="type_{{ current_type }}">{{ get_string("type_" + current_type, "subscriptions") }}</h2>
<table class="subscriptions">
{%- endif -%}
+ {%- endif -%}
+ {%- if subscription["type"] not in subscription["supplementsType"] -%}
{{ process_subscription(subscription) }}
{%- endif -%}
{%- endfor %}
« no previous file with comments | « no previous file | locales/en/subscriptions.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld