Switch to side-by-side view

--- a/ForgeTracker/forgetracker/templates/admin.html
+++ b/ForgeTracker/forgetracker/templates/admin.html
@@ -5,6 +5,8 @@
       xmlns:xi="http://www.w3.org/2001/XInclude">
 
   <xi:include href="master.html" />
+
+  <?python from pyforge.lib.security import has_artifact_access ?>
 
   <head>
     <meta content="text/html; charset=UTF-8" http-equiv="content-type" py:replace="''"/>
@@ -14,11 +16,12 @@
   <body>
     <div id="app_admin_tabs">
     	<ul>
-    		<li><a href="#app-acl" py:if="app.permissions">Permissions</a></li>
-    		<li><a href="#app-status" py:if="app.permissions">Statuses</a></li>
-    		<li><a href="#app-custom-fields" py:if="app.permissions">Custom Fields</a></li>
+    		<li><a href="#app-acl"
+    		       py:if="app.permissions and has_artifact_access('configure', app=app)()">Permissions</a></li>
+    		<li><a href="#app-status">Statuses</a></li>
+    		<li><a href="#app-custom-fields">Custom Fields</a></li>
     	</ul>
-      <div id="app-acl">
+      <div id="app-acl" py:if="app.permissions and has_artifact_access('configure', app=app)()">
         <h3>Permissions</h3>
         <div id="acl-admin">
           <py:for each="p in app.permissions" >
@@ -57,25 +60,39 @@
           </py:for>
         </div>
       </div>
-      <div id="app-status">
-        <h3>Status</h3>
+      <div id="app-status" style="overflow: auto">
+        <h3>Statuses</h3>
         <div>
           <form method="POST" action="set_status_names">
-              status names:
-              <input type="text" name="status_names" style="width:50%" value="${globals.status_names}"/>
-              <input type="submit" value="Save"/>
+              <div class="span-3"><label>Status names:</label></div>
+              <div class="span-15 last">
+                <input type="text" name="status_names" style="width:50%" value="${globals.status_names}" 
+                       py:if="has_artifact_access('configure', app=app)()"/>
+                <span py:if="not has_artifact_access('configure', app=app)()">${globals.status_names}</span>
+              </div>
+              <div class="push-3 span-15 last"><input type="submit" value="Save"/></div>
           </form>
         </div>
       </div>
-      <div id="app-custom-fields">
+      <div id="app-custom-fields" style="overflow: auto">
         <h3>Custom Fields</h3>
         <div>
           <div id="custom-field-list">
-              <div py:for="field in globals.custom_fields" style="display:none" class="custom-field-stub"
-                  data-label="${field.label}" data-type="${field.type}" data-options="${getattr(field, 'options', '')}"/>
+            <py:for each="field in globals.custom_fields">
+              <div style="display:none" class="custom-field-stub"
+                  data-label="${field.label}" data-type="${field.type}" data-options="${getattr(field, 'options', '')}"
+                  py:if="has_artifact_access('configure', app=app)()"/>
+              <py:if test="not has_artifact_access('configure', app=app)()">
+                <div class="span-3"><label>Label: </label></div><div class="span-15 last">${field.label}</div>
+                <div class="span-3"><label>Type: </label></div><div class="span-15 last">${field.type}</div>
+                <span class="options-wrapper" py:if="field.options"><div class="span-3"><label>Options: </label></div><div class="span-15 last">${getattr(field, 'options', '')}</div></span>
+              </py:if>
+            </py:for>
           </div>
-          <button onclick="add_field()">Add Field</button>
-          <button onclick="save_fields()">Save</button>
+          <button onclick="add_field()" 
+                  py:if="has_artifact_access('configure', app=app)()">Add Field</button>
+          <button onclick="save_fields()" 
+                  py:if="has_artifact_access('configure', app=app)()">Save</button>
         </div>
       </div>
     </div>  
@@ -91,5 +108,6 @@
            });
 	  </script>
   </body>
-  <script type="text/javascript" src="/static/Tickets/js/custom-fields.js"/>
+  <script type="text/javascript" src="/static/Tickets/js/custom-fields.js" 
+          py:if="has_artifact_access('configure', app=app)()"/>
 </html>