Skip to content

Commit

Permalink
refactorig the textbook nav (#800)
Browse files Browse the repository at this point in the history
  • Loading branch information
Leah Wasser authored Oct 10, 2019
1 parent c2a7c98 commit 2d38e9e
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions _includes/sidebar_class_navigation_week.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
{% assign classes = weeks | where:"module-type", 'class' %}
{% assign homework = weeks | where:"module-type", 'homework' %}

<h5><a href="{{ site.url }}/courses/{{ page.course | slugify }}/" ><i class="fa fa-home" aria-hidden="true"></i> {{ page.course | capitalize }} Home</a></h5>
<h5><a href="{{ site.url }}/courses/{{ page.course | slugify }}/" ><i class="fa fa-home" aria-hidden="true"></i> {{ page.course | replace: '-', ' ' | capitalize }}</a></h5>

<!-- Just get the pages from this course -->

Expand All @@ -47,17 +47,17 @@ <h5><a href="{{ site.url }}/courses/{{ page.course | slugify }}/" ><i class="fa

<!-- Only list the week if it's not the week for the current landing page -->
{% if post.week != page.week %}
<li> <a href="{{ site.url }}{{ post.permalink }}"> <!--<i class="fa fa-folder-o" aria-hidden="true"></i>-->
{% if post.nav-title %}{{ post.week }}. {{ post.nav-title }} {% else %} {{ post.week }}. {{ post.title }}{% endif %}</a>
<li> <b>SECTION {{ post.week }} <a href="{{ site.url }}{{ post.permalink }}"> <!--<i class="fa fa-folder-o" aria-hidden="true"></i>-->
{% if post.nav-title %}{{ post.nav-title | upcase }} {% else %} {{ post.title | upcase }}{% endif %}</a></b>
</li>

<!-- list the chapters for each section -->
<!-- list the chapters for each section updating this to show a chapter number if it's a textbook-->
{% assign sorted_chapters = chapters | sort:"class-order" %}
<ul>
{% for chapter in sorted_chapters %}
{% if chapter.week == post.week %}
<li>
<a href="{{ site.url }}{{ chapter.permalink }}">{{ post.week }}.{{ chapter.class-order }} {{ chapter.module-nav-title }} </a>
<a href="{{ site.url }}{{ chapter.permalink }}"> {% if chapter.chapter %}Chapter {{ chapter.chapter }}: {% else %}{{ post.week }}.{{ chapter.class-order }} {% endif %} {{ chapter.module-nav-title }} </a>
</li>
{% endif %}
{% endfor %}
Expand All @@ -66,13 +66,15 @@ <h5><a href="{{ site.url }}/courses/{{ page.course | slugify }}/" ><i class="fa

{% endif %}

<!-- This is for the activate section in the nav which is grey -->

{% if post.week == page.week %}
{% if post.url == page.url %}
<li> <a href="{{ site.url }}{{ post.permalink }}" class='active'> <!--<i class="fa fa-folder-open" aria-hidden="true"></i> -->
{% if post.nav-title %}{{ post.week }}. {{ post.nav-title | upcase }} {% else %} {{ post.week }}. {{ post.title | upcase }}{% endif %}</a></li>
{% else %}
<li> <a href="{{ site.url }}{{ post.permalink }}" class='active'> SECTION {{ post.week }}<br><!--<i class="fa fa-folder-open" aria-hidden="true"></i> -->
{% if post.nav-title %} {{ post.nav-title | upcase }} {% else %} {{ post.title | upcase }}{% endif %}</a></li>
{% else %}
<li class='active-section'> <a href="{{ site.url }}{{ post.permalink }}"><i class="fa fa-folder-open" aria-hidden="true"></i>
{% if post.nav-title %}{{ post.week }}. {{ post.nav-title | upcase }} {% else %} {{ post.week }}. {{ post.title | upcase }}{% endif %}</a></li>
{% if post.nav-title %}{{ post.chapter }} {{ post.week }}. {{ post.nav-title | upcase }} {% else %} {{ post.week }}. {{ post.title | upcase }}{% endif %}</a></li>

{% endif %}

Expand All @@ -88,7 +90,9 @@ <h5><a href="{{ site.url }}/courses/{{ page.course | slugify }}/" ><i class="fa

{% assign theLesson = module.class-lesson %}
{% assign class_lessons = weeks | where:"class-lesson", theLesson %}
<li><span class="nav__sub-title grey"><i class="fa fa-caret-down" aria-hidden="true"></i>{{ module.week }}.{{ module.class-order }} {{ module.module-nav-title | capitalize }} </span></li>
<!-- If it's a textbook with a chapter number write "chapter", else assume it is a week -->

<li><span class="nav__sub-title grey"><i class="fa fa-caret-down" aria-hidden="true"></i> {% if module.chapter %} Chapter {{ module.chapter }} {{ module.module-nav-title | capitalize }} {% else %} {{ module.week }}.{{ module.class-order }} {{ module.module-nav-title | capitalize }} {% endif %} </span></li>
<ul>

{% assign class_lessons = weeks | where:"class-lesson", theLesson %}
Expand Down

0 comments on commit 2d38e9e

Please sign in to comment.