[CalendarServer-changes] [12846] CalendarServer/trunk/calendarserver/webadmin/work.xhtml

source_changes at macosforge.org source_changes at macosforge.org
Fri Mar 7 13:00:13 PST 2014


Revision: 12846
          http://trac.calendarserver.org//changeset/12846
Author:   wsanchez at apple.com
Date:     2014-03-07 13:00:13 -0800 (Fri, 07 Mar 2014)
Log Message:
-----------
Refactor out row addition

Modified Paths:
--------------
    CalendarServer/trunk/calendarserver/webadmin/work.xhtml

Modified: CalendarServer/trunk/calendarserver/webadmin/work.xhtml
===================================================================
--- CalendarServer/trunk/calendarserver/webadmin/work.xhtml	2014-03-07 20:48:43 UTC (rev 12845)
+++ CalendarServer/trunk/calendarserver/webadmin/work.xhtml	2014-03-07 21:00:13 UTC (rev 12846)
@@ -375,6 +375,13 @@
 
           var jobItems = JSON.parse(e.data);
 
+          function addCellToRow(row, tag, text) {
+            var cell = document.createElement(tag);
+            var content = document.createTextNode(text);
+            cell.appendChild(content);
+            row.appendChild(cell);
+          }
+
           for (var i in jobItems) {
             var jobItem = jobItems[i];  // OMG JavaScript is so stupid.
 
@@ -391,10 +398,7 @@
                 var attribute = attributes[i];  // OMG JavaScript, wow you so dumb
                 attributeDescription = valueOrKey(jobItemAttributeDescriptions, attribute)
 
-                var header = document.createElement("th");
-                var text = document.createTextNode(attributeDescription);
-                header.appendChild(text);
-                row.appendChild(header);
+                addCellToRow(row, "th", attributeDescription)
               }
 
               detailsHeader.appendChild(row);
@@ -406,14 +410,10 @@
             for (var i in attributes) {
               var attribute = attributes[i];  // OMG JavaScript the lameness
 
-              var content = jobItem[attribute]
-              if (content === null) { content = ""; }
+              var value = jobItem[attribute]
+              if (value === null) { value = ""; }
 
-              var cell = document.createElement("td");
-              var text = document.createTextNode(content);
-
-              cell.appendChild(text);
-              row.appendChild(cell);
+              addCellToRow(row, "td", value)
             }
 
             detailsBody.appendChild(row);
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20140307/0f41a7b9/attachment-0001.html>


More information about the calendarserver-changes mailing list