Rails.cache.write("COURSE_CURRICULUM_TAGS", ["Apologia", "Beautiful Feet", "Canon Press", "Classical Academic Press", "Classical Conversations", "Dr. Jay Wile", "Henle Latin", "IEW", "Intermediate Logic", "Introductory Logic", "Logic of English", "Lost Tools of Writing", "Math U See", "Memoria Press", "Notgrass", "Saxon Math", "Shormann", "Singapore Math", "Teaching Textbooks", "Veritas Press"])
Rails.cache.write("CURRICULUM_SUBCATEGORIES_HASH", {
"Apologia" => ["Exploring Creation with Biology", "Exploring Creation with Physical Science", "General Science"],
"Canon Press" => ["Introductory Logic - The Fundamentals of Thinking Well"],
"Classical Academic Press" => ["The Art of Argument"],
"Classical Conversations" => ["Challenge 1", "Challenge 2", "Challenge 3", "Challenge 4", "Challenge A", "Challenge B", "Essentials", "Foundations"],
"Dr. Jay Wile" => ["Discovering Design with Chemistry"],
"Henle Latin" => ["Latin 1", "Latin 2"],
"IEW" => ["Following Narnia® Volume 2: Aslan's Country", "Medieval History"],
"Logic of English" => ["Logic of English C"],
"Math U See" => ["AIM", "Math U See Alpha", "Math U See Beta", "Math U See Geometry", "Math U See Pre-Algebra", "Math U See: Zeta", "Math U See Algebra 2"],
"Notgrass" => ["Notgrass Exploring Government"],
"Saxon Math" => ["Saxon Advanced Math", "Saxon Algebra", "Saxon Algebra 1/2"],
"Shormann" => ["Shormann Algebra 1", "Shormann Algebra 2", "Shormann Algebra 2 with Integrated Geometry"],
"Singapore Math" => ["2B US Edition", "5B US Edition"]
})
[{
label: "integer",
value: "b"
}, {
label: "canon",
value: "subject"
}, {
label: "Apologia",
value: "subject"
}]
var curriculum_tree = <%= cache_course_curriculum_tags.map { |s| [{label: s, value: 'subject'}, {label: s, value: s}, (cache_curriculum_subcategories_hash[s] || []).map {|ss| {label: ss, value: ss} } ] }.flatten.to_json.html_safe %>;
curriculum_tree = _.filter(curriculum_tree, function (val) {
return val.value == 'subject' || val.label.indexOf(current_curriculum) !== -1
});
$('item i').on('click', function (e) {
e.preventDefault();
var item = $(this).parent();
if (item.hasClass('active')) {
$(this).removeClass('fal').addClass('fas');
} else {
$(this).removeClass('fas').addClass('fal');
}
});
$('form').validate({
ignore: [],
invalidHandler: function(form, validator) {
if (validator.numberOfInvalids()) {
for (var i = 0; i < validator.errorList.length; ++i) {
//alert(validator.errorList[i].element.getAttribute('name'));
console.log(validator.errorList[i]);
}
}
}
});