[openstreetmap/openstreetmap-website] Add some javascript to check dynamically if the username is already taken (PR #4402)
Anton Khorev
notifications at github.com
Thu Dec 14 13:00:51 UTC 2023
@AntonKhorev commented on this pull request.
> @@ -223,4 +223,62 @@ $(document).ready(function () {
$("#read_tou").on("click", function () {
$("#continue").prop("disabled", !($(this).prop("checked") && $("#read_ct").prop("checked")));
});
+
+
+ const isTaken /* Record<string, string> */ = {}
+
+ function indicateInvalidDisplayName(isValid /* boolean | undefined*/) {
+ // isValid might also be 'undefined', hence we check explicitly for 'true' and 'false'
+ $("#user_display_name").toggleClass("is-valid", isValid === true)
+ $("#user_display_name").toggleClass("is-invalid", isValid === false)
+ }
+
+ function checkDisplayName(){
+ const displayName = $("#user_display_name").val()
+ if(displayName === ""){
Last change of minimal display name length was [in 2006](https://github.com/openstreetmap/openstreetmap-website/commit/37bd2971b49da9364fe5dd25415e97e38b34abd7#diff-9802ca3c9c4cf89904fd44bc114e35ebdf2c5dd3d5b645491e2b253e1afef29bR10). Getting out of sync here is very unlikely. If you think that it is, you can just avoid validating short names by not doing requests and not adding the `is-valid` class.
--
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/4402#discussion_r1426689474
You are receiving this because you are subscribed to this thread.
Message ID: <openstreetmap/openstreetmap-website/pull/4402/review/1781765564 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20231214/7ea9605c/attachment.htm>
More information about the rails-dev
mailing list