Clean up Design Docs page
Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/874a2a94 Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/874a2a94 Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/874a2a94 Branch: refs/heads/Update-Sidebar-Ui Commit: 874a2a94f1a198385241f9704d1eb5e0e3a20875 Parents: 076cb1b Author: suelockwood <[email protected]> Authored: Wed Apr 16 12:04:10 2014 -0400 Committer: suelockwood <[email protected]> Committed: Wed Apr 16 16:47:40 2014 -0400 ---------------------------------------------------------------------- src/fauxton/app/addons/documents/routes.js | 52 +++++++------------- .../addons/documents/templates/ddoc_info.html | 2 +- .../addons/documents/templates/view_editor.html | 1 - src/fauxton/app/addons/documents/views.js | 28 ++++------- 4 files changed, 29 insertions(+), 54 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/couchdb/blob/874a2a94/src/fauxton/app/addons/documents/routes.js ---------------------------------------------------------------------- diff --git a/src/fauxton/app/addons/documents/routes.js b/src/fauxton/app/addons/documents/routes.js index e159de6..a83fbcb 100644 --- a/src/fauxton/app/addons/documents/routes.js +++ b/src/fauxton/app/addons/documents/routes.js @@ -204,10 +204,24 @@ function(app, FauxtonAPI, Documents, Databases, Resources) { })); }, designDocMetadata: function(database, ddoc){ + this.toolsView && this.toolsView.remove(); + this.viewEditor && this.viewEditor.remove(); + var DesignDocInfo = new Resources.DdocInfo({_id: "_design/"+ddoc},{database: this.data.database }); + this.setView("#dashboard-lower-content", new Documents.Views.DdocInfo({ + ddocName: ddoc, model: DesignDocInfo })); + + this.sidebar.setSelectedTab(app.utils.removeSpecialCharacters(ddoc)+"_metadata"); + + this.crumbs = function () { + return [ + {"name": this.data.database.id, "link": Databases.databaseUrl(this.data.database)}, + ]; + }; + }, tempFn: function(databaseName, ddoc, fn){ this.setView("#dashboard-upper-content", new Documents.Views.temp({})); @@ -254,7 +268,7 @@ function(app, FauxtonAPI, Documents, Databases, Resources) { this.sidebar.setSelectedTab('all-docs'); } - if (this.viewEditor) { this.viewEditor.remove(); } + this.viewEditor && this.viewEditor.remove(); this.data.database.allDocs.paging.pageSize = this.getDocPerPageLimit(urlParams, parseInt(docParams.limit, 10)); @@ -306,7 +320,7 @@ function(app, FauxtonAPI, Documents, Databases, Resources) { ddocInfo: this.ddocInfo(decodeDdoc, this.data.designDocs, view) })); - if (this.toolsView) { this.toolsView.remove(); } + this.toolsView && this.toolsView.remove(); this.documentsView = this.createViewDocumentsView({ designDoc: decodeDdoc, @@ -492,31 +506,6 @@ function(app, FauxtonAPI, Documents, Databases, Resources) { } }, - // }); - - // var ChangesRouteObject = FauxtonAPI.RouteObject.extend({ - // layout: "with_tabs", - // selectedHeader: "Databases", - // crumbs: function () { - // return [ - // {"name": this.database.id, "link": Databases.databaseUrl(this.database)}, - // {"name": "_changes", "link": "/_changes"} - // ]; - // }, - - // routes: { - - // }, - - // initialize: function (route, masterLayout, options) { - // this.databaseName = options[0]; - // this.database = new Databases.Model({id: this.databaseName}); - - // var docParams = app.getParams(); - - // this.database.buildChanges(docParams); - // }, - changes: function (event) { var docParams = app.getParams(); this.data.database.buildChanges(docParams); @@ -525,13 +514,8 @@ function(app, FauxtonAPI, Documents, Databases, Resources) { model: this.data.database })); - if (this.viewEditor) { - this.viewEditor.remove(); - } - - if (this.toolsView) { - this.toolsView.remove(); - } + this.toolsView && this.toolsView.remove(); + this.viewEditor && this.viewEditor.remove(); this.sidebar.setSelectedTab('changes'); http://git-wip-us.apache.org/repos/asf/couchdb/blob/874a2a94/src/fauxton/app/addons/documents/templates/ddoc_info.html ---------------------------------------------------------------------- diff --git a/src/fauxton/app/addons/documents/templates/ddoc_info.html b/src/fauxton/app/addons/documents/templates/ddoc_info.html index ed0aed6..2821c11 100644 --- a/src/fauxton/app/addons/documents/templates/ddoc_info.html +++ b/src/fauxton/app/addons/documents/templates/ddoc_info.html @@ -12,7 +12,7 @@ License for the specific language governing permissions and limitations under the License. --> <div> - <h2> Design Doc MetaData </h2> + <h2>Design Doc MetaData: _design/<%=Ddoc%> </h2> <div class="row-fluid"> <% i=0; _.map(view_index, function (val, key) { %> <% if(i%2==0){%> http://git-wip-us.apache.org/repos/asf/couchdb/blob/874a2a94/src/fauxton/app/addons/documents/templates/view_editor.html ---------------------------------------------------------------------- diff --git a/src/fauxton/app/addons/documents/templates/view_editor.html b/src/fauxton/app/addons/documents/templates/view_editor.html index 3a427f0..010c4c0 100644 --- a/src/fauxton/app/addons/documents/templates/view_editor.html +++ b/src/fauxton/app/addons/documents/templates/view_editor.html @@ -20,7 +20,6 @@ the License. <li><a data-bypass="true" id="query-nav" href="#query" data-toggle="tab"> <i class="fonticon-plus fonticon"></i> Query Options</a> </li> - <li><a data-bypass="true" id="meta-nav" href="#metadata" data-toggle="tab">Design Doc Metadata</a></li> <% } %> </ul> </div> http://git-wip-us.apache.org/repos/asf/couchdb/blob/874a2a94/src/fauxton/app/addons/documents/views.js ---------------------------------------------------------------------- diff --git a/src/fauxton/app/addons/documents/views.js b/src/fauxton/app/addons/documents/views.js index 88c9d1c..1ee5a21 100644 --- a/src/fauxton/app/addons/documents/views.js +++ b/src/fauxton/app/addons/documents/views.js @@ -1635,8 +1635,6 @@ function(app, FauxtonAPI, Components, Documents, Databases, pouchdb, if ($targetTab.attr('id') !== $previousTab.attr('id')) { $previousTab.removeAttr('style'); } - //stop polling - this.ddocInfoView.stopRefreshInterval(); if ($targetId === 'index-nav') { if (this.newView) { return; } @@ -1645,11 +1643,6 @@ function(app, FauxtonAPI, Components, Documents, Databases, pouchdb, $targetTab.toggle('slow', function(){ that.showEditors(); }); - } else if ($targetId === "meta-nav"){ - if (!$("#ddoc-info").is(":visible")){ - this.ddocInfoView.startRefreshInterval(); - } - $targetTab.toggle('slow'); } else { $targetTab.toggle('slow'); } @@ -1693,16 +1686,6 @@ function(app, FauxtonAPI, Components, Documents, Databases, pouchdb, $('.beautify-tooltip').tooltip(); } }, - renderDdocInfo: function(){ - if(this.ddocInfoView){ - this.ddocInfoView.remove(); - } - - if (this.newView) { return; } - this.ddocInfoView = this.setView('#ddoc-info', new Views.DdocInfo({model: this.ddocInfo })); - this.ddocInfoView.render(); - - }, beforeRender: function () { if (this.newView) { @@ -1742,7 +1725,6 @@ function(app, FauxtonAPI, Components, Documents, Databases, pouchdb, }, afterRender: function() { - this.renderDdocInfo(); if (this.params && !this.newView) { this.advancedOptions.updateFromParams(this.params); @@ -2051,12 +2033,22 @@ function(app, FauxtonAPI, Components, Documents, Databases, pouchdb, template: "addons/documents/templates/ddoc_info", initialize: function (options) { + this.ddocName = options.ddocName; this.refreshTime = options.refreshTime || 5000; this.listenTo(this.model, 'change', this.render); }, + establish: function () { + return this.model.fetch(); + }, + + afterRender: function(){ + this.startRefreshInterval(); + }, + serialize: function () { return { + Ddoc: this.ddocName, view_index: this.model.get('view_index') }; },
