Skip to content

Commit

Permalink
Set all tokens and translation links needed by lesson layout
Browse files Browse the repository at this point in the history
  • Loading branch information
dpshelio committed Aug 8, 2019
1 parent 7953c24 commit edce5ff
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 11 deletions.
2 changes: 1 addition & 1 deletion _includes/main_title.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@

{% include base_path.html %}

<h1 class="maintitle"><a href="{{ relative_root_path }}{% link index.md %}">{{ site.title }}</a>{% if page.title %}: {{ page.title }}{% endif %}</h1>
<h1 class="maintitle"><a href="{{ page.root }}{% link index.md %}">{{ site.title }}</a>{% if page.title %}{% unless page.path contains 'index' %}: {{ page.title }}{% endunless %}{% endif %}</h1>
18 changes: 9 additions & 9 deletions _includes/syllabus.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
Days are displayed if at least one episode has 'start = true'.
{% endcomment %}
<div class="syllabus">
<h2 id="schedule">Schedule</h2>
<h2 id="schedule"> {{ include.language.schedule }}</h2>

{% assign lesson_number = 0 %}
{% assign day = 0 %}
{% assign multiday = false %}
{% for episode in site.episodes %}
{% for episode in include.episodes %}
{% if episode.start %}{% assign multiday = true %}{% break %}{% endif %}
{% endfor %}
{% assign current = site.start_time %}
Expand All @@ -19,10 +19,10 @@ <h2 id="schedule">Schedule</h2>
<tr>
{% if multiday %}<td class="col-md-1"></td>{% endif %}
<td class="{% if multiday %}col-md-1{% else %}col-md-2{% endif %}"></td>
<td class="col-md-3"><a href="{{ relative_root_path }}{% link setup.md %}">Setup</a></td>
<td class="col-md-7">Download files required for the lesson</td>
<td class="col-md-3"><a href="{{ page.root }}{% link setup.md %}">{{ include.language.setup }}</a></td>
<td class="col-md-7">{{ include.language.downloadLesson }}</td>
</tr>
{% for episode in site.episodes %}
{% for episode in include.episodes %}
{% if episode.start %} {% comment %} Starting a new day? {% endcomment %}
{% assign day = day | plus: 1 %}
{% if day > 1 %} {% comment %} If about to start day 2 or later, show finishing time for previous day {% endcomment %}
Expand All @@ -31,7 +31,7 @@ <h2 id="schedule">Schedule</h2>
<tr>
{% if multiday %}<td class="col-md-1"></td>{% endif %}
<td class="{% if multiday %}col-md-1{% else %}col-md-2{% endif %}">{% if hours < 10 %}0{% endif %}{{ hours }}:{% if minutes < 10 %}0{% endif %}{{ minutes }}</td>
<td class="col-md-3">Finish</td>
<td class="col-md-3">{{ include.language.finish }}</td>
<td class="col-md-7"></td>
</tr>
{% endif %}
Expand All @@ -48,7 +48,7 @@ <h2 id="schedule">Schedule</h2>
</td>
<td class="col-md-7">
{% if episode.break %}
Break
{{ include.language.break }}
{% else %}
{% if episode.questions %}
{% for question in episode.questions %}
Expand All @@ -68,13 +68,13 @@ <h2 id="schedule">Schedule</h2>
<tr>
{% if multiday %}<td class="col-md-1"></td>{% endif %}
<td class="{% if multiday %}col-md-1{% else %}col-md-2{% endif %}">{% if hours < 10 %}0{% endif %}{{ hours }}:{% if minutes < 10 %}0{% endif %}{{ minutes }}</td>
<td class="col-md-3">Finish</td>
<td class="col-md-3">{{ include.language.finish }}</td>
<td class="col-md-7"></td>
</tr>
</table>

<p>
The actual schedule may vary slightly depending on the topics and exercises chosen by the instructor.
{{ include.language.scheduleDisclaimer }}
</p>

</div>
17 changes: 16 additions & 1 deletion _layouts/lesson.html
Original file line number Diff line number Diff line change
@@ -1,8 +1,23 @@
---
layout: base
---
{% comment %}
In which language is the current page? Guess from the path: locale="/<lang>/".
Load language tockens for menus {{ data_language }}. Translations need to provide a lang.md file that translates what's under _data/language.yaml
Generate list of episodes and extras for the language shown. - NOTE: _extras need in the permlinks /<language>/page!!
{% endcomment %}
{% if page.path contains "_locale" %}
{% assign locale = page.path | remove: "_locale/" | split: "/" | first | downcase %}
{% assign pathLocale = locale | append: '/' | prepend: '/' %}
{% assign episodes = site.locale | where_exp:"item", "item.path contains pathLocale" | where_exp:"item", "item.path contains 'episode'" | sort: "path" %}
{% else %}
{% assign locale = "en" %}
{% assign episodes = site.episodes %}
{% endif %}
{% assign lang_file = locale | append: '.md' %}
{% assign data_language = site.pages | where_exp:"page", "page.path contains 'i18n'" | where_exp:"page", "page.path contains lang_file" | first %}
{% include main_title.html %}
<article>
{{ content }}
</article>
{% include syllabus.html %}
{% include syllabus.html language=data_language episodes=episodes %}

0 comments on commit edce5ff

Please sign in to comment.