From 19b90689c1d2a9d8a496464820e6fbf9243cf8d4 Mon Sep 17 00:00:00 2001 From: Dave Arter Date: Thu, 31 May 2018 14:41:12 +0100 Subject: [Zurich] Don't delete extra fields when editing contact Editing a contact with extra fields would cause those fields to be deleted because they weren't included in the POST request when saving. This change ensures they're present in the DOM, but hidden by default. --- templates/web/zurich/admin/contact-form.html | 10 ++++++++++ web/cobrands/fixmystreet/admin.js | 7 +++++++ 2 files changed, 17 insertions(+) diff --git a/templates/web/zurich/admin/contact-form.html b/templates/web/zurich/admin/contact-form.html index 8d8d184e6..3840d46a4 100644 --- a/templates/web/zurich/admin/contact-form.html +++ b/templates/web/zurich/admin/contact-form.html @@ -18,6 +18,16 @@

[% loc('Email:') %] +

+ [% loc('Extra fields:') %] + [% IF contact.in_storage %] + ([% loc('show') %]) + [% END %] +

+
+ [% INCLUDE 'admin/extra-metadata-form.html' metas=(contact.get_metadata_for_input OR []) %] +
+

[% IF contact.in_storage %] diff --git a/web/cobrands/fixmystreet/admin.js b/web/cobrands/fixmystreet/admin.js index d1a75a6dc..5c0378ad2 100644 --- a/web/cobrands/fixmystreet/admin.js +++ b/web/cobrands/fixmystreet/admin.js @@ -99,6 +99,13 @@ $(function(){ // Bits for the report extra fields form builder: + // Reveal the UI when 'show' link is clicked + $(".js-show-extra-fields").click(function(e) { + e.preventDefault(); + $(this).hide(); + $(".js-extra-fields-ui").removeClass("hidden-js"); + }); + // If type is changed to 'singlevaluelist' show the options list $(".js-metadata-items").on("change", ".js-metadata-item-type", function() { var $this = $(this); -- cgit v1.2.3