diff --git a/README.md b/README.md index a38a713693e063ccd59168af5b3de68e91182ae0..7b060f49ca76777abc1b5602016681f43395c350 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,14 @@ # acos-webdev-iwdap Content package for Acos-servers that adds web development exercises -designed for *Introduction to Web Development and Programming*. +where student experiments with web using a browser inspector tool. ## Installation -For the time being, this package requires that `acos-webdev` package has been installed manually. +This package requires that `acos-webdev` package has been installed +as a dependency. ## Testing -Tests are written with WebDriverIO, refer to the `acos-server` documentation on testing. +Tests are written with WebDriverIO, refer to the `acos-server` +documentation on testing. diff --git a/index.js b/index.js index b316f30b54d28f49a8189be1afb98b90521164b5..033d2a94cfcdf7a90f2a91d40f5dc05f743d6759 100644 --- a/index.js +++ b/index.js @@ -1,23 +1,26 @@ /* global module, require, __dirname, console */ /* jshint globalstrict: true */ 'use strict'; -var nj = require('nunjucks'); -var fs = require('fs'); +let nj = require('nunjucks'); +let fs = require('fs'); -var AcosMod = function () {}; +let AcosMod = function () {}; -var baseDir = __dirname; -var content = JSON.parse(fs.readFileSync(baseDir + '/content.json', 'utf8')); +let baseDir = __dirname; +let content = JSON.parse(fs.readFileSync(baseDir + '/content.json', 'utf8')); AcosMod.initialize = function (req, params, handlers, cb) { - var templateDir = baseDir + '/templates/'; + let templateDir = baseDir + '/templates/'; nj.configure(templateDir, { autoescape: false }); - var config = content[params.name]; + + let config = content[params.name]; config.abFlag = params.abFlag; + if (config.template) { config.html = nj.render(config.template, config); } - var templateParam = { + + let templateParam = { id: 'acos-webdev-inspector-' + params.name, config: JSON.stringify(config), acceptTest: config.acceptTest,