Skip to content

Commit

Permalink
Can mark handouts as un-indexed
Browse files Browse the repository at this point in the history
  • Loading branch information
maxg committed Feb 1, 2021
1 parent 1991e82 commit c9c2b91
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
4 changes: 2 additions & 2 deletions server/structure.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ function parse($json) {

function incl($config) {
global $HANDOUT_TOC_KINDS;
return in_array($config->kind, $HANDOUT_TOC_KINDS);
return in_array($config->kind, $HANDOUT_TOC_KINDS) && ! property_exists($config, 'noindex');
}

function entry($config) {
Expand All @@ -29,5 +29,5 @@ function entry($config) {
header('Content-Type: application/json');
$configs = array_map(function($name) { return substr($name, 0, -5); }, glob('data/*.json'));
natsort($configs);
print json_encode(array_map(entry, array_filter(array_map(parse, array_values($configs)), incl)));
print json_encode(array_map(entry, array_values(array_filter(array_map(parse, array_values($configs)), incl))));
?>
4 changes: 4 additions & 0 deletions web/handout/handout-page.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,12 @@ HANDOUT_SCRIPTDIR = document.querySelector('script[src*=handout-page]').getAttri
// when all scripts are loaded, render and run
if ( ! scripts) {
renderPage();
var data = document.querySelector('script[src*=handout-page]').dataset;
$('script[src*=handout-page], script[src*=render]').remove();
require('./handout-run.js').done(function(event) {
Object.entries(data).forEach(function(kv) {
event.target.dataset[kv[0]] = kv[1];
});
event.target.setAttribute('data-handx-url', HANDOUT_HANDX);
});
return;
Expand Down
1 change: 1 addition & 0 deletions web/handout/handout-render.js
Original file line number Diff line number Diff line change
Expand Up @@ -489,6 +489,7 @@ function handoutDeliveryCallback() {
part: part || null,
structure: window.handoutStructure,
exercises: window.handoutExercises,
noindex: document.querySelector('script[data-handx-noindex]') ? true : undefined,
});

$('.exercise-panel').attr('data-ex-remote', HANDOUT_HANDX + 'submit.php')
Expand Down

0 comments on commit c9c2b91

Please sign in to comment.