Return-Path: X-Original-To: apmail-couchdb-dev-archive@www.apache.org Delivered-To: apmail-couchdb-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 2C65D17725 for ; Sat, 4 Oct 2014 16:32:19 +0000 (UTC) Received: (qmail 88261 invoked by uid 500); 4 Oct 2014 16:32:18 -0000 Delivered-To: apmail-couchdb-dev-archive@couchdb.apache.org Received: (qmail 88199 invoked by uid 500); 4 Oct 2014 16:32:18 -0000 Mailing-List: contact dev-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@couchdb.apache.org Delivered-To: mailing list dev@couchdb.apache.org Received: (qmail 88188 invoked by uid 99); 4 Oct 2014 16:32:18 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 04 Oct 2014 16:32:18 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 219699C5F49; Sat, 4 Oct 2014 16:32:18 +0000 (UTC) From: benkeen To: dev@couchdb.apache.org Reply-To: dev@couchdb.apache.org References: In-Reply-To: Subject: [GitHub] couchdb-fauxton pull request: New Query Options tray added Content-Type: text/plain Message-Id: <20141004163218.219699C5F49@tyr.zones.apache.org> Date: Sat, 4 Oct 2014 16:32:18 +0000 (UTC) Github user benkeen commented on a diff in the pull request: https://github.com/apache/couchdb-fauxton/pull/78#discussion_r18430151 --- Diff: app/addons/documents/views.js --- @@ -45,118 +45,88 @@ function(app, FauxtonAPI, Components, Documents, Databases, Views, QueryOptions, 'click .toggle-select-menu': 'selectAllMenu' }, - initialize: function(options){ - //adding the database to the object + initialize: function(options) { this.database = options.database; + this.params = options.params; + _.bindAll(this); this.selectVisible = false; - FauxtonAPI.Events.on('advancedOptions:updateView', this.updateAllDocs); FauxtonAPI.Events.on('success:bulkDelete', this.selectAllMenu); - }, - - cleanup:function(){ - FauxtonAPI.Events.unbind('advancedOptions:updateView'); - FauxtonAPI.Events.unbind('success:bulkDelete'); - }, - - selectAllMenu: function(e){ - FauxtonAPI.triggerRouteEvent("toggleSelectHeader"); - FauxtonAPI.Events.trigger("documents:showSelectAll",this.selectVisible); - }, - addAllDocsMenu: function(){ - //search docs + // insert the Search Docs field this.headerSearch = this.insertView("#header-search", new Views.JumpToDoc({ database: this.database, collection: this.database.allDocs })); - //insert queryoptions - //that file is included in require() above and the argument is QueryOptions - // and it wants all these params: - /* Sooooo I searched this file for where Advanced options was originally inserted to see what the hell - is happening. and it's in AllDocsLayout. So I'm going to move some of those functions over here - - These are required: - this.database = options.database; - this.updateViewFn = options.updateViewFn; - this.previewFn = options.previewFn; - - these are booleans: - this.showStale = _.isUndefined(options.showStale) ? false : options.showStale; - this.hasReduce = _.isUndefined(options.hasReduce) ? true : options.hasReduce; - - these you only need for view indexes, not all docs because they are about - specific views and design docs (ddocs, also views live inside a ddoc): - this.viewName = options.viewName; - this.ddocName = options.ddocName; - */ - - /*this.queryOptions = this.insertView("#query-options", new QueryOptions.AdvancedOptions({ - database: this.database, - hasReduce: false, - showPreview: false, - }));*/ - //Moved the apibar view into the components file so you can include it in your views - this.apiBar = this.insertView("#header-api-bar", new Components.ApiBar({ - endpoint: this.apiEndpoints[0], - documentation: this.apiEndpoints[1] + // add the Query Options modal + header link + this.queryOptions = this.insertView("#query-options", new QueryOptions.QueryOptionsTray({ + hasReduce: false, + showStale: false })); + + // insert the API Url header link + this.apiBar = this.insertView("#header-api-bar", new Components.ApiBar()); }, - updateApiUrl: function(api){ - //this will update the api bar when the route changes - //you can find the method that updates it in components.js Components.ApiBar() - this.apiEndpoints = api; - this.apiBar && this.apiBar.update(api); + afterRender: function() { + this.toggleQueryOptionsHeader(this.isHidden); }, - serialize: function() { - //basically if you want something in a template, You can define it here - return { - database: this.database.get('id') - }; + cleanup: function() { + FauxtonAPI.Events.unbind('success:bulkDelete'); }, - beforeRender:function(){ - this.addAllDocsMenu(); + selectAllMenu: function(e) { + FauxtonAPI.triggerRouteEvent("toggleSelectHeader"); + FauxtonAPI.Events.trigger("documents:showSelectAll",this.selectVisible); --- End diff -- That was some older code. Actually - looks like it may be legacy... if you don't mind I'll leave it alone for now. I have a half-dozen follow up tickets in mind to this one, so I can look at it then. :) --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastructure@apache.org or file a JIRA ticket with INFRA. ---