From 37404b3d9e326fd084d30780e2817c5b7873eaa8 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Fran=C3=A7ois=20Michonneau?= Date: Tue, 21 Aug 2018 09:45:12 -0400 Subject: [PATCH] add lesson life cycle stage indicator --- _includes/life_cycle.html | 34 ++++++++++++++++++++++++++++++++++ _layouts/base.html | 3 +++ assets/css/lesson.scss | 31 +++++++++++++++++++++++++++++++ assets/js/lesson.js | 28 ++++++++++++++++++++++++++++ bin/boilerplate/_config.yml | 4 ++++ 5 files changed, 100 insertions(+) create mode 100644 _includes/life_cycle.html diff --git a/_includes/life_cycle.html b/_includes/life_cycle.html new file mode 100644 index 0000000..efc5b6d --- /dev/null +++ b/_includes/life_cycle.html @@ -0,0 +1,34 @@ + +{% if site.life_cycle == "pre-alpha" %} + +
+
+ This lesson is still being designed and assembled (Pre-Alpha version) +
+
+ + +{% elsif site.life_cycle == "alpha" %} + +
+
+ This lesson is in the early stages of development (Alpha version) +
+
+ + +{% elsif site.life_cycle == "beta" %} + +
+
+ This lesson is being piloted (Beta version) +
+
+ +{% elsif site.life_cycle == "stable" %} + +{% comment %} +We don't do anything special for now +{% endcomment %} + +{% endif %} diff --git a/_layouts/base.html b/_layouts/base.html index 8a2e4b5..d8fefd6 100644 --- a/_layouts/base.html +++ b/_layouts/base.html @@ -41,6 +41,9 @@ GitHub where `site.github.url` will be defined. {{ site.title }}{% if page.title %}: {{ page.title }}{% endif %} + + {% include life_cycle.html %} +
{% include navbar.html %} {{ content }} diff --git a/assets/css/lesson.scss b/assets/css/lesson.scss index d5662e0..f83365e 100644 --- a/assets/css/lesson.scss +++ b/assets/css/lesson.scss @@ -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. //---------------------------------------- diff --git a/assets/js/lesson.js b/assets/js/lesson.js index 185da92..333dee8 100644 --- a/assets/js/lesson.js +++ b/assets/js/lesson.js @@ -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); + } + } +}); diff --git a/bin/boilerplate/_config.yml b/bin/boilerplate/_config.yml index 5d6beb1..3c3f4f2 100644 --- a/bin/boilerplate/_config.yml +++ b/bin/boilerplate/_config.yml @@ -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). #------------------------------------------------------------ -- 2.30.2