Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactoring the textbook nav #800

Merged
merged 1 commit into from
Oct 10, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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