comparison test_create/test_core.js @ 2315:a7e50a52a896

Fix for #31. Add Page is now at the bottom, new pages inserted above.
author Nicholas Jillings <nicholas.jillings@mail.bcu.ac.uk>
date Fri, 29 Apr 2016 15:36:29 +0100
parents 152eada7bd03
children 33d2c4fd2625
comparison
equal deleted inserted replaced
2313:70bb8e542741 2315:a7e50a52a896
1449 handleEvent: function() 1449 handleEvent: function()
1450 { 1450 {
1451 var pageObj = new specification.page(specification); 1451 var pageObj = new specification.page(specification);
1452 specification.pages.push(pageObj); 1452 specification.pages.push(pageObj);
1453 var newPage = new this.parent.pageNode(this.parent,pageObj); 1453 var newPage = new this.parent.pageNode(this.parent,pageObj);
1454 this.parent.injectDOM.appendChild(newPage.rootDOM); 1454 document.getElementById("page-holder").appendChild(newPage.rootDOM);
1455 this.parent.pages.push(newPage); 1455 this.parent.pages.push(newPage);
1456 } 1456 }
1457 } 1457 }
1458 this.addPage.root.textContent = "Add Page"; 1458 this.addPage.root.textContent = "Add Page";
1459 this.addPage.root.id = "new-page-button";
1460 this.addPage.root.style.float = "left";
1459 this.addPage.root.addEventListener("click",this.addPage,false); 1461 this.addPage.root.addEventListener("click",this.addPage,false);
1460 this.injectDOM.appendChild(this.addPage.root); 1462
1463 var pageHolder = document.createElement("div");
1464 pageHolder.id ="page-holder";
1465 this.injectDOM.appendChild(pageHolder);
1461 1466
1462 // Build each page 1467 // Build each page
1463 for (var page of specification.pages) 1468 for (var page of specification.pages)
1464 { 1469 {
1465 var newPage = new this.pageNode(this,page); 1470 var newPage = new this.pageNode(this,page);
1466 this.injectDOM.appendChild(newPage.rootDOM); 1471 pageHolder.appendChild(newPage.rootDOM);
1467 this.pages.push(newPage); 1472 this.pages.push(newPage);
1468 } 1473 }
1474
1475 this.injectDOM.appendChild(this.addPage.root);
1469 } 1476 }
1470 1477
1471 this.interfaceNode = function(parent,rootObject) 1478 this.interfaceNode = function(parent,rootObject)
1472 { 1479 {
1473 this.type = "interfaceNode"; 1480 this.type = "interfaceNode";