Disable save button when changeset comment is empty (closes #1488)

This commit is contained in:
Bryan Housel
2015-09-18 11:55:09 -04:00
parent dc9f29fd09
commit 51ad6d006c
+11 -3
View File
@@ -38,7 +38,11 @@ iD.ui.Commit = function(context) {
.attr('placeholder', t('commit.description_placeholder'))
.attr('maxlength', 255)
.property('value', context.storage('comment') || '')
.on('blur.save', function () {
.on('input.save', function() {
d3.selectAll('.save-section .save-button')
.attr('disabled', (this.value.length ? null : true));
})
.on('blur.save', function() {
context.storage('comment', this.value);
});
@@ -117,7 +121,11 @@ iD.ui.Commit = function(context) {
.attr('class','buttons fillL cf');
var saveButton = buttonSection.append('button')
.attr('class', 'action col5 button')
.attr('class', 'action col5 button save-button')
.attr('disabled', function() {
var n = d3.select('.commit-form textarea').node();
return (n && n.value.length) ? null : true;
})
.on('click.save', function() {
dispatch.save({
comment: commentField.node().value
@@ -129,7 +137,7 @@ iD.ui.Commit = function(context) {
.text(t('commit.save'));
var cancelButton = buttonSection.append('button')
.attr('class', 'action col5 button')
.attr('class', 'action col5 button cancel-button')
.on('click.cancel', function() { dispatch.cancel(); });
cancelButton.append('span')