summaryrefslogtreecommitdiff
path: root/modules/zelfoverhoor
diff options
context:
space:
mode:
authortomsmeding <tom.smeding@gmail.com>2018-03-02 12:17:29 +0100
committertomsmeding <tom.smeding@gmail.com>2018-03-02 12:17:29 +0100
commita00c93ac174b4c9b01ddd020f8a6d4a32e18f5b2 (patch)
tree3e0e5693cd17e34501889f3886c393902a58bd58 /modules/zelfoverhoor
parent04f196c7c5c9601a9d7e64e013cc9846c4b2e1fe (diff)
zelfoverhoor: Insert questions halfway while editing
Diffstat (limited to 'modules/zelfoverhoor')
-rw-r--r--modules/zelfoverhoor/docent.html2
-rw-r--r--modules/zelfoverhoor/docent.js20
2 files changed, 19 insertions, 3 deletions
diff --git a/modules/zelfoverhoor/docent.html b/modules/zelfoverhoor/docent.html
index c3c1d7b..501d007 100644
--- a/modules/zelfoverhoor/docent.html
+++ b/modules/zelfoverhoor/docent.html
@@ -21,7 +21,7 @@ td, th {
padding: 4px;
}
.newquestioncontainer {
- margin-bottom: 10px;
+ margin-bottom: 5px;
}
.newquestioncontainer > span {
margin-right: 5px;
diff --git a/modules/zelfoverhoor/docent.js b/modules/zelfoverhoor/docent.js
index c14fb2e..b44d4b6 100644
--- a/modules/zelfoverhoor/docent.js
+++ b/modules/zelfoverhoor/docent.js
@@ -181,17 +181,33 @@ function renumberQuestions(){
function addNewQuestion(){
var parent=document.getElementById("newquestions");
+ var number=parent.children.length;
var div=document.createElement("div");
div.classList.add("newquestioncontainer");
+ if(number>0){
+ var insertbtn=document.createElement("input");
+ insertbtn.setAttribute("type","button");
+ insertbtn.setAttribute("value","Voeg vraag hier toe");
+ insertbtn.setAttribute("style","margin-bottom:5px");
+ insertbtn.addEventListener("click",function(){
+ addNewQuestion();
+ var newdiv=parent.children[parent.children.length-1];
+ parent.insertBefore(newdiv,div);
+ renumberQuestions();
+ });
+ div.appendChild(insertbtn);
+ div.appendChild(document.createElement("br"));
+ }
+
var span=document.createElement("span");
span.setAttribute("style","display:inline-block");
var b=document.createElement("b");
b.appendChild(document.createTextNode("Vraag "));
- var span2=document.createElement("span2");
+ var span2=document.createElement("span");
span2.classList.add("questionindex");
- span2.innerHTML=parent.children.length+1;
+ span2.innerHTML=number+1;
b.appendChild(span2);
b.appendChild(document.createTextNode(":"));
span.appendChild(b);