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 C1F9E10420 for ; Fri, 14 Mar 2014 01:37:47 +0000 (UTC) Received: (qmail 49533 invoked by uid 500); 14 Mar 2014 01:37:46 -0000 Delivered-To: apmail-couchdb-dev-archive@couchdb.apache.org Received: (qmail 49442 invoked by uid 500); 14 Mar 2014 01:37:46 -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 49434 invoked by uid 99); 14 Mar 2014 01:37:46 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 14 Mar 2014 01:37:46 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 5C212980A16; Fri, 14 Mar 2014 01:37:46 +0000 (UTC) From: kxepal To: dev@couchdb.apache.org Reply-To: dev@couchdb.apache.org References: In-Reply-To: Subject: [GitHub] couchdb pull request: CouchDB- 2128 Config Section dropdown Content-Type: text/plain Message-Id: <20140314013746.5C212980A16@tyr.zones.apache.org> Date: Fri, 14 Mar 2014 01:37:46 +0000 (UTC) Github user kxepal commented on a diff in the pull request: https://github.com/apache/couchdb/pull/178#discussion_r10594277 --- Diff: src/fauxton/app/addons/config/views.js --- @@ -111,34 +168,58 @@ function (app, FauxtonAPI, Config) { }); } - this.$("#add-section-modal").modal('hide'); - this.render(); - }, + this.hide(); + Views.Events.trigger("newSection"); - addSection: function (event) { + }, + isNew: function(collection){ + var sectionName = this.$('input[name="section"]').val(), + name = this.$('input[name="name"]').val(); + var section = _.findWhere(collection.toJSON(), {"section":sectionName}); + var options = _.findWhere(section.options, {name: name}); + + return options; + }, + isSection: function(){ + var section = this.$('input[name="section"]').val(); + return _.find(this.sourceArray, function(item){ return item === section; }); + }, + validate: function (event){ event.preventDefault(); - this.$("#add-section-modal").modal({show:true}); + var section = this.$('input[name="section"]').val(), + name = this.$('input[name="name"]').val(), + value = this.$('input[name="value"]').val(), + collection = this.collection; + + if(!this.isSection()){ + this.errorMessage("You need to use an existing section."); + } else if (!name) { + this.errorMessage("Add a name."); + } else if (!value) { + this.errorMessage("Add a value"); --- End diff -- `Add a name.`, but `Add a value`. May be get rid all trailing dots or set them to all messages for consistency? --- 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. ---