mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-15 05:30:35 +02:00
Merge remote-tracking branch 'alanb43/changeset-max-length-warning' into maxlength-indicator
This commit is contained in:
@@ -615,6 +615,7 @@ en:
|
||||
comment_needed_message: Please add a changeset comment first.
|
||||
about_changeset_comments: About changeset comments
|
||||
about_changeset_comments_link: //wiki.openstreetmap.org/wiki/Good_changeset_comments
|
||||
changeset_comment_length_warning: "Changeset comments can have a maximum of 255 characters"
|
||||
google_warning: "You mentioned Google in this comment: remember that copying from Google Maps is strictly forbidden."
|
||||
google_warning_link: https://www.openstreetmap.org/copyright
|
||||
contributors:
|
||||
|
||||
@@ -85,10 +85,10 @@ export function uiChangesetEditor(context) {
|
||||
}
|
||||
}
|
||||
|
||||
// Add warning if comment mentions Google
|
||||
var hasGoogle = _tags.comment.match(/google/i);
|
||||
var commentTooLong = _tags.comment.length > 255;
|
||||
var commentWarning = selection.select('.form-field-comment').selectAll('.comment-warning')
|
||||
.data(hasGoogle ? [0] : []);
|
||||
.data(hasGoogle || commentTooLong ? [0] : []);
|
||||
|
||||
commentWarning.exit()
|
||||
.transition()
|
||||
@@ -96,23 +96,30 @@ export function uiChangesetEditor(context) {
|
||||
.style('opacity', 0)
|
||||
.remove();
|
||||
|
||||
var commentEnter = commentWarning.enter()
|
||||
.insert('div', '.tag-reference-body')
|
||||
.attr('class', 'field-warning comment-warning')
|
||||
.style('opacity', 0);
|
||||
function displayWarningMessage(msg, link) {
|
||||
var commentEnter = commentWarning.enter()
|
||||
.insert('div', '.tag-reference-body')
|
||||
.attr('class', 'field-warning comment-warning')
|
||||
.style('opacity', 0);
|
||||
|
||||
commentEnter
|
||||
.append('a')
|
||||
.attr('target', '_blank')
|
||||
.call(svgIcon('#iD-icon-alert', 'inline'))
|
||||
.attr('href', t('commit.google_warning_link'))
|
||||
.append('span')
|
||||
.call(t.append('commit.google_warning'));
|
||||
commentEnter
|
||||
.append('a')
|
||||
.attr('target', '_blank')
|
||||
.call(svgIcon('#iD-icon-alert', 'inline'))
|
||||
.attr('href', t(link))
|
||||
.append('span')
|
||||
.call(t.append(msg));
|
||||
|
||||
commentEnter
|
||||
.transition()
|
||||
.duration(200)
|
||||
.style('opacity', 1);
|
||||
commentEnter
|
||||
.transition()
|
||||
.duration(200)
|
||||
.style('opacity', 1);
|
||||
}
|
||||
|
||||
// Add warning if comment mentions Google or comment length
|
||||
// exceeds 255 chars
|
||||
if (hasGoogle) displayWarningMessage('commit.google_warning', 'commit.google_warning_link');
|
||||
if (commentTooLong) displayWarningMessage('commit.changeset_comment_length_warning', 'commit.about_changeset_comments_link');
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user