Bladeren bron

Bugfixes on prototype RuleBuilder

Nathan Schneider 4 jaren geleden
bovenliggende
commit
f24870a0d4
1 gewijzigde bestanden met toevoegingen van 17 en 7 verwijderingen
  1. 17 7
      _layouts/rule.html

+ 17 - 7
_layouts/rule.html

@@ -26,14 +26,22 @@ layout: default
       // Set up transfer
       var data = ev.dataTransfer.getData("text");
       // Iff module is from the menu clone it
-      var module = document.getElementById(data).cloneNode(true);
+      var module = document.getElementById(data);
+      if (module.parentElement.id == "module-menu") {
+          module = module.cloneNode(true);
+      }
+      // append name
       module.id += "-dropped";
       // display the deletion button
       module.children[2].style.display = "inline";
       // pop it in!
       target.appendChild(module);
       // be sure the dummy text is gone
-      target.children[0].style.display = "none";
+      document.getElementById("drag-directions").style.display = "none";
+
+      // Send field contents to console
+      // To aid in database stuff
+      console.log(document.getElementById("module-input"));
   }
   
   // toggleVisible(id)
@@ -356,13 +364,13 @@ layout: default
     <span class="question">What is the community’s name?</span>
     <h1 contenteditable="true" class="editable output" id="communityname">{{ page.community-name }}</h1>
 
-    <!-- Modules  -->
-
+    <p class="question"><strong>RuleBuilder</strong></p>
+    
+    <!-- Modules -->
     <div ondrop="drop(event)" ondragover="allowDrop(event)"
          class="modulebox" id="module-input">
       <span class="question" id="drag-directions">
-        Drag modules from the icon at right</span>
-      
+        Drag modules from the icon at right</span>      
       <div class="button">
         <img src="{% link assets/tabler_icons/tool.svg %}" title="Modules" />
         <div class="tooltiptext" id="module-menu">
@@ -392,7 +400,9 @@ layout: default
         </div>
       </div>
     </div>
-  
+
+    <p class="question"><strong>RuleWriter</strong></p>
+    
     <!-- SECTION S1: BASICS -->
     <h2 id="header-s1" class="header">
       <img src="{% link assets/tabler_icons/info-circle.svg %}"