From ff39af817d22ec3d1a76074361b5707e88a35a5d Mon Sep 17 00:00:00 2001
From: Amanda Ghassaei <amandaghassaei@gmail.com>
Date: Thu, 13 Aug 2015 01:58:46 -0400
Subject: [PATCH] component edit menu working again too

---
 js/cam/assemblers/Assembler.js                | 4 ++--
 js/cam/assemblers/Component.js                | 6 +++---
 js/menus/templates/EditComponentMenuView.html | 2 +-
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/js/cam/assemblers/Assembler.js b/js/cam/assemblers/Assembler.js
index d2a821d9..21ec4fca 100644
--- a/js/cam/assemblers/Assembler.js
+++ b/js/cam/assemblers/Assembler.js
@@ -79,9 +79,9 @@ define(['underscore', 'appState', 'lattice', 'stlLoader', 'threeModel', 'cam', '
     };
 
     Assembler.prototype._buildAssemblerComponents = function(componentsJSON){
-        var components = [];
+        var components = {};
         _.each(componentsJSON, function(componentJSON, id){
-            components[id] = new Component(id);
+            components[id] = new Component(id, componentJSON);
         });
         return components;
     };
diff --git a/js/cam/assemblers/Component.js b/js/cam/assemblers/Component.js
index e9d37f81..9840473e 100644
--- a/js/cam/assemblers/Component.js
+++ b/js/cam/assemblers/Component.js
@@ -7,10 +7,10 @@ define(['underscore', 'cam', 'three'], function(_, cam, THREE){
 
     var id = 0;
 
-    function Component(geometry, material, name){
+    function Component(id, json){
         this.object3D = new THREE.Object3D();
-        this.id = "id" + id++;
-        this.name = name || "";
+        this.id = id || "id" + id++;
+        this.name = json.name || "";
         this.parent = null;
         this.children = [];
     }
diff --git a/js/menus/templates/EditComponentMenuView.html b/js/menus/templates/EditComponentMenuView.html
index 8d6abe63..d9c1bbdc 100644
--- a/js/menus/templates/EditComponentMenuView.html
+++ b/js/menus/templates/EditComponentMenuView.html
@@ -19,7 +19,7 @@ Children: &nbsp;&nbsp;
         <% }); %>
     </ul>
 </div><br/>
-    <% _.each(components[editingComponent].children, function(childID){ console.log(components[editingComponent].children);%>
+    <% _.each(components[editingComponent].children, function(childID){ %>
         <%= components[childID].name %> <a class="removeChild" data-id="<%= childID %>" href="#">Remove</a><br/>
     <% }); %><br/>
 STL: &nbsp;&nbsp;STL Name<br/><br/>
-- 
GitLab