Mark levels done in local storage

This commit is contained in:
Samy Pessé
2014-03-31 19:41:27 -07:00
parent 77136705fc
commit 642a338cb0
6 changed files with 17 additions and 6 deletions
+3
View File
@@ -41,5 +41,8 @@ require([
editor.setValue(codeSolution);
});
});
// Show progress
progress.show();
});
});
+3 -1
View File
@@ -12,7 +12,7 @@ define([
var getLevels = function() {
var levels = $(".book-summary li[data-level]");
return _.map(levels, function(level) {
return $(level).data("level");
return $(level).data("level").toString();
});
};
@@ -37,6 +37,8 @@ define([
var progress = getProgress();
progress[level] = state? Date.now() : 0;
storage.set("progress", progress);
};
// Show progress
+1 -1
View File
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+6
View File
@@ -28,6 +28,12 @@
overflow: hidden;
background: #35393b;
}
&.done {
> a {
color: green;
}
}
a {
display: block;
+3 -3
View File
@@ -1,6 +1,6 @@
<div class="book-summary">
<ul class="summary">
<li>
<li data-level="0">
<a href="{{ basePath }}/README.html">Introduction</a>
</li>
<li>
@@ -8,12 +8,12 @@
</li>
<li class="divider"></li>
{% for item in summary.chapters %}
<li {% if item._path == _input %}class="active"{% endif %}>
<li {% if item._path == _input %}class="active"{% endif %} data-level="{{ item.level }}">
<a href="{{ basePath }}/{{ item.path }}">{{ item.title }}</a>
{% if item.articles.length > 0 %}
<ul class="articles">
{% for article in item.articles %}
<li {% if article._path == _input %}class="active"{% endif %}>
<li {% if article._path == _input %}class="active"{% endif %} data-level="{{ article.level }}">
<a href="{{ basePath }}/{{ article.path }}">{{ article.title }}</a>
</li>
{% endfor %}