Commit ffa7ecb9 authored by Julien Palard's avatar Julien Palard
Browse files

Try to enhance exercises list.

parent 5ca2e13e
......@@ -29,9 +29,9 @@ celery -A hkis worker
Templates are translated using django `makemessages` and `compilemessages` commands:
```
$ django-admin makemessages -a
$ ./manage.py makemessages --locale fr
# Edit the .po files
$ django-admin compilemessages
$ ./manage.py compilemessages
```
Exercises (title and wording) are translated via the admin (or the
......
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-09-28 13:18+0200\n"
"PO-Revision-Date: 2020-09-28 13:20+0200\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
#: templates/admin/base_site.html:3
msgid "Django site admin"
msgstr "Admin Django"
......@@ -44,9 +44,18 @@ def main():
for exercise in exercises["results"]:
path = Path("exercises") / exercise["slug"]
path.mkdir(exist_ok=True, parents=True)
for file in "check.py", "solution.py", "wording.md", "initial_solution.py":
for file in (
"check.py",
"solution.py",
"wording.md",
"wording_en.md",
"wording_fr.md",
"initial_solution.py",
):
(path / (file)).write_text(
fix_newline_at_end_of_file(exercise[file.split(".")[0]])
fix_newline_at_end_of_file(exercise[file.split(".")[0]]).replace(
"\r\n", "\n"
)
)
del exercise[file.split(".")[0]]
(path / "meta").write_text(json.dumps(exercise, indent=4))
......
This diff is collapsed.
......@@ -27,12 +27,10 @@ h2 {
span.good {
color: #28a745;
font-size: 2.5rem;
}
span.bad {
color: #cb2431;
font-size: 2.5rem;
}
a {
......
......@@ -7,10 +7,10 @@
<h1>Python exercises</h1>
<table class="table table-sm table-hover records_list">
<table class="table table-sm table-hover table-responsive">
<tbody>
{% for exercise in exercises %}
<tr class="d-flex" onclick="if (!event.ctrlKey){location.href='{% url "exercise" exercise.slug %}';}">
<tr onclick="if (!event.ctrlKey){location.href='{% url "exercise" exercise.slug %}';}">
<td scope="row" class="d-flex align-items-center">
{% if exercise.tried %}
{% if exercise.done %}
......@@ -22,11 +22,11 @@
</td>
<td>
<a href="{% url "exercise" exercise.slug %}">
<h5>{{ exercise.number }}. {{ exercise.title }}</h5>
<h5 style="display:inline">{{ exercise.number }}. {{ exercise.title }}</h5>
</a>
{{ exercise.lead }}
<br />
<i>{% trans "Solved by" %} {{ exercise.successes }} ({{ exercise.pct_tried|floatformat }}%)</i>
</td>
<td>
<i>{% blocktrans with nb=exercise.successes %}Solved by {{ nb }}{% endblocktrans %}</i>
</td>
</tr>
{% endfor %}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment