|
1 | 1 | {% extends "layout.html" %}
|
2 | 2 | {% block title %}Project Ideas for GSoC 2019{% endblock %}
|
3 | 3 |
|
| 4 | +{% block header %}GSoC 2019: Project Ideas{% endblock %} |
4 | 5 | {% block body %}
|
5 | 6 | <p class="text-muted">This is the project idea list for the <a href="/gsoc-2019">Google Summer of Code 2019</a> program. We have a mix of projects that are meant to be installed widely (such as plugins for other software) and projects that are more focused on improving user experience for users of Creative Commons licenses. Regardless of scope, these projects all have a broad and positive community impact.</p>
|
6 | 7 | <a name="ideas-top"></a>
|
7 | 8 | <hr/>
|
8 | 9 | <!-- We display all ideas by default. -->
|
9 |
| - {% set ideas = site.query('/gsoc-2019/project-ideas/project-ideas-list').include_undiscoverable(true) %} |
10 |
| - <!-- The following code filters the ideas to display based on the current URL. These mappings are defined in the "databags" folder. |
11 |
| - Jinja does not support changing values of variables inside loops, so we have to use namespace objects. |
12 |
| - See "Scoping Behavior" here: http://jinja.pocoo.org/docs/2.10/templates/#assignments --> |
13 |
| - {% set ns = namespace(field=None, value=None) %} |
14 |
| - {% for slug, data in bag('project-filters').iteritems() %} |
15 |
| - {% if this._slug == slug %} |
16 |
| - {% set ns.field = data['field'] %} |
17 |
| - {% set ns.value = data['value'] %} |
18 |
| - {% endif %} |
19 |
| - {% endfor %} |
20 |
| - {% if ns.field == 'difficulty' %} |
21 |
| - {% set ideas = ideas.filter(F.difficulty == ns.value) %} |
22 |
| - {% endif %} |
23 |
| - {% if ns.field == 'skill' %} |
24 |
| - {% set ideas = ideas.filter(F.skills_recommended.contains(ns.value)) %} |
| 10 | + {% set ideas = site.query('/gsoc-2019/project-ideas-collection').include_undiscoverable(true) %} |
| 11 | + {% set filters = site.query('/gsoc-2019/project-ideas').include_undiscoverable(true).order_by('order') %} |
| 12 | + {% set current_filter = filters.filter(F._slug == this._slug).first() %} |
| 13 | + <!-- The following code filters the ideas to display based on the current URL. --> |
| 14 | + {% if current_filter.field == 'difficulty' %} |
| 15 | + {% set ideas = ideas.filter(F.difficulty == current_filter.value) %} |
| 16 | + {% elif current_filter.field == 'recommended_skill' %} |
| 17 | + {% set ideas = ideas.filter(F.skills_recommended.contains(current_filter.value)) %} |
25 | 18 | {% endif %}
|
26 | 19 | <div class="mt-4">
|
27 | 20 | <div>
|
28 |
| - {% for slug, data in bag('project-filters').iteritems() %} |
29 |
| - <a href="{{ data['path'] }}"> |
30 |
| - <button type="button" class="btn btn-sm {% if this._path == data['path'] %}btn-dark{% else %}btn-primary{% endif %}" {% if this._path == data['path'] %}disabled{% endif %}> |
31 |
| - {{ data['nav_label'] }} |
| 21 | + {% for filter in filters %} |
| 22 | + <a href="{{ filter.url_path }}"> |
| 23 | + <button type="button" class="m-1 btn btn-sm {% if this._slug == filter._slug %}btn-dark{% else %}btn-primary{% endif %}" {% if this._slug == filter._slug %}disabled{% endif %}> |
| 24 | + {{ filter.nav_label }} |
32 | 25 | </button>
|
33 | 26 | </a>
|
34 | 27 | {% endfor %}
|
|
0 commit comments