You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ga...@apache.org on 2013/12/04 15:32:52 UTC
[1/2] git commit: updated refs/heads/master to f5a5862
Updated Branches:
refs/heads/master 9c942b509 -> f5a5862a7
Fauxton: Fix search button
Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/844ddfa3
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/844ddfa3
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/844ddfa3
Branch: refs/heads/master
Commit: 844ddfa3c4ae1695327de17f9816b28d19fdceb7
Parents: 9c942b5
Author: Garren Smith <ga...@gmail.com>
Authored: Wed Dec 4 10:33:57 2013 +0200
Committer: Garren Smith <ga...@gmail.com>
Committed: Wed Dec 4 16:31:26 2013 +0200
----------------------------------------------------------------------
src/fauxton/Gruntfile.js | 5 +++--
src/fauxton/app/modules/databases/views.js | 20 +++++++++++++++-----
src/fauxton/app/modules/fauxton/components.js | 12 +++++++++++-
3 files changed, 29 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/couchdb/blob/844ddfa3/src/fauxton/Gruntfile.js
----------------------------------------------------------------------
diff --git a/src/fauxton/Gruntfile.js b/src/fauxton/Gruntfile.js
index 42e5e17..6a8a73a 100644
--- a/src/fauxton/Gruntfile.js
+++ b/src/fauxton/Gruntfile.js
@@ -142,12 +142,13 @@ module.exports = function(grunt) {
// The jshint option for scripturl is set to lax, because the anchor
// override inside main.js needs to test for them so as to not accidentally
- // route.
+ // route. Settings expr true so we can do `migtBeNullObject && mightBeNullObject.coolFunction()`
jshint: {
all: ['app/**/*.js', 'Gruntfile.js', "test/core/*.js"],
options: {
scripturl: true,
- evil: true
+ evil: true,
+ expr: true
}
},
http://git-wip-us.apache.org/repos/asf/couchdb/blob/844ddfa3/src/fauxton/app/modules/databases/views.js
----------------------------------------------------------------------
diff --git a/src/fauxton/app/modules/databases/views.js b/src/fauxton/app/modules/databases/views.js
index 0f67d36..9a197a9 100644
--- a/src/fauxton/app/modules/databases/views.js
+++ b/src/fauxton/app/modules/databases/views.js
@@ -38,7 +38,8 @@ function(app, Components, FauxtonAPI) {
template: "templates/databases/list",
events: {
"click button.all": "selectAll",
- "submit form.database-search": "switchDatabase"
+ "submit form.database-search": "switchDatabase",
+ "click label.fonticon-search": "switchDatabase"
},
initialize: function(options) {
@@ -52,10 +53,15 @@ function(app, Components, FauxtonAPI) {
};
},
- switchDatabase: function(event) {
- event.preventDefault();
+ switchDatabase: function(event, selectedName) {
+ event && event.preventDefault();
+
var dbname = this.$el.find("input.search-query").val();
+ if (selectedName) {
+ dbname = selectedName;
+ }
+
if (dbname) {
// TODO: switch to using a model, or Databases.databaseUrl()
// Neither of which are in scope right now
@@ -77,7 +83,6 @@ function(app, Components, FauxtonAPI) {
collection: this.collection
}));
-
_.each(this.paginated(), function(database) {
this.insertView("table.databases tbody", new Views.Item({
model: database
@@ -99,9 +104,14 @@ function(app, Components, FauxtonAPI) {
},
afterRender: function() {
+ var that = this;
this.dbSearchTypeahead = new Components.DbSearchTypeahead({
dbLimit: this.dbLimit,
- el: "input.search-query"
+ el: "input.search-query",
+ onUpdate: function (item) {
+ console.log('boom', item);
+ that.switchDatabase(null, item);
+ }
});
this.dbSearchTypeahead.render();
http://git-wip-us.apache.org/repos/asf/couchdb/blob/844ddfa3/src/fauxton/app/modules/fauxton/components.js
----------------------------------------------------------------------
diff --git a/src/fauxton/app/modules/fauxton/components.js b/src/fauxton/app/modules/fauxton/components.js
index 0443573..bcc9226 100644
--- a/src/fauxton/app/modules/fauxton/components.js
+++ b/src/fauxton/app/modules/fauxton/components.js
@@ -116,8 +116,17 @@ function(app, FauxtonAPI, ace) {
},
afterRender: function () {
+ var onUpdate = this.onUpdate;
+
this.$el.typeahead({
- source: this.source
+ source: this.source,
+ updater: function (item) {
+ if (onUpdate) {
+ onUpdate(item);
+ }
+
+ return item;
+ }
});
}
@@ -127,6 +136,7 @@ function(app, FauxtonAPI, ace) {
Components.DbSearchTypeahead = Components.Typeahead.extend({
initialize: function (options) {
this.dbLimit = options.dbLimit || 30;
+ this.onUpdate = options.onUpdate;
_.bindAll(this);
},
source: function(query, process) {
[2/2] git commit: updated refs/heads/master to f5a5862
Posted by ga...@apache.org.
Fauxton: Add viewHasRendered route event
This is used to clean up any left over spinners if a view has previously
been rendered
Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/f5a5862a
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/f5a5862a
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/f5a5862a
Branch: refs/heads/master
Commit: f5a5862a72214d292ccf5b61159bd10dedf5faff
Parents: 844ddfa
Author: Garren Smith <ga...@gmail.com>
Authored: Wed Dec 4 12:05:06 2013 +0200
Committer: Garren Smith <ga...@gmail.com>
Committed: Wed Dec 4 16:31:27 2013 +0200
----------------------------------------------------------------------
src/fauxton/app/api.js | 39 ++++++++++++++++++++++++---------------
1 file changed, 24 insertions(+), 15 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/couchdb/blob/f5a5862a/src/fauxton/app/api.js
----------------------------------------------------------------------
diff --git a/src/fauxton/app/api.js b/src/fauxton/app/api.js
index 9d6ba08..a71c5f8 100644
--- a/src/fauxton/app/api.js
+++ b/src/fauxton/app/api.js
@@ -314,7 +314,10 @@ function(app, Fauxton) {
FauxtonAPI.when(this.establish()).then(function(resp) {
triggerBroadcast('afterEstablish');
_.each(routeObject.getViews(), function(view, selector) {
- if(view.hasRendered) { return; }
+ if(view.hasRendered) {
+ triggerBroadcast('viewHasRendered', view, selector);
+ return;
+ }
triggerBroadcast('beforeRender', view, selector);
FauxtonAPI.when(view.establish()).then(function(resp) {
@@ -339,14 +342,6 @@ function(app, Fauxton) {
masterLayout.renderView(selector);
});
- /*var hooks = masterLayout.hooks[selector];
- var boundRoute = route;
-
- _.each(hooks, function(hook){
- if (_.any(hook.routes, function(route){return route == boundRoute;})){
- hook.callback(view);
- }
- });*/
});
}.bind(this), function (resp) {
if (!resp) { return; }
@@ -479,12 +474,23 @@ function(app, Fauxton) {
}
});
- var viewSpinner;
- FauxtonAPI.RouteObject.on('beforeRender', function (routeObject, view, selector) {
- if (!routeObject.disableLoader) {
+ var removeRouteObjectSpinner = function () {
+ if (routeObjectSpinner) {
routeObjectSpinner.stop();
$('.spinner').remove();
}
+ };
+
+ var removeViewSpinner = function () {
+ if (viewSpinner){
+ viewSpinner.stop();
+ $('.spinner').remove();
+ }
+ };
+
+ var viewSpinner;
+ FauxtonAPI.RouteObject.on('beforeRender', function (routeObject, view, selector) {
+ removeRouteObjectSpinner();
if (!view.disableLoader){
var opts = {
@@ -506,9 +512,12 @@ function(app, Fauxton) {
});
FauxtonAPI.RouteObject.on('afterRender', function (routeObject, view, selector) {
- if (!view.disableLoader){
- viewSpinner.stop();
- }
+ removeViewSpinner();
+ });
+
+ FauxtonAPI.RouteObject.on('viewHasRendered', function () {
+ removeViewSpinner();
+ removeRouteObjectSpinner();
});
var extensions = _.extend({}, Backbone.Events);