Skip to content

Commit

Permalink
Set all tokens and translation links needed by episode layout
Browse files Browse the repository at this point in the history
  • Loading branch information
dpshelio committed Aug 8, 2019
1 parent edce5ff commit 4659b2f
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 14 deletions.
2 changes: 1 addition & 1 deletion _includes/episode_keypoints.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Display key points for an episode.
{% endcomment %}
<blockquote class="keypoints">
<h2>Key Points</h2>
<h2>{{ include.language.keypoints }}</h2>
<ul>
{% for keypoint in page.keypoints %}
<li>{{ keypoint|markdownify }}</li>
Expand Down
8 changes: 4 additions & 4 deletions _includes/episode_navbar.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
<div class="col-xs-1">
<h3 class="text-left">
{% if page.previous.url %}
<a href="{{ relative_root_path }}{{ page.previous.url }}"><span class="glyphicon glyphicon-menu-left" aria-hidden="true"></span><span class="sr-only">previous episode</span></a>
<a href="{{ page.root }}{{ page.previous.url }}"><span class="glyphicon glyphicon-menu-left" aria-hidden="true"></span><span class="sr-only">{{ include.language.previous }} {{ include.language.episode }}</span></a>
{% else %}
<a href="{{ relative_root_path }}/"><span class="glyphicon glyphicon-menu-up" aria-hidden="true"></span><span class="sr-only">lesson home</span></a>
<a href="{{ page.root }}/"><span class="glyphicon glyphicon-menu-up" aria-hidden="true"></span><span class="sr-only">{{ include.language.lessonHome }}</span></a>
{% endif %}
</h3>
</div>
Expand All @@ -27,9 +27,9 @@ <h3 class="maintitle"><a href="{{ relative_root_path }}/">{{ site.title }}</a></
<div class="col-xs-1">
<h3 class="text-right">
{% if page.next.url %}
<a href="{{ relative_root_path }}{{ page.next.url }}"><span class="glyphicon glyphicon-menu-right" aria-hidden="true"></span><span class="sr-only">next episode</span></a>
<a href="{{ page.root }}{{ page.next.url }}"><span class="glyphicon glyphicon-menu-right" aria-hidden="true"></span><span class="sr-only">{{ include.language.next }} {{ include.language.episode }}</span></a>
{% else %}
<a href="{{ relative_root_path }}/"><span class="glyphicon glyphicon-menu-up" aria-hidden="true"></span><span class="sr-only">lesson home</span></a>
<a href="{{ page.root }}/"><span class="glyphicon glyphicon-menu-up" aria-hidden="true"></span><span class="sr-only">{{ include.language.lessonHome }}</span></a>
{% endif %}
</h3>
</div>
Expand Down
10 changes: 5 additions & 5 deletions _includes/episode_overview.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@
Display an episode's timings and learning objectives.
{% endcomment %}
<blockquote class="objectives">
<h2>Overview</h2>
<h2>{{ include.language.overview }}</h2>

<div class="row">
<div class="col-md-3">
<strong>Teaching:</strong> {{ page.teaching }} min
<strong>{{ include.language.teaching }}:</strong> {{ page.teaching }} {{ include.language.min }}
<br/>
<strong>Exercises:</strong> {{ page.exercises }} min
<strong>{{ include.language.exercises }}:</strong> {{ page.exercises }} {{ include.language.min }}
</div>
<div class="col-md-9">
<strong>Questions</strong>
<strong>{{ include.language.questions }}</strong>
<ul>
{% for question in page.questions %}
<li>{{ question|markdownify }}</li>
Expand All @@ -24,7 +24,7 @@ <h2>Overview</h2>
<div class="col-md-3">
</div>
<div class="col-md-9">
<strong>Objectives</strong>
<strong>{{ include.language.objectives }}</strong>
<ul>
{% for objective in page.objectives %}
<li>{{ objective|markdownify }}</li>
Expand Down
21 changes: 17 additions & 4 deletions _layouts/episode.html
Original file line number Diff line number Diff line change
@@ -1,11 +1,24 @@
---
layout: base
---
{% include episode_navbar.html episode_navbar_title=true %}
{% 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 %}
{% else %}
{% assign locale = "en" %}
{% 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 %}
{% comment %} Start of page {% endcomment %}
{% include episode_navbar.html episode_navbar_title=true language=data_language %}
<article>
{% include episode_title.html %}
{% include episode_overview.html %}
{% include episode_overview.html language=data_language %}
{{content}}
{% include episode_keypoints.html %}
{% include episode_keypoints.html language=data_language %}
</article>
{% include episode_navbar.html episode_navbar_title=false %}
{% include episode_navbar.html episode_navbar_title=false language=data_language %}

0 comments on commit 4659b2f

Please sign in to comment.