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:11 UTC

[04/26] fauxton commit: updated refs/heads/secondary-indexes to 7a446d8

fix new indexes


Project: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/commit/e528ed3c
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/tree/e528ed3c
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/diff/e528ed3c

Branch: refs/heads/secondary-indexes
Commit: e528ed3c3699010d6ecb4beb879d08a44d952593
Parents: dbdd1fe
Author: deathbearbrown <de...@gmail.com>
Authored: Mon Aug 4 11:08:09 2014 -0400
Committer: deathbearbrown <de...@gmail.com>
Committed: Wed Aug 6 12:23:53 2014 -0400

----------------------------------------------------------------------
 app/addons/documents/views-sidebar.js    |  2 +-
 app/addons/indexes/routes-list.js        |  5 ++--
 app/addons/indexes/routes-show.js        |  5 ++--
 app/addons/indexes/routes-viewindexes.js |  6 ++--
 app/addons/indexes/views.js              | 41 +++++++++++----------------
 5 files changed, 26 insertions(+), 33 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/e528ed3c/app/addons/documents/views-sidebar.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/views-sidebar.js b/app/addons/documents/views-sidebar.js
index 7ebe99a..63837e9 100644
--- a/app/addons/documents/views-sidebar.js
+++ b/app/addons/documents/views-sidebar.js
@@ -175,7 +175,7 @@ function(app, FauxtonAPI, Components, Documents, Databases) {
 
         menuLinks.push({
           title: link.title,
-          url: "#" + database.url('app') + "/_design/" + docSafe + "/" + link.url,
+          url: "#" + database.url('app') + "/" + link.url + "/" + docSafe,
           icon: 'fonticon-plus-circled'
         });
 

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/e528ed3c/app/addons/indexes/routes-list.js
----------------------------------------------------------------------
diff --git a/app/addons/indexes/routes-list.js b/app/addons/indexes/routes-list.js
index e7a2282..1245c24 100644
--- a/app/addons/indexes/routes-list.js
+++ b/app/addons/indexes/routes-list.js
@@ -28,7 +28,7 @@ function (app, FauxtonAPI, Databases, Views, Documents, Resources, RouteCore) {
         roles: ['_admin']
       },
       "database/:database/new_list": "newListsEditor",
-      "database/:database/_design/:designDoc/new_list": "newListsEditor"
+      "database/:database/new_list/:designDoc": "newListsEditor"
     },
 
     apiUrl: function() {
@@ -40,7 +40,8 @@ function (app, FauxtonAPI, Databases, Views, Documents, Resources, RouteCore) {
       var params = app.getParams();
 
       this.setView("#left-content", new Views.ListEditor({
-        currentddoc: "_design/"+designDoc || "",
+        model: this.data.database,
+        currentddoc: designDoc ? "_design/"+designDoc : "",
         ddocs: this.data.designDocs,
         params: params,
         database: this.data.database,

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/e528ed3c/app/addons/indexes/routes-show.js
----------------------------------------------------------------------
diff --git a/app/addons/indexes/routes-show.js b/app/addons/indexes/routes-show.js
index 9c9e451..10a3a56 100644
--- a/app/addons/indexes/routes-show.js
+++ b/app/addons/indexes/routes-show.js
@@ -28,14 +28,15 @@ function (app, FauxtonAPI, Databases, Views, Documents, Resources, RouteCore) {
         roles: ['_admin']
       },
       "database/:database/new_show": "newShowEditor",
-      "database/:database/_design/:designDoc/new_show": "newShowEditor"
+      "database/:database/new_show/:designDoc": "newShowEditor"
     },
 
     newShowEditor: function (database, designDoc) {
       var params = app.getParams();
 
       this.setView("#left-content", new Views.ShowEditor({
-        currentddoc: "_design/"+designDoc || "",
+        model: this.data.database,
+        currentddoc: designDoc ? "_design/"+designDoc : "",
         ddocs: this.data.designDocs,
         params: params,
         database: this.data.database,

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/e528ed3c/app/addons/indexes/routes-viewindexes.js
----------------------------------------------------------------------
diff --git a/app/addons/indexes/routes-viewindexes.js b/app/addons/indexes/routes-viewindexes.js
index 86006f3..571a9cd 100644
--- a/app/addons/indexes/routes-viewindexes.js
+++ b/app/addons/indexes/routes-viewindexes.js
@@ -27,8 +27,7 @@ function (app, FauxtonAPI, Databases, Views, Documents, Resources, RouteCore) {
         route: "viewFn",
         roles: ['_admin']
       },
-      "database/:database/new_view": "newViewEditor",
-      "database/:database/_design/:designDoc/new_view": "newViewEditor"
+      "database/:database/new_view/:designDoc": "newViewEditor"
     },
 
     newViewEditor: function (database, designDoc) {
@@ -37,7 +36,8 @@ function (app, FauxtonAPI, Databases, Views, Documents, Resources, RouteCore) {
       this.setView("#right-content", new Views.PreviewScreen({}));
 
       this.viewEditor = this.setView("#left-content", new Views.ViewEditor({
-        currentddoc: "_design/"+designDoc || "",
+        model: this.data.database,
+        currentddoc: designDoc ? "_design/"+designDoc : "",
         ddocs: this.data.designDocs,
         params: params,
         database: this.data.database,

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/e528ed3c/app/addons/indexes/views.js
----------------------------------------------------------------------
diff --git a/app/addons/indexes/views.js b/app/addons/indexes/views.js
index 73ed6ea..345ce80 100644
--- a/app/addons/indexes/views.js
+++ b/app/addons/indexes/views.js
@@ -51,10 +51,10 @@ function(app, FauxtonAPI, Components, Documents, Databases, pouchdb,
         this.params = options.params;
         this.database = options.database;
         this.currentDdoc = options.currentddoc;
-        if (this.newView) {
+      if (this.newView) {
         this.viewName = 'newView';
       } else {
-        this.ddocID = options.ddocInfo.id;
+        this.ddocID = options.ddocInfo ? options.ddocInfo.id : '';
         this.viewName = options.viewName;
         this.ddocInfo = new Documents.DdocInfo({_id: this.ddocID},{database: this.database});
       }
@@ -74,48 +74,39 @@ function(app, FauxtonAPI, Components, Documents, Databases, pouchdb,
         ddoc: this.model,
         ddocName: this.model.id,
         viewName: this.viewName,
-        reduceFunStr: this.reduceFunStr,
-        isCustomReduce: this.hasCustomReduce(),
         newView: this.newView,
         langTemplates: this.langTemplates.javascript
       };
     }
   });
 
-
-
-  Views.IndexHeader = Views.IndexCore.extend({
+  Views.IndexHeader = FauxtonAPI.View.extend({
     template: "addons/indexes/templates/index_header"
   });
 
-  Views.PreviewScreen = Views.IndexCore.extend({
+  Views.PreviewScreen = FauxtonAPI.View.extend({
     template: "addons/indexes/templates/preview_screen",
     className: "watermark-logo"
   });
 
-  Views.ShowEditor = FauxtonAPI.View.extend({
+  Views.ShowEditor = Views.IndexCore.extend({
     template: "addons/indexes/templates/show_editor",
-    initialize: function(options) {
-      this.newView = options.newView || false;
-      this.ddocs = options.ddocs;
-      this.params = options.params;
-      this.database = options.database;
-      this.currentDdoc = options.currentddoc;
-      if (this.newView) {
-        this.viewName = 'newView';
-      } else {
-        this.ddocID = options.ddocInfo.id;
-        this.viewName = options.viewName;
-        this.ddocInfo = new Documents.DdocInfo({_id: this.ddocID},{database: this.database});
+    langTemplates: {
+      "javascript": {
+        map: "function(doc) {\n  emit(doc._id, 1);\n}",
       }
-
-      this.showIndex = false;
-      _.bindAll(this);
     },
+    defaultLang: "javascript"
   });
 
-  Views.ListEditor = FauxtonAPI.View.extend({
+  Views.ListEditor = Views.IndexCore.extend({
     template: "addons/indexes/templates/list_editor",
+    langTemplates: {
+      "javascript": {
+        map: "function(doc) {\n  emit(doc._id, 1);\n}",
+      }
+    },
+    defaultLang: "javascript"
   });