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/13 18:14:23 UTC
fauxton commit: updated refs/heads/secondary-indexes to 82caac0
Repository: couchdb-fauxton
Updated Branches:
refs/heads/secondary-indexes e850b2e41 -> 82caac0f4
adding back some route events
Project: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/commit/82caac0f
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/tree/82caac0f
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/diff/82caac0f
Branch: refs/heads/secondary-indexes
Commit: 82caac0f4a705a1224b438031e4405ba9807212e
Parents: e850b2e
Author: deathbearbrown <de...@gmail.com>
Authored: Wed Aug 13 10:11:23 2014 -0400
Committer: deathbearbrown <de...@gmail.com>
Committed: Wed Aug 13 12:14:20 2014 -0400
----------------------------------------------------------------------
app/addons/documents/routes.js | 15 +++++++++++----
app/addons/indexes/routes-core.js | 35 +++++++++++++++++++++++++++++++++-
app/addons/indexes/views.js | 17 ++++++-----------
assets/less/templates.less | 2 +-
4 files changed, 52 insertions(+), 17 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/82caac0f/app/addons/documents/routes.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/routes.js b/app/addons/documents/routes.js
index 65b3740..db815a4 100644
--- a/app/addons/documents/routes.js
+++ b/app/addons/documents/routes.js
@@ -265,7 +265,7 @@ function(app, FauxtonAPI, Components, Documents, Changes, DocEditor, Databases,
resetAllDocsHeader: function(){
if (this.changesHeader){
- this.headerRight = this.setView("#api-navbar", new Documents.Views.RightAllDocsHeader({
+ this.rightHeader = this.setView("#api-navbar", new Documents.Views.RightAllDocsHeader({
database: this.data.database
}));
this.changesHeader = false;
@@ -290,7 +290,7 @@ function(app, FauxtonAPI, Components, Documents, Changes, DocEditor, Databases,
/* --------------------------------------------------
Update the apiUrl
----------------------------------------------------*/
- this.headerRight.updateApiUrl([designDocInfo.url('apiurl'), designDocInfo.documentation()]);
+ this.rightHeader.updateApiUrl([designDocInfo.url('apiurl'), designDocInfo.documentation()]);
},
@@ -365,7 +365,7 @@ function(app, FauxtonAPI, Components, Documents, Changes, DocEditor, Databases,
/* --------------------------------------------------
update the api url
----------------------------------------------------*/
- this.headerRight.updateApiUrl([this.data.database.allDocs.urlRef("apiurl", urlParams), this.data.database.allDocs.documentation()]);
+ this.rightHeader.updateApiUrl([this.data.database.allDocs.urlRef("apiurl", urlParams), this.data.database.allDocs.documentation()]);
},
@@ -415,9 +415,12 @@ function(app, FauxtonAPI, Components, Documents, Changes, DocEditor, Databases,
this.leftheader.forceRender();
this.documentsView.forceRender();
- this.headerRight.updateApiUrl([collection.urlRef("apiurl", urlParams), "docs"]);
+ this.rightHeader.updateApiUrl([collection.urlRef("apiurl", urlParams), "docs"]);
},
+ /* --------------------------------------------------
+ Called when you change the # of items to show in the pagination footer
+ ----------------------------------------------------*/
perPageChange: function (perPage) {
// We need to restore the collection parameters to the defaults (1st page)
// and update the page size
@@ -428,6 +431,10 @@ function(app, FauxtonAPI, Components, Documents, Changes, DocEditor, Databases,
this.setDocPerPageLimit(perPage);
},
+ /* --------------------------------------------------
+ Triggers when you hit the paginate forward and backwards buttons
+ ----------------------------------------------------*/
+
paginate: function (options) {
var collection = this.documentsView.collection;
this.leftheader.forceRender();
http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/82caac0f/app/addons/indexes/routes-core.js
----------------------------------------------------------------------
diff --git a/app/addons/indexes/routes-core.js b/app/addons/indexes/routes-core.js
index ae21e03..a341d41 100644
--- a/app/addons/indexes/routes-core.js
+++ b/app/addons/indexes/routes-core.js
@@ -47,7 +47,8 @@ function (app, FauxtonAPI, Databases, Views, Documents, Resources) {
events: {
"route:updatePreviewDocs": "updateAllDocsFromPreview",
"route:perPageChange": "perPageChange",
- "route:paginate": "paginate"
+ "route:paginate": "paginate",
+ "route:updateAllDocs": "updateAllDocsFromView"
},
/* --------------------------------------------------
@@ -136,6 +137,38 @@ function (app, FauxtonAPI, Databases, Views, Documents, Resources) {
/* --------------------------------------------------
+ Reload preview docs
+ -----------------------------------------------------*/
+ updateAllDocsFromView: function (event) {
+ var view = event.view,
+ params = this.createParams(),
+ urlParams = params.urlParams,
+ docParams = params.docParams,
+ ddoc = event.ddoc,
+ pageSize,
+ collection;
+
+ var defaultPageSize = _.isUndefined(this.documentsView) ? 20 : this.documentsView.perPage();
+ docParams.limit = pageSize = this.getDocPerPageLimit(urlParams, defaultPageSize);
+
+ if (event.allDocs) {
+ this.eventAllDocs = true; // this is horrible. But I cannot get the trigger not to fire the route!
+ this.data.database.buildAllDocs(docParams);
+ collection = this.data.database.allDocs;
+ collection.paging.pageSize = pageSize;
+
+ }
+
+ this.documentsView.setCollection(collection);
+ this.documentsView.setParams(docParams, urlParams);
+
+ this.leftheader.forceRender();
+ this.documentsView.forceRender();
+
+ this.rightHeader.updateApiUrl([collection.urlRef("apiurl", urlParams), "docs"]);
+ },
+
+ /* --------------------------------------------------
Docs that are returned from a view
----------------------------------------------------*/
createViewDocumentsView: function (options) {
http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/82caac0f/app/addons/indexes/views.js
----------------------------------------------------------------------
diff --git a/app/addons/indexes/views.js b/app/addons/indexes/views.js
index 51f37fa..421495f 100644
--- a/app/addons/indexes/views.js
+++ b/app/addons/indexes/views.js
@@ -88,14 +88,12 @@ function(app, FauxtonAPI, Components, Documents, Databases, pouchdb,
return FauxtonAPI.addNotification({
msg: "JSON Parse Error on field: "+param.name,
type: "error",
- selector: ".advanced-options .errors-container",
clear: true
});
});
FauxtonAPI.addNotification({
msg: "Make sure that strings are properly quoted and any other values are valid JSON structures",
type: "warning",
- selector: ".advanced-options .errors-container",
clear: true
});
@@ -131,7 +129,6 @@ function(app, FauxtonAPI, Components, Documents, Databases, pouchdb,
FauxtonAPI.addNotification({
msg: "<strong>Warning!</strong> Preview executes the Map/Reduce functions in your browser, and may behave differently from CouchDB.",
type: "warning",
- selector: ".advanced-options .errors-container",
fade: true,
escape: false // beware of possible XSS when the message changes
});
@@ -310,7 +307,7 @@ function(app, FauxtonAPI, Components, Documents, Databases, pouchdb,
this.showIndex = false;
_.bindAll(this);
- FauxtonAPI.Events.on('index:delete', this.deleteView);
+ FauxtonAPI.Events.on('index:delete', this.deleteEvent);
},
establish: function () {
@@ -343,11 +340,15 @@ function(app, FauxtonAPI, Components, Documents, Databases, pouchdb,
}
},
+ deleteEvent: function(){
+ this.deleteView();
+ },
+
deleteView: function (event) {
event && event.preventDefault();
if (this.newView) { return alert('Cannot delete a new view.'); }
- if (!confirm('Are you sure you want to delete this view?')) {return;}
+ if (!confirm('Are you sure you want to delete this view?')) { return; }
var that = this,
promise,
@@ -394,7 +395,6 @@ function(app, FauxtonAPI, Components, Documents, Databases, pouchdb,
notification = FauxtonAPI.addNotification({
msg: "Saving document.",
- selector: "#define-view .errors-container",
clear: true
});
@@ -419,7 +419,6 @@ function(app, FauxtonAPI, Components, Documents, Databases, pouchdb,
notification = FauxtonAPI.addNotification({
msg: errormessage,
type: "error",
- selector: "#define-view .errors-container",
clear: true
});
}
@@ -439,7 +438,6 @@ function(app, FauxtonAPI, Components, Documents, Databases, pouchdb,
FauxtonAPI.addNotification({
msg: "View has been saved.",
type: "success",
- selector: "#define-view .errors-container",
clear: true
});
@@ -455,9 +453,6 @@ function(app, FauxtonAPI, Components, Documents, Databases, pouchdb,
this.ddocInfo = ddoc;
this.showIndex = true;
this.render();
- FauxtonAPI.triggerRouteEvent('reloadDesignDocs', {
- selectedTab: app.utils.removeSpecialCharacters(ddocName.replace(/_design\//,'')) + '_' + app.utils.removeSpecialCharacters(viewName)
- });
}
// TODO:// this should change to a trigger because we shouldn't define advanced options in this view
http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/82caac0f/assets/less/templates.less
----------------------------------------------------------------------
diff --git a/assets/less/templates.less b/assets/less/templates.less
index 3ab7d19..abf1c4b 100644
--- a/assets/less/templates.less
+++ b/assets/less/templates.less
@@ -482,7 +482,7 @@
#right-content{
.two-pane &{
.view {
- padding: 0 20px;
+ padding: 0 20px 40px;
}
border-left: 1px solid #999;
.box-shadow(-6px 0 rgba(0, 0, 0, 0.1));