Return-Path: X-Original-To: apmail-couchdb-commits-archive@www.apache.org Delivered-To: apmail-couchdb-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id D3943100ED for ; Sat, 15 Mar 2014 01:45:06 +0000 (UTC) Received: (qmail 3636 invoked by uid 500); 15 Mar 2014 01:45:06 -0000 Delivered-To: apmail-couchdb-commits-archive@couchdb.apache.org Received: (qmail 3574 invoked by uid 500); 15 Mar 2014 01:45:05 -0000 Mailing-List: contact commits-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 commits@couchdb.apache.org Received: (qmail 3567 invoked by uid 99); 15 Mar 2014 01:45:05 -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, 15 Mar 2014 01:45:05 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 75A618B82B6; Sat, 15 Mar 2014 01:45:05 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: deathbear@apache.org To: commits@couchdb.apache.org Message-Id: <35edb44adefa41aab37b9dd0e1575d3e@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: couchdb commit: updated refs/heads/2129-config-edit-name to 9e1280d Date: Sat, 15 Mar 2014 01:45:05 +0000 (UTC) Repository: couchdb Updated Branches: refs/heads/2129-config-edit-name [created] 9e1280d3a Edit Config name. Needs validation. Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/9e1280d3 Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/9e1280d3 Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/9e1280d3 Branch: refs/heads/2129-config-edit-name Commit: 9e1280d3a6b586aa420b49c71d2f7d349d633cb2 Parents: a17bf86 Author: suelockwood Authored: Fri Mar 14 14:54:52 2014 -0400 Committer: suelockwood Committed: Fri Mar 14 21:44:52 2014 -0400 ---------------------------------------------------------------------- .../app/addons/config/templates/item.html | 13 ++++++-- src/fauxton/app/addons/config/views.js | 35 +++++++++++++------- 2 files changed, 34 insertions(+), 14 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/couchdb/blob/9e1280d3/src/fauxton/app/addons/config/templates/item.html ---------------------------------------------------------------------- diff --git a/src/fauxton/app/addons/config/templates/item.html b/src/fauxton/app/addons/config/templates/item.html index 108fa58..8af9a50 100644 --- a/src/fauxton/app/addons/config/templates/item.html +++ b/src/fauxton/app/addons/config/templates/item.html @@ -17,13 +17,22 @@ the License. <% } else { %> <% } %> - <%= option.name %> + +
+ <%= option.name %> +
+
+ + + +
+
<%= option.value %>
- +
http://git-wip-us.apache.org/repos/asf/couchdb/blob/9e1280d3/src/fauxton/app/addons/config/views.js ---------------------------------------------------------------------- diff --git a/src/fauxton/app/addons/config/views.js b/src/fauxton/app/addons/config/views.js index 0468cd1..6533c4e 100644 --- a/src/fauxton/app/addons/config/views.js +++ b/src/fauxton/app/addons/config/views.js @@ -45,38 +45,49 @@ function(app, FauxtonAPI, Config, Components) { }, editValue: function (event) { - this.$(".js-show-value").addClass("js-hidden"); - this.$(".js-edit-value-form").removeClass("js-hidden"); - this.$(".js-value-input").focus(); + this.$(event.currentTarget).find(".js-show-value").addClass("js-hidden"); + this.$(event.currentTarget).find(".js-edit-value-form").removeClass("js-hidden"); + this.$(event.currentTarget).find(".js-value-input").focus(); }, processKeyEvents: function (event) { // Enter key if (event.keyCode === 13) { - return this.saveAndRender(); + return this.saveAndRender(event); } // Esc key if (event.keyCode === 27) { - return this.discardValue(); + return this.discardValue(event); } }, discardValue: function (event) { - this.$(".js-edit-value-form").addClass("js-hidden"); - this.$(".js-show-value").removeClass("js-hidden"); + this.$(event.currentTarget).parents('td').find(".js-edit-value-form").addClass("js-hidden"); + this.$(event.currentTarget).parents('td').find(".js-show-value").removeClass("js-hidden"); }, cancelEdit: function (event) { - this.discardValue(); + this.discardValue(event); }, serialize: function () { return {option: this.model.toJSON()}; }, - - saveAndRender: function () { - this.model.save({value: this.$(".js-value-input").val()}); - this.render(); + saveAndRender: function (event) { + var options = {}; + $input = this.$(event.currentTarget).parents('td').find(".js-value-input"); + options[$input.attr('name')] = $input.val(); + + if ($input.attr('name')==='name'){ + var newModel = this.model.clone(); + newModel.save(options); + this.model.destroy(); + this.model = newModel; + this.render(); + } else { + this.model.save(options); + this.render(); + } } });