couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kxe...@apache.org
Subject [15/50] [abbrv] fauxton commit: updated refs/heads/import-master to b32c617
Date Tue, 01 Apr 2014 09:14:31 GMT
Set the triggering of the call to poll or stop polling ddoc metadata in the tab toggling


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

Branch: refs/heads/import-master
Commit: 8c6497f9480c398b7103f656a4021b161652bb3e
Parents: ae8c6d6
Author: suelockwood <deathbear@apache.org>
Authored: Mon Mar 10 13:08:43 2014 -0400
Committer: Garren Smith <garren.smith@gmail.com>
Committed: Mon Mar 10 16:04:25 2014 -0400

----------------------------------------------------------------------
 app/addons/documents/views.js | 24 ++++++++++++++++++------
 1 file changed, 18 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/8c6497f9/app/addons/documents/views.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/views.js b/app/addons/documents/views.js
index 54ec261..b51ea08 100644
--- a/app/addons/documents/views.js
+++ b/app/addons/documents/views.js
@@ -1577,6 +1577,8 @@ function(app, FauxtonAPI, Components, Documents, Databases, pouchdb,
resizeColum
       if ($targetTab.attr('id') !== $previousTab.attr('id')) {
         $previousTab.removeAttr('style');
       }
+      //stop polling
+      this.ddocInfoView.stopRefreshInterval(); 
 
       if ($targetId === 'index-nav') {
         if (this.newView) { return; }
@@ -1585,6 +1587,11 @@ function(app, FauxtonAPI, Components, Documents, Databases, pouchdb,
resizeColum
         $targetTab.toggle('slow', function(){
            that.showEditors();
         });
+      } else if ($targetId === "meta-nav"){
+        if ($previousTab.attr('id') !== "metadata"){
+          this.ddocInfoView.startRefreshInterval();
+        } 
+        $targetTab.toggle('slow'); 
       } else {
         $targetTab.toggle('slow');
       }
@@ -1628,7 +1635,14 @@ function(app, FauxtonAPI, Components, Documents, Databases, pouchdb,
resizeColum
         $('.beautify-tooltip').tooltip();
       }
     },
+    renderDdocInfo: function(){
+      if(this.ddocInfoView){
+        this.ddocInfoView.remove();
+      } 
+      this.ddocInfoView = this.setView('#ddoc-info', new Views.DdocInfo({model: this.ddocInfo
}));
+      this.ddocInfoView.render();
 
+    },
     beforeRender: function () {
 
       if (this.newView) {
@@ -1643,7 +1657,7 @@ function(app, FauxtonAPI, Components, Documents, Databases, pouchdb,
resizeColum
         var ddocDecode = decodeURIComponent(this.ddocID);
         this.model = this.ddocs.get(ddocDecode).dDocModel();
         this.reduceFunStr = this.model.viewHasReduce(this.viewName);
-        this.setView('#ddoc-info', new Views.DdocInfo({model: this.ddocInfo }));
+        
       }
 
       this.designDocSelector = this.setView('.design-doc-group', new Views.DesignDocSelector({
@@ -1670,6 +1684,8 @@ function(app, FauxtonAPI, Components, Documents, Databases, pouchdb,
resizeColum
     },
 
     afterRender: function() {
+      this.renderDdocInfo();
+
       if (this.params && !this.newView) {
         this.advancedOptions.updateFromParams(this.params);
       }
@@ -1872,15 +1888,11 @@ function(app, FauxtonAPI, Components, Documents, Databases, pouchdb,
resizeColum
       };
     },
 
-    afterRender: function () {
-      this.startRefreshInterval();
-    },
-
     startRefreshInterval: function () {
       var model = this.model;
 
       // Interval already set
-      if (this.intervalId) { return ; }
+      if (this.intervalId) { this.stopRefreshInterval(); }
 
       this.intervalId = setInterval(function () {
         model.fetch();


Mime
View raw message