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/09/17 17:28:39 UTC

git commit: updated refs/heads/master to 0324f40

Updated Branches:
  refs/heads/master 8a3332270 -> 0324f40e2


Fauxton: Hide edit index on initial view load


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

Branch: refs/heads/master
Commit: 0324f40e292afeb3aa2775f7b43b365e6dee71b9
Parents: 8a33322
Author: Garren Smith <ga...@gmail.com>
Authored: Tue Sep 17 17:28:25 2013 +0200
Committer: Garren Smith <ga...@gmail.com>
Committed: Tue Sep 17 17:28:25 2013 +0200

----------------------------------------------------------------------
 src/fauxton/app/modules/documents/views.js       | 19 ++++++++++++++++---
 .../app/templates/documents/view_editor.html     |  2 +-
 2 files changed, 17 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb/blob/0324f40e/src/fauxton/app/modules/documents/views.js
----------------------------------------------------------------------
diff --git a/src/fauxton/app/modules/documents/views.js b/src/fauxton/app/modules/documents/views.js
index 40f610e..9991d6f 100644
--- a/src/fauxton/app/modules/documents/views.js
+++ b/src/fauxton/app/modules/documents/views.js
@@ -829,7 +829,8 @@ function(app, FauxtonAPI, Paginate, Documents, pouchdb, Codemirror, JSHint, resi
       "change form.view-query-update input": "updateFilters",
       "change form.view-query-update select": "updateFilters",
       "change select#ddoc": "updateDesignDoc",
-      "submit form.view-query-update": "updateView"
+      "submit form.view-query-update": "updateView",
+      "click #db-views-tabs-nav": 'toggleIndexNav'
     },
 
     langTemplates: {
@@ -1194,6 +1195,17 @@ function(app, FauxtonAPI, Paginate, Documents, pouchdb, Codemirror, JSHint, resi
         }, this);
       }
     },
+    toggleIndexNav: function (event) {
+      var $index = this.$('#index'),
+          $targetId = this.$(event.target).attr('id');
+
+      if ($targetId === 'index-nav') {
+        if (this.newView) { return; }
+        $index.toggle('slow');
+      } else {
+        $index.removeAttr('style');
+      }
+    },
 
     serialize: function() {
       return {
@@ -1231,8 +1243,6 @@ function(app, FauxtonAPI, Paginate, Documents, pouchdb, Codemirror, JSHint, resi
     },
 
     afterRender: function() {
-
-
       var that = this, 
           mapFun = this.$("#map-function"),
           reduceFun = this.$("#reduce-function");
@@ -1240,6 +1250,9 @@ function(app, FauxtonAPI, Paginate, Documents, pouchdb, Codemirror, JSHint, resi
       if (this.newView) {
         mapFun.val(this.langTemplates[this.defaultLang].map);
         reduceFun.val(this.langTemplates[this.defaultLang].reduce);
+      } else {
+        this.$('#index').hide();
+        this.$('#index-nav').parent().removeClass('active');
       }
 
       this.updateDesignDoc();

http://git-wip-us.apache.org/repos/asf/couchdb/blob/0324f40e/src/fauxton/app/templates/documents/view_editor.html
----------------------------------------------------------------------
diff --git a/src/fauxton/app/templates/documents/view_editor.html b/src/fauxton/app/templates/documents/view_editor.html
index e04caa4..b837aa1 100644
--- a/src/fauxton/app/templates/documents/view_editor.html
+++ b/src/fauxton/app/templates/documents/view_editor.html
@@ -13,7 +13,7 @@ the License.
 -->
 <div class="row">
   <ul class="nav nav-tabs window-resizeable" id="db-views-tabs-nav">
-    <li class="active"> <a class="fonticon-wrench fonticon" data-toggle="tab" href="#index"><% if (newView) { %>Create Index <% } else { %>Edit Index <% } %></a></li>
+    <li class="active"> <a id="index-nav" class="fonticon-wrench fonticon" data-toggle="tab" href="#index"><% if (newView) { %>Create Index <% } else { %>Edit Index <% } %></a></li>
     <li><a class="fonticon-plus fonticon" href="#query" data-toggle="tab">Advanced Options</a></li>
     <li><a href="#metadata" data-toggle="tab">Design Doc Metadata</a></li>
   </ul>