From ba9745a6eb0eeeb42a5bcd99e4b0a2b3d308e855 Mon Sep 17 00:00:00 2001 From: Greg Guthe Date: Thu, 5 Sep 2013 00:22:51 -0400 Subject: [PATCH 1/4] Save commit message on keyup Refs: #1775 --- js/id/ui/commit.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/js/id/ui/commit.js b/js/id/ui/commit.js index c813d1cf8..6ba09910d 100644 --- a/js/id/ui/commit.js +++ b/js/id/ui/commit.js @@ -52,7 +52,10 @@ iD.ui.Commit = function(context) { var commentField = commentSection.append('textarea') .attr('placeholder', t('commit.description_placeholder')) - .property('value', context.storage('comment') || ''); + .property('value', context.storage('comment') || '') + .on('keyup.save', function () { + context.storage('comment', this.value); + }); commentField.node().select(); From b27ed806a90e6c5126d1322f4ae5f7e2f19a218e Mon Sep 17 00:00:00 2001 From: Greg Guthe Date: Thu, 5 Sep 2013 21:00:11 -0400 Subject: [PATCH 2/4] Save commit message on blur --- js/id/ui/commit.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/id/ui/commit.js b/js/id/ui/commit.js index 6ba09910d..f2c092642 100644 --- a/js/id/ui/commit.js +++ b/js/id/ui/commit.js @@ -53,7 +53,7 @@ iD.ui.Commit = function(context) { var commentField = commentSection.append('textarea') .attr('placeholder', t('commit.description_placeholder')) .property('value', context.storage('comment') || '') - .on('keyup.save', function () { + .on('blur.save', function () { context.storage('comment', this.value); }); From 2d5ec0d77f0b33b1d35434ed86e6f89cd47639c1 Mon Sep 17 00:00:00 2001 From: Greg Guthe Date: Thu, 5 Sep 2013 21:03:30 -0400 Subject: [PATCH 3/4] Remove commit message save on click Clicking the save button will blur the commit message textarea and trigger a save. --- js/id/ui/commit.js | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/js/id/ui/commit.js b/js/id/ui/commit.js index f2c092642..2c11424d6 100644 --- a/js/id/ui/commit.js +++ b/js/id/ui/commit.js @@ -90,14 +90,7 @@ iD.ui.Commit = function(context) { // Confirm Button var saveButton = saveSection.append('button') - .attr('class', 'action col3 button') - .on('click.save', function() { - var comment = commentField.node().value; - localStorage.comment = comment; - event.save({ - comment: comment - }); - }); + .attr('class', 'action col3 button'); saveButton.append('span') .attr('class', 'label') From 876547b1ea81a7cfc4afdb032acfa1d6ef4a78cc Mon Sep 17 00:00:00 2001 From: Greg Guthe Date: Mon, 9 Sep 2013 19:22:50 -0400 Subject: [PATCH 4/4] Fix saving comments --- js/id/ui/commit.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/js/id/ui/commit.js b/js/id/ui/commit.js index 2c11424d6..0968cabda 100644 --- a/js/id/ui/commit.js +++ b/js/id/ui/commit.js @@ -90,7 +90,12 @@ iD.ui.Commit = function(context) { // Confirm Button var saveButton = saveSection.append('button') - .attr('class', 'action col3 button'); + .attr('class', 'action col3 button') + .on('click.save', function() { + event.save({ + comment: commentField.node().value + }); + }); saveButton.append('span') .attr('class', 'label')