diff options
author | Chris Mytton <chrism@mysociety.org> | 2020-04-08 14:39:19 +0100 |
---|---|---|
committer | Dave Arter <davea@mysociety.org> | 2020-08-06 10:59:14 +0100 |
commit | ed0002b0d76560cc3d5b1e62f8395bbfae74403c (patch) | |
tree | 32a1ee32d0d447ba01207e66d3aab0b09a1f525d /web | |
parent | 30de263a85621fcad51991661475cdc422730c12 (diff) |
Add photo upload field to inspector form
This adds the code for photo uploads from the regular update form to the
inspector form, and adds details to the documentation.
Diffstat (limited to 'web')
-rw-r--r-- | web/cobrands/fixmystreet/fixmystreet.js | 11 | ||||
-rw-r--r-- | web/cobrands/fixmystreet/staff.js | 8 |
2 files changed, 11 insertions, 8 deletions
diff --git a/web/cobrands/fixmystreet/fixmystreet.js b/web/cobrands/fixmystreet/fixmystreet.js index 032140298..8073530c6 100644 --- a/web/cobrands/fixmystreet/fixmystreet.js +++ b/web/cobrands/fixmystreet/fixmystreet.js @@ -660,6 +660,11 @@ $.extend(fixmystreet.set_up, { }, dropzone: function($context) { + if ('Dropzone' in window) { + Dropzone.autoDiscover = false; + } else { + return; + } // Pass a jQuery element, eg $('.foobar'), into this function // to limit all the selectors to that element. Handy if you want @@ -670,12 +675,6 @@ $.extend(fixmystreet.set_up, { $context = $(document); } - if ('Dropzone' in window) { - Dropzone.autoDiscover = false; - } else { - return; - } - var forms = $('[for="form_photo"], .js-photo-label', $context).closest('form'); forms.each(function() { // Internal $context is the individual form with the photo upload inside diff --git a/web/cobrands/fixmystreet/staff.js b/web/cobrands/fixmystreet/staff.js index 89d7cab39..e62ae6ba7 100644 --- a/web/cobrands/fixmystreet/staff.js +++ b/web/cobrands/fixmystreet/staff.js @@ -137,6 +137,10 @@ fixmystreet.staff_set_up = { document.getElementById('side-inspect').scrollIntoView(); } + // make sure dropzone is set up, otherwise loading problem with + // JS leaves this uninitialized. + fixmystreet.set_up.dropzone($inspect_form); + function updateTemplates(opts) { opts.category = opts.category || $inspect_form.find('[name=category]').val(); opts.state = opts.state || $inspect_form.find('[name=state]').val(); @@ -212,9 +216,9 @@ fixmystreet.staff_set_up = { var $checkbox = $(this); var toggle_public_update = function() { if ($checkbox.prop('checked')) { - $('#public_update').parents('p').show(); + $('#public_update_form_fields').show(); } else { - $('#public_update').parents('p').hide(); + $('#public_update_form_fields').hide(); } }; $checkbox.on('change', function() { |