You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by cm...@apache.org on 2009/12/12 01:08:48 UTC

svn commit: r889867 - in /couchdb/trunk/share/www: script/futon.format.js style/layout.css

Author: cmlenz
Date: Sat Dec 12 00:08:47 2009
New Revision: 889867

URL: http://svn.apache.org/viewvc?rev=889867&view=rev
Log:
Futon: Improve display of multi-line strings in tabular document view.

Modified:
    couchdb/trunk/share/www/script/futon.format.js
    couchdb/trunk/share/www/style/layout.css

Modified: couchdb/trunk/share/www/script/futon.format.js
URL: http://svn.apache.org/viewvc/couchdb/trunk/share/www/script/futon.format.js?rev=889867&r1=889866&r2=889867&view=diff
==============================================================================
--- couchdb/trunk/share/www/script/futon.format.js [utf-8] (original)
+++ couchdb/trunk/share/www/script/futon.format.js [utf-8] Sat Dec 12 00:08:47 2009
@@ -42,7 +42,7 @@
           case "string":
             var retval = val;
             if (type == "string" && !options.escapeStrings) {
-              retval = indentLines(retval, tab);
+              retval = indentLines(retval.replace(/\r\n/g, "\n"), tab.substr(options.indent));
             } else {
               retval = escape(JSON.stringify(val));
             }
@@ -70,7 +70,9 @@
                 buf.push(index > 0 ? itemsep : options.linesep);
                 buf.push(tab, format(val[index], depth + 1));
               }
-              if (index >= 0) buf.push(options.linesep, tab.substr(options.indent));
+              if (index >= 0) {
+                buf.push(options.linesep, tab.substr(options.indent));
+              }
               buf.push("]");
               if (options.html) {
                 return "<code class='array'>" + buf.join("") + "</code>";
@@ -95,7 +97,9 @@
                   ": ", format(val[key], depth + 1));
                 index++;
               }
-              if (index >= 0) buf.push(options.linesep, tab.substr(options.indent));
+              if (index >= 0) {
+                buf.push(options.linesep, tab.substr(options.indent));
+              }
               buf.push("}");
               if (options.html) {
                 return "<code class='object'>" + buf.join("") + "</code>";

Modified: couchdb/trunk/share/www/style/layout.css
URL: http://svn.apache.org/viewvc/couchdb/trunk/share/www/style/layout.css?rev=889867&r1=889866&r2=889867&view=diff
==============================================================================
--- couchdb/trunk/share/www/style/layout.css (original)
+++ couchdb/trunk/share/www/style/layout.css Sat Dec 12 00:08:47 2009
@@ -427,6 +427,7 @@
 #fields tbody.content td code { display: block; font-size: 11px;
   padding: 2px 2px 2px 3px; position: relative;
 }
+#fields tbody.content td code.string { white-space: pre-wrap; }
 #fields tbody.content td code.string:before { color: #ccc; content: "“";
   position: absolute; left: -4px;
 }
@@ -448,9 +449,7 @@
   float: left; margin-left: 0; padding-left: 2px; padding-right: .5em;
   padding-top: 2px;
 }
-#fields tbody.content td dd code.string { left: 4px; text-indent: -6px;
-  white-space: pre-wrap;
-}
+#fields tbody.content td dd code.string { left: 4px; text-indent: -6px; }
 #fields tbody.content td dd code.string:before { position: static; }
 #fields tbody.content input, #fields tbody.content textarea,
 #fields tbody.source textarea {