From 53ea660e5ed2bfdf3998d8fe1659506ed5f99594 Mon Sep 17 00:00:00 2001
From: Amanda Ghassaei <amandaghassaei@gmail.com>
Date: Sat, 15 Aug 2015 03:09:33 -0400
Subject: [PATCH] eod

---
 js/menus/templates/EditComponentMenuView.html | 54 ++++++++++---------
 1 file changed, 28 insertions(+), 26 deletions(-)

diff --git a/js/menus/templates/EditComponentMenuView.html b/js/menus/templates/EditComponentMenuView.html
index 6275a155..7c95fcab 100644
--- a/js/menus/templates/EditComponentMenuView.html
+++ b/js/menus/templates/EditComponentMenuView.html
@@ -1,4 +1,5 @@
 <% var thisComponent = components[editingComponent] || stock[editingComponent]; %>
+<% var isStock = stock[editingComponent]; %>
 Name: &nbsp;&nbsp;<input data-property="name" value="<%= thisComponent.name %>" placeholder="Enter Name" class="seventyFiveWidth form-control textInput component" type="text"><br/><br/>
 Parent: &nbsp;&nbsp;
     <div class="btn-group">
@@ -10,30 +11,31 @@ Parent: &nbsp;&nbsp;
             <% }); %>
         </ul>
     </div><br/><br/>
-Children: &nbsp;&nbsp;
-<div class="btn-group">
-    <button data-toggle="dropdown" class="btn dropdown-toggle" type="button">+ Add Child<span class="caret"></span></button>
-    <ul role="menu" class="dropdown-menu">
-        <% _.each(components, function(component, id){ %>
-            <% if (component.id == editingComponent || component.id == thisComponent.parent) return; %>
-            <li><a class="component dropdownSelector" data-property="newChild" data-value="<%= id %>" href="#"><%= component.name %></a></li>
-        <% }); %>
-        <% _.each(stock, function(thisStock, id){ %>
-            <li><a class="component dropdownSelector" data-property="newChild" data-value="<%= id %>" href="#"><%= thisStock.name %></a></li>
-        <% }); %>
-    </ul>
-</div><br/><br/>
-<% var treeLevel = 0; %>
-<% _.each(tree, function(level, id){ %>
-    <% if (tree[editingComponent] >= level) return; %>
-    <% var component = components[id] || stock[id]; %>
-    <% treeLevel++; %>
-    <div class="assemblerTree" <% if (treeLevel%2 == 0){ %> style="background-color:#ddd"<% } %> ><label style="padding-left:<%= (level-tree[editingComponent]-1)*10 + 20 %>px"><%= component.name %>
-        <% if(tree[editingComponent]+1 == level){ %><a data-id="<%= id %>" class="editMachineComponent pull-right" href="#">Remove</a><% } %></label></div><br/>
-<% }); %><br/>
-
-STL: &nbsp;&nbsp;STL Name<br/><br/>
-<a id="uploadStl" href="#" class="btn btn-block btn-lg btn-default">Upload STL</a><br/>
+<% if(!isStock){ %>
+    Children: &nbsp;&nbsp;
+    <div class="btn-group pull-right">
+        <button data-toggle="dropdown" class="btn dropdown-toggle" type="button">+ Add Child<span class="caret"></span></button>
+        <ul role="menu" class="dropdown-menu">
+            <% _.each(components, function(component, id){ %>
+                <% if (component.id == editingComponent || component.id == thisComponent.parent) return; %>
+                <li><a class="component dropdownSelector" data-property="newChild" data-value="<%= id %>" href="#"><%= component.name %></a></li>
+            <% }); %>
+            <% _.each(stock, function(thisStock, id){ %>
+                <li><a class="component dropdownSelector" data-property="newChild" data-value="<%= id %>" href="#"><%= thisStock.name %></a></li>
+            <% }); %>
+        </ul>
+    </div><br/><br/>
+    <% var treeLevel = 0; %>
+    <% _.each(tree, function(level, id){ %>
+        <% if (tree[editingComponent] >= level) return; %>
+        <% var component = components[id] || stock[id]; %>
+        <% treeLevel++; %>
+        <div class="assemblerTree" <% if (treeLevel%2 == 0){ %> style="background-color:#ddd"<% } %> ><label style="padding-left:<%= (level-tree[editingComponent]-1)*10 + 20 %>px"><%= component.name %>
+            <% if(tree[editingComponent]+1 == level){ %><a data-id="<%= id %>" class="editMachineComponent pull-right" href="#">Remove</a><% } %></label></div><br/>
+    <% }); %><br/>
+    STL: &nbsp;&nbsp;STL Name<br/><br/>
+    <a id="uploadStl" href="#" class="btn btn-block btn-lg btn-default">Upload STL</a><br/>
+<% } %>
 Offset (xyz):&nbsp;&nbsp;
     <input data-property="translation" data-key="x" value="<%= translation.x %>" placeholder="X" class="form-control floatInput component" type="text">&nbsp;
     <input data-property="translation" data-key="y" value="<%= translation.y %>" placeholder="Y" class="form-control floatInput component" type="text">&nbsp;
@@ -42,7 +44,7 @@ Rotation (xyz):&nbsp;&nbsp;
     <input data-property="rotation" data-key="x" value="<%= rotation.x %>" placeholder="X" class="form-control floatInput component" type="text">&nbsp;
     <input data-property="rotation" data-key="y" value="<%= rotation.y %>" placeholder="Y" class="form-control floatInput component" type="text">&nbsp;
     <input data-property="rotation" data-key="z" value="<%= rotation.z %>" placeholder="Z" class="form-control floatInput component" type="text"><br/><br/>
-Scale: &nbsp;&nbsp;<input data-property="scale" value="<%= scale %>" placeholder="Scale" class="form-control floatInput component" type="text"><br/><br/>
-<a id="finishComponent" href="#" class="btn btn-block btn-lg btn-success">Save Component</a><br/>
+<% if(!isStock){ %> Scale: &nbsp;&nbsp;<input data-property="scale" value="<%= scale %>" placeholder="Scale" class="form-control floatInput component" type="text"><br/><br/><% } %>
+<a id="finishComponent" href="#" class="btn btn-block btn-lg btn-success">Save <% if(isStock){ %>Stock<% }else{ %>Component<% } %></a><br/>
 <a id="deleteComponent" href="#" class="btn btn-halfWidth btn-lg btn-default"><span class="fui-trash"></span> Delete</a>
 <a id="cancelComponent" href="#" class="btn btn-halfWidth pull-right btn-lg btn-default">Cancel / Exit</a><br/><br/>
-- 
GitLab