aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG.md4
-rw-r--r--data/dashboard.json28
-rw-r--r--perllib/FixMyStreet/App/Controller/Moderate.pm5
-rw-r--r--perllib/FixMyStreet/App/Controller/Report.pm16
-rw-r--r--perllib/FixMyStreet/App/Controller/Reports.pm3
-rw-r--r--perllib/FixMyStreet/Cobrand/Default.pm1
-rw-r--r--perllib/FixMyStreet/Cobrand/Oxfordshire.pm2
-rw-r--r--perllib/FixMyStreet/Integrations/ExorRDI.pm21
-rw-r--r--t/app/controller/report_inspect.t87
-rw-r--r--t/cobrand/oxfordshire.t7
-rw-r--r--templates/web/base/report/_main.html14
-rw-r--r--templates/web/base/report/display.html3
-rw-r--r--templates/web/base/report/update.html8
-rw-r--r--templates/web/base/reports/_list-filters.html16
-rw-r--r--templates/web/base/reports/_status_filter_options.html3
-rw-r--r--templates/web/bromley/report/display.html67
-rw-r--r--templates/web/bromley/report/update-form.html4
-rw-r--r--templates/web/bromley/report/update/form_name.html29
-rw-r--r--templates/web/oxfordshire/reports/_status_filter_options.html7
-rw-r--r--web/cobrands/borsetshire/js.js4
-rw-r--r--web/cobrands/fixmystreet/fixmystreet.js22
21 files changed, 203 insertions, 148 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index b3c9b96be..b4a57c9c6 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -17,11 +17,15 @@
- Only create one update when staff user updating category #1857
- Do not include blank updates in email alerts #1857
- Redirect inspectors correctly on creation in two-tier.
+ - Report status filter All option works for body users #1845
- Admin improvements:
- Character length limit can be placed on report detailed information #1848
- Inspector panel shows nearest address if available #1850
- Return a 200 rather than 404 for ref ID lookup.
- Public report page shows state changes made in admin interface #1846
+ - Remove hidden from default staff state dropdown. #1878
+ - Marking an item as a duplicate enforces providing duplicate id or
+ a public update #1873
* v2.2 (13th September 2017)
- New features:
diff --git a/data/dashboard.json b/data/dashboard.json
index 1da667356..a15ff1b02 100644
--- a/data/dashboard.json
+++ b/data/dashboard.json
@@ -7,17 +7,17 @@
"4": { "id": 4, "name": "South Ward" }
},
"category_options": [
- "Abandoned vehicles",
- "Grafitti",
- "Potholes",
- "Street lighting",
- "Trees",
- "Other"
+ { "name": "Abandoned vehicles", "value": "Abandoned vehicles" },
+ { "name": "Grafitti", "value": "Grafitti" },
+ { "name": "Potholes", "value": "Potholes" },
+ { "name": "Street lighting", "value": "Street lighting" },
+ { "name": "Trees", "value": "Trees" },
+ { "name": "Other", "value": "Other" }
],
"counts_all": {
"wtd": {
"total": 10,
- "planned": 2,
+ "action scheduled": 2,
"in progress": 1,
"investigating": 1,
"fixed - council": 3,
@@ -28,7 +28,7 @@
},
"week": {
"total": 21,
- "planned": 5,
+ "action scheduled": 5,
"in progress": 3,
"investigating": 4,
"fixed - council": 6,
@@ -39,7 +39,7 @@
},
"weeks": {
"total": 57,
- "planned": 5,
+ "action scheduled": 5,
"in progress": 16,
"investigating": 4,
"fixed - council": 23,
@@ -50,7 +50,7 @@
},
"ytd": {
"total": 171,
- "planned": 23,
+ "action scheduled": 23,
"in progress": 34,
"investigating": 9,
"fixed - council": 72,
@@ -63,7 +63,7 @@
"counts_some": {
"wtd": {
"total": 5,
- "planned": 0,
+ "action scheduled": 0,
"in progress": 1,
"investigating": 1,
"fixed - council": 2,
@@ -74,7 +74,7 @@
},
"week": {
"total": 7,
- "planned": 1,
+ "action scheduled": 1,
"in progress": 2,
"investigating": 1,
"fixed - council": 2,
@@ -85,7 +85,7 @@
},
"weeks": {
"total": 57,
- "planned": 5,
+ "action scheduled": 5,
"in progress": 16,
"investigating": 4,
"fixed - council": 23,
@@ -96,7 +96,7 @@
},
"ytd": {
"total": 57,
- "planned": 5,
+ "action scheduled": 5,
"in progress": 16,
"investigating": 4,
"fixed - council": 23,
diff --git a/perllib/FixMyStreet/App/Controller/Moderate.pm b/perllib/FixMyStreet/App/Controller/Moderate.pm
index 42dc759e5..4d3a97fa8 100644
--- a/perllib/FixMyStreet/App/Controller/Moderate.pm
+++ b/perllib/FixMyStreet/App/Controller/Moderate.pm
@@ -21,10 +21,7 @@ data to change.
(Authentication requires:
- user to be from_body
- - user to have a "moderate" record in user_body_permissions (there is
- currently no admin interface for this. Should be added, but
- while we're trialing this, it's a simple case of adding a DB record
- manually)
+ - user to have a "moderate" record in user_body_permissions
The original data of the report is stored in moderation_original_data, so
that it can be reverted/consulted if required. All moderation events are
diff --git a/perllib/FixMyStreet/App/Controller/Report.pm b/perllib/FixMyStreet/App/Controller/Report.pm
index c72c75d3a..138098d5f 100644
--- a/perllib/FixMyStreet/App/Controller/Report.pm
+++ b/perllib/FixMyStreet/App/Controller/Report.pm
@@ -377,15 +377,15 @@ sub inspect : Private {
if ( $problem->state eq 'hidden' ) {
$problem->get_photoset->delete_cached;
}
- if ( $problem->state eq 'duplicate' && $old_state ne 'duplicate' ) {
- # If the report is being closed as duplicate, make sure the
- # update records this.
- $update_params{problem_state} = "duplicate";
- }
- if ( $problem->state ne 'duplicate' ) {
+ if ( $problem->state eq 'duplicate') {
+ if (my $duplicate_of = $c->get_param('duplicate_of')) {
+ $problem->set_duplicate_of($duplicate_of);
+ } elsif (not $c->get_param('public_update')) {
+ $valid = 0;
+ push @{ $c->stash->{errors} }, _('Please provide a duplicate ID or public update for this report.');
+ }
+ } else {
$problem->unset_extra_metadata('duplicate_of');
- } elsif (my $duplicate_of = $c->get_param('duplicate_of')) {
- $problem->set_duplicate_of($duplicate_of);
}
if ( $problem->state ne $old_state ) {
diff --git a/perllib/FixMyStreet/App/Controller/Reports.pm b/perllib/FixMyStreet/App/Controller/Reports.pm
index b0015acc5..b6281f0ca 100644
--- a/perllib/FixMyStreet/App/Controller/Reports.pm
+++ b/perllib/FixMyStreet/App/Controller/Reports.pm
@@ -575,16 +575,19 @@ sub stash_report_filter_status : Private {
my $s = FixMyStreet::DB::Result::Problem->open_states();
%filter_problem_states = (%filter_problem_states, %$s);
$filter_status{open} = 1;
+ $filter_status{$_} = 1 for keys %$s;
}
if ($status{closed}) {
my $s = FixMyStreet::DB::Result::Problem->closed_states();
%filter_problem_states = (%filter_problem_states, %$s);
$filter_status{closed} = 1;
+ $filter_status{$_} = 1 for keys %$s;
}
if ($status{fixed}) {
my $s = FixMyStreet::DB::Result::Problem->fixed_states();
%filter_problem_states = (%filter_problem_states, %$s);
$filter_status{fixed} = 1;
+ $filter_status{$_} = 1 for keys %$s;
}
if ($status{all}) {
diff --git a/perllib/FixMyStreet/Cobrand/Default.pm b/perllib/FixMyStreet/Cobrand/Default.pm
index b482d7612..9e49099aa 100644
--- a/perllib/FixMyStreet/Cobrand/Default.pm
+++ b/perllib/FixMyStreet/Cobrand/Default.pm
@@ -1084,7 +1084,6 @@ sub state_groups_inspect {
[ $rs->display('confirmed'), [ grep { $_ ne 'planned' } FixMyStreet::DB::Result::Problem->open_states ] ],
@fixed ? [ $rs->display('fixed'), [ 'fixed - council' ] ] : (),
[ $rs->display('closed'), [ grep { $_ ne 'closed' } FixMyStreet::DB::Result::Problem->closed_states ] ],
- [ $rs->display('hidden'), [ 'hidden' ] ]
]
}
diff --git a/perllib/FixMyStreet/Cobrand/Oxfordshire.pm b/perllib/FixMyStreet/Cobrand/Oxfordshire.pm
index cdd186fef..23324e763 100644
--- a/perllib/FixMyStreet/Cobrand/Oxfordshire.pm
+++ b/perllib/FixMyStreet/Cobrand/Oxfordshire.pm
@@ -217,7 +217,7 @@ sub user_extra_fields {
sub display_days_ago_threshold { 28 }
-sub max_detailed_info_length { 172 }
+sub max_detailed_info_length { 164 }
sub defect_type_extra_fields {
return [
diff --git a/perllib/FixMyStreet/Integrations/ExorRDI.pm b/perllib/FixMyStreet/Integrations/ExorRDI.pm
index 093688e47..dc865e1ad 100644
--- a/perllib/FixMyStreet/Integrations/ExorRDI.pm
+++ b/perllib/FixMyStreet/Integrations/ExorRDI.pm
@@ -46,6 +46,9 @@ sub construct {
time_zone => FixMyStreet->time_zone || FixMyStreet->local_time_zone
);
+ my $tmo = $cobrand->traffic_management_options;
+ my %tm_lookup = map { $tmo->[$_] => $_ + 1 } 0..$#$tmo;
+
my $missed_cutoff = $now - DateTime::Duration->new( hours => 24 );
my %params = (
-and => [
@@ -102,7 +105,7 @@ sub construct {
my $i = 0;
foreach my $inspector_id (keys %$inspectors) {
my $inspections = $inspectors->{$inspector_id};
- my $initials = $inspector_initials->{$inspector_id};
+ my $initials = $inspector_initials->{$inspector_id} || "XX";
my %body_by_activity_code;
foreach my $report (@$inspections) {
@@ -116,13 +119,17 @@ sub construct {
$location .= " Nearest postcode: $closest_address->{postcode}{postcode}." if $closest_address->{postcode};
}
- my $description = sprintf("%s %s", $report->external_id || "", $report->get_extra_metadata('detailed_information') || "");
+ my $traffic_information = $report->get_extra_metadata('traffic_information') || 'none';
+ my $description = sprintf("%s %s %s %s",
+ $report->external_id || "",
+ $initials,
+ 'TM' . ($tm_lookup{$traffic_information} || '0'),
+ $report->get_extra_metadata('detailed_information') || "");
+ # Maximum length of 180 characters total
+ $description = substr($description, 0, 180);
my $activity_code = $report->defect_type ?
$report->defect_type->get_extra_metadata('activity_code')
: 'MC';
- my $traffic_information = $report->get_extra_metadata('traffic_information') ?
- 'TM ' . $report->get_extra_metadata('traffic_information')
- : 'TM none';
$body_by_activity_code{$activity_code} ||= [];
$csv->add_row($body_by_activity_code{$activity_code},
@@ -133,7 +140,7 @@ sub construct {
$location, # defect location field, which we don't capture from inspectors
$report->inspection_log_entry->whenedited->strftime("%H%M"), # defect time raised
"","","","","","","", # empty fields
- $traffic_information,
+ "TM $traffic_information",
$description, # defect description
);
@@ -169,7 +176,7 @@ sub construct {
"G", # start of an area/sequence
$link_id, # area/link id, fixed value for our purposes
"","", # must be empty
- $initials || "XX", # inspector initials
+ $initials, # inspector initials
$self->inspection_date->strftime("%y%m%d"), # date of inspection yymmdd
"1600", # time of inspection hhmm, set to static value for now
"D", # inspection variant, should always be D
diff --git a/t/app/controller/report_inspect.t b/t/app/controller/report_inspect.t
index f74c94c34..74d99c0a9 100644
--- a/t/app/controller/report_inspect.t
+++ b/t/app/controller/report_inspect.t
@@ -148,6 +148,67 @@ FixMyStreet::override_config {
$report2->update;
};
+ subtest "can mark a report as duplicate without supplying a duplicate and a public update" => sub {
+ my $old_state = $report->state;
+ $report->comments->delete_all;
+
+ $mech->get_ok("/report/$report_id");
+ $mech->submit_form_ok({ button => 'save', with_fields => { state => 'Duplicate', include_update => "0" } });
+
+ $mech->content_contains('provide a duplicate ID', "error message about missing duplicate id");
+ $report->discard_changes;
+ $report2->discard_changes;
+
+ is $report->state, $old_state, 'report not marked as duplicate';
+ is $report->comments->search({ problem_state => 'duplicate' })->count, 0, 'no update marking report as duplicate was left';
+
+ is $report->get_extra_metadata('duplicate_of'), undef;
+
+ $mech->submit_form_ok({ button => 'save', with_fields => { state => 'Duplicate', public_update => 'This is a duplicate', include_update => "1" } });
+ $mech->content_lacks('provide a duplicate ID', "no error message about missing duplicate id");
+ $report->discard_changes;
+ $report2->discard_changes;
+
+ is $report->state, 'duplicate', 'report marked as duplicate';
+ is $report->comments->search({ problem_state => 'duplicate' })->count, 1, 'update marking report as duplicate was left';
+ is $report->get_extra_metadata('duplicate_of'), undef;
+ is_deeply $report2->get_extra_metadata('duplicates'), undef;
+
+ $report->update({ state => $old_state });
+ };
+
+ subtest "can mark a report as duplicate without supplying a public update and a duplicate id" => sub {
+ my $old_state = $report->state;
+ $report->comments->delete_all;
+
+ $mech->get_ok("/report/$report_id");
+ $mech->submit_form_ok({ button => 'save', with_fields => { state => 'Duplicate', include_update => "0" } });
+
+ $mech->content_contains('provide a duplicate ID', "error message about missing duplicate id");
+ $report->discard_changes;
+ $report2->discard_changes;
+
+ is $report->state, $old_state, 'report not marked as duplicate';
+ is $report->comments->search({ problem_state => 'duplicate' })->count, 0, 'no update marking report as duplicate was left';
+
+ is $report->get_extra_metadata('duplicate_of'), undef;
+
+ $mech->submit_form_ok({ button => 'save', with_fields => { state => 'Duplicate', duplicate_of => $report2->id, include_update => "0" } });
+ $mech->content_lacks('provide a duplicate ID', "no error message about missing duplicate id");
+ $report->discard_changes;
+ $report2->discard_changes;
+
+ is $report->state, 'duplicate', 'report marked as duplicate';
+ is $report->comments->search({ problem_state => 'duplicate' })->count, 1, 'update marking report as duplicate was left';
+ is $report->get_extra_metadata('duplicate_of'), $report2->id;
+ is_deeply $report2->get_extra_metadata('duplicates'), [ $report->id ];
+
+ $report->set_extra_metadata('duplicate_of', undef);
+ $report->update({ state => $old_state });
+ $report2->set_extra_metadata('duplicates', undef);
+ $report2->update;
+ };
+
subtest "marking a report as a duplicate with update correctly sets update status" => sub {
my $old_state = $report->state;
$report->comments->delete_all;
@@ -386,36 +447,36 @@ foreach my $test (
button => 'save',
with_fields => {
include_update => 0,
- detailed_information => 'XXX172XXX' . 'x' x 163,
+ detailed_information => 'XXX164XXX' . 'x' x (164-9)
}
});
$report->discard_changes;
- like $report->get_extra_metadata('detailed_information'), qr/XXX172XXX/, 'detailed information saved';
- $mech->content_lacks('limited to 172 characters', "172 charcters of detailed information ok");
- $mech->content_contains('XXX172XXX', "Detailed information field contains submitted text");
+ like $report->get_extra_metadata('detailed_information'), qr/XXX164XXX/, 'detailed information saved';
+ $mech->content_lacks('limited to 164 characters', "164 charcters of detailed information ok");
+ $mech->content_contains('XXX164XXX', "Detailed information field contains submitted text");
$mech->submit_form_ok({
button => 'save',
with_fields => {
include_update => 0,
- detailed_information => 'XXX173XXX' . 'x' x 164,
+ detailed_information => 'XXX165XXX' . 'x' x (164-8)
}
});
if ($test->{limited}) {
- $mech->content_contains('172 characters maximum');
- $mech->content_contains('limited to 172 characters', "173 charcters of detailed information not ok");
- $mech->content_contains('XXX173XXX', "Detailed information field contains submitted text");
+ $mech->content_contains('164 characters maximum');
+ $mech->content_contains('limited to 164 characters', "165 charcters of detailed information not ok");
+ $mech->content_contains('XXX165XXX', "Detailed information field contains submitted text");
$report->discard_changes;
- like $report->get_extra_metadata('detailed_information'), qr/XXX172XXX/, 'detailed information not saved';
+ like $report->get_extra_metadata('detailed_information'), qr/XXX164XXX/, 'detailed information not saved';
} else {
$mech->content_lacks(' characters maximum');
- $mech->content_lacks('limited to 172 characters', "173 charcters of detailed information ok");
- $mech->content_contains('XXX173XXX', "Detailed information field contains submitted text");
+ $mech->content_lacks('limited to 164 characters', "165 charcters of detailed information ok");
+ $mech->content_contains('XXX165XXX', "Detailed information field contains submitted text");
$report->discard_changes;
- like $report->get_extra_metadata('detailed_information'), qr/XXX173XXX/, 'detailed information saved';
+ like $report->get_extra_metadata('detailed_information'), qr/XXX165XXX/, 'detailed information saved';
}
};
};
@@ -498,7 +559,7 @@ FixMyStreet::override_config {
public_update => '',
priority => $rp->id,
include_update => '1',
- detailed_information => 'XXX172XXXxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
+ detailed_information => 'XXX164XXXxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
defect_type => '',
traffic_information => ''
};
diff --git a/t/cobrand/oxfordshire.t b/t/cobrand/oxfordshire.t
index abafa1fe8..dcf8b25c9 100644
--- a/t/cobrand/oxfordshire.t
+++ b/t/cobrand/oxfordshire.t
@@ -107,6 +107,7 @@ subtest 'Exor file looks okay' => sub {
foreach my $problem (@problems) {
$problem->update({ state => 'action scheduled', external_id => $i });
$problem->update({ defect_type => $dt }) if $i == 123;
+ $problem->set_extra_metadata(traffic_information => 'Signs and Cones') if $i == 124;
$problem->update({ defect_type => $dt2 }) if $i == 124;
FixMyStreet::DB->resultset('AdminLog')->create({
admin_user => $inspector->name,
@@ -129,19 +130,19 @@ subtest 'Exor file looks okay' => sub {
"1,1.8,1.0.0.0,ENHN,"
"G,1989169,,,XX,170505,1600,D,INS,N,,,,"
"H,FC"
-"I,FC,,XXX,"434970E 209683N Nearest postcode: OX28 4DS.",1200,,,,,,,,"TM none","123 ""
+"I,FC,,XXX,"434970E 209683N Nearest postcode: OX28 4DS.",1200,,,,,,,,"TM none","123 XX TM0 ""
"J,SFP1,2,,,434970,209683,,,,,"
"M,resolve,,,/CFC,,"
"P,0,999999"
"G,1989169,,,XX,170505,1600,D,INS,N,,,,"
"H,MC"
-"I,MC,,XXX,"434970E 209683N Nearest postcode: OX28 4DS.",1200,,,,,,,,"TM none","125 ""
+"I,MC,,XXX,"434970E 209683N Nearest postcode: OX28 4DS.",1200,,,,,,,,"TM none","125 XX TM0 ""
"J,SFP2,2,,,434970,209683,,,,,"
"M,resolve,,,/CMC,,"
"P,0,999999"
"G,1989169,,,XX,170505,1600,D,INS,N,,,,"
"H,S"
-"I,S,,XXX,"434970E 209683N Nearest postcode: OX28 4DS.",1200,,,,,,,,"TM none","124 ""
+"I,S,,XXX,"434970E 209683N Nearest postcode: OX28 4DS.",1200,,,,,,,,"TM Signs and Cones","124 XX TM1 ""
"J,ACC2,2,,,434970,209683,,,,,"
"M,resolve,,,/CSI,,"
"P,0,999999"
diff --git a/templates/web/base/report/_main.html b/templates/web/base/report/_main.html
index 405cb2118..25bbd4c33 100644
--- a/templates/web/base/report/_main.html
+++ b/templates/web/base/report/_main.html
@@ -1,13 +1,9 @@
-[% IF c.user_exists %]
- [% DEFAULT permissions = c.user.permissions(c, problem.bodies_str) %]
-[%- END %]
-
<a href="[% c.uri_for( '/around', { lat => latitude, lon => longitude } ) %]"
class="problem-back js-back-to-report-list">[% loc('Back to all reports') %]</a>
<div class="problem-header clearfix" data-lastupdate="[% problem.lastupdate %]">
-[% IF c.user.has_permission_to('planned_reports', problem.bodies_str_ids) %]
+[% IF permissions.planned_reports %]
<form method="post" action="/my/planned/change" id="planned_form" class="hidden-label-target">
<input type="hidden" name="id" value="[% problem.id %]">
<input type="hidden" name="token" value="[% csrf_token %]">
@@ -124,16 +120,12 @@
</form>
[% END %]
- [% IF
- (permissions.moderate)
- OR
- (c.user.has_permission_to('planned_reports', problem.bodies_str_ids))
- %]
+ [% IF permissions.moderate OR permissions.planned_reports %]
<div class="moderate-display segmented-control" role="menu">
[% IF permissions.moderate %]
<a class="js-moderate btn" role="menuitem" aria-label="[% loc('Moderate this report') %]">[% loc('Moderate') %]</a>
[% END %]
- [% IF c.user.has_permission_to('planned_reports', problem.bodies_str_ids) %]
+ [% IF permissions.planned_reports %]
[%~ IF c.user.is_planned_report(problem) ~%]
<label class="btn btn--shortlisted" for="shortlist-report" role="menuitem" aria-label="[% loc('Remove from shortlist') %]">[% loc('Shortlisted') %]</label>
[%~ ELSE ~%]
diff --git a/templates/web/base/report/display.html b/templates/web/base/report/display.html
index 7c26c4938..d5e3bdcfa 100644
--- a/templates/web/base/report/display.html
+++ b/templates/web/base/report/display.html
@@ -39,6 +39,9 @@
[% END %]
[% INCLUDE 'report/banner.html' %]
+[% IF c.user_exists %]
+ [% DEFAULT permissions = c.user.permissions(c, problem.bodies_str) %]
+[%- END %]
[% INCLUDE 'report/_main.html' %]
[% IF problem.duplicate_of %]
diff --git a/templates/web/base/report/update.html b/templates/web/base/report/update.html
index 5691376e6..6dca226fe 100644
--- a/templates/web/base/report/update.html
+++ b/templates/web/base/report/update.html
@@ -1,12 +1,10 @@
-[% moderating = c.user && c.user.has_permission_to('moderate', problem.bodies_str_ids) %]
-
[% IF loop.first %]
<section class="full-width">
<h4 class="static-with-rule">[% loc('Updates') %]</h4>
<ul class="item-list item-list--updates">
[% END %]
<li class="item-list__item item-list__item--updates">
- [% IF moderating; original_update = update.moderation_original_data %]
+ [% IF permissions.moderate; original_update = update.moderation_original_data %]
<form method="post" action="/moderate/report/[% problem.id %]/update/[% update.id %]">
<input type="hidden" name="token" value="[% csrf_token %]">
<input type="button" class="btn js-moderate moderate-display" value="[% loc('Moderate this update') %]">
@@ -33,7 +31,7 @@
<div class="moderate-display">
[% update.text | add_links | markup(update.user) | html_para %]
</div>
- [% IF moderating %]
+ [% IF permissions.moderate %]
<div class="moderate-edit">
[% IF update.text != original.detail %]
<label><input type="checkbox" name="update_revert_detail" class="revert-textarea">
@@ -66,7 +64,7 @@
</div>
[% END %]
</div>
- [% IF moderating %]
+ [% IF permissions.moderate %]
<div class="moderate-edit">
<label for="moderation_reason">[% loc('Moderation reason:') %]</label>
<input type="text" class="form-control" name="moderation_reason"
diff --git a/templates/web/base/reports/_list-filters.html b/templates/web/base/reports/_list-filters.html
index 50e88857d..ab8ac06f7 100644
--- a/templates/web/base/reports/_list-filters.html
+++ b/templates/web/base/reports/_list-filters.html
@@ -1,10 +1,18 @@
[% select_status = BLOCK %]
<select class="form-control js-multiple" name="status" id="statuses" multiple
- data-all="[% loc('All') %]" data-all-options='["open","closed","fixed"]'
- [%~ IF c.cobrand.on_map_default_status == 'open' %]
- data-none="[% loc('Unfixed reports') %]"
+ data-all="[% loc('All') %]"
+ [% IF c.user_exists AND c.user.is_superuser OR c.user.belongs_to_body(body.id) %]
+ [% options = []; FOR group IN filter_states; FOR state IN group.1; NEXT IF state == 'hidden'; options.push(state); END; END %]
+ data-all-options='["[% options.join('", "') %]"]'
+ [%~ ELSE ~%]
+ [%~ IF has_fixed_state ~%]
+ data-all-options='["open","closed","fixed"]'
+ [%~ ELSE ~%]
+ data-all-options='["open","closed"]'
+ [%~ END ~%]
[%~ END ~%]
- >
+ [% INCLUDE 'reports/_status_filter_options.html' %]
+ >
[% IF c.user_exists AND c.user.has_body_permission_to('planned_reports') AND !shortlist %]
<option value="shortlisted"[% ' selected' IF filter_status.shortlisted %]>[% loc('Shortlisted') %]</option>
<option value="unshortlisted"[% ' selected' IF filter_status.unshortlisted %]>[% loc('Unshortlisted') %]</option>
diff --git a/templates/web/base/reports/_status_filter_options.html b/templates/web/base/reports/_status_filter_options.html
new file mode 100644
index 000000000..b761222e0
--- /dev/null
+++ b/templates/web/base/reports/_status_filter_options.html
@@ -0,0 +1,3 @@
+ [%~ IF c.cobrand.on_map_default_status == 'open' %]
+ data-none="[% prettify_state('confirmed') %]"
+ [%~ END ~%]
diff --git a/templates/web/bromley/report/display.html b/templates/web/bromley/report/display.html
deleted file mode 100644
index 4c1a69bca..000000000
--- a/templates/web/bromley/report/display.html
+++ /dev/null
@@ -1,67 +0,0 @@
-[%
- PROCESS "report/photo-js.html";
- PROCESS "maps/${map.type}.html";
-
- problem_title = problem.title_safe _ ' - ' _ loc('Viewing a problem');
- INCLUDE 'header.html'
- title = problem_title
- rss = [ loc('Updates to this problem, FixMyStreet'), "/rss/$problem.id" ]
- robots = 'index, nofollow'
- bodyclass = 'mappage'
-%]
-
-[% map_html %]
-</div>
-
-<div id="map_sidebar">
-
-[% IF login_success %]
- <p class='form-success'>[% loc('You have successfully signed in; please check and confirm your details are accurate:') %]</p>
-[% END %]
-
-[% INCLUDE 'report/banner.html' %]
-[% INCLUDE 'report/_main.html' %]
-
-[% IF problem.duplicate_of %]
- [% INCLUDE 'report/duplicate-no-updates.html' hide_header = 1 %]
-[% END %]
-
-[% INCLUDE 'report/display_tools.html' %]
-[% INCLUDE 'report/updates.html' %]
-
-[% IF problem.duplicate_of %]
- [% INCLUDE 'report/duplicate-no-updates.html' %]
-[% ELSE %]
- [% INCLUDE 'report/update-form.html' %]
-[% END %]
-</div>
-
-[% INCLUDE 'footer.html' %]
-
-[% BLOCK name %]
- [% INCLUDE 'report/new/extra_name.html' %]
-
- [% IF c.user_exists %]
- [% names = c.user.split_name %]
- [% END %]
- <label for="form_first_name">[% loc('First Name') %]</label>
- [% IF field_errors.first_name %]
- <p class='form-error'>[% field_errors.first_name %]</p>
- [% END %]
- <input class="js-form-name form-control" type="text" value="[% names.first || first_name | html %]" name="first_name" id="form_first_name" placeholder="[% loc('Your first name') %]">
-
- <label for="form_last_name">[% loc('Last Name') %]</label>
- [% IF field_errors.last_name %]
- <p class='form-error'>[% field_errors.last_name %]</p>
- [% END %]
- <input class="js-form-name form-control" type="text" value="[% names.last || last_name | html %]" name="last_name" id="form_last_name" placeholder="[% loc('Your last name') %]">
-
- <div class="checkbox-group">
- <input type="checkbox" name="may_show_name" id="form_may_show_name" value="1"[% ' checked' IF update AND NOT update.anonymous %]>
- <label class="inline" for="form_may_show_name">[% loc('Show my name publicly') %]</label>
- </div>
- <div class="checkbox-group">
- <input type="checkbox" name="add_alert" id="form_add_alert" value="1"[% ' checked' IF add_alert %]>
- <label class="inline" for="form_add_alert">[% loc( 'Alert me to future updates' ) %]</label>
- </div>
-[% END %]
diff --git a/templates/web/bromley/report/update-form.html b/templates/web/bromley/report/update-form.html
index 22dfb1c08..e6d0e1bc0 100644
--- a/templates/web/bromley/report/update-form.html
+++ b/templates/web/bromley/report/update-form.html
@@ -71,7 +71,7 @@
[% IF c.user_exists %]
- [% INCLUDE name %]
+ [% INCLUDE 'report/update/form_name.html' %]
<input class="final-submit green-btn js-submit_register" type="submit" name="submit_register" value="[% loc('Post') %]">
@@ -93,7 +93,7 @@
<div id="form_sign_in_no" class="form-box">
<h5>Confirm my report by email</h5>
- [% INCLUDE name %]
+ [% INCLUDE 'report/update/form_name.html' %]
<label for="password_register">[% loc('Password (optional)') %]</label>
diff --git a/templates/web/bromley/report/update/form_name.html b/templates/web/bromley/report/update/form_name.html
new file mode 100644
index 000000000..a33d144bd
--- /dev/null
+++ b/templates/web/bromley/report/update/form_name.html
@@ -0,0 +1,29 @@
+[% INCLUDE 'report/new/extra_name.html' %]
+
+[% PROCESS 'user/_anonymity.html' anonymous = update.anonymous %]
+
+[% IF c.user_exists %]
+ [% names = c.user.split_name %]
+[% END %]
+
+<label for="form_first_name">[% loc('First Name') %]</label>
+[% IF field_errors.first_name %]
+ <p class='form-error'>[% field_errors.first_name %]</p>
+[% END %]
+<input class="js-form-name form-control" type="text" value="[% names.first || first_name | html %]" name="first_name" id="form_first_name" placeholder="[% loc('Your first name') %]">
+
+<label for="form_last_name">[% loc('Last Name') %]</label>
+[% IF field_errors.last_name %]
+ <p class='form-error'>[% field_errors.last_name %]</p>
+[% END %]
+<input class="js-form-name form-control" type="text" value="[% names.last || last_name | html %]" name="last_name" id="form_last_name" placeholder="[% loc('Your last name') %]">
+
+<div class="checkbox-group">
+ <input type="checkbox" name="may_show_name" id="form_may_show_name" value="1"[% ' checked' IF name_public %]>
+ <label class="inline" for="form_may_show_name">[% loc('Show my name publicly') %]</label>
+</div>
+
+<div class="checkbox-group">
+ <input type="checkbox" name="add_alert" id="form_add_alert" value="1"[% ' checked' IF add_alert %]>
+ <label class="inline" for="form_add_alert">[% loc( 'Alert me to future updates' ) %]</label>
+</div>
diff --git a/templates/web/oxfordshire/reports/_status_filter_options.html b/templates/web/oxfordshire/reports/_status_filter_options.html
new file mode 100644
index 000000000..7f4fd5ace
--- /dev/null
+++ b/templates/web/oxfordshire/reports/_status_filter_options.html
@@ -0,0 +1,7 @@
+ [% IF c.user_exists AND c.user.is_superuser OR c.user.belongs_to_body(body.id) %]
+ data-none="All unresolved"
+ data-extra="All unresolved"
+ data-extra-options='["confirmed","investigating","action scheduled"]'
+ [% ELSE %]
+ data-none="Open"
+ [%~ END ~%]
diff --git a/web/cobrands/borsetshire/js.js b/web/cobrands/borsetshire/js.js
index eee78df43..9fdb3e31b 100644
--- a/web/cobrands/borsetshire/js.js
+++ b/web/cobrands/borsetshire/js.js
@@ -1,7 +1,7 @@
(function(){
function set_redirect(form) {
- var e = form.email.value;
+ var e = form.username.value;
if (e == 'inspector@example.org') {
form.r.value = 'my/planned';
} else if (e == 'cs@example.org') {
@@ -13,7 +13,7 @@
$('#demo-user-list dt').click(function(){
var form = document.forms.general_auth;
- form.email.value = $(this).text();
+ form.username.value = $(this).text();
form.password_sign_in.value = 'password';
set_redirect(form);
form.submit();
diff --git a/web/cobrands/fixmystreet/fixmystreet.js b/web/cobrands/fixmystreet/fixmystreet.js
index cc156569f..6825ecbce 100644
--- a/web/cobrands/fixmystreet/fixmystreet.js
+++ b/web/cobrands/fixmystreet/fixmystreet.js
@@ -113,15 +113,25 @@ function isR2L() {
make_multi: function() {
var $this = $(this),
- all = $this.data('all');
+ all = $this.data('all'),
+ none = $this.data('none') || all,
+ allOpts = $this.data('all-options') || [],
+ extra = $this.data('extra'),
+ extraOpts = $this.data('extra-options') || [];
+
+ var presets = [{
+ name: all,
+ options: allOpts
+ }];
+
+ if (extra) {
+ presets.push({name: extra, options: extraOpts});
+ }
$this.multiSelect({
allText: all,
- noneText: all,
+ noneText: none,
positionMenuWithin: $('#side'),
- presets: [{
- name: all,
- options: []
- }]
+ presets: presets
});
}