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

David Tsiklauri notifications at github.com
Wed Jan 8 11:19:30 UTC 2025


@nertc 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();

On document load now application checks and hides those fields that have "_destroy" checkbox checked. Therefore, this problem was solved.

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

Message ID: <openstreetmap/openstreetmap-website/pull/5439/review/2536876742 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20250108/252c6367/attachment-0001.htm>


More information about the rails-dev mailing list