Skip to content

Commit 7e428a8

Browse files
committed
Added filtering ideas by difficulty.
1 parent 98a8e2d commit 7e428a8

File tree

7 files changed

+57
-10
lines changed

7 files changed

+57
-10
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
11
_model: project-ideas
22
---
33
title: Project Ideas for GSoC 2019
4-
---
5-
body:
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>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
_model: project-ideas
2+
---
3+
title: Project Ideas for GSoC 2019
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
_model: project-ideas
2+
---
3+
title: Project Ideas for GSoC 2019
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
_model: project-ideas
2+
---
3+
title: Project Ideas for GSoC 2019

databags/project-filters.json

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"project-ideas": {
3+
"path": "/gsoc-2019/project-ideas",
4+
"nav_label": "All Projects",
5+
"field": null,
6+
"value": null
7+
},
8+
"difficulty-easy": {
9+
"path": "/gsoc-2019/project-ideas/difficulty-easy",
10+
"nav_label": "Difficulty: Easy",
11+
"field": "difficulty",
12+
"value": "Easy"
13+
},
14+
"difficulty-medium": {
15+
"path": "/gsoc-2019/project-ideas/difficulty-medium",
16+
"nav_label": "Difficulty: Medium",
17+
"field": "difficulty",
18+
"value": "Medium"
19+
},
20+
"difficulty-hard": {
21+
"path": "/gsoc-2019/project-ideas/difficulty-hard",
22+
"nav_label": "Difficulty: Hard",
23+
"field": "difficulty",
24+
"value": "Hard"
25+
}
26+
}

models/project-ideas.ini

-4
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,3 @@ protected = yes
77
[fields.title]
88
label = Title
99
type = string
10-
11-
[fields.body]
12-
label = Body
13-
type = markdown

templates/project-ideas.html

+22-3
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,32 @@
11
{% extends "layout.html" %}
2-
{% block title %}{{ this.title }}{% endblock %}
2+
{% block title %}Project Ideas for GSoC 2019{% endblock %}
33

44
{% block body %}
5-
{{ this.body }}
5+
<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>
66
<a name="ideas-top"></a>
77
<hr/>
8-
{% set ideas = site.query('/gsoc-2019/project-ideas/project-ideas-list').include_undiscoverable(true).all() %}
8+
{% set ideas = site.query('/gsoc-2019/project-ideas/project-ideas-list').include_undiscoverable(true) %}
9+
{% set ns_field = namespace(field=None) %}
10+
{% set ns_value = namespace(value=None) %}
11+
{% for slug, data in bag('project-filters').iteritems() %}
12+
{% if this._slug == slug %}
13+
{% set ns_field.field = data['field'] %}
14+
{% set ns_value.value = data['value'] %}
15+
{% endif %}
16+
{% endfor %}
17+
{% if ns_field.field == 'difficulty' %}
18+
{% set ideas = ideas.filter(F.difficulty == ns_value.value) %}
19+
{% endif %}
920
<div class="mt-4">
1021
<div>
22+
<ul class="nav nav-pills">
23+
{% for slug, data in bag('project-filters').iteritems() %}
24+
<li class="nav-item">
25+
<a class="nav-link{% if this._path == data['path'] %} active{% endif
26+
%}" href="{{ data['path'] }}">{{ data['nav_label'] }}</a>
27+
</li>
28+
{% endfor %}
29+
</ul>
1130
<ul class="list-unstyled m3">
1231
{% for idea in ideas %}
1332
<li class="my-2"><a href="#{{ idea._slug }}">{{ idea.title }}</a></li>

0 commit comments

Comments
 (0)