Skip to content

Commit

Permalink
add lesson life cycle stage indicator
Browse files Browse the repository at this point in the history
  • Loading branch information
fmichonneau committed Aug 21, 2018
1 parent 5e4ca8b commit 37404b3
Show file tree
Hide file tree
Showing 5 changed files with 100 additions and 0 deletions.
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 %}
3 changes: 3 additions & 0 deletions _layouts/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@
<title>{{ site.title }}{% if page.title %}: {{ page.title }}{% endif %}</title>
</head>
<body>

{% include life_cycle.html %}

<div class="container">
{% include navbar.html %}
{{ content }}
Expand Down
31 changes: 31 additions & 0 deletions assets/css/lesson.scss
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,37 @@ span.fold-unfold {
}


//----------------------------------------
// Life cycle box
//----------------------------------------

div.life-cycle {
position: -webkit-sticky; /* Safari */
position: sticky;
top: 0;
z-index: 100;
font-size: 1.2em;
text-align: center;
margin-bottom: -1px;
border-radius: 0;
}

.pre-alpha {
color: #a94442;
background: #f2dede;
}

.alpha {
color: #8a6d3b;
background: #fcf8e3;
}

.beta {
color: #31708f;
background: #d9edf7;
}


//----------------------------------------
// keyboard key style, from StackExchange.
//----------------------------------------
Expand Down
28 changes: 28 additions & 0 deletions assets/js/lesson.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,31 @@ function google_search() {
var domain = $("meta[name=search-domain]").attr("value");
window.open("https://www.google.com/search?q=" + query + "+site:" + domain);
}

// function to shrink the life cycle bar when scrolling
$(function(){
$('#life-cycle').data('size','big');
});

$(window).scroll(function(){
if($(document).scrollTop() > 0)
{
if($('#life-cycle').data('size') == 'big')
{
$('#life-cycle').data('size','small');
$('#life-cycle').stop().animate({
padding: '5px'
},100);
}
}
else
{
if($('#life-cycle').data('size') == 'small')
{
$('#life-cycle').data('size','big');
$('#life-cycle').stop().animate({
padding: '15px'
},100);
}
}
});
4 changes: 4 additions & 0 deletions bin/boilerplate/_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ carpentry: "swc"
# Overall title for pages.
title: "Lesson Title"

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

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

0 comments on commit 37404b3

Please sign in to comment.