Skip to content

Commit 078eec5

Browse files
authored
Merge pull request #637 from fmichonneau/add-transition
add new steps to transition lessons to Workbench
2 parents bd9f274 + e6aed98 commit 078eec5

File tree

6 files changed

+91
-10
lines changed

6 files changed

+91
-10
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{% assign date = include.need_transition_date %}
2+
3+
{% unless site.transition_url %}
4+
<div class="alert alert-danger">
5+
you need to specify the variable <code>transition_url</code>
6+
in <code>_config.yml</code>.
7+
</div>
8+
{% endunless %}
9+
10+
{% if date == "true" %}
11+
{% unless site.transition_date %}
12+
<div class="alert alert-danger">
13+
you need to specify the variable <code>transition_date</code>
14+
in <code>_config.yml</code>.
15+
</div>
16+
{% endunless %}
17+
{% endif %}

_includes/lesson_footer.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@
2828
{% endif %}
2929
</div>
3030
<div class="col-md-6 help-links" align="right">
31-
{% if page.source %}
32-
{% if page.source == "Rmd" %}
31+
{% if site.life_cycle contains 'transition-step' %}
32+
<a href="{{repo_url}}">Edit on GitHub</a>
33+
{% elsif page.source == "Rmd" %}
3334
<a href="{{repo_url}}/edit/{{ default_branch }}/{{page.path|replace: "_episodes", "_episodes_rmd" | replace: ".md", ".Rmd"}}" data-checker-ignore>Edit on GitHub</a>
34-
{% endif %}
3535
{% else %}
3636
<a href="{{repo_url}}/edit/{{ default_branch }}/{{page.path}}" data-checker-ignore>Edit on GitHub</a>
3737
{% endif %}

_includes/life_cycle.html

Lines changed: 46 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,52 @@
2828
{% elsif site.life_cycle == "stable" %}
2929

3030
{% comment %}
31-
We do not do anything special unless this is a Carpentries Lab lesson
31+
We do not do anything special for lessons in stable
32+
{% endcomment %}
33+
34+
35+
{% comment %}
36+
Below we cover the 3 phases of lesson transition towards the Carpentries Workbench:
37+
- transition-step-1 (`transition_url` variable needed): we indicate that there
38+
is a new version of the lesson that is available for testing, and that it will be deprecated in the future.
39+
- transition-step-2 (`transition_url` and `transition_date` variables needed): we indicate that a new version of the lesson is avaiable with a deprecation date.
40+
- transition-step-3 (`transition_url` variable needed): the lesson is fully deprecated, and a redirect is set up to the new URL
41+
{% endcomment %}
42+
43+
{% elsif site.life_cycle == "transition-step-1" %}
44+
{% include check_transition_variables.html need_transition_date = 'false' %}
45+
46+
<div class="alert alert-warning life-cycle">
47+
A newer version of this lesson is being tested on The Carpentries Workbench:
48+
<a href="{{ site.transition_url }}">{{ site.transition_url }}</a>.
49+
The Jekyll version of this lesson will become deprecated in the near future.
50+
</div>
51+
52+
{% elsif site.life_cycle == "transition-step-2" %}
53+
{% include check_transition_variables.html need_transition_date = 'true' %}
54+
55+
<div class="alert alert-danger life-cycle">
56+
A newer version of this lesson is available from:
57+
<a href="{{ site.transition_url }}">{{ site.transition_url }}</a>.
58+
The Jekyll version of this lesson will become deprecated on
59+
{{ site.transition_date }}.
60+
</div>
61+
62+
{% elsif site.life_cycle == "transition-step-3" %}
63+
{% include check_transition_variables.html need_transition_date = 'false' %}
64+
65+
<div class="alert alert-danger life-cycle">
66+
You are veiwing a deprecated version of this lesson. An updated version is
67+
available from:
68+
<a href="{{ site.transition_url }}">{{ site.transition_url }}</a>.
69+
</div>
70+
71+
{% endif %}
72+
73+
74+
75+
{% comment %}
76+
For Carpentries Lab lessons we add a banner about the review status
3277
{% endcomment %}
3378

3479
{% if site.carpentry == "lab" %}
@@ -43,4 +88,3 @@
4388
</div>
4489
</div>
4590
{% endif %}
46-
{% endif %}

_includes/navbar.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,12 +94,12 @@
9494

9595
{% comment %} Always show license. {% endcomment %}
9696
<li><a href="{{ relative_root_path }}{% link LICENSE.md %}">License</a></li>
97-
{% if page.source %}
98-
{% if page.source == "Rmd" %}
97+
{% if site.life_cycle contains 'transition-step' %}
98+
<li><a href="{{repo_url}}">Improve this page <span class="glyphicon glyphicon-pencil" aria-hidden="true"></span></a></li>
99+
{% elsif page.source == "Rmd" %}
99100
<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>
100-
{% endif %}
101101
{% else %}
102-
<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>
102+
<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>
103103
{% endif %}
104104
</ul>
105105
<form class="navbar-form navbar-right" role="search" id="search" onsubmit="google_search(); return false;">

_layouts/base.html

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@
2323

2424
{% include favicons.html %}
2525

26+
{% if site.life_cycle == 'transition-step-3' %}
27+
<meta http-equiv="refresh" content="0; url={{ site.transition_url }}" />
28+
{% endif %}
29+
2630
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
2731
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
2832
<!--[if lt IE 9]>
@@ -32,7 +36,7 @@
3236

3337
<title>
3438
{% if page.title %}{{ page.title }}{% endif %}{% if page.title and site.title %} &ndash; {% endif %}{% if site.title %}{{ site.title }}{% endif %}
35-
</title>
39+
</title>
3640

3741
</head>
3842
<body>

bin/boilerplate/_config.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,24 @@ title: "Lesson Title"
1616
# Life cycle stage of the lesson
1717
# See this page for more details: https://cdh.carpentries.org/the-lesson-life-cycle.html
1818
# Possible values: "pre-alpha", "alpha", "beta", "stable"
19+
#
20+
# Lessons that are going through the transition to the
21+
# Carpentries Workbench will go through 3 steps:
22+
# 'transition-step-1': notice indicating a new version
23+
# 'transition-step-2': notice encouraging to use new version
24+
# 'transition-step-3': notice indicating the lesson is deprecated,
25+
# with automated redirect
1926
life_cycle: "pre-alpha"
2027

28+
# For lessons in the life stages in 'transition-step-1' or later:
29+
# - 'transition_url' holds the URL for the version of the lesson that
30+
# uses the Workbench (needed for all 3 steps)
31+
# - 'transition_date' (in yyyy-mm-dd format) is the date when the lesson
32+
# will transition to being deprecated. The date only needs to be decided
33+
# when the lesson is in 'transition-step-2'.
34+
transition_url:
35+
transition_date:
36+
2137
#------------------------------------------------------------
2238
# Generic settings (should not need to change).
2339
#------------------------------------------------------------

0 commit comments

Comments
 (0)