| Left: | ||
| Right: |
| OLD | NEW |
|---|---|
| 1 {# | 1 {# |
| 2 # This file is part of the Adblock Plus website, | 2 # This file is part of the Adblock Plus website, |
| 3 # Copyright (C) 2006-2015 Eyeo GmbH | 3 # Copyright (C) 2006-2015 Eyeo GmbH |
| 4 # | 4 # |
| 5 # Adblock Plus is free software: you can redistribute it and/or modify | 5 # Adblock Plus is free software: you can redistribute it and/or modify |
| 6 # it under the terms of the GNU General Public License version 3 as | 6 # it under the terms of the GNU General Public License version 3 as |
| 7 # published by the Free Software Foundation. | 7 # published by the Free Software Foundation. |
| 8 # | 8 # |
| 9 # Adblock Plus is distributed in the hope that it will be useful, | 9 # Adblock Plus is distributed in the hope that it will be useful, |
| 10 # but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 # but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 # GNU General Public License for more details. | 12 # GNU General Public License for more details. |
| 13 # | 13 # |
| 14 # You should have received a copy of the GNU General Public License | 14 # You should have received a copy of the GNU General Public License |
| 15 # along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. | 15 # along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. |
| 16 #} | 16 #} |
| 17 | 17 |
| 18 {%- macro process_subscription(subscription, parent=None) %} | 18 {%- macro process_subscription(subscription, parent=None) %} |
| 19 <tr{% if subscription["deprecated"] %} class="deprecated"{% endif %}> | 19 <tr{% if subscription["deprecated"] %} class="deprecated"{% endif %}> |
| 20 {%- if subscription["supplements"] %} | 20 {%- if parent and subscription["supplements"] %} |
| 21 <td rowspan="2" class="dummy"></td> | 21 <td rowspan="2" class="dummy"></td> |
| 22 <td rowspan="2"> | 22 <td rowspan="2"> |
| 23 {%- else %} | 23 {%- else %} |
| 24 <td rowspan="2" colspan="2"> | 24 <td rowspan="2" colspan="2"> |
| 25 {%- endif %} | 25 {%- endif %} |
| 26 <strong class="subscriptionTitle">{{ subscription["name"] }}</strong><br> | 26 <strong class="subscriptionTitle">{{ subscription["name"] }}</strong><br> |
| 27 {{ subscription["specialization"] }} | 27 {{ subscription["specialization"] }} |
| 28 {%- if subscription["supplements"] %} | 28 {%- if subscription["supplements"] %} |
| 29 <br>{{ "supplement for"|translate("supplements_prefix") }} {{ ' / '.join(s ubscription["supplements"]) }} {{ " "|translate("supplements_suffix") }} | 29 <br>{{ "supplement for"|translate("supplements_prefix") }} {{ ' / '.join(s ubscription["supplements"]) }} {{ " "|translate("supplements_suffix") }} |
| 30 {%- endif %} | 30 {%- endif %} |
| (...skipping 30 matching lines...) Expand all Loading... | |
| 61 </td> | 61 </td> |
| 62 </tr> | 62 </tr> |
| 63 {%- if not parent -%} | 63 {%- if not parent -%} |
| 64 {%- for supplement in subscription["supplemented"]|subscription_sort -%} | 64 {%- for supplement in subscription["supplemented"]|subscription_sort -%} |
| 65 {{ process_subscription(supplement, subscription) }} | 65 {{ process_subscription(supplement, subscription) }} |
| 66 {%- endfor -%} | 66 {%- endfor -%} |
| 67 {%- endif -%} | 67 {%- endif -%} |
| 68 {%- endmacro %} | 68 {%- endmacro %} |
| 69 | 69 |
| 70 {% macro display_subscriptions(subscriptions) %} | 70 {% macro display_subscriptions(subscriptions) %} |
| 71 {%- set current_type = subscriptions[0]["type"] -%} | 71 {%- 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
| |
| 72 <h2>{{ get_string("type_" + current_type, "subscriptions") }}</h2> | |
| 73 | |
| 74 <table class="subscriptions"> | |
| 75 {%- for subscription in subscriptions|subscription_sort -%} | 72 {%- for subscription in subscriptions|subscription_sort -%} |
| 76 {%- if not subscription["supplements"] -%} | 73 {%- 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
| |
| 77 {%- if current_type != subscription["type"] -%} | 74 {%- if current_type != subscription["type"] -%} |
| 75 {%- 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
| |
| 76 </table> | |
| 77 {%- endif -%} | |
| 78 {%- set current_type = subscription["type"] %} | 78 {%- set current_type = subscription["type"] %} |
| 79 </table> | 79 <h2 id="type_{{ current_type }}">{{ get_string("type_" + current_type, "subscr iptions") }}</h2> |
| 80 | |
| 81 <h2>{{ get_string("type_" + current_type, "subscriptions") }}</h2> | |
| 82 | 80 |
| 83 <table class="subscriptions"> | 81 <table class="subscriptions"> |
| 84 {%- endif -%} | 82 {%- endif -%} |
| 83 {%- endif -%} | |
| 84 {%- if subscription["type"] not in subscription["supplementsType"] -%} | |
| 85 {{ process_subscription(subscription) }} | 85 {{ process_subscription(subscription) }} |
| 86 {%- endif -%} | 86 {%- endif -%} |
| 87 {%- endfor %} | 87 {%- endfor %} |
| 88 </table> | 88 </table> |
| 89 {% endmacro %} | 89 {% endmacro %} |
| OLD | NEW |