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/08 21:20:44 UTC

fauxton commit: updated refs/heads/secondary-indexes to bf49f5a

Repository: couchdb-fauxton
Updated Branches:
  refs/heads/secondary-indexes 57d408c0d -> bf49f5a93


Use events for advanced options


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

Branch: refs/heads/secondary-indexes
Commit: bf49f5a931e0ae904b8ede9e39cf9d7682efa5ba
Parents: 57d408c
Author: deathbearbrown <de...@gmail.com>
Authored: Fri Aug 8 15:20:51 2014 -0400
Committer: deathbearbrown <de...@gmail.com>
Committed: Fri Aug 8 15:20:51 2014 -0400

----------------------------------------------------------------------
 app/addons/documents/routes.js                  |  1 +
 .../documents/templates/all_docs_item.html      |  2 +-
 app/addons/documents/views-advancedopts.js      |  9 ++++-----
 app/addons/documents/views.js                   | 20 +++++++++-----------
 app/addons/indexes/views.js                     |  4 ++--
 5 files changed, 17 insertions(+), 19 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/bf49f5a9/app/addons/documents/routes.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/routes.js b/app/addons/documents/routes.js
index 895de40..52b8ea9 100644
--- a/app/addons/documents/routes.js
+++ b/app/addons/documents/routes.js
@@ -373,6 +373,7 @@ function(app, FauxtonAPI, Components, Documents, Changes, DocEditor, Databases,
 
       this.documentsView.setCollection(collection);
       this.documentsView.setParams(docParams, urlParams);
+      this.leftheader.forceRender();
       this.documentsView.forceRender();
 
       this.headerRight.updateApiUrl([collection.urlRef("apiurl", urlParams), "docs"]);

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/bf49f5a9/app/addons/documents/templates/all_docs_item.html
----------------------------------------------------------------------
diff --git a/app/addons/documents/templates/all_docs_item.html b/app/addons/documents/templates/all_docs_item.html
index cf56335..80dbfe9 100644
--- a/app/addons/documents/templates/all_docs_item.html
+++ b/app/addons/documents/templates/all_docs_item.html
@@ -12,7 +12,7 @@ License for the specific language governing permissions and limitations under
 the License.
 -->
 
-<div class="select" style="display:none"><input <%- checked ? 'checked="checked"' : '' %> type="checkbox" class="js-row-select"></div>
+<div class="select" <% if (!showSelect){ %>style="display:none"<%}%> ><input <%- checked ? 'checked="checked"' : '' %> type="checkbox" class="js-row-select"></div>
 <div class="doc-item  ">
 
   <header>

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/bf49f5a9/app/addons/documents/views-advancedopts.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/views-advancedopts.js b/app/addons/documents/views-advancedopts.js
index 9a00c63..6500b50 100644
--- a/app/addons/documents/views-advancedopts.js
+++ b/app/addons/documents/views-advancedopts.js
@@ -29,8 +29,6 @@ function(app, FauxtonAPI, resizeColumns ) {
       this.database = options.database;
       this.ddocName = options.ddocName;
       this.viewName = options.viewName;
-      this.updateViewFn = options.updateViewFn;
-      this.previewFn = options.previewFn;
       this.showStale = _.isUndefined(options.showStale) ? false : options.showStale;
       this.hasReduce = _.isUndefined(options.hasReduce) ? true : options.hasReduce;
     },
@@ -66,14 +64,14 @@ function(app, FauxtonAPI, resizeColumns ) {
     toggleQuery: function(event) {
       $('#dashboard-content').scrollTop(0);
       this.$('#query-options-tray').toggle();
-    }, 
+    },
 
     resetForm: function() {
       $('input, textarea').each(function(){
         $(this).val('');
       });
       $('input:checkbox').attr('checked', false);
-      $("select").each(function(){ 
+      $("select").each(function(){
         this.selectedIndex = 0;
       });
     },
@@ -190,7 +188,8 @@ function(app, FauxtonAPI, resizeColumns ) {
       event.preventDefault();
       var params = this.queryParams();
       if (!params) { return;}
-      this.updateViewFn(event, params);
+      FauxtonAPI.Events.trigger('advancedOptions:updateView', event, params);
+      //this.updateViewFn(event, params);
     },
 
     updateFilters: function(event) {

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/bf49f5a9/app/addons/documents/views.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/views.js b/app/addons/documents/views.js
index 58a6c73..31438df 100644
--- a/app/addons/documents/views.js
+++ b/app/addons/documents/views.js
@@ -51,16 +51,17 @@ function(app, FauxtonAPI, Components, Documents, Databases, Views, QueryOptions,
       this.database = options.database;
       _.bindAll(this);
       this.selectVisible = false;
+      FauxtonAPI.Events.on('advancedOptions:updateView', this.updateAllDocs);
     },
 
     selectAllDocs: function(e){
       //trigger event to select all in other view
-      FauxtonAPI.Events.trigger("documents:select-all");
-
       this.$('.toggle-select-menu').toggleClass('active');
 
       //trigger event to change the header
       this.toggleSelectMenu();
+      FauxtonAPI.Events.trigger("documents:show-select-all",this.selectVisible);
+
     },
 
     toggleSelectMenu: function(){
@@ -112,9 +113,8 @@ function(app, FauxtonAPI, Components, Documents, Databases, Views, QueryOptions,
         this.viewName = options.viewName;
         this.ddocName = options.ddocName;
       */
+
       this.queryOptions = this.insertView("#query-options", new QueryOptions.AdvancedOptions({
-        updateViewFn: this.updateAllDocs,
-        previewFn: this.previewView,
         database: this.database,
         hasReduce: false,
         showPreview: false,
@@ -183,10 +183,6 @@ function(app, FauxtonAPI, Components, Documents, Databases, Views, QueryOptions,
 
       FauxtonAPI.navigate(fragment, {trigger: false});
       FauxtonAPI.triggerRouteEvent('updateAllDocs', {allDocs: true});
-    },
-
-    previewView: function (event) {
-      event.preventDefault();
     }
   });
 
@@ -260,12 +256,13 @@ function(app, FauxtonAPI, Components, Documents, Databases, Views, QueryOptions,
     initialize: function (options) {
       this.checked = options.checked;
       this.expanded = options.expanded;
+      this.showSelect = false;
       _.bindAll(this);
-      FauxtonAPI.Events.on("documents:select-all", this.showSelect);
+      FauxtonAPI.Events.on("documents:show-select-all", this.showSelectBox);
     },
-    showSelect: function(bool){
+    showSelectBox: function(bool){
       this.showSelect = bool;
-      this.$('.select').toggle();
+      this.$('.select').toggle(this.showSelect);
     },
     events: {
       "click button.delete": "destroy",
@@ -280,6 +277,7 @@ function(app, FauxtonAPI, Components, Documents, Databases, Views, QueryOptions,
 
     serialize: function() {
       return {
+        showSelect: this.showSelect,
         expanded: this.expanded,
         docID: this.model.get('_id'),
         doc: this.model,

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/bf49f5a9/app/addons/indexes/views.js
----------------------------------------------------------------------
diff --git a/app/addons/indexes/views.js b/app/addons/indexes/views.js
index bfe209e..9d0546e 100644
--- a/app/addons/indexes/views.js
+++ b/app/addons/indexes/views.js
@@ -40,12 +40,14 @@ function(app, FauxtonAPI, Components, Documents, Databases, pouchdb,
     className: "header-right",
     template: "addons/indexes/templates/header_right",
     initialize:function(options){
+      _.bindAll(this);
       this.database = options.database;
       this.title = options.title;
       this.api = options.api;
       this.endpoint = options.endpoint;
       this.documentation = options.documentation;
       this.eventer = _.extend({}, Backbone.Events);
+      FauxtonAPI.Events.on('advancedOptions:updateView', this.updateView);
     },
     updateApiUrl: function(api){
       //this will update the api bar when the route changes
@@ -60,8 +62,6 @@ function(app, FauxtonAPI, Components, Documents, Databases, pouchdb,
       }));
 
       this.advancedOptions = this.insertView('#header-query-options', new QueryOptions.AdvancedOptions({
-        updateViewFn: this.updateView,
-        previewFn: this.previewView,
         database: this.database,
         viewName: this.viewName,
         ddocName: this.model.id,