From 3677ed59c33ae64ac8dd1e2b15d7072f4dd843cd Mon Sep 17 00:00:00 2001 From: Matthew Somerville Date: Wed, 6 Jun 2018 18:12:41 +0100 Subject: Improve inspect form position and configurability. Dealing with the map UI changes earlier leads to a better display position, and we add a global variable check to allow cobrands to not use this behaviour. Fixes #1863. --- CHANGELOG.md | 2 ++ web/cobrands/fixmystreet/fixmystreet.js | 11 ++++++----- web/cobrands/fixmystreet/staff.js | 4 +++- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 93dca7ccf..aeddf1abc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,8 @@ * Unreleased - Front end improvements: - Extra help text on contact form #2149 + - Admin improvements: + - Improve inspect form position and configurability. - Bugfixes: - Prevent contact form leaking information about updates #2149 - Fix pointer event issue selecting pin on map. #2130 diff --git a/web/cobrands/fixmystreet/fixmystreet.js b/web/cobrands/fixmystreet/fixmystreet.js index 24597c225..bf920c5b8 100644 --- a/web/cobrands/fixmystreet/fixmystreet.js +++ b/web/cobrands/fixmystreet/fixmystreet.js @@ -1085,6 +1085,12 @@ fixmystreet.display = { // Remove any existing report page content from sidebar $('#side-report').remove(); $('.two_column_sidebar').remove(); + + fixmystreet.mobile_reporting.remove_ui(); + if (fixmystreet.map.updateSize && ($twoColReport.length || $('html').hasClass('mobile'))) { + fixmystreet.map.updateSize(); + } + // Insert this report's content if ($twoColReport.length) { $twoColReport.appendTo('#map_sidebar'); @@ -1101,11 +1107,6 @@ fixmystreet.display = { var page_title = found[1]; fixmystreet.page = 'report'; - fixmystreet.mobile_reporting.remove_ui(); - if (fixmystreet.map.updateSize && ($twoColReport.length || $('html').hasClass('mobile'))) { - fixmystreet.map.updateSize(); - } - $('.big-hide-pins-link').hide(); // If this is the first individual report we've loaded, remove the diff --git a/web/cobrands/fixmystreet/staff.js b/web/cobrands/fixmystreet/staff.js index 0dd635437..824e8fa0b 100644 --- a/web/cobrands/fixmystreet/staff.js +++ b/web/cobrands/fixmystreet/staff.js @@ -225,7 +225,9 @@ $.extend(fixmystreet.set_up, { } // Focus on form - $('html,body').scrollTop($inspect_form.offset().top); + if (!fixmystreet.inspect_form_no_scroll_on_load) { + document.getElementById('side-inspect').scrollIntoView(); + } function updateTemplates(opts) { opts.category = opts.category || $inspect_form.find('[name=category]').val(); -- cgit v1.2.3