diff options
author | Garren Smith <garren.smith@gmail.com> | 2013-09-17 17:28:25 +0200 |
---|---|---|
committer | Garren Smith <garren.smith@gmail.com> | 2013-09-17 17:28:25 +0200 |
commit | 0324f40e292afeb3aa2775f7b43b365e6dee71b9 (patch) | |
tree | f8b235db27817759d96748d26ab4c635c93cec0c | |
parent | 8a33322704ca03a09849a6a72ddbb16ff444071f (diff) | |
download | couchdb-0324f40e292afeb3aa2775f7b43b365e6dee71b9.tar.gz |
Fauxton: Hide edit index on initial view load
-rw-r--r-- | src/fauxton/app/modules/documents/views.js | 19 | ||||
-rw-r--r-- | src/fauxton/app/templates/documents/view_editor.html | 2 |
2 files changed, 17 insertions, 4 deletions
diff --git a/src/fauxton/app/modules/documents/views.js b/src/fauxton/app/modules/documents/views.js index 40f610ed0..9991d6f36 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(); diff --git a/src/fauxton/app/templates/documents/view_editor.html b/src/fauxton/app/templates/documents/view_editor.html index e04caa486..b837aa166 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> |