getting closer with the persisted checklists
This commit is contained in:
@ -23,6 +23,16 @@ $(document).ready(function() {
|
||||
|
||||
setCSRFToken($('meta[name="csrf-token"]').attr('content'));
|
||||
|
||||
$('.checklist-element').each(function() {
|
||||
if (!!$(this).attr('id')) {
|
||||
var checklistElementId = $('.checklist-element').attr('id');
|
||||
if(localStorage[checklistElementId]) {
|
||||
$(this).children('.step-text').addClass('italic');
|
||||
$(this).children('input').trigger('click');
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$('.start-challenge').on('click', function() {
|
||||
$(this).parent().remove();
|
||||
$('.challenge-content')
|
||||
@ -35,11 +45,18 @@ $(document).ready(function() {
|
||||
});
|
||||
|
||||
$('.challenge-list-checkbox').on('change', function() {
|
||||
var checkboxId = $(this).parent().parent().attr('id');
|
||||
if ($(this).is(":checked")) {
|
||||
$(this).parent().parent().children('.step-text').addClass('italic');
|
||||
if (!localStorage || !localStorage[checkboxId]) {
|
||||
localStorage[checkboxId] = "true";
|
||||
}
|
||||
}
|
||||
if (!$(this).is(":checked")) {
|
||||
$(this).parent().parent().children('.step-text').removeClass('italic');
|
||||
if (localStorage[checkboxId]) {
|
||||
localStorage[checkboxId] = "false";
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -6,9 +6,9 @@ block content
|
||||
.well
|
||||
h4
|
||||
ol
|
||||
for step in details
|
||||
for step, index in details
|
||||
.row
|
||||
li
|
||||
li.checklist-element(id="#{dashedName + index}")
|
||||
.col-xs-2
|
||||
input(type='checkbox' class='challenge-list-checkbox')
|
||||
.col-xs-10.step-text!= step
|
||||
|
Reference in New Issue
Block a user