Mercurial > hg > webaudioevaluationtool
changeset 2858:cffde1e75b2d
Test create: Completed setup node
author | Nicholas Jillings <nicholas.jillings@mail.bcu.ac.uk> |
---|---|
date | Thu, 27 Apr 2017 11:43:08 +0100 |
parents | 80a3b693b3f6 |
children | d432bf25889b |
files | test_create.html test_create/test_core.js |
diffstat | 2 files changed, 27 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/test_create.html Thu Apr 27 11:24:16 2017 +0100 +++ b/test_create.html Thu Apr 27 11:43:08 2017 +0100 @@ -108,11 +108,12 @@ </div> </div> </div> - <div id="globalpresurvey" class="node"> + <div id="globalpresurvey" class="node" ng-controller="survey" ng-init="survey = specification.preTest"> <h2>Pre Test Survey</h2> - <button type="button" class="btn btn-success" ng-click="specification.preTest.addOption()">Add Entry</button> - <div class="node" ng-repeat="opt in specification.preTest.options" ng-controller="surveyOption"> + <button type="button" class="btn btn-success" ng-click="addSurveyEntry()">Add Entry</button> + <div class="node" ng-repeat="opt in survey.options" ng-controller="surveyOption"> <h3>Survey Entry</h3> + <button type="button" class="btn btn-danger" ng-click="removeSurveyEntry(opt);">Delete Entry</button> <div class="attributes"> <div class="attribute"> <span>Survey Type: </span> @@ -223,14 +224,14 @@ <span>Jump To On Pass: </span> <select ng-model="condition.jumpToOnPass"> <option value="">None</option> - <option ng-repeat="entry in specification.preTest.options" value="{{entry.id}}">{{entry.id}}</option> + <option ng-repeat="entry in survey.options" value="{{entry.id}}">{{entry.id}}</option> </select> </div> <div class="attribute"> <span>Jump To On Fail: </span> <select ng-model="condition.jumpToOnFail"> <option value="">None</option> - <option ng-repeat="entry in specification.preTest.options" value="{{entry.id}}">{{entry.id}}</option> + <option ng-repeat="entry in survey.options" value="{{entry.id}}">{{entry.id}}</option> </select> </div> </div> @@ -238,11 +239,12 @@ </div> </div> </div> - <div id="globalpostsurvey" class="node"> + <div id="globalpostsurvey" class="node" ng-controller="survey" ng-init="survey = specification.postTest"> <h2>Post Test Survey</h2> - <button type="button" class="btn btn-success" ng-click="specification.postTest.addOption()">Add Entry</button> - <div class="node" ng-repeat="opt in specification.postTest.options" ng-controller="surveyOption"> + <button type="button" class="btn btn-success" ng-click="addSurveyEntry()">Add Entry</button> + <div class="node" ng-repeat="opt in survey.options" ng-controller="surveyOption"> <h3>Survey Entry</h3> + <button type="button" class="btn btn-danger" ng-click="removeSurveyEntry(opt);">Delete Entry</button> <div class="attributes"> <div class="attribute"> <span>Survey Type: </span> @@ -353,14 +355,14 @@ <span>Jump To On Pass: </span> <select ng-model="condition.jumpToOnPass"> <option value="">None</option> - <option ng-repeat="entry in specification.postTest.options" value="{{entry.id}}">{{entry.id}}</option> + <option ng-repeat="entry in survey.options" value="{{entry.id}}">{{entry.id}}</option> </select> </div> <div class="attribute"> <span>Jump To On Fail: </span> <select ng-model="condition.jumpToOnFail"> <option value="">None</option> - <option ng-repeat="entry in specification.postTest.options" value="{{entry.id}}">{{entry.id}}</option> + <option ng-repeat="entry in survey.options" value="{{entry.id}}">{{entry.id}}</option> </select> </div> </div>
--- a/test_create/test_core.js Thu Apr 27 11:24:16 2017 +0100 +++ b/test_create/test_core.js Thu Apr 27 11:43:08 2017 +0100 @@ -150,6 +150,21 @@ }; }]); +AngularInterface.controller("survey", ['$scope', '$element', '$window', function ($s, $e, $w) { + $s.addSurveyEntry = function () { + $s.survey.addOption(); + }; + $s.removeSurveyEntry = function (entry) { + var index = $s.survey.options.findIndex(function (a) { + return a == entry; + }); + if (index === -1) { + throw ("Invalid Entry"); + } + $s.survey.options.splice(index, 1); + }; +}]); + AngularInterface.controller("surveyOption", ['$scope', '$element', '$window', function ($s, $e, $w) { $s.removeOption = function (option) {