You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by de...@apache.org on 2014/08/06 21:31:23 UTC
[16/26] fauxton commit: updated refs/heads/secondary-indexes to
7a446d8
Ripping out views into it's own addon
Project: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/commit/2ad683c8
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/tree/2ad683c8
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/diff/2ad683c8
Branch: refs/heads/secondary-indexes
Commit: 2ad683c80622ed199536d5c76444a1cd337e2270
Parents: ccc4c92
Author: deathbearbrown <de...@gmail.com>
Authored: Tue Jul 22 16:40:06 2014 -0400
Committer: deathbearbrown <de...@gmail.com>
Committed: Wed Aug 6 12:24:46 2014 -0400
----------------------------------------------------------------------
app/addons/documents/templates/view_editor.html | 91 --------------------
app/addons/indexes/routes-filter.js | 47 ++++++++++
.../indexes/templates/design_doc_selector.html | 43 ++++-----
3 files changed, 69 insertions(+), 112 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/2ad683c8/app/addons/documents/templates/view_editor.html
----------------------------------------------------------------------
diff --git a/app/addons/documents/templates/view_editor.html b/app/addons/documents/templates/view_editor.html
index 769deed..e69de29 100644
--- a/app/addons/documents/templates/view_editor.html
+++ b/app/addons/documents/templates/view_editor.html
@@ -1,91 +0,0 @@
-<!--
-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="dashboard-upper-menu">
- <ul class="nav nav-tabs" id="db-views-tabs-nav">
- <li class="active"> <a data-bypass="true" id="index-nav" data-toggle="tab" href="#index">
- <i class="fonticon-wrench fonticon"></i>
- <% if (newView) { %>Create Index <% } else { %>Edit Index <% } %></a></li>
- <% if (!newView) { %>
- <li><a data-bypass="true" id="query-nav" href="#query" data-toggle="tab">
- <i class="fonticon-plus fonticon"></i> Query Options</a>
- </li>
- <% } %>
- </ul>
-</div>
- <div class="all-docs-list errors-container"></div>
- <div class="tab-content">
- <div id="query-options-wrapper"></div>
- <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 class="help-link" data-bypass="true" 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 class="help-link" data-bypass="true" 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>
- <button class="beautify beautify_map btn btn-primary btn-large hide beautify-tooltip" type="button" data-toggle="tooltip" title="Reformat your minified code to make edits to it.">beautify this code</button>
- <% } %>
- </div>
-
-
- <div class="control-group">
- <label for="reduce-function-selector">Reduce (optional) <a class="help-link" data-bypass="true" 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>
- <button class="beautify beautify_reduce btn btn-primary btn-large hide beautify-tooltip" type="button" data-toggle="tooltip" title="Reformat your minified code to make edits to it.">beautify this code</button>
- <% } %>
- </div>
-
- <div class="control-group">
- <button class="btn btn-success save"><i class="icon fonticon-ok-circled"></i> Save & Build Index</button>
- <% if (!newView) { %>
- <button class="btn btn-danger delete"><i class="icon fonticon-cancel-circled"></i> 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>
http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/2ad683c8/app/addons/indexes/routes-filter.js
----------------------------------------------------------------------
diff --git a/app/addons/indexes/routes-filter.js b/app/addons/indexes/routes-filter.js
new file mode 100644
index 0000000..492b014
--- /dev/null
+++ b/app/addons/indexes/routes-filter.js
@@ -0,0 +1,47 @@
+// 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.
+define([
+ "app",
+ "api",
+ "addons/databases/base",
+ "addons/indexes/views",
+ "addons/documents/views",
+ "addons/indexes/resources"
+],
+
+function (app, FauxtonAPI, Databases, Views, Documents, Resources) {
+
+ var FilterIndexes = FauxtonAPI.RouteObject.extend({
+ layout: "two_pane",
+ routes: {
+ "database/:database/_design/:ddoc/_filters/:fn": {
+ route: "tempFn",
+ roles: ['_admin']
+ },
+ "database/:database/new_filter": "newFilterEditor",
+ "database/:database/new_filter/:designDoc": "newFilterEditor"
+ },
+ newFilterEditor: function(){
+ return false;
+ },
+ tempFn: function(databaseName, ddoc, fn){
+ this.setView("#dashboard-upper-content", new Documents.Views.temp({}));
+ this.crumbs = function () {
+ return [
+ {"name": this.data.database.id, "link": Databases.databaseUrl(this.data.database)},
+ ];
+ };
+ }
+ });
+
+ return FilterIndexes;
+});
http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/2ad683c8/app/addons/indexes/templates/design_doc_selector.html
----------------------------------------------------------------------
diff --git a/app/addons/indexes/templates/design_doc_selector.html b/app/addons/indexes/templates/design_doc_selector.html
index e5ceedc..98abc46 100644
--- a/app/addons/indexes/templates/design_doc_selector.html
+++ b/app/addons/indexes/templates/design_doc_selector.html
@@ -11,27 +11,28 @@ WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
License for the specific language governing permissions and limitations under
the License.
-->
- <label for="ddoc">Save to Design Document <a class="help-link" data-bypass="true" href="<%-getDocUrl('design_doc')%>" target="_blank"><i class="icon-question-sign"></i></a></label>
- <div class="row-fluid new-ddoc">
- <div class="select-wrapper span5">
- <select id="ddoc">
- <optgroup label="Select a document">
- <option value="new-doc">New document</option>
+<div class="span3">
+ <label for="ddoc">Save to Design Document <a class="help-link" 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) { %>
- <%= ddoc.id %>
- <%= ddocName %>
- <% if (ddoc.id === ddocName) { %>
- <option selected="selected" value="<%- ddoc.id %>"><%- ddoc.id %></option>
- <% } else { %>
- <option value="<%- ddoc.id %>"><%- ddoc.id %></option>
- <% } %>
- <% }); %>
- </optgroup>
- </select>
- <i></i>
- </div>
+ <% ddocs.each(function(ddoc) { %>
+ <%= ddoc.id %>
+ <%= ddocName %>
+ <% if (ddoc.id === ddocName) { %>
+ <option selected="selected" value="<%- ddoc.id %>"><%- ddoc.id %></option>
+ <% } else { %>
+ <option value="<%- ddoc.id %>"><%- ddoc.id %></option>
+ <% } %>
+ <% }); %>
+ </optgroup>
+ </select>
+</div>
- <input type="text" id="new-ddoc" class="span7" style="display:none" placeholder="Enter a design doc name" />
+<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>
\ No newline at end of file