|
@@ -52,11 +52,34 @@ layout: default
|
|
|
// include a field removal button
|
|
|
var destination = document.getElementById("builder-field");
|
|
|
if (content == null) { content = ""; }
|
|
|
- var output = '\n<div><a onclick="this.parentNode.remove()"><img src="{% link assets/tabler_icons/x.svg %}" class="delete-module" align="right" /></a>';
|
|
|
+ var output = '\n<div><div class="field-controls">';
|
|
|
+ output += '<a onclick="swapSibling(this.parentNode.parentNode,true)"><img src="{% link assets/tabler_icons/chevron-up.svg %}" /></a><br />';
|
|
|
+ output += '<a onclick="this.parentNode.parentNode.remove()"><img src="{% link assets/tabler_icons/x.svg %}" class="delete-module" /></a><br />';
|
|
|
+ output += '<a onclick="swapSibling(this.parentNode.parentNode,false)"><img src="{% link assets/tabler_icons/chevron-down.svg %}" /></a></div>';
|
|
|
output += '<span class="question">' + content + '</span>';
|
|
|
output += '<p contenteditable="true" class="editable output" id="custom-field"></p></div>\n';
|
|
|
destination.innerHTML += output;
|
|
|
}
|
|
|
+
|
|
|
+ // Moves a text field up or down
|
|
|
+ // direction is bool: true is up, false is down
|
|
|
+ function swapSibling(node1, direction) {
|
|
|
+ var node2 = null;
|
|
|
+ if (direction == true) {
|
|
|
+ node2 = node1.previousElementSibling;
|
|
|
+ if (node2 == null) { return; }
|
|
|
+ node2.parentNode.replaceChild(node2, node1);
|
|
|
+ node2.parentNode.insertBefore(node1, node2);
|
|
|
+ } else {
|
|
|
+ node2 = node1.nextElementSibling;
|
|
|
+ if (node2 == null) { return; }
|
|
|
+ node1.parentNode.replaceChild(node1, node2);
|
|
|
+ node1.parentNode.insertBefore(node2, node1);
|
|
|
+ }
|
|
|
+ console.log(node2);
|
|
|
+ // cancel if there is no sibling
|
|
|
+ }
|
|
|
+
|
|
|
// end BUILDER functions
|
|
|
|
|
|
// toggleVisible(id)
|
|
@@ -89,6 +112,8 @@ layout: default
|
|
|
classDisplayAll("button","none");
|
|
|
classDisplayAll("question","none");
|
|
|
classDisplayAll("delete-module","none");
|
|
|
+ classDisplayAll("module-link","none");
|
|
|
+ classDisplayAll("field-controls","none");
|
|
|
var editableFields = document.getElementsByClassName("editable");
|
|
|
// de-editable-ize the editable fields
|
|
|
for (var i = 0; i < editableFields.length; i++) {
|
|
@@ -146,6 +171,8 @@ layout: default
|
|
|
classDisplayAll("link-text","inline");
|
|
|
classDisplayAll("link-url","inline");
|
|
|
classDisplayAll("delete-module","inline");
|
|
|
+ classDisplayAll("module-link","inline");
|
|
|
+ classDisplayAll("field-controls","inline");
|
|
|
// link handling TKTK
|
|
|
// author handling
|
|
|
document.getElementById("authorship-result").style.display = "none";
|
|
@@ -404,7 +431,7 @@ layout: default
|
|
|
<span class="module fixed" id="module-{{ module.id }}"
|
|
|
draggable="true" ondragstart="drag(event)">
|
|
|
<span>{{ module.name }}</span>
|
|
|
- <a target="_blank" href="{{ module.url }}">
|
|
|
+ <a target="_blank" href="{{ module.url }}" class="module-link">
|
|
|
<img src="{% link assets/tabler_icons/link.svg %}"
|
|
|
draggable="false" /></a>
|
|
|
<a onclick="this.parentNode.remove()" class="delete-module"
|
|
@@ -423,7 +450,7 @@ layout: default
|
|
|
<img src="{% link assets/tabler_icons/info-circle.svg %}"
|
|
|
class="icons" />
|
|
|
<span class="subhead output">Basics</span>
|
|
|
- <button onclick="toggleVisible('s1')" class="button plus"><img src="{% link assets/tabler_icons/plus.svg %}" title="Expand" /></button>
|
|
|
+ <button onclick="toggleVisible('s1')" class="button chevrons"><img src="{% link assets/tabler_icons/chevrons-down.svg %}" title="Expand" /></button>
|
|
|
</h2>
|
|
|
<div class="section" id="s1" style="display:none">
|
|
|
|
|
@@ -447,7 +474,7 @@ layout: default
|
|
|
<img src="{% link assets/tabler_icons/user.svg %}"
|
|
|
class="icons" />
|
|
|
<span class="subhead output">Participants</span>
|
|
|
- <button onclick="toggleVisible('s2')" class="button plus"><img src="{% link assets/tabler_icons/plus.svg %}" title="Expand" /></button>
|
|
|
+ <button onclick="toggleVisible('s2')" class="button chevrons"><img src="{% link assets/tabler_icons/chevrons-down.svg %}" title="Expand" /></button>
|
|
|
</h2>
|
|
|
<div class="section" id="s2" style="display:none">
|
|
|
|
|
@@ -470,7 +497,7 @@ layout: default
|
|
|
<img src="{% link assets/tabler_icons/news.svg %}"
|
|
|
class="icons" />
|
|
|
<span class="subhead output">Policy</span>
|
|
|
- <button onclick="toggleVisible('s3')" class="button plus"><img src="{% link assets/tabler_icons/plus.svg %}" title="Expand" /></button>
|
|
|
+ <button onclick="toggleVisible('s3')" class="button chevrons"><img src="{% link assets/tabler_icons/chevrons-down.svg %}" title="Expand" /></button>
|
|
|
</h2>
|
|
|
<div class="section" id="s3" style="display:none">
|
|
|
|
|
@@ -493,7 +520,7 @@ layout: default
|
|
|
<img src="{% link assets/tabler_icons/refresh.svg %}"
|
|
|
class="icons" />
|
|
|
<span class="subhead output">Process</span>
|
|
|
- <button onclick="toggleVisible('s4')" class="button plus"><img src="{% link assets/tabler_icons/plus.svg %}" title="Expand" /></button>
|
|
|
+ <button onclick="toggleVisible('s4')" class="button chevrons"><img src="{% link assets/tabler_icons/chevrons-down.svg %}" title="Expand" /></button>
|
|
|
</h2>
|
|
|
<div class="section" id="s4" style="display:none">
|
|
|
|
|
@@ -516,7 +543,7 @@ layout: default
|
|
|
<img src="{% link assets/tabler_icons/adjustments.svg %}"
|
|
|
class="icons" />
|
|
|
<span class="subhead output">Evolution</span>
|
|
|
- <button onclick="toggleVisible('s5')" class="button plus"><img src="{% link assets/tabler_icons/plus.svg %}" title="Expand" /></button>
|
|
|
+ <button onclick="toggleVisible('s5')" class="button chevrons"><img src="{% link assets/tabler_icons/chevrons-down.svg %}" title="Expand" /></button>
|
|
|
</h2>
|
|
|
<div class="section" id="s5" style="display:none">
|
|
|
|