[openstreetmap/openstreetmap-website] Add social profile links (PR #5439)

Anton Khorev notifications at github.com
Fri Dec 27 00:57:20 UTC 2024


@AntonKhorev commented on this pull request.



> @@ -225,4 +225,27 @@ $(document).ready(function () {
   $("#read_tou").on("click", function () {
     $("#continue").prop("disabled", !($(this).prop("checked") && $("#read_ct").prop("checked")));
   });
+
+  $("#add-social-link").click(function (event) {
+    event.preventDefault();
+    const newIndex = -(new Date().getTime());
+    const socialLinkForm = $(`
+      <div class="social-link-added-fields row mb-3">
+        <div class="col-sm-8">
+          <input class="form-control" type="text" name="user[social_links_attributes][${newIndex}][url]" id="user_social_links_attributes_${newIndex}_url">      
+        </div>
+        <button type="button" class="btn btn-outline-primary col-sm-1 align-self-start">${I18n.t("javascripts.profiles.edit.social_links.remove")}</button>
+      </div>
+    `);
+
+    socialLinkForm.find("button").click(function () {
+      $(this).parent().remove();

I press this button, this removes the link, and I'd think it's saved. But actually not, failing the validation will resurrect the link.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5439#pullrequestreview-2523560650
You are receiving this because you are subscribed to this thread.

Message ID: <openstreetmap/openstreetmap-website/pull/5439/review/2523560650 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20241226/2090b7cb/attachment.htm>


More information about the rails-dev mailing list