mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-20 23:44:47 +02:00
Disable save button when changeset comment is empty (closes #1488)
This commit is contained in:
+11
-3
@@ -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')
|
||||
|
||||
Reference in New Issue
Block a user