diff options
author | Dave Arter <davea@mysociety.org> | 2018-02-20 11:51:05 +0000 |
---|---|---|
committer | Dave Arter <davea@mysociety.org> | 2018-02-20 12:18:03 +0000 |
commit | 3063317ecf65ef15fa0c563c933b7a2d38702126 (patch) | |
tree | 52190404509e3cd2d61101c9fb8ab1541a028487 | |
parent | d57cf05da497bc013a580e6895002d183ec31e2b (diff) |
Fix duplicate report selection
The underlying DOM structure returned from /report/xx/nearby.json had
changed, meaning the "Which report is it a duplicate of?" list on the
inspector form wasn't displaying any reports. This commit introduces a
template specifically for the nearby URL instead of overloading the
on_map_list_items template.
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Report.pm | 4 | ||||
-rw-r--r-- | templates/web/base/report/nearby.html | 3 | ||||
-rw-r--r-- | web/cobrands/fixmystreet/staff.js | 1 |
3 files changed, 5 insertions, 3 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Report.pm b/perllib/FixMyStreet/App/Controller/Report.pm index ec0e6f886..5e85715a2 100644 --- a/perllib/FixMyStreet/App/Controller/Report.pm +++ b/perllib/FixMyStreet/App/Controller/Report.pm @@ -555,8 +555,8 @@ sub nearby_json : Private { } @$nearby; my $list_html = $c->render_fragment( - 'around/on_map_list_items.html', - { around_map => [], on_map => $nearby } + 'report/nearby.html', + { reports => $nearby } ); my $json = { pins => \@pins }; diff --git a/templates/web/base/report/nearby.html b/templates/web/base/report/nearby.html new file mode 100644 index 000000000..c64b10d7f --- /dev/null +++ b/templates/web/base/report/nearby.html @@ -0,0 +1,3 @@ +[%~ FOREACH problem IN reports ~%] + [%~ INCLUDE 'reports/_list-entry.html' ~%] +[%~ END ~%] diff --git a/web/cobrands/fixmystreet/staff.js b/web/cobrands/fixmystreet/staff.js index 37bfeabaf..4577ab65e 100644 --- a/web/cobrands/fixmystreet/staff.js +++ b/web/cobrands/fixmystreet/staff.js @@ -14,7 +14,6 @@ $.extend(fixmystreet.set_up, { $.getJSON(nearby_url, args, function(data) { var duplicate_of = $("#report_inspect_form [name=duplicate_of]").val(); var $reports = $(data.reports_list) - .filter("li") .not("[data-report-id="+report_id+"]") .slice(0, 5); $reports.filter("[data-report-id="+duplicate_of+"]").addClass("item-list--reports__item--selected"); |