Simplify order of text accumulation.
[mkws-moved-to-github.git] / tools / htdocs / mkws.js
index 3702be0..05d50b5 100644 (file)
@@ -644,12 +644,23 @@ function renderDetails(data, marker)
        maybeLoadTemplate("Record");
     }
 
+    var details;
     if (mkws.templateRecord) {
        var template = mkws.templateRecord;
-       return template(data);
+       details = template(data);
+    } else {
+       details = defaultRenderDetails(data, marker);
     }
 
-    var details = '<div class="details" id="mkwsDet_'+data.recid+'"><table>';
+    details = '<div class="details" id="mkwsDet_'+data.recid+'">' + details;
+    details += '</div>';
+
+    return details;
+}
+
+function defaultRenderDetails(data, marker)
+{
+    var details = '<table>';
     if (marker) details += '<tr><td colspan="2">'+ marker + '</td></tr>';
 
     var locations = [];
@@ -667,8 +678,7 @@ function renderDetails(data, marker)
     } else {
        details += renderField("Location" + (locations.length == 1 ? "" : "s"), locations);
     }
-    details += '</table></div>';
-
+    details += '</table>';
     return details;
 }