Skip to content

Commit

Permalink
site scafolding
Browse files Browse the repository at this point in the history
  • Loading branch information
lpaglione committed Jul 25, 2019
1 parent 6364238 commit 95ad29f
Show file tree
Hide file tree
Showing 9 changed files with 431 additions and 1 deletion.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
![COmanage Logo](https://registry-test.cilogon.org/registry/img/COmanage-Logo-LG-onWhite.png)
![COmanage Logo](assets/registry/img/COmanage-Logo-LG-onWhite.png)

CO301: Modeling Your Collaboration
==================================
Expand Down
81 changes: 81 additions & 0 deletions _config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
#------------------------------------------------------------
# The structure of this site including this file was adapted
# from The Carpentries, who should receive attribution and
# credit for these configurations. They are covered by a
# Creative Commons Attribution license
# https://creativecommons.org/licenses/by/4.0/
#------------------------------------------------------------


#------------------------------------------------------------
# Values for this lesson.
#------------------------------------------------------------

# Overall title for pages.
title: "COmanage Training"

# Life cycle stage of the lesson
# possible values: "pre-alpha", "alpha", "beta", "stable"
life_cycle: "alpha"

#------------------------------------------------------------
# Generic settings (should not need to change).
#------------------------------------------------------------

# What kind of thing is this ("workshop" or "lesson")?
kind: "lesson"

# Magic to make URLs resolve both locally and on GitHub.
# See https://help.github.com/articles/repository-metadata-on-github-pages/.
# Please don't change it: <USERNAME>/<PROJECT> is correct.
repository: <USERNAME>/<PROJECT>

# Email address, no mailto:
email: "checkout@carpentries.org"

# Sites.
carpentries_site: "https://carpentries.org/"

# Surveys.
pre_survey: ""
post_survey: ""

# Start time in minutes (0 to be clock-independent, 540 to show a start at 09:00 am)
start_time: 540

# Specify that things in the episodes collection should be output.
collections:
episodes:
output: true
permalink: /:path/index.html
extras:
output: true
permalink: /:path/index.html

# Set the default layout for things in the episodes collection.
defaults:
- values:
root: .
layout: page
- scope:
path: ""
type: episodes
values:
root: ..
layout: episode
- scope:
path: ""
type: extras
values:
root: ..
layout: page

# Files and directories that are not to be copied.
exclude:
- Makefile
- bin/

# Turn on built-in syntax highlighting.
highlighter: rouge

plugins: [jekyll-redirect-from]
27 changes: 27 additions & 0 deletions _includes/base_path.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{% comment %}
This is adapted from: https://ricostacruz.com/til/relative-paths-in-jekyll

`page.url` gives the URL of the current page with a leading /:

- when the URL ends with the extension (e.g., /foo/bar.html) then we can get
the depth by counting the number of / and remove - 1
- when the URL ends with a / (e.g. /foo/bar/) then the number / gives the depth
directly
{% endcomment %}

{% assign relative_root_path = '' %}

{% assign last_char = page.url | slice: -1 %}

{% if last_char == "/"}
{% assign offset = 0 %}
{% else %}
{% assign offset = 1 %}
{% endif %}

{% assign depth = page.url | split: '/' | size | minus: offset %}
{% if depth <= 1 %}{% assign relative_root_path = '.' %}
{% elsif depth == 2 %}{% assign relative_root_path = '..' %}
{% elsif depth == 3 %}{% assign relative_root_path = '../..' %}
{% elsif depth == 4 %}{% assign relative_root_path = '../../..' %}
{% endif %}
45 changes: 45 additions & 0 deletions _includes/gh_variables.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{% comment %}
When rendering websites locally, `site.github.url` doesn't get resolved properly
unless a GitHub Personal Access Token is set up and available in the
environment. This leads to warnings and errors when trying to serve the site
locally. To work around this, we use the `jekyll.environment` variable which is
set to `development` when rendering the site locally, and set to `production` on
GitHub where `site.github.url` is defined.
{% endcomment %}

{% if jekyll.environment == "production" %}

{% comment %}
First, get the name of the repository
{% endcomment %}
{% assign repo_name = site.github.repository_name %}

{% comment %}
`site.github.public_repositories` contains comprehensive information for all public repositories for the organization. We use `where` to extract the part
of the metadata that is relevant to the present repository.
{% endcomment %}
{% assign repo_info = site.github.public_repositories | where: "name", repo_name %}

{% comment %}
Now, we can extract the default branch for the repo
{% endcomment %}
{% assign default_branch = repo_info[0].default_branch %}

{% comment %}
Other variables requested by the template
{% endcomment %}
{% assign repo_url = site.github.repository_url %}
{% assign search_domain_url = site.github.url %}
{% assign project_title = site.github.project_title %}
{% assign source_branch = site.github.source.branch %}

{% elsif jekyll.environment == "development" %}

{% assign repo_name = "" %}
{% assign repo_url = "" %}
{% assign default_branch = "" %}
{% assign search_domain_url = "" %}
{% assign project_title = "" %}
{% assign source_branch = "" %}

{% endif %}
34 changes: 34 additions & 0 deletions _includes/life_cycle.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@

{% if site.life_cycle == "pre-alpha" %}

<div class="panel panel-default life-cycle">
<div id="life-cycle" class="panel-body pre-alpha">
This lesson is still being designed and assembled (Pre-Alpha version)
</div>
</div>


{% elsif site.life_cycle == "alpha" %}

<div class="panel panel-default life-cycle">
<div id="life-cycle" class="panel-body alpha">
This lesson is in the early stages of development (Alpha version)
</div>
</div>


{% elsif site.life_cycle == "beta" %}

<div class="panel panel-default life-cycle">
<div id="life-cycle" class="panel-body beta">
This lesson is being piloted (Beta version)
</div>
</div>

{% elsif site.life_cycle == "stable" %}

{% comment %}
We don't do anything special for now
{% endcomment %}

{% endif %}
93 changes: 93 additions & 0 deletions _includes/navbar.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
{% comment %}
Lesson navigation bar.
{% endcomment %}

{% include gh_variables.html %}

<nav class="navbar navbar-default">
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>

{% comment %} Select what logo to display. {% endcomment %}
{% if site.carpentry == "swc" %}
<a href="{{ site.swc_site }}" class="pull-left">
<img class="navbar-logo" src="{{ relative_root_path }}{% link /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="{{ relative_root_path }}{% link /assets/img/dc-icon-black.svg %}" alt="Data Carpentry logo" />
</a>
{% elsif site.carpentry == "lc" %}
<a href="{{ site.lc_site }}" class="pull-left">
<img class="navbar-logo" src="{{ relative_root_path }}{% link /assets/img/lc-icon-black.svg %}" alt="Library Carpentry logo" />
</a>
{% elsif site.carpentry == "cp" %}
<a href="{{ site.carpentries_site }}" class="pull-left">
<img class="navbar-logo" src="{{ relative_root_path }}{% link /assets/img/cp-logo-blue.svg %}" alt="The Carpentries logo" />
</a>
{% endif %}

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

</div>
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav">

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

{% if site.kind == "lesson" %}
{% comment %} Show setup instructions. {% endcomment %}
<li><a href="{{ relative_root_path }}{% link setup.md %}">Setup</a></li>

{% comment %} Show lesson episodes for lessons. {% endcomment %}
<li class="dropdown">
<a href="{{ relative_root_path }}/" 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="{{ relative_root_path }}{{ episode.url }}">{{ episode.title }}</a></li>
{% endfor %}
<li role="separator" class="divider"></li>
<li><a href="{{ relative_root_path }}{% link aio.md %}">All in one page (Beta)</a></li>
</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" %}
<li class="dropdown">
<a href="{{ relative_root_path }}/" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Extras <span class="caret"></span></a>
<ul class="dropdown-menu">
<li><a href="{{ relative_root_path }}{% link reference.md %}">Reference</a></li>
{% for extra in site.extras %}
<li><a href="{{ relative_root_path }}{{ extra.url }}">{{ extra.title }}</a></li>
{% endfor %}
</ul>
</li>
{% endif %}

{% comment %} Always show license. {% endcomment %}
<li><a href="{{ relative_root_path }}{% link LICENSE.md %}">License</a></li>
{% if page.source %}
{% if page.source == "Rmd" %}
<li><a href="{{repo_url}}/edit/{{ default_branch }}/{{page.path|replace: "_episodes", "_episodes_rmd" | replace: ".md", ".Rmd"}}" data-checker-ignore>Improve this page <span class="glyphicon glyphicon-pencil" aria-hidden="true"></span></a></li>
{% endif %}
{% else %}
<li><a href="{{repo_url}}/edit/{{ default_branch}}/{{page.path}}" data-checker-ignore>Improve this page <span class="glyphicon glyphicon-pencil" aria-hidden="true"></span></a></li>
{% endif %}
</ul>
<form class="navbar-form navbar-right" role="search" id="search" onsubmit="google_search(); return false;">
<div class="form-group">
<input type="text" id="google-search" placeholder="Search..." aria-label="Google site search">
</div>
</form>
</div>
</div>
</nav>
94 changes: 94 additions & 0 deletions _includes/syllabus.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
{% include base_path.html %}

{% comment %}
Display syllabus in tabular form.
Days are displayed if at least one episode has 'start = true'.
{% endcomment %}
<div class="syllabus">
<h2 id="schedule">Sample Schedule</h2>

{% assign day = 0 %}
{% assign multiday = false %}
{% for episode in site.episodes %}
{% if episode.start %}{% assign multiday = true %}{% break %}{% endif %}
{% endfor %}
{% assign current = site.start_time %}

<table class="table table-striped">
<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>
</tr>
<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="{{ site.instructor_pre_survey }}{{ site.github.project_title }}">Pre-training survey</a></td>
<td class="col-md-7">Please fill out our pre-training survey before the start of the course.</td>
</tr>
{% for episode in site.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 %}
{% assign hours = current | divided_by: 60 %}
{% assign minutes = current | modulo: 60 %}
<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-7"></td>
</tr>
{% endif %}
{% assign current = site.start_time %} {% comment %}Re-set start time of this episode to general daily start time {% endcomment %}
{% endif %}
{% assign hours = current | divided_by: 60 %}
{% assign minutes = current | modulo: 60 %}
<tr>
{% if multiday %}<td class="col-md-1">{% if episode.start %}Day {{ day }}{% endif %}</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">
{% assign lesson_number = lesson_number | plus: 1 %}
{{ lesson_number }}. <a href="{{ relative_root_path }}{{ episode.url }}">{{ episode.title }}</a>
</td>
<td class="col-md-7">
{% if episode.break %}
Break
{% else %}
{% if episode.questions %}
{% for question in episode.questions %}
{{question|markdownify|strip_html}}
{% unless forloop.last %}
<br/>
{% endunless %}
{% endfor %}
{% endif %}
{% endif %}
</td>
</tr>
{% assign current = current | plus: episode.teaching | plus: episode.exercises | plus: episode.break %}
{% endfor %}
{% assign hours = current | divided_by: 60 %}
{% assign minutes = current | modulo: 60 %}
<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"><a href="{{ site.instructor_post_survey }}{{ site.github.project_title }}">Post-training survey</a></td>
<td class="col-md-7">Please fill out our pre-training survey before the start of the course.</td>
</tr>
{% assign current = current | plus: 15 %}
{% assign hours = current | divided_by: 60 %}
{% assign minutes = current | modulo: 60 %}
<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-7"></td>
</tr>
</table>

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

</div>
Loading

0 comments on commit 95ad29f

Please sign in to comment.