add lesson life cycle stage indicator
authorFrançois Michonneau <francois.michonneau@gmail.com>
Tue, 21 Aug 2018 13:45:12 +0000 (09:45 -0400)
committerFrançois Michonneau <francois.michonneau@gmail.com>
Tue, 21 Aug 2018 13:48:42 +0000 (09:48 -0400)
_includes/life_cycle.html [new file with mode: 0644]
_layouts/base.html
assets/css/lesson.scss
assets/js/lesson.js
bin/boilerplate/_config.yml

diff --git a/_includes/life_cycle.html b/_includes/life_cycle.html
new file mode 100644 (file)
index 0000000..efc5b6d
--- /dev/null
@@ -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 %}
index 8a2e4b5134a8857d377f6bd7c2e7bc3a2cfaf119..d8fefd6b1c93db26d5283550659beac2c7eba053 100644 (file)
@@ -41,6 +41,9 @@ GitHub where `site.github.url` will be defined.
     <title>{{ site.title }}{% if page.title %}: {{ page.title }}{% endif %}</title>
   </head>
   <body>
+
+    {% include life_cycle.html %}
+
     <div class="container">
       {% include navbar.html %}
 {{ content }}
index d5662e065bfaf5580423c89ad5955d469d2d42ed..f83365e6ac11c43eb67345a127da181243ac0ef6 100644 (file)
@@ -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.
 //----------------------------------------
index 185da920220429f734256180b9d7baf41323d45e..333dee8c1b5508234a98cbdee40eae4532097d73 100644 (file)
@@ -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);
+        }
+    }
+});
index 5d6beb1d08c38eac79cb22a30237421c89164fff..3c3f4f2d8973dad9984130587de7634333e6b1e8 100644 (file)
@@ -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).
 #------------------------------------------------------------