diff options
20 files changed, 204 insertions, 54 deletions
diff --git a/bin/update-all-reports b/bin/update-all-reports index 2ede68fe0..d0146dd47 100755 --- a/bin/update-all-reports +++ b/bin/update-all-reports @@ -59,9 +59,9 @@ while ( my @problem = $problems->next ) { my $type = ( $problem{duration} > 2 * $fourweeks ) ? 'unknown' : ($problem{age} > $fourweeks ? 'older' : 'new'); - if (FixMyStreet::DB::Result::Problem->fixed_states()->{$problem{state}}) { + if (FixMyStreet::DB::Result::Problem->fixed_states()->{$problem{state}} || FixMyStreet::DB::Result::Problem->closed_states()->{$problem{state}}) { # Fixed problems are either old or new - $fixed{$body}{$duration_str}++ if FixMyStreet::DB::Result::Problem->fixed_states()->{$problem{state}}; + $fixed{$body}{$duration_str}++; } else { # Open problems are either unknown, older, or new $open{$body}{$type}++ if $problem{state} eq 'confirmed'; diff --git a/conf/general.yml-example b/conf/general.yml-example index 4fbf43635..175b342a4 100644 --- a/conf/general.yml-example +++ b/conf/general.yml-example @@ -23,8 +23,14 @@ EMAIL_DOMAIN: 'example.org' CONTACT_EMAIL: 'team@example.org' CONTACT_NAME: 'FixMyStreet' -# Whether this is a development site or not. +# Whether this is a development site or not. It will mean e.g. templates/ +# CSS modified times aren't cached STAGING_SITE: 1 +# Normally, a staging site will route all reports to CONTACT_EMAIL on a +# development site (when STAGING_SITE is 1), to guard against sending fake +# reports to live places. Set this to 1 if you want a dev site to route +# reports as normal. +SEND_REPORTS_ON_STAGING: 0 # What to use as front page/alert example places placeholder # Defaults to High Street, Main Street diff --git a/locale/de_CH.UTF-8/LC_MESSAGES/FixMyStreet.po b/locale/de_CH.UTF-8/LC_MESSAGES/FixMyStreet.po index 7b483d90d..7a4560aa3 100644 --- a/locale/de_CH.UTF-8/LC_MESSAGES/FixMyStreet.po +++ b/locale/de_CH.UTF-8/LC_MESSAGES/FixMyStreet.po @@ -7,10 +7,9 @@ msgstr "" "Project-Id-Version: 1.0\n" "Report-Msgid-Bugs-To: matthew@mysociety.org\n" "POT-Creation-Date: 2013-01-16 12:43+0000\n" -"PO-Revision-Date: 2013-01-15 17:55+0100\n" +"PO-Revision-Date: 2013-01-16 17:30+0100\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <team@fixmystreet.com>\n" -"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -1963,7 +1962,7 @@ msgstr "Fotos von neuen Meldungen in der Nähe" #: templates/web/default/js/translation_strings.html:24 msgid "Place pin on map" -msgstr "" +msgstr "Pin auf der Karte absetzen" #: templates/web/bromley/report/display.html:80 #: templates/web/bromley/report/display.html:81 @@ -2705,7 +2704,7 @@ msgstr "" #: templates/web/default/js/translation_strings.html:22 msgid "Right place?" -msgstr "" +msgstr "Richtiger Ort?" #: perllib/FixMyStreet/Geocode/OSM.pm:173 msgid "" @@ -3323,6 +3322,8 @@ msgid "" "remember your password, or do not have one, please fill in the ‘sign " "in by email’ section of the form." msgstr "" +"Ihre Email/Passwort Kombination war ungültig. Bitte versuchen Sie es " +"erneut oder wenden Sie sich an den Administrator." #: perllib/FixMyStreet/App/Controller/Alert.pm:355 msgid "" @@ -3486,7 +3487,7 @@ msgstr "Total" #: templates/web/default/js/translation_strings.html:23 msgid "Try again" -msgstr "" +msgstr "Erneut versuchen" #: templates/web/default/admin/report_edit.html:19 #: templates/web/default/admin/report_edit.html:22 @@ -4274,8 +4275,8 @@ msgstr[1] "<big>%s</big> Meldungen in der letzten Woche" #, perl-format msgid "<big>%s</big> fixed in past month" msgid_plural "<big>%s</big> fixed in past month" -msgstr[0] "<big>%s</big> bearbeiteter Mangel im letzten Monat" -msgstr[1] "<big>%s</big> bearbeitete Mängel im letzten Monat" +msgstr[0] "<big>%s</big> bearbeitete Meldung im letzten Monat" +msgstr[1] "<big>%s</big> bearbeitete Meldungen im letzten Monat" #: templates/web/default/report/new/councils_text_some.html:14 #, perl-format diff --git a/perllib/FixMyStreet/App/Controller/Around.pm b/perllib/FixMyStreet/App/Controller/Around.pm index 5090ef7ff..8f651fae2 100644 --- a/perllib/FixMyStreet/App/Controller/Around.pm +++ b/perllib/FixMyStreet/App/Controller/Around.pm @@ -293,19 +293,51 @@ sub location_autocomplete : Path('/ajax/geocode') { # we want the match even if there's no ambiguity, so recommendation doesn't # disappear when it's the last choice being offered in the autocomplete. $c->stash->{allow_single_geocode_match_strings} = 1; + return $self->_geocode( $c, $c->req->param('term') ); +} + +sub location_lookup : Path('/ajax/lookup_location') { + my ( $self, $c ) = @_; + $c->res->content_type('application/json; charset=utf-8'); + unless ( $c->req->param('term') ) { + $c->res->status(404); + $c->res->body(''); + return; + } + + return $self->_geocode( $c, $c->req->param('term') ); +} + +sub _geocode : Private { + my ( $self, $c, $term ) = @_; + my ( $lat, $long, $suggestions ) = FixMyStreet::Geocode::lookup( $c->req->param('term'), $c ); - my @addresses; - # $error doubles up to return multiple choices by being an array - if ( ref($suggestions) eq 'ARRAY' ) { - foreach (@$suggestions) { - push @addresses, decode_utf8($_->{address}); + + my ($response, @addresses); + + if ( $lat && $long ) { + $response = { latitude => $lat, longitude => $long }; + } else { + if ( ref($suggestions) eq 'ARRAY' ) { + foreach (@$suggestions) { + push @addresses, decode_utf8($_->{address}); + } + $response = { suggestions => \@addresses }; + } else { + $response = { error => $suggestions }; } } + + if ( $c->stash->{allow_single_geocode_match_strings} ) { + $response = \@addresses; + } + my $body = JSON->new->utf8(1)->encode( - \@addresses + $response ); $c->res->body($body); + } __PACKAGE__->meta->make_immutable; diff --git a/perllib/FixMyStreet/App/Controller/Reports.pm b/perllib/FixMyStreet/App/Controller/Reports.pm index eab308054..f4093ef21 100644 --- a/perllib/FixMyStreet/App/Controller/Reports.pm +++ b/perllib/FixMyStreet/App/Controller/Reports.pm @@ -5,6 +5,7 @@ use namespace::autoclean; use File::Slurp; use List::MoreUtils qw(zip); use POSIX qw(strcoll); +use RABX; use mySociety::MaPit; BEGIN { extends 'Catalyst::Controller'; } @@ -356,9 +357,13 @@ sub load_and_group_problems : Private { # A proxy for an external_body $where->{'lower(external_body)'} = lc $c->stash->{body}->name; } elsif ($c->stash->{body}) { - $where->{areas} = { 'like', '%,' . $c->stash->{body}->id . ',%' }; + # XXX FixMyStreet used to have the following line so that reports not + # currently sent anywhere could still be listed in the appropriate + # (body/area), as they were the same. Now they're not, not sure if + # there's a way to do this easily. + #$where->{areas} = { 'like', '%,' . $c->stash->{body}->id . ',%' }; $where->{bodies_str} = [ - undef, + # undef, $c->stash->{body}->id, { 'like', $c->stash->{body}->id . ',%' }, { 'like', '%,' . $c->stash->{body}->id }, @@ -371,6 +376,7 @@ sub load_and_group_problems : Private { 'id', 'bodies_str', 'state', 'areas', 'latitude', 'longitude', 'title', 'cobrand', #{ duration => { extract => "epoch from current_timestamp-lastupdate" } }, #{ age => { extract => "epoch from current_timestamp-confirmed" } }, + { created => { extract => 'epoch from created' } }, { confirmed => { extract => 'epoch from confirmed' } }, { whensent => { extract => 'epoch from whensent' } }, { lastupdate => { extract => 'epoch from lastupdate' } }, @@ -384,10 +390,14 @@ sub load_and_group_problems : Private { $problems = $problems->cursor; # Raw DB cursor for speed my ( %problems, @pins ); - my @cols = ( 'id', 'bodies_str', 'state', 'areas', 'latitude', 'longitude', 'title', 'cobrand', 'confirmed', 'whensent', 'lastupdate', 'photo', 'extra' ); + my @cols = ( 'id', 'bodies_str', 'state', 'areas', 'latitude', 'longitude', 'title', 'cobrand', 'created', 'confirmed', 'whensent', 'lastupdate', 'photo', 'extra' ); while ( my @problem = $problems->next ) { my %problem = zip @cols, @problem; $problem{is_fixed} = FixMyStreet::DB::Result::Problem->fixed_states()->{$problem{state}}; + if ($problem{extra} && $c->cobrand->moniker eq 'zurich') { # Inflate + utf8::encode($problem{extra}) if utf8::is_utf8($problem{extra}); + $problem{extra} = RABX::unserialise($problem{extra}); + } $c->log->debug( $problem{'cobrand'} . ', cobrand is ' . $c->cobrand->moniker ); if ( !$c->stash->{body}->id ) { # An external_body entry diff --git a/perllib/FixMyStreet/DB/ResultSet/AlertType.pm b/perllib/FixMyStreet/DB/ResultSet/AlertType.pm index a502a4a25..5b6b33d94 100644 --- a/perllib/FixMyStreet/DB/ResultSet/AlertType.pm +++ b/perllib/FixMyStreet/DB/ResultSet/AlertType.pm @@ -94,8 +94,9 @@ sub email_alerts ($) { } # this is currently only for new_updates if ($row->{item_text}) { - if ( $row->{alert_user_id} == $row->{user_id} ) { + if ( $cobrand->moniker ne 'zurich' && $row->{alert_user_id} == $row->{user_id} ) { # This is an alert to the same user who made the report - make this a login link + # Don't bother with Zurich which has no accounts my $user = FixMyStreet::App->model('DB::User')->find( { id => $row->{alert_user_id} } ); diff --git a/perllib/FixMyStreet/DB/ResultSet/Problem.pm b/perllib/FixMyStreet/DB/ResultSet/Problem.pm index 897a7e732..8bf0fc93a 100644 --- a/perllib/FixMyStreet/DB/ResultSet/Problem.pm +++ b/perllib/FixMyStreet/DB/ResultSet/Problem.pm @@ -360,7 +360,7 @@ sub send_reports { next unless $sender_count; - if (mySociety::Config::get('STAGING_SITE')) { + if (mySociety::Config::get('STAGING_SITE') && !mySociety::Config::get('SEND_REPORTS_ON_STAGING')) { # on a staging server send emails to ourselves rather than the bodies my @testing_bodies = split( '\|', mySociety::Config::get('TESTING_COUNCILS') ); unless ( grep { $row->bodies_str eq $_ } @testing_bodies ) { diff --git a/perllib/FixMyStreet/SendReport/Email.pm b/perllib/FixMyStreet/SendReport/Email.pm index 2a580c0d5..182c47d56 100644 --- a/perllib/FixMyStreet/SendReport/Email.pm +++ b/perllib/FixMyStreet/SendReport/Email.pm @@ -67,7 +67,7 @@ sub send { my @recips = $self->build_recipient_list( $row, $h ); # on a staging server send emails to ourselves rather than the bodies - if (mySociety::Config::get('STAGING_SITE') && !FixMyStreet->test_mode) { + if (mySociety::Config::get('STAGING_SITE') && !mySociety::Config::get('SEND_REPORTS_ON_STAGING') && !FixMyStreet->test_mode) { @recips = ( mySociety::Config::get('CONTACT_EMAIL') ); } diff --git a/templates/email/zurich/alert-update.txt b/templates/email/zurich/alert-update.txt new file mode 100644 index 000000000..3f8da5f66 --- /dev/null +++ b/templates/email/zurich/alert-update.txt @@ -0,0 +1,11 @@ +Subject: New update on report - '<?=$values['title']?>' + +The following update has been left on this report: + +<?=$values['data']?> + +To view this report on the site, please visit the following URL: + <?=$values['problem_url']?> + +<?=$values['signature']?> + diff --git a/templates/email/zurich/submit-external.txt b/templates/email/zurich/submit-external.txt index 0775f7728..c9a002952 100755..100644 --- a/templates/email/zurich/submit-external.txt +++ b/templates/email/zurich/submit-external.txt @@ -1,8 +1,8 @@ -Subject: FixMyZurich: New report #<?=$values['id']?> +Subject: FixMyZurich: Neue Meldung #<?=$values['id']?> -Dear <?=$values['bodies_name']?>, +Guten Tag<?=$values['bodies_name']?>, -This report has been sent to you by Stadt Zurich to be dealt with. +Diese Meldung wurde Ihnen von der Stadt Zürich gesendet, da es Ihr Zuständigkeitsgebiet betreffen könnte. -Public URL: <?=$values['url']?> +Öffentliche URL: <?=$values['url']?> diff --git a/templates/email/zurich/submit-feedback-pending.txt b/templates/email/zurich/submit-feedback-pending.txt index ff2e8e8b1..fbf9cafb9 100755 --- a/templates/email/zurich/submit-feedback-pending.txt +++ b/templates/email/zurich/submit-feedback-pending.txt @@ -1,10 +1,10 @@ -Subject: FixMyZurich: report #<?=$values['id']?> pending feedback +Subject: FixMyZurich: Meldung #<?=$values['id']?> bereit für Feedback -Dear <?=$values['bodies_name']?>, +Guten Tag <?=$values['bodies_name']?>, -This report has been sent back to you by the subdivision for final response and closure. +Diese Meldung wurde vom Fachbereich abschliessend beantwortet und kann nun auf Fix My Zurich beantwortet und abgeschlossen werden. -Public URL: <?=$values['url']?> +Öffentliche URL: <?=$values['url']?> Admin URL: <?=$values['admin_url']?> diff --git a/templates/email/zurich/submit-in-progress.txt b/templates/email/zurich/submit-in-progress.txt index c8d259e09..809ba4653 100755..100644 --- a/templates/email/zurich/submit-in-progress.txt +++ b/templates/email/zurich/submit-in-progress.txt @@ -1,10 +1,10 @@ -Subject: FixMyZurich: New report #<?=$values['id']?> +Subject: FixMyZurich: Neue Meldung #<?=$values['id']?> -Dear <?=$values['bodies_name']?>, +Guten Tag <?=$values['bodies_name']?>, -This report has been sent to you by your division to be dealt with. +Diese Meldung wurde Ihnen von Ihrer FMZ-Verantworltichen Stelle zugeteilt. -Public URL: <?=$values['url']?> +Öffentliche URL: <?=$values['url']?> Admin URL: <?=$values['admin_url']?> diff --git a/templates/email/zurich/submit.txt b/templates/email/zurich/submit.txt index 752d6c6b4..f55b66e18 100755..100644 --- a/templates/email/zurich/submit.txt +++ b/templates/email/zurich/submit.txt @@ -1,10 +1,10 @@ -Subject: FixMyZurich: New report #<?=$values['id']?> +Subject: FixMyZurich: Neue Meldung #<?=$values['id']?> -Dear <?=$values['bodies_name']?>, +Guten Tag <?=$values['bodies_name']?>, -A new report has been submitted by a user. +Eine neue Meldung wurde erfasst: -Public URL: <?=$values['url']?> +Öffentliche URL: <?=$values['url']?> Admin URL: <?=$values['admin_url']?> diff --git a/templates/web/zurich/faq/faq-de.html b/templates/web/zurich/faq/faq-de-ch.html index a739f1b74..a739f1b74 100755 --- a/templates/web/zurich/faq/faq-de.html +++ b/templates/web/zurich/faq/faq-de-ch.html diff --git a/templates/web/zurich/footer.html b/templates/web/zurich/footer.html index 2e4717360..499923b1c 100644 --- a/templates/web/zurich/footer.html +++ b/templates/web/zurich/footer.html @@ -5,6 +5,12 @@ <div class="nav-wrapper"> <div class="nav-wrapper-2"> <div id="main-nav" role="navigation"> + [% IF c.user_exists %] + <p> + [% tprintf(loc('Hi %s'), c.user.name || c.user.email) %] + </p><p><a href="/auth/sign_out">[% loc('sign out') %]</a> + </p> + [% ELSE %] <ul id="main-menu"> <li><[% IF c.req.uri.path == '/' %]span[% ELSE %]a href="/"[% END %] >[% loc("Report a problem") %]</[% c.req.uri.path == '/' ? 'span' : 'a' %]></li>[% @@ -13,6 +19,7 @@ %]<li><[% IF c.req.uri.path == '/faq' %]span[% ELSE %]a href="/faq"[% END %]>[% loc("Help") %]</[% c.req.uri.path == '/faq' ? 'span' : 'a' %]></li> </ul> + [% END %] </div> </div> </div> diff --git a/templates/web/zurich/header.html b/templates/web/zurich/header.html index fdc4f1800..d47a05a0d 100644 --- a/templates/web/zurich/header.html +++ b/templates/web/zurich/header.html @@ -43,17 +43,6 @@ </div> </header> - <div id="user-meta"> - [% IF c.user_exists %] - <p> - [% tprintf(loc('Hi %s'), c.user.name || c.user.email) %] - <a href="/auth/sign_out">[% loc('sign out') %]</a> - </p> - [% ELSE %] - <!-- <a href="/auth">[% loc('Sign in') %]</a> --> - [% END %] - </div> - [% pre_container_extra %] <div class="container"> diff --git a/templates/web/zurich/report/updates.html b/templates/web/zurich/report/updates.html index 34b65e998..0f9afbf68 100644 --- a/templates/web/zurich/report/updates.html +++ b/templates/web/zurich/report/updates.html @@ -1,15 +1,17 @@ -[% IF problem.state == 'fixed - council' %] -<section class="full-width"> +[% IF problem.state == 'fixed - council' OR problem.state == 'closed' %] <h4 class="static-with-rule">[% loc('Updates') %]</h4> <ul class="issue-list"> <li> <div class="update-wrap"> <div class="update-text"> <p class="meta-2">[% prettify_epoch( problem.lastupdate_local.epoch ) %]</p> + [% IF problem.state == 'fixed - council' %] [% add_links( problem.extra.public_response ) | html_para %] + [% ELSIF problem.state == 'closed' AND problem.external_body %] + <p>[% tprintf( loc('Assigned to %s'), problem.body(c).name ) %]</p> + [% END %] </div> </div> </li> </ul> -</section> [% END %] diff --git a/web/cobrands/zurich/_colours.scss b/web/cobrands/zurich/_colours.scss index d21bc6e38..8187f0c68 100644 --- a/web/cobrands/zurich/_colours.scss +++ b/web/cobrands/zurich/_colours.scss @@ -10,7 +10,7 @@ $primary_text: #fff; $col_click_map: $lighter_blue; $col_click_map_dark: darken($lighter_blue, 20%); -$col_fixed_label: #00BD08; +$col_fixed_label: #648721; $col_fixed_label_dark: #4B8304; // Zurich admin tables: @@ -21,4 +21,4 @@ $table_heading_border_col: #7a7a7a; $table_heading_col: #fff; $table_heading_underline_col: #393939; $button_col: #fff; -$button_bg_col: #a1a1a1; // also search bar (tables)
\ No newline at end of file +$button_bg_col: #a1a1a1; // also search bar (tables) diff --git a/web/cobrands/zurich/base.scss b/web/cobrands/zurich/base.scss index 28ce8295c..61bcbacb7 100644 --- a/web/cobrands/zurich/base.scss +++ b/web/cobrands/zurich/base.scss @@ -18,3 +18,55 @@ color: #666; font-size: 85%; } + +// Simplify the banner to just be a floated box. Colours etc. still +// inherited from the base stylesheet. +.banner { + p { + position: static; + float: right; + font-weight: bold; + padding: 1em; + margin: 0; + text-transform: uppercase; + text-align: center; + &:before { + display: none; + } + } +} + +// No grey background or other bits +// The amount of resetting here shows this needs refactoring, so that it is FMS making the changes +// Also look into why full-width pulls things out, but then it is its children +// that have to recompensate with padding. +h4.static-with-rule { + color: black; + font-size: 1em; + font-weight: bold; + text-transform: none; + background: none; + padding-left: 0; + padding-right: 0; + border-top: 0.25em solid #e5e5e5; +} +.issue-list { + border-bottom: none; + li { + padding-left: 0; + padding-right: 0; + background: none; + } +} + +.issue-list-a { + border-bottom: none; + li { + background: none; + .text { + .img { + padding-right: 1em; + } + } + } +} diff --git a/web/cobrands/zurich/layout.scss b/web/cobrands/zurich/layout.scss index 82ae2be75..cfd945034 100644 --- a/web/cobrands/zurich/layout.scss +++ b/web/cobrands/zurich/layout.scss @@ -47,6 +47,27 @@ body.mappage { } } +.nav-wrapper-2 p:first-child { + font-weight: bold; + margin-top: 0.75em; +} +.nav-wrapper-2 p { + line-height: 1.2; + color: white; + clear: right; + float: right; + margin: 0 1em 0 0; + font-size: 85%; + a { + color: white; + font-size: 85%; + } + a:hover { + color: white; + } +} + +/* TODO Change the main-nav to be what is wanted */ #main-nav { ul#main-menu { li { @@ -78,3 +99,21 @@ body.twothirdswidthpage { } } +// Zurich base has made this a more simple construct. The top is to pull it up +// over the content padding to be attached to the top of the content area. +// We reduce the padding as no pin image, and change the background. +.banner { + top: -1em; + p { + &#fixed { + padding-top: 2em; + @include background(linear-gradient(#769643, #648721 4px)); + } + } +} +.ie6 .banner p { + &#fixed { + background-image: none; + } +} + |