comparison test_create/test_core.js @ 3098:348d59ab726e

Test creator uses Bootstrap modals
author Nicholas Jillings <nicholas.jillings@mail.bcu.ac.uk>
date Tue, 16 Jan 2018 15:23:45 +0000
parents c8707694f4e7
children fc9718756d55
comparison
equal deleted inserted replaced
3097:c8707694f4e7 3098:348d59ab726e
70 var specification = new Specification(); 70 var specification = new Specification();
71 71
72 window.onload = function () { 72 window.onload = function () {
73 // Get the test interface specifications 73 // Get the test interface specifications
74 toggleDropdowns(); 74 toggleDropdowns();
75 $("#popupHolder").modal("show");
75 }; 76 };
76 77
77 function toggleDropdowns() { 78 function toggleDropdowns() {
78 $(function () { 79 $(function () {
79 $('[data-toggle="popover"]').popover(); 80 $('[data-toggle="popover"]').popover();
85 s.handleFiles(event); 86 s.handleFiles(event);
86 s.$apply(); 87 s.$apply();
87 } 88 }
88 89
89 AngularInterface.controller("view", ['$scope', '$element', '$window', function ($s, $e, $w) { 90 AngularInterface.controller("view", ['$scope', '$element', '$window', function ($s, $e, $w) {
90 $s.popupVisible = true;
91 $s.testSpecifications = {}; 91 $s.testSpecifications = {};
92 92
93 (function () { 93 (function () {
94 new Promise(function (resolve, reject) { 94 new Promise(function (resolve, reject) {
95 var xml = new XMLHttpRequest(); 95 var xml = new XMLHttpRequest();
109 $s.testSpecifications = data; 109 $s.testSpecifications = data;
110 $s.$apply(); 110 $s.$apply();
111 }); 111 });
112 })(); 112 })();
113 113
114 $s.showPopup = function () {
115 $s.popupVisible = true;
116 };
117 $s.hidePopup = function () {
118 $s.popupVisible = false;
119 };
120 $s.globalSchema = undefined; 114 $s.globalSchema = undefined;
121 get("xml/test-schema.xsd").then(function (text) { 115 get("xml/test-schema.xsd").then(function (text) {
122 specification.processSchema(text); 116 specification.processSchema(text);
123 $s.globalSchema = specification.getSchema(); 117 $s.globalSchema = specification.getSchema();
124 }); 118 });
214 $s.state = 0; 208 $s.state = 0;
215 $s.selected = undefined; 209 $s.selected = undefined;
216 $s.next = function () { 210 $s.next = function () {
217 $s.state++; 211 $s.state++;
218 if ($s.state > 1 || $s.file) { 212 if ($s.state > 1 || $s.file) {
219 $s.hidePopup(); 213 $($e[0]).modal('hide')
220 $s.initialise($s.selected); 214 $s.initialise($s.selected);
221 } 215 }
222 }; 216 };
223 $s.back = function () { 217 $s.back = function () {
224 $s.state--; 218 $s.state--;