aboutsummaryrefslogtreecommitdiffstats
path: root/perllib
diff options
context:
space:
mode:
authorHakim Cassimally <hakim@mysociety.org>2014-08-07 12:57:34 +0000
committerHakim Cassimally <hakim@mysociety.org>2014-09-16 16:35:32 +0000
commita956cb82808f01ddd5d78ff510550ba22aaf3d2a (patch)
tree3263d58bcc330b27d68fca2c2b207a938080d43f /perllib
parentfb007dcd9047268896b04b0ee08f7a9822c8d63b (diff)
[EastSussex] tweaks after comments from ESCC
- change front-page text - rename Category to Type By overriding report/new/category template snippet. This is hacked in (including substitution of the "-- Pick a category --" text, as not sure how to simply do this as a cobrand-specific translation. - hide footer on mobile view - pothole field input and display This is a temporary request, which we hope will be superseded by full integration in due course. A command is documented in the cobrand to set the "extra" on the contact info for the Potholes category. This is then displayed by the UI. The default process_extras places it in extra, for potential future processing. As this is a temporary fix, we are calling this field "detail_size", as this is automatically included in "Details" and therefore also sent in the email. (This means that we may need to update data later on to call this "pothole_size" or similar in future?) - contrast tweaks (Via request from Matt Tooke at ESCC.) Not all handled precisely as he suggests: * spacing of button nav -- more or less as suggested, but tweaks for the <span> selected button, and reduced padding on non-frontpage. * sign-in buttons: fixed using CSS for .green-btn instead of adding HTML class throughout. * mobile-footer: edited <footer> css, as suggested by Dave Arter. - revert problematic CSS (breaks map report page) - Remove spurious "FixMyStreet" button - frontpage subheading wording
Diffstat (limited to 'perllib')
-rw-r--r--perllib/FixMyStreet/Cobrand/EastSussex.pm64
1 files changed, 64 insertions, 0 deletions
diff --git a/perllib/FixMyStreet/Cobrand/EastSussex.pm b/perllib/FixMyStreet/Cobrand/EastSussex.pm
index 9eadbed4e..94b404bc3 100644
--- a/perllib/FixMyStreet/Cobrand/EastSussex.pm
+++ b/perllib/FixMyStreet/Cobrand/EastSussex.pm
@@ -42,5 +42,69 @@ sub enter_postcode_text {
# increase map zoom level so street names are visible
sub default_map_zoom { return 3; }
+
+=head2 temp_update_potholes_contact
+
+Routine to update the extra for potholes (temporary setup hack, will be
+superseded by Open311/integration).
+
+Can run with a script or command line like:
+
+ bin/cron-wrapper perl -MFixMyStreet::App -MFixMyStreet::Cobrand::EastSussex -e \
+ 'FixMyStreet::Cobrand::EastSussex->new({c => FixMyStreet::App->new})->temp_update_potholes_contact'
+
+=cut
+
+use constant POTHOLE_SIZES => [
+ {'key' => ['Blank'], 'name' => ['--']},
+ {'key' => ['golf'], 'name' => ['Golf ball sized']},
+ {'key' => ['tennis'], 'name' => ['Tennis ball sized']},
+ {'key' => ['football'], 'name' => ['Football sized']},
+ {'key' => ['larger'], 'name' => ['Larger']}
+];
+
+use constant POTHOLE_DICT => {
+ map {
+ @{ $_->{key} },
+ @{ $_->{name} },
+ } @{ POTHOLE_SIZES() },
+};
+
+sub resolve_pothole_size {
+ my ($self, $key) = @_;
+ return $self->POTHOLE_DICT->{$key};
+}
+
+sub temp_update_potholes_contact {
+ my $self = shift;
+
+ my $category = 'Potholes';
+ my $contact = $self->{c}->model('DB::Contact')
+ ->search({
+ body_id => $self->council_id,
+ category => $category,
+ })->first
+ or die "No such category: $category";
+
+ my $fields = [
+ {
+ 'code' => 'detail_size', # there is already builtin handling for this field in Report::New
+ 'variable' => 'true',
+ 'order' => '1',
+ 'description' => 'Size of the pothole?',
+ 'required' => 'true',
+ 'datatype' => 'singlevaluelist',
+ 'datatype_description' => {},
+ 'values' => {
+ 'value' => $self->POTHOLE_SIZES,
+ },
+ }
+ ];
+ # require IO::String; require RABX;
+ # RABX::wire_wr( $fields, IO::String->new(my $extra) );
+
+ $contact->update({ extra => $fields });
+}
+
1;