[all][s]: (refs #1) refactor layout to be like standard js library rather than couch app.

This commit is contained in:
rgrp
2011-10-24 16:00:28 +01:00
parent fe8df046da
commit 27a63e6577
29 changed files with 6 additions and 126 deletions

BIN
demo/images/bg_gradient.gif Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 87 B

BIN
demo/images/couch.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

BIN
demo/images/large-spinner.gif Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

BIN
demo/images/small-spinner.gif Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

438
demo/index.html Executable file
View File

@@ -0,0 +1,438 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>CouchDB Data Explorer</title>
<link rel="stylesheet" href="style/reset.css" media="screen">
<link rel="stylesheet" href="style/data-table.css" media="screen">
<link rel="stylesheet" href="style/style.css" media="screen">
<!-- only using jqueryui for draggable -- a lighter solution would be nice -->
<script type="text/javascript" src="../src/deps-min.js"></script>
<script type="text/javascript" src="../src/util.js"></script>
<script type="text/javascript" src="../src/costco.js"></script>
<script type="text/javascript" src="../src/recline.js"></script>
<script type="text/javascript" src="../src/site.js"></script>
</head>
<body class="bod">
<div class="container">
<div class="menu-overlay" style="display: none; z-index: 101; ">&nbsp;</div>
<ul class="menu">
</ul>
<div id="header">
<a href="http://github.com/maxogden/recline"><img id="couchLogo" src="images/couch.png"/></a>
<div class="project-title"></div>
<div class="project-actions"></div>
<div class="project-controls"></div>
</div>
<div class="main_content">
<div class="left-panel"></div>
<div class="right-panel"></div>
</div>
</div>
<div id="notification-container">
<div id="notification">
<img src="images/small-spinner.gif" class="notification-loader"><span id="notification-message">Loading...</span>
</div>
</div>
<div class="dialog-overlay" style="display: none; z-index: 101; ">&nbsp;</div>
<div class="dialog ui-draggable" style="display: none; z-index: 102; top: 101px; ">
<div class="dialog-frame" style="width: 700px; visibility: visible; ">
<div class="dialog-content dialog-border"></div>
</div>
</div>
<script type='text/mustache' class="busyTemplate">
<div id="loading-message">
<img src="images/large-spinner.gif">
<span> Working...</span>
</div>
</script>
<script type='text/mustache' class="controlsTemplate">
<a id="logged-in-status" href="JavaScript:void(0);" class="secondary">{{text}}</a>
</script>
<script type='text/mustache' class="actionsTemplate">
<a class="button" data-action="import" href="javascript:{}"><span data-action="import" class="button-menu">Import</span></a>
<!-- <a class="button" data-action="edit" href="javascript:{}"><span data-action="transform" class="button-menu">Edit</span></a> -->
<a class="button" data-action="export" href="javascript:{}"><span data-action="export" class="button-menu">Export</span></a>
</script>
<script type='text/mustache' class="importActionsTemplate">
<li><a data-action="urlImport" class="menuAction" href="JavaScript:void(0);">JSON API</a></li>
<li><a data-action="pasteImport" class="menuAction" href="JavaScript:void(0);">Paste JSON</a></li>
<li><a data-action="uploadImport" class="menuAction" href="JavaScript:void(0);">Upload CSV</a></li>
</script>
<script type='text/mustache' class="exportActionsTemplate">
<li><a data-action="csv" class="menuAction" href="JavaScript:void(0);">CSV</a></li>
<li><a data-action="json" class="menuAction" href="JavaScript:void(0);">JSON</a></li>
</script>
<script type='text/mustache' class="transformActionsTemplate">
<li><a data-action="transform" class="menuAction" href="JavaScript:void(0);">Global transform...</a></li>
</script>
<script type='text/mustache' class="columnActionsTemplate">
<li><a data-action="bulkEdit" class="menuAction" href="JavaScript:void(0);">Transform...</a></li>
<li><a data-action="deleteColumn" class="menuAction" href="JavaScript:void(0);">Delete this column</a></li>
</script>
<script type='text/mustache' class="rowActionsTemplate">
<li><a data-action="deleteRow" class="menuAction" href="JavaScript:void(0);">Delete this row</a></li>
</script>
<script type='text/mustache' class="titleTemplate"><span id="project-name-button" class="app-path-section">{{db_name}}</span></script>
<script type='text/mustache' class="bulkTemplate">http://{{host}}/{{db_name}}/_bulk_docs</script>
<script type='text/mustache' class="generatingTemplate"><div class="loading">Loading...</div></script>
<script type='text/mustache' class="tableContainerTemplate">
<div id="tool-panel">
<div id="summary-bar">
<span id="docCount"></span>
</div>
<div id="download">
</div>
</div>
<div id="view-panel">
<div class="viewpanel-header">
<div class="viewpanel-pagesize">
<span>
Show:
</span>
<a href="javascript:{}" class="viewPanel-pagingControls-page action">5</a>
<a href="javascript:{}" class="viewPanel-pagingControls-page selected">10</a>
<a href="javascript:{}" class="viewPanel-pagingControls-page action">25</a>
<a href="javascript:{}" class="viewPanel-pagingControls-page action">50</a>
<span>
rows
</span>
</div>
<div class="viewpanel-sorting">
</div>
<div class="viewpanel-paging">
<a href="javascript:{}" class="first inaction">« first</a>
<a href="javascript:{}" class="previous inaction"> previous</a>
<span class="viewpanel-pagingcount">
1 - 10
</span>
<a href="javascript:{}" class="next action">next </a>
<a href="javascript:{}" class="last action">last »</a>
</div>
</div>
<div class="data-table-container">
</div>
</div>
</script>
<script type='text/mustache' class="dataTableTemplate">
<table class="data-table" cellspacing="0">
<tbody>
<tr>
{{#notEmpty}}<td class="column-header"></td>{{/notEmpty}}
{{#headers}}
<td class="column-header">
<div class="column-header-title">
<a class="column-header-menu"></a>
<span class="column-header-name">{{.}}</span>
</div>
</div>
</td>
{{/headers}}
</tr>
{{#rows}}
<tr data-id="{{id}}">
<td><a class="row-header-menu"></a></td>
{{#cells}}
<td data-header="{{header}}">
<div class="data-table-cell-content">
<a href="javascript:{}" class="data-table-cell-edit" title="Edit this cell">&nbsp;</a>
<div class="data-table-cell-value">{{value}}</div>
</div>
</td>
{{/cells}}
</tr>
{{/rows}}
</tbody>
</table>
</script>
<script type='text/mustache' class="signInTemplate">
<div class="dialog-header">
Sign in
</div>
<div class="dialog-body">
<div class="grid-layout layout-tight layout-full">
<form name="sign-in-form" id="sign-in-form">
<table class="form-table">
<tbody>
<tr>
<th>
<label for="username">Username</label>
</th>
<td>
<input type="text" size="25" id="username-input" name="username">
</td>
</tr>
<tr>
<th>
<label for="password">Password</label>
</th>
<td>
<input type="password" size="25" id="password-input" name="password">
</td>
</tr>
<input type="submit" style="height: 0px; width: 0px; border: none; padding: 0px;" hidefocus="true" />
</tbody>
</table>
</form>
</div>
</div>
<div class="dialog-footer">
<button class="okButton button">&nbsp;&nbsp;Sign in&nbsp;&nbsp;</button>
<button class="cancelButton button">Cancel</button>
</div>
</script>
<script type='text/mustache' class="transformTemplate">
<div class="dialog-header">
Recursive transform on all rows
</div>
<div class="dialog-body">
<div class="grid-layout layout-full">
<p class="info">Traverse and transform objects by visiting every node on a recursive walk using <a href="https://github.com/substack/js-traverse">js-traverse</a>.</p>
<table>
<tbody>
<tr>
<td colspan="4">
<div class="grid-layout layout-tight layout-full">
<table rows="4" cols="4">
<tbody>
<tr style="vertical-align: bottom;">
<td colspan="4">
Expression
</td>
</tr>
<tr>
<td colspan="3">
<div class="input-container">
<textarea class="expression-preview-code"></textarea>
</div>
</td>
<td class="expression-preview-parsing-status" width="150" style="vertical-align: top;">
No syntax error.
</td>
</tr>
<tr>
<td colspan="4">
<div id="expression-preview-tabs" class="refine-tabs ui-tabs ui-widget ui-widget-content ui-corner-all">
<span>Preview</span>
<div id="expression-preview-tabs-preview" class="ui-tabs-panel ui-widget-content ui-corner-bottom">
<div class="expression-preview-container" style="width: 652px; ">
</div>
</div>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="dialog-footer">
<button class="okButton button">&nbsp;&nbsp;Update All&nbsp;&nbsp;</button>
<button class="cancelButton button">Cancel</button>
</div>
</script>
<script type='text/mustache' class="urlImportTemplate">
<div class="dialog-header">
Download and import from a URL or API
</div>
<div class="dialog-body">
<div class="grid-layout layout-full">
<p class="info">
Currently only <a href="http://en.wikipedia.org/wiki/JSONP">JSONP</a>-enabled APIs are supported, for example:
</p>
<p class="info">
<code>https://api.github.com/repos/maxogden/recline/commits</code>
</p>
<form name="api-import-form" id="sign-in-form">
<table class="form-table">
<tbody>
<tr>
<th>
<label for="url">URL</label>
</th>
<td>
<input type="text" size="65" id="url-input" name="url">
</td>
</tr>
<input type="submit" style="height: 0px; width: 0px; border: none; padding: 0px; display: none;" hidefocus="true" />
</tbody>
</table>
</form>
</div>
</div>
<div class="dialog-footer">
<button class="okButton button">&nbsp;&nbsp;Fetch&nbsp;&nbsp;</button>
<button class="cancelButton button">Cancel</button>
</div>
</script>
<script type='text/mustache' class="pasteImportTemplate">
<div class="dialog-header">
Import raw copy & pasted JSON
</div>
<div class="dialog-body">
<div class="grid-layout layout-tight layout-full">
<p class="info">
Paste in an array of JSON objects representing the documents that you would like to insert into the database.
</p>
<p class="info">
<code>[{"woo": "pizza"}, {"tasty": "muffins"}]</code>
</p>
<div class="menu-container data-table-cell-editor">
<textarea class="data-table-cell-copypaste-editor" bind="textarea">{{value}}</textarea>
</div>
</div>
</div>
<div class="dialog-footer">
<button class="okButton button">&nbsp;&nbsp;Import&nbsp;&nbsp;</button>
<button class="cancelButton button">Cancel</button>
</div>
</script>
<script type='text/mustache' class="uploadImportTemplate">
<div class="dialog-header">
Upload and import a CSV
</div>
<div class="dialog-body">
<div class="grid-layout layout-tight layout-full">
<strong>Please choose a CSV file to upload:</strong><br />
<input type="file" id="file" />
</div>
</div>
<div class="dialog-footer">
<button class="okButton button">&nbsp;&nbsp;Import&nbsp;&nbsp;</button>
<button class="cancelButton button">Cancel</button>
</div>
</script>
<script type='text/mustache' class="bulkEditTemplate">
<div class="dialog-header">
Functional transform on column {{name}}
</div>
<div class="dialog-body">
<div class="grid-layout layout-tight layout-full">
<table>
<tbody>
<tr>
<td colspan="4">
<div class="grid-layout layout-tight layout-full">
<table rows="4" cols="4">
<tbody>
<tr style="vertical-align: bottom;">
<td colspan="4">
Expression
</td>
</tr>
<tr>
<td colspan="3">
<div class="input-container">
<textarea class="expression-preview-code"></textarea>
</div>
</td>
<td class="expression-preview-parsing-status" width="150" style="vertical-align: top;">
No syntax error.
</td>
</tr>
<tr>
<td colspan="4">
<div id="expression-preview-tabs" class="refine-tabs ui-tabs ui-widget ui-widget-content ui-corner-all">
<span>Preview</span>
<div id="expression-preview-tabs-preview" class="ui-tabs-panel ui-widget-content ui-corner-bottom">
<div class="expression-preview-container" style="width: 652px; ">
</div>
</div>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="dialog-footer">
<button class="okButton button">&nbsp;&nbsp;Update All&nbsp;&nbsp;</button>
<button class="cancelButton button">Cancel</button>
</div>
</script>
<script type='text/mustache' class="cellEditorTemplate">
<div class="menu-container data-table-cell-editor">
<textarea class="data-table-cell-editor-editor" bind="textarea">{{value}}</textarea>
<div id="data-table-cell-editor-actions">
<div class="data-table-cell-editor-action">
<button class="okButton button">Update</button>
</div>
<div class="data-table-cell-editor-action">
<button class="cancelButton button">Cancel</button>
</div>
</div>
</div>
</script>
<script type='text/mustache' class="jsonTreeTemplate">
<div class="dialog-header">
Please highlight the array of JSON objects to convert to documents.
</div>
<div class="dialog-body">
<div id="document-container">
<div id="document-editor"></div>
</div>
</div>
<div class="dialog-footer">
<button class="okButton button">&nbsp;&nbsp;Import&nbsp;&nbsp;</button>
<button class="cancelButton button">Cancel</button>
</div>
</script>
<script type='text/mustache' class="editPreviewTemplate">
<div class="expression-preview-table-wrapper">
<table>
<tbody>
<tr>
<td class="expression-preview-heading">
before
</td>
<td class="expression-preview-heading">
after
</td>
</tr>
{{#rows}}
<tr>
<td class="expression-preview-value">
{{before}}
</td>
<td class="expression-preview-value">
{{after}}
</td>
</tr>
{{/rows}}
</tbody>
</table>
</div>
</script>
</body>
</html>

1198
demo/style/data-table.css Executable file

File diff suppressed because it is too large Load Diff

BIN
demo/style/images/down-arrow.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 971 B

BIN
demo/style/images/edit-map.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

BIN
demo/style/images/loader-blue.gif Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

BIN
demo/style/images/loader.gif Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

67
demo/style/reset.css Executable file
View File

@@ -0,0 +1,67 @@
/* --------------------------------------------------------------
reset.css
* Resets default browser CSS.
-------------------------------------------------------------- */
html {
margin:0;
padding:0;
border:0;
}
body, div, span, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, code,
del, dfn, em, img, q, dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, dialog, figure, footer, header,
hgroup, nav, section {
margin: 0;
padding: 0;
border: 0;
font-weight: inherit;
font-style: inherit;
font-size: 100%;
font-family: inherit;
vertical-align: baseline;
}
/* This helps to make newer HTML5 elements behave like DIVs in older browers */
article, aside, dialog, figure, footer, header,
hgroup, nav, section {
display:block;
}
/* Line-height should always be unitless! */
body {
line-height: 1.5;
background: white;
}
/* Tables still need 'cellspacing="0"' in the markup. */
table {
border-collapse: separate;
border-spacing: 0;
}
/* float:none prevents the span-x classes from breaking table-cell display */
caption, th, td {
text-align: left;
font-weight: normal;
float:none !important;
}
table, th, td {
vertical-align: middle;
}
/* Remove possible quote marks (") from <q>, <blockquote>. */
blockquote:before, blockquote:after, q:before, q:after { content: ''; }
blockquote, q { quotes: "" ""; }
/* Remove annoying border on linked images. */
a img { border: none; }
/* Remember to define your own focus styles! */
:focus { outline: 0; }

212
demo/style/style.css Executable file
View File

@@ -0,0 +1,212 @@
section { margin-bottom: 20px; padding: 10px; }
section.even { background-color: #EEE; -webkit-border-radius: 6px; -moz-border-radius: 6px; border-radius: 6px; }
article.example { margin: 20px 0px 20px 0px; padding: 10px 0px 10px 0px; border-top: 1px dotted #CCCCCC; border-bottom: 1px dotted #CCCCCC; }
footer { font-size: 11px; color: #666; text-align: center; margin-top: 20px; }
footer a { color: #666 }
.container { margin: 0px auto; }
#main { background-color: #FFFFFF; -webkit-border-radius: 6px; -moz-border-radius: 6px; border-radius: 6px; }
code,
blockquote,
.code { font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif }
.code { color: #d1d1d1; background-color: #3F3F3F; margin: 0px 0px 20px 0px; padding: 5px; font-size: 13px; -webkit-border-radius: 6px; -moz-border-radius: 6px; border-radius: 6px; }
.notice { background-color: #FFF9D8; margin-top: 20px; padding: 10px; -webkit-border-radius: 6px; -moz-border-radius: 6px; border-radius: 6px; }
.ribbon { position: absolute; top: 0; right: 0; border: 0; }
#download {float: right; position: relative; top: 3px; right: 5px;}
#database{overflow:hidden;}
#database h2{margin:0;}
#database .group{border-top:1px solid #bedce7;}
#database .separator{padding-top:1em;}
#database .envelope{border-bottom:1px solid #bedce7;border-left:1px solid #bedce7;border-right:1px solid #bedce7;padding:0 .7em .7em .7em;background:#eaf2f5 url(images/bg_gradient.gif) 0 100% repeat-x;overflow:hidden;}
#database .envelope.selected{background:#fffeeb!important;}
#database .envelope.selected .machine span{border-bottom:1px dotted #4183c4;}
#database.single_database .envelope .machine span{border-bottom:1px dotted #4183c4;}
#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 .dbInfo {background:#fff url(images/bg_gradient.gif) 0 100% repeat-x;}
#database .action {background:#eaf2f5 url(images/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%;}
#database .database_oneline .gravatar{width:1%;}
#database .database_oneline .gravatar img{border:1px solid #d0d0d0;padding:1px;background-color:white;float:left;margin-right:.4em;}
#database .database_oneline .author a{font-weight:bold;color:black;}
#database .database_oneline .message a{color:black;}
#database .database_oneline .database,#database .database_oneline .tree{width:1%;font-family:Monaco,"Courier New","DejaVu Sans Mono","Bitstream Vera Sans Mono",monospace;font-size:90%;color:#808080;border-left:1px solid #bedce7;padding:.6em .5em;}
#database .database_oneline .tree{border-right:1px solid #bedce7;}
a{color:#4183c4;}
a {text-decoration: none;}
a:hover{text-decoration:underline;}
.usingMouse a{outline:none;}
a.button span.icon.loading { background-image: url(images/loader.gif); }
.loading { background-image: url(images/loader.gif); background-repeat: no-repeat; padding-left: 15px; background-position: 0px 3px;}
a.button:hover span.icon.loading { background-image: url(images/loader-blue.gif); }
#couchLogo {float: left; margin-right: 5px; margin-top: 3px}
.chosen {border: 1px solid green}
.info { padding: 0px 0px 10px 0px}
.large-loader { position: relative; }
.menu-overlay {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
ul.menu {
display: none;
outline-style: none;
background: white;
color: black;
font-size: 12px;
height: auto;
list-style: none;
overflow: hidden;
position: absolute;
text-align: left;
width: 120px;
z-index: 666;
border: 1px solid #CCC;
border-right: 1px solid #666;
border-bottom: 1px solid #666;
margin: 0; padding: 0; }
ul.menu * {
margin: 0;
padding: 0; }
ul.menu a {
line-height: 14px;
color: black;
display: block;
padding: 5px 7px;
text-decoration: none; }
ul.menu li {
height: 24px; }
ul.menu li:hover {
background-color: #DBE8F8 }
/* Document Editor from CouchDB SammyFuton */
div#document-container span#expand-all {
cursor:pointer; color:#FF0000;
}
div#document-editor { background: #fff; font-size:14px; overflow: auto; max-height: 500px;}
div#document-editor span.expand {cursor:pointer; color:#FF0000;}
div#document-editor div.id-space {
border: none; float: left; margin: 3px 3px 0 3px; padding: 0;
width: 15px; height: 15px;
}
div#document-editor div.doc-field {width:99%; padding-bottom:2px;}
div#document-editor div.doc-field, div.doc-value, div.doc-key {float:left; cursor:pointer; cursor: hand;}
div#document-editor div.doc-key {padding-right:5px;font-weight:bold;}
div#document-editor div.string-type { white-space: pre-wrap; color:#393;}
div#document-editor div.string-type:before { color: #ccc; content: "“";
left: -4px;
}
div#document-editor div.string-type:after { color: #ccc; content: "”"; }
div#document-editor span.number-type { white-space: pre-wrap; color:#339; padding-left:6px;}
div#document-editor span.array-type { color: #BD101D; float:left;}
div#document-editor span.object-type { color: #BD101D; float:left;}
div#document-editor span.null-type { color: #BD101D; float:left; color: #666666; padding-left:6px;}
div#document-editor div.array-key {float:left; padding-right:15px; color:#666666;}
div#document-editor div.object-key {float:left; padding-right:15px; font-weight:bold; }
div#document-editor div.doc-key-base {float:left; padding-right:15px; font-weight:bold; }
div#document-editor .doc-value.object {
max-width: 400px;
}
div#document-editor .array-type {
max-width: 500px;
}
div#document-editor div.empty {
float:left;
}
div#document-editor input {
font: normal 90% arial, sans-serif;
}
div#document-editor span#save-button {
cursor:pointer; background-color:#ddd;
padding: 2px 5px 2px 5px;
-moz-border-radius: 15px;
-webkit-border-radius: 15px;
border-radius: 15px;
}
span#restore {
cursor:pointer; background-color:#ddd;
padding: 2px 5px 2px 5px;
-moz-border-radius: 15px;
-webkit-border-radius: 15px;
border-radius: 15px;
}
div#autosave {
float:right;
}
span.revision {
padding-right:10px;
cursor:pointer;
float:left;
margin-bottom:10px;
}
div#document-revisions {
padding-top:20px;
}
span#document-revisions-title {
padding-right:10px;
font-weight:bold;
float:left;
margin-bottom:80px;
}
span.current-revision {
font-weight:bold;
padding-right:10px;
float:left;
margin-bottom:10px;
}
span.revision {
padding-right:10px;
cursor:default;
float:left;
margin-bottom:10px;
}
span.revision-status-missing {
color:#8C8C8C;
}
span.revision-status-disk {
cursor:pointer;
}
span.revision-status-available {
cursor:pointer;
}
span.revision-status-deleted {
color:#8C8C8C;
}
.tooltip {
position:absolute;
font-size:12px;
padding:2px;
background-color:#B3B3B3;
border:checked;
color:black;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
}
span.tooltip-status-title {
color:black;
font-weight:normal;
text-align:center;
}
span.tooltip-status {
font-weight:bold;
color:red;
text-align:center;
}