diff options
author | Garren Smith <garren.smith@gmail.com> | 2014-01-06 12:33:00 +0200 |
---|---|---|
committer | Garren Smith <garren.smith@gmail.com> | 2014-01-13 10:51:51 +0200 |
commit | 89810cce9837d52db4b6beae3206c7b36b6854df (patch) | |
tree | b2a485a0cbe8d83f8ee855a530e9558663ad1be9 | |
parent | 62f939c22cbbda69f5dfd9fd062eab74f9287512 (diff) | |
download | couchdb-89810cce9837d52db4b6beae3206c7b36b6854df.tar.gz |
Fauxton: move modules to addons
59 files changed, 1229 insertions, 77 deletions
diff --git a/.gitignore b/.gitignore index 3d6c0f6ab..784444df9 100644 --- a/.gitignore +++ b/.gitignore @@ -103,6 +103,10 @@ src/fauxton/app/addons/* !src/fauxton/app/addons/permissions !src/fauxton/app/addons/verifyinstall !src/fauxton/app/addons/compaction +!src/fauxton/app/addons/fauxton +!src/fauxton/app/addons/pouchdb +!src/fauxton/app/addons/databases +!src/fauxton/app/addons/documents src/fauxton/settings.json* !src/fauxton/settings.json.default src/ibrowse/ibrowse.app diff --git a/src/fauxton/app/addons/activetasks/resources.js b/src/fauxton/app/addons/activetasks/resources.js index ca732fbc7..3ac0898b2 100644 --- a/src/fauxton/app/addons/activetasks/resources.js +++ b/src/fauxton/app/addons/activetasks/resources.js @@ -13,7 +13,7 @@ define([ "app", "backbone", - "modules/fauxton/base", + "addons/fauxton/base", "d3" ], diff --git a/src/fauxton/app/addons/compaction/routes.js b/src/fauxton/app/addons/compaction/routes.js index 2a33e0796..ff15c884d 100644 --- a/src/fauxton/app/addons/compaction/routes.js +++ b/src/fauxton/app/addons/compaction/routes.js @@ -17,7 +17,7 @@ define([ // Modules "addons/compaction/views", - "modules/databases/resources" + "addons/databases/resources" ], function(app, FauxtonAPI, Compaction, Databases) { diff --git a/src/fauxton/app/modules/databases/base.js b/src/fauxton/app/addons/databases/base.js index 6ff12c646..1a3dc66ef 100644 --- a/src/fauxton/app/modules/databases/base.js +++ b/src/fauxton/app/addons/databases/base.js @@ -16,9 +16,9 @@ define([ "api", // Modules - "modules/databases/routes", + "addons/databases/routes", // Views - "modules/databases/views" + "addons/databases/views" ], diff --git a/src/fauxton/app/modules/databases/resources.js b/src/fauxton/app/addons/databases/resources.js index f3bde80bc..b6d6536fd 100644 --- a/src/fauxton/app/modules/databases/resources.js +++ b/src/fauxton/app/addons/databases/resources.js @@ -16,11 +16,11 @@ define([ "api", // Modules - "modules/documents/resources" + "addons/documents/resources" ], function(app, FauxtonAPI, Documents) { - var Databases = FauxtonAPI.module(); + var Databases = FauxtonAPI.addon(); Databases.DocLimit = 20; diff --git a/src/fauxton/app/modules/databases/routes.js b/src/fauxton/app/addons/databases/routes.js index ca3d64005..c41301826 100644 --- a/src/fauxton/app/modules/databases/routes.js +++ b/src/fauxton/app/addons/databases/routes.js @@ -16,9 +16,9 @@ define([ "api", // Modules - "modules/databases/resources", + "addons/databases/resources", // TODO:: fix the include flow modules so we don't have to require views here - "modules/databases/views" + "addons/databases/views" ], function(app, FauxtonAPI, Databases, Views) { diff --git a/src/fauxton/app/addons/databases/templates/item.html b/src/fauxton/app/addons/databases/templates/item.html new file mode 100644 index 000000000..e2f80712f --- /dev/null +++ b/src/fauxton/app/addons/databases/templates/item.html @@ -0,0 +1,24 @@ +<!-- +Licensed under the Apache License, Version 2.0 (the "License"); you may not +use this file except in compliance with the License. You may obtain a copy of +the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +License for the specific language governing permissions and limitations under +the License. +--> + +<td> + <a href="#/database/<%=encoded%>/_all_docs?limit=<%=docLimit%>"><%= database.get("name") %></a> +</td> +<td><%= database.status.humanSize() %></td> +<td><%= database.status.numDocs() %></td> +<td><%= database.status.updateSeq() %></td> +<td> + <a class="db-actions btn fonticon-replicate set-replication-start" title="Replicate <%= database.get("name") %>" href="#/replication/new/<%=encoded%>"></a> + <a class="db-actions btn icon-lock set-permissions" title="Set permissions for <%= database.get("name") %>" href="#/database/<%=encoded%>/permissions"></a> +</td> diff --git a/src/fauxton/app/addons/databases/templates/list.html b/src/fauxton/app/addons/databases/templates/list.html new file mode 100644 index 000000000..31c097796 --- /dev/null +++ b/src/fauxton/app/addons/databases/templates/list.html @@ -0,0 +1,35 @@ +<!-- +Licensed under the Apache License, Version 2.0 (the "License"); you may not +use this file except in compliance with the License. You may obtain a copy of +the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +License for the specific language governing permissions and limitations under +the License. +--> + +<div class="result-tools" style=""> + <div id="newButton" class="pull-left"></div> + <form id="jump-to-db" class="navbar-form pull-right input-append database-search"> + <input type="text" class="search-autocomplete" name="search-query" placeholder="Database name"></input> + <button class="fonticon-search btn button red " type="submit"></button> + </form> + + +</div> +<table class="databases table table-striped"> + <thead> + <th>Name</th> + <th>Size</th> + <th># of Docs</th> + <th>Update Seq</th> + <th>Actions</th> + </thead> + <tbody> + </tbody> +</table> +<div id="database-pagination"></div> diff --git a/src/fauxton/app/addons/databases/templates/newdatabase.html b/src/fauxton/app/addons/databases/templates/newdatabase.html new file mode 100644 index 000000000..b357e0b15 --- /dev/null +++ b/src/fauxton/app/addons/databases/templates/newdatabase.html @@ -0,0 +1,17 @@ +<!-- +Licensed under the Apache License, Version 2.0 (the "License"); you may not +use this file except in compliance with the License. You may obtain a copy of +the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +License for the specific language governing permissions and limitations under +the License. +--> + +<a class="button new" id="new"><i class="icon fonticon-new-database"></i>Add New Database</a> + + diff --git a/src/fauxton/app/addons/databases/templates/sidebar.html b/src/fauxton/app/addons/databases/templates/sidebar.html new file mode 100644 index 000000000..a8bbd89ff --- /dev/null +++ b/src/fauxton/app/addons/databases/templates/sidebar.html @@ -0,0 +1,31 @@ +<!-- +Licensed under the Apache License, Version 2.0 (the "License"); you may not +use this file except in compliance with the License. You may obtain a copy of +the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +License for the specific language governing permissions and limitations under +the License. +--> + +<div class="row-fluid"> + <a href="http://couchdb.org" target="_blank"><img src="img/couchdblogo.png"/></a> + <br/> +</div> +<hr> +<ul class="nav nav-list"> + <!-- <li class="nav-header">Database types</li> --> + <li class="active"><a class="toggle-view" id="owned">Your databases</a></li> + <li><a class="btn new" id="new"><i class="icon-plus"></i> New database</a></li> +</ul> +<hr> + +<div> + <a class="twitter-timeline" data-dnt="true" href="https://twitter.com/CouchDB" data-widget-id="314360971646869505">Tweets by @CouchDB</a> +<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script> + +</div> diff --git a/src/fauxton/app/modules/databases/views.js b/src/fauxton/app/addons/databases/views.js index dbeb4754b..80d64ed0c 100644 --- a/src/fauxton/app/modules/databases/views.js +++ b/src/fauxton/app/addons/databases/views.js @@ -13,9 +13,9 @@ define([ "app", - "modules/fauxton/components", + "addons/fauxton/components", "api", - "modules/databases/resources" + "addons/databases/resources" ], function(app, Components, FauxtonAPI, Databases) { diff --git a/src/fauxton/app/modules/documents/base.js b/src/fauxton/app/addons/documents/base.js index 96e4ada62..cb68a3128 100644 --- a/src/fauxton/app/modules/documents/base.js +++ b/src/fauxton/app/addons/documents/base.js @@ -16,7 +16,7 @@ define([ "api", // Modules - "modules/documents/routes" + "addons/documents/routes" ], function(app, FauxtonAPI, Documents) { diff --git a/src/fauxton/app/modules/documents/resources.js b/src/fauxton/app/addons/documents/resources.js index 43bb0fdc7..5254302a7 100644 --- a/src/fauxton/app/modules/documents/resources.js +++ b/src/fauxton/app/addons/documents/resources.js @@ -16,7 +16,7 @@ define([ ], function(app, FauxtonAPI) { - var Documents = app.module(); + var Documents = FauxtonAPI.addon(); Documents.Doc = Backbone.Model.extend({ idAttribute: "_id", diff --git a/src/fauxton/app/modules/documents/routes.js b/src/fauxton/app/addons/documents/routes.js index 435ed5ed9..d120feb1f 100644 --- a/src/fauxton/app/modules/documents/routes.js +++ b/src/fauxton/app/addons/documents/routes.js @@ -16,8 +16,8 @@ define([ "api", // Modules - "modules/documents/views", - "modules/databases/base" + "addons/documents/views", + "addons/databases/base" ], function(app, FauxtonAPI, Documents, Databases) { diff --git a/src/fauxton/app/addons/documents/templates/advanced_options.html b/src/fauxton/app/addons/documents/templates/advanced_options.html new file mode 100644 index 000000000..8e96574b1 --- /dev/null +++ b/src/fauxton/app/addons/documents/templates/advanced_options.html @@ -0,0 +1,97 @@ +<!-- +Licensed under the Apache License, Version 2.0 (the "License"); you may not +use this file except in compliance with the License. You may obtain a copy of +the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +License for the specific language governing permissions and limitations under +the License. +--> +<div class="errors-container"></div> +<form class="view-query-update custom-inputs"> + <div class="controls-group"> + <div class="row-fluid"> + <div class="controls controls-row"> + <input name="key" class="span6" type="text" placeholder="Key"> + <input name="keys" class="span6" type="text" placeholder="Keys"> + </div> + </div> + <div class="row-fluid"> + <div class="controls controls-row"> + <input name="startkey" class="span6" type="text" placeholder="Start Key"> + <input name="endkey" class="span6" type="text" placeholder="End Key"> + </div> + </div> + </div> + <div class="controls-group"> + <div class="row-fluid"> + <div class="controls controls-row"> + <div class="checkbox inline"> + <input id="check1" type="checkbox" name="include_docs" value="true"> + <label name="include_docs" for="check1">Include Docs</label> + <% if (hasReduce) { %> + <input id="check2" name="reduce" type="checkbox" value="true"> + <label for="check2">Reduce</label> + </div> + <label id="select1" class="drop-down inline"> + Group Level: + <select id="select1" disabled name="group_level" class="input-small"> + <option value="0">None</option> + <option value="1">1</option> + <option value="2">2</option> + <option value="3">3</option> + <option value="4">4</option> + <option value="5">5</option> + <option value="6">6</option> + <option value="7">7</option> + <option value="8">8</option> + <option value="9">9</option> + <option value="999" selected="selected">exact</option> + </select> + </label> + <% } else{ %> + </div> + <% } %> + + <div class="checkbox inline"> + <input id="check3" name="stale" type="checkbox" value="ok"> + <label for="check3">Stale</label> + <input id="check4" name="descending" type="checkbox" value="true"> + <label for="check4">Descending</label> + </div> + <label class="drop-down inline"> + Limit: + <select name="limit" class="input-small"> + <option>5</option> + <option selected="selected">10</option> + <option>25</option> + <option>50</option> + <option>100</option> + </select> + </label> + <div class="checkbox inline"> + <input id="check5" name="inclusive_end" type="checkbox" value="false"> + <label for="check5">Disable Inclusive End</label> + <input id="check6" name="update_seq" type="checkbox" value="true"> + <label for="check6">Update Sequence</label> + </div> + </div> + </div> + </div> + <div class="controls-group"> + <div class="row-fluid"> + <div id="button-options" class="controls controls-row"> + <button type="submit" class="button green">Query</button> + <% if (showPreview) { %> + <button class="button btn-info preview">Browser Preview</button> + <% } %> + </div> + </div> + </div> +</form> +</div> + diff --git a/src/fauxton/app/addons/documents/templates/all_docs_item.html b/src/fauxton/app/addons/documents/templates/all_docs_item.html new file mode 100644 index 000000000..bfedaaa08 --- /dev/null +++ b/src/fauxton/app/addons/documents/templates/all_docs_item.html @@ -0,0 +1,26 @@ +<!-- +Licensed under the Apache License, Version 2.0 (the "License"); you may not +use this file except in compliance with the License. You may obtain a copy of +the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +License for the specific language governing permissions and limitations under +the License. +--> + +<td class="select"><input type="checkbox" class="row-select"></td> +<td> + <div> + <pre class="prettyprint"><%- doc.prettyJSON() %></pre> + <% if (doc.isEditable()) { %> + <div class="btn-group"> + <a href="#<%= doc.url('web-index') %>" class="btn btn-small edits">Edit <%= doc.docType() %></a> + <button href="#" class="btn btn-small btn-danger delete" title="Delete this document."><i class="icon icon-trash"></i></button> + </div> + <% } %> + </div> +</td> diff --git a/src/fauxton/app/addons/documents/templates/all_docs_layout.html b/src/fauxton/app/addons/documents/templates/all_docs_layout.html new file mode 100644 index 000000000..526c200d1 --- /dev/null +++ b/src/fauxton/app/addons/documents/templates/all_docs_layout.html @@ -0,0 +1,20 @@ +<!-- +Licensed under the Apache License, Version 2.0 (the "License"); you may not +use this file except in compliance with the License. You may obtain a copy of +the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +License for the specific language governing permissions and limitations under +the License. +--> +<ul class="nav nav-tabs window-resizeable" id="db-views-tabs-nav"> + <li><a id="toggle-query" class="fonticon-plus fonticon" href="#query" data-toggle="tab">Query Options</a></li> +</ul> +<div class="tab-content"> + <div class="tab-pane" id="query"> + </div> +</div> diff --git a/src/fauxton/app/addons/documents/templates/all_docs_list.html b/src/fauxton/app/addons/documents/templates/all_docs_list.html new file mode 100644 index 000000000..335b040b8 --- /dev/null +++ b/src/fauxton/app/addons/documents/templates/all_docs_list.html @@ -0,0 +1,43 @@ +<!-- +Licensed under the Apache License, Version 2.0 (the "License"); you may not +use this file except in compliance with the License. You may obtain a copy of +the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +License for the specific language governing permissions and limitations under +the License. +--> + +<div class="view show"> + <% if (!viewList) { %> + <div class="row"> + <div class="btn-toolbar span6"> + <button type="button" class="btn all" data-toggle="button">✓ All</button> + <button class="btn btn-small disabled bulk-delete"><i class="icon-trash"></i></button> + <% if (expandDocs) { %> + <button id="collapse" class="btn"><i class="icon-minus"></i> Collapse</button> + <% } else { %> + <button id="collapse" class="btn"><i class="icon-plus"></i> Expand</button> + <% } %> + </div> + </div> + <% } %> + <p> + + <div id="item-numbers"> </div> + + <% if (requestDuration) { %> + <span class="view-request-duration"> + View request duration: <strong> <%= requestDuration %> </strong> + </span> + <% } %> + </p> + <table class="all-docs table table-striped table-condensed"> + <tbody></tbody> + </table> + <div id="documents-pagination"></div> +</div> diff --git a/src/fauxton/app/addons/documents/templates/all_docs_number.html b/src/fauxton/app/addons/documents/templates/all_docs_number.html new file mode 100644 index 000000000..c4ea8f64a --- /dev/null +++ b/src/fauxton/app/addons/documents/templates/all_docs_number.html @@ -0,0 +1,21 @@ +<!-- +Licensed under the Apache License, Version 2.0 (the "License"); you may not +use this file except in compliance with the License. You may obtain a copy of +the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +License for the specific language governing permissions and limitations under +the License. +--> +<% if (totalRows === "unknown"){ %> + Showing 0 documents. <a href="#/database/<%=database%>/new"> Create your first document.</a> +<% } else { %> + Showing <%=offset%> - <%= numModels %> of <%= totalRows %> rows +<%}%> +<% if (updateSeq) { %> + -- Update Sequence: <%= updateSeq %> +<% } %> diff --git a/src/fauxton/app/addons/documents/templates/changes.html b/src/fauxton/app/addons/documents/templates/changes.html new file mode 100644 index 000000000..9408979a2 --- /dev/null +++ b/src/fauxton/app/addons/documents/templates/changes.html @@ -0,0 +1,38 @@ +<!-- +Licensed under the Apache License, Version 2.0 (the "License"); you may not +use this file except in compliance with the License. You may obtain a copy of +the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +License for the specific language governing permissions and limitations under +the License. +--> + +<table id="changes-table" class="table"> + <thead> + <th id="seq"> seq </th> + <th> id </th> + <th id="changes"> changes </th> + <th id="deleted"> deleted? </th> + </thead> + <tbody> + <% _.each(changes, function (change) { %> + <tr> + <td> <%= change.seq %> </td> + <% if (change.deleted) { %> + <td> <%= change.id %> </td> + <% } else { %> + <td> <a href="#<%= database.url('app') %>/<%= change.id %>"><%= change.id %></a> </td> + <% } %> + <td> + <pre class="prettyprint"> <%- JSON.stringify({changes: change.changes, doc: change.doc}, null, " ") %> </pre> + </td> + <td><%= change.deleted ? "true" : "false" %></td> + </tr> + <% }); %> + </tbody> +</table> diff --git a/src/fauxton/app/addons/documents/templates/ddoc_info.html b/src/fauxton/app/addons/documents/templates/ddoc_info.html new file mode 100644 index 000000000..ed0aed6a7 --- /dev/null +++ b/src/fauxton/app/addons/documents/templates/ddoc_info.html @@ -0,0 +1,28 @@ +<!-- +Licensed under the Apache License, Version 2.0 (the "License"); you may not +use this file except in compliance with the License. You may obtain a copy of +the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +License for the specific language governing permissions and limitations under +the License. +--> +<div> + <h2> Design Doc MetaData </h2> + <div class="row-fluid"> + <% i=0; _.map(view_index, function (val, key) { %> + <% if(i%2==0){%> + <div class="row-fluid"> + <% }; %> + <div class="span6 well-item"><strong> <%= key %></strong> : <%= val %> </div> + <% if(i%2==1){%> + </div> + <% }; %> + <% ++i; + }); %> + </div> +</div> diff --git a/src/fauxton/app/addons/documents/templates/design_doc_selector.html b/src/fauxton/app/addons/documents/templates/design_doc_selector.html new file mode 100644 index 000000000..7bbe31021 --- /dev/null +++ b/src/fauxton/app/addons/documents/templates/design_doc_selector.html @@ -0,0 +1,35 @@ +<!-- +Licensed under the Apache License, Version 2.0 (the "License"); you may not +use this file except in compliance with the License. You may obtain a copy of +the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +License for the specific language governing permissions and limitations under +the License. +--> +<div class="span3"> + <label for="ddoc">Save to Design Document <a href="<%=getDocUrl('design_doc')%>" target="_blank"><i class="icon-question-sign"></i></a></label> + <select id="ddoc"> + <optgroup label="Select a document"> + <option value="new-doc">New document</option> + <% ddocs.each(function(ddoc) { %> + <% if (ddoc.id === ddocName) { %> + <option selected="selected" value="<%= ddoc.id %>"><%= ddoc.id %></option> + <% } else { %> + <option value="<%= ddoc.id %>"><%= ddoc.id %></option> + <% } %> + <% }); %> + </optgroup> + </select> +</div> + +<div id="new-ddoc-section" class="span5" style="display:none"> + <label class="control-label" for="new-ddoc"> _design/ </label> + <div class="controls"> + <input type="text" id="new-ddoc" placeholder="newDesignDoc"> + </div> +</div> diff --git a/src/fauxton/app/addons/documents/templates/doc.html b/src/fauxton/app/addons/documents/templates/doc.html new file mode 100644 index 000000000..10bbf8b88 --- /dev/null +++ b/src/fauxton/app/addons/documents/templates/doc.html @@ -0,0 +1,55 @@ +<!-- +Licensed under the Apache License, Version 2.0 (the "License"); you may not +use this file except in compliance with the License. You may obtain a copy of +the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +License for the specific language governing permissions and limitations under +the License. +--> + +<div id="doc"> + <div class="errors-container"></div> + +<div class="row doc-editor-buttons"> + <div class="span3"> + <button class="save-doc button green btn-medium save fonticon-circle-check" type="button">Save</button> + <button class="button cancel-button gray btn-medium">Back to _all_docs</button> + </div> + + <div class="span7"> + <% if (attachments) { %> + <div class="btn-group"> + <a class="button gray btn-medium dropdown-toggle btn" data-bypass="true" data-toggle="dropdown" href="#"> + View Attachments + <span class="caret"></span> + </a> + <ul class="dropdown-menu"> + <%_.each(attachments, function (att) { %> + <li> + <a href="<%= att.url %>" target="_blank"> <strong> <%= att.fileName %> </strong> - + <span> <%= att.contentType %>, <%= formatSize(att.size)%> </span> + </a> + </li> + <% }) %> + </ul> + </div> + <% } %> + <button class="button gray btn-medium upload"><i class="icon-circle-arrow-up"></i> Upload Attachment</button> + <button class="button gray btn-medium duplicate"><i class="icon-repeat"></i> Duplicate document</button> + </div> + + <button class="button red btn-medium delete"><i class="icon-trash"></i></button> + </ul> + +<div id="upload-modal"> </div> +<div id="duplicate-modal"> </div> +</div> + + <div id="editor-container" class="doc-code"><%- JSON.stringify(doc.attributes, null, " ") %></div> + +</div> diff --git a/src/fauxton/app/addons/documents/templates/doc_field_editor.html b/src/fauxton/app/addons/documents/templates/doc_field_editor.html new file mode 100644 index 000000000..77d92781c --- /dev/null +++ b/src/fauxton/app/addons/documents/templates/doc_field_editor.html @@ -0,0 +1,74 @@ +<!-- +Licensed under the Apache License, Version 2.0 (the "License"); you may not +use this file except in compliance with the License. You may obtain a copy of +the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +License for the specific language governing permissions and limitations under +the License. +--> + +<div id="doc-field-editor"> + <div class="tools"> + + <div class="btn-toolbar pull-left"> + <button class="btn btn-small all">✓ All</button> + <button class="btn btn-small disabled delete"><i class="icon-trash"></i> Delete field</button> + <button class="btn btn-small new" style="margin-left: 64px"><i class="icon-plus"></i> New field</button> + </div> + <div class="btn-toolbar pull-right"> + <button class="btn btn-small cancel button cancel-button outlineGray fonticon-circle-x">Cancel</button> + <button class="btn btn-small save button green fonticon-circle-check">Save</button> + </div> + </div> + + <div class="clearfix"></div> + <!-- <hr style="margin-top: 0"/> --> + + <table class="table table-striped table-condensed"> + <thead> + <tr> + <th class="select"> + </th> + <th>Key</th> + <th>Value</th> + </tr> + </thead> + <tbody> + <tr style="display:none"> + <td class="select"><input type="checkbox" /></td> + <td class="key"><input type="text" class="input-large" value='' /></td> + <td class="value"><input type="text" class="input-xxlarge" value='' /></td> + </tr> + <% _.each(doc, function(value, key) { %> + <tr> + <td class="select"><input type="checkbox" /></td> + <td class="key"> + <input type="text" class="input-large" name="doc[<%= key %>]" value="<%= key %>" /> + </td> + <td class="value"><input type="text" class="input-xxlarge" value='<%= JSON.stringify(value) %>' /></td> + </tr> + <% }); %> + <tr> + <th colspan="3"> + Attachments + </th> + </tr> + <%_.each(attachments, function (att) { %> + <tr> + <td class="select"><input type="checkbox" /></td> + <td colspan="2"> + <a href="<%= att.url %>" target="_blank"> <%= att.fileName %> </a> + <span> <%= att.contentType %>, <%= formatSize(att.size)%> </span> + </td> + </tr> + <% }) %> + </tbody> + </table> + <a class="btn btn-small new" style="margin-left: 64px"><i class="icon-plus"></i> New field</a> + +</div> diff --git a/src/fauxton/app/addons/documents/templates/doc_field_editor_tabs.html b/src/fauxton/app/addons/documents/templates/doc_field_editor_tabs.html new file mode 100644 index 000000000..766647cb2 --- /dev/null +++ b/src/fauxton/app/addons/documents/templates/doc_field_editor_tabs.html @@ -0,0 +1,19 @@ +<!-- +Licensed under the Apache License, Version 2.0 (the "License"); you may not +use this file except in compliance with the License. You may obtain a copy of +the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +License for the specific language governing permissions and limitations under +the License. +--> + +<!--<ul class="nav nav-tabs"> + <li id="field_editor" class="<%= isSelectedClass('field_editor') %>"><a href="#<%= doc.url('app') %>/field_editor">Doc fields</a></li> + <li id="code_editor" class="<%= isSelectedClass('code_editor') %>"><a href="#<%= doc.url('app') %>/code_editor"><i class="icon-pencil"> </i> Code editor</a> + </li> +</ul>--> diff --git a/src/fauxton/app/addons/documents/templates/duplicate_doc_modal.html b/src/fauxton/app/addons/documents/templates/duplicate_doc_modal.html new file mode 100644 index 000000000..3f374b65a --- /dev/null +++ b/src/fauxton/app/addons/documents/templates/duplicate_doc_modal.html @@ -0,0 +1,36 @@ +<!-- +Licensed under the Apache License, Version 2.0 (the "License"); you may not +use this file except in compliance with the License. You may obtain a copy of +the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +License for the specific language governing permissions and limitations under +the License. +--> + +<div class="modal hide fade"> + <div class="modal-header"> + <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> + <h3>Duplicate Document</h3> + </div> + <div class="modal-body"> + <div id="modal-error" class="hide alert alert-error"/> + <form id="file-upload" class="form" method="post"> + <p class="help-block"> + Set new documents ID: + </p> + <input id="dup-id" type="text" class="input-xlarge"> + </form> + + </div> + <div class="modal-footer"> + <a href="#" data-dismiss="modal" class="btn button cancel-button outlineGray fonticon-circle-x">Cancel</a> + <a href="#" id="duplicate-btn" class="btn btn-primary button green save fonticon-circle-check">Duplicate</a> + </div> +</div> + + diff --git a/src/fauxton/app/addons/documents/templates/edit_tools.html b/src/fauxton/app/addons/documents/templates/edit_tools.html new file mode 100644 index 000000000..40c884dd3 --- /dev/null +++ b/src/fauxton/app/addons/documents/templates/edit_tools.html @@ -0,0 +1,44 @@ +<!-- +Licensed under the Apache License, Version 2.0 (the "License"); you may not +use this file except in compliance with the License. You may obtain a copy of +the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +License for the specific language governing permissions and limitations under +the License. +--> + +<div class="view show"> + <p> + Showing 1-<%= numModels %> of <%= totalRows %> rows + <% if (updateSeq) { %> + -- Update Sequence: <%= updateSeq %> + <% } %> + <% if (requestDuration) { %> + <span class="view-request-duration"> + View request duration: <strong> <%= requestDuration %> </strong> + </span> + <% } %> + </p> + <table class="all-docs table table-striped table-condensed"> + <tbody></tbody> + </table> + <!-- + <div class="pagination pagination-centered"> + <ul> + <li class="disabled"><a href="#">«</a></li> + <li class="active"><a href="#">1</a></li> + <li><a href="#">2</a></li> + <li><a href="#">3</a></li> + <li><a href="#">4</a></li> + <li><a href="#">5</a></li> + <li><a href="#">»</a></li> + </ul> + </div> + --> + +</div> diff --git a/src/fauxton/app/addons/documents/templates/index_menu_item.html b/src/fauxton/app/addons/documents/templates/index_menu_item.html new file mode 100644 index 000000000..7ca9012e6 --- /dev/null +++ b/src/fauxton/app/addons/documents/templates/index_menu_item.html @@ -0,0 +1,17 @@ +<!-- +Licensed under the Apache License, Version 2.0 (the "License"); you may not +use this file except in compliance with the License. You may obtain a copy of +the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +License for the specific language governing permissions and limitations under +the License. +--> + +<a id="<%= ddoc_clean %>_<%= index_clean %>" href="#database/<%= database_encoded %>/_design/<%= ddoc_encoded %>/_view/<%= index_encoded %>" class="toggle-view"> + <%= ddoc %><span class="divider">/</span><%= index %> +</a> diff --git a/src/fauxton/app/addons/documents/templates/index_row_docular.html b/src/fauxton/app/addons/documents/templates/index_row_docular.html new file mode 100644 index 000000000..383545359 --- /dev/null +++ b/src/fauxton/app/addons/documents/templates/index_row_docular.html @@ -0,0 +1,26 @@ +<!-- +Licensed under the Apache License, Version 2.0 (the "License"); you may not +use this file except in compliance with the License. You may obtain a copy of +the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +License for the specific language governing permissions and limitations under +the License. +--> + +<td class="select"><input type="checkbox"></td> +<td> + <div> + <pre class="prettyprint"><%- doc.prettyJSON() %></pre> + <% if (doc.isEditable()) { %> + <div class="btn-group"> + <a href="#<%= doc.url('app') %>" class="btn btn-small edits">Edit <%= doc.docType() %></a> + <button href="#" class="btn btn-small btn-danger delete" title="Delete this document."><i class="icon icon-trash"></i></button> + </div> + <% } %> + </div> +</td> diff --git a/src/fauxton/app/addons/documents/templates/index_row_tabular.html b/src/fauxton/app/addons/documents/templates/index_row_tabular.html new file mode 100644 index 000000000..f5f68fa78 --- /dev/null +++ b/src/fauxton/app/addons/documents/templates/index_row_tabular.html @@ -0,0 +1,25 @@ +<!-- +Licensed under the Apache License, Version 2.0 (the "License"); you may not +use this file except in compliance with the License. You may obtain a copy of +the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +License for the specific language governing permissions and limitations under +the License. +--> + +<td class="select"><input type="checkbox"></td> +<td> + <div> + <pre class="prettyprint"><%- JSON.stringify(doc.get("key")) %></pre> + </div> +</td> +<td> + <div> + <pre class="prettyprint"><%- JSON.stringify(doc.get("value")) %></pre> + </div> +</td> diff --git a/src/fauxton/app/addons/documents/templates/jumpdoc.html b/src/fauxton/app/addons/documents/templates/jumpdoc.html new file mode 100644 index 000000000..43fdb9c3a --- /dev/null +++ b/src/fauxton/app/addons/documents/templates/jumpdoc.html @@ -0,0 +1,19 @@ +<!-- +Licensed under the Apache License, Version 2.0 (the "License"); you may not +use this file except in compliance with the License. You may obtain a copy of +the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +License for the specific language governing permissions and limitations under +the License. +--> + +<form id="jump-to-doc" class="form-inline input-append" > + <input type="text" id="jump-to-doc-id" class="input-large" placeholder="Document ID"></input> + + <button class="fonticon-search btn button red " type="submit"></button> +</form> diff --git a/src/fauxton/app/addons/documents/templates/search.html b/src/fauxton/app/addons/documents/templates/search.html new file mode 100644 index 000000000..bb8489110 --- /dev/null +++ b/src/fauxton/app/addons/documents/templates/search.html @@ -0,0 +1,15 @@ +<!-- +Licensed under the Apache License, Version 2.0 (the "License"); you may not +use this file except in compliance with the License. You may obtain a copy of +the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +License for the specific language governing permissions and limitations under +the License. +--> + +<input id="searchbox" type="text" class="span12" placeholder="Search by doc id, view key or search index">
\ No newline at end of file diff --git a/src/fauxton/app/addons/documents/templates/sidebar.html b/src/fauxton/app/addons/documents/templates/sidebar.html new file mode 100644 index 000000000..8a73ae9a3 --- /dev/null +++ b/src/fauxton/app/addons/documents/templates/sidebar.html @@ -0,0 +1,67 @@ +<!-- +Licensed under the Apache License, Version 2.0 (the "License"); you may not +use this file except in compliance with the License. You may obtain a copy of +the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +License for the specific language governing permissions and limitations under +the License. +--> + +<div id="sidenav"> + <header class="row-fluid"> + <div class="span12"> + <div class="btn-group"> + <button class="btn dropdown-toggle dropdown-toggle-btn" data-toggle="dropdown"> + Docs + <span class="caret"></span> + </button> + <ul class="dropdown-menu"> + <!-- dropdown menu links --> + <li><a class="icon-file" href="<%= db_url %>">Docs</a></li> + <li><a class="icon-lock" href="<%= permissions_url %>">Permissions</a></li> + <li><a class="icon-forward" href="<%= changes_url %>">Changes</a></li> + <% _.each(docLinks, function (link) { %> + <li><a class="<%= link.icon %>" href="<%= database_url + '/' + link.url %>"><%= link.title %></a></li> + <% }); %> + </ul> + </div> + + <div class="btn-group"> + <button class="btn dropdown-toggle dropdown-toggle-btn" data-toggle="dropdown"> + New + <span class="caret"></span> + </button> + <ul class="dropdown-menu"> + <!-- dropdown menu links --> + <li> + <a id="doc" href="#<%= database.url('app') %>/new">Document</a> + </li> + <li> + <a href="#<%= database.url('app') %>/new_view">Secondary Index</a> + <% _.each(newLinks, function (item) { %> + <a href="#<%= database.url('app') %>/<%=item.url%>"> <%= item.name %></a> + <% }); %> + </li> + </ul> + </div> + <button id="delete-database" class="btn"><i class="icon-trash"></i> Database</button> + </div> + </header> + + <nav> + <ul class="nav nav-list"> + <li class="active"><a id="all-docs" href="#<%= database.url('index') %>?limit=<%= docLimit %>" class="toggle-view"> All documents</a></li> + <li><a id="design-docs" href='#<%= database.url("index") %>?limit=<%= docLimit %>&startkey="_design"&endkey="_e"' class="toggle-view"> All design docs</a></li> + </ul> + <ul class="nav nav-list views"> + <li class="nav-header">Secondary Indexes</li> + <li><a id="new-view" href="#<%= database.url('app') %>/new_view" class="new"><i class="icon-plus"></i> New</a></li> + </ul> + <div id="extension-navs"></div> + </nav> +</div> diff --git a/src/fauxton/app/addons/documents/templates/tabs.html b/src/fauxton/app/addons/documents/templates/tabs.html new file mode 100644 index 000000000..f8b0c4b44 --- /dev/null +++ b/src/fauxton/app/addons/documents/templates/tabs.html @@ -0,0 +1,18 @@ +<!-- +Licensed under the Apache License, Version 2.0 (the "License"); you may not +use this file except in compliance with the License. You may obtain a copy of +the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +License for the specific language governing permissions and limitations under +the License. +--> + +<ul class="nav nav-tabs"> + <li class="active"><a href="<%= db_url %>">Docs</a></li> + <li id="changes"><a href="<%= changes_url %>">Changes</a></li> +</ul> diff --git a/src/fauxton/app/addons/documents/templates/upload_modal.html b/src/fauxton/app/addons/documents/templates/upload_modal.html new file mode 100644 index 000000000..9a5c5cd82 --- /dev/null +++ b/src/fauxton/app/addons/documents/templates/upload_modal.html @@ -0,0 +1,42 @@ +<!-- +Licensed under the Apache License, Version 2.0 (the "License"); you may not +use this file except in compliance with the License. You may obtain a copy of +the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +License for the specific language governing permissions and limitations under +the License. +--> + +<div class="modal hide fade"> + <div class="modal-header"> + <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> + <h3>Upload an Attachment</h3> + </div> + <div class="modal-body"> + <div id="modal-error" class="alert alert-error hide" style="font-size: 16px;"> </div> + <form id="file-upload" class="form" method="post"> + <p class="help-block"> + Please select the file you want to upload as an attachment to this document. + Please note that this will result in the immediate creation of a new revision of the document, + so it's not necessary to save the document after the upload. + </p> + <input id="_attachments" type="file" name="_attachments"> + <input id="_rev" type="hidden" name="_rev" value="" > + <br/> + </form> + + <div class="progress progress-info"> + <div class="bar" style="width: 0%"></div> + </div> + </div> + <div class="modal-footer"> + <a href="#" data-dismiss="modal" data-bypass="true" class="btn button cancel-button outlineGray fonticon-circle-x">Cancel</a> + <a href="#" id="upload-btn" data-bypass="true" class="btn btn-primary button green save fonticon-circle-check">Upload</a> + </div> +</div> + diff --git a/src/fauxton/app/addons/documents/templates/view_editor.html b/src/fauxton/app/addons/documents/templates/view_editor.html new file mode 100644 index 000000000..ddb5a0cb9 --- /dev/null +++ b/src/fauxton/app/addons/documents/templates/view_editor.html @@ -0,0 +1,87 @@ +<!-- +Licensed under the Apache License, Version 2.0 (the "License"); you may not +use this file except in compliance with the License. You may obtain a copy of +the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +License for the specific language governing permissions and limitations under +the License. +--> +<div class="row"> + <ul class="nav nav-tabs" id="db-views-tabs-nav"> + <li class="active"> <a data-bypass="true" id="index-nav" class="fonticon-wrench fonticon" data-toggle="tab" href="#index"><% if (newView) { %>Create Index <% } else { %>Edit Index <% } %></a></li> + <% if (!newView) { %> + <li><a data-bypass="true" id="query-nav" class="fonticon-plus fonticon" href="#query" data-toggle="tab">Query Options</a></li> + <li><a data-bypass="true" id="meta-nav" href="#metadata" data-toggle="tab">Design Doc Metadata</a></li> + <% } %> + </ul> + <div class="all-docs-list errors-container"></div> + <div class="tab-content"> + <div class="tab-pane active" id="index"> + <div id="define-view" class="ddoc-alert well"> + <div class="errors-container"></div> + <form class="form-horizontal view-query-save"> + + <div class="control-group design-doc-group"> + </div> + + <div class="control-group"> + <label for="index-name">Index name <a href="<%=getDocUrl('view_functions')%>" target="_blank"><i class="icon-question-sign"></i></a></label> + <input type="text" id="index-name" value="<%= viewName %>" placeholder="Index name" /> + </div> + + + <div class="control-group"> + <label for="map-function">Map function <a href="<%=getDocUrl('map_functions')%>" target="_blank"><i class="icon-question-sign"></i></a></label> + <% if (newView) { %> + <div class="js-editor" id="map-function"><%= langTemplates.map %></div> + <% } else { %> + <div class="js-editor" id="map-function"><%- ddoc.get('views')[viewName].map %></div> + <% } %> + </div> + + + <div class="control-group"> + <label for="reduce-function-selector">Reduce (optional) <a href="<%=getDocUrl('reduce_functions')%>" target="_blank"><i class="icon-question-sign"></i></a></label> + + <select id="reduce-function-selector"> + <option value="" <%= !reduceFunStr ? 'selected="selected"' : '' %>>None</option> + <% _.each(["_sum", "_count", "_stats"], function(reduce) { %> + <option value="<%= reduce %>" <% if (reduce == reduceFunStr) { %>selected<% } %>><%= reduce %></option> + <% }) %> + <option value="CUSTOM" <% if (isCustomReduce) { %>selected<% } %>>Custom Reduce function</option> + </select> + </div> + + <div class="control-group reduce-function"> + <label for="reduce-function">Custom Reduce function</label> + <% if (newView) { %> + <div class="js-editor" id="reduce-function"><%= langTemplates.reduce %></div> + <% } else { %> + <div class="js-editor" id="reduce-function"><%- ddoc.get('views')[viewName].reduce %></div> + <% } %> + </div> + + <div class="control-group"> + <button class="button green save fonticon-circle-check">Save & Build Index</button> + <button class="button btn-info preview">Preview</button> + <% if (!newView) { %> + <button class="button delete outlineGray fonticon-circle-x">Delete</button> + <% } %> + </div> + <div class="clearfix"></div> + </form> + </div> + </div> + <div class="tab-pane" id="metadata"> + <div id="ddoc-info" class="well"> </div> + </div> + <div class="tab-pane" id="query"> + </div> + </div> +</div> + diff --git a/src/fauxton/app/modules/documents/tests/resourcesSpec.js b/src/fauxton/app/addons/documents/tests/resourcesSpec.js index e848221ff..380a4e4fc 100644 --- a/src/fauxton/app/modules/documents/tests/resourcesSpec.js +++ b/src/fauxton/app/addons/documents/tests/resourcesSpec.js @@ -10,7 +10,7 @@ // License for the specific language governing permissions and limitations under // the License. define([ - 'modules/documents/resources', + 'addons/documents/resources', 'testUtils' ], function (Models, testUtils) { var assert = testUtils.assert; diff --git a/src/fauxton/app/modules/documents/views.js b/src/fauxton/app/addons/documents/views.js index 59aba0152..97d58e3e0 100644 --- a/src/fauxton/app/modules/documents/views.js +++ b/src/fauxton/app/addons/documents/views.js @@ -14,11 +14,11 @@ define([ "app", "api", - "modules/fauxton/components", + "addons/fauxton/components", - "modules/documents/resources", - "modules/databases/resources", - "modules/pouchdb/base", + "addons/documents/resources", + "addons/databases/resources", + "addons/pouchdb/base", // Libs "resizeColumns", diff --git a/src/fauxton/app/modules/fauxton/base.js b/src/fauxton/app/addons/fauxton/base.js index cf6305c30..aa4c3d4e0 100644 --- a/src/fauxton/app/modules/fauxton/base.js +++ b/src/fauxton/app/addons/fauxton/base.js @@ -12,19 +12,19 @@ define([ "app", - // Libs + // Libs "backbone", - "resizeColumns" - + "resizeColumns", ], function(app, Backbone, resizeColumns) { - //resizeAnimation - app.resizeColumns = new resizeColumns({}); - app.resizeColumns.onResizeHandler(); - var Fauxton = app.module(); + //resizeAnimation + app.resizeColumns = new resizeColumns({}); + app.resizeColumns.onResizeHandler(); + + var Fauxton = {}; Fauxton.Breadcrumbs = Backbone.View.extend({ template: "templates/fauxton/breadcrumbs", @@ -100,10 +100,6 @@ function(app, Backbone, resizeColumns) { } else { this.navLinks.push(link); } - - //this.trigger("link:add"); - - //this.render(); }, removeLink: function (removeLink) { diff --git a/src/fauxton/app/modules/fauxton/components.js b/src/fauxton/app/addons/fauxton/components.js index a9f45addb..a9f45addb 100644 --- a/src/fauxton/app/modules/fauxton/components.js +++ b/src/fauxton/app/addons/fauxton/components.js diff --git a/src/fauxton/app/modules/fauxton/layout.js b/src/fauxton/app/addons/fauxton/layout.js index 14222414b..14222414b 100644 --- a/src/fauxton/app/modules/fauxton/layout.js +++ b/src/fauxton/app/addons/fauxton/layout.js diff --git a/src/fauxton/app/addons/fauxton/templates/api_bar.html b/src/fauxton/app/addons/fauxton/templates/api_bar.html new file mode 100644 index 000000000..1f03a2c08 --- /dev/null +++ b/src/fauxton/app/addons/fauxton/templates/api_bar.html @@ -0,0 +1,30 @@ +<!-- +Licensed under the Apache License, Version 2.0 (the "License"); you may not +use this file except in compliance with the License. You may obtain a copy of +the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +License for the specific language governing permissions and limitations under +the License. +--> + +<button class="button api-url-btn"> + API URL + <span class="fonticon-plus icon"></span> +</button> +<div class="api-navbar" style="display: none"> + <div class="input-prepend input-append"> + <span class="add-on"> + API reference + <a href="<%=getDocUrl(documentation)%>" target="_blank"> + <i class="icon-question-sign"></i> + </a> + </span> + <input type="text" class="input-xxlarge" value="<%= endpoint %>"> + <a href="<%= endpoint %>" target="_blank" class="btn">Show me</a> + </div> +</div> diff --git a/src/fauxton/app/addons/fauxton/templates/breadcrumbs.html b/src/fauxton/app/addons/fauxton/templates/breadcrumbs.html new file mode 100644 index 000000000..026db89fb --- /dev/null +++ b/src/fauxton/app/addons/fauxton/templates/breadcrumbs.html @@ -0,0 +1,24 @@ +<!-- +Licensed under the Apache License, Version 2.0 (the "License"); you may not +use this file except in compliance with the License. You may obtain a copy of +the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +License for the specific language governing permissions and limitations under +the License. +--> + +<ul class="breadcrumb"> + <% _.each(_.initial(crumbs), function(crumb) { %> + <li> + <a href="#<%= crumb.link %>"><%= crumb.name %></a> + <span class="divider fonticon fonticon-carrot"> </span> + </li> + <% }); %> + <% var last = _.last(crumbs) || {name: ''} %> + <li class="active"><%= last.name %></li> +</ul> diff --git a/src/fauxton/app/addons/fauxton/templates/footer.html b/src/fauxton/app/addons/fauxton/templates/footer.html new file mode 100644 index 000000000..593c11f38 --- /dev/null +++ b/src/fauxton/app/addons/fauxton/templates/footer.html @@ -0,0 +1,15 @@ +<!-- +Licensed under the Apache License, Version 2.0 (the "License"); you may not +use this file except in compliance with the License. You may obtain a copy of +the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +License for the specific language governing permissions and limitations under +the License. +--> + +<p>Fauxton on <a href="http://couchdb.apache.org/">Apache CouchDB</a> <%=version%></p> diff --git a/src/fauxton/app/addons/fauxton/templates/index_pagination.html b/src/fauxton/app/addons/fauxton/templates/index_pagination.html new file mode 100644 index 000000000..f445377d8 --- /dev/null +++ b/src/fauxton/app/addons/fauxton/templates/index_pagination.html @@ -0,0 +1,24 @@ +<!-- +Licensed under the Apache License, Version 2.0 (the "License"); you may not +use this file except in compliance with the License. You may obtain a copy of +the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +License for the specific language governing permissions and limitations under +the License. +--> + +<div class="pagination pagination-centered"> + <ul> + <li <% if (!canShowPreviousfn()) {%> class="disabled" <% } %>> + <a id="previous" href="#"> Previous </a> + </li> + <li <% if (!canShowNextfn()) {%> class="disabled" <% } %>> + <a id="next" href="#"> Next </a></li> + </ul> +</div> + diff --git a/src/fauxton/app/addons/fauxton/templates/nav_bar.html b/src/fauxton/app/addons/fauxton/templates/nav_bar.html new file mode 100644 index 000000000..da030d6f7 --- /dev/null +++ b/src/fauxton/app/addons/fauxton/templates/nav_bar.html @@ -0,0 +1,75 @@ +<!-- +Licensed under the Apache License, Version 2.0 (the "License"); you may not +use this file except in compliance with the License. You may obtain a copy of +the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +License for the specific language governing permissions and limitations under +the License. +--> + +<div class="brand"> + <div class="burger"> + <div><!-- * --></div> + <div><!-- * --></div> + <div><!-- * --></div> + </div> + <div class="icon">Apache Fauxton</div> +</div> + +<nav id="main_navigation"> + <ul id="nav-links" class="nav pull-right"> + <% _.each(navLinks, function(link) { %> + <% if (link.view) {return;} %> + <li data-nav-name= "<%= link.title %>" > + <a href="<%= link.href %>"> + <span class="<%= link.icon %> fonticon"></span> + <%= link.title %> + </a> + </li> + <% }); %> + </ul> + + <div id="footer-links"> + + <ul id="bottom-nav-links" class="nav"> + <li data-nav-name= "Documentation"> + <a href="<%=getDocUrl('docs')%>" target="_blank"> + <span class="fonticon-bookmark fonticon"></span> + Documentation + </a> + </li> + + + <% _.each(bottomNavLinks, function(link) { %> + <% if (link.view) {return;} %> + <li data-nav-name= "<%= link.title %>"> + <a href="<%= link.href %>"> + <span class="<%= link.icon %> fonticon"></span> + <%= link.title %> + </a> + </li> + <% }); %> + </ul> + + <ul id="footer-nav-links" class="nav"> + <% _.each(footerNavLinks, function(link) { %> + <% if (link.view) {return;} %> + <li data-nav-name= "<%= link.title %>"> + <a href="<%= link.href %>"> + <span class="<%= link.icon %> fonticon"></span> + <%= link.title %> + </a> + </li> + <% }); %> + </ul> + + </div> +</nav> + + + diff --git a/src/fauxton/app/addons/fauxton/templates/notification.html b/src/fauxton/app/addons/fauxton/templates/notification.html new file mode 100644 index 000000000..ca8a9033a --- /dev/null +++ b/src/fauxton/app/addons/fauxton/templates/notification.html @@ -0,0 +1,18 @@ +<!-- +Licensed under the Apache License, Version 2.0 (the "License"); you may not +use this file except in compliance with the License. You may obtain a copy of +the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +License for the specific language governing permissions and limitations under +the License. +--> + +<div class="alert alert-<%= type %>"> + <button type="button" class="close" data-dismiss="alert">×</button> + <%= msg %> +</div> diff --git a/src/fauxton/app/addons/fauxton/templates/pagination.html b/src/fauxton/app/addons/fauxton/templates/pagination.html new file mode 100644 index 000000000..19dfc8cfd --- /dev/null +++ b/src/fauxton/app/addons/fauxton/templates/pagination.html @@ -0,0 +1,31 @@ +<!-- +Licensed under the Apache License, Version 2.0 (the "License"); you may not +use this file except in compliance with the License. You may obtain a copy of +the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +License for the specific language governing permissions and limitations under +the License. +--> + +<div class="pagination pagination-centered"> + <ul> + <% if (page > 1) { %> + <li> <a href="<%= urlFun(page-1) %>">«</a></li> + <% } else { %> + <li class="disabled"> <a href="<%= urlFun(page) %>">«</a></li> + <% } %> + <% _.each(_.range(1, totalPages+1), function(i) { %> + <li <% if (page == i) { %>class="active"<% } %>> <a href="<%= urlFun(i) %>"><%= i %></a></li> + <% }) %> + <% if (page < totalPages) { %> + <li><a href="<%= urlFun(page+1) %>">»</a></li> + <% } else { %> + <li class="disabled"> <a href="<%= urlFun(page) %>">»</a></li> + <% } %> + </ul> +</div> diff --git a/src/fauxton/app/addons/permissions/routes.js b/src/fauxton/app/addons/permissions/routes.js index 89c2bd742..0e9fa5254 100644 --- a/src/fauxton/app/addons/permissions/routes.js +++ b/src/fauxton/app/addons/permissions/routes.js @@ -13,7 +13,7 @@ define([ "app", "api", - "modules/databases/base", + "addons/databases/base", "addons/permissions/views" ], function (app, FauxtonAPI, Databases, Permissions) { diff --git a/src/fauxton/app/modules/pouchdb/base.js b/src/fauxton/app/addons/pouchdb/base.js index ee323a766..df6c7267a 100644 --- a/src/fauxton/app/modules/pouchdb/base.js +++ b/src/fauxton/app/addons/pouchdb/base.js @@ -11,11 +11,11 @@ define([ "api", // Modules - "modules/pouchdb/pouchdb.mapreduce.js" + "addons/pouchdb/pouchdb.mapreduce.js" ], function(app, FauxtonAPI, MapReduce) { - var Pouch = {}; + var Pouch = FauxtonAPI.addon(); Pouch.MapReduce = MapReduce; Pouch.runViewQuery = function(fun, opts) { diff --git a/src/fauxton/app/modules/pouchdb/pouch.collate.js b/src/fauxton/app/addons/pouchdb/pouch.collate.js index 7cc5f9cfe..6c64410db 100644 --- a/src/fauxton/app/modules/pouchdb/pouch.collate.js +++ b/src/fauxton/app/addons/pouchdb/pouch.collate.js @@ -21,7 +21,7 @@ define([ "api", // Modules - "modules/pouchdb/pouch.collate.js" + "addons/pouchdb/pouch.collate.js" ], function(app, FauxtonAPI, Collate) { diff --git a/src/fauxton/app/modules/pouchdb/pouchdb.mapreduce.js b/src/fauxton/app/addons/pouchdb/pouchdb.mapreduce.js index a2d0b91b5..224a6f66f 100644 --- a/src/fauxton/app/modules/pouchdb/pouchdb.mapreduce.js +++ b/src/fauxton/app/addons/pouchdb/pouchdb.mapreduce.js @@ -29,7 +29,7 @@ define([ "api", // Modules - "modules/pouchdb/pouch.collate.js" + "addons/pouchdb/pouch.collate.js" ], function(app, FauxtonAPI, Collate) { diff --git a/src/fauxton/app/addons/replication/views.js b/src/fauxton/app/addons/replication/views.js index f4b96fd40..1b31a9d9e 100644 --- a/src/fauxton/app/addons/replication/views.js +++ b/src/fauxton/app/addons/replication/views.js @@ -13,7 +13,7 @@ define([ "app", "api", - "modules/fauxton/components", + "addons/fauxton/components", "addons/replication/resources" ], function(app, FauxtonAPI, Components, replication) { diff --git a/src/fauxton/app/addons/stats/resources.js b/src/fauxton/app/addons/stats/resources.js index a761e6be0..b3c4ce108 100644 --- a/src/fauxton/app/addons/stats/resources.js +++ b/src/fauxton/app/addons/stats/resources.js @@ -15,7 +15,7 @@ define([ "api", "backbone", "lodash", - "modules/fauxton/base" + "addons/fauxton/base" ], function (app, FauxtonAPI, backbone, _, Fauxton) { diff --git a/src/fauxton/app/addons/verifyinstall/resources.js b/src/fauxton/app/addons/verifyinstall/resources.js index 5d83f9a0c..8a98883f9 100644 --- a/src/fauxton/app/addons/verifyinstall/resources.js +++ b/src/fauxton/app/addons/verifyinstall/resources.js @@ -13,8 +13,8 @@ define([ "app", "api", - "modules/databases/resources", - "modules/documents/resources" + "addons/databases/resources", + "addons/documents/resources" ], function (app, FauxtonAPI, Databases, Documents) { diff --git a/src/fauxton/app/api.js b/src/fauxton/app/api.js index 5ad032a68..c9d08bf94 100644 --- a/src/fauxton/app/api.js +++ b/src/fauxton/app/api.js @@ -14,7 +14,7 @@ define([ "app", // Modules - "modules/fauxton/base", + "addons/fauxton/base", "spin" ], diff --git a/src/fauxton/app/app.js b/src/fauxton/app/app.js index 0a51410ef..9ac5bc2d5 100644 --- a/src/fauxton/app/app.js +++ b/src/fauxton/app/app.js @@ -22,6 +22,8 @@ define([ "helpers", "mixins", + // Modules + "resizeColumns", // Plugins. "plugins/backbone.layoutmanager", @@ -29,7 +31,7 @@ define([ ], -function(app, $, _, Backbone, Bootstrap, Helpers, Mixins) { +function(app, $, _, Backbone, Bootstrap, Helpers, Mixins, resizeColumns) { // Make sure we have a console.log if (typeof console == "undefined") { @@ -81,6 +83,10 @@ function(app, $, _, Backbone, Bootstrap, Helpers, Mixins) { } }); + //resizeAnimation + app.resizeColumns = new resizeColumns({}); + app.resizeColumns.onResizeHandler(); + // Localize or create a new JavaScript Template object. var JST = window.JST = window.JST || {}; diff --git a/src/fauxton/app/router.js b/src/fauxton/app/router.js index e3a1636aa..7cf69ade0 100644 --- a/src/fauxton/app/router.js +++ b/src/fauxton/app/router.js @@ -25,27 +25,14 @@ define([ "api", // Modules - "modules/fauxton/base", + "addons/fauxton/base", // Layout - "modules/fauxton/layout", - - // Routes return the module that they define routes for - "modules/databases/base", - "modules/documents/base", - "modules/pouchdb/base", - - - // this needs to be added as a plugin later - // "modules/logs/base", - // "modules/config/base", + "addons/fauxton/layout", "load_addons" ], -function(req, app, Initialize, FauxtonAPI, Fauxton, Layout, Databases, Documents, Pouch, LoadAddons) { - - // TODO: auto generate this list if possible - var modules = [Databases, Documents]; +function(req, app, Initialize, FauxtonAPI, Fauxton, Layout, LoadAddons) { var beforeUnloads = {}; @@ -106,11 +93,6 @@ function(req, app, Initialize, FauxtonAPI, Fauxton, Layout, Databases, Documents }, setModuleRoutes: function() { - _.each(modules, function(module) { - if (module){ - _.each(module.RouteObjects, this.addModuleRouteObject, this); - } - }, this); _.each(LoadAddons.addons, function(module) { if (module){ module.initialize(); @@ -122,21 +104,6 @@ function(req, app, Initialize, FauxtonAPI, Fauxton, Layout, Databases, Documents }, this); }, - /*setAddonHooks: function() { - _.each(LoadAddons.addons, function(module) { - // This is updates to views by the addon - if (module && module.hooks){ - _.each(module.hooks, function(callback, route){ - if (this.masterLayout.hooks[route]) { - this.masterLayout.hooks[route].push(callback); - } else { - this.masterLayout.hooks[route] = [callback]; - } - }, this); - } - }, this); - },*/ - initialize: function() { //TODO: It would be nice to handle this with a router this.navBar = app.navBar = new Fauxton.NavBar(); diff --git a/src/fauxton/settings.json.default b/src/fauxton/settings.json.default index ad7e6b5a7..cb09eb2e1 100644 --- a/src/fauxton/settings.json.default +++ b/src/fauxton/settings.json.default @@ -1,5 +1,8 @@ { "deps": [ + { "name": "databases" }, + { "name": "documents" }, + { "name": "pouchdb" }, { "name": "activetasks" }, { "name": "config" }, { "name": "logs" }, |