Skip to content

Commit

Permalink
Styling workshops correctly.
Browse files Browse the repository at this point in the history
1.  Use site.root for root path if set, otherwise use site.github.url.
2.  Display extra files for workshop-template repo as well as for lessons.
  • Loading branch information
Greg Wilson committed Jun 26, 2016
1 parent 519cd35 commit e0f4c7a
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 20 deletions.
15 changes: 12 additions & 3 deletions _includes/javascript.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
<script src="{{ site.root }}/assets/js/jquery.min.js"></script>
<script src="{{ site.root }}/assets/js/bootstrap.min.js"></script>
<script src="{{ site.root }}/assets/js/lesson.js"></script>
{% comment %}
If previewing locally, site.root is set in _config_dev.yml.
If site.root is not set, assume we're viewing on the web.
{% endcomment %}
{% if site.root %}
{% assign root = site.root %}
{% else %}
{% assign root = site.github.url %}
{% endif %}
<script src="{{ root }}/assets/js/jquery.min.js"></script>
<script src="{{ root }}/assets/js/bootstrap.min.js"></script>
<script src="{{ root }}/assets/js/lesson.js"></script>
52 changes: 38 additions & 14 deletions _includes/navbar.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
{% comment %}
If previewing locally, site.root is set in _config_dev.yml.
If site.root is not set, assume we're viewing on the web.
{% endcomment %}
{% if site.root %}
{% assign root = site.root %}
{% else %}
{% assign root = site.github.url %}
{% endif %}
<nav class="navbar navbar-default">
<div class="container-fluid">
<div class="navbar-header">
Expand All @@ -7,49 +16,64 @@
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>

{% comment %} Select what logo to display. {% endcomment %}
{% if page.carpentry == "swc" %}
<a href="{{ site.swc_site }}" class="pull-left">
<img class="navbar-logo" src="{{ site.root }}/assets/img/swc-icon-blue.svg" alt="Software Carpentry logo" />
<img class="navbar-logo" src="{{ root }}/assets/img/swc-icon-blue.svg" alt="Software Carpentry logo" />
</a>
{% elsif page.carpentry == "dc" %}
<a href="{{ site.dc_site }}" class="pull-left">
<img class="navbar-logo" src="{{ site.root }}/assets/img/dc-icon-black.svg" alt="Data Carpentry logo" />
<img class="navbar-logo" src="{{ root }}/assets/img/dc-icon-black.svg" alt="Data Carpentry logo" />
</a>
{% elsif site.carpentry == "swc" %}
<a href="{{ site.swc_site }}" class="pull-left">
<img class="navbar-logo" src="{{ site.root }}/assets/img/swc-icon-blue.svg" alt="Software Carpentry logo" />
<img class="navbar-logo" src="{{ root }}/assets/img/swc-icon-blue.svg" alt="Software Carpentry logo" />
</a>
{% elsif site.carpentry == "dc" %}
<a href="{{ site.dc_site }}" class="pull-left">
<img class="navbar-logo" src="{{ site.root }}/assets/img/dc-icon-black.svg" alt="Data Carpentry logo" />
<img class="navbar-logo" src="{{ root }}/assets/img/dc-icon-black.svg" alt="Data Carpentry logo" />
</a>
{% endif %}
<a class="navbar-brand" href="{{ site.root }}/">Home</a>

{% comment %} Always show link to home page. {% endcomment %}
<a class="navbar-brand" href="{{ root }}/">Home</a>

</div>
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav">
<li><a href="{{ site.root }}/conduct/">Code of Conduct</a></li>

{% comment %} Always show code of conduct. {% endcomment %}
<li><a href="{{ root }}/conduct/">Code of Conduct</a></li>

{% comment %} Show setup instructions, reference guide, and lesson episodes for lessons. {% endcomment %}
{% if site.kind == "lesson" %}
<li><a href="{{ site.root }}/setup/">Setup</a></li>
<li><a href="{{ root }}/setup/">Setup</a></li>
<li><a href="{{ root }}/reference/">Reference</a></li>
<li class="dropdown">
<a href="{{ site.root }}/" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Episodes <span class="caret"></span></a>
<a href="{{ root }}/" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Episodes <span class="caret"></span></a>
<ul class="dropdown-menu">
{% for episode in site.episodes %}
<li><a href="{{ site.root }}{{ episode.url }}">{{ episode.title }}</a></li>
<li><a href="{{ root }}{{ episode.url }}">{{ episode.title }}</a></li>
{% endfor %}
</ul>
</li>
{% endif %}

{% comment %} Show extras for lessons or if this is the main workshop-template repo (where they contain documentation). {% endcomment %}
{% if site.kind == "lesson" or site.repository_name == "workshop-template" %}
<li class="dropdown">
<a href="{{ site.root }}/" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Extras <span class="caret"></span></a>
<a href="{{ root }}/" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Extras <span class="caret"></span></a>
<ul class="dropdown-menu">
{% for extra in site.extras %}
<li><a href="{{ site.root }}{{ extra.url }}">{{ extra.title }}</a></li>
<li><a href="{{ root }}{{ extra.url }}">{{ extra.title }}</a></li>
{% endfor %}
</ul>
</li>
<li><a href="{{ site.root }}/reference/">Reference</a></li>
{% endif %}
<li><a href="{{ site.root }}/license/">License</a></li>
{% endif %}

{% comment %} Always show license. {% endcomment %}
<li><a href="{{ root }}/license/">License</a></li>
</ul>
<form class="navbar-form navbar-right" role="search" id="search" onsubmit="google_search(); return false;">
<div class="form-group">
Expand Down
15 changes: 12 additions & 3 deletions _layouts/workshop.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
---
---
{% comment %}
If previewing locally, site.root is set in _config_dev.yml.
If site.root is not set, assume we're viewing on the web.
{% endcomment %}
{% if site.root %}
{% assign root = site.root %}
{% else %}
{% assign root = site.github.url %}
{% endif %}
<!doctype html>
<html lang="en">
<head>
Expand All @@ -25,9 +34,9 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta http-equiv="last-modified" content="{{ site.time }}">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" type="text/css" href="{{ site.root }}/assets/css/bootstrap.css" />
<link rel="stylesheet" type="text/css" href="{{ site.root }}/assets/css/bootstrap-theme.css" />
<link rel="stylesheet" type="text/css" href="{{ site.root }}/assets/css/lesson.css" />
<link rel="stylesheet" type="text/css" href="{{ root }}/assets/css/bootstrap.css" />
<link rel="stylesheet" type="text/css" href="{{ root }}/assets/css/bootstrap-theme.css" />
<link rel="stylesheet" type="text/css" href="{{ root }}/assets/css/lesson.css" />
{% if site.carpentry == "swc" %}
<link rel="shortcut icon" type="image/x-icon" href="/favicon-swc.ico" />
{% endif %}
Expand Down

0 comments on commit e0f4c7a

Please sign in to comment.