fixing csv serialization and minor style tweaks

This commit is contained in:
maxogden 2011-03-09 23:16:57 -08:00
parent bf57648c96
commit b3dbaa0ec3
5 changed files with 21 additions and 16 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 87 B

View File

@ -44,14 +44,14 @@
if( vhost ) dbInfo.db_name = 'db';
render( 'db', 'stats', dbInfo );
render( 'actions', 'actions', dbInfo );
render( 'bulk', 'bulk', dbInfo );
}
$.getJSON( baseURL + 'db', gotDb );
$( '.csv' ).click( function( e ) {
$( '.csv' ).live('click', ( function( e ) {
function gotHeaders( headers ) {
window.location.href = baseURL + 'csv?headers=' + headers;
@ -61,7 +61,7 @@
e.preventDefault();
})
}))
})
</script>
@ -78,11 +78,10 @@
<div id="stats"></div>
<article class="example">
<p>
<h3>Actions</h3>
</p>
<h3>Actions</h3>
<div id="actions"></div>
<p>
<a href="javascript:void(false)" class="button csv"><span class="downarrow icon"></span>Download DB as CSV</a>
</p>
</article>
@ -113,15 +112,12 @@
<div class="group" id="current-head-database">
<table width="100%" cellspacing="0" cellpadding="0">
<tbody>
<tr class="database_oneline">
<tr class="database_oneline action">
<td class="date">
<nobr>DB:</nobr>
</td>
<td class="author">
<a href="#">{{db_name}}</a>
<nobr>db:</nobr>
</td>
<td class="message">
<code><a href="http://{{host}}/{{db_name}}">http://{{host}}/{{db_name}}</a> </code>
<code><a href="http://{{host}}/{{db_name}}">http://{{host}}/<strong>{{db_name}}</strong></a> </code>
</td>
<td class="database">
size&nbsp;<a href="#" hotkey="c">{{disk_size}}</a>
@ -136,6 +132,10 @@
</div>
</script>
<script type='text/mustache' id="actionsTemplate">
<a href="javascript:void(false)" class="primary button csv"><span class="downarrow icon"></span>Download DB as CSV</a>
</script>
<script type='text/mustache' id="bulkTemplate"> http://{{host}}/{{db_name}}/_bulk_docs</script>
</body>

View File

@ -1,7 +1,7 @@
/**
* This is styling for the demo page and is not necessary to include in your projects
*/
body { font-family: Helvetica, Arial, sans-serif; line-height: 1.5em; font-size: 14px; color: #444; background-color: #D5E9F6; }
body { font-family: Helvetica, Arial, sans-serif; font-size: 14px; color: #444; background-color: #D5E9F6; }
h1#title { font-size: 37px; margin-bottom: 50px; color: #666; }
h2 { font-size: 21px; margin-bottom: 20px; }
h3 { font-size: 16px }
@ -45,7 +45,8 @@
#database .human .actor .name span{color:#888;font-size:90%;}
#database .human .actor .date{color:#888;font-size:90%;line-height:1em;}
#database .machine{float:right;width:18em;padding:.8em 0 .8em 1.2em;border-left:1px solid #bedce7;color:#808080;font-family:Monaco,"Courier New","DejaVu Sans Mono","Bitstream Vera Sans Mono",monospace;font-size:.85em;line-height:1.5em;}
#database .database_oneline{background:#eaf2f5 url(/images/modules/database/bg_gradient.gif) 0 100% repeat-x;}
#database .dbInfo {background:#fff url(/images/modules/database/bg_gradient.gif) 0 100% repeat-x;}
#database .action {background:#eaf2f5 url(/images/modules/database/bg_gradient.gif) 0 100% repeat-x;}
#database .database_oneline td{border-bottom:1px solid #bedce7;}
#database .database_oneline .date{color:#888;width:1%;padding:0 1em 0 .5em;border-left:1px solid #bedce7;}
#database .database_oneline .author{width:15%;}

View File

@ -19,7 +19,7 @@ function(head, req) {
if (row.value[headers[header]]) {
if (startedOutput) send(",");
var value = row.value[headers[header]];
if (typeof(value) == "object") value = JSON.stringify(value).replace(/"/g, '\\"');
if (typeof(value) == "object") value = JSON.stringify(value).replace(/"/g, "\\\"");
send("\"" + value + "\"");
} else {
if (startedOutput) send(",");

View File

@ -23,6 +23,10 @@
"to": "_list/csv/all",
"from": "csv"
},
{
"to": "../../../_active_tasks",
"from": "_active_tasks"
},
{
"to": "_list/urlencode/headers",
"from": "headers"