comparison test_create/test_core.js @ 2907:a1e294297380

#222 WIP
author Nicholas Jillings <n.g.r.jillings@se14.qmul.ac.uk>
date Mon, 31 Jul 2017 16:15:47 +0100
parents 22d1f6d9f0bf
children 9c26e579e64d
comparison
equal deleted inserted replaced
2906:281393b64a13 2907:a1e294297380
238 }; 238 };
239 239
240 $s.configure = function () {} 240 $s.configure = function () {}
241 241
242 $s.$watch("selectedTestPrototype", $s.configure); 242 $s.$watch("selectedTestPrototype", $s.configure);
243
244 $s.placeholder = function (name) {
245 var spec = $s.schema.querySelector("attribute[name=\"" + name + "\"]") || $w.specification.schema.querySelector("attribute[name=\"" + name + "\"]");
246 var attr = spec.getAttribute("default");
247 if (attr === undefined) {
248 return "";
249 }
250 return attr;
251 }
243 }]); 252 }]);
244 253
245 AngularInterface.controller("survey", ['$scope', '$element', '$window', function ($s, $e, $w) { 254 AngularInterface.controller("survey", ['$scope', '$element', '$window', function ($s, $e, $w) {
246 $s.addSurveyEntry = function () { 255 $s.addSurveyEntry = function () {
247 $s.survey.addOption(); 256 $s.survey.addOption();
411 420
412 $s.$watch("selectedTestPrototype", $s.configure); 421 $s.$watch("selectedTestPrototype", $s.configure);
413 $s.configure(); 422 $s.configure();
414 }]); 423 }]);
415 AngularInterface.controller("page", ['$scope', '$element', '$window', function ($s, $e, $w) { 424 AngularInterface.controller("page", ['$scope', '$element', '$window', function ($s, $e, $w) {
425 $s.schema = $w.specification.schema.querySelector("element[name=\"page\"]");
426 $s.page.label = "default";
416 $s.addInterface = function () { 427 $s.addInterface = function () {
417 $s.page.addInterface(); 428 $s.page.addInterface();
418 }; 429 };
419 $s.removeInterface = function (node) { 430 $s.removeInterface = function (node) {
420 var index = $s.page.interfaces.findIndex(function (a) { 431 var index = $s.page.interfaces.findIndex(function (a) {
448 if (index === -1) { 459 if (index === -1) {
449 throw ("Invalid node"); 460 throw ("Invalid node");
450 } 461 }
451 $s.page.audioElements.splice(index, 1); 462 $s.page.audioElements.splice(index, 1);
452 }; 463 };
453 }]); 464
465 $s.placeholder = function (name) {
466 var spec = $s.schema.querySelector("attribute[name=\"" + name + "\"]") || $w.specification.schema.querySelector("attribute[name=\"" + name + "\"]");
467 var attr = spec.getAttribute("default");
468 if (attr === undefined) {
469 return "";
470 }
471 return attr;
472 }
473 }]);