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/04 20:56:04 UTC
fauxton commit: updated refs/heads/secondary-indexes to 789cc12
Repository: couchdb-fauxton
Updated Branches:
refs/heads/secondary-indexes a9f3e2646 -> 789cc125f
design doc ui
Project: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/commit/789cc125
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/tree/789cc125
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/diff/789cc125
Branch: refs/heads/secondary-indexes
Commit: 789cc125f503c383aed2b0cea7e26afbc4017e23
Parents: a9f3e26
Author: deathbearbrown <de...@gmail.com>
Authored: Mon Aug 4 14:56:07 2014 -0400
Committer: deathbearbrown <de...@gmail.com>
Committed: Mon Aug 4 14:56:07 2014 -0400
----------------------------------------------------------------------
app/addons/fauxton/base.js | 5 +-
app/addons/fauxton/components.js | 5 +-
app/addons/indexes/assets/less/index-form.less | 45 ++++++-
app/addons/indexes/routes-viewindexes.js | 1 +
.../indexes/templates/design_doc_selector.html | 41 ++++---
app/addons/indexes/views.js | 119 +++++++++----------
6 files changed, 124 insertions(+), 92 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/789cc125/app/addons/fauxton/base.js
----------------------------------------------------------------------
diff --git a/app/addons/fauxton/base.js b/app/addons/fauxton/base.js
index 57530b9..71a09b3 100644
--- a/app/addons/fauxton/base.js
+++ b/app/addons/fauxton/base.js
@@ -14,11 +14,10 @@ define([
"app",
"api",
"addons/fauxton/resizeColumns",
- "addons/fauxton/components",
- "plugins/zeroclipboard/ZeroClipboard"
+ "addons/fauxton/components"
],
-function(app, FauxtonAPI, resizeColumns, Components, ZeroClipboard) {
+function(app, FauxtonAPI, resizeColumns, Components) {
var Fauxton = FauxtonAPI.addon();
FauxtonAPI.addNotification = function (options) {
http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/789cc125/app/addons/fauxton/components.js
----------------------------------------------------------------------
diff --git a/app/addons/fauxton/components.js b/app/addons/fauxton/components.js
index 9899c39..0d06a0c 100644
--- a/app/addons/fauxton/components.js
+++ b/app/addons/fauxton/components.js
@@ -25,10 +25,11 @@ define([
// Libs
"api",
"ace_configuration",
- "spin"
+ "spin",
+ "plugins/zeroclipboard/ZeroClipboard"
],
-function(app, FauxtonAPI, ace, spin) {
+function(app, FauxtonAPI, ace, spin, ZeroClipboard) {
var Components = FauxtonAPI.addon();
http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/789cc125/app/addons/indexes/assets/less/index-form.less
----------------------------------------------------------------------
diff --git a/app/addons/indexes/assets/less/index-form.less b/app/addons/indexes/assets/less/index-form.less
index 09826e3..c07163b 100644
--- a/app/addons/indexes/assets/less/index-form.less
+++ b/app/addons/indexes/assets/less/index-form.less
@@ -15,13 +15,50 @@
border-bottom: 1px solid #D9D9D9;
border-top: 1px solid #fff;
margin: 0 0 0 1px;
- }
- input[type=text]{
- width: 100%;
- .border-radius(5px 5px 5px 5px);
+ > input[type=text]{
+ width: 100%;
+ .border-radius(5px 5px 5px 5px);
+ }
}
.js-editor {
border: 1px solid #ccc;
.border-radius(5px 5px 5px 5px);
}
}
+.input-prepend {
+ margin-left:0;
+}
+.new-ddoc {
+ .select-wrapper {
+ .border-radius(5px 0 0 5px);
+ margin-left:0;
+ overflow: hidden;
+ border: 1px solid #d0cdc6;
+ position: relative;
+ select {
+ border: 0;
+ color: #000;
+ background: transparent;
+ font-size: 14px;
+ padding: 5px 10px;
+ -webkit-appearance: none;
+ -moz-appearance: window;
+ height: 44px;
+ }
+ i {
+ position: absolute;
+ right: 20px;
+ top: 16px;
+ display: block;
+ color: #000;
+ width: 0;
+ height: 0;
+ border-style: solid;
+ border-width: 10px 7.5px 0 7.5px;
+ border-color: #000000 transparent transparent transparent;
+ }
+ }
+ input[type=text]{
+ .border-radius(0px 5px 5px 0);
+ }
+}
http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/789cc125/app/addons/indexes/routes-viewindexes.js
----------------------------------------------------------------------
diff --git a/app/addons/indexes/routes-viewindexes.js b/app/addons/indexes/routes-viewindexes.js
index 571a9cd..0b4caac 100644
--- a/app/addons/indexes/routes-viewindexes.js
+++ b/app/addons/indexes/routes-viewindexes.js
@@ -27,6 +27,7 @@ function (app, FauxtonAPI, Databases, Views, Documents, Resources, RouteCore) {
route: "viewFn",
roles: ['_admin']
},
+ "database/:database/new_view": "newViewEditor",
"database/:database/new_view/:designDoc": "newViewEditor"
},
http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/789cc125/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 d12cd64..e5ceedc 100644
--- a/app/addons/indexes/templates/design_doc_selector.html
+++ b/app/addons/indexes/templates/design_doc_selector.html
@@ -11,28 +11,27 @@ 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 class="help-link" data-bypass="true" 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>
+ <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>
- <% 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>
+ <% 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>
-<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" />
+ <input type="text" id="new-ddoc" class="span7" style="display:none" placeholder="Enter a design doc name" />
</div>
-</div>
+
http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/789cc125/app/addons/indexes/views.js
----------------------------------------------------------------------
diff --git a/app/addons/indexes/views.js b/app/addons/indexes/views.js
index 345ce80..2ef57ff 100644
--- a/app/addons/indexes/views.js
+++ b/app/addons/indexes/views.js
@@ -34,17 +34,64 @@ function(app, FauxtonAPI, Components, Documents, Databases, pouchdb,
var Views = {};
- //Index view CORE extend this
- Views.IndexCore = FauxtonAPI.View.extend({
- langTemplates: {
- "javascript": {
- map: "function(doc) {\n emit(doc._id, 1);\n}",
- reduce: "function(keys, values, rereduce){\n if (rereduce){\n return sum(values);\n } else {\n return values.length;\n }\n}"
- }
+ Views.IndexHeader = FauxtonAPI.View.extend({
+ template: "addons/indexes/templates/index_header"
+ });
+
+ Views.PreviewScreen = FauxtonAPI.View.extend({
+ template: "addons/indexes/templates/preview_screen",
+ className: "watermark-logo"
+ });
+
+
+ Views.Row = FauxtonAPI.View.extend({
+ template: "addons/indexes/templates/index_row_docular",
+ className: "doc-row",
+ events: {
+ "click button.delete": "destroy"
},
- defaultLang: "javascript",
+ destroy: function (event) {
+ event.preventDefault();
+
+ window.alert('Cannot delete a document generated from a view.');
+ },
+
+ beforeRender: function(){
+ var newLinks = [{
+ links: [{
+ title: 'Table',
+ icon: 'fonticon-table'
+ },{
+ title: 'JSON',
+ icon: 'fonticon-json'
+ }]
+ }];
+
+ this.insertView("#view-doc-menu", new Components.MenuDropDown({
+ icon: 'fonticon-drop-down-dots',
+ links: newLinks,
+ }));
+ },
+
+ serialize: function() {
+ return {
+ docID: this.model.get('id'),
+ doc: this.model,
+ url: this.model.url('app')
+ };
+ }
+ });
+
+
+/*
+ INDEX EDITORS____________________________________
+
+*/
+
+ //Index view CORE extend this
+ Views.IndexCore = FauxtonAPI.View.extend({
initialize: function(options) {
this.newView = options.newView || false;
this.ddocs = options.ddocs;
@@ -80,15 +127,6 @@ function(app, FauxtonAPI, Components, Documents, Databases, pouchdb,
}
});
- Views.IndexHeader = FauxtonAPI.View.extend({
- template: "addons/indexes/templates/index_header"
- });
-
- Views.PreviewScreen = FauxtonAPI.View.extend({
- template: "addons/indexes/templates/preview_screen",
- className: "watermark-logo"
- });
-
Views.ShowEditor = Views.IndexCore.extend({
template: "addons/indexes/templates/show_editor",
langTemplates: {
@@ -111,49 +149,6 @@ function(app, FauxtonAPI, Components, Documents, Databases, pouchdb,
- Views.Row = FauxtonAPI.View.extend({
- template: "addons/indexes/templates/index_row_docular",
- className: "doc-row",
- events: {
- "click button.delete": "destroy"
- },
-
- destroy: function (event) {
- event.preventDefault();
-
- window.alert('Cannot delete a document generated from a view.');
- },
-
- beforeRender: function(){
- var newLinks = [{
- links: [{
- title: 'Table',
- icon: 'fonticon-table'
- },{
- title: 'JSON',
- icon: 'fonticon-json'
- }]
- }];
-
- this.insertView("#view-doc-menu", new Components.MenuDropDown({
- icon: 'fonticon-drop-down-dots',
- links: newLinks,
- }));
- },
-
- serialize: function() {
- return {
- docID: this.model.get('id'),
- doc: this.model,
- url: this.model.url('app')
- };
- }
- });
-
-
-
-
-
Views.ViewEditor = FauxtonAPI.View.extend({
template: "addons/indexes/templates/view_editor",
@@ -632,9 +627,9 @@ function(app, FauxtonAPI, Components, Documents, Databases, pouchdb,
updateDesignDoc: function () {
if (this.newDesignDoc()) {
- this.$('#new-ddoc-section').show();
+ this.$('#new-ddoc').show();
} else {
- this.$('#new-ddoc-section').hide();
+ this.$('#new-ddoc').hide();
}
},